[sheepdog] [PATCH] sheepfs: disable http interface if http is not enabled
Liu Yuan
namei.unix at gmail.com
Mon Jan 27 05:02:02 CET 2014
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
configure.ac | 8 +++++---
sheepfs/Makefile.am | 11 ++++++++++-
sheepfs/core.c | 2 ++
sheepfs/sheepfs.h | 5 +++++
4 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index e30d32e..949d339 100644
--- a/configure.ac
+++ b/configure.ac
@@ -333,10 +333,12 @@ if test "x${enable_sheepfs}" = xyes; then
AC_CHECK_HEADERS([fuse.h],,
AC_MSG_ERROR(fuse.h header missing),
[#define _FILE_OFFSET_BITS 64])
- AC_CHECK_LIB([curl], [curl_easy_init],,
- AC_MSG_ERROR(libcurl not found))
- AC_CHECK_HEADERS([curl/curl.h],,
+ if test "x${enable_http}" = xyes; then
+ AC_CHECK_LIB([curl], [curl_easy_init],,
+ AC_MSG_ERROR(libcurl not found))
+ AC_CHECK_HEADERS([curl/curl.h],,
AC_MSG_ERROR(curl.h header missing))
+ fi
AC_DEFINE_UNQUOTED([HAVE_SHEEPFS], 1, [have sheepfs])
PACKAGE_FEATURES="$PACKAGE_FEATURES sheepfs"
PKG_CHECK_EXISTS(fuse >= 2.8.0,
diff --git a/sheepfs/Makefile.am b/sheepfs/Makefile.am
index a5e84ba..3391d3c 100644
--- a/sheepfs/Makefile.am
+++ b/sheepfs/Makefile.am
@@ -24,9 +24,18 @@ AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include
sbin_PROGRAMS = sheepfs
sheepfs_SOURCES = core.c cluster.c vdi.c shadow_file.c volume.c node.c \
- config.c http.c
+ config.c
+
+if BUILD_HTTP
+sheepfs_SOURCES += http.c
+endif
sheepfs_LDADD = ../lib/libsheepdog.a $(fuse_LIBS) $(LIBS) -lpthread -lcurl
+
+if BUILD_HTTP
+sheepfs_LDADD += -lcurl
+endif
+
sheepfs_DEPENDENCIES = ../lib/libsheepdog.a
noinst_HEADERS = sheepfs.h
diff --git a/sheepfs/core.c b/sheepfs/core.c
index fd89fab..a0ea936 100644
--- a/sheepfs/core.c
+++ b/sheepfs/core.c
@@ -78,6 +78,7 @@ static struct sheepfs_file_operation {
config_sheep_info_get_size },
[OP_VOLUME] = { volume_read, volume_write, volume_get_size,
volume_sync, volume_open },
+#ifdef HAVE_HTTP
[OP_HTTP_ADDRESS] = { http_address_read, http_address_write,
http_address_get_size },
[OP_HTTP_OBJECT] = { NULL, http_object_write },
@@ -85,6 +86,7 @@ static struct sheepfs_file_operation {
object_unlink },
[OP_CONTAINER] = { NULL, NULL, NULL, NULL, NULL, NULL,
container_rmdir },
+#endif
};
__printf(3, 4)
diff --git a/sheepfs/sheepfs.h b/sheepfs/sheepfs.h
index 9748238..e5bf40e 100644
--- a/sheepfs/sheepfs.h
+++ b/sheepfs/sheepfs.h
@@ -103,7 +103,12 @@ int config_sheep_info_write(const char *, const char *, size_t, off_t);
size_t config_sheep_info_get_size(const char *path);
/* http.c */
+#ifdef HAVE_HTTP
int create_http_layout(void);
+#else
+static inline int create_http_layout(void) { return 0; }
+#endif
+
int http_address_read(const char *path, char *buf, size_t size, off_t ignore);
int http_address_write(const char *path, const char *buf, size_t size,
off_t ignore);
--
1.8.1.2
More information about the sheepdog
mailing list