[patch tabled 1/8] Shuffle fields of storage nodes

2010-11-28 Thread Pete Zaitcev
This helps copy-paste safer later, mostly.

Signed-off-by: Pete Zaitcev zait...@redhat.com

---
 server/object.c  |2 -
 server/storage.c |   79 ++---
 server/tabled.h  |   12 +++---
 3 files changed, 53 insertions(+), 40 deletions(-)

commit 2d0645834468ea056223bee52d679c983945ce65
Author: Pete Zaitcev zait...@yahoo.com
Date:   Thu Nov 11 11:24:00 2010 -0700

Field rearrangements. Layering violation improvement.

diff --git a/server/object.c b/server/object.c
index 71d5377..2920811 100644
--- a/server/object.c
+++ b/server/object.c
@@ -1008,7 +1008,7 @@ static bool object_get_poke(struct client *cli)
ssize_t bytes;
 
/* The checks for in_len in caller should protect us, but let's see. */
-   if (!cli-in_ce.stc) {
+   if (!cli-in_ce.key) {
applog(LOG_ERR, read on closed chunk, in_len %ld,
   (long) cli-in_len);
return false;
diff --git a/server/storage.c b/server/storage.c
index fc232ba..c472961 100644
--- a/server/storage.c
+++ b/server/storage.c
@@ -91,8 +91,8 @@ static void stor_read_event(int fd, short events, void 
*userdata)
struct open_chunk *cep = userdata;
 
cep-r_armed = false;   /* no EV_PERSIST */
-   if (cep-rcb)
-   (*cep-rcb)(cep);
+   if (cep-ocb)
+   (*cep-ocb)(cep);
 }
 
 static void stor_write_event(int fd, short events, void *userdata)
@@ -100,8 +100,8 @@ static void stor_write_event(int fd, short events, void 
*userdata)
struct open_chunk *cep = userdata;
 
cep-w_armed = false;   /* no EV_PERSIST */
-   if (cep-wcb)
-   (*cep-wcb)(cep);
+   if (cep-ocb)
+   (*cep-ocb)(cep);
 }
 
 /*
@@ -131,6 +131,8 @@ int stor_put_start(struct open_chunk *cep, void 
(*cb)(struct open_chunk *),
 {
char stckey[STOR_KEY_SLEN+1];
 
+   if (cep-key)
+   return -EBUSY;
if (!cep-stc)
return -EINVAL;
 
@@ -145,9 +147,10 @@ int stor_put_start(struct open_chunk *cep, void 
(*cb)(struct open_chunk *),
   cep-node-id, stckey, (long long) size);
return -EIO;
}
-   cep-wtogo = size;
-   cep-wkey = key;
-   cep-wcb = cb;
+   cep-size = size;
+   cep-done = 0;
+   cep-key = key;
+   cep-ocb = cb;
event_set(cep-wevt, cep-wfd, EV_WRITE, stor_write_event, cep);
event_base_set(cep-evbase, cep-wevt);
 
@@ -167,13 +170,15 @@ int stor_open_read(struct open_chunk *cep, void 
(*cb)(struct open_chunk *),
char stckey[STOR_KEY_SLEN+1];
uint64_t size;
 
+   if (cep-key)
+   return -EBUSY;
if (!cep-stc)
return -EINVAL;
 
-   if (cep-rsize  cep-roff != cep-rsize) {
+   if (cep-size  cep-done != cep-size) {
applog(LOG_ERR, Unfinished Get (%ld,%ld),
-  (long)cep-roff, (long)cep-rsize);
-   cep-rsize = 0;
+  (long)cep-done, (long)cep-size);
+   cep-size = 0;
}
 
sprintf(stckey, stor_key_fmt, (unsigned long long) key);
@@ -184,9 +189,10 @@ int stor_open_read(struct open_chunk *cep, void 
(*cb)(struct open_chunk *),
return -EIO;
}
*psize = size;
-   cep-rsize = size;
-   cep-roff = 0;
-   cep-rcb = cb;
+   cep-size = size;
+   cep-done = 0;
+   cep-key = key;
+   cep-ocb = cb;
event_set(cep-revt, cep-rfd, EV_READ, stor_read_event, cep);
event_base_set(cep-evbase, cep-revt);
 
@@ -213,12 +219,14 @@ void stor_close(struct open_chunk *cep)
event_del(cep-revt);
cep-r_armed = false;
}
-   cep-rsize = 0;
+   cep-size = 0;
 
if (cep-w_armed) {
event_del(cep-wevt);
cep-w_armed = false;
}
+
+   cep-key = 0;
 }
 
 /*
@@ -251,40 +259,44 @@ void stor_abort(struct open_chunk *cep)
if (debugging)
applog(LOG_INFO, Failed to reopen Chunk nid %u (%d),
   cep-node-id, rc);
+
+   cep-size = 0;
+   cep-done = 0;
+   cep-key = 0;
return;
}
 
-   if (cep-wtogo) {
-   sprintf(stckey, stor_key_fmt, (unsigned long long) cep-wkey);
+   if (cep-done != cep-size) {
+   sprintf(stckey, stor_key_fmt, (unsigned long long) cep-key);
stc_delz(cep-stc, stckey);
-   cep-wtogo = 0;
}
 
if (cep-r_armed) {
event_del(cep-revt);
cep-r_armed = false;
}
-   cep-rsize = 0;
 
if (cep-w_armed) {
event_del(cep-wevt);
cep-w_armed = false;
}
+
+   cep-size = 0;
+   cep-done = 0;
+
+   cep-key = 0;
 }
 
 ssize_t stor_put_buf(struct open_chunk *cep, void *data, size_t len)
 {
  

[patch tabled 2/8] Comment storage.c

2010-11-28 Thread Pete Zaitcev
I have a vague memory that It should be ok to return meant something
related to the way our event dispatch worked, but I cannot recall any
details. Ergo, useless comment.

Signed-off-by: Pete Zaitcev zait...@redhat.com

---
 server/storage.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

commit 8c4bed7bd56a5bb2c3a654a494a6bb545f0d7db2
Author: Pete Zaitcev zait...@yahoo.com
Date:   Thu Nov 11 15:46:59 2010 -0700

Update comments.

diff --git a/server/storage.c b/server/storage.c
index c472961..5c6e3a7 100644
--- a/server/storage.c
+++ b/server/storage.c
@@ -161,9 +161,6 @@ int stor_put_start(struct open_chunk *cep, void 
(*cb)(struct open_chunk *),
return 0;
 }
 
-/*
- * It should be ok to return
- */
 int stor_open_read(struct open_chunk *cep, void (*cb)(struct open_chunk *),
   uint64_t key, uint64_t *psize)
 {
@@ -379,6 +376,9 @@ int stor_obj_del(struct storage_node *stn, uint64_t key)
return rc;
 }
 
+/*
+ * XXX WTF?! This accidentially tests a node instead of object! FIXME
+ */
 bool stor_obj_test(struct open_chunk *cep, uint64_t key)
 {
struct st_keylist *klist;
--
To unsubscribe from this list: send the line unsubscribe hail-devel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch tabled 5/8] Rename in_storage to in_socket

2010-11-28 Thread Pete Zaitcev
The clause is called Socket, so the old name was confusing.

Signed-off-by: Pete Zaitcev zait...@redhat.com

---
 server/storparse.c |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

commit 6536a193f1befcf3eed8b18535990e8566518479
Author: Pete Zaitcev zait...@yahoo.com
Date:   Sun Nov 28 16:29:54 2010 -0700

Rename in_storage to in_socket, because Socket.

diff --git a/server/storparse.c b/server/storparse.c
index 5ed15ea..cbffe0f 100644
--- a/server/storparse.c
+++ b/server/storparse.c
@@ -36,7 +36,7 @@ struct config_context {
boolin_chunk;
boolin_chunk_reported;
 
-   boolin_storage;
+   boolin_socket;
boolstor_encrypt;
char*stor_port;
char*stor_host;
@@ -82,8 +82,8 @@ static void cfg_elm_start (GMarkupParseContext *context,
}
 
if (!strcmp(element_name, Socket)) {
-   if (!cc-in_storage)
-   cc-in_storage = true;
+   if (!cc-in_socket)
+   cc-in_socket = true;
else
applog(LOG_ERR, %s: Nested Socket, cc-fname);
}
@@ -95,7 +95,7 @@ static void cfg_elm_start (GMarkupParseContext *context,
}
 }
 
-static void cfg_elm_end_storage(struct config_context *cc)
+static void cfg_elm_end_socket(struct config_context *cc)
 {
if (cc-text) {
applog(LOG_WARNING, %s: Extra text in Socket element: \%s\,
@@ -206,8 +206,8 @@ static void cfg_elm_end (GMarkupParseContext *context,
}
 
else if (!strcmp(element_name, Socket)) {
-   cfg_elm_end_storage(cc);
-   cc-in_storage = false;
+   cfg_elm_end_socket(cc);
+   cc-in_socket = false;
}
 
else if (!strcmp(element_name, Geo)) {
@@ -272,7 +272,7 @@ static void cfg_elm_end (GMarkupParseContext *context,
return;
}
 
-   if (cc-in_storage) {
+   if (cc-in_socket) {
n = strtol(cc-text, NULL, 10);
if (n  0  n  65536) {
free(cc-stor_port);
@@ -296,7 +296,7 @@ static void cfg_elm_end (GMarkupParseContext *context,
return;
}
 
-   if (cc-in_storage) {
+   if (cc-in_socket) {
free(cc-stor_host);
cc-stor_host = cc-text;
cc-text = NULL;
--
To unsubscribe from this list: send the line unsubscribe hail-devel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch tabled 4/8] Split out chunk back-end

2010-11-28 Thread Pete Zaitcev
This patch is careful not to change anything but the strictly necessary
parts in the actual code.

Signed-off-by: Pete Zaitcev zait...@redhat.com

---
 server/Makefile.am  |3 
 server/stor_chunk.c |  409 ++
 server/storage.c|  377 --
 server/tabled.h |3 
 4 files changed, 414 insertions(+), 378 deletions(-)

commit 1eaf18ff243a2d4e291d0af2f13ec425ab0757c0
Author: Pete Zaitcev zait...@yahoo.com
Date:   Thu Nov 11 16:30:52 2010 -0700

Split out the chunk-specific part, byte for byte, no changes.

diff --git a/server/Makefile.am b/server/Makefile.am
index 5b53a0a..52beec4 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -5,7 +5,8 @@ sbin_PROGRAMS   = tabled tdbadm
 
 tabled_SOURCES = tabled.h  \
  bucket.c cldu.c config.c metarep.c object.c replica.c \
- server.c status.c storage.c storparse.c util.c
+ server.c status.c storage.c storparse.c \
+ stor_chunk.c util.c
 tabled_LDADD   = ../lib/libtdb.a   \
  @HAIL_LIBS@ @PCRE_LIBS@ @GLIB_LIBS@ \
  @CRYPTO_LIBS@ @DB4_LIBS@ @EVENT_LIBS@ @SSL_LIBS@
diff --git a/server/stor_chunk.c b/server/stor_chunk.c
new file mode 100644
index 000..815adcf
--- /dev/null
+++ b/server/stor_chunk.c
@@ -0,0 +1,409 @@
+
+/*
+ * Copyright 2010 Red Hat, Inc.
+ *
+ * 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.
+ *
+ * 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; see the file COPYING.  If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#define _GNU_SOURCE
+#include tabled-config.h
+
+#include sys/types.h
+// #include sys/socket.h
+#include errno.h
+#include syslog.h
+#include string.h
+#include glib.h
+#include event.h
+#include chunkc.h
+#include netdb.h
+#include tabled.h
+
+static const char stor_key_fmt[] = %016llx;
+#define STOR_KEY_SLEN  16
+
+static int stor_new_stc(struct storage_node *stn, struct st_client **stcp)
+{
+   struct st_client *stc;
+   struct sockaddr_in *a4;
+   struct sockaddr_in6 *a6;
+   unsigned short port;
+
+   if (stn-addr.sin6_family == AF_INET) {
+   a4 = (struct sockaddr_in *) stn-addr;
+   port = ntohs(a4-sin_port);
+   } else if (stn-addr.sin6_family == AF_INET6) {
+   a6 = stn-addr;
+   port = ntohs(a6-sin6_port);
+   } else {
+   return -EINVAL;
+   }
+
+   stc = stc_new(stn-hostname, port,
+ tabled_srv.chunk_user, tabled_srv.chunk_key,
+ false);
+   if (!stc)
+   return -EDOM;
+
+   if (!stc_table_openz(stc, tabled, CHF_TBL_CREAT)) {
+   stc_free(stc);
+   return -EDOM;
+   }
+
+   *stcp = stc;
+   return 0;
+}
+
+static void stor_read_event(int fd, short events, void *userdata)
+{
+   struct open_chunk *cep = userdata;
+
+   cep-r_armed = false;   /* no EV_PERSIST */
+   if (cep-ocb)
+   (*cep-ocb)(cep);
+}
+
+static void stor_write_event(int fd, short events, void *userdata)
+{
+   struct open_chunk *cep = userdata;
+
+   cep-w_armed = false;   /* no EV_PERSIST */
+   if (cep-ocb)
+   (*cep-ocb)(cep);
+}
+
+/*
+ * Open *cep using stn, set up chunk session if needed.
+ */
+static int chunk_open(struct open_chunk *cep, struct storage_node *stn,
+ struct event_base *ev_base)
+{
+   int rc;
+
+   if (cep-stc)
+   return 0;
+
+   if ((rc = stor_new_stc(stn, cep-stc))  0)
+   return rc;
+
+   cep-evbase = ev_base;
+   cep-node = stor_node_get(stn);
+
+   /* cep-stc-verbose = 1; */
+
+   return 0;
+}
+
+static int chunk_put_start(struct open_chunk *cep,
+  void (*cb)(struct open_chunk *),
+  uint64_t key, uint64_t size)
+{
+   char stckey[STOR_KEY_SLEN+1];
+
+   if (cep-key)
+   return -EBUSY;
+   if (!cep-stc)
+   return -EINVAL;
+
+   /*
+* Set up the putting.
+*/
+   sprintf(stckey, stor_key_fmt, (unsigned long long) key);
+   if (!stc_put_startz(cep-stc, stckey, size, cep-wfd, 0)) {
+   if (debugging)
+   applog(LOG_INFO,
+  stor nid %u put %s new for %lld error,
+  cep-node-id, stckey, (long long) size);
+   return 

[patch tabled 6/8] Add filesystem back-end

2010-11-28 Thread Pete Zaitcev
This patch adds the first new back-end and makes some changes to the way
nodes are added, to make the invariants of storage_node more sensible.

The filesystem back-end itself is not intended for production use,
so it makes no attempt to run any asynchronous transfers.

We also add a test. Note that this differs from the preliminary versions
of this patch. We used to add both chunk and fs back-ends, so that tabled
replicates to both. This makes sense as a test of store path, but on
retrieval tabled selects any one of available storage nodes with the
object, randomly. It creates gaps in test coverage in any given run.
Therefore, we test two back-end types sequentially now.

Signed-off-by: Pete Zaitcev zait...@redhat.com

---
 server/Makefile.am   |2 
 server/stor_chunk.c  |   21 -
 server/stor_fs.c |  498 +
 server/storage.c |  157 ++--
 server/storparse.c   |   97 +++
 server/tabled.h  |   31 ++
 test/Makefile.am |3 
 test/be_fs-test.conf |5 
 test/combo-redux |   74 ++
 test/prep-db |4 
 test/start-daemon|1 
 test/stop-daemon |9 
 12 files changed, 835 insertions(+), 67 deletions(-)

commit bccedeedabbe713e4053afa185314b3f57f3d204
Author: Pete Zaitcev zait...@yahoo.com
Date:   Sun Nov 28 17:58:05 2010 -0700

Add fs back-end, with a test.

diff --git a/server/Makefile.am b/server/Makefile.am
index 52beec4..71bcb35 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -6,7 +6,7 @@ sbin_PROGRAMS   = tabled tdbadm
 tabled_SOURCES = tabled.h  \
  bucket.c cldu.c config.c metarep.c object.c replica.c \
  server.c status.c storage.c storparse.c \
- stor_chunk.c util.c
+ stor_chunk.c stor_fs.c util.c
 tabled_LDADD   = ../lib/libtdb.a   \
  @HAIL_LIBS@ @PCRE_LIBS@ @GLIB_LIBS@ \
  @CRYPTO_LIBS@ @DB4_LIBS@ @EVENT_LIBS@ @SSL_LIBS@
diff --git a/server/stor_chunk.c b/server/stor_chunk.c
index 815adcf..7462a9c 100644
--- a/server/stor_chunk.c
+++ b/server/stor_chunk.c
@@ -31,8 +31,7 @@
 #include netdb.h
 #include tabled.h
 
-static const char stor_key_fmt[] = %016llx;
-#define STOR_KEY_SLEN  16
+static const char stor_key_fmt[] = STOR_KEY_FMT;
 
 static int stor_new_stc(struct storage_node *stn, struct st_client **stcp)
 {
@@ -66,24 +65,6 @@ static int stor_new_stc(struct storage_node *stn, struct 
st_client **stcp)
return 0;
 }
 
-static void stor_read_event(int fd, short events, void *userdata)
-{
-   struct open_chunk *cep = userdata;
-
-   cep-r_armed = false;   /* no EV_PERSIST */
-   if (cep-ocb)
-   (*cep-ocb)(cep);
-}
-
-static void stor_write_event(int fd, short events, void *userdata)
-{
-   struct open_chunk *cep = userdata;
-
-   cep-w_armed = false;   /* no EV_PERSIST */
-   if (cep-ocb)
-   (*cep-ocb)(cep);
-}
-
 /*
  * Open *cep using stn, set up chunk session if needed.
  */
diff --git a/server/stor_fs.c b/server/stor_fs.c
new file mode 100644
index 000..b433a67
--- /dev/null
+++ b/server/stor_fs.c
@@ -0,0 +1,498 @@
+
+/*
+ * Copyright 2010 Red Hat, Inc.
+ *
+ * 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.
+ *
+ * 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; see the file COPYING.  If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#define _GNU_SOURCE
+#include tabled-config.h
+
+#include sys/types.h
+#include sys/stat.h
+#include errno.h
+#include fcntl.h
+#include syslog.h
+#include string.h
+#include glib.h
+#include event.h
+#include tabled.h
+
+static const char stor_key_fmt[] = STOR_KEY_FMT;
+
+static char *fs_obj_pathname(const char *base, uint64_t key)
+{
+   enum { PREFIX_LEN = 3 };
+   char prefix[PREFIX_LEN + 1];
+   char stckey[STOR_KEY_SLEN+1];
+   char *s;
+   int rc;
+
+   /* we know that stckey is going to be longer than PREFIX_LEN */
+   sprintf(stckey, stor_key_fmt, (unsigned long long) key);
+   memcpy(prefix, stckey, PREFIX_LEN);
+   prefix[PREFIX_LEN] = 0;
+
+   rc = asprintf(s, %s/%s/%s, base, prefix, stckey + PREFIX_LEN);
+   if (rc  0)
+   goto err_out;
+
+   return s;
+
+err_out:
+   return NULL;
+}
+
+static char *fs_ctl_pathname(const char *base, const char *file)
+{
+   char *s;
+   int rc;
+
+   rc = asprintf(s, %s/%s, base, file);
+   if (rc  0)
+   return NULL;
+   return s;
+}
+

[patch tabled 8/8] Add Swift back-end

2010-11-28 Thread Pete Zaitcev
This patch allows to use tabled with OpenStack Swift object store as if it
were our chunkserver, with some extra tricks. The configuration has to be
entred manually into CLD, just like in case of filesystem back-end.

The code is fairly experimental, so it retains extra messages.

Also, since Swift authorizes by plaintext passwords, support for SSL is
essential, but is currently missing.

There is no build-time test for this, because it would require us to
depend on OpenStack, which is untenable.

Signed-off-by: Pete Zaitcev zait...@redhat.com

---
 doc/etc.tabled.conf  |5 
 server/Makefile.am   |7 
 server/object.c  |2 
 server/replica.c |4 
 server/server.c  |8 
 server/stor_swift.c  | 1420 +
 server/storage.c |3 
 server/storparse.c   |7 
 server/tabled.h  |   30 
 test/swift-test.conf |8 
 10 files changed, 1487 insertions(+), 7 deletions(-)

commit f24e2bd00d10f074ca9c6f62794b0838bc2de9b5
Author: Pete Zaitcev zait...@yahoo.com
Date:   Sun Nov 28 18:07:44 2010 -0700

Add Swift back-end. Sadly, no test.

diff --git a/doc/etc.tabled.conf b/doc/etc.tabled.conf
index 5112e8a..6e82fe4 100644
--- a/doc/etc.tabled.conf
+++ b/doc/etc.tabled.conf
@@ -43,8 +43,9 @@
  /CLD
 --
 
-ChunkUsertest/ChunkUser
-ChunkKeytest/ChunkKey
+!-- swift-auth-add-user -K devauth -a tabled tester1 tester1 --
+ChunkUsertester1/ChunkUser
+ChunkKeytester1/ChunkKey
 
 !-- Monitoring interface. Best is not to expose this to Internet. --
 StatusPort8084/StatusPort
diff --git a/server/Makefile.am b/server/Makefile.am
index 71bcb35..5651ec2 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -1,15 +1,16 @@
 
-INCLUDES   = -I$(top_srcdir)/include @GLIB_CFLAGS@ @HAIL_CFLAGS@
+INCLUDES   = -I$(top_srcdir)/include   \
+ @LIBCURL_CPPFLAGS@ @GLIB_CFLAGS@ @HAIL_CFLAGS@
 
 sbin_PROGRAMS  = tabled tdbadm
 
 tabled_SOURCES = tabled.h  \
  bucket.c cldu.c config.c metarep.c object.c replica.c \
  server.c status.c storage.c storparse.c \
- stor_chunk.c stor_fs.c util.c
+ stor_chunk.c stor_fs.c stor_swift.c util.c
 tabled_LDADD   = ../lib/libtdb.a   \
  @HAIL_LIBS@ @PCRE_LIBS@ @GLIB_LIBS@ \
- @CRYPTO_LIBS@ @DB4_LIBS@ @EVENT_LIBS@ @SSL_LIBS@
+ @CRYPTO_LIBS@ @DB4_LIBS@ @EVENT_LIBS@ @LIBCURL@ @SSL_LIBS@
 
 tdbadm_SOURCES = tdbadm.c
 tdbadm_LDADD   = ../lib/libtdb.a @GLIB_LIBS@ @DB4_LIBS@
diff --git a/server/object.c b/server/object.c
index 2920811..44f8d5c 100644
--- a/server/object.c
+++ b/server/object.c
@@ -700,6 +700,8 @@ static struct open_chunk *open_chunk1(struct storage_node 
*stnode,
applog(LOG_ERR, OOM);
goto err_alloc;
}
+   INIT_LIST_HEAD(ochunk-evt_list);
+   INIT_LIST_HEAD(ochunk-buf_list);
 
rc = stor_open(ochunk, stnode, tabled_srv.evbase_main);
if (rc != 0) {
diff --git a/server/replica.c b/server/replica.c
index 7c31112..0d3f7a2 100644
--- a/server/replica.c
+++ b/server/replica.c
@@ -90,6 +90,10 @@ static struct rep_job *job_alloc(size_t klen, struct 
db_obj_key *key)
job = malloc(len);
if (job) {
memset(job, 0, sizeof(struct rep_job));
+   INIT_LIST_HEAD(job-in_ce.evt_list);
+   INIT_LIST_HEAD(job-in_ce.buf_list);
+   INIT_LIST_HEAD(job-out_ce.evt_list);
+   INIT_LIST_HEAD(job-out_ce.buf_list);
memcpy(job+1, key, klen);
job-klen = klen;
job-key = (struct db_obj_key *)(job+1);
diff --git a/server/server.c b/server/server.c
index ba3e00a..de6975f 100644
--- a/server/server.c
+++ b/server/server.c
@@ -46,6 +46,7 @@
 #include openssl/md5.h
 #include openssl/hmac.h
 #include openssl/ssl.h
+#include curl/curl.h
 #include elist.h
 #include chunkc.h
 #include cldc.h
@@ -1245,6 +1246,8 @@ static struct client *cli_alloc(bool is_status)
applog(LOG_ERR, out of memory);
return NULL;
}
+   INIT_LIST_HEAD(cli-in_ce.evt_list);
+   INIT_LIST_HEAD(cli-in_ce.buf_list);
 
atcp_wr_init(cli-wst, libevent_wr_ops, cli-write_ev, cli);
 
@@ -2079,6 +2082,11 @@ int main (int argc, char *argv[])
SSL_library_init();
SSL_load_error_strings();
 
+   if (curl_global_init(CURL_GLOBAL_ALL)) {
+   fprintf(stderr, curl_global_init failed\n);
+   return 1;
+   }
+
stc_init();
 
cld_init();
diff --git a/server/stor_swift.c b/server/stor_swift.c
new file mode 100644
index 000..253c92c
--- /dev/null
+++ b/server/stor_swift.c
@@ -0,0 +1,1420 @@
+
+/*
+ * Copyright 2010 Red Hat, Inc.
+ *
+ * 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.
+ *
+ * This program is distributed 

[patch tabled 7/8] Clenaup stor_chunk.c

2010-11-28 Thread Pete Zaitcev
Signed-off-by: Pete Zaitcev zait...@redhat.com

---
 server/stor_chunk.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

commit ca0920cfe5978839ee1a35d6096754a87db6f9ac
Author: Pete Zaitcev zait...@yahoo.com
Date:   Sun Nov 28 18:01:24 2010 -0700

Cleanup stor_chunk.

diff --git a/server/stor_chunk.c b/server/stor_chunk.c
index 7462a9c..9111750 100644
--- a/server/stor_chunk.c
+++ b/server/stor_chunk.c
@@ -21,14 +21,12 @@
 #include tabled-config.h
 
 #include sys/types.h
-// #include sys/socket.h
 #include errno.h
 #include syslog.h
 #include string.h
 #include glib.h
 #include event.h
 #include chunkc.h
-#include netdb.h
 #include tabled.h
 
 static const char stor_key_fmt[] = STOR_KEY_FMT;
@@ -117,7 +115,7 @@ static int chunk_put_start(struct open_chunk *cep,
event_base_set(cep-evbase, cep-wevt);
 
if (debugging)
-   applog(LOG_INFO, stor nid %u put %s new for %lld,
+   applog(LOG_INFO, stor nid %u put %s size %lld,
   cep-node-id, stckey, (long long) size);
 
return 0;
@@ -249,7 +247,7 @@ static ssize_t chunk_put_buf(struct open_chunk *cep, void 
*data, size_t len)
int rc;
 
if (cep-done + len  cep-size) {
-   applog(LOG_ERR, Put size %ld remaining %ld,
+   /* P3 */ applog(LOG_ERR, Put length %ld remaining %ld,
   (long) len, (long) (cep-size - cep-done));
if (cep-done == cep-size)
return -EIO;/* will spin otherwise, better error */
--
To unsubscribe from this list: send the line unsubscribe hail-devel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html