From: Lee Duncan <[email protected]>
Missed include file buffer.h on the first round.
These changes will support other clients, like
open-iscsi, using include files from isns rather
than their own copies.
---
Makefile.in | 24 ++++++++
buffer.c | 2 +-
buffer.h | 141 -----------------------------------------------
include/libisns/attrs.h | 2 +-
include/libisns/buffer.h | 141 +++++++++++++++++++++++++++++++++++++++++++++++
security.h | 2 +-
socket.c | 2 +-
socket.h | 2 +-
8 files changed, 170 insertions(+), 146 deletions(-)
delete mode 100644 buffer.h
create mode 100644 include/libisns/buffer.h
diff --git a/Makefile.in b/Makefile.in
index 674ff55204dc..8ccb96e4b4f7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -2,16 +2,20 @@ prefix = @prefix@
exec_prefix = @exec_prefix@
sbindir = @sbindir@
mandir = @mandir@
+libdir = @libdir@
etcdir = /etc
vardir = /var/lib/isns
systemddir = $(prefix)/lib/systemd/system
datarootdir = @datarootdir@
+includedir = @includedir@
SBINDIR = $(DESTDIR)$(sbindir)
CFGDIR = $(DESTDIR)$(etcdir)/isns
MANDIR = $(DESTDIR)$(mandir)
VARDIR = $(DESTDIR)$(vardir)
SYSTEMDDIR = $(DESTDIR)$(systemddir)
+LIBDIR = $(DESTDIR)$(libdir)
+INCDIR = $(DESTDIR)$(includedir)/libisns
CC = @CC@
CPPFLAGS= @CPPFLAGS@
@@ -63,6 +67,16 @@ LIBOBJS = server.o \
util.o \
bitvector.o \
mdebug.o
+HDRS = include/libisns/attrs.h \
+ include/libisns/buffer.h \
+ include/libisns/isns.h \
+ include/libisns/isns-proto.h \
+ include/libisns/message.h \
+ include/libisns/paths.h \
+ include/libisns/source.h \
+ include/libisns/types.h \
+ include/libisns/util.h
+
SECLINK = @SECLIBS@
SLPLINK = @SLPLIBS@
SLPLIN = @SLPLIBS@
@@ -88,6 +102,16 @@ install:
$(INSTALL) -m 644 isnsd.service $(SYSTEMDDIR)
$(INSTALL) -m 644 isnsd.socket $(SYSTEMDDIR)
+install_hdrs:
+ @echo '*** Installing Open-iSNS header files ***'
+ $(INSTALL) -m 755 -d $(INCDIR)
+ $(INSTALL) -m 644 $(HDRS) $(INCDIR)
+
+install_lib: $(LIB)
+ @echo '*** Installing Open-iSNS developer files ***'
+ $(INSTALL) -m 755 -d $(LIBDIR)
+ $(INSTALL) -m 644 $(LIB) $(LIBDIR)
+
clean distclean::
rm -f *.o $(LIB) isnsd isnsadm isnsdd bitvector *~
diff --git a/buffer.c b/buffer.c
index 503d4ce48839..8e8e5af06746 100644
--- a/buffer.c
+++ b/buffer.c
@@ -11,7 +11,7 @@
#include <err.h>
#include <unistd.h>
#include <netinet/in.h> /* ntohl&htonl */
-#include "buffer.h"
+#include <libisns/buffer.h>
#include <libisns/util.h> /* htonll */
static int buf_drain(buf_t *bp);
diff --git a/buffer.h b/buffer.h
deleted file mode 100644
index 75ba9108d066..000000000000
--- a/buffer.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Buffer handling functions
- *
- * Copyright (C) 2003-2006, Olaf Kirch <[email protected]>
- */
-
-#ifndef BUFFER_H
-#define BUFFER_H
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <stdint.h>
-
-typedef struct isns_buf {
- struct isns_buf * next;
- unsigned char * base;
- unsigned int head, tail, size, max_size;
- unsigned int write_mode : 1,
- allocated : 1;
- int fd;
-
- /* Anonymous union for misc stuff */
- union {
- struct {
- struct sockaddr_storage addr;
- socklen_t addrlen;
- };
- };
-} buf_t;
-
-extern buf_t * buf_open(const char *, int);
-extern buf_t * buf_alloc(size_t);
-extern buf_t * buf_dup(const buf_t *);
-extern void buf_init(buf_t *, void *, size_t);
-extern void buf_init_empty(buf_t *, size_t);
-extern void buf_set(buf_t *, void *, size_t);
-
-extern void buf_clear(buf_t *);
-extern void buf_close(buf_t *);
-extern void buf_destroy(buf_t *);
-extern void buf_free(buf_t *);
-extern void buf_list_free(buf_t *);
-
-extern int buf_get(buf_t *, void *, size_t);
-extern int buf_get32(buf_t *, uint32_t *);
-extern int buf_get64(buf_t *, uint64_t *);
-extern int buf_gets(buf_t *, char *, size_t);
-extern int buf_put(buf_t *, const void *, size_t);
-extern int buf_put32(buf_t *, uint32_t);
-extern int buf_put64(buf_t *, uint64_t);
-extern int buf_puts(buf_t *, const char *);
-extern int buf_putc(buf_t *, int);
-extern int buf_read(buf_t *, int);
-extern int buf_seek(buf_t *bp, off_t offset);
-extern int buf_truncate(buf_t *, size_t);
-extern void buf_compact(buf_t *);
-extern buf_t * buf_split(buf_t **to_split, size_t len);
-extern int __buf_resize(buf_t *, size_t);
-
-extern void buf_list_append(buf_t **, buf_t *);
-
-static inline size_t
-buf_avail(const buf_t *bp)
-{
- return bp->tail - bp->head;
-}
-
-static inline size_t
-buf_tailroom(const buf_t *bp)
-{
- return bp->max_size - bp->tail;
-}
-
-static inline size_t
-buf_size(const buf_t *bp)
-{
- return bp->size;
-}
-
-static inline void *
-buf_head(const buf_t *bp)
-{
- return bp->base + bp->head;
-}
-
-static inline void *
-buf_tail(const buf_t *bp)
-{
- return bp->base + bp->tail;
-}
-
-static inline int
-buf_reserve(buf_t *bp, size_t len)
-{
- if (bp->head != bp->tail)
- return 0;
- if (bp->max_size - bp->head < len)
- return 0;
- bp->head += len;
- bp->tail += len;
- return 1;
-}
-
-static inline int
-buf_pull(buf_t *bp, size_t len)
-{
- if (len > buf_avail(bp))
- return 0;
- bp->head += len;
- return 1;
-}
-
-static inline void *
-buf_push(buf_t *bp, size_t len)
-{
- if (bp->max_size - bp->tail < len)
- return NULL;
-
- if (bp->tail + len > bp->size
- && !__buf_resize(bp, bp->tail + len))
- return NULL;
-
- bp->tail += len;
- return bp->base + bp->tail - len;
-}
-
-static inline void *
-buf_push_head(buf_t *bp, size_t len)
-{
- if (bp->head < len)
- return NULL;
-
- if (bp->tail > bp->size
- && !__buf_resize(bp, bp->tail))
- return NULL;
-
- bp->head -= len;
- return bp->base + bp->head;
-}
-
-#endif /* BUFFER_H */
diff --git a/include/libisns/attrs.h b/include/libisns/attrs.h
index d137886cf2de..e10f1d839915 100644
--- a/include/libisns/attrs.h
+++ b/include/libisns/attrs.h
@@ -8,7 +8,7 @@
#define ISNS_ATTRS_H
#include <netinet/in.h>
-#include "buffer.h"
+#include <libisns/buffer.h>
#include <libisns/isns.h>
/*
diff --git a/include/libisns/buffer.h b/include/libisns/buffer.h
new file mode 100644
index 000000000000..75ba9108d066
--- /dev/null
+++ b/include/libisns/buffer.h
@@ -0,0 +1,141 @@
+/*
+ * Buffer handling functions
+ *
+ * Copyright (C) 2003-2006, Olaf Kirch <[email protected]>
+ */
+
+#ifndef BUFFER_H
+#define BUFFER_H
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <stdint.h>
+
+typedef struct isns_buf {
+ struct isns_buf * next;
+ unsigned char * base;
+ unsigned int head, tail, size, max_size;
+ unsigned int write_mode : 1,
+ allocated : 1;
+ int fd;
+
+ /* Anonymous union for misc stuff */
+ union {
+ struct {
+ struct sockaddr_storage addr;
+ socklen_t addrlen;
+ };
+ };
+} buf_t;
+
+extern buf_t * buf_open(const char *, int);
+extern buf_t * buf_alloc(size_t);
+extern buf_t * buf_dup(const buf_t *);
+extern void buf_init(buf_t *, void *, size_t);
+extern void buf_init_empty(buf_t *, size_t);
+extern void buf_set(buf_t *, void *, size_t);
+
+extern void buf_clear(buf_t *);
+extern void buf_close(buf_t *);
+extern void buf_destroy(buf_t *);
+extern void buf_free(buf_t *);
+extern void buf_list_free(buf_t *);
+
+extern int buf_get(buf_t *, void *, size_t);
+extern int buf_get32(buf_t *, uint32_t *);
+extern int buf_get64(buf_t *, uint64_t *);
+extern int buf_gets(buf_t *, char *, size_t);
+extern int buf_put(buf_t *, const void *, size_t);
+extern int buf_put32(buf_t *, uint32_t);
+extern int buf_put64(buf_t *, uint64_t);
+extern int buf_puts(buf_t *, const char *);
+extern int buf_putc(buf_t *, int);
+extern int buf_read(buf_t *, int);
+extern int buf_seek(buf_t *bp, off_t offset);
+extern int buf_truncate(buf_t *, size_t);
+extern void buf_compact(buf_t *);
+extern buf_t * buf_split(buf_t **to_split, size_t len);
+extern int __buf_resize(buf_t *, size_t);
+
+extern void buf_list_append(buf_t **, buf_t *);
+
+static inline size_t
+buf_avail(const buf_t *bp)
+{
+ return bp->tail - bp->head;
+}
+
+static inline size_t
+buf_tailroom(const buf_t *bp)
+{
+ return bp->max_size - bp->tail;
+}
+
+static inline size_t
+buf_size(const buf_t *bp)
+{
+ return bp->size;
+}
+
+static inline void *
+buf_head(const buf_t *bp)
+{
+ return bp->base + bp->head;
+}
+
+static inline void *
+buf_tail(const buf_t *bp)
+{
+ return bp->base + bp->tail;
+}
+
+static inline int
+buf_reserve(buf_t *bp, size_t len)
+{
+ if (bp->head != bp->tail)
+ return 0;
+ if (bp->max_size - bp->head < len)
+ return 0;
+ bp->head += len;
+ bp->tail += len;
+ return 1;
+}
+
+static inline int
+buf_pull(buf_t *bp, size_t len)
+{
+ if (len > buf_avail(bp))
+ return 0;
+ bp->head += len;
+ return 1;
+}
+
+static inline void *
+buf_push(buf_t *bp, size_t len)
+{
+ if (bp->max_size - bp->tail < len)
+ return NULL;
+
+ if (bp->tail + len > bp->size
+ && !__buf_resize(bp, bp->tail + len))
+ return NULL;
+
+ bp->tail += len;
+ return bp->base + bp->tail - len;
+}
+
+static inline void *
+buf_push_head(buf_t *bp, size_t len)
+{
+ if (bp->head < len)
+ return NULL;
+
+ if (bp->tail > bp->size
+ && !__buf_resize(bp, bp->tail))
+ return NULL;
+
+ bp->head -= len;
+ return bp->base + bp->head;
+}
+
+#endif /* BUFFER_H */
diff --git a/security.h b/security.h
index bbab3fe73631..b55800351493 100644
--- a/security.h
+++ b/security.h
@@ -8,7 +8,7 @@
#define ISNS_SECURITY_H
#include <openssl/evp.h>
-#include "buffer.h"
+#include <libisns/buffer.h>
#include <libisns/util.h>
/*
diff --git a/socket.c b/socket.c
index bd6d6b441077..4f16fe68b7b5 100644
--- a/socket.c
+++ b/socket.c
@@ -20,7 +20,7 @@
#include <fcntl.h>
#include "config.h"
-#include "buffer.h"
+#include <libisns/buffer.h>
#include <libisns/isns.h>
#include "socket.h"
#include "security.h"
diff --git a/socket.h b/socket.h
index a721a3b3c81f..364fa659ad3c 100644
--- a/socket.h
+++ b/socket.h
@@ -8,7 +8,7 @@
#define ISNS_SOCKET_H
#include <libisns/isns.h>
-#include "buffer.h"
+#include <libisns/buffer.h>
#include <libisns/message.h>
struct isns_partial_msg {
--
2.1.4
--
You received this message because you are subscribed to the Google Groups
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.