summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--endian.h42
-rw-r--r--pgfuse.c4
-rw-r--r--pgsql.c20
-rw-r--r--redhat/pgfuse.spec17
-rw-r--r--testpgsql.c3
5 files changed, 57 insertions, 29 deletions
diff --git a/endian.h b/endian.h
new file mode 100644
index 0000000..589ad17
--- /dev/null
+++ b/endian.h
@@ -0,0 +1,42 @@
+/*
+ Copyright (C) 2012 Andreas Baumann <abaumann@yahoo.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _PGFUSE_ENDIAN_H
+#define _PGFUSE_ENDIAN_H
+
+#if defined(__linux__)
+#include <endian.h>
+#ifndef htobe64
+#include <byteswap.h>
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define htobe64( x ) bswap_64 ( x )
+#define be64toh( x ) bswap_64( x )
+#else
+#define htobe64( x ) ( x )
+#define be64toh( x ) ( x )
+#endif
+#endif
+#elif defined(__FreeBSD__) || defined(__NetBSD__)
+#include <sys/endian.h>
+#elif defined(__OpenBSD__)
+#include <sys/types.h>
+#define be64toh( x ) betoh64(x)
+#else
+#error unknown platform for htobe64 and be64toh, port first!
+#endif
+
+#endif
diff --git a/pgfuse.c b/pgfuse.c
index 464e1af..1fa9ded 100644
--- a/pgfuse.c
+++ b/pgfuse.c
@@ -32,7 +32,7 @@
#include <pthread.h> /* for pthread_self */
-#if FUSE_VERSION < 28
+#if FUSE_VERSION < 21
#error Currently only written for newest FUSE APIversion (FUSE_VERSION 28)
#endif
@@ -1284,8 +1284,10 @@ static struct fuse_operations pgfuse_oper = {
.lock = NULL,
.utimens = pgfuse_utimens,
.bmap = NULL,
+#if FUSE_VERSION >= 28
.ioctl = NULL,
.poll = NULL
+#endif
};
/* --- parse arguments --- */
diff --git a/pgsql.c b/pgsql.c
index 6b83dd0..fc8b154 100644
--- a/pgsql.c
+++ b/pgsql.c
@@ -25,25 +25,7 @@
#include <arpa/inet.h> /* for htonl, ntohl */
#include <stdint.h> /* for uint64_t */
-/* for be64toh and htobe64 */
-#if defined(__linux__)
-#include <endian.h>
-#ifndef be64toh
-#include <byteswap.h>
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define htobe64( x ) bswap_64 ( x )
-#define be64toh( x ) bswap_64( x )
-#else
-#define htobe64( x ) ( x )
-#define be64toh( x ) ( x )
-#endif
-#endif
-#elif defined(__FreeBSD__) || defined(__NetBSD__)
-#include <sys/endian.h>
-#elif defined(__OpenBSD__)
-#include <sys/types.h>
-#define be64toh( x ) betoh64(x)
-#endif
+#include "endian.h" /* for be64toh and htobe64 */
#include "config.h" /* compiled in defaults */
diff --git a/redhat/pgfuse.spec b/redhat/pgfuse.spec
index 34f0338..1293912 100644
--- a/redhat/pgfuse.spec
+++ b/redhat/pgfuse.spec
@@ -3,14 +3,8 @@
# Copyright (C) 2012
%define rhel 0
-%define rhel4 0
%define rhel5 0
%define rhel6 0
-%if 0%{?rhel_version} >= 400 && 0%{?rhel_version} <= 499
-%define dist rhel4
-%define rhel 1
-%define rhel4 1
-%endif
%if 0%{?rhel_version} >= 500 && 0%{?rhel_version} <= 599
%define dist rhel5
%define rhel 1
@@ -93,8 +87,15 @@ BuildRequires: pkg-config
%endif
BuildRequires: gcc
-BuildRequires: postgresql-devel >= 7.0
-Requires: postgresql-libs >= 7.0
+
+%if %{rhel5}
+BuildRequires: postgresql84-devel
+Requires: postgresql84-server
+%else
+BuildRequires: postgresql-devel >= 8.4
+Requires: postgresql-libs >= 8.4
+%endif
+
BuildRequires: fuse-devel >= 2.6
Requires: fuse-libs >= 2.6
Requires: fuse >= 2.6
diff --git a/testpgsql.c b/testpgsql.c
index b4e943f..3159e2d 100644
--- a/testpgsql.c
+++ b/testpgsql.c
@@ -21,9 +21,10 @@
#include <string.h> /* for strcmp */
#include <stdbool.h> /* for bool */
#include <stdint.h> /* for uint64_t */
-#include <endian.h> /* for be64toh (GNU/BSD-ism, but easy to port if necessary) */
#include <sys/time.h> /* for struct timespec, gettimeofday */
+#include "endian.h" /* for be64toh */
+
/* January 1, 2000, 00:00:00 UTC (in Unix epoch seconds) */
#define POSTGRES_EPOCH_DATE 946684800