summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/call-stub.c5064
-rw-r--r--libglusterfs/src/checksum.c32
-rw-r--r--libglusterfs/src/common-utils.c1804
-rw-r--r--libglusterfs/src/compat-errno.c1593
-rw-r--r--libglusterfs/src/compat.c582
-rw-r--r--libglusterfs/src/dict.c2808
-rw-r--r--libglusterfs/src/event.c1516
-rw-r--r--libglusterfs/src/fd.c320
-rw-r--r--libglusterfs/src/gf-dirent.c60
-rw-r--r--libglusterfs/src/globals.c123
-rw-r--r--libglusterfs/src/graph-print.c20
-rw-r--r--libglusterfs/src/graph.c2
-rw-r--r--libglusterfs/src/hashfn.c274
-rw-r--r--libglusterfs/src/inode.c16
-rw-r--r--libglusterfs/src/iobuf.c79
-rw-r--r--libglusterfs/src/latency.c8
-rw-r--r--libglusterfs/src/rbthash.c1
-rw-r--r--libglusterfs/src/scheduler.c98
-rw-r--r--libglusterfs/src/stack.c40
-rw-r--r--libglusterfs/src/statedump.c142
-rw-r--r--libglusterfs/src/syncop.c53
-rw-r--r--libglusterfs/src/syscall.c94
-rw-r--r--libglusterfs/src/timer.c44
23 files changed, 7380 insertions, 7393 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c
index d3b29a39ad7..50a06502c8d 100644
--- a/libglusterfs/src/call-stub.c
+++ b/libglusterfs/src/call-stub.c
@@ -31,171 +31,171 @@
static call_stub_t *
stub_new (call_frame_t *frame,
- char wind,
- glusterfs_fop_t fop)
+ char wind,
+ glusterfs_fop_t fop)
{
- call_stub_t *new = NULL;
+ call_stub_t *new = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- new = mem_get0 (frame->this->ctx->stub_mem_pool);
- GF_VALIDATE_OR_GOTO ("call-stub", new, out);
+ new = mem_get0 (frame->this->ctx->stub_mem_pool);
+ GF_VALIDATE_OR_GOTO ("call-stub", new, out);
- new->frame = frame;
- new->wind = wind;
- new->fop = fop;
- new->stub_mem_pool = frame->this->ctx->stub_mem_pool;
- INIT_LIST_HEAD (&new->list);
+ new->frame = frame;
+ new->wind = wind;
+ new->fop = fop;
+ new->stub_mem_pool = frame->this->ctx->stub_mem_pool;
+ INIT_LIST_HEAD (&new->list);
out:
- return new;
+ return new;
}
call_stub_t *
fop_lookup_stub (call_frame_t *frame,
- fop_lookup_t fn,
- loc_t *loc,
- dict_t *xattr_req)
+ fop_lookup_t fn,
+ loc_t *loc,
+ dict_t *xattr_req)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
- stub = stub_new (frame, 1, GF_FOP_LOOKUP);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_LOOKUP);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.lookup.fn = fn;
+ stub->args.lookup.fn = fn;
- if (xattr_req)
- stub->args.lookup.xattr_req = dict_ref (xattr_req);
+ if (xattr_req)
+ stub->args.lookup.xattr_req = dict_ref (xattr_req);
- loc_copy (&stub->args.lookup.loc, loc);
+ loc_copy (&stub->args.lookup.loc, loc);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_lookup_cbk_stub (call_frame_t *frame,
- fop_lookup_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- inode_t *inode,
- struct iatt *buf,
+ fop_lookup_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ inode_t *inode,
+ struct iatt *buf,
dict_t *dict,
struct iatt *postparent)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_LOOKUP);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_LOOKUP);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.lookup_cbk.fn = fn;
- stub->args.lookup_cbk.op_ret = op_ret;
- stub->args.lookup_cbk.op_errno = op_errno;
- if (inode)
- stub->args.lookup_cbk.inode = inode_ref (inode);
- if (buf)
- stub->args.lookup_cbk.buf = *buf;
- if (dict)
- stub->args.lookup_cbk.dict = dict_ref (dict);
+ stub->args.lookup_cbk.fn = fn;
+ stub->args.lookup_cbk.op_ret = op_ret;
+ stub->args.lookup_cbk.op_errno = op_errno;
+ if (inode)
+ stub->args.lookup_cbk.inode = inode_ref (inode);
+ if (buf)
+ stub->args.lookup_cbk.buf = *buf;
+ if (dict)
+ stub->args.lookup_cbk.dict = dict_ref (dict);
if (postparent)
stub->args.lookup_cbk.postparent = *postparent;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_stat_stub (call_frame_t *frame,
- fop_stat_t fn,
- loc_t *loc)
+ fop_stat_t fn,
+ loc_t *loc)
{
- call_stub_t *stub = NULL;
-
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
+ call_stub_t *stub = NULL;
+
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
- stub = stub_new (frame, 1, GF_FOP_STAT);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_STAT);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.stat.fn = fn;
- loc_copy (&stub->args.stat.loc, loc);
+ stub->args.stat.fn = fn;
+ loc_copy (&stub->args.stat.loc, loc);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_stat_cbk_stub (call_frame_t *frame,
- fop_stat_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- struct iatt *buf)
+ fop_stat_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct iatt *buf)
{
- call_stub_t *stub = NULL;
-
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ call_stub_t *stub = NULL;
+
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_STAT);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_STAT);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.stat_cbk.fn = fn;
- stub->args.stat_cbk.op_ret = op_ret;
- stub->args.stat_cbk.op_errno = op_errno;
- if (op_ret == 0)
- stub->args.stat_cbk.buf = *buf;
+ stub->args.stat_cbk.fn = fn;
+ stub->args.stat_cbk.op_ret = op_ret;
+ stub->args.stat_cbk.op_errno = op_errno;
+ if (op_ret == 0)
+ stub->args.stat_cbk.buf = *buf;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_fstat_stub (call_frame_t *frame,
- fop_fstat_t fn,
- fd_t *fd)
+ fop_fstat_t fn,
+ fd_t *fd)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 1, GF_FOP_FSTAT);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_FSTAT);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.fstat.fn = fn;
+ stub->args.fstat.fn = fn;
- if (fd)
- stub->args.fstat.fd = fd_ref (fd);
+ if (fd)
+ stub->args.fstat.fd = fd_ref (fd);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_fstat_cbk_stub (call_frame_t *frame,
- fop_fstat_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- struct iatt *buf)
+ fop_fstat_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct iatt *buf)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_FSTAT);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_FSTAT);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.fstat_cbk.fn = fn;
- stub->args.fstat_cbk.op_ret = op_ret;
- stub->args.fstat_cbk.op_errno = op_errno;
- if (buf)
- stub->args.fstat_cbk.buf = *buf;
+ stub->args.fstat_cbk.fn = fn;
+ stub->args.fstat_cbk.op_ret = op_ret;
+ stub->args.fstat_cbk.op_errno = op_errno;
+ if (buf)
+ stub->args.fstat_cbk.buf = *buf;
out:
- return stub;
+ return stub;
}
@@ -203,503 +203,503 @@ out:
call_stub_t *
fop_truncate_stub (call_frame_t *frame,
- fop_truncate_t fn,
- loc_t *loc,
- off_t off)
+ fop_truncate_t fn,
+ loc_t *loc,
+ off_t off)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
- stub = stub_new (frame, 1, GF_FOP_TRUNCATE);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_TRUNCATE);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.truncate.fn = fn;
- loc_copy (&stub->args.truncate.loc, loc);
- stub->args.truncate.off = off;
+ stub->args.truncate.fn = fn;
+ loc_copy (&stub->args.truncate.loc, loc);
+ stub->args.truncate.off = off;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_truncate_cbk_stub (call_frame_t *frame,
- fop_truncate_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- struct iatt *prebuf,
+ fop_truncate_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct iatt *prebuf,
struct iatt *postbuf)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_TRUNCATE);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_TRUNCATE);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.truncate_cbk.fn = fn;
- stub->args.truncate_cbk.op_ret = op_ret;
- stub->args.truncate_cbk.op_errno = op_errno;
- if (prebuf)
- stub->args.truncate_cbk.prebuf = *prebuf;
+ stub->args.truncate_cbk.fn = fn;
+ stub->args.truncate_cbk.op_ret = op_ret;
+ stub->args.truncate_cbk.op_errno = op_errno;
+ if (prebuf)
+ stub->args.truncate_cbk.prebuf = *prebuf;
if (postbuf)
stub->args.truncate_cbk.postbuf = *postbuf;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_ftruncate_stub (call_frame_t *frame,
- fop_ftruncate_t fn,
- fd_t *fd,
- off_t off)
+ fop_ftruncate_t fn,
+ fd_t *fd,
+ off_t off)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 1, GF_FOP_FTRUNCATE);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_FTRUNCATE);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.ftruncate.fn = fn;
- if (fd)
- stub->args.ftruncate.fd = fd_ref (fd);
+ stub->args.ftruncate.fn = fn;
+ if (fd)
+ stub->args.ftruncate.fd = fd_ref (fd);
- stub->args.ftruncate.off = off;
+ stub->args.ftruncate.off = off;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_ftruncate_cbk_stub (call_frame_t *frame,
- fop_ftruncate_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- struct iatt *prebuf,
+ fop_ftruncate_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct iatt *prebuf,
struct iatt *postbuf)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_FTRUNCATE);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_FTRUNCATE);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.ftruncate_cbk.fn = fn;
- stub->args.ftruncate_cbk.op_ret = op_ret;
- stub->args.ftruncate_cbk.op_errno = op_errno;
- if (prebuf)
- stub->args.ftruncate_cbk.prebuf = *prebuf;
- if (postbuf)
- stub->args.ftruncate_cbk.postbuf = *postbuf;
+ stub->args.ftruncate_cbk.fn = fn;
+ stub->args.ftruncate_cbk.op_ret = op_ret;
+ stub->args.ftruncate_cbk.op_errno = op_errno;
+ if (prebuf)
+ stub->args.ftruncate_cbk.prebuf = *prebuf;
+ if (postbuf)
+ stub->args.ftruncate_cbk.postbuf = *postbuf;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_access_stub (call_frame_t *frame,
- fop_access_t fn,
- loc_t *loc,
- int32_t mask)
+ fop_access_t fn,
+ loc_t *loc,
+ int32_t mask)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
- stub = stub_new (frame, 1, GF_FOP_ACCESS);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_ACCESS);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.access.fn = fn;
- loc_copy (&stub->args.access.loc, loc);
- stub->args.access.mask = mask;
+ stub->args.access.fn = fn;
+ loc_copy (&stub->args.access.loc, loc);
+ stub->args.access.mask = mask;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_access_cbk_stub (call_frame_t *frame,
- fop_access_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno)
+ fop_access_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_ACCESS);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_ACCESS);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.access_cbk.fn = fn;
- stub->args.access_cbk.op_ret = op_ret;
- stub->args.access_cbk.op_errno = op_errno;
+ stub->args.access_cbk.fn = fn;
+ stub->args.access_cbk.op_ret = op_ret;
+ stub->args.access_cbk.op_errno = op_errno;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_readlink_stub (call_frame_t *frame,
- fop_readlink_t fn,
- loc_t *loc,
- size_t size)
+ fop_readlink_t fn,
+ loc_t *loc,
+ size_t size)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
-
- stub = stub_new (frame, 1, GF_FOP_READLINK);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
- stub->args.readlink.fn = fn;
- loc_copy (&stub->args.readlink.loc, loc);
- stub->args.readlink.size = size;
+ stub = stub_new (frame, 1, GF_FOP_READLINK);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ stub->args.readlink.fn = fn;
+ loc_copy (&stub->args.readlink.loc, loc);
+ stub->args.readlink.size = size;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_readlink_cbk_stub (call_frame_t *frame,
- fop_readlink_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- const char *path,
+ fop_readlink_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ const char *path,
struct iatt *sbuf)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_READLINK);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_READLINK);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.readlink_cbk.fn = fn;
- stub->args.readlink_cbk.op_ret = op_ret;
- stub->args.readlink_cbk.op_errno = op_errno;
- if (path)
- stub->args.readlink_cbk.buf = gf_strdup (path);
+ stub->args.readlink_cbk.fn = fn;
+ stub->args.readlink_cbk.op_ret = op_ret;
+ stub->args.readlink_cbk.op_errno = op_errno;
+ if (path)
+ stub->args.readlink_cbk.buf = gf_strdup (path);
if (sbuf)
stub->args.readlink_cbk.sbuf = *sbuf;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_mknod_stub (call_frame_t *frame, fop_mknod_t fn,
- loc_t *loc, mode_t mode, dev_t rdev, dict_t *params)
+ loc_t *loc, mode_t mode, dev_t rdev, dict_t *params)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
- stub = stub_new (frame, 1, GF_FOP_MKNOD);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_MKNOD);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.mknod.fn = fn;
- loc_copy (&stub->args.mknod.loc, loc);
- stub->args.mknod.mode = mode;
- stub->args.mknod.rdev = rdev;
+ stub->args.mknod.fn = fn;
+ loc_copy (&stub->args.mknod.loc, loc);
+ stub->args.mknod.mode = mode;
+ stub->args.mknod.rdev = rdev;
if (params)
stub->args.mknod.params = dict_ref (params);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_mknod_cbk_stub (call_frame_t *frame,
- fop_mknod_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- inode_t *inode,
+ fop_mknod_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ inode_t *inode,
struct iatt *buf,
struct iatt *preparent,
struct iatt *postparent)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_MKNOD);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_MKNOD);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.mknod_cbk.fn = fn;
- stub->args.mknod_cbk.op_ret = op_ret;
- stub->args.mknod_cbk.op_errno = op_errno;
- if (inode)
- stub->args.mknod_cbk.inode = inode_ref (inode);
- if (buf)
- stub->args.mknod_cbk.buf = *buf;
+ stub->args.mknod_cbk.fn = fn;
+ stub->args.mknod_cbk.op_ret = op_ret;
+ stub->args.mknod_cbk.op_errno = op_errno;
+ if (inode)
+ stub->args.mknod_cbk.inode = inode_ref (inode);
+ if (buf)
+ stub->args.mknod_cbk.buf = *buf;
if (preparent)
stub->args.mknod_cbk.preparent = *preparent;
if (postparent)
stub->args.mknod_cbk.postparent = *postparent;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_mkdir_stub (call_frame_t *frame, fop_mkdir_t fn,
- loc_t *loc, mode_t mode, dict_t *params)
+ loc_t *loc, mode_t mode, dict_t *params)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
- stub = stub_new (frame, 1, GF_FOP_MKDIR);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_MKDIR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.mkdir.fn = fn;
- loc_copy (&stub->args.mkdir.loc, loc);
- stub->args.mkdir.mode = mode;
+ stub->args.mkdir.fn = fn;
+ loc_copy (&stub->args.mkdir.loc, loc);
+ stub->args.mkdir.mode = mode;
if (params)
stub->args.mkdir.params = dict_ref (params);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_mkdir_cbk_stub (call_frame_t *frame,
- fop_mkdir_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- inode_t *inode,
+ fop_mkdir_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ inode_t *inode,
struct iatt *buf,
struct iatt *preparent,
struct iatt *postparent)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_MKDIR);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_MKDIR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.mkdir_cbk.fn = fn;
- stub->args.mkdir_cbk.op_ret = op_ret;
- stub->args.mkdir_cbk.op_errno = op_errno;
- if (inode)
- stub->args.mkdir_cbk.inode = inode_ref (inode);
- if (buf)
- stub->args.mkdir_cbk.buf = *buf;
+ stub->args.mkdir_cbk.fn = fn;
+ stub->args.mkdir_cbk.op_ret = op_ret;
+ stub->args.mkdir_cbk.op_errno = op_errno;
+ if (inode)
+ stub->args.mkdir_cbk.inode = inode_ref (inode);
+ if (buf)
+ stub->args.mkdir_cbk.buf = *buf;
if (preparent)
stub->args.mkdir_cbk.preparent = *preparent;
if (postparent)
stub->args.mkdir_cbk.postparent = *postparent;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_unlink_stub (call_frame_t *frame,
- fop_unlink_t fn,
- loc_t *loc)
+ fop_unlink_t fn,
+ loc_t *loc)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
- stub = stub_new (frame, 1, GF_FOP_UNLINK);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_UNLINK);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.unlink.fn = fn;
- loc_copy (&stub->args.unlink.loc, loc);
+ stub->args.unlink.fn = fn;
+ loc_copy (&stub->args.unlink.loc, loc);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_unlink_cbk_stub (call_frame_t *frame,
- fop_unlink_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
+ fop_unlink_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
struct iatt *preparent,
struct iatt *postparent)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_UNLINK);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_UNLINK);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.unlink_cbk.fn = fn;
- stub->args.unlink_cbk.op_ret = op_ret;
- stub->args.unlink_cbk.op_errno = op_errno;
+ stub->args.unlink_cbk.fn = fn;
+ stub->args.unlink_cbk.op_ret = op_ret;
+ stub->args.unlink_cbk.op_errno = op_errno;
if (preparent)
stub->args.unlink_cbk.preparent = *preparent;
if (postparent)
stub->args.unlink_cbk.postparent = *postparent;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_rmdir_stub (call_frame_t *frame, fop_rmdir_t fn,
- loc_t *loc, int flags)
+ loc_t *loc, int flags)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
- stub = stub_new (frame, 1, GF_FOP_RMDIR);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_RMDIR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.rmdir.fn = fn;
- loc_copy (&stub->args.rmdir.loc, loc);
+ stub->args.rmdir.fn = fn;
+ loc_copy (&stub->args.rmdir.loc, loc);
stub->args.rmdir.flags = flags;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_rmdir_cbk_stub (call_frame_t *frame,
- fop_rmdir_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
+ fop_rmdir_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
struct iatt *preparent,
struct iatt *postparent)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_RMDIR);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_RMDIR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.rmdir_cbk.fn = fn;
- stub->args.rmdir_cbk.op_ret = op_ret;
- stub->args.rmdir_cbk.op_errno = op_errno;
+ stub->args.rmdir_cbk.fn = fn;
+ stub->args.rmdir_cbk.op_ret = op_ret;
+ stub->args.rmdir_cbk.op_errno = op_errno;
if (preparent)
stub->args.rmdir_cbk.preparent = *preparent;
if (postparent)
stub->args.rmdir_cbk.postparent = *postparent;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_symlink_stub (call_frame_t *frame, fop_symlink_t fn,
- const char *linkname, loc_t *loc, dict_t *params)
+ const char *linkname, loc_t *loc, dict_t *params)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
- GF_VALIDATE_OR_GOTO ("call-stub", linkname, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", linkname, out);
- stub = stub_new (frame, 1, GF_FOP_SYMLINK);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_SYMLINK);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.symlink.fn = fn;
- stub->args.symlink.linkname = gf_strdup (linkname);
- loc_copy (&stub->args.symlink.loc, loc);
+ stub->args.symlink.fn = fn;
+ stub->args.symlink.linkname = gf_strdup (linkname);
+ loc_copy (&stub->args.symlink.loc, loc);
if (params)
stub->args.symlink.params = dict_ref (params);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_symlink_cbk_stub (call_frame_t *frame,
- fop_symlink_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- inode_t *inode,
+ fop_symlink_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ inode_t *inode,
struct iatt *buf,
struct iatt *preparent,
struct iatt *postparent)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_SYMLINK);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_SYMLINK);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.symlink_cbk.fn = fn;
- stub->args.symlink_cbk.op_ret = op_ret;
- stub->args.symlink_cbk.op_errno = op_errno;
- if (inode)
- stub->args.symlink_cbk.inode = inode_ref (inode);
- if (buf)
- stub->args.symlink_cbk.buf = *buf;
+ stub->args.symlink_cbk.fn = fn;
+ stub->args.symlink_cbk.op_ret = op_ret;
+ stub->args.symlink_cbk.op_errno = op_errno;
+ if (inode)
+ stub->args.symlink_cbk.inode = inode_ref (inode);
+ if (buf)
+ stub->args.symlink_cbk.buf = *buf;
if (preparent)
stub->args.symlink_cbk.preparent = *preparent;
if (postparent)
stub->args.symlink_cbk.postparent = *postparent;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_rename_stub (call_frame_t *frame,
- fop_rename_t fn,
- loc_t *oldloc,
- loc_t *newloc)
+ fop_rename_t fn,
+ loc_t *oldloc,
+ loc_t *newloc)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", oldloc, out);
- GF_VALIDATE_OR_GOTO ("call-stub", newloc, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", oldloc, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", newloc, out);
- stub = stub_new (frame, 1, GF_FOP_RENAME);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_RENAME);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.rename.fn = fn;
- loc_copy (&stub->args.rename.old, oldloc);
- loc_copy (&stub->args.rename.new, newloc);
+ stub->args.rename.fn = fn;
+ loc_copy (&stub->args.rename.old, oldloc);
+ loc_copy (&stub->args.rename.new, newloc);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_rename_cbk_stub (call_frame_t *frame,
- fop_rename_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- struct iatt *buf,
+ fop_rename_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct iatt *buf,
struct iatt *preoldparent,
struct iatt *postoldparent,
struct iatt *prenewparent,
struct iatt *postnewparent)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_RENAME);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_RENAME);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.rename_cbk.fn = fn;
- stub->args.rename_cbk.op_ret = op_ret;
- stub->args.rename_cbk.op_errno = op_errno;
- if (buf)
- stub->args.rename_cbk.buf = *buf;
+ stub->args.rename_cbk.fn = fn;
+ stub->args.rename_cbk.op_ret = op_ret;
+ stub->args.rename_cbk.op_errno = op_errno;
+ if (buf)
+ stub->args.rename_cbk.buf = *buf;
if (preoldparent)
stub->args.rename_cbk.preoldparent = *preoldparent;
if (postoldparent)
@@ -709,333 +709,333 @@ fop_rename_cbk_stub (call_frame_t *frame,
if (postnewparent)
stub->args.rename_cbk.postnewparent = *postnewparent;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_link_stub (call_frame_t *frame,
- fop_link_t fn,
- loc_t *oldloc,
- loc_t *newloc)
+ fop_link_t fn,
+ loc_t *oldloc,
+ loc_t *newloc)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", oldloc, out);
- GF_VALIDATE_OR_GOTO ("call-stub", newloc, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", oldloc, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", newloc, out);
- stub = stub_new (frame, 1, GF_FOP_LINK);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_LINK);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.link.fn = fn;
- loc_copy (&stub->args.link.oldloc, oldloc);
- loc_copy (&stub->args.link.newloc, newloc);
+ stub->args.link.fn = fn;
+ loc_copy (&stub->args.link.oldloc, oldloc);
+ loc_copy (&stub->args.link.newloc, newloc);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_link_cbk_stub (call_frame_t *frame,
- fop_link_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- inode_t *inode,
+ fop_link_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ inode_t *inode,
struct iatt *buf,
struct iatt *preparent,
struct iatt *postparent)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_LINK);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_LINK);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.link_cbk.fn = fn;
- stub->args.link_cbk.op_ret = op_ret;
- stub->args.link_cbk.op_errno = op_errno;
- if (inode)
- stub->args.link_cbk.inode = inode_ref (inode);
- if (buf)
- stub->args.link_cbk.buf = *buf;
+ stub->args.link_cbk.fn = fn;
+ stub->args.link_cbk.op_ret = op_ret;
+ stub->args.link_cbk.op_errno = op_errno;
+ if (inode)
+ stub->args.link_cbk.inode = inode_ref (inode);
+ if (buf)
+ stub->args.link_cbk.buf = *buf;
if (preparent)
stub->args.link_cbk.preparent = *preparent;
if (postparent)
stub->args.link_cbk.postparent = *postparent;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_create_stub (call_frame_t *frame, fop_create_t fn,
- loc_t *loc, int32_t flags, mode_t mode,
+ loc_t *loc, int32_t flags, mode_t mode,
fd_t *fd, dict_t *params)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
- stub = stub_new (frame, 1, GF_FOP_CREATE);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_CREATE);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.create.fn = fn;
- loc_copy (&stub->args.create.loc, loc);
- stub->args.create.flags = flags;
- stub->args.create.mode = mode;
- if (fd)
- stub->args.create.fd = fd_ref (fd);
+ stub->args.create.fn = fn;
+ loc_copy (&stub->args.create.loc, loc);
+ stub->args.create.flags = flags;
+ stub->args.create.mode = mode;
+ if (fd)
+ stub->args.create.fd = fd_ref (fd);
if (params)
stub->args.create.params = dict_ref (params);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_create_cbk_stub (call_frame_t *frame,
- fop_create_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- fd_t *fd,
- inode_t *inode,
- struct iatt *buf,
+ fop_create_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ fd_t *fd,
+ inode_t *inode,
+ struct iatt *buf,
struct iatt *preparent,
struct iatt *postparent)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_CREATE);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_CREATE);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.create_cbk.fn = fn;
- stub->args.create_cbk.op_ret = op_ret;
- stub->args.create_cbk.op_errno = op_errno;
- if (fd)
- stub->args.create_cbk.fd = fd_ref (fd);
- if (inode)
- stub->args.create_cbk.inode = inode_ref (inode);
- if (buf)
- stub->args.create_cbk.buf = *buf;
+ stub->args.create_cbk.fn = fn;
+ stub->args.create_cbk.op_ret = op_ret;
+ stub->args.create_cbk.op_errno = op_errno;
+ if (fd)
+ stub->args.create_cbk.fd = fd_ref (fd);
+ if (inode)
+ stub->args.create_cbk.inode = inode_ref (inode);
+ if (buf)
+ stub->args.create_cbk.buf = *buf;
if (preparent)
stub->args.create_cbk.preparent = *preparent;
if (postparent)
stub->args.create_cbk.postparent = *postparent;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_open_stub (call_frame_t *frame,
- fop_open_t fn,
- loc_t *loc,
- int32_t flags, fd_t *fd,
+ fop_open_t fn,
+ loc_t *loc,
+ int32_t flags, fd_t *fd,
int32_t wbflags)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
- stub = stub_new (frame, 1, GF_FOP_OPEN);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_OPEN);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.open.fn = fn;
- loc_copy (&stub->args.open.loc, loc);
- stub->args.open.flags = flags;
+ stub->args.open.fn = fn;
+ loc_copy (&stub->args.open.loc, loc);
+ stub->args.open.flags = flags;
stub->args.open.wbflags = wbflags;
- if (fd)
- stub->args.open.fd = fd_ref (fd);
+ if (fd)
+ stub->args.open.fd = fd_ref (fd);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_open_cbk_stub (call_frame_t *frame,
- fop_open_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- fd_t *fd)
+ fop_open_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ fd_t *fd)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_OPEN);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_OPEN);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.open_cbk.fn = fn;
- stub->args.open_cbk.op_ret = op_ret;
- stub->args.open_cbk.op_errno = op_errno;
- if (fd)
- stub->args.open_cbk.fd = fd_ref (fd);
+ stub->args.open_cbk.fn = fn;
+ stub->args.open_cbk.op_ret = op_ret;
+ stub->args.open_cbk.op_errno = op_errno;
+ if (fd)
+ stub->args.open_cbk.fd = fd_ref (fd);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_readv_stub (call_frame_t *frame,
- fop_readv_t fn,
- fd_t *fd,
- size_t size,
- off_t off)
+ fop_readv_t fn,
+ fd_t *fd,
+ size_t size,
+ off_t off)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 1, GF_FOP_READ);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_READ);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.readv.fn = fn;
- if (fd)
- stub->args.readv.fd = fd_ref (fd);
- stub->args.readv.size = size;
- stub->args.readv.off = off;
+ stub->args.readv.fn = fn;
+ if (fd)
+ stub->args.readv.fd = fd_ref (fd);
+ stub->args.readv.size = size;
+ stub->args.readv.off = off;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_readv_cbk_stub (call_frame_t *frame,
- fop_readv_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- struct iovec *vector,
- int32_t count,
- struct iatt *stbuf,
+ fop_readv_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct iovec *vector,
+ int32_t count,
+ struct iatt *stbuf,
struct iobref *iobref)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_READ);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_READ);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.readv_cbk.fn = fn;
- stub->args.readv_cbk.op_ret = op_ret;
- stub->args.readv_cbk.op_errno = op_errno;
- if (op_ret >= 0) {
- stub->args.readv_cbk.vector = iov_dup (vector, count);
- stub->args.readv_cbk.count = count;
- stub->args.readv_cbk.stbuf = *stbuf;
- stub->args.readv_cbk.iobref = iobref_ref (iobref);
- }
+ stub->args.readv_cbk.fn = fn;
+ stub->args.readv_cbk.op_ret = op_ret;
+ stub->args.readv_cbk.op_errno = op_errno;
+ if (op_ret >= 0) {
+ stub->args.readv_cbk.vector = iov_dup (vector, count);
+ stub->args.readv_cbk.count = count;
+ stub->args.readv_cbk.stbuf = *stbuf;
+ stub->args.readv_cbk.iobref = iobref_ref (iobref);
+ }
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_writev_stub (call_frame_t *frame,
- fop_writev_t fn,
- fd_t *fd,
- struct iovec *vector,
- int32_t count,
- off_t off,
+ fop_writev_t fn,
+ fd_t *fd,
+ struct iovec *vector,
+ int32_t count,
+ off_t off,
struct iobref *iobref)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", vector, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", vector, out);
- stub = stub_new (frame, 1, GF_FOP_WRITE);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_WRITE);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.writev.fn = fn;
- if (fd)
- stub->args.writev.fd = fd_ref (fd);
- stub->args.writev.vector = iov_dup (vector, count);
- stub->args.writev.count = count;
- stub->args.writev.off = off;
+ stub->args.writev.fn = fn;
+ if (fd)
+ stub->args.writev.fd = fd_ref (fd);
+ stub->args.writev.vector = iov_dup (vector, count);
+ stub->args.writev.count = count;
+ stub->args.writev.off = off;
stub->args.writev.iobref = iobref_ref (iobref);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_writev_cbk_stub (call_frame_t *frame,
- fop_writev_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
+ fop_writev_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
struct iatt *prebuf,
- struct iatt *postbuf)
+ struct iatt *postbuf)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_WRITE);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_WRITE);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.writev_cbk.fn = fn;
- stub->args.writev_cbk.op_ret = op_ret;
- stub->args.writev_cbk.op_errno = op_errno;
- if (op_ret >= 0)
- stub->args.writev_cbk.postbuf = *postbuf;
+ stub->args.writev_cbk.fn = fn;
+ stub->args.writev_cbk.op_ret = op_ret;
+ stub->args.writev_cbk.op_errno = op_errno;
+ if (op_ret >= 0)
+ stub->args.writev_cbk.postbuf = *postbuf;
if (prebuf)
stub->args.writev_cbk.prebuf = *prebuf;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_flush_stub (call_frame_t *frame,
- fop_flush_t fn,
- fd_t *fd)
+ fop_flush_t fn,
+ fd_t *fd)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 1, GF_FOP_FLUSH);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_FLUSH);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.flush.fn = fn;
- if (fd)
- stub->args.flush.fd = fd_ref (fd);
+ stub->args.flush.fn = fn;
+ if (fd)
+ stub->args.flush.fd = fd_ref (fd);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_flush_cbk_stub (call_frame_t *frame,
- fop_flush_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno)
+ fop_flush_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_FLUSH);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_FLUSH);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.flush_cbk.fn = fn;
- stub->args.flush_cbk.op_ret = op_ret;
- stub->args.flush_cbk.op_errno = op_errno;
+ stub->args.flush_cbk.fn = fn;
+ stub->args.flush_cbk.op_ret = op_ret;
+ stub->args.flush_cbk.op_errno = op_errno;
out:
- return stub;
+ return stub;
}
@@ -1043,282 +1043,282 @@ out:
call_stub_t *
fop_fsync_stub (call_frame_t *frame,
- fop_fsync_t fn,
- fd_t *fd,
- int32_t datasync)
+ fop_fsync_t fn,
+ fd_t *fd,
+ int32_t datasync)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 1, GF_FOP_FSYNC);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_FSYNC);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.fsync.fn = fn;
- if (fd)
- stub->args.fsync.fd = fd_ref (fd);
- stub->args.fsync.datasync = datasync;
+ stub->args.fsync.fn = fn;
+ if (fd)
+ stub->args.fsync.fd = fd_ref (fd);
+ stub->args.fsync.datasync = datasync;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_fsync_cbk_stub (call_frame_t *frame,
- fop_fsync_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
+ fop_fsync_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
struct iatt *prebuf,
struct iatt *postbuf)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_FSYNC);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_FSYNC);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.fsync_cbk.fn = fn;
- stub->args.fsync_cbk.op_ret = op_ret;
- stub->args.fsync_cbk.op_errno = op_errno;
+ stub->args.fsync_cbk.fn = fn;
+ stub->args.fsync_cbk.op_ret = op_ret;
+ stub->args.fsync_cbk.op_errno = op_errno;
if (prebuf)
stub->args.fsync_cbk.prebuf = *prebuf;
if (postbuf)
stub->args.fsync_cbk.postbuf = *postbuf;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_opendir_stub (call_frame_t *frame,
- fop_opendir_t fn,
- loc_t *loc, fd_t *fd)
+ fop_opendir_t fn,
+ loc_t *loc, fd_t *fd)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
- stub = stub_new (frame, 1, GF_FOP_OPENDIR);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_OPENDIR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.opendir.fn = fn;
- loc_copy (&stub->args.opendir.loc, loc);
- if (fd)
- stub->args.opendir.fd = fd_ref (fd);
+ stub->args.opendir.fn = fn;
+ loc_copy (&stub->args.opendir.loc, loc);
+ if (fd)
+ stub->args.opendir.fd = fd_ref (fd);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_opendir_cbk_stub (call_frame_t *frame,
- fop_opendir_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- fd_t *fd)
+ fop_opendir_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ fd_t *fd)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_OPENDIR);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_OPENDIR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.opendir_cbk.fn = fn;
- stub->args.opendir_cbk.op_ret = op_ret;
- stub->args.opendir_cbk.op_errno = op_errno;
+ stub->args.opendir_cbk.fn = fn;
+ stub->args.opendir_cbk.op_ret = op_ret;
+ stub->args.opendir_cbk.op_errno = op_errno;
- if (fd)
- stub->args.opendir_cbk.fd = fd_ref (fd);
+ if (fd)
+ stub->args.opendir_cbk.fd = fd_ref (fd);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_fsyncdir_stub (call_frame_t *frame,
- fop_fsyncdir_t fn,
- fd_t *fd,
- int32_t datasync)
+ fop_fsyncdir_t fn,
+ fd_t *fd,
+ int32_t datasync)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 1, GF_FOP_FSYNCDIR);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_FSYNCDIR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.fsyncdir.fn = fn;
- if (fd)
- stub->args.fsyncdir.fd = fd_ref (fd);
- stub->args.fsyncdir.datasync = datasync;
+ stub->args.fsyncdir.fn = fn;
+ if (fd)
+ stub->args.fsyncdir.fd = fd_ref (fd);
+ stub->args.fsyncdir.datasync = datasync;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_fsyncdir_cbk_stub (call_frame_t *frame,
- fop_fsyncdir_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno)
+ fop_fsyncdir_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_FSYNCDIR);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_FSYNCDIR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.fsyncdir_cbk.fn = fn;
- stub->args.fsyncdir_cbk.op_ret = op_ret;
- stub->args.fsyncdir_cbk.op_errno = op_errno;
+ stub->args.fsyncdir_cbk.fn = fn;
+ stub->args.fsyncdir_cbk.op_ret = op_ret;
+ stub->args.fsyncdir_cbk.op_errno = op_errno;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_statfs_stub (call_frame_t *frame,
- fop_statfs_t fn,
- loc_t *loc)
+ fop_statfs_t fn,
+ loc_t *loc)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
- stub = stub_new (frame, 1, GF_FOP_STATFS);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_STATFS);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.statfs.fn = fn;
- loc_copy (&stub->args.statfs.loc, loc);
+ stub->args.statfs.fn = fn;
+ loc_copy (&stub->args.statfs.loc, loc);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_statfs_cbk_stub (call_frame_t *frame,
- fop_statfs_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- struct statvfs *buf)
+ fop_statfs_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct statvfs *buf)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_STATFS);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_STATFS);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.statfs_cbk.fn = fn;
- stub->args.statfs_cbk.op_ret = op_ret;
- stub->args.statfs_cbk.op_errno = op_errno;
- if (op_ret == 0)
- stub->args.statfs_cbk.buf = *buf;
+ stub->args.statfs_cbk.fn = fn;
+ stub->args.statfs_cbk.op_ret = op_ret;
+ stub->args.statfs_cbk.op_errno = op_errno;
+ if (op_ret == 0)
+ stub->args.statfs_cbk.buf = *buf;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_setxattr_stub (call_frame_t *frame,
- fop_setxattr_t fn,
- loc_t *loc,
- dict_t *dict,
- int32_t flags)
+ fop_setxattr_t fn,
+ loc_t *loc,
+ dict_t *dict,
+ int32_t flags)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
- stub = stub_new (frame, 1, GF_FOP_SETXATTR);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_SETXATTR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.setxattr.fn = fn;
- loc_copy (&stub->args.setxattr.loc, loc);
- /* TODO */
- if (dict)
- stub->args.setxattr.dict = dict_ref (dict);
- stub->args.setxattr.flags = flags;
+ stub->args.setxattr.fn = fn;
+ loc_copy (&stub->args.setxattr.loc, loc);
+ /* TODO */
+ if (dict)
+ stub->args.setxattr.dict = dict_ref (dict);
+ stub->args.setxattr.flags = flags;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_setxattr_cbk_stub (call_frame_t *frame,
- fop_setxattr_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno)
+ fop_setxattr_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_SETXATTR);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_SETXATTR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.setxattr_cbk.fn = fn;
- stub->args.setxattr_cbk.op_ret = op_ret;
- stub->args.setxattr_cbk.op_errno = op_errno;
+ stub->args.setxattr_cbk.fn = fn;
+ stub->args.setxattr_cbk.op_ret = op_ret;
+ stub->args.setxattr_cbk.op_errno = op_errno;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_getxattr_stub (call_frame_t *frame,
- fop_getxattr_t fn,
- loc_t *loc,
- const char *name)
+ fop_getxattr_t fn,
+ loc_t *loc,
+ const char *name)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
- stub = stub_new (frame, 1, GF_FOP_GETXATTR);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_GETXATTR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.getxattr.fn = fn;
- loc_copy (&stub->args.getxattr.loc, loc);
+ stub->args.getxattr.fn = fn;
+ loc_copy (&stub->args.getxattr.loc, loc);
- if (name)
- stub->args.getxattr.name = gf_strdup (name);
+ if (name)
+ stub->args.getxattr.name = gf_strdup (name);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_getxattr_cbk_stub (call_frame_t *frame,
- fop_getxattr_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- dict_t *dict)
+ fop_getxattr_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ dict_t *dict)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_GETXATTR);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_GETXATTR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.getxattr_cbk.fn = fn;
- stub->args.getxattr_cbk.op_ret = op_ret;
- stub->args.getxattr_cbk.op_errno = op_errno;
- /* TODO */
- if (dict)
- stub->args.getxattr_cbk.dict = dict_ref (dict);
+ stub->args.getxattr_cbk.fn = fn;
+ stub->args.getxattr_cbk.op_ret = op_ret;
+ stub->args.getxattr_cbk.op_errno = op_errno;
+ /* TODO */
+ if (dict)
+ stub->args.getxattr_cbk.dict = dict_ref (dict);
out:
- return stub;
+ return stub;
}
@@ -1329,23 +1329,23 @@ fop_fsetxattr_stub (call_frame_t *frame,
dict_t *dict,
int32_t flags)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", fd, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", fd, out);
- stub = stub_new (frame, 1, GF_FOP_FSETXATTR);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_FSETXATTR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.fsetxattr.fn = fn;
- stub->args.fsetxattr.fd = fd_ref (fd);
+ stub->args.fsetxattr.fn = fn;
+ stub->args.fsetxattr.fd = fd_ref (fd);
- /* TODO */
- if (dict)
- stub->args.fsetxattr.dict = dict_ref (dict);
- stub->args.fsetxattr.flags = flags;
+ /* TODO */
+ if (dict)
+ stub->args.fsetxattr.dict = dict_ref (dict);
+ stub->args.fsetxattr.flags = flags;
out:
- return stub;
+ return stub;
}
@@ -1355,18 +1355,18 @@ fop_fsetxattr_cbk_stub (call_frame_t *frame,
int32_t op_ret,
int32_t op_errno)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_FSETXATTR);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_FSETXATTR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.fsetxattr_cbk.fn = fn;
- stub->args.fsetxattr_cbk.op_ret = op_ret;
- stub->args.fsetxattr_cbk.op_errno = op_errno;
+ stub->args.fsetxattr_cbk.fn = fn;
+ stub->args.fsetxattr_cbk.op_ret = op_ret;
+ stub->args.fsetxattr_cbk.op_errno = op_errno;
out:
- return stub;
+ return stub;
}
@@ -1376,21 +1376,21 @@ fop_fgetxattr_stub (call_frame_t *frame,
fd_t *fd,
const char *name)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", fd, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", fd, out);
- stub = stub_new (frame, 1, GF_FOP_FGETXATTR);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_FGETXATTR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.fgetxattr.fn = fn;
- stub->args.fgetxattr.fd = fd_ref (fd);
+ stub->args.fgetxattr.fn = fn;
+ stub->args.fgetxattr.fd = fd_ref (fd);
- if (name)
+ if (name)
stub->args.fgetxattr.name = gf_strdup (name);
out:
- return stub;
+ return stub;
}
@@ -1401,332 +1401,332 @@ fop_fgetxattr_cbk_stub (call_frame_t *frame,
int32_t op_errno,
dict_t *dict)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_GETXATTR);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_GETXATTR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.fgetxattr_cbk.fn = fn;
- stub->args.fgetxattr_cbk.op_ret = op_ret;
- stub->args.fgetxattr_cbk.op_errno = op_errno;
+ stub->args.fgetxattr_cbk.fn = fn;
+ stub->args.fgetxattr_cbk.op_ret = op_ret;
+ stub->args.fgetxattr_cbk.op_errno = op_errno;
- /* TODO */
- if (dict)
- stub->args.fgetxattr_cbk.dict = dict_ref (dict);
+ /* TODO */
+ if (dict)
+ stub->args.fgetxattr_cbk.dict = dict_ref (dict);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_removexattr_stub (call_frame_t *frame,
- fop_removexattr_t fn,
- loc_t *loc,
- const char *name)
+ fop_removexattr_t fn,
+ loc_t *loc,
+ const char *name)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
- GF_VALIDATE_OR_GOTO ("call-stub", name, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", loc, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", name, out);
- stub = stub_new (frame, 1, GF_FOP_REMOVEXATTR);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_REMOVEXATTR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.removexattr.fn = fn;
- loc_copy (&stub->args.removexattr.loc, loc);
+ stub->args.removexattr.fn = fn;
+ loc_copy (&stub->args.removexattr.loc, loc);
stub->args.removexattr.name = gf_strdup (name);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_removexattr_cbk_stub (call_frame_t *frame,
- fop_removexattr_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno)
+ fop_removexattr_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_REMOVEXATTR);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_REMOVEXATTR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.removexattr_cbk.fn = fn;
- stub->args.removexattr_cbk.op_ret = op_ret;
- stub->args.removexattr_cbk.op_errno = op_errno;
+ stub->args.removexattr_cbk.fn = fn;
+ stub->args.removexattr_cbk.op_ret = op_ret;
+ stub->args.removexattr_cbk.op_errno = op_errno;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_lk_stub (call_frame_t *frame,
- fop_lk_t fn,
- fd_t *fd,
- int32_t cmd,
- struct gf_flock *lock)
+ fop_lk_t fn,
+ fd_t *fd,
+ int32_t cmd,
+ struct gf_flock *lock)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
+
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", lock, out);
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", lock, out);
-
- stub = stub_new (frame, 1, GF_FOP_LK);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_LK);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.lk.fn = fn;
- if (fd)
- stub->args.lk.fd = fd_ref (fd);
- stub->args.lk.cmd = cmd;
- stub->args.lk.lock = *lock;
+ stub->args.lk.fn = fn;
+ if (fd)
+ stub->args.lk.fd = fd_ref (fd);
+ stub->args.lk.cmd = cmd;
+ stub->args.lk.lock = *lock;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_lk_cbk_stub (call_frame_t *frame,
- fop_lk_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- struct gf_flock *lock)
+ fop_lk_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct gf_flock *lock)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_LK);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_LK);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.lk_cbk.fn = fn;
- stub->args.lk_cbk.op_ret = op_ret;
- stub->args.lk_cbk.op_errno = op_errno;
- if (op_ret == 0)
- stub->args.lk_cbk.lock = *lock;
+ stub->args.lk_cbk.fn = fn;
+ stub->args.lk_cbk.op_ret = op_ret;
+ stub->args.lk_cbk.op_errno = op_errno;
+ if (op_ret == 0)
+ stub->args.lk_cbk.lock = *lock;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_inodelk_stub (call_frame_t *frame, fop_inodelk_t fn,
- const char *volume, loc_t *loc, int32_t cmd, struct gf_flock *lock)
+ const char *volume, loc_t *loc, int32_t cmd, struct gf_flock *lock)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- if (!frame || !lock)
- return NULL;
+ if (!frame || !lock)
+ return NULL;
- stub = stub_new (frame, 1, GF_FOP_INODELK);
- if (!stub)
- return NULL;
+ stub = stub_new (frame, 1, GF_FOP_INODELK);
+ if (!stub)
+ return NULL;
- stub->args.inodelk.fn = fn;
+ stub->args.inodelk.fn = fn;
- if (volume)
- stub->args.inodelk.volume = gf_strdup (volume);
+ if (volume)
+ stub->args.inodelk.volume = gf_strdup (volume);
- loc_copy (&stub->args.inodelk.loc, loc);
- stub->args.inodelk.cmd = cmd;
- stub->args.inodelk.lock = *lock;
+ loc_copy (&stub->args.inodelk.loc, loc);
+ stub->args.inodelk.cmd = cmd;
+ stub->args.inodelk.lock = *lock;
- return stub;
+ return stub;
}
call_stub_t *
fop_inodelk_cbk_stub (call_frame_t *frame, fop_inodelk_cbk_t fn,
- int32_t op_ret, int32_t op_errno)
+ int32_t op_ret, int32_t op_errno)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- if (!frame)
- return NULL;
+ if (!frame)
+ return NULL;
- stub = stub_new (frame, 0, GF_FOP_INODELK);
- if (!stub)
- return NULL;
+ stub = stub_new (frame, 0, GF_FOP_INODELK);
+ if (!stub)
+ return NULL;
- stub->args.inodelk_cbk.fn = fn;
- stub->args.inodelk_cbk.op_ret = op_ret;
- stub->args.inodelk_cbk.op_errno = op_errno;
+ stub->args.inodelk_cbk.fn = fn;
+ stub->args.inodelk_cbk.op_ret = op_ret;
+ stub->args.inodelk_cbk.op_errno = op_errno;
- return stub;
+ return stub;
}
call_stub_t *
fop_finodelk_stub (call_frame_t *frame, fop_finodelk_t fn,
- const char *volume, fd_t *fd, int32_t cmd, struct gf_flock *lock)
+ const char *volume, fd_t *fd, int32_t cmd, struct gf_flock *lock)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- if (!frame || !lock)
- return NULL;
+ if (!frame || !lock)
+ return NULL;
- stub = stub_new (frame, 1, GF_FOP_FINODELK);
- if (!stub)
- return NULL;
+ stub = stub_new (frame, 1, GF_FOP_FINODELK);
+ if (!stub)
+ return NULL;
- stub->args.finodelk.fn = fn;
+ stub->args.finodelk.fn = fn;
- if (fd)
- stub->args.finodelk.fd = fd_ref (fd);
+ if (fd)
+ stub->args.finodelk.fd = fd_ref (fd);
- if (volume)
- stub->args.finodelk.volume = gf_strdup (volume);
+ if (volume)
+ stub->args.finodelk.volume = gf_strdup (volume);
- stub->args.finodelk.cmd = cmd;
- stub->args.finodelk.lock = *lock;
+ stub->args.finodelk.cmd = cmd;
+ stub->args.finodelk.lock = *lock;
- return stub;
+ return stub;
}
call_stub_t *
fop_finodelk_cbk_stub (call_frame_t *frame, fop_inodelk_cbk_t fn,
- int32_t op_ret, int32_t op_errno)
+ int32_t op_ret, int32_t op_errno)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- if (!frame)
- return NULL;
+ if (!frame)
+ return NULL;
- stub = stub_new (frame, 0, GF_FOP_FINODELK);
- if (!stub)
- return NULL;
+ stub = stub_new (frame, 0, GF_FOP_FINODELK);
+ if (!stub)
+ return NULL;
- stub->args.finodelk_cbk.fn = fn;
- stub->args.finodelk_cbk.op_ret = op_ret;
- stub->args.finodelk_cbk.op_errno = op_errno;
+ stub->args.finodelk_cbk.fn = fn;
+ stub->args.finodelk_cbk.op_ret = op_ret;
+ stub->args.finodelk_cbk.op_errno = op_errno;
- return stub;
+ return stub;
}
call_stub_t *
fop_entrylk_stub (call_frame_t *frame, fop_entrylk_t fn,
- const char *volume, loc_t *loc, const char *name,
- entrylk_cmd cmd, entrylk_type type)
+ const char *volume, loc_t *loc, const char *name,
+ entrylk_cmd cmd, entrylk_type type)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- if (!frame)
- return NULL;
+ if (!frame)
+ return NULL;
- stub = stub_new (frame, 1, GF_FOP_ENTRYLK);
- if (!stub)
- return NULL;
+ stub = stub_new (frame, 1, GF_FOP_ENTRYLK);
+ if (!stub)
+ return NULL;
- stub->args.entrylk.fn = fn;
+ stub->args.entrylk.fn = fn;
- if (volume)
- stub->args.entrylk.volume = gf_strdup (volume);
+ if (volume)
+ stub->args.entrylk.volume = gf_strdup (volume);
- loc_copy (&stub->args.entrylk.loc, loc);
+ loc_copy (&stub->args.entrylk.loc, loc);
- stub->args.entrylk.cmd = cmd;
- stub->args.entrylk.type = type;
- if (name)
- stub->args.entrylk.name = gf_strdup (name);
+ stub->args.entrylk.cmd = cmd;
+ stub->args.entrylk.type = type;
+ if (name)
+ stub->args.entrylk.name = gf_strdup (name);
- return stub;
+ return stub;
}
call_stub_t *
fop_entrylk_cbk_stub (call_frame_t *frame, fop_entrylk_cbk_t fn,
- int32_t op_ret, int32_t op_errno)
+ int32_t op_ret, int32_t op_errno)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- if (!frame)
- return NULL;
+ if (!frame)
+ return NULL;
- stub = stub_new (frame, 0, GF_FOP_ENTRYLK);
- if (!stub)
- return NULL;
+ stub = stub_new (frame, 0, GF_FOP_ENTRYLK);
+ if (!stub)
+ return NULL;
- stub->args.entrylk_cbk.fn = fn;
- stub->args.entrylk_cbk.op_ret = op_ret;
- stub->args.entrylk_cbk.op_errno = op_errno;
+ stub->args.entrylk_cbk.fn = fn;
+ stub->args.entrylk_cbk.op_ret = op_ret;
+ stub->args.entrylk_cbk.op_errno = op_errno;
- return stub;
+ return stub;
}
call_stub_t *
fop_fentrylk_stub (call_frame_t *frame, fop_fentrylk_t fn,
- const char *volume, fd_t *fd, const char *name,
- entrylk_cmd cmd, entrylk_type type)
+ const char *volume, fd_t *fd, const char *name,
+ entrylk_cmd cmd, entrylk_type type)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- if (!frame)
- return NULL;
+ if (!frame)
+ return NULL;
- stub = stub_new (frame, 1, GF_FOP_FENTRYLK);
- if (!stub)
- return NULL;
+ stub = stub_new (frame, 1, GF_FOP_FENTRYLK);
+ if (!stub)
+ return NULL;
- stub->args.fentrylk.fn = fn;
+ stub->args.fentrylk.fn = fn;
- if (volume)
- stub->args.fentrylk.volume = gf_strdup (volume);
+ if (volume)
+ stub->args.fentrylk.volume = gf_strdup (volume);
- if (fd)
- stub->args.fentrylk.fd = fd_ref (fd);
- stub->args.fentrylk.cmd = cmd;
- stub->args.fentrylk.type = type;
- if (name)
- stub->args.fentrylk.name = gf_strdup (name);
+ if (fd)
+ stub->args.fentrylk.fd = fd_ref (fd);
+ stub->args.fentrylk.cmd = cmd;
+ stub->args.fentrylk.type = type;
+ if (name)
+ stub->args.fentrylk.name = gf_strdup (name);
- return stub;
+ return stub;
}
call_stub_t *
fop_fentrylk_cbk_stub (call_frame_t *frame, fop_fentrylk_cbk_t fn,
- int32_t op_ret, int32_t op_errno)
+ int32_t op_ret, int32_t op_errno)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- if (!frame)
- return NULL;
+ if (!frame)
+ return NULL;
- stub = stub_new (frame, 0, GF_FOP_FENTRYLK);
- if (!stub)
- return NULL;
+ stub = stub_new (frame, 0, GF_FOP_FENTRYLK);
+ if (!stub)
+ return NULL;
- stub->args.fentrylk_cbk.fn = fn;
- stub->args.fentrylk_cbk.op_ret = op_ret;
- stub->args.fentrylk_cbk.op_errno = op_errno;
+ stub->args.fentrylk_cbk.fn = fn;
+ stub->args.fentrylk_cbk.op_ret = op_ret;
+ stub->args.fentrylk_cbk.op_errno = op_errno;
- return stub;
+ return stub;
}
call_stub_t *
fop_readdirp_cbk_stub (call_frame_t *frame,
- fop_readdirp_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- gf_dirent_t *entries)
+ fop_readdirp_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ gf_dirent_t *entries)
{
- call_stub_t *stub = NULL;
- gf_dirent_t *stub_entry = NULL, *entry = NULL;
+ call_stub_t *stub = NULL;
+ gf_dirent_t *stub_entry = NULL, *entry = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_READDIRP);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_READDIRP);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.readdirp_cbk.fn = fn;
- stub->args.readdirp_cbk.op_ret = op_ret;
- stub->args.readdirp_cbk.op_errno = op_errno;
- INIT_LIST_HEAD (&stub->args.readdirp_cbk.entries.list);
+ stub->args.readdirp_cbk.fn = fn;
+ stub->args.readdirp_cbk.op_ret = op_ret;
+ stub->args.readdirp_cbk.op_errno = op_errno;
+ INIT_LIST_HEAD (&stub->args.readdirp_cbk.entries.list);
/* This check must come after the init of head above
* so we're sure the list is empty for list_empty.
@@ -1734,42 +1734,42 @@ fop_readdirp_cbk_stub (call_frame_t *frame,
if (!entries)
goto out;
- if (op_ret > 0) {
- list_for_each_entry (entry, &entries->list, list) {
- stub_entry = gf_dirent_for_name (entry->d_name);
+ if (op_ret > 0) {
+ list_for_each_entry (entry, &entries->list, list) {
+ stub_entry = gf_dirent_for_name (entry->d_name);
if (!stub_entry)
goto out;
- stub_entry->d_off = entry->d_off;
- stub_entry->d_ino = entry->d_ino;
- stub_entry->d_stat = entry->d_stat;
- list_add_tail (&stub_entry->list,
- &stub->args.readdirp_cbk.entries.list);
- }
- }
+ stub_entry->d_off = entry->d_off;
+ stub_entry->d_ino = entry->d_ino;
+ stub_entry->d_stat = entry->d_stat;
+ list_add_tail (&stub_entry->list,
+ &stub->args.readdirp_cbk.entries.list);
+ }
+ }
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_readdir_cbk_stub (call_frame_t *frame,
- fop_readdir_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- gf_dirent_t *entries)
+ fop_readdir_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ gf_dirent_t *entries)
{
- call_stub_t *stub = NULL;
- gf_dirent_t *stub_entry = NULL, *entry = NULL;
+ call_stub_t *stub = NULL;
+ gf_dirent_t *stub_entry = NULL, *entry = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_READDIR);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
-
- stub->args.readdir_cbk.fn = fn;
- stub->args.readdir_cbk.op_ret = op_ret;
- stub->args.readdir_cbk.op_errno = op_errno;
- INIT_LIST_HEAD (&stub->args.readdir_cbk.entries.list);
+ stub = stub_new (frame, 0, GF_FOP_READDIR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ stub->args.readdir_cbk.fn = fn;
+ stub->args.readdir_cbk.op_ret = op_ret;
+ stub->args.readdir_cbk.op_errno = op_errno;
+ INIT_LIST_HEAD (&stub->args.readdir_cbk.entries.list);
/* This check must come after the init of head above
* so we're sure the list is empty for list_empty.
@@ -1777,56 +1777,56 @@ fop_readdir_cbk_stub (call_frame_t *frame,
if (!entries)
goto out;
- if (op_ret > 0) {
- list_for_each_entry (entry, &entries->list, list) {
- stub_entry = gf_dirent_for_name (entry->d_name);
+ if (op_ret > 0) {
+ list_for_each_entry (entry, &entries->list, list) {
+ stub_entry = gf_dirent_for_name (entry->d_name);
if (!stub_entry)
goto out;
- stub_entry->d_off = entry->d_off;
- stub_entry->d_ino = entry->d_ino;
+ stub_entry->d_off = entry->d_off;
+ stub_entry->d_ino = entry->d_ino;
- list_add_tail (&stub_entry->list,
- &stub->args.readdir_cbk.entries.list);
- }
- }
+ list_add_tail (&stub_entry->list,
+ &stub->args.readdir_cbk.entries.list);
+ }
+ }
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_readdir_stub (call_frame_t *frame,
- fop_readdir_t fn,
- fd_t *fd,
- size_t size,
- off_t off)
+ fop_readdir_t fn,
+ fd_t *fd,
+ size_t size,
+ off_t off)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- stub = stub_new (frame, 1, GF_FOP_READDIR);
- stub->args.readdir.fn = fn;
- stub->args.readdir.fd = fd_ref (fd);
- stub->args.readdir.size = size;
- stub->args.readdir.off = off;
+ stub = stub_new (frame, 1, GF_FOP_READDIR);
+ stub->args.readdir.fn = fn;
+ stub->args.readdir.fd = fd_ref (fd);
+ stub->args.readdir.size = size;
+ stub->args.readdir.off = off;
- return stub;
+ return stub;
}
call_stub_t *
fop_readdirp_stub (call_frame_t *frame,
- fop_readdirp_t fn,
- fd_t *fd,
- size_t size,
- off_t off)
+ fop_readdirp_t fn,
+ fd_t *fd,
+ size_t size,
+ off_t off)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- stub = stub_new (frame, 1, GF_FOP_READDIRP);
- stub->args.readdirp.fn = fn;
- stub->args.readdirp.fd = fd_ref (fd);
- stub->args.readdirp.size = size;
- stub->args.readdirp.off = off;
+ stub = stub_new (frame, 1, GF_FOP_READDIRP);
+ stub->args.readdirp.fn = fn;
+ stub->args.readdirp.fd = fd_ref (fd);
+ stub->args.readdirp.size = size;
+ stub->args.readdirp.off = off;
- return stub;
+ return stub;
}
call_stub_t *
@@ -1835,20 +1835,20 @@ fop_rchecksum_stub (call_frame_t *frame,
fd_t *fd, off_t offset,
int32_t len)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", fd, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", fd, out);
- stub = stub_new (frame, 1, GF_FOP_RCHECKSUM);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 1, GF_FOP_RCHECKSUM);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.rchecksum.fn = fn;
+ stub->args.rchecksum.fn = fn;
stub->args.rchecksum.fd = fd_ref (fd);
- stub->args.rchecksum.offset = offset;
- stub->args.rchecksum.len = len;
+ stub->args.rchecksum.offset = offset;
+ stub->args.rchecksum.len = len;
out:
- return stub;
+ return stub;
}
@@ -1860,124 +1860,124 @@ fop_rchecksum_cbk_stub (call_frame_t *frame,
uint32_t weak_checksum,
uint8_t *strong_checksum)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_RCHECKSUM);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_RCHECKSUM);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.rchecksum_cbk.fn = fn;
- stub->args.rchecksum_cbk.op_ret = op_ret;
- stub->args.rchecksum_cbk.op_errno = op_errno;
+ stub->args.rchecksum_cbk.fn = fn;
+ stub->args.rchecksum_cbk.op_ret = op_ret;
+ stub->args.rchecksum_cbk.op_errno = op_errno;
- if (op_ret >= 0)
- {
- stub->args.rchecksum_cbk.weak_checksum =
+ if (op_ret >= 0)
+ {
+ stub->args.rchecksum_cbk.weak_checksum =
weak_checksum;
- stub->args.rchecksum_cbk.strong_checksum =
- memdup (strong_checksum, MD5_DIGEST_LEN);
- }
+ stub->args.rchecksum_cbk.strong_checksum =
+ memdup (strong_checksum, MD5_DIGEST_LEN);
+ }
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_xattrop_cbk_stub (call_frame_t *frame,
- fop_xattrop_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno)
+ fop_xattrop_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
+
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
-
- stub = stub_new (frame, 0, GF_FOP_XATTROP);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ stub = stub_new (frame, 0, GF_FOP_XATTROP);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- stub->args.xattrop_cbk.fn = fn;
- stub->args.xattrop_cbk.op_ret = op_ret;
- stub->args.xattrop_cbk.op_errno = op_errno;
+ stub->args.xattrop_cbk.fn = fn;
+ stub->args.xattrop_cbk.op_ret = op_ret;
+ stub->args.xattrop_cbk.op_errno = op_errno;
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_fxattrop_cbk_stub (call_frame_t *frame,
- fop_fxattrop_cbk_t fn,
- int32_t op_ret,
- int32_t op_errno,
- dict_t *xattr)
+ fop_fxattrop_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ dict_t *xattr)
{
- call_stub_t *stub = NULL;
- GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ call_stub_t *stub = NULL;
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- stub = stub_new (frame, 0, GF_FOP_FXATTROP);
- stub->args.fxattrop_cbk.fn = fn;
- stub->args.fxattrop_cbk.op_ret = op_ret;
- stub->args.fxattrop_cbk.op_errno = op_errno;
- if (xattr)
- stub->args.fxattrop_cbk.xattr = dict_ref (xattr);
+ stub = stub_new (frame, 0, GF_FOP_FXATTROP);
+ stub->args.fxattrop_cbk.fn = fn;
+ stub->args.fxattrop_cbk.op_ret = op_ret;
+ stub->args.fxattrop_cbk.op_errno = op_errno;
+ if (xattr)
+ stub->args.fxattrop_cbk.xattr = dict_ref (xattr);
out:
- return stub;
+ return stub;
}
call_stub_t *
fop_xattrop_stub (call_frame_t *frame,
- fop_xattrop_t fn,
- loc_t *loc,
- gf_xattrop_flags_t optype,
- dict_t *xattr)
+ fop_xattrop_t fn,
+ loc_t *loc,
+ gf_xattrop_flags_t optype,
+ dict_t *xattr)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
+
+ if (!frame || !xattr)
+ return NULL;
- if (!frame || !xattr)
- return NULL;
+ stub = stub_new (frame, 1, GF_FOP_XATTROP);
+ if (!stub)
+ return NULL;
- stub = stub_new (frame, 1, GF_FOP_XATTROP);
- if (!stub)
- return NULL;
+ stub->args.xattrop.fn = fn;
- stub->args.xattrop.fn = fn;
-
- loc_copy (&stub->args.xattrop.loc, loc);
+ loc_copy (&stub->args.xattrop.loc, loc);
- stub->args.xattrop.optype = optype;
- stub->args.xattrop.xattr = dict_ref (xattr);
+ stub->args.xattrop.optype = optype;
+ stub->args.xattrop.xattr = dict_ref (xattr);
- return stub;
+ return stub;
}
call_stub_t *
fop_fxattrop_stub (call_frame_t *frame,
- fop_fxattrop_t fn,
- fd_t *fd,
- gf_xattrop_flags_t optype,
- dict_t *xattr)
+ fop_fxattrop_t fn,
+ fd_t *fd,
+ gf_xattrop_flags_t optype,
+ dict_t *xattr)
{
- call_stub_t *stub = NULL;
+ call_stub_t *stub = NULL;
+
+ if (!frame || !xattr)
+ return NULL;
- if (!frame || !xattr)
- return NULL;
+ stub = stub_new (frame, 1, GF_FOP_FXATTROP);
+ if (!stub)
+ return NULL;
- stub = stub_new (frame, 1, GF_FOP_FXATTROP);
- if (!stub)
- return NULL;
+ stub->args.fxattrop.fn = fn;
- stub->args.fxattrop.fn = fn;
-
- stub->args.fxattrop.fd = fd_ref (fd);
+ stub->args.fxattrop.fd = fd_ref (fd);
- stub->args.fxattrop.optype = optype;
- stub->args.fxattrop.xattr = dict_ref (xattr);
+ stub->args.fxattrop.optype = optype;
+ stub->args.fxattrop.xattr = dict_ref (xattr);
- return stub;
+ return stub;
}
@@ -1994,11 +1994,11 @@ fop_setattr_cbk_stub (call_frame_t *frame,
if (frame == NULL)
goto out;
- stub = stub_new (frame, 0, GF_FOP_SETATTR);
- if (stub == NULL)
+ stub = stub_new (frame, 0, GF_FOP_SETATTR);
+ if (stub == NULL)
goto out;
- stub->args.setattr_cbk.fn = fn;
+ stub->args.setattr_cbk.fn = fn;
stub->args.setattr_cbk.op_ret = op_ret;
stub->args.setattr_cbk.op_errno = op_errno;
@@ -2009,7 +2009,7 @@ fop_setattr_cbk_stub (call_frame_t *frame,
stub->args.setattr_cbk.statpost = *statpost;
out:
- return stub;
+ return stub;
}
call_stub_t *
@@ -2025,11 +2025,11 @@ fop_fsetattr_cbk_stub (call_frame_t *frame,
if (frame == NULL)
goto out;
- stub = stub_new (frame, 0, GF_FOP_FSETATTR);
- if (stub == NULL)
+ stub = stub_new (frame, 0, GF_FOP_FSETATTR);
+ if (stub == NULL)
goto out;
- stub->args.fsetattr_cbk.fn = fn;
+ stub->args.fsetattr_cbk.fn = fn;
stub->args.fsetattr_cbk.op_ret = op_ret;
stub->args.fsetattr_cbk.op_errno = op_errno;
@@ -2039,7 +2039,7 @@ fop_fsetattr_cbk_stub (call_frame_t *frame,
if (statpost)
stub->args.fsetattr_cbk.statpost = *statpost;
out:
- return stub;
+ return stub;
}
call_stub_t *
@@ -2057,13 +2057,13 @@ fop_setattr_stub (call_frame_t *frame,
if (fn == NULL)
goto out;
- stub = stub_new (frame, 1, GF_FOP_SETATTR);
- if (stub == NULL)
+ stub = stub_new (frame, 1, GF_FOP_SETATTR);
+ if (stub == NULL)
goto out;
- stub->args.setattr.fn = fn;
+ stub->args.setattr.fn = fn;
- loc_copy (&stub->args.setattr.loc, loc);
+ loc_copy (&stub->args.setattr.loc, loc);
if (stbuf)
stub->args.setattr.stbuf = *stbuf;
@@ -2071,7 +2071,7 @@ fop_setattr_stub (call_frame_t *frame,
stub->args.setattr.valid = valid;
out:
- return stub;
+ return stub;
}
call_stub_t *
@@ -2089,11 +2089,11 @@ fop_fsetattr_stub (call_frame_t *frame,
if (fn == NULL)
goto out;
- stub = stub_new (frame, 1, GF_FOP_FSETATTR);
- if (stub == NULL)
+ stub = stub_new (frame, 1, GF_FOP_FSETATTR);
+ if (stub == NULL)
goto out;
- stub->args.fsetattr.fn = fn;
+ stub->args.fsetattr.fn = fn;
if (fd)
stub->args.fsetattr.fd = fd_ref (fd);
@@ -2104,377 +2104,377 @@ fop_fsetattr_stub (call_frame_t *frame,
stub->args.fsetattr.valid = valid;
out:
- return stub;
+ return stub;
}
static void
call_resume_wind (call_stub_t *stub)
{
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- switch (stub->fop) {
- case GF_FOP_OPEN:
- {
- stub->args.open.fn (stub->frame,
- stub->frame->this,
- &stub->args.open.loc,
- stub->args.open.flags, stub->args.open.fd,
+ switch (stub->fop) {
+ case GF_FOP_OPEN:
+ {
+ stub->args.open.fn (stub->frame,
+ stub->frame->this,
+ &stub->args.open.loc,
+ stub->args.open.flags, stub->args.open.fd,
stub->args.open.wbflags);
- break;
- }
- case GF_FOP_CREATE:
- {
- stub->args.create.fn (stub->frame,
- stub->frame->this,
- &stub->args.create.loc,
- stub->args.create.flags,
- stub->args.create.mode,
- stub->args.create.fd,
+ break;
+ }
+ case GF_FOP_CREATE:
+ {
+ stub->args.create.fn (stub->frame,
+ stub->frame->this,
+ &stub->args.create.loc,
+ stub->args.create.flags,
+ stub->args.create.mode,
+ stub->args.create.fd,
stub->args.create.params);
- break;
- }
- case GF_FOP_STAT:
- {
- stub->args.stat.fn (stub->frame,
- stub->frame->this,
- &stub->args.stat.loc);
- break;
- }
- case GF_FOP_READLINK:
- {
- stub->args.readlink.fn (stub->frame,
- stub->frame->this,
- &stub->args.readlink.loc,
- stub->args.readlink.size);
- break;
- }
-
- case GF_FOP_MKNOD:
- {
- stub->args.mknod.fn (stub->frame, stub->frame->this,
- &stub->args.mknod.loc,
- stub->args.mknod.mode,
- stub->args.mknod.rdev,
+ break;
+ }
+ case GF_FOP_STAT:
+ {
+ stub->args.stat.fn (stub->frame,
+ stub->frame->this,
+ &stub->args.stat.loc);
+ break;
+ }
+ case GF_FOP_READLINK:
+ {
+ stub->args.readlink.fn (stub->frame,
+ stub->frame->this,
+ &stub->args.readlink.loc,
+ stub->args.readlink.size);
+ break;
+ }
+
+ case GF_FOP_MKNOD:
+ {
+ stub->args.mknod.fn (stub->frame, stub->frame->this,
+ &stub->args.mknod.loc,
+ stub->args.mknod.mode,
+ stub->args.mknod.rdev,
stub->args.mknod.params);
- }
- break;
-
- case GF_FOP_MKDIR:
- {
- stub->args.mkdir.fn (stub->frame, stub->frame->this,
- &stub->args.mkdir.loc,
- stub->args.mkdir.mode,
+ }
+ break;
+
+ case GF_FOP_MKDIR:
+ {
+ stub->args.mkdir.fn (stub->frame, stub->frame->this,
+ &stub->args.mkdir.loc,
+ stub->args.mkdir.mode,
stub->args.mkdir.params);
- }
- break;
-
- case GF_FOP_UNLINK:
- {
- stub->args.unlink.fn (stub->frame,
- stub->frame->this,
- &stub->args.unlink.loc);
- }
- break;
-
- case GF_FOP_RMDIR:
- {
- stub->args.rmdir.fn (stub->frame, stub->frame->this,
- &stub->args.rmdir.loc,
+ }
+ break;
+
+ case GF_FOP_UNLINK:
+ {
+ stub->args.unlink.fn (stub->frame,
+ stub->frame->this,
+ &stub->args.unlink.loc);
+ }
+ break;
+
+ case GF_FOP_RMDIR:
+ {
+ stub->args.rmdir.fn (stub->frame, stub->frame->this,
+ &stub->args.rmdir.loc,
stub->args.rmdir.flags);
- }
- break;
-
- case GF_FOP_SYMLINK:
- {
- stub->args.symlink.fn (stub->frame,
- stub->frame->this,
- stub->args.symlink.linkname,
- &stub->args.symlink.loc,
+ }
+ break;
+
+ case GF_FOP_SYMLINK:
+ {
+ stub->args.symlink.fn (stub->frame,
+ stub->frame->this,
+ stub->args.symlink.linkname,
+ &stub->args.symlink.loc,
stub->args.symlink.params);
- }
- break;
-
- case GF_FOP_RENAME:
- {
- stub->args.rename.fn (stub->frame,
- stub->frame->this,
- &stub->args.rename.old,
- &stub->args.rename.new);
- }
- break;
-
- case GF_FOP_LINK:
- {
- stub->args.link.fn (stub->frame,
- stub->frame->this,
- &stub->args.link.oldloc,
- &stub->args.link.newloc);
- }
- break;
-
- case GF_FOP_TRUNCATE:
- {
- stub->args.truncate.fn (stub->frame,
- stub->frame->this,
- &stub->args.truncate.loc,
- stub->args.truncate.off);
- break;
- }
-
- case GF_FOP_READ:
- {
- stub->args.readv.fn (stub->frame,
- stub->frame->this,
- stub->args.readv.fd,
- stub->args.readv.size,
- stub->args.readv.off);
- break;
- }
-
- case GF_FOP_WRITE:
- {
- stub->args.writev.fn (stub->frame,
- stub->frame->this,
- stub->args.writev.fd,
- stub->args.writev.vector,
- stub->args.writev.count,
- stub->args.writev.off,
+ }
+ break;
+
+ case GF_FOP_RENAME:
+ {
+ stub->args.rename.fn (stub->frame,
+ stub->frame->this,
+ &stub->args.rename.old,
+ &stub->args.rename.new);
+ }
+ break;
+
+ case GF_FOP_LINK:
+ {
+ stub->args.link.fn (stub->frame,
+ stub->frame->this,
+ &stub->args.link.oldloc,
+ &stub->args.link.newloc);
+ }
+ break;
+
+ case GF_FOP_TRUNCATE:
+ {
+ stub->args.truncate.fn (stub->frame,
+ stub->frame->this,
+ &stub->args.truncate.loc,
+ stub->args.truncate.off);
+ break;
+ }
+
+ case GF_FOP_READ:
+ {
+ stub->args.readv.fn (stub->frame,
+ stub->frame->this,
+ stub->args.readv.fd,
+ stub->args.readv.size,
+ stub->args.readv.off);
+ break;
+ }
+
+ case GF_FOP_WRITE:
+ {
+ stub->args.writev.fn (stub->frame,
+ stub->frame->this,
+ stub->args.writev.fd,
+ stub->args.writev.vector,
+ stub->args.writev.count,
+ stub->args.writev.off,
stub->args.writev.iobref);
- break;
- }
-
- case GF_FOP_STATFS:
- {
- stub->args.statfs.fn (stub->frame,
- stub->frame->this,
- &stub->args.statfs.loc);
- break;
- }
- case GF_FOP_FLUSH:
- {
- stub->args.flush.fn (stub->frame,
- stub->frame->this,
- stub->args.flush.fd);
- break;
- }
-
- case GF_FOP_FSYNC:
- {
- stub->args.fsync.fn (stub->frame,
- stub->frame->this,
- stub->args.fsync.fd,
- stub->args.fsync.datasync);
- break;
- }
-
- case GF_FOP_SETXATTR:
- {
- stub->args.setxattr.fn (stub->frame,
- stub->frame->this,
- &stub->args.setxattr.loc,
- stub->args.setxattr.dict,
- stub->args.setxattr.flags);
- break;
- }
-
- case GF_FOP_GETXATTR:
- {
- stub->args.getxattr.fn (stub->frame,
- stub->frame->this,
- &stub->args.getxattr.loc,
- stub->args.getxattr.name);
- break;
- }
-
- case GF_FOP_FSETXATTR:
- {
- stub->args.fsetxattr.fn (stub->frame,
+ break;
+ }
+
+ case GF_FOP_STATFS:
+ {
+ stub->args.statfs.fn (stub->frame,
+ stub->frame->this,
+ &stub->args.statfs.loc);
+ break;
+ }
+ case GF_FOP_FLUSH:
+ {
+ stub->args.flush.fn (stub->frame,
+ stub->frame->this,
+ stub->args.flush.fd);
+ break;
+ }
+
+ case GF_FOP_FSYNC:
+ {
+ stub->args.fsync.fn (stub->frame,
+ stub->frame->this,
+ stub->args.fsync.fd,
+ stub->args.fsync.datasync);
+ break;
+ }
+
+ case GF_FOP_SETXATTR:
+ {
+ stub->args.setxattr.fn (stub->frame,
+ stub->frame->this,
+ &stub->args.setxattr.loc,
+ stub->args.setxattr.dict,
+ stub->args.setxattr.flags);
+ break;
+ }
+
+ case GF_FOP_GETXATTR:
+ {
+ stub->args.getxattr.fn (stub->frame,
+ stub->frame->this,
+ &stub->args.getxattr.loc,
+ stub->args.getxattr.name);
+ break;
+ }
+
+ case GF_FOP_FSETXATTR:
+ {
+ stub->args.fsetxattr.fn (stub->frame,
stub->frame->this,
stub->args.fsetxattr.fd,
stub->args.fsetxattr.dict,
stub->args.fsetxattr.flags);
- break;
- }
+ break;
+ }
- case GF_FOP_FGETXATTR:
- {
- stub->args.fgetxattr.fn (stub->frame,
+ case GF_FOP_FGETXATTR:
+ {
+ stub->args.fgetxattr.fn (stub->frame,
stub->frame->this,
stub->args.fgetxattr.fd,
stub->args.fgetxattr.name);
- break;
- }
-
- case GF_FOP_REMOVEXATTR:
- {
- stub->args.removexattr.fn (stub->frame,
- stub->frame->this,
- &stub->args.removexattr.loc,
- stub->args.removexattr.name);
- break;
- }
-
- case GF_FOP_OPENDIR:
- {
- stub->args.opendir.fn (stub->frame,
- stub->frame->this,
- &stub->args.opendir.loc,
- stub->args.opendir.fd);
- break;
- }
-
- case GF_FOP_FSYNCDIR:
- {
- stub->args.fsyncdir.fn (stub->frame,
- stub->frame->this,
- stub->args.fsyncdir.fd,
- stub->args.fsyncdir.datasync);
- break;
- }
-
- case GF_FOP_ACCESS:
- {
- stub->args.access.fn (stub->frame,
- stub->frame->this,
- &stub->args.access.loc,
- stub->args.access.mask);
- break;
- }
-
- case GF_FOP_FTRUNCATE:
- {
- stub->args.ftruncate.fn (stub->frame,
- stub->frame->this,
- stub->args.ftruncate.fd,
- stub->args.ftruncate.off);
- break;
- }
-
- case GF_FOP_FSTAT:
- {
- stub->args.fstat.fn (stub->frame,
- stub->frame->this,
- stub->args.fstat.fd);
- break;
- }
-
- case GF_FOP_LK:
- {
- stub->args.lk.fn (stub->frame,
- stub->frame->this,
- stub->args.lk.fd,
- stub->args.lk.cmd,
- &stub->args.lk.lock);
- break;
- }
-
- case GF_FOP_INODELK:
- {
- stub->args.inodelk.fn (stub->frame,
- stub->frame->this,
+ break;
+ }
+
+ case GF_FOP_REMOVEXATTR:
+ {
+ stub->args.removexattr.fn (stub->frame,
+ stub->frame->this,
+ &stub->args.removexattr.loc,
+ stub->args.removexattr.name);
+ break;
+ }
+
+ case GF_FOP_OPENDIR:
+ {
+ stub->args.opendir.fn (stub->frame,
+ stub->frame->this,
+ &stub->args.opendir.loc,
+ stub->args.opendir.fd);
+ break;
+ }
+
+ case GF_FOP_FSYNCDIR:
+ {
+ stub->args.fsyncdir.fn (stub->frame,
+ stub->frame->this,
+ stub->args.fsyncdir.fd,
+ stub->args.fsyncdir.datasync);
+ break;
+ }
+
+ case GF_FOP_ACCESS:
+ {
+ stub->args.access.fn (stub->frame,
+ stub->frame->this,
+ &stub->args.access.loc,
+ stub->args.access.mask);
+ break;
+ }
+
+ case GF_FOP_FTRUNCATE:
+ {
+ stub->args.ftruncate.fn (stub->frame,
+ stub->frame->this,
+ stub->args.ftruncate.fd,
+ stub->args.ftruncate.off);
+ break;
+ }
+
+ case GF_FOP_FSTAT:
+ {
+ stub->args.fstat.fn (stub->frame,
+ stub->frame->this,
+ stub->args.fstat.fd);
+ break;
+ }
+
+ case GF_FOP_LK:
+ {
+ stub->args.lk.fn (stub->frame,
+ stub->frame->this,
+ stub->args.lk.fd,
+ stub->args.lk.cmd,
+ &stub->args.lk.lock);
+ break;
+ }
+
+ case GF_FOP_INODELK:
+ {
+ stub->args.inodelk.fn (stub->frame,
+ stub->frame->this,
stub->args.inodelk.volume,
- &stub->args.inodelk.loc,
- stub->args.inodelk.cmd,
- &stub->args.inodelk.lock);
- break;
- }
-
- case GF_FOP_FINODELK:
- {
- stub->args.finodelk.fn (stub->frame,
- stub->frame->this,
+ &stub->args.inodelk.loc,
+ stub->args.inodelk.cmd,
+ &stub->args.inodelk.lock);
+ break;
+ }
+
+ case GF_FOP_FINODELK:
+ {
+ stub->args.finodelk.fn (stub->frame,
+ stub->frame->this,
stub->args.finodelk.volume,
- stub->args.finodelk.fd,
- stub->args.finodelk.cmd,
- &stub->args.finodelk.lock);
- break;
- }
-
- case GF_FOP_ENTRYLK:
- {
- stub->args.entrylk.fn (stub->frame,
- stub->frame->this,
+ stub->args.finodelk.fd,
+ stub->args.finodelk.cmd,
+ &stub->args.finodelk.lock);
+ break;
+ }
+
+ case GF_FOP_ENTRYLK:
+ {
+ stub->args.entrylk.fn (stub->frame,
+ stub->frame->this,
stub->args.entrylk.volume,
- &stub->args.entrylk.loc,
- stub->args.entrylk.name,
- stub->args.entrylk.cmd,
- stub->args.entrylk.type);
- break;
- }
-
- case GF_FOP_FENTRYLK:
- {
- stub->args.fentrylk.fn (stub->frame,
- stub->frame->this,
+ &stub->args.entrylk.loc,
+ stub->args.entrylk.name,
+ stub->args.entrylk.cmd,
+ stub->args.entrylk.type);
+ break;
+ }
+
+ case GF_FOP_FENTRYLK:
+ {
+ stub->args.fentrylk.fn (stub->frame,
+ stub->frame->this,
stub->args.fentrylk.volume,
- stub->args.fentrylk.fd,
- stub->args.fentrylk.name,
- stub->args.fentrylk.cmd,
- stub->args.fentrylk.type);
- break;
- }
-
- break;
-
- case GF_FOP_LOOKUP:
- {
- stub->args.lookup.fn (stub->frame,
- stub->frame->this,
- &stub->args.lookup.loc,
- stub->args.lookup.xattr_req);
- break;
- }
-
- case GF_FOP_RCHECKSUM:
- {
- stub->args.rchecksum.fn (stub->frame,
+ stub->args.fentrylk.fd,
+ stub->args.fentrylk.name,
+ stub->args.fentrylk.cmd,
+ stub->args.fentrylk.type);
+ break;
+ }
+
+ break;
+
+ case GF_FOP_LOOKUP:
+ {
+ stub->args.lookup.fn (stub->frame,
+ stub->frame->this,
+ &stub->args.lookup.loc,
+ stub->args.lookup.xattr_req);
+ break;
+ }
+
+ case GF_FOP_RCHECKSUM:
+ {
+ stub->args.rchecksum.fn (stub->frame,
stub->frame->this,
stub->args.rchecksum.fd,
stub->args.rchecksum.offset,
stub->args.rchecksum.len);
- break;
- }
-
- case GF_FOP_READDIR:
- {
- stub->args.readdir.fn (stub->frame,
- stub->frame->this,
- stub->args.readdir.fd,
- stub->args.readdir.size,
- stub->args.readdir.off);
- break;
- }
+ break;
+ }
+
+ case GF_FOP_READDIR:
+ {
+ stub->args.readdir.fn (stub->frame,
+ stub->frame->this,
+ stub->args.readdir.fd,
+ stub->args.readdir.size,
+ stub->args.readdir.off);
+ break;
+ }
case GF_FOP_READDIRP:
- {
- stub->args.readdirp.fn (stub->frame,
- stub->frame->this,
- stub->args.readdirp.fd,
- stub->args.readdirp.size,
- stub->args.readdirp.off);
- break;
- }
-
- case GF_FOP_XATTROP:
- {
- stub->args.xattrop.fn (stub->frame,
- stub->frame->this,
- &stub->args.xattrop.loc,
- stub->args.xattrop.optype,
- stub->args.xattrop.xattr);
-
- break;
- }
- case GF_FOP_FXATTROP:
- {
- stub->args.fxattrop.fn (stub->frame,
- stub->frame->this,
- stub->args.fxattrop.fd,
- stub->args.fxattrop.optype,
- stub->args.fxattrop.xattr);
-
- break;
- }
+ {
+ stub->args.readdirp.fn (stub->frame,
+ stub->frame->this,
+ stub->args.readdirp.fd,
+ stub->args.readdirp.size,
+ stub->args.readdirp.off);
+ break;
+ }
+
+ case GF_FOP_XATTROP:
+ {
+ stub->args.xattrop.fn (stub->frame,
+ stub->frame->this,
+ &stub->args.xattrop.loc,
+ stub->args.xattrop.optype,
+ stub->args.xattrop.xattr);
+
+ break;
+ }
+ case GF_FOP_FXATTROP:
+ {
+ stub->args.fxattrop.fn (stub->frame,
+ stub->frame->this,
+ stub->args.fxattrop.fd,
+ stub->args.fxattrop.optype,
+ stub->args.fxattrop.xattr);
+
+ break;
+ }
case GF_FOP_SETATTR:
{
stub->args.setattr.fn (stub->frame,
@@ -2493,16 +2493,16 @@ call_resume_wind (call_stub_t *stub)
stub->args.fsetattr.valid);
break;
}
- default:
- {
- gf_log ("call-stub", GF_LOG_ERROR, "Invalid value of FOP (%d)",
+ default:
+ {
+ gf_log ("call-stub", GF_LOG_ERROR, "Invalid value of FOP (%d)",
stub->fop);
break;
- }
+ }
- }
+ }
out:
- return;
+ return;
}
@@ -2510,746 +2510,746 @@ out:
static void
call_resume_unwind (call_stub_t *stub)
{
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
-
- switch (stub->fop) {
- case GF_FOP_OPEN:
- {
- if (!stub->args.open_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.open_cbk.op_ret,
- stub->args.open_cbk.op_errno,
- stub->args.open_cbk.fd);
- else
- stub->args.open_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.open_cbk.op_ret,
- stub->args.open_cbk.op_errno,
- stub->args.open_cbk.fd);
- break;
- }
-
- case GF_FOP_CREATE:
- {
- if (!stub->args.create_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.create_cbk.op_ret,
- stub->args.create_cbk.op_errno,
- stub->args.create_cbk.fd,
- stub->args.create_cbk.inode,
- &stub->args.create_cbk.buf,
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ switch (stub->fop) {
+ case GF_FOP_OPEN:
+ {
+ if (!stub->args.open_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.open_cbk.op_ret,
+ stub->args.open_cbk.op_errno,
+ stub->args.open_cbk.fd);
+ else
+ stub->args.open_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.open_cbk.op_ret,
+ stub->args.open_cbk.op_errno,
+ stub->args.open_cbk.fd);
+ break;
+ }
+
+ case GF_FOP_CREATE:
+ {
+ if (!stub->args.create_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.create_cbk.op_ret,
+ stub->args.create_cbk.op_errno,
+ stub->args.create_cbk.fd,
+ stub->args.create_cbk.inode,
+ &stub->args.create_cbk.buf,
&stub->args.create_cbk.preparent,
&stub->args.create_cbk.postparent);
- else
- stub->args.create_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.create_cbk.op_ret,
- stub->args.create_cbk.op_errno,
- stub->args.create_cbk.fd,
- stub->args.create_cbk.inode,
- &stub->args.create_cbk.buf,
+ else
+ stub->args.create_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.create_cbk.op_ret,
+ stub->args.create_cbk.op_errno,
+ stub->args.create_cbk.fd,
+ stub->args.create_cbk.inode,
+ &stub->args.create_cbk.buf,
&stub->args.create_cbk.preparent,
&stub->args.create_cbk.postparent);
-
- break;
- }
-
- case GF_FOP_STAT:
- {
- if (!stub->args.stat_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.stat_cbk.op_ret,
- stub->args.stat_cbk.op_errno,
- &stub->args.stat_cbk.buf);
- else
- stub->args.stat_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.stat_cbk.op_ret,
- stub->args.stat_cbk.op_errno,
- &stub->args.stat_cbk.buf);
-
- break;
- }
-
- case GF_FOP_READLINK:
- {
- if (!stub->args.readlink_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.readlink_cbk.op_ret,
- stub->args.readlink_cbk.op_errno,
- stub->args.readlink_cbk.buf,
+
+ break;
+ }
+
+ case GF_FOP_STAT:
+ {
+ if (!stub->args.stat_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.stat_cbk.op_ret,
+ stub->args.stat_cbk.op_errno,
+ &stub->args.stat_cbk.buf);
+ else
+ stub->args.stat_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.stat_cbk.op_ret,
+ stub->args.stat_cbk.op_errno,
+ &stub->args.stat_cbk.buf);
+
+ break;
+ }
+
+ case GF_FOP_READLINK:
+ {
+ if (!stub->args.readlink_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.readlink_cbk.op_ret,
+ stub->args.readlink_cbk.op_errno,
+ stub->args.readlink_cbk.buf,
&stub->args.readlink_cbk.sbuf);
- else
- stub->args.readlink_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.readlink_cbk.op_ret,
- stub->args.readlink_cbk.op_errno,
- stub->args.readlink_cbk.buf,
+ else
+ stub->args.readlink_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.readlink_cbk.op_ret,
+ stub->args.readlink_cbk.op_errno,
+ stub->args.readlink_cbk.buf,
&stub->args.readlink_cbk.sbuf);
- break;
- }
-
- case GF_FOP_MKNOD:
- {
- if (!stub->args.mknod_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.mknod_cbk.op_ret,
- stub->args.mknod_cbk.op_errno,
- stub->args.mknod_cbk.inode,
+ break;
+ }
+
+ case GF_FOP_MKNOD:
+ {
+ if (!stub->args.mknod_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.mknod_cbk.op_ret,
+ stub->args.mknod_cbk.op_errno,
+ stub->args.mknod_cbk.inode,
&stub->args.mknod_cbk.buf,
&stub->args.mknod_cbk.preparent,
&stub->args.mknod_cbk.postparent);
- else
- stub->args.mknod_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.mknod_cbk.op_ret,
- stub->args.mknod_cbk.op_errno,
- stub->args.mknod_cbk.inode,
+ else
+ stub->args.mknod_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.mknod_cbk.op_ret,
+ stub->args.mknod_cbk.op_errno,
+ stub->args.mknod_cbk.inode,
&stub->args.mknod_cbk.buf,
&stub->args.mknod_cbk.preparent,
&stub->args.mknod_cbk.postparent);
- break;
- }
-
- case GF_FOP_MKDIR:
- {
- if (!stub->args.mkdir_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.mkdir_cbk.op_ret,
- stub->args.mkdir_cbk.op_errno,
- stub->args.mkdir_cbk.inode,
+ break;
+ }
+
+ case GF_FOP_MKDIR:
+ {
+ if (!stub->args.mkdir_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.mkdir_cbk.op_ret,
+ stub->args.mkdir_cbk.op_errno,
+ stub->args.mkdir_cbk.inode,
&stub->args.mkdir_cbk.buf,
&stub->args.mkdir_cbk.preparent,
&stub->args.mkdir_cbk.postparent);
- else
- stub->args.mkdir_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.mkdir_cbk.op_ret,
- stub->args.mkdir_cbk.op_errno,
- stub->args.mkdir_cbk.inode,
+ else
+ stub->args.mkdir_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.mkdir_cbk.op_ret,
+ stub->args.mkdir_cbk.op_errno,
+ stub->args.mkdir_cbk.inode,
&stub->args.mkdir_cbk.buf,
&stub->args.mkdir_cbk.preparent,
&stub->args.mkdir_cbk.postparent);
- if (stub->args.mkdir_cbk.inode)
- inode_unref (stub->args.mkdir_cbk.inode);
-
- break;
- }
-
- case GF_FOP_UNLINK:
- {
- if (!stub->args.unlink_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.unlink_cbk.op_ret,
- stub->args.unlink_cbk.op_errno,
+ if (stub->args.mkdir_cbk.inode)
+ inode_unref (stub->args.mkdir_cbk.inode);
+
+ break;
+ }
+
+ case GF_FOP_UNLINK:
+ {
+ if (!stub->args.unlink_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.unlink_cbk.op_ret,
+ stub->args.unlink_cbk.op_errno,
&stub->args.unlink_cbk.preparent,
&stub->args.unlink_cbk.postparent);
- else
- stub->args.unlink_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.unlink_cbk.op_ret,
- stub->args.unlink_cbk.op_errno,
+ else
+ stub->args.unlink_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.unlink_cbk.op_ret,
+ stub->args.unlink_cbk.op_errno,
&stub->args.unlink_cbk.preparent,
&stub->args.unlink_cbk.postparent);
- break;
- }
-
- case GF_FOP_RMDIR:
- {
- if (!stub->args.rmdir_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.rmdir_cbk.op_ret,
- stub->args.rmdir_cbk.op_errno,
+ break;
+ }
+
+ case GF_FOP_RMDIR:
+ {
+ if (!stub->args.rmdir_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.rmdir_cbk.op_ret,
+ stub->args.rmdir_cbk.op_errno,
&stub->args.rmdir_cbk.preparent,
&stub->args.rmdir_cbk.postparent);
- else
- stub->args.rmdir_cbk.fn (stub->frame,
+ else
+ stub->args.rmdir_cbk.fn (stub->frame,
stub->frame->cookie,
stub->frame->this,
stub->args.rmdir_cbk.op_ret,
stub->args.rmdir_cbk.op_errno,
&stub->args.rmdir_cbk.preparent,
&stub->args.rmdir_cbk.postparent);
- break;
- }
-
- case GF_FOP_SYMLINK:
- {
- if (!stub->args.symlink_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.symlink_cbk.op_ret,
- stub->args.symlink_cbk.op_errno,
- stub->args.symlink_cbk.inode,
+ break;
+ }
+
+ case GF_FOP_SYMLINK:
+ {
+ if (!stub->args.symlink_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.symlink_cbk.op_ret,
+ stub->args.symlink_cbk.op_errno,
+ stub->args.symlink_cbk.inode,
&stub->args.symlink_cbk.buf,
&stub->args.symlink_cbk.preparent,
&stub->args.symlink_cbk.postparent);
- else
- stub->args.symlink_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.symlink_cbk.op_ret,
- stub->args.symlink_cbk.op_errno,
- stub->args.symlink_cbk.inode,
+ else
+ stub->args.symlink_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.symlink_cbk.op_ret,
+ stub->args.symlink_cbk.op_errno,
+ stub->args.symlink_cbk.inode,
&stub->args.symlink_cbk.buf,
&stub->args.symlink_cbk.preparent,
&stub->args.symlink_cbk.postparent);
- }
- break;
-
- case GF_FOP_RENAME:
- {
+ }
+ break;
+
+ case GF_FOP_RENAME:
+ {
#if 0
- if (!stub->args.rename_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.rename_cbk.op_ret,
- stub->args.rename_cbk.op_errno,
- &stub->args.rename_cbk.buf,
+ if (!stub->args.rename_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.rename_cbk.op_ret,
+ stub->args.rename_cbk.op_errno,
+ &stub->args.rename_cbk.buf,
&stub->args.rename_cbk.preoldparent,
&stub->args.rename_cbk.postoldparent,
&stub->args.rename_cbk.prenewparent,
&stub->args.rename_cbk.postnewparent);
- else
- stub->args.rename_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.rename_cbk.op_ret,
- stub->args.rename_cbk.op_errno,
- &stub->args.rename_cbk.buf,
+ else
+ stub->args.rename_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.rename_cbk.op_ret,
+ stub->args.rename_cbk.op_errno,
+ &stub->args.rename_cbk.buf,
&stub->args.rename_cbk.preoldparent,
&stub->args.rename_cbk.postoldparent,
&stub->args.rename_cbk.prenewparent,
&stub->args.rename_cbk.postnewparent);
#endif
- break;
- }
-
- case GF_FOP_LINK:
- {
- if (!stub->args.link_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.link_cbk.op_ret,
- stub->args.link_cbk.op_errno,
- stub->args.link_cbk.inode,
- &stub->args.link_cbk.buf);
- else
- stub->args.link_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.link_cbk.op_ret,
- stub->args.link_cbk.op_errno,
- stub->args.link_cbk.inode,
+ break;
+ }
+
+ case GF_FOP_LINK:
+ {
+ if (!stub->args.link_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.link_cbk.op_ret,
+ stub->args.link_cbk.op_errno,
+ stub->args.link_cbk.inode,
+ &stub->args.link_cbk.buf);
+ else
+ stub->args.link_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.link_cbk.op_ret,
+ stub->args.link_cbk.op_errno,
+ stub->args.link_cbk.inode,
&stub->args.link_cbk.buf,
&stub->args.link_cbk.preparent,
&stub->args.link_cbk.postparent);
- break;
- }
-
- case GF_FOP_TRUNCATE:
- {
- if (!stub->args.truncate_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.truncate_cbk.op_ret,
- stub->args.truncate_cbk.op_errno,
- &stub->args.truncate_cbk.prebuf,
+ break;
+ }
+
+ case GF_FOP_TRUNCATE:
+ {
+ if (!stub->args.truncate_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.truncate_cbk.op_ret,
+ stub->args.truncate_cbk.op_errno,
+ &stub->args.truncate_cbk.prebuf,
&stub->args.truncate_cbk.postbuf);
- else
- stub->args.truncate_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.truncate_cbk.op_ret,
- stub->args.truncate_cbk.op_errno,
- &stub->args.truncate_cbk.prebuf,
+ else
+ stub->args.truncate_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.truncate_cbk.op_ret,
+ stub->args.truncate_cbk.op_errno,
+ &stub->args.truncate_cbk.prebuf,
&stub->args.truncate_cbk.postbuf);
- break;
- }
-
- case GF_FOP_READ:
- {
- if (!stub->args.readv_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.readv_cbk.op_ret,
- stub->args.readv_cbk.op_errno,
- stub->args.readv_cbk.vector,
- stub->args.readv_cbk.count,
- &stub->args.readv_cbk.stbuf,
+ break;
+ }
+
+ case GF_FOP_READ:
+ {
+ if (!stub->args.readv_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.readv_cbk.op_ret,
+ stub->args.readv_cbk.op_errno,
+ stub->args.readv_cbk.vector,
+ stub->args.readv_cbk.count,
+ &stub->args.readv_cbk.stbuf,
stub->args.readv_cbk.iobref);
- else
- stub->args.readv_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.readv_cbk.op_ret,
- stub->args.readv_cbk.op_errno,
- stub->args.readv_cbk.vector,
- stub->args.readv_cbk.count,
- &stub->args.readv_cbk.stbuf,
+ else
+ stub->args.readv_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.readv_cbk.op_ret,
+ stub->args.readv_cbk.op_errno,
+ stub->args.readv_cbk.vector,
+ stub->args.readv_cbk.count,
+ &stub->args.readv_cbk.stbuf,
stub->args.readv_cbk.iobref);
- }
- break;
-
- case GF_FOP_WRITE:
- {
- if (!stub->args.writev_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.writev_cbk.op_ret,
- stub->args.writev_cbk.op_errno,
+ }
+ break;
+
+ case GF_FOP_WRITE:
+ {
+ if (!stub->args.writev_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.writev_cbk.op_ret,
+ stub->args.writev_cbk.op_errno,
&stub->args.writev_cbk.prebuf,
- &stub->args.writev_cbk.postbuf);
- else
- stub->args.writev_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.writev_cbk.op_ret,
- stub->args.writev_cbk.op_errno,
+ &stub->args.writev_cbk.postbuf);
+ else
+ stub->args.writev_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.writev_cbk.op_ret,
+ stub->args.writev_cbk.op_errno,
&stub->args.writev_cbk.prebuf,
- &stub->args.writev_cbk.postbuf);
- break;
- }
-
- case GF_FOP_STATFS:
- {
- if (!stub->args.statfs_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.statfs_cbk.op_ret,
- stub->args.statfs_cbk.op_errno,
- &(stub->args.statfs_cbk.buf));
- else
- stub->args.statfs_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.statfs_cbk.op_ret,
- stub->args.statfs_cbk.op_errno,
- &(stub->args.statfs_cbk.buf));
- }
- break;
-
- case GF_FOP_FLUSH:
- {
- if (!stub->args.flush_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.flush_cbk.op_ret,
- stub->args.flush_cbk.op_errno);
- else
- stub->args.flush_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.flush_cbk.op_ret,
- stub->args.flush_cbk.op_errno);
-
- break;
- }
-
- case GF_FOP_FSYNC:
- {
- if (!stub->args.fsync_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.fsync_cbk.op_ret,
- stub->args.fsync_cbk.op_errno,
+ &stub->args.writev_cbk.postbuf);
+ break;
+ }
+
+ case GF_FOP_STATFS:
+ {
+ if (!stub->args.statfs_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.statfs_cbk.op_ret,
+ stub->args.statfs_cbk.op_errno,
+ &(stub->args.statfs_cbk.buf));
+ else
+ stub->args.statfs_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.statfs_cbk.op_ret,
+ stub->args.statfs_cbk.op_errno,
+ &(stub->args.statfs_cbk.buf));
+ }
+ break;
+
+ case GF_FOP_FLUSH:
+ {
+ if (!stub->args.flush_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.flush_cbk.op_ret,
+ stub->args.flush_cbk.op_errno);
+ else
+ stub->args.flush_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.flush_cbk.op_ret,
+ stub->args.flush_cbk.op_errno);
+
+ break;
+ }
+
+ case GF_FOP_FSYNC:
+ {
+ if (!stub->args.fsync_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.fsync_cbk.op_ret,
+ stub->args.fsync_cbk.op_errno,
&stub->args.fsync_cbk.prebuf,
&stub->args.fsync_cbk.postbuf);
- else
- stub->args.fsync_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.fsync_cbk.op_ret,
- stub->args.fsync_cbk.op_errno,
+ else
+ stub->args.fsync_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.fsync_cbk.op_ret,
+ stub->args.fsync_cbk.op_errno,
&stub->args.fsync_cbk.prebuf,
&stub->args.fsync_cbk.postbuf);
- break;
- }
-
- case GF_FOP_SETXATTR:
- {
- if (!stub->args.setxattr_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.setxattr_cbk.op_ret,
- stub->args.setxattr_cbk.op_errno);
-
- else
- stub->args.setxattr_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.setxattr_cbk.op_ret,
- stub->args.setxattr_cbk.op_errno);
-
- break;
- }
-
- case GF_FOP_GETXATTR:
- {
- if (!stub->args.getxattr_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.getxattr_cbk.op_ret,
- stub->args.getxattr_cbk.op_errno,
- stub->args.getxattr_cbk.dict);
- else
- stub->args.getxattr_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.getxattr_cbk.op_ret,
- stub->args.getxattr_cbk.op_errno,
- stub->args.getxattr_cbk.dict);
- break;
- }
-
- case GF_FOP_FSETXATTR:
- {
- if (!stub->args.fsetxattr_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.fsetxattr_cbk.op_ret,
- stub->args.fsetxattr_cbk.op_errno);
-
- else
- stub->args.fsetxattr_cbk.fn (stub->frame,
+ break;
+ }
+
+ case GF_FOP_SETXATTR:
+ {
+ if (!stub->args.setxattr_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.setxattr_cbk.op_ret,
+ stub->args.setxattr_cbk.op_errno);
+
+ else
+ stub->args.setxattr_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.setxattr_cbk.op_ret,
+ stub->args.setxattr_cbk.op_errno);
+
+ break;
+ }
+
+ case GF_FOP_GETXATTR:
+ {
+ if (!stub->args.getxattr_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.getxattr_cbk.op_ret,
+ stub->args.getxattr_cbk.op_errno,
+ stub->args.getxattr_cbk.dict);
+ else
+ stub->args.getxattr_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.getxattr_cbk.op_ret,
+ stub->args.getxattr_cbk.op_errno,
+ stub->args.getxattr_cbk.dict);
+ break;
+ }
+
+ case GF_FOP_FSETXATTR:
+ {
+ if (!stub->args.fsetxattr_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.fsetxattr_cbk.op_ret,
+ stub->args.fsetxattr_cbk.op_errno);
+
+ else
+ stub->args.fsetxattr_cbk.fn (stub->frame,
stub->frame->cookie,
stub->frame->this,
stub->args.fsetxattr_cbk.op_ret,
stub->args.fsetxattr_cbk.op_errno);
- break;
- }
-
- case GF_FOP_FGETXATTR:
- {
- if (!stub->args.fgetxattr_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.fgetxattr_cbk.op_ret,
- stub->args.fgetxattr_cbk.op_errno,
- stub->args.fgetxattr_cbk.dict);
- else
- stub->args.fgetxattr_cbk.fn (stub->frame,
+ break;
+ }
+
+ case GF_FOP_FGETXATTR:
+ {
+ if (!stub->args.fgetxattr_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.fgetxattr_cbk.op_ret,
+ stub->args.fgetxattr_cbk.op_errno,
+ stub->args.fgetxattr_cbk.dict);
+ else
+ stub->args.fgetxattr_cbk.fn (stub->frame,
stub->frame->cookie,
stub->frame->this,
stub->args.fgetxattr_cbk.op_ret,
stub->args.fgetxattr_cbk.op_errno,
stub->args.fgetxattr_cbk.dict);
- break;
- }
-
- case GF_FOP_REMOVEXATTR:
- {
- if (!stub->args.removexattr_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.removexattr_cbk.op_ret,
- stub->args.removexattr_cbk.op_errno);
- else
- stub->args.removexattr_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.removexattr_cbk.op_ret,
- stub->args.removexattr_cbk.op_errno);
-
- break;
- }
-
- case GF_FOP_OPENDIR:
- {
- if (!stub->args.opendir_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.opendir_cbk.op_ret,
- stub->args.opendir_cbk.op_errno,
- stub->args.opendir_cbk.fd);
- else
- stub->args.opendir_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.opendir_cbk.op_ret,
- stub->args.opendir_cbk.op_errno,
- stub->args.opendir_cbk.fd);
- break;
- }
-
- case GF_FOP_FSYNCDIR:
- {
- if (!stub->args.fsyncdir_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.fsyncdir_cbk.op_ret,
- stub->args.fsyncdir_cbk.op_errno);
- else
- stub->args.fsyncdir_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.fsyncdir_cbk.op_ret,
- stub->args.fsyncdir_cbk.op_errno);
- break;
- }
-
- case GF_FOP_ACCESS:
- {
- if (!stub->args.access_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.access_cbk.op_ret,
- stub->args.access_cbk.op_errno);
- else
- stub->args.access_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.access_cbk.op_ret,
- stub->args.access_cbk.op_errno);
-
- break;
- }
-
- case GF_FOP_FTRUNCATE:
- {
- if (!stub->args.ftruncate_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.ftruncate_cbk.op_ret,
- stub->args.ftruncate_cbk.op_errno,
- &stub->args.ftruncate_cbk.prebuf,
- &stub->args.ftruncate_cbk.postbuf);
- else
- stub->args.ftruncate_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.ftruncate_cbk.op_ret,
- stub->args.ftruncate_cbk.op_errno,
- &stub->args.ftruncate_cbk.prebuf,
- &stub->args.ftruncate_cbk.postbuf);
- break;
- }
-
- case GF_FOP_FSTAT:
- {
- if (!stub->args.fstat_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.fstat_cbk.op_ret,
- stub->args.fstat_cbk.op_errno,
- &stub->args.fstat_cbk.buf);
- else
- stub->args.fstat_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.fstat_cbk.op_ret,
- stub->args.fstat_cbk.op_errno,
- &stub->args.fstat_cbk.buf);
-
- break;
- }
-
- case GF_FOP_LK:
- {
- if (!stub->args.lk_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.lk_cbk.op_ret,
- stub->args.lk_cbk.op_errno,
- &stub->args.lk_cbk.lock);
- else
- stub->args.lk_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.lk_cbk.op_ret,
- stub->args.lk_cbk.op_errno,
- &stub->args.lk_cbk.lock);
- break;
- }
-
- case GF_FOP_INODELK:
- {
- if (!stub->args.inodelk_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.inodelk_cbk.op_ret,
- stub->args.inodelk_cbk.op_errno);
-
- else
- stub->args.inodelk_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.inodelk_cbk.op_ret,
- stub->args.inodelk_cbk.op_errno);
- break;
- }
-
- case GF_FOP_FINODELK:
- {
- if (!stub->args.finodelk_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.finodelk_cbk.op_ret,
- stub->args.finodelk_cbk.op_errno);
-
- else
- stub->args.finodelk_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.finodelk_cbk.op_ret,
- stub->args.finodelk_cbk.op_errno);
- break;
- }
-
- case GF_FOP_ENTRYLK:
- {
- if (!stub->args.entrylk_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.entrylk_cbk.op_ret,
- stub->args.entrylk_cbk.op_errno);
-
- else
- stub->args.entrylk_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.entrylk_cbk.op_ret,
- stub->args.entrylk_cbk.op_errno);
- break;
- }
-
- case GF_FOP_FENTRYLK:
- {
- if (!stub->args.fentrylk_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.fentrylk_cbk.op_ret,
- stub->args.fentrylk_cbk.op_errno);
-
- else
- stub->args.fentrylk_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.fentrylk_cbk.op_ret,
- stub->args.fentrylk_cbk.op_errno);
- break;
- }
-
- case GF_FOP_LOOKUP:
- {
- if (!stub->args.lookup_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.lookup_cbk.op_ret,
- stub->args.lookup_cbk.op_errno,
- stub->args.lookup_cbk.inode,
- &stub->args.lookup_cbk.buf,
+ break;
+ }
+
+ case GF_FOP_REMOVEXATTR:
+ {
+ if (!stub->args.removexattr_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.removexattr_cbk.op_ret,
+ stub->args.removexattr_cbk.op_errno);
+ else
+ stub->args.removexattr_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.removexattr_cbk.op_ret,
+ stub->args.removexattr_cbk.op_errno);
+
+ break;
+ }
+
+ case GF_FOP_OPENDIR:
+ {
+ if (!stub->args.opendir_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.opendir_cbk.op_ret,
+ stub->args.opendir_cbk.op_errno,
+ stub->args.opendir_cbk.fd);
+ else
+ stub->args.opendir_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.opendir_cbk.op_ret,
+ stub->args.opendir_cbk.op_errno,
+ stub->args.opendir_cbk.fd);
+ break;
+ }
+
+ case GF_FOP_FSYNCDIR:
+ {
+ if (!stub->args.fsyncdir_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.fsyncdir_cbk.op_ret,
+ stub->args.fsyncdir_cbk.op_errno);
+ else
+ stub->args.fsyncdir_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.fsyncdir_cbk.op_ret,
+ stub->args.fsyncdir_cbk.op_errno);
+ break;
+ }
+
+ case GF_FOP_ACCESS:
+ {
+ if (!stub->args.access_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.access_cbk.op_ret,
+ stub->args.access_cbk.op_errno);
+ else
+ stub->args.access_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.access_cbk.op_ret,
+ stub->args.access_cbk.op_errno);
+
+ break;
+ }
+
+ case GF_FOP_FTRUNCATE:
+ {
+ if (!stub->args.ftruncate_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.ftruncate_cbk.op_ret,
+ stub->args.ftruncate_cbk.op_errno,
+ &stub->args.ftruncate_cbk.prebuf,
+ &stub->args.ftruncate_cbk.postbuf);
+ else
+ stub->args.ftruncate_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.ftruncate_cbk.op_ret,
+ stub->args.ftruncate_cbk.op_errno,
+ &stub->args.ftruncate_cbk.prebuf,
+ &stub->args.ftruncate_cbk.postbuf);
+ break;
+ }
+
+ case GF_FOP_FSTAT:
+ {
+ if (!stub->args.fstat_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.fstat_cbk.op_ret,
+ stub->args.fstat_cbk.op_errno,
+ &stub->args.fstat_cbk.buf);
+ else
+ stub->args.fstat_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.fstat_cbk.op_ret,
+ stub->args.fstat_cbk.op_errno,
+ &stub->args.fstat_cbk.buf);
+
+ break;
+ }
+
+ case GF_FOP_LK:
+ {
+ if (!stub->args.lk_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.lk_cbk.op_ret,
+ stub->args.lk_cbk.op_errno,
+ &stub->args.lk_cbk.lock);
+ else
+ stub->args.lk_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.lk_cbk.op_ret,
+ stub->args.lk_cbk.op_errno,
+ &stub->args.lk_cbk.lock);
+ break;
+ }
+
+ case GF_FOP_INODELK:
+ {
+ if (!stub->args.inodelk_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.inodelk_cbk.op_ret,
+ stub->args.inodelk_cbk.op_errno);
+
+ else
+ stub->args.inodelk_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.inodelk_cbk.op_ret,
+ stub->args.inodelk_cbk.op_errno);
+ break;
+ }
+
+ case GF_FOP_FINODELK:
+ {
+ if (!stub->args.finodelk_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.finodelk_cbk.op_ret,
+ stub->args.finodelk_cbk.op_errno);
+
+ else
+ stub->args.finodelk_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.finodelk_cbk.op_ret,
+ stub->args.finodelk_cbk.op_errno);
+ break;
+ }
+
+ case GF_FOP_ENTRYLK:
+ {
+ if (!stub->args.entrylk_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.entrylk_cbk.op_ret,
+ stub->args.entrylk_cbk.op_errno);
+
+ else
+ stub->args.entrylk_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.entrylk_cbk.op_ret,
+ stub->args.entrylk_cbk.op_errno);
+ break;
+ }
+
+ case GF_FOP_FENTRYLK:
+ {
+ if (!stub->args.fentrylk_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.fentrylk_cbk.op_ret,
+ stub->args.fentrylk_cbk.op_errno);
+
+ else
+ stub->args.fentrylk_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.fentrylk_cbk.op_ret,
+ stub->args.fentrylk_cbk.op_errno);
+ break;
+ }
+
+ case GF_FOP_LOOKUP:
+ {
+ if (!stub->args.lookup_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.lookup_cbk.op_ret,
+ stub->args.lookup_cbk.op_errno,
+ stub->args.lookup_cbk.inode,
+ &stub->args.lookup_cbk.buf,
stub->args.lookup_cbk.dict,
&stub->args.lookup_cbk.postparent);
- else
- stub->args.lookup_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.lookup_cbk.op_ret,
- stub->args.lookup_cbk.op_errno,
- stub->args.lookup_cbk.inode,
+ else
+ stub->args.lookup_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.lookup_cbk.op_ret,
+ stub->args.lookup_cbk.op_errno,
+ stub->args.lookup_cbk.inode,
&stub->args.lookup_cbk.buf,
stub->args.lookup_cbk.dict,
&stub->args.lookup_cbk.postparent);
- /* FIXME NULL should not be passed */
-
- if (stub->args.lookup_cbk.dict)
- dict_unref (stub->args.lookup_cbk.dict);
- if (stub->args.lookup_cbk.inode)
- inode_unref (stub->args.lookup_cbk.inode);
-
- break;
- }
-
- case GF_FOP_RCHECKSUM:
- {
- if (!stub->args.rchecksum_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.rchecksum_cbk.op_ret,
- stub->args.rchecksum_cbk.op_errno,
- stub->args.rchecksum_cbk.weak_checksum,
- stub->args.rchecksum_cbk.strong_checksum);
- else
- stub->args.rchecksum_cbk.fn (stub->frame,
+ /* FIXME NULL should not be passed */
+
+ if (stub->args.lookup_cbk.dict)
+ dict_unref (stub->args.lookup_cbk.dict);
+ if (stub->args.lookup_cbk.inode)
+ inode_unref (stub->args.lookup_cbk.inode);
+
+ break;
+ }
+
+ case GF_FOP_RCHECKSUM:
+ {
+ if (!stub->args.rchecksum_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.rchecksum_cbk.op_ret,
+ stub->args.rchecksum_cbk.op_errno,
+ stub->args.rchecksum_cbk.weak_checksum,
+ stub->args.rchecksum_cbk.strong_checksum);
+ else
+ stub->args.rchecksum_cbk.fn (stub->frame,
stub->frame->cookie,
stub->frame->this,
- stub->args.rchecksum_cbk.op_ret,
+ stub->args.rchecksum_cbk.op_ret,
stub->args.rchecksum_cbk.op_errno,
stub->args.rchecksum_cbk.weak_checksum,
stub->args.rchecksum_cbk.strong_checksum);
- if (stub->args.rchecksum_cbk.op_ret >= 0)
- {
- GF_FREE (stub->args.rchecksum_cbk.strong_checksum);
- }
-
- break;
- }
-
- case GF_FOP_READDIR:
- {
- if (!stub->args.readdir_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.readdir_cbk.op_ret,
- stub->args.readdir_cbk.op_errno,
- &stub->args.readdir_cbk.entries);
- else
- stub->args.readdir_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.readdir_cbk.op_ret,
- stub->args.readdir_cbk.op_errno,
- &stub->args.readdir_cbk.entries);
-
- if (stub->args.readdir_cbk.op_ret > 0)
- gf_dirent_free (&stub->args.readdir_cbk.entries);
-
- break;
- }
+ if (stub->args.rchecksum_cbk.op_ret >= 0)
+ {
+ GF_FREE (stub->args.rchecksum_cbk.strong_checksum);
+ }
+
+ break;
+ }
+
+ case GF_FOP_READDIR:
+ {
+ if (!stub->args.readdir_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.readdir_cbk.op_ret,
+ stub->args.readdir_cbk.op_errno,
+ &stub->args.readdir_cbk.entries);
+ else
+ stub->args.readdir_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.readdir_cbk.op_ret,
+ stub->args.readdir_cbk.op_errno,
+ &stub->args.readdir_cbk.entries);
+
+ if (stub->args.readdir_cbk.op_ret > 0)
+ gf_dirent_free (&stub->args.readdir_cbk.entries);
+
+ break;
+ }
case GF_FOP_READDIRP:
- {
- if (!stub->args.readdirp_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.readdirp_cbk.op_ret,
- stub->args.readdirp_cbk.op_errno,
- &stub->args.readdirp_cbk.entries);
- else
- stub->args.readdirp_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.readdirp_cbk.op_ret,
- stub->args.readdirp_cbk.op_errno,
- &stub->args.readdirp_cbk.entries);
-
- if (stub->args.readdirp_cbk.op_ret > 0)
- gf_dirent_free (&stub->args.readdirp_cbk.entries);
-
- break;
- }
-
- case GF_FOP_XATTROP:
- {
- if (!stub->args.xattrop_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.xattrop_cbk.op_ret,
- stub->args.xattrop_cbk.op_errno);
- else
- stub->args.xattrop_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.xattrop_cbk.op_ret,
- stub->args.xattrop_cbk.op_errno,
- stub->args.xattrop_cbk.xattr);
-
- if (stub->args.xattrop_cbk.xattr)
- dict_unref (stub->args.xattrop_cbk.xattr);
-
- break;
- }
- case GF_FOP_FXATTROP:
- {
- if (!stub->args.fxattrop_cbk.fn)
- STACK_UNWIND (stub->frame,
- stub->args.fxattrop_cbk.op_ret,
- stub->args.fxattrop_cbk.op_errno);
- else
- stub->args.fxattrop_cbk.fn (stub->frame,
- stub->frame->cookie,
- stub->frame->this,
- stub->args.fxattrop_cbk.op_ret,
- stub->args.fxattrop_cbk.op_errno,
- stub->args.fxattrop_cbk.xattr);
-
- if (stub->args.fxattrop_cbk.xattr)
- dict_unref (stub->args.fxattrop_cbk.xattr);
-
- break;
- }
+ {
+ if (!stub->args.readdirp_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.readdirp_cbk.op_ret,
+ stub->args.readdirp_cbk.op_errno,
+ &stub->args.readdirp_cbk.entries);
+ else
+ stub->args.readdirp_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.readdirp_cbk.op_ret,
+ stub->args.readdirp_cbk.op_errno,
+ &stub->args.readdirp_cbk.entries);
+
+ if (stub->args.readdirp_cbk.op_ret > 0)
+ gf_dirent_free (&stub->args.readdirp_cbk.entries);
+
+ break;
+ }
+
+ case GF_FOP_XATTROP:
+ {
+ if (!stub->args.xattrop_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.xattrop_cbk.op_ret,
+ stub->args.xattrop_cbk.op_errno);
+ else
+ stub->args.xattrop_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.xattrop_cbk.op_ret,
+ stub->args.xattrop_cbk.op_errno,
+ stub->args.xattrop_cbk.xattr);
+
+ if (stub->args.xattrop_cbk.xattr)
+ dict_unref (stub->args.xattrop_cbk.xattr);
+
+ break;
+ }
+ case GF_FOP_FXATTROP:
+ {
+ if (!stub->args.fxattrop_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.fxattrop_cbk.op_ret,
+ stub->args.fxattrop_cbk.op_errno);
+ else
+ stub->args.fxattrop_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.fxattrop_cbk.op_ret,
+ stub->args.fxattrop_cbk.op_errno,
+ stub->args.fxattrop_cbk.xattr);
+
+ if (stub->args.fxattrop_cbk.xattr)
+ dict_unref (stub->args.fxattrop_cbk.xattr);
+
+ break;
+ }
case GF_FOP_SETATTR:
{
if (!stub->args.setattr_cbk.fn)
@@ -3289,305 +3289,305 @@ call_resume_unwind (call_stub_t *stub)
break;
}
default:
- {
- gf_log ("call-stub", GF_LOG_ERROR, "Invalid value of FOP (%d)",
+ {
+ gf_log ("call-stub", GF_LOG_ERROR, "Invalid value of FOP (%d)",
stub->fop);
break;
- }
- }
+ }
+ }
out:
- return;
+ return;
}
static void
call_stub_destroy_wind (call_stub_t *stub)
{
- switch (stub->fop) {
- case GF_FOP_OPEN:
- {
- loc_wipe (&stub->args.open.loc);
- if (stub->args.open.fd)
- fd_unref (stub->args.open.fd);
- break;
- }
- case GF_FOP_CREATE:
- {
- loc_wipe (&stub->args.create.loc);
- if (stub->args.create.fd)
- fd_unref (stub->args.create.fd);
+ switch (stub->fop) {
+ case GF_FOP_OPEN:
+ {
+ loc_wipe (&stub->args.open.loc);
+ if (stub->args.open.fd)
+ fd_unref (stub->args.open.fd);
+ break;
+ }
+ case GF_FOP_CREATE:
+ {
+ loc_wipe (&stub->args.create.loc);
+ if (stub->args.create.fd)
+ fd_unref (stub->args.create.fd);
if (stub->args.create.params)
dict_unref (stub->args.create.params);
- break;
- }
- case GF_FOP_STAT:
- {
- loc_wipe (&stub->args.stat.loc);
- break;
- }
- case GF_FOP_READLINK:
- {
- loc_wipe (&stub->args.readlink.loc);
- break;
- }
-
- case GF_FOP_MKNOD:
- {
- loc_wipe (&stub->args.mknod.loc);
+ break;
+ }
+ case GF_FOP_STAT:
+ {
+ loc_wipe (&stub->args.stat.loc);
+ break;
+ }
+ case GF_FOP_READLINK:
+ {
+ loc_wipe (&stub->args.readlink.loc);
+ break;
+ }
+
+ case GF_FOP_MKNOD:
+ {
+ loc_wipe (&stub->args.mknod.loc);
if (stub->args.mknod.params)
dict_unref (stub->args.mknod.params);
- }
- break;
-
- case GF_FOP_MKDIR:
- {
- loc_wipe (&stub->args.mkdir.loc);
+ }
+ break;
+
+ case GF_FOP_MKDIR:
+ {
+ loc_wipe (&stub->args.mkdir.loc);
if (stub->args.mkdir.params)
dict_unref (stub->args.mkdir.params);
- }
- break;
-
- case GF_FOP_UNLINK:
- {
- loc_wipe (&stub->args.unlink.loc);
- }
- break;
-
- case GF_FOP_RMDIR:
- {
- loc_wipe (&stub->args.rmdir.loc);
- }
- break;
-
- case GF_FOP_SYMLINK:
- {
- GF_FREE ((char *)stub->args.symlink.linkname);
- loc_wipe (&stub->args.symlink.loc);
+ }
+ break;
+
+ case GF_FOP_UNLINK:
+ {
+ loc_wipe (&stub->args.unlink.loc);
+ }
+ break;
+
+ case GF_FOP_RMDIR:
+ {
+ loc_wipe (&stub->args.rmdir.loc);
+ }
+ break;
+
+ case GF_FOP_SYMLINK:
+ {
+ GF_FREE ((char *)stub->args.symlink.linkname);
+ loc_wipe (&stub->args.symlink.loc);
if (stub->args.symlink.params)
dict_unref (stub->args.symlink.params);
- }
- break;
-
- case GF_FOP_RENAME:
- {
- loc_wipe (&stub->args.rename.old);
- loc_wipe (&stub->args.rename.new);
- }
- break;
-
- case GF_FOP_LINK:
- {
- loc_wipe (&stub->args.link.oldloc);
- loc_wipe (&stub->args.link.newloc);
- }
- break;
-
- case GF_FOP_TRUNCATE:
- {
- loc_wipe (&stub->args.truncate.loc);
- break;
- }
-
- case GF_FOP_READ:
- {
- if (stub->args.readv.fd)
- fd_unref (stub->args.readv.fd);
- break;
- }
-
- case GF_FOP_WRITE:
- {
- struct iobref *iobref = stub->args.writev.iobref;
- if (stub->args.writev.fd)
- fd_unref (stub->args.writev.fd);
- GF_FREE (stub->args.writev.vector);
- if (iobref)
- iobref_unref (iobref);
- break;
- }
-
- case GF_FOP_STATFS:
- {
- loc_wipe (&stub->args.statfs.loc);
- break;
- }
- case GF_FOP_FLUSH:
- {
- if (stub->args.flush.fd)
- fd_unref (stub->args.flush.fd);
- break;
- }
-
- case GF_FOP_FSYNC:
- {
- if (stub->args.fsync.fd)
- fd_unref (stub->args.fsync.fd);
- break;
- }
-
- case GF_FOP_SETXATTR:
- {
- loc_wipe (&stub->args.setxattr.loc);
- if (stub->args.setxattr.dict)
- dict_unref (stub->args.setxattr.dict);
- break;
- }
-
- case GF_FOP_GETXATTR:
- {
- if (stub->args.getxattr.name)
- GF_FREE ((char *)stub->args.getxattr.name);
- loc_wipe (&stub->args.getxattr.loc);
- break;
- }
-
- case GF_FOP_FSETXATTR:
- {
- fd_unref (stub->args.fsetxattr.fd);
- if (stub->args.fsetxattr.dict)
- dict_unref (stub->args.fsetxattr.dict);
- break;
- }
-
- case GF_FOP_FGETXATTR:
- {
- if (stub->args.fgetxattr.name)
- GF_FREE ((char *)stub->args.fgetxattr.name);
- fd_unref (stub->args.fgetxattr.fd);
- break;
- }
-
- case GF_FOP_REMOVEXATTR:
- {
- loc_wipe (&stub->args.removexattr.loc);
- GF_FREE ((char *)stub->args.removexattr.name);
- break;
- }
-
- case GF_FOP_OPENDIR:
- {
- loc_wipe (&stub->args.opendir.loc);
- if (stub->args.opendir.fd)
- fd_unref (stub->args.opendir.fd);
- break;
- }
-
- case GF_FOP_FSYNCDIR:
- {
- if (stub->args.fsyncdir.fd)
- fd_unref (stub->args.fsyncdir.fd);
- break;
- }
-
- case GF_FOP_ACCESS:
- {
- loc_wipe (&stub->args.access.loc);
- break;
- }
-
- case GF_FOP_FTRUNCATE:
- {
- if (stub->args.ftruncate.fd)
- fd_unref (stub->args.ftruncate.fd);
- break;
- }
-
- case GF_FOP_FSTAT:
- {
- if (stub->args.fstat.fd)
- fd_unref (stub->args.fstat.fd);
- break;
- }
-
- case GF_FOP_LK:
- {
- if (stub->args.lk.fd)
- fd_unref (stub->args.lk.fd);
- break;
- }
-
- case GF_FOP_INODELK:
- {
+ }
+ break;
+
+ case GF_FOP_RENAME:
+ {
+ loc_wipe (&stub->args.rename.old);
+ loc_wipe (&stub->args.rename.new);
+ }
+ break;
+
+ case GF_FOP_LINK:
+ {
+ loc_wipe (&stub->args.link.oldloc);
+ loc_wipe (&stub->args.link.newloc);
+ }
+ break;
+
+ case GF_FOP_TRUNCATE:
+ {
+ loc_wipe (&stub->args.truncate.loc);
+ break;
+ }
+
+ case GF_FOP_READ:
+ {
+ if (stub->args.readv.fd)
+ fd_unref (stub->args.readv.fd);
+ break;
+ }
+
+ case GF_FOP_WRITE:
+ {
+ struct iobref *iobref = stub->args.writev.iobref;
+ if (stub->args.writev.fd)
+ fd_unref (stub->args.writev.fd);
+ GF_FREE (stub->args.writev.vector);
+ if (iobref)
+ iobref_unref (iobref);
+ break;
+ }
+
+ case GF_FOP_STATFS:
+ {
+ loc_wipe (&stub->args.statfs.loc);
+ break;
+ }
+ case GF_FOP_FLUSH:
+ {
+ if (stub->args.flush.fd)
+ fd_unref (stub->args.flush.fd);
+ break;
+ }
+
+ case GF_FOP_FSYNC:
+ {
+ if (stub->args.fsync.fd)
+ fd_unref (stub->args.fsync.fd);
+ break;
+ }
+
+ case GF_FOP_SETXATTR:
+ {
+ loc_wipe (&stub->args.setxattr.loc);
+ if (stub->args.setxattr.dict)
+ dict_unref (stub->args.setxattr.dict);
+ break;
+ }
+
+ case GF_FOP_GETXATTR:
+ {
+ if (stub->args.getxattr.name)
+ GF_FREE ((char *)stub->args.getxattr.name);
+ loc_wipe (&stub->args.getxattr.loc);
+ break;
+ }
+
+ case GF_FOP_FSETXATTR:
+ {
+ fd_unref (stub->args.fsetxattr.fd);
+ if (stub->args.fsetxattr.dict)
+ dict_unref (stub->args.fsetxattr.dict);
+ break;
+ }
+
+ case GF_FOP_FGETXATTR:
+ {
+ if (stub->args.fgetxattr.name)
+ GF_FREE ((char *)stub->args.fgetxattr.name);
+ fd_unref (stub->args.fgetxattr.fd);
+ break;
+ }
+
+ case GF_FOP_REMOVEXATTR:
+ {
+ loc_wipe (&stub->args.removexattr.loc);
+ GF_FREE ((char *)stub->args.removexattr.name);
+ break;
+ }
+
+ case GF_FOP_OPENDIR:
+ {
+ loc_wipe (&stub->args.opendir.loc);
+ if (stub->args.opendir.fd)
+ fd_unref (stub->args.opendir.fd);
+ break;
+ }
+
+ case GF_FOP_FSYNCDIR:
+ {
+ if (stub->args.fsyncdir.fd)
+ fd_unref (stub->args.fsyncdir.fd);
+ break;
+ }
+
+ case GF_FOP_ACCESS:
+ {
+ loc_wipe (&stub->args.access.loc);
+ break;
+ }
+
+ case GF_FOP_FTRUNCATE:
+ {
+ if (stub->args.ftruncate.fd)
+ fd_unref (stub->args.ftruncate.fd);
+ break;
+ }
+
+ case GF_FOP_FSTAT:
+ {
+ if (stub->args.fstat.fd)
+ fd_unref (stub->args.fstat.fd);
+ break;
+ }
+
+ case GF_FOP_LK:
+ {
+ if (stub->args.lk.fd)
+ fd_unref (stub->args.lk.fd);
+ break;
+ }
+
+ case GF_FOP_INODELK:
+ {
if (stub->args.inodelk.volume)
GF_FREE ((char *)stub->args.inodelk.volume);
- loc_wipe (&stub->args.inodelk.loc);
- break;
- }
- case GF_FOP_FINODELK:
- {
+ loc_wipe (&stub->args.inodelk.loc);
+ break;
+ }
+ case GF_FOP_FINODELK:
+ {
if (stub->args.finodelk.volume)
GF_FREE ((char *)stub->args.finodelk.volume);
- if (stub->args.finodelk.fd)
- fd_unref (stub->args.finodelk.fd);
- break;
- }
- case GF_FOP_ENTRYLK:
- {
+ if (stub->args.finodelk.fd)
+ fd_unref (stub->args.finodelk.fd);
+ break;
+ }
+ case GF_FOP_ENTRYLK:
+ {
if (stub->args.entrylk.volume)
GF_FREE ((char *)stub->args.entrylk.volume);
- if (stub->args.entrylk.name)
- GF_FREE ((char *)stub->args.entrylk.name);
- loc_wipe (&stub->args.entrylk.loc);
- break;
- }
- case GF_FOP_FENTRYLK:
- {
+ if (stub->args.entrylk.name)
+ GF_FREE ((char *)stub->args.entrylk.name);
+ loc_wipe (&stub->args.entrylk.loc);
+ break;
+ }
+ case GF_FOP_FENTRYLK:
+ {
if (stub->args.fentrylk.volume)
GF_FREE ((char *)stub->args.fentrylk.volume);
- if (stub->args.fentrylk.name)
- GF_FREE ((char *)stub->args.fentrylk.name);
-
- if (stub->args.fentrylk.fd)
- fd_unref (stub->args.fentrylk.fd);
- break;
- }
-
- case GF_FOP_LOOKUP:
- {
- loc_wipe (&stub->args.lookup.loc);
- if (stub->args.lookup.xattr_req)
- dict_unref (stub->args.lookup.xattr_req);
- break;
- }
-
- case GF_FOP_RCHECKSUM:
- {
+ if (stub->args.fentrylk.name)
+ GF_FREE ((char *)stub->args.fentrylk.name);
+
+ if (stub->args.fentrylk.fd)
+ fd_unref (stub->args.fentrylk.fd);
+ break;
+ }
+
+ case GF_FOP_LOOKUP:
+ {
+ loc_wipe (&stub->args.lookup.loc);
+ if (stub->args.lookup.xattr_req)
+ dict_unref (stub->args.lookup.xattr_req);
+ break;
+ }
+
+ case GF_FOP_RCHECKSUM:
+ {
if (stub->args.rchecksum.fd)
fd_unref (stub->args.rchecksum.fd);
- break;
- }
+ break;
+ }
- case GF_FOP_READDIR:
- {
- if (stub->args.readdir.fd)
- fd_unref (stub->args.readdir.fd);
- break;
- }
+ case GF_FOP_READDIR:
+ {
+ if (stub->args.readdir.fd)
+ fd_unref (stub->args.readdir.fd);
+ break;
+ }
case GF_FOP_READDIRP:
- {
- if (stub->args.readdirp.fd)
- fd_unref (stub->args.readdirp.fd);
- break;
- }
-
- case GF_FOP_XATTROP:
- {
- loc_wipe (&stub->args.xattrop.loc);
- dict_unref (stub->args.xattrop.xattr);
- break;
- }
- case GF_FOP_FXATTROP:
- {
- if (stub->args.fxattrop.fd)
- fd_unref (stub->args.fxattrop.fd);
- dict_unref (stub->args.fxattrop.xattr);
- break;
- }
+ {
+ if (stub->args.readdirp.fd)
+ fd_unref (stub->args.readdirp.fd);
+ break;
+ }
+
+ case GF_FOP_XATTROP:
+ {
+ loc_wipe (&stub->args.xattrop.loc);
+ dict_unref (stub->args.xattrop.xattr);
+ break;
+ }
+ case GF_FOP_FXATTROP:
+ {
+ if (stub->args.fxattrop.fd)
+ fd_unref (stub->args.fxattrop.fd);
+ dict_unref (stub->args.fxattrop.xattr);
+ break;
+ }
case GF_FOP_SETATTR:
{
loc_wipe (&stub->args.setattr.loc);
@@ -3600,216 +3600,216 @@ call_stub_destroy_wind (call_stub_t *stub)
break;
}
default:
- {
- gf_log ("call-stub", GF_LOG_ERROR, "Invalid value of FOP (%d)",
+ {
+ gf_log ("call-stub", GF_LOG_ERROR, "Invalid value of FOP (%d)",
stub->fop);
break;
- }
- }
+ }
+ }
}
static void
call_stub_destroy_unwind (call_stub_t *stub)
{
- switch (stub->fop) {
- case GF_FOP_OPEN:
- {
- if (stub->args.open_cbk.fd)
- fd_unref (stub->args.open_cbk.fd);
- }
- break;
-
- case GF_FOP_CREATE:
- {
- if (stub->args.create_cbk.fd)
- fd_unref (stub->args.create_cbk.fd);
-
- if (stub->args.create_cbk.inode)
- inode_unref (stub->args.create_cbk.inode);
- }
- break;
-
- case GF_FOP_STAT:
- break;
-
- case GF_FOP_READLINK:
- {
- if (stub->args.readlink_cbk.buf)
- GF_FREE ((char *)stub->args.readlink_cbk.buf);
- }
- break;
-
- case GF_FOP_MKNOD:
- {
- if (stub->args.mknod_cbk.inode)
- inode_unref (stub->args.mknod_cbk.inode);
- }
- break;
-
- case GF_FOP_MKDIR:
- {
- if (stub->args.mkdir_cbk.inode)
- inode_unref (stub->args.mkdir_cbk.inode);
- }
- break;
-
- case GF_FOP_UNLINK:
- break;
-
- case GF_FOP_RMDIR:
- break;
-
- case GF_FOP_SYMLINK:
- {
- if (stub->args.symlink_cbk.inode)
- inode_unref (stub->args.symlink_cbk.inode);
- }
- break;
-
- case GF_FOP_RENAME:
- break;
-
- case GF_FOP_LINK:
- {
- if (stub->args.link_cbk.inode)
- inode_unref (stub->args.link_cbk.inode);
- }
- break;
-
- case GF_FOP_TRUNCATE:
- break;
-
- case GF_FOP_READ:
- {
- if (stub->args.readv_cbk.op_ret >= 0) {
- struct iobref *iobref = stub->args.readv_cbk.iobref;
- GF_FREE (stub->args.readv_cbk.vector);
-
- if (iobref) {
- iobref_unref (iobref);
- }
- }
- }
- break;
-
- case GF_FOP_WRITE:
- break;
-
- case GF_FOP_STATFS:
- break;
-
- case GF_FOP_FLUSH:
- break;
-
- case GF_FOP_FSYNC:
- break;
-
- case GF_FOP_SETXATTR:
- break;
-
- case GF_FOP_GETXATTR:
- {
- if (stub->args.getxattr_cbk.dict)
- dict_unref (stub->args.getxattr_cbk.dict);
- }
- break;
-
- case GF_FOP_FSETXATTR:
- break;
-
- case GF_FOP_FGETXATTR:
- {
- if (stub->args.fgetxattr_cbk.dict)
- dict_unref (stub->args.fgetxattr_cbk.dict);
- }
- break;
-
- case GF_FOP_REMOVEXATTR:
- break;
-
- case GF_FOP_OPENDIR:
- {
- if (stub->args.opendir_cbk.fd)
- fd_unref (stub->args.opendir_cbk.fd);
- }
- break;
-
- case GF_FOP_FSYNCDIR:
- break;
-
- case GF_FOP_ACCESS:
- break;
-
- case GF_FOP_FTRUNCATE:
- break;
-
- case GF_FOP_FSTAT:
- break;
-
- case GF_FOP_LK:
- break;
-
- case GF_FOP_INODELK:
- break;
-
- case GF_FOP_FINODELK:
- break;
-
- case GF_FOP_ENTRYLK:
- break;
-
- case GF_FOP_FENTRYLK:
- break;
-
- case GF_FOP_LOOKUP:
- {
- if (stub->args.lookup_cbk.inode)
- inode_unref (stub->args.lookup_cbk.inode);
-
- if (stub->args.lookup_cbk.dict)
- dict_unref (stub->args.lookup_cbk.dict);
- }
- break;
-
- case GF_FOP_RCHECKSUM:
- {
- if (stub->args.rchecksum_cbk.op_ret >= 0) {
- GF_FREE (stub->args.rchecksum_cbk.strong_checksum);
- }
- }
- break;
-
- case GF_FOP_READDIR:
- {
- if (stub->args.readdir_cbk.op_ret > 0) {
- gf_dirent_free (&stub->args.readdir_cbk.entries);
- }
- }
- break;
+ switch (stub->fop) {
+ case GF_FOP_OPEN:
+ {
+ if (stub->args.open_cbk.fd)
+ fd_unref (stub->args.open_cbk.fd);
+ }
+ break;
+
+ case GF_FOP_CREATE:
+ {
+ if (stub->args.create_cbk.fd)
+ fd_unref (stub->args.create_cbk.fd);
+
+ if (stub->args.create_cbk.inode)
+ inode_unref (stub->args.create_cbk.inode);
+ }
+ break;
+
+ case GF_FOP_STAT:
+ break;
+
+ case GF_FOP_READLINK:
+ {
+ if (stub->args.readlink_cbk.buf)
+ GF_FREE ((char *)stub->args.readlink_cbk.buf);
+ }
+ break;
+
+ case GF_FOP_MKNOD:
+ {
+ if (stub->args.mknod_cbk.inode)
+ inode_unref (stub->args.mknod_cbk.inode);
+ }
+ break;
+
+ case GF_FOP_MKDIR:
+ {
+ if (stub->args.mkdir_cbk.inode)
+ inode_unref (stub->args.mkdir_cbk.inode);
+ }
+ break;
+
+ case GF_FOP_UNLINK:
+ break;
+
+ case GF_FOP_RMDIR:
+ break;
+
+ case GF_FOP_SYMLINK:
+ {
+ if (stub->args.symlink_cbk.inode)
+ inode_unref (stub->args.symlink_cbk.inode);
+ }
+ break;
+
+ case GF_FOP_RENAME:
+ break;
+
+ case GF_FOP_LINK:
+ {
+ if (stub->args.link_cbk.inode)
+ inode_unref (stub->args.link_cbk.inode);
+ }
+ break;
+
+ case GF_FOP_TRUNCATE:
+ break;
+
+ case GF_FOP_READ:
+ {
+ if (stub->args.readv_cbk.op_ret >= 0) {
+ struct iobref *iobref = stub->args.readv_cbk.iobref;
+ GF_FREE (stub->args.readv_cbk.vector);
+
+ if (iobref) {
+ iobref_unref (iobref);
+ }
+ }
+ }
+ break;
+
+ case GF_FOP_WRITE:
+ break;
+
+ case GF_FOP_STATFS:
+ break;
+
+ case GF_FOP_FLUSH:
+ break;
+
+ case GF_FOP_FSYNC:
+ break;
+
+ case GF_FOP_SETXATTR:
+ break;
+
+ case GF_FOP_GETXATTR:
+ {
+ if (stub->args.getxattr_cbk.dict)
+ dict_unref (stub->args.getxattr_cbk.dict);
+ }
+ break;
+
+ case GF_FOP_FSETXATTR:
+ break;
+
+ case GF_FOP_FGETXATTR:
+ {
+ if (stub->args.fgetxattr_cbk.dict)
+ dict_unref (stub->args.fgetxattr_cbk.dict);
+ }
+ break;
+
+ case GF_FOP_REMOVEXATTR:
+ break;
+
+ case GF_FOP_OPENDIR:
+ {
+ if (stub->args.opendir_cbk.fd)
+ fd_unref (stub->args.opendir_cbk.fd);
+ }
+ break;
+
+ case GF_FOP_FSYNCDIR:
+ break;
+
+ case GF_FOP_ACCESS:
+ break;
+
+ case GF_FOP_FTRUNCATE:
+ break;
+
+ case GF_FOP_FSTAT:
+ break;
+
+ case GF_FOP_LK:
+ break;
+
+ case GF_FOP_INODELK:
+ break;
+
+ case GF_FOP_FINODELK:
+ break;
+
+ case GF_FOP_ENTRYLK:
+ break;
+
+ case GF_FOP_FENTRYLK:
+ break;
+
+ case GF_FOP_LOOKUP:
+ {
+ if (stub->args.lookup_cbk.inode)
+ inode_unref (stub->args.lookup_cbk.inode);
+
+ if (stub->args.lookup_cbk.dict)
+ dict_unref (stub->args.lookup_cbk.dict);
+ }
+ break;
+
+ case GF_FOP_RCHECKSUM:
+ {
+ if (stub->args.rchecksum_cbk.op_ret >= 0) {
+ GF_FREE (stub->args.rchecksum_cbk.strong_checksum);
+ }
+ }
+ break;
+
+ case GF_FOP_READDIR:
+ {
+ if (stub->args.readdir_cbk.op_ret > 0) {
+ gf_dirent_free (&stub->args.readdir_cbk.entries);
+ }
+ }
+ break;
case GF_FOP_READDIRP:
- {
- if (stub->args.readdirp_cbk.op_ret > 0) {
- gf_dirent_free (&stub->args.readdirp_cbk.entries);
- }
- }
- break;
-
- case GF_FOP_XATTROP:
- {
- if (stub->args.xattrop_cbk.xattr)
- dict_unref (stub->args.xattrop_cbk.xattr);
- }
- break;
-
- case GF_FOP_FXATTROP:
- {
- if (stub->args.fxattrop_cbk.xattr)
- dict_unref (stub->args.fxattrop_cbk.xattr);
- }
- break;
-
+ {
+ if (stub->args.readdirp_cbk.op_ret > 0) {
+ gf_dirent_free (&stub->args.readdirp_cbk.entries);
+ }
+ }
+ break;
+
+ case GF_FOP_XATTROP:
+ {
+ if (stub->args.xattrop_cbk.xattr)
+ dict_unref (stub->args.xattrop_cbk.xattr);
+ }
+ break;
+
+ case GF_FOP_FXATTROP:
+ {
+ if (stub->args.fxattrop_cbk.xattr)
+ dict_unref (stub->args.fxattrop_cbk.xattr);
+ }
+ break;
+
case GF_FOP_SETATTR:
{
break;
@@ -3821,36 +3821,36 @@ call_stub_destroy_unwind (call_stub_t *stub)
}
default:
- {
- gf_log ("call-stub", GF_LOG_ERROR, "Invalid value of FOP (%d)",
+ {
+ gf_log ("call-stub", GF_LOG_ERROR, "Invalid value of FOP (%d)",
stub->fop);
break;
- }
- }
+ }
+ }
}
-
+
void
call_stub_destroy (call_stub_t *stub)
{
- struct mem_pool *tmp_pool = NULL;
+ struct mem_pool *tmp_pool = NULL;
+
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ tmp_pool = stub->stub_mem_pool;
- tmp_pool = stub->stub_mem_pool;
-
- if (stub->wind) {
- call_stub_destroy_wind (stub);
- } else {
- call_stub_destroy_unwind (stub);
- }
+ if (stub->wind) {
+ call_stub_destroy_wind (stub);
+ } else {
+ call_stub_destroy_unwind (stub);
+ }
- stub->stub_mem_pool = NULL;
- mem_put (tmp_pool, stub);
+ stub->stub_mem_pool = NULL;
+ mem_put (tmp_pool, stub);
out:
- tmp_pool = NULL;
+ tmp_pool = NULL;
- return;
+ return;
}
void
@@ -3858,10 +3858,10 @@ call_resume (call_stub_t *stub)
{
xlator_t *old_THIS = NULL;
- errno = EINVAL;
- GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+ errno = EINVAL;
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
- list_del_init (&stub->list);
+ list_del_init (&stub->list);
old_THIS = THIS;
THIS = stub->frame->this;
@@ -3873,9 +3873,7 @@ call_resume (call_stub_t *stub)
}
THIS = old_THIS;
- call_stub_destroy (stub);
+ call_stub_destroy (stub);
out:
- return;
+ return;
}
-
-
diff --git a/libglusterfs/src/checksum.c b/libglusterfs/src/checksum.c
index de86adc9a37..8c71f6c6ac7 100644
--- a/libglusterfs/src/checksum.c
+++ b/libglusterfs/src/checksum.c
@@ -1,20 +1,20 @@
/*
- Copyright (c) 2010 Gluster, Inc. <http://www.gluster.com>
- This file is part of GlusterFS.
-
- GlusterFS is free software; you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation; either version 3 of the License,
- or (at your option) any later version.
-
- GlusterFS 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
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see
- <http://www.gnu.org/licenses/>.
+ Copyright (c) 2010 Gluster, Inc. <http://www.gluster.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
*/
#include <inttypes.h>
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 98dbeb83110..3ae0f54c78c 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -53,8 +53,8 @@ typedef int32_t (*rw_op_t)(int32_t fd, char *buf, int32_t size);
typedef int32_t (*rwv_op_t)(int32_t fd, const struct iovec *buf, int32_t size);
struct dnscache6 {
- struct addrinfo *first;
- struct addrinfo *next;
+ struct addrinfo *first;
+ struct addrinfo *next;
};
@@ -74,138 +74,138 @@ log_base2 (unsigned long x)
int32_t
gf_resolve_ip6 (const char *hostname,
- uint16_t port,
- int family,
- void **dnscache,
- struct addrinfo **addr_info)
+ uint16_t port,
+ int family,
+ void **dnscache,
+ struct addrinfo **addr_info)
{
- int32_t ret = 0;
- struct addrinfo hints;
- struct dnscache6 *cache = NULL;
- char service[NI_MAXSERV], host[NI_MAXHOST];
-
- if (!hostname) {
- gf_log ("resolver", GF_LOG_WARNING, "hostname is NULL");
- return -1;
- }
-
- if (!*dnscache) {
- *dnscache = GF_CALLOC (1, sizeof (struct dnscache6),
- gf_common_mt_dnscache6);
+ int32_t ret = 0;
+ struct addrinfo hints;
+ struct dnscache6 *cache = NULL;
+ char service[NI_MAXSERV], host[NI_MAXHOST];
+
+ if (!hostname) {
+ gf_log ("resolver", GF_LOG_WARNING, "hostname is NULL");
+ return -1;
+ }
+
+ if (!*dnscache) {
+ *dnscache = GF_CALLOC (1, sizeof (struct dnscache6),
+ gf_common_mt_dnscache6);
if (!*dnscache)
return -1;
- }
-
- cache = *dnscache;
- if (cache->first && !cache->next) {
- freeaddrinfo(cache->first);
- cache->first = cache->next = NULL;
- gf_log ("resolver", GF_LOG_TRACE,
- "flushing DNS cache");
- }
-
- if (!cache->first) {
- char *port_str = NULL;
- gf_log ("resolver", GF_LOG_TRACE,
- "DNS cache not present, freshly probing hostname: %s",
- hostname);
-
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = family;
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_flags = AI_ADDRCONFIG;
-
- ret = gf_asprintf (&port_str, "%d", port);
+ }
+
+ cache = *dnscache;
+ if (cache->first && !cache->next) {
+ freeaddrinfo(cache->first);
+ cache->first = cache->next = NULL;
+ gf_log ("resolver", GF_LOG_TRACE,
+ "flushing DNS cache");
+ }
+
+ if (!cache->first) {
+ char *port_str = NULL;
+ gf_log ("resolver", GF_LOG_TRACE,
+ "DNS cache not present, freshly probing hostname: %s",
+ hostname);
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = family;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_flags = AI_ADDRCONFIG;
+
+ ret = gf_asprintf (&port_str, "%d", port);
if (-1 == ret) {
gf_log ("resolver", GF_LOG_ERROR, "asprintf failed");
return -1;
}
- if ((ret = getaddrinfo(hostname, port_str, &hints, &cache->first)) != 0) {
- gf_log ("resolver", GF_LOG_ERROR,
- "getaddrinfo failed (%s)", gai_strerror (ret));
-
- GF_FREE (*dnscache);
- *dnscache = NULL;
- GF_FREE (port_str);
- return -1;
- }
- GF_FREE (port_str);
-
- cache->next = cache->first;
- }
-
- if (cache->next) {
- ret = getnameinfo((struct sockaddr *)cache->next->ai_addr,
- cache->next->ai_addrlen,
- host, sizeof (host),
- service, sizeof (service),
- NI_NUMERICHOST);
- if (ret != 0) {
- gf_log ("resolver",
- GF_LOG_ERROR,
- "getnameinfo failed (%s)", gai_strerror (ret));
- goto err;
- }
-
- gf_log ("resolver", GF_LOG_TRACE,
- "returning ip-%s (port-%s) for hostname: %s and port: %d",
- host, service, hostname, port);
-
- *addr_info = cache->next;
- }
+ if ((ret = getaddrinfo(hostname, port_str, &hints, &cache->first)) != 0) {
+ gf_log ("resolver", GF_LOG_ERROR,
+ "getaddrinfo failed (%s)", gai_strerror (ret));
+
+ GF_FREE (*dnscache);
+ *dnscache = NULL;
+ GF_FREE (port_str);
+ return -1;
+ }
+ GF_FREE (port_str);
+
+ cache->next = cache->first;
+ }
+
+ if (cache->next) {
+ ret = getnameinfo((struct sockaddr *)cache->next->ai_addr,
+ cache->next->ai_addrlen,
+ host, sizeof (host),
+ service, sizeof (service),
+ NI_NUMERICHOST);
+ if (ret != 0) {
+ gf_log ("resolver",
+ GF_LOG_ERROR,
+ "getnameinfo failed (%s)", gai_strerror (ret));
+ goto err;
+ }
+
+ gf_log ("resolver", GF_LOG_TRACE,
+ "returning ip-%s (port-%s) for hostname: %s and port: %d",
+ host, service, hostname, port);
+
+ *addr_info = cache->next;
+ }
if (cache->next)
cache->next = cache->next->ai_next;
- if (cache->next) {
- ret = getnameinfo((struct sockaddr *)cache->next->ai_addr,
- cache->next->ai_addrlen,
- host, sizeof (host),
- service, sizeof (service),
- NI_NUMERICHOST);
- if (ret != 0) {
- gf_log ("resolver",
- GF_LOG_ERROR,
- "getnameinfo failed (%s)", gai_strerror (ret));
- goto err;
- }
-
- gf_log ("resolver", GF_LOG_TRACE,
- "next DNS query will return: ip-%s port-%s", host, service);
- }
-
- return 0;
+ if (cache->next) {
+ ret = getnameinfo((struct sockaddr *)cache->next->ai_addr,
+ cache->next->ai_addrlen,
+ host, sizeof (host),
+ service, sizeof (service),
+ NI_NUMERICHOST);
+ if (ret != 0) {
+ gf_log ("resolver",
+ GF_LOG_ERROR,
+ "getnameinfo failed (%s)", gai_strerror (ret));
+ goto err;
+ }
+
+ gf_log ("resolver", GF_LOG_TRACE,
+ "next DNS query will return: ip-%s port-%s", host, service);
+ }
+
+ return 0;
err:
- freeaddrinfo (cache->first);
- cache->first = cache->next = NULL;
- GF_FREE (cache);
- *dnscache = NULL;
- return -1;
+ freeaddrinfo (cache->first);
+ cache->first = cache->next = NULL;
+ GF_FREE (cache);
+ *dnscache = NULL;
+ return -1;
}
void
gf_log_volume_file (FILE *specfp)
{
- extern FILE *gf_log_logfile;
- int lcount = 0;
- char data[GF_UNIT_KB];
-
- fseek (specfp, 0L, SEEK_SET);
-
- fprintf (gf_log_logfile, "Given volfile:\n");
- fprintf (gf_log_logfile,
- "+---------------------------------------"
- "---------------------------------------+\n");
- while (fgets (data, GF_UNIT_KB, specfp) != NULL){
- lcount++;
- fprintf (gf_log_logfile, "%3d: %s", lcount, data);
- }
- fprintf (gf_log_logfile,
- "\n+---------------------------------------"
- "---------------------------------------+\n");
- fflush (gf_log_logfile);
- fseek (specfp, 0L, SEEK_SET);
+ extern FILE *gf_log_logfile;
+ int lcount = 0;
+ char data[GF_UNIT_KB];
+
+ fseek (specfp, 0L, SEEK_SET);
+
+ fprintf (gf_log_logfile, "Given volfile:\n");
+ fprintf (gf_log_logfile,
+ "+---------------------------------------"
+ "---------------------------------------+\n");
+ while (fgets (data, GF_UNIT_KB, specfp) != NULL){
+ lcount++;
+ fprintf (gf_log_logfile, "%3d: %s", lcount, data);
+ }
+ fprintf (gf_log_logfile,
+ "\n+---------------------------------------"
+ "---------------------------------------+\n");
+ fflush (gf_log_logfile);
+ fseek (specfp, 0L, SEEK_SET);
}
static void
@@ -213,128 +213,128 @@ gf_dump_config_flags (int fd)
{
int ret = 0;
- ret = write (fd, "configuration details:\n", 23);
+ ret = write (fd, "configuration details:\n", 23);
if (ret == -1)
goto out;
/* have argp */
#ifdef HAVE_ARGP
- ret = write (fd, "argp 1\n", 7);
+ ret = write (fd, "argp 1\n", 7);
if (ret == -1)
goto out;
#endif
/* ifdef if found backtrace */
#ifdef HAVE_BACKTRACE
- ret = write (fd, "backtrace 1\n", 12);
+ ret = write (fd, "backtrace 1\n", 12);
if (ret == -1)
goto out;
#endif
/* Berkeley-DB version has cursor->get() */
#ifdef HAVE_BDB_CURSOR_GET
- ret = write (fd, "bdb->cursor->get 1\n", 19);
+ ret = write (fd, "bdb->cursor->get 1\n", 19);
if (ret == -1)
goto out;
#endif
/* Define to 1 if you have the <db.h> header file. */
#ifdef HAVE_DB_H
- ret = write (fd, "db.h 1\n", 7);
+ ret = write (fd, "db.h 1\n", 7);
if (ret == -1)
goto out;
#endif
/* Define to 1 if you have the <dlfcn.h> header file. */
#ifdef HAVE_DLFCN_H
- ret = write (fd, "dlfcn 1\n", 8);
+ ret = write (fd, "dlfcn 1\n", 8);
if (ret == -1)
goto out;
#endif
/* define if fdatasync exists */
#ifdef HAVE_FDATASYNC
- ret = write (fd, "fdatasync 1\n", 12);
+ ret = write (fd, "fdatasync 1\n", 12);
if (ret == -1)
goto out;
#endif
/* Define to 1 if you have the `pthread' library (-lpthread). */
#ifdef HAVE_LIBPTHREAD
- ret = write (fd, "libpthread 1\n", 13);
+ ret = write (fd, "libpthread 1\n", 13);
if (ret == -1)
goto out;
#endif
/* define if llistxattr exists */
#ifdef HAVE_LLISTXATTR
- ret = write (fd, "llistxattr 1\n", 13);
+ ret = write (fd, "llistxattr 1\n", 13);
if (ret == -1)
goto out;
#endif
/* define if found setfsuid setfsgid */
#ifdef HAVE_SET_FSID
- ret = write (fd, "setfsid 1\n", 10);
+ ret = write (fd, "setfsid 1\n", 10);
if (ret == -1)
goto out;
#endif
/* define if found spinlock */
#ifdef HAVE_SPINLOCK
- ret = write (fd, "spinlock 1\n", 11);
+ ret = write (fd, "spinlock 1\n", 11);
if (ret == -1)
goto out;
#endif
/* Define to 1 if you have the <sys/epoll.h> header file. */
#ifdef HAVE_SYS_EPOLL_H
- ret = write (fd, "epoll.h 1\n", 10);
+ ret = write (fd, "epoll.h 1\n", 10);
if (ret == -1)
goto out;
#endif
/* Define to 1 if you have the <sys/extattr.h> header file. */
#ifdef HAVE_SYS_EXTATTR_H
- ret = write (fd, "extattr.h 1\n", 12);
+ ret = write (fd, "extattr.h 1\n", 12);
if (ret == -1)
goto out;
#endif
/* Define to 1 if you have the <sys/xattr.h> header file. */
#ifdef HAVE_SYS_XATTR_H
- ret = write (fd, "xattr.h 1\n", 10);
+ ret = write (fd, "xattr.h 1\n", 10);
if (ret == -1)
goto out;
#endif
/* define if found st_atim.tv_nsec */
#ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
- ret = write (fd, "st_atim.tv_nsec 1\n", 18);
+ ret = write (fd, "st_atim.tv_nsec 1\n", 18);
if (ret == -1)
goto out;
#endif
/* define if found st_atimespec.tv_nsec */
#ifdef HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
- ret = write (fd, "st_atimespec.tv_nsec 1\n",23);
+ ret = write (fd, "st_atimespec.tv_nsec 1\n",23);
if (ret == -1)
goto out;
#endif
/* Define to the full name and version of this package. */
#ifdef PACKAGE_STRING
- {
- char msg[128];
- sprintf (msg, "package-string: %s\n", PACKAGE_STRING);
- ret = write (fd, msg, strlen (msg));
+ {
+ char msg[128];
+ sprintf (msg, "package-string: %s\n", PACKAGE_STRING);
+ ret = write (fd, msg, strlen (msg));
if (ret == -1)
goto out;
- }
+ }
#endif
out:
- return;
+ return;
}
/* Obtain a backtrace and print it to stdout. */
@@ -343,7 +343,7 @@ out:
void
gf_print_trace (int32_t signum)
{
- extern FILE *gf_log_logfile;
+ extern FILE *gf_log_logfile;
struct tm *tm = NULL;
char msg[1024] = {0,};
char timestr[256] = {0,};
@@ -353,33 +353,33 @@ gf_print_trace (int32_t signum)
fd = fileno (gf_log_logfile);
- /* Pending frames, (if any), list them in order */
- ret = write (fd, "pending frames:\n", 16);
- {
- glusterfs_ctx_t *ctx = glusterfs_ctx_get ();
- struct list_head *trav = ((call_pool_t *)ctx->pool)->all_frames.next;
- while (trav != (&((call_pool_t *)ctx->pool)->all_frames)) {
- call_frame_t *tmp = (call_frame_t *)(&((call_stack_t *)trav)->frames);
- if (tmp->root->type == GF_OP_TYPE_FOP)
- sprintf (msg,"frame : type(%d) op(%s)\n",
- tmp->root->type,
- gf_fop_list[tmp->root->op]);
- if (tmp->root->type == GF_OP_TYPE_MGMT)
- sprintf (msg,"frame : type(%d) op(%s)\n",
- tmp->root->type,
- gf_mgmt_list[tmp->root->op]);
-
- ret = write (fd, msg, strlen (msg));
- trav = trav->next;
- }
- ret = write (fd, "\n", 1);
- }
-
- sprintf (msg, "patchset: %s\n", GLUSTERFS_REPOSITORY_REVISION);
- ret = write (fd, msg, strlen (msg));
-
- sprintf (msg, "signal received: %d\n", signum);
- ret = write (fd, msg, strlen (msg));
+ /* Pending frames, (if any), list them in order */
+ ret = write (fd, "pending frames:\n", 16);
+ {
+ glusterfs_ctx_t *ctx = glusterfs_ctx_get ();
+ struct list_head *trav = ((call_pool_t *)ctx->pool)->all_frames.next;
+ while (trav != (&((call_pool_t *)ctx->pool)->all_frames)) {
+ call_frame_t *tmp = (call_frame_t *)(&((call_stack_t *)trav)->frames);
+ if (tmp->root->type == GF_OP_TYPE_FOP)
+ sprintf (msg,"frame : type(%d) op(%s)\n",
+ tmp->root->type,
+ gf_fop_list[tmp->root->op]);
+ if (tmp->root->type == GF_OP_TYPE_MGMT)
+ sprintf (msg,"frame : type(%d) op(%s)\n",
+ tmp->root->type,
+ gf_mgmt_list[tmp->root->op]);
+
+ ret = write (fd, msg, strlen (msg));
+ trav = trav->next;
+ }
+ ret = write (fd, "\n", 1);
+ }
+
+ sprintf (msg, "patchset: %s\n", GLUSTERFS_REPOSITORY_REVISION);
+ ret = write (fd, msg, strlen (msg));
+
+ sprintf (msg, "signal received: %d\n", signum);
+ ret = write (fd, msg, strlen (msg));
{
/* Dump the timestamp of the crash too, so the previous logs
@@ -391,23 +391,23 @@ gf_print_trace (int32_t signum)
ret = write (fd, timestr, strlen (timestr));
}
- gf_dump_config_flags (fd);
+ gf_dump_config_flags (fd);
#if HAVE_BACKTRACE
- /* Print 'backtrace' */
- {
- void *array[200];
- size_t size;
-
- size = backtrace (array, 200);
- backtrace_symbols_fd (&array[1], size-1, fd);
- sprintf (msg, "---------\n");
- ret = write (fd, msg, strlen (msg));
- }
+ /* Print 'backtrace' */
+ {
+ void *array[200];
+ size_t size;
+
+ size = backtrace (array, 200);
+ backtrace_symbols_fd (&array[1], size-1, fd);
+ sprintf (msg, "---------\n");
+ ret = write (fd, msg, strlen (msg));
+ }
#endif /* HAVE_BACKTRACE */
- /* Send a signal to terminate the process */
- signal (signum, SIG_DFL);
- raise (signum);
+ /* Send a signal to terminate the process */
+ signal (signum, SIG_DFL);
+ raise (signum);
}
void
@@ -419,97 +419,97 @@ trap (void)
char *
gf_trim (char *string)
{
- register char *s, *t;
+ register char *s, *t;
- if (string == NULL)
- {
- return NULL;
- }
+ if (string == NULL)
+ {
+ return NULL;
+ }
- for (s = string; isspace (*s); s++)
- ;
+ for (s = string; isspace (*s); s++)
+ ;
- if (*s == 0)
- return s;
+ if (*s == 0)
+ return s;
- t = s + strlen (s) - 1;
- while (t > s && isspace (*t))
- t--;
- *++t = '\0';
+ t = s + strlen (s) - 1;
+ while (t > s && isspace (*t))
+ t--;
+ *++t = '\0';
- return s;
+ return s;
}
int
gf_strsplit (const char *str, const char *delim,
- char ***tokens, int *token_count)
+ char ***tokens, int *token_count)
{
- char *_running = NULL;
- char *running = NULL;
- char *token = NULL;
- char **token_list = NULL;
- int count = 0;
- int i = 0;
- int j = 0;
-
- if (str == NULL || delim == NULL || tokens == NULL || token_count == NULL)
- {
- return -1;
- }
+ char *_running = NULL;
+ char *running = NULL;
+ char *token = NULL;
+ char **token_list = NULL;
+ int count = 0;
+ int i = 0;
+ int j = 0;
+
+ if (str == NULL || delim == NULL || tokens == NULL || token_count == NULL)
+ {
+ return -1;
+ }
_running = gf_strdup (str);
- if (_running == NULL)
- {
- return -1;
- }
- running = _running;
-
- while ((token = strsep (&running, delim)) != NULL)
- {
- if (token[0] != '\0')
- count++;
- }
- GF_FREE (_running);
+ if (_running == NULL)
+ {
+ return -1;
+ }
+ running = _running;
+
+ while ((token = strsep (&running, delim)) != NULL)
+ {
+ if (token[0] != '\0')
+ count++;
+ }
+ GF_FREE (_running);
_running = gf_strdup (str);
- if (_running == NULL)
- {
- return -1;
- }
- running = _running;
-
- if ((token_list = GF_CALLOC (count, sizeof (char *),
- gf_common_mt_char)) == NULL)
- {
- GF_FREE (_running);
- return -1;
- }
-
- while ((token = strsep (&running, delim)) != NULL)
- {
- if (token[0] == '\0')
- continue;
+ if (_running == NULL)
+ {
+ return -1;
+ }
+ running = _running;
+
+ if ((token_list = GF_CALLOC (count, sizeof (char *),
+ gf_common_mt_char)) == NULL)
+ {
+ GF_FREE (_running);
+ return -1;
+ }
+
+ while ((token = strsep (&running, delim)) != NULL)
+ {
+ if (token[0] == '\0')
+ continue;
token_list[i] = gf_strdup (token);
- if (token_list[i] == NULL)
- goto free_exit;
+ if (token_list[i] == NULL)
+ goto free_exit;
i++;
- }
+ }
- GF_FREE (_running);
+ GF_FREE (_running);
- *tokens = token_list;
- *token_count = count;
- return 0;
+ *tokens = token_list;
+ *token_count = count;
+ return 0;
free_exit:
- GF_FREE (_running);
- for (j = 0; j < i; j++)
- {
- GF_FREE (token_list[j]);
- }
- GF_FREE (token_list);
- return -1;
+ GF_FREE (_running);
+ for (j = 0; j < i; j++)
+ {
+ GF_FREE (token_list[j]);
+ }
+ GF_FREE (token_list);
+ return -1;
}
int
@@ -525,8 +525,8 @@ gf_strstr (const char *str, const char *delim, const char *match)
if (str == NULL || delim == NULL || match == NULL || tmp_str == NULL) {
ret = -1;
- goto out;
- }
+ goto out;
+ }
tmp = strtok_r (tmp_str, delim, &save_ptr);
@@ -551,876 +551,876 @@ out:
int
gf_volume_name_validate (const char *volume_name)
{
- const char *vname = NULL;
+ const char *vname = NULL;
- if (volume_name == NULL)
- {
- return -1;
- }
+ if (volume_name == NULL)
+ {
+ return -1;
+ }
- if (!isalpha (volume_name[0]))
- {
- return 1;
- }
+ if (!isalpha (volume_name[0]))
+ {
+ return 1;
+ }
- for (vname = &volume_name[1]; *vname != '\0'; vname++)
- {
- if (!(isalnum (*vname) || *vname == '_'))
- return 1;
- }
+ for (vname = &volume_name[1]; *vname != '\0'; vname++)
+ {
+ if (!(isalnum (*vname) || *vname == '_'))
+ return 1;
+ }
- return 0;
+ return 0;
}
int
gf_string2time (const char *str, uint32_t *n)
{
- unsigned long value = 0;
- char *tail = NULL;
- int old_errno = 0;
- const char *s = NULL;
-
- if (str == NULL || n == NULL)
- {
- errno = EINVAL;
- return -1;
- }
-
- for (s = str; *s != '\0'; s++)
- {
- if (isspace (*s))
- {
- continue;
- }
- if (*s == '-')
- {
- return -1;
- }
- break;
- }
-
- old_errno = errno;
- errno = 0;
- value = strtol (str, &tail, 0);
-
- if (errno == ERANGE || errno == EINVAL)
- {
- return -1;
- }
-
- if (errno == 0)
- {
- errno = old_errno;
- }
-
- if (!((tail[0] == '\0') ||
- ((tail[0] == 's') && (tail[1] == '\0')) ||
- ((tail[0] == 's') && (tail[1] == 'e') && (tail[2] == 'c') && (tail[3] == '\0'))))
- {
- return -1;
- }
-
- *n = value;
-
- return 0;
+ unsigned long value = 0;
+ char *tail = NULL;
+ int old_errno = 0;
+ const char *s = NULL;
+
+ if (str == NULL || n == NULL)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ for (s = str; *s != '\0'; s++)
+ {
+ if (isspace (*s))
+ {
+ continue;
+ }
+ if (*s == '-')
+ {
+ return -1;
+ }
+ break;
+ }
+
+ old_errno = errno;
+ errno = 0;
+ value = strtol (str, &tail, 0);
+
+ if (errno == ERANGE || errno == EINVAL)
+ {
+ return -1;
+ }
+
+ if (errno == 0)
+ {
+ errno = old_errno;
+ }
+
+ if (!((tail[0] == '\0') ||
+ ((tail[0] == 's') && (tail[1] == '\0')) ||
+ ((tail[0] == 's') && (tail[1] == 'e') && (tail[2] == 'c') && (tail[3] == '\0'))))
+ {
+ return -1;
+ }
+
+ *n = value;
+
+ return 0;
}
int
gf_string2percent (const char *str, uint32_t *n)
{
- unsigned long value = 0;
- char *tail = NULL;
- int old_errno = 0;
- const char *s = NULL;
-
- if (str == NULL || n == NULL)
- {
- errno = EINVAL;
- return -1;
- }
-
- for (s = str; *s != '\0'; s++)
- {
- if (isspace (*s))
- {
- continue;
- }
- if (*s == '-')
- {
- return -1;
- }
- break;
- }
-
- old_errno = errno;
- errno = 0;
- value = strtol (str, &tail, 0);
-
- if (errno == ERANGE || errno == EINVAL)
- {
- return -1;
- }
-
- if (errno == 0)
- {
- errno = old_errno;
- }
-
- if (!((tail[0] == '\0') ||
- ((tail[0] == '%') && (tail[1] == '\0'))))
- {
- return -1;
- }
-
- *n = value;
-
- return 0;
+ unsigned long value = 0;
+ char *tail = NULL;
+ int old_errno = 0;
+ const char *s = NULL;
+
+ if (str == NULL || n == NULL)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ for (s = str; *s != '\0'; s++)
+ {
+ if (isspace (*s))
+ {
+ continue;
+ }
+ if (*s == '-')
+ {
+ return -1;
+ }
+ break;
+ }
+
+ old_errno = errno;
+ errno = 0;
+ value = strtol (str, &tail, 0);
+
+ if (errno == ERANGE || errno == EINVAL)
+ {
+ return -1;
+ }
+
+ if (errno == 0)
+ {
+ errno = old_errno;
+ }
+
+ if (!((tail[0] == '\0') ||
+ ((tail[0] == '%') && (tail[1] == '\0'))))
+ {
+ return -1;
+ }
+
+ *n = value;
+
+ return 0;
}
static int
_gf_string2long (const char *str, long *n, int base)
{
- long value = 0;
- char *tail = NULL;
- int old_errno = 0;
-
- if (str == NULL || n == NULL)
- {
- errno = EINVAL;
- return -1;
- }
-
- old_errno = errno;
- errno = 0;
- value = strtol (str, &tail, base);
-
- if (errno == ERANGE || errno == EINVAL)
- {
- return -1;
- }
-
- if (errno == 0)
- {
- errno = old_errno;
- }
-
- if (tail[0] != '\0')
- {
- /* bala: invalid integer format */
- return -1;
- }
-
- *n = value;
-
- return 0;
+ long value = 0;
+ char *tail = NULL;
+ int old_errno = 0;
+
+ if (str == NULL || n == NULL)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ old_errno = errno;
+ errno = 0;
+ value = strtol (str, &tail, base);
+
+ if (errno == ERANGE || errno == EINVAL)
+ {
+ return -1;
+ }
+
+ if (errno == 0)
+ {
+ errno = old_errno;
+ }
+
+ if (tail[0] != '\0')
+ {
+ /* bala: invalid integer format */
+ return -1;
+ }
+
+ *n = value;
+
+ return 0;
}
static int
_gf_string2ulong (const char *str, unsigned long *n, int base)
{
- unsigned long value = 0;
- char *tail = NULL;
- int old_errno = 0;
- const char *s = NULL;
-
- if (str == NULL || n == NULL)
- {
- errno = EINVAL;
- return -1;
- }
-
- for (s = str; *s != '\0'; s++)
- {
- if (isspace (*s))
- {
- continue;
- }
- if (*s == '-')
- {
- /* bala: we do not support suffixed (-) sign and
- invalid integer format */
- return -1;
- }
- break;
- }
-
- old_errno = errno;
- errno = 0;
- value = strtoul (str, &tail, base);
-
- if (errno == ERANGE || errno == EINVAL)
- {
- return -1;
- }
-
- if (errno == 0)
- {
- errno = old_errno;
- }
-
- if (tail[0] != '\0')
- {
- /* bala: invalid integer format */
- return -1;
- }
-
- *n = value;
-
- return 0;
+ unsigned long value = 0;
+ char *tail = NULL;
+ int old_errno = 0;
+ const char *s = NULL;
+
+ if (str == NULL || n == NULL)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ for (s = str; *s != '\0'; s++)
+ {
+ if (isspace (*s))
+ {
+ continue;
+ }
+ if (*s == '-')
+ {
+ /* bala: we do not support suffixed (-) sign and
+ invalid integer format */
+ return -1;
+ }
+ break;
+ }
+
+ old_errno = errno;
+ errno = 0;
+ value = strtoul (str, &tail, base);
+
+ if (errno == ERANGE || errno == EINVAL)
+ {
+ return -1;
+ }
+
+ if (errno == 0)
+ {
+ errno = old_errno;
+ }
+
+ if (tail[0] != '\0')
+ {
+ /* bala: invalid integer format */
+ return -1;
+ }
+
+ *n = value;
+
+ return 0;
}
static int
_gf_string2uint (const char *str, unsigned int *n, int base)
{
- unsigned long value = 0;
- char *tail = NULL;
- int old_errno = 0;
- const char *s = NULL;
-
- if (str == NULL || n == NULL)
- {
- errno = EINVAL;
- return -1;
- }
-
- for (s = str; *s != '\0'; s++)
- {
- if (isspace (*s))
- {
- continue;
- }
- if (*s == '-')
- {
- /* bala: we do not support suffixed (-) sign and
- invalid integer format */
- return -1;
- }
- break;
- }
-
- old_errno = errno;
- errno = 0;
- value = strtoul (str, &tail, base);
-
- if (errno == ERANGE || errno == EINVAL)
- {
- return -1;
- }
-
- if (errno == 0)
- {
- errno = old_errno;
- }
-
- if (tail[0] != '\0')
- {
- /* bala: invalid integer format */
- return -1;
- }
-
- *n = (unsigned int)value;
-
- return 0;
+ unsigned long value = 0;
+ char *tail = NULL;
+ int old_errno = 0;
+ const char *s = NULL;
+
+ if (str == NULL || n == NULL)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ for (s = str; *s != '\0'; s++)
+ {
+ if (isspace (*s))
+ {
+ continue;
+ }
+ if (*s == '-')
+ {
+ /* bala: we do not support suffixed (-) sign and
+ invalid integer format */
+ return -1;
+ }
+ break;
+ }
+
+ old_errno = errno;
+ errno = 0;
+ value = strtoul (str, &tail, base);
+
+ if (errno == ERANGE || errno == EINVAL)
+ {
+ return -1;
+ }
+
+ if (errno == 0)
+ {
+ errno = old_errno;
+ }
+
+ if (tail[0] != '\0')
+ {
+ /* bala: invalid integer format */
+ return -1;
+ }
+
+ *n = (unsigned int)value;
+
+ return 0;
}
static int
_gf_string2double (const char *str, double *n)
{
- double value = 0.0;
- char *tail = NULL;
- int old_errno = 0;
+ double value = 0.0;
+ char *tail = NULL;
+ int old_errno = 0;
- if (str == NULL || n == NULL) {
- errno = EINVAL;
- return -1;
- }
+ if (str == NULL || n == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
- old_errno = errno;
- errno = 0;
- value = strtod (str, &tail);
+ old_errno = errno;
+ errno = 0;
+ value = strtod (str, &tail);
- if (errno == ERANGE || errno == EINVAL) {
- return -1;
- }
+ if (errno == ERANGE || errno == EINVAL) {
+ return -1;
+ }
- if (errno == 0) {
- errno = old_errno;
- }
+ if (errno == 0) {
+ errno = old_errno;
+ }
- if (tail[0] != '\0') {
- return -1;
- }
+ if (tail[0] != '\0') {
+ return -1;
+ }
- *n = value;
+ *n = value;
- return 0;
+ return 0;
}
static int
_gf_string2longlong (const char *str, long long *n, int base)
{
- long long value = 0;
- char *tail = NULL;
- int old_errno = 0;
-
- if (str == NULL || n == NULL)
- {
- errno = EINVAL;
- return -1;
- }
-
- old_errno = errno;
- errno = 0;
- value = strtoll (str, &tail, base);
-
- if (errno == ERANGE || errno == EINVAL)
- {
- return -1;
- }
-
- if (errno == 0)
- {
- errno = old_errno;
- }
-
- if (tail[0] != '\0')
- {
- /* bala: invalid integer format */
- return -1;
- }
-
- *n = value;
-
- return 0;
+ long long value = 0;
+ char *tail = NULL;
+ int old_errno = 0;
+
+ if (str == NULL || n == NULL)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ old_errno = errno;
+ errno = 0;
+ value = strtoll (str, &tail, base);
+
+ if (errno == ERANGE || errno == EINVAL)
+ {
+ return -1;
+ }
+
+ if (errno == 0)
+ {
+ errno = old_errno;
+ }
+
+ if (tail[0] != '\0')
+ {
+ /* bala: invalid integer format */
+ return -1;
+ }
+
+ *n = value;
+
+ return 0;
}
static int
_gf_string2ulonglong (const char *str, unsigned long long *n, int base)
{
- unsigned long long value = 0;
- char *tail = NULL;
- int old_errno = 0;
- const char *s = NULL;
-
- if (str == NULL || n == NULL)
- {
- errno = EINVAL;
- return -1;
- }
-
- for (s = str; *s != '\0'; s++)
- {
- if (isspace (*s))
- {
- continue;
- }
- if (*s == '-')
- {
- /* bala: we do not support suffixed (-) sign and
- invalid integer format */
- return -1;
- }
- break;
- }
-
- old_errno = errno;
- errno = 0;
- value = strtoull (str, &tail, base);
-
- if (errno == ERANGE || errno == EINVAL)
- {
- return -1;
- }
-
- if (errno == 0)
- {
- errno = old_errno;
- }
-
- if (tail[0] != '\0')
- {
- /* bala: invalid integer format */
- return -1;
- }
-
- *n = value;
-
- return 0;
+ unsigned long long value = 0;
+ char *tail = NULL;
+ int old_errno = 0;
+ const char *s = NULL;
+
+ if (str == NULL || n == NULL)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ for (s = str; *s != '\0'; s++)
+ {
+ if (isspace (*s))
+ {
+ continue;
+ }
+ if (*s == '-')
+ {
+ /* bala: we do not support suffixed (-) sign and
+ invalid integer format */
+ return -1;
+ }
+ break;
+ }
+
+ old_errno = errno;
+ errno = 0;
+ value = strtoull (str, &tail, base);
+
+ if (errno == ERANGE || errno == EINVAL)
+ {
+ return -1;
+ }
+
+ if (errno == 0)
+ {
+ errno = old_errno;
+ }
+
+ if (tail[0] != '\0')
+ {
+ /* bala: invalid integer format */
+ return -1;
+ }
+
+ *n = value;
+
+ return 0;
}
int
gf_string2long (const char *str, long *n)
{
- return _gf_string2long (str, n, 0);
+ return _gf_string2long (str, n, 0);
}
int
gf_string2ulong (const char *str, unsigned long *n)
{
- return _gf_string2ulong (str, n, 0);
+ return _gf_string2ulong (str, n, 0);
}
int
gf_string2int (const char *str, int *n)
{
- long l = 0;
- int ret = 0;
+ long l = 0;
+ int ret = 0;
- ret = _gf_string2long (str, &l, 0);
+ ret = _gf_string2long (str, &l, 0);
- *n = l;
- return ret;
+ *n = l;
+ return ret;
}
int
gf_string2uint (const char *str, unsigned int *n)
{
- return _gf_string2uint (str, n, 0);
+ return _gf_string2uint (str, n, 0);
}
int
gf_string2double (const char *str, double *n)
{
- return _gf_string2double (str, n);
+ return _gf_string2double (str, n);
}
int
gf_string2longlong (const char *str, long long *n)
{
- return _gf_string2longlong (str, n, 0);
+ return _gf_string2longlong (str, n, 0);
}
int
gf_string2ulonglong (const char *str, unsigned long long *n)
{
- return _gf_string2ulonglong (str, n, 0);
+ return _gf_string2ulonglong (str, n, 0);
}
int
gf_string2int8 (const char *str, int8_t *n)
{
- long l = 0L;
- int rv = 0;
+ long l = 0L;
+ int rv = 0;
- rv = _gf_string2long (str, &l, 0);
- if (rv != 0)
- return rv;
+ rv = _gf_string2long (str, &l, 0);
+ if (rv != 0)
+ return rv;
- if (l >= INT8_MIN && l <= INT8_MAX)
- {
- *n = (int8_t) l;
- return 0;
- }
+ if (l >= INT8_MIN && l <= INT8_MAX)
+ {
+ *n = (int8_t) l;
+ return 0;
+ }
- errno = ERANGE;
- return -1;
+ errno = ERANGE;
+ return -1;
}
int
gf_string2int16 (const char *str, int16_t *n)
{
- long l = 0L;
- int rv = 0;
+ long l = 0L;
+ int rv = 0;
- rv = _gf_string2long (str, &l, 0);
- if (rv != 0)
- return rv;
+ rv = _gf_string2long (str, &l, 0);
+ if (rv != 0)
+ return rv;
- if (l >= INT16_MIN && l <= INT16_MAX)
- {
- *n = (int16_t) l;
- return 0;
- }
+ if (l >= INT16_MIN && l <= INT16_MAX)
+ {
+ *n = (int16_t) l;
+ return 0;
+ }
- errno = ERANGE;
- return -1;
+ errno = ERANGE;
+ return -1;
}
int
gf_string2int32 (const char *str, int32_t *n)
{
- long l = 0L;
- int rv = 0;
+ long l = 0L;
+ int rv = 0;
- rv = _gf_string2long (str, &l, 0);
- if (rv != 0)
- return rv;
+ rv = _gf_string2long (str, &l, 0);
+ if (rv != 0)
+ return rv;
- if (l >= INT32_MIN && l <= INT32_MAX)
- {
- *n = (int32_t) l;
- return 0;
- }
+ if (l >= INT32_MIN && l <= INT32_MAX)
+ {
+ *n = (int32_t) l;
+ return 0;
+ }
- errno = ERANGE;
- return -1;
+ errno = ERANGE;
+ return -1;
}
int
gf_string2int64 (const char *str, int64_t *n)
{
- long long l = 0LL;
- int rv = 0;
+ long long l = 0LL;
+ int rv = 0;
- rv = _gf_string2longlong (str, &l, 0);
- if (rv != 0)
- return rv;
+ rv = _gf_string2longlong (str, &l, 0);
+ if (rv != 0)
+ return rv;
- if (l >= INT64_MIN && l <= INT64_MAX)
- {
- *n = (int64_t) l;
- return 0;
- }
+ if (l >= INT64_MIN && l <= INT64_MAX)
+ {
+ *n = (int64_t) l;
+ return 0;
+ }
- errno = ERANGE;
- return -1;
+ errno = ERANGE;
+ return -1;
}
int
gf_string2uint8 (const char *str, uint8_t *n)
{
- unsigned long l = 0L;
- int rv = 0;
+ unsigned long l = 0L;
+ int rv = 0;
- rv = _gf_string2ulong (str, &l, 0);
- if (rv != 0)
- return rv;
+ rv = _gf_string2ulong (str, &l, 0);
+ if (rv != 0)
+ return rv;
- if (l >= 0 && l <= UINT8_MAX)
- {
- *n = (uint8_t) l;
- return 0;
- }
+ if (l >= 0 && l <= UINT8_MAX)
+ {
+ *n = (uint8_t) l;
+ return 0;
+ }
- errno = ERANGE;
- return -1;
+ errno = ERANGE;
+ return -1;
}
int
gf_string2uint16 (const char *str, uint16_t *n)
{
- unsigned long l = 0L;
- int rv = 0;
+ unsigned long l = 0L;
+ int rv = 0;
- rv = _gf_string2ulong (str, &l, 0);
- if (rv != 0)
- return rv;
+ rv = _gf_string2ulong (str, &l, 0);
+ if (rv != 0)
+ return rv;
- if (l >= 0 && l <= UINT16_MAX)
- {
- *n = (uint16_t) l;
- return 0;
- }
+ if (l >= 0 && l <= UINT16_MAX)
+ {
+ *n = (uint16_t) l;
+ return 0;
+ }
- errno = ERANGE;
- return -1;
+ errno = ERANGE;
+ return -1;
}
int
gf_string2uint32 (const char *str, uint32_t *n)
{
- unsigned long l = 0L;
- int rv = 0;
+ unsigned long l = 0L;
+ int rv = 0;
- rv = _gf_string2ulong (str, &l, 0);
- if (rv != 0)
- return rv;
+ rv = _gf_string2ulong (str, &l, 0);
+ if (rv != 0)
+ return rv;
- if (l >= 0 && l <= UINT32_MAX)
- {
- *n = (uint32_t) l;
- return 0;
- }
+ if (l >= 0 && l <= UINT32_MAX)
+ {
+ *n = (uint32_t) l;
+ return 0;
+ }
- errno = ERANGE;
- return -1;
+ errno = ERANGE;
+ return -1;
}
int
gf_string2uint64 (const char *str, uint64_t *n)
{
- unsigned long long l = 0ULL;
- int rv = 0;
+ unsigned long long l = 0ULL;
+ int rv = 0;
- rv = _gf_string2ulonglong (str, &l, 0);
- if (rv != 0)
- return rv;
+ rv = _gf_string2ulonglong (str, &l, 0);
+ if (rv != 0)
+ return rv;
- if (l >= 0 && l <= UINT64_MAX)
- {
- *n = (uint64_t) l;
- return 0;
- }
+ if (l >= 0 && l <= UINT64_MAX)
+ {
+ *n = (uint64_t) l;
+ return 0;
+ }
- errno = ERANGE;
- return -1;
+ errno = ERANGE;
+ return -1;
}
int
gf_string2ulong_base10 (const char *str, unsigned long *n)
{
- return _gf_string2ulong (str, n, 10);
+ return _gf_string2ulong (str, n, 10);
}
int
gf_string2uint_base10 (const char *str, unsigned int *n)
{
- return _gf_string2uint (str, n, 10);
+ return _gf_string2uint (str, n, 10);
}
int
gf_string2uint8_base10 (const char *str, uint8_t *n)
{
- unsigned long l = 0L;
- int rv = 0;
+ unsigned long l = 0L;
+ int rv = 0;
- rv = _gf_string2ulong (str, &l, 10);
- if (rv != 0)
- return rv;
+ rv = _gf_string2ulong (str, &l, 10);
+ if (rv != 0)
+ return rv;
- if (l >= 0 && l <= UINT8_MAX)
- {
- *n = (uint8_t) l;
- return 0;
- }
+ if (l >= 0 && l <= UINT8_MAX)
+ {
+ *n = (uint8_t) l;
+ return 0;
+ }
- errno = ERANGE;
- return -1;
+ errno = ERANGE;
+ return -1;
}
int
gf_string2uint16_base10 (const char *str, uint16_t *n)
{
- unsigned long l = 0L;
- int rv = 0;
+ unsigned long l = 0L;
+ int rv = 0;
- rv = _gf_string2ulong (str, &l, 10);
- if (rv != 0)
- return rv;
+ rv = _gf_string2ulong (str, &l, 10);
+ if (rv != 0)
+ return rv;
- if (l >= 0 && l <= UINT16_MAX)
- {
- *n = (uint16_t) l;
- return 0;
- }
+ if (l >= 0 && l <= UINT16_MAX)
+ {
+ *n = (uint16_t) l;
+ return 0;
+ }
- errno = ERANGE;
- return -1;
+ errno = ERANGE;
+ return -1;
}
int
gf_string2uint32_base10 (const char *str, uint32_t *n)
{
- unsigned long l = 0L;
- int rv = 0;
+ unsigned long l = 0L;
+ int rv = 0;
- rv = _gf_string2ulong (str, &l, 10);
- if (rv != 0)
- return rv;
+ rv = _gf_string2ulong (str, &l, 10);
+ if (rv != 0)
+ return rv;
- if (l >= 0 && l <= UINT32_MAX)
- {
- *n = (uint32_t) l;
- return 0;
- }
+ if (l >= 0 && l <= UINT32_MAX)
+ {
+ *n = (uint32_t) l;
+ return 0;
+ }
- errno = ERANGE;
- return -1;
+ errno = ERANGE;
+ return -1;
}
int
gf_string2uint64_base10 (const char *str, uint64_t *n)
{
- unsigned long long l = 0ULL;
- int rv = 0;
+ unsigned long long l = 0ULL;
+ int rv = 0;
- rv = _gf_string2ulonglong (str, &l, 10);
- if (rv != 0)
- return rv;
+ rv = _gf_string2ulonglong (str, &l, 10);
+ if (rv != 0)
+ return rv;
- if (l >= 0 && l <= UINT64_MAX)
- {
- *n = (uint64_t) l;
- return 0;
- }
+ if (l >= 0 && l <= UINT64_MAX)
+ {
+ *n = (uint64_t) l;
+ return 0;
+ }
- errno = ERANGE;
- return -1;
+ errno = ERANGE;
+ return -1;
}
int
gf_string2bytesize (const char *str, uint64_t *n)
{
- uint64_t value = 0ULL;
- char *tail = NULL;
- int old_errno = 0;
- const char *s = NULL;
-
- if (str == NULL || n == NULL)
- {
- errno = EINVAL;
- return -1;
- }
-
- for (s = str; *s != '\0'; s++)
- {
- if (isspace (*s))
- {
- continue;
- }
- if (*s == '-')
- {
- /* bala: we do not support suffixed (-) sign and
- invalid integer format */
- return -1;
- }
- break;
- }
-
- old_errno = errno;
- errno = 0;
- value = strtoull (str, &tail, 10);
-
- if (errno == ERANGE || errno == EINVAL)
- {
- return -1;
- }
-
- if (errno == 0)
- {
- errno = old_errno;
- }
-
- if (tail[0] != '\0')
- {
- if (strcasecmp (tail, GF_UNIT_KB_STRING) == 0)
- {
- value *= GF_UNIT_KB;
- }
- else if (strcasecmp (tail, GF_UNIT_MB_STRING) == 0)
- {
- value *= GF_UNIT_MB;
- }
- else if (strcasecmp (tail, GF_UNIT_GB_STRING) == 0)
- {
- value *= GF_UNIT_GB;
- }
- else if (strcasecmp (tail, GF_UNIT_TB_STRING) == 0)
- {
- value *= GF_UNIT_TB;
- }
- else if (strcasecmp (tail, GF_UNIT_PB_STRING) == 0)
- {
- value *= GF_UNIT_PB;
- }
- else
- {
- /* bala: invalid integer format */
- return -1;
- }
- }
-
- *n = value;
-
- return 0;
+ uint64_t value = 0ULL;
+ char *tail = NULL;
+ int old_errno = 0;
+ const char *s = NULL;
+
+ if (str == NULL || n == NULL)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ for (s = str; *s != '\0'; s++)
+ {
+ if (isspace (*s))
+ {
+ continue;
+ }
+ if (*s == '-')
+ {
+ /* bala: we do not support suffixed (-) sign and
+ invalid integer format */
+ return -1;
+ }
+ break;
+ }
+
+ old_errno = errno;
+ errno = 0;
+ value = strtoull (str, &tail, 10);
+
+ if (errno == ERANGE || errno == EINVAL)
+ {
+ return -1;
+ }
+
+ if (errno == 0)
+ {
+ errno = old_errno;
+ }
+
+ if (tail[0] != '\0')
+ {
+ if (strcasecmp (tail, GF_UNIT_KB_STRING) == 0)
+ {
+ value *= GF_UNIT_KB;
+ }
+ else if (strcasecmp (tail, GF_UNIT_MB_STRING) == 0)
+ {
+ value *= GF_UNIT_MB;
+ }
+ else if (strcasecmp (tail, GF_UNIT_GB_STRING) == 0)
+ {
+ value *= GF_UNIT_GB;
+ }
+ else if (strcasecmp (tail, GF_UNIT_TB_STRING) == 0)
+ {
+ value *= GF_UNIT_TB;
+ }
+ else if (strcasecmp (tail, GF_UNIT_PB_STRING) == 0)
+ {
+ value *= GF_UNIT_PB;
+ }
+ else
+ {
+ /* bala: invalid integer format */
+ return -1;
+ }
+ }
+
+ *n = value;
+
+ return 0;
}
int64_t
gf_str_to_long_long (const char *number)
{
- int64_t unit = 1;
- int64_t ret = 0;
- char *endptr = NULL ;
- if (!number)
- return 0;
-
- ret = strtoll (number, &endptr, 0);
-
- if (endptr) {
- switch (*endptr) {
- case 'G':
- case 'g':
- if ((* (endptr + 1) == 'B') ||(* (endptr + 1) == 'b'))
- unit = 1024 * 1024 * 1024;
- break;
- case 'M':
- case 'm':
- if ((* (endptr + 1) == 'B') ||(* (endptr + 1) == 'b'))
- unit = 1024 * 1024;
- break;
- case 'K':
- case 'k':
- if ((* (endptr + 1) == 'B') ||(* (endptr + 1) == 'b'))
- unit = 1024;
- break;
- case '%':
- unit = 1;
- break;
- default:
- unit = 1;
- break;
- }
- }
- return ret * unit;
+ int64_t unit = 1;
+ int64_t ret = 0;
+ char *endptr = NULL ;
+ if (!number)
+ return 0;
+
+ ret = strtoll (number, &endptr, 0);
+
+ if (endptr) {
+ switch (*endptr) {
+ case 'G':
+ case 'g':
+ if ((* (endptr + 1) == 'B') ||(* (endptr + 1) == 'b'))
+ unit = 1024 * 1024 * 1024;
+ break;
+ case 'M':
+ case 'm':
+ if ((* (endptr + 1) == 'B') ||(* (endptr + 1) == 'b'))
+ unit = 1024 * 1024;
+ break;
+ case 'K':
+ case 'k':
+ if ((* (endptr + 1) == 'B') ||(* (endptr + 1) == 'b'))
+ unit = 1024;
+ break;
+ case '%':
+ unit = 1;
+ break;
+ default:
+ unit = 1;
+ break;
+ }
+ }
+ return ret * unit;
}
int
gf_string2boolean (const char *str, gf_boolean_t *b)
{
- if (str == NULL) {
- return -1;
- }
-
- if ((strcasecmp (str, "1") == 0) ||
- (strcasecmp (str, "on") == 0) ||
- (strcasecmp (str, "yes") == 0) ||
- (strcasecmp (str, "true") == 0) ||
- (strcasecmp (str, "enable") == 0)) {
- *b = _gf_true;
- return 0;
- }
-
- if ((strcasecmp (str, "0") == 0) ||
- (strcasecmp (str, "off") == 0) ||
- (strcasecmp (str, "no") == 0) ||
- (strcasecmp (str, "false") == 0) ||
- (strcasecmp (str, "disable") == 0)) {
- *b = _gf_false;
- return 0;
- }
-
- return -1;
+ if (str == NULL) {
+ return -1;
+ }
+
+ if ((strcasecmp (str, "1") == 0) ||
+ (strcasecmp (str, "on") == 0) ||
+ (strcasecmp (str, "yes") == 0) ||
+ (strcasecmp (str, "true") == 0) ||
+ (strcasecmp (str, "enable") == 0)) {
+ *b = _gf_true;
+ return 0;
+ }
+
+ if ((strcasecmp (str, "0") == 0) ||
+ (strcasecmp (str, "off") == 0) ||
+ (strcasecmp (str, "no") == 0) ||
+ (strcasecmp (str, "false") == 0) ||
+ (strcasecmp (str, "disable") == 0)) {
+ *b = _gf_false;
+ return 0;
+ }
+
+ return -1;
}
int
gf_lockfd (int fd)
{
- struct gf_flock fl;
+ struct gf_flock fl;
- fl.l_type = F_WRLCK;
- fl.l_whence = SEEK_SET;
- fl.l_start = 0;
- fl.l_len = 0;
+ fl.l_type = F_WRLCK;
+ fl.l_whence = SEEK_SET;
+ fl.l_start = 0;
+ fl.l_len = 0;
- return fcntl (fd, F_SETLK, &fl);
+ return fcntl (fd, F_SETLK, &fl);
}
int
gf_unlockfd (int fd)
{
- struct gf_flock fl;
+ struct gf_flock fl;
- fl.l_type = F_UNLCK;
- fl.l_whence = SEEK_SET;
- fl.l_start = 0;
- fl.l_len = 0;
+ fl.l_type = F_UNLCK;
+ fl.l_whence = SEEK_SET;
+ fl.l_start = 0;
+ fl.l_len = 0;
- return fcntl (fd, F_SETLK, &fl);
+ return fcntl (fd, F_SETLK, &fl);
}
static void
@@ -1575,7 +1575,7 @@ strtail (char *str, const char *pattern)
}
/* RFC 1123 & 952 */
-char
+char
valid_host_name (char *address, int length)
{
int i = 0;
@@ -1612,10 +1612,10 @@ valid_ipv4_address (char *address, int length)
char ret = 1;
tmp = gf_strdup (address);
- prev = tmp;
+ prev = tmp;
prev = strtok_r (tmp, ".", &ptr);
- while (prev != NULL)
+ while (prev != NULL)
{
octets++;
value = strtol (prev, &endptr, 10);
@@ -1623,7 +1623,7 @@ valid_ipv4_address (char *address, int length)
ret = 0;
goto out;
}
-
+
prev = strtok_r (NULL, ".", &ptr);
}
@@ -1647,7 +1647,7 @@ valid_ipv6_address (char *address, int length)
tmp = gf_strdup (address);
prev = strtok_r (tmp, ":", &ptr);
- while (prev != NULL)
+ while (prev != NULL)
{
hex_numbers++;
value = strtol (prev, &endptr, 16);
@@ -1656,10 +1656,10 @@ valid_ipv6_address (char *address, int length)
ret = 0;
goto out;
}
-
+
prev = strtok_r (NULL, ":", &ptr);
}
-
+
if (hex_numbers > 8) {
ret = 0;
}
@@ -1744,7 +1744,7 @@ gf_elem_swap (void *x, void *y, size_t l) {
void
gf_array_insertionsort (void *A, int l, int r, size_t elem_size,
- gf_cmp cmp)
+ gf_cmp cmp)
{
int i = l;
int N = r+1;
diff --git a/libglusterfs/src/compat-errno.c b/libglusterfs/src/compat-errno.c
index 7b39b0a8da5..1a7290fe77f 100644
--- a/libglusterfs/src/compat-errno.c
+++ b/libglusterfs/src/compat-errno.c
@@ -1,20 +1,20 @@
/*
- Copyright (c) 2008-2010 Gluster, Inc. <http://www.gluster.com>
- This file is part of GlusterFS.
-
- GlusterFS is free software; you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation; either version 3 of the License,
- or (at your option) any later version.
-
- GlusterFS 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
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see
- <http://www.gnu.org/licenses/>.
+ Copyright (c) 2008-2010 Gluster, Inc. <http://www.gluster.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
*/
#ifndef _CONFIG_H
@@ -27,868 +27,868 @@
#include "compat-errno.h"
-static int32_t gf_error_to_errno_array[1024];
+static int32_t gf_error_to_errno_array[1024];
static int32_t gf_errno_to_error_array[1024];
static int32_t gf_compat_errno_init_done;
#ifdef GF_SOLARIS_HOST_OS
-static void
+static void
init_compat_errno_arrays ()
{
-/* ENOMSG 35 / * No message of desired type */
- gf_error_to_errno_array[GF_ERROR_CODE_NOMSG] = ENOMSG;
- gf_errno_to_error_array[ENOMSG] = GF_ERROR_CODE_NOMSG;
+/* ENOMSG 35 / * No message of desired type */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOMSG] = ENOMSG;
+ gf_errno_to_error_array[ENOMSG] = GF_ERROR_CODE_NOMSG;
-/* EIDRM 36 / * Identifier removed */
- gf_error_to_errno_array[GF_ERROR_CODE_IDRM] = EIDRM;
- gf_errno_to_error_array[EIDRM] = GF_ERROR_CODE_IDRM;
+/* EIDRM 36 / * Identifier removed */
+ gf_error_to_errno_array[GF_ERROR_CODE_IDRM] = EIDRM;
+ gf_errno_to_error_array[EIDRM] = GF_ERROR_CODE_IDRM;
-/* ECHRNG 37 / * Channel number out of range */
- gf_error_to_errno_array[GF_ERROR_CODE_CHRNG] = ECHRNG;
- gf_errno_to_error_array[ECHRNG] = GF_ERROR_CODE_CHRNG;
+/* ECHRNG 37 / * Channel number out of range */
+ gf_error_to_errno_array[GF_ERROR_CODE_CHRNG] = ECHRNG;
+ gf_errno_to_error_array[ECHRNG] = GF_ERROR_CODE_CHRNG;
-/* EL2NSYNC 38 / * Level 2 not synchronized */
- gf_error_to_errno_array[GF_ERROR_CODE_L2NSYNC] = EL2NSYNC;
- gf_errno_to_error_array[EL2NSYNC] = GF_ERROR_CODE_L2NSYNC;
+/* EL2NSYNC 38 / * Level 2 not synchronized */
+ gf_error_to_errno_array[GF_ERROR_CODE_L2NSYNC] = EL2NSYNC;
+ gf_errno_to_error_array[EL2NSYNC] = GF_ERROR_CODE_L2NSYNC;
-/* EL3HLT 39 / * Level 3 halted */
- gf_error_to_errno_array[GF_ERROR_CODE_L3HLT] = EL3HLT;
- gf_errno_to_error_array[EL3HLT] = GF_ERROR_CODE_L3HLT;
+/* EL3HLT 39 / * Level 3 halted */
+ gf_error_to_errno_array[GF_ERROR_CODE_L3HLT] = EL3HLT;
+ gf_errno_to_error_array[EL3HLT] = GF_ERROR_CODE_L3HLT;
-/* EL3RST 40 / * Level 3 reset */
- gf_error_to_errno_array[GF_ERROR_CODE_L3RST] = EL3RST;
- gf_errno_to_error_array[EL3RST] = GF_ERROR_CODE_L3RST;
+/* EL3RST 40 / * Level 3 reset */
+ gf_error_to_errno_array[GF_ERROR_CODE_L3RST] = EL3RST;
+ gf_errno_to_error_array[EL3RST] = GF_ERROR_CODE_L3RST;
-/* ELNRNG 41 / * Link number out of range */
- gf_error_to_errno_array[GF_ERROR_CODE_LNRNG] = ELNRNG;
- gf_errno_to_error_array[ELNRNG] = GF_ERROR_CODE_LNRNG;
+/* ELNRNG 41 / * Link number out of range */
+ gf_error_to_errno_array[GF_ERROR_CODE_LNRNG] = ELNRNG;
+ gf_errno_to_error_array[ELNRNG] = GF_ERROR_CODE_LNRNG;
-/* EUNATCH 42 / * Protocol driver not attached */
- gf_error_to_errno_array[GF_ERROR_CODE_UNATCH] = EUNATCH;
- gf_errno_to_error_array[EUNATCH] = GF_ERROR_CODE_UNATCH;
+/* EUNATCH 42 / * Protocol driver not attached */
+ gf_error_to_errno_array[GF_ERROR_CODE_UNATCH] = EUNATCH;
+ gf_errno_to_error_array[EUNATCH] = GF_ERROR_CODE_UNATCH;
-/* ENOCSI 43 / * No CSI structure available */
- gf_error_to_errno_array[GF_ERROR_CODE_NOCSI] = ENOCSI;
- gf_errno_to_error_array[ENOCSI] = GF_ERROR_CODE_NOCSI;
+/* ENOCSI 43 / * No CSI structure available */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOCSI] = ENOCSI;
+ gf_errno_to_error_array[ENOCSI] = GF_ERROR_CODE_NOCSI;
-/* EL2HLT 44 / * Level 2 halted */
- gf_error_to_errno_array[GF_ERROR_CODE_L2HLT] = EL2HLT;
- gf_errno_to_error_array[EL2HLT] = GF_ERROR_CODE_L2HLT;
+/* EL2HLT 44 / * Level 2 halted */
+ gf_error_to_errno_array[GF_ERROR_CODE_L2HLT] = EL2HLT;
+ gf_errno_to_error_array[EL2HLT] = GF_ERROR_CODE_L2HLT;
-/* EDEADLK 45 / * Deadlock condition. */
- gf_error_to_errno_array[GF_ERROR_CODE_DEADLK] = EDEADLK;
- gf_errno_to_error_array[EDEADLK] = GF_ERROR_CODE_DEADLK;
+/* EDEADLK 45 / * Deadlock condition. */
+ gf_error_to_errno_array[GF_ERROR_CODE_DEADLK] = EDEADLK;
+ gf_errno_to_error_array[EDEADLK] = GF_ERROR_CODE_DEADLK;
-/* ENOLCK 46 / * No record locks available. */
- gf_error_to_errno_array[GF_ERROR_CODE_NOLCK] = ENOLCK;
- gf_errno_to_error_array[ENOLCK] = GF_ERROR_CODE_NOLCK;
+/* ENOLCK 46 / * No record locks available. */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOLCK] = ENOLCK;
+ gf_errno_to_error_array[ENOLCK] = GF_ERROR_CODE_NOLCK;
-/* ECANCELED 47 / * Operation canceled */
- gf_error_to_errno_array[GF_ERROR_CODE_CANCELED] = ECANCELED;
- gf_errno_to_error_array[ECANCELED] = GF_ERROR_CODE_CANCELED;
+/* ECANCELED 47 / * Operation canceled */
+ gf_error_to_errno_array[GF_ERROR_CODE_CANCELED] = ECANCELED;
+ gf_errno_to_error_array[ECANCELED] = GF_ERROR_CODE_CANCELED;
-/* ENOTSUP 48 / * Operation not supported */
- gf_error_to_errno_array[GF_ERROR_CODE_NOTSUPP] = ENOTSUP;
- gf_errno_to_error_array[ENOTSUP] = GF_ERROR_CODE_NOTSUPP;
+/* ENOTSUP 48 / * Operation not supported */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOTSUPP] = ENOTSUP;
+ gf_errno_to_error_array[ENOTSUP] = GF_ERROR_CODE_NOTSUPP;
/* Filesystem Quotas */
-/* EDQUOT 49 / * Disc quota exceeded */
- gf_error_to_errno_array[GF_ERROR_CODE_DQUOT] = EDQUOT;
- gf_errno_to_error_array[EDQUOT] = GF_ERROR_CODE_DQUOT;
+/* EDQUOT 49 / * Disc quota exceeded */
+ gf_error_to_errno_array[GF_ERROR_CODE_DQUOT] = EDQUOT;
+ gf_errno_to_error_array[EDQUOT] = GF_ERROR_CODE_DQUOT;
/* Convergent Error Returns */
-/* EBADE 50 / * invalid exchange */
- gf_error_to_errno_array[GF_ERROR_CODE_BADE] = EBADE;
- gf_errno_to_error_array[EBADE] = GF_ERROR_CODE_BADE;
-/* EBADR 51 / * invalid request descriptor */
- gf_error_to_errno_array[GF_ERROR_CODE_BADR] = EBADR;
- gf_errno_to_error_array[EBADR] = GF_ERROR_CODE_BADR;
-/* EXFULL 52 / * exchange full */
- gf_error_to_errno_array[GF_ERROR_CODE_XFULL] = EXFULL;
- gf_errno_to_error_array[EXFULL] = GF_ERROR_CODE_XFULL;
-/* ENOANO 53 / * no anode */
- gf_error_to_errno_array[GF_ERROR_CODE_NOANO] = ENOANO;
- gf_errno_to_error_array[ENOANO] = GF_ERROR_CODE_NOANO;
-/* EBADRQC 54 / * invalid request code */
- gf_error_to_errno_array[GF_ERROR_CODE_BADRQC] = EBADRQC;
- gf_errno_to_error_array[EBADRQC] = GF_ERROR_CODE_BADRQC;
-/* EBADSLT 55 / * invalid slot */
- gf_error_to_errno_array[GF_ERROR_CODE_BADSLT] = EBADSLT;
- gf_errno_to_error_array[EBADSLT] = GF_ERROR_CODE_BADSLT;
-/* EDEADLOCK 56 / * file locking deadlock error */
+/* EBADE 50 / * invalid exchange */
+ gf_error_to_errno_array[GF_ERROR_CODE_BADE] = EBADE;
+ gf_errno_to_error_array[EBADE] = GF_ERROR_CODE_BADE;
+/* EBADR 51 / * invalid request descriptor */
+ gf_error_to_errno_array[GF_ERROR_CODE_BADR] = EBADR;
+ gf_errno_to_error_array[EBADR] = GF_ERROR_CODE_BADR;
+/* EXFULL 52 / * exchange full */
+ gf_error_to_errno_array[GF_ERROR_CODE_XFULL] = EXFULL;
+ gf_errno_to_error_array[EXFULL] = GF_ERROR_CODE_XFULL;
+/* ENOANO 53 / * no anode */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOANO] = ENOANO;
+ gf_errno_to_error_array[ENOANO] = GF_ERROR_CODE_NOANO;
+/* EBADRQC 54 / * invalid request code */
+ gf_error_to_errno_array[GF_ERROR_CODE_BADRQC] = EBADRQC;
+ gf_errno_to_error_array[EBADRQC] = GF_ERROR_CODE_BADRQC;
+/* EBADSLT 55 / * invalid slot */
+ gf_error_to_errno_array[GF_ERROR_CODE_BADSLT] = EBADSLT;
+ gf_errno_to_error_array[EBADSLT] = GF_ERROR_CODE_BADSLT;
+/* EDEADLOCK 56 / * file locking deadlock error */
/* This is same as EDEADLK on linux */
- gf_error_to_errno_array[GF_ERROR_CODE_DEADLK] = EDEADLOCK;
- gf_errno_to_error_array[EDEADLOCK] = GF_ERROR_CODE_DEADLK;
+ gf_error_to_errno_array[GF_ERROR_CODE_DEADLK] = EDEADLOCK;
+ gf_errno_to_error_array[EDEADLOCK] = GF_ERROR_CODE_DEADLK;
-/* EBFONT 57 / * bad font file fmt */
- gf_error_to_errno_array[GF_ERROR_CODE_BFONT] = EBFONT;
- gf_errno_to_error_array[EBFONT] = GF_ERROR_CODE_BFONT;
+/* EBFONT 57 / * bad font file fmt */
+ gf_error_to_errno_array[GF_ERROR_CODE_BFONT] = EBFONT;
+ gf_errno_to_error_array[EBFONT] = GF_ERROR_CODE_BFONT;
/* Interprocess Robust Locks */
-/* EOWNERDEAD 58 / * process died with the lock */
- gf_error_to_errno_array[GF_ERROR_CODE_OWNERDEAD] = EOWNERDEAD;
- gf_errno_to_error_array[EOWNERDEAD] = GF_ERROR_CODE_OWNERDEAD;
-/* ENOTRECOVERABLE 59 / * lock is not recoverable */
- gf_error_to_errno_array[GF_ERROR_CODE_NOTRECOVERABLE] = ENOTRECOVERABLE;
- gf_errno_to_error_array[ENOTRECOVERABLE] = GF_ERROR_CODE_NOTRECOVERABLE;
+/* EOWNERDEAD 58 / * process died with the lock */
+ gf_error_to_errno_array[GF_ERROR_CODE_OWNERDEAD] = EOWNERDEAD;
+ gf_errno_to_error_array[EOWNERDEAD] = GF_ERROR_CODE_OWNERDEAD;
+/* ENOTRECOVERABLE 59 / * lock is not recoverable */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOTRECOVERABLE] = ENOTRECOVERABLE;
+ gf_errno_to_error_array[ENOTRECOVERABLE] = GF_ERROR_CODE_NOTRECOVERABLE;
/* stream problems */
-/* ENOSTR 60 / * Device not a stream */
- gf_error_to_errno_array[GF_ERROR_CODE_NOSTR] = ENOSTR;
- gf_errno_to_error_array[ENOSTR] = GF_ERROR_CODE_NOSTR;
-/* ENODATA 61 / * no data (for no delay io) */
- gf_error_to_errno_array[GF_ERROR_CODE_NODATA] = ENODATA;
- gf_errno_to_error_array[ENODATA] = GF_ERROR_CODE_NODATA;
-/* ETIME 62 / * timer expired */
- gf_error_to_errno_array[GF_ERROR_CODE_TIME] = ETIME;
- gf_errno_to_error_array[ETIME] = GF_ERROR_CODE_TIME;
-/* ENOSR 63 / * out of streams resources */
- gf_error_to_errno_array[GF_ERROR_CODE_NOSR] = ENOSR;
- gf_errno_to_error_array[ENOSR] = GF_ERROR_CODE_NOSR;
-
-/* ENONET 64 / * Machine is not on the network */
- gf_error_to_errno_array[GF_ERROR_CODE_NONET] = ENONET;
- gf_errno_to_error_array[ENONET] = GF_ERROR_CODE_NONET;
-/* ENOPKG 65 / * Package not installed */
- gf_error_to_errno_array[GF_ERROR_CODE_NOPKG] = ENOPKG;
- gf_errno_to_error_array[ENOPKG] = GF_ERROR_CODE_NOPKG;
-/* EREMOTE 66 / * The object is remote */
- gf_error_to_errno_array[GF_ERROR_CODE_REMOTE] = EREMOTE;
- gf_errno_to_error_array[EREMOTE] = GF_ERROR_CODE_REMOTE;
-/* ENOLINK 67 / * the link has been severed */
- gf_error_to_errno_array[GF_ERROR_CODE_NOLINK] = ENOLINK;
- gf_errno_to_error_array[ENOLINK] = GF_ERROR_CODE_NOLINK;
-/* EADV 68 / * advertise error */
- gf_error_to_errno_array[GF_ERROR_CODE_ADV] = EADV;
- gf_errno_to_error_array[EADV] = GF_ERROR_CODE_ADV;
-/* ESRMNT 69 / * srmount error */
- gf_error_to_errno_array[GF_ERROR_CODE_SRMNT] = ESRMNT;
- gf_errno_to_error_array[ESRMNT] = GF_ERROR_CODE_SRMNT;
-
-/* ECOMM 70 / * Communication error on send */
- gf_error_to_errno_array[GF_ERROR_CODE_COMM] = ECOMM;
- gf_errno_to_error_array[ECOMM] = GF_ERROR_CODE_COMM;
-/* EPROTO 71 / * Protocol error */
- gf_error_to_errno_array[GF_ERROR_CODE_PROTO] = EPROTO;
- gf_errno_to_error_array[EPROTO] = GF_ERROR_CODE_PROTO;
+/* ENOSTR 60 / * Device not a stream */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOSTR] = ENOSTR;
+ gf_errno_to_error_array[ENOSTR] = GF_ERROR_CODE_NOSTR;
+/* ENODATA 61 / * no data (for no delay io) */
+ gf_error_to_errno_array[GF_ERROR_CODE_NODATA] = ENODATA;
+ gf_errno_to_error_array[ENODATA] = GF_ERROR_CODE_NODATA;
+/* ETIME 62 / * timer expired */
+ gf_error_to_errno_array[GF_ERROR_CODE_TIME] = ETIME;
+ gf_errno_to_error_array[ETIME] = GF_ERROR_CODE_TIME;
+/* ENOSR 63 / * out of streams resources */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOSR] = ENOSR;
+ gf_errno_to_error_array[ENOSR] = GF_ERROR_CODE_NOSR;
+
+/* ENONET 64 / * Machine is not on the network */
+ gf_error_to_errno_array[GF_ERROR_CODE_NONET] = ENONET;
+ gf_errno_to_error_array[ENONET] = GF_ERROR_CODE_NONET;
+/* ENOPKG 65 / * Package not installed */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOPKG] = ENOPKG;
+ gf_errno_to_error_array[ENOPKG] = GF_ERROR_CODE_NOPKG;
+/* EREMOTE 66 / * The object is remote */
+ gf_error_to_errno_array[GF_ERROR_CODE_REMOTE] = EREMOTE;
+ gf_errno_to_error_array[EREMOTE] = GF_ERROR_CODE_REMOTE;
+/* ENOLINK 67 / * the link has been severed */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOLINK] = ENOLINK;
+ gf_errno_to_error_array[ENOLINK] = GF_ERROR_CODE_NOLINK;
+/* EADV 68 / * advertise error */
+ gf_error_to_errno_array[GF_ERROR_CODE_ADV] = EADV;
+ gf_errno_to_error_array[EADV] = GF_ERROR_CODE_ADV;
+/* ESRMNT 69 / * srmount error */
+ gf_error_to_errno_array[GF_ERROR_CODE_SRMNT] = ESRMNT;
+ gf_errno_to_error_array[ESRMNT] = GF_ERROR_CODE_SRMNT;
+
+/* ECOMM 70 / * Communication error on send */
+ gf_error_to_errno_array[GF_ERROR_CODE_COMM] = ECOMM;
+ gf_errno_to_error_array[ECOMM] = GF_ERROR_CODE_COMM;
+/* EPROTO 71 / * Protocol error */
+ gf_error_to_errno_array[GF_ERROR_CODE_PROTO] = EPROTO;
+ gf_errno_to_error_array[EPROTO] = GF_ERROR_CODE_PROTO;
/* Interprocess Robust Locks */
-/* ELOCKUNMAPPED 72 / * locked lock was unmapped */
- gf_error_to_errno_array[GF_ERROR_CODE_LOCKUNMAPPED] = ELOCKUNMAPPED;
- gf_errno_to_error_array[ELOCKUNMAPPED] = GF_ERROR_CODE_LOCKUNMAPPED;
-
-/* ENOTACTIVE 73 / * Facility is not active */
- gf_error_to_errno_array[GF_ERROR_CODE_NOTACTIVE] = ENOTACTIVE;
- gf_errno_to_error_array[ENOTACTIVE] = GF_ERROR_CODE_NOTACTIVE;
-/* EMULTIHOP 74 / * multihop attempted */
- gf_error_to_errno_array[GF_ERROR_CODE_MULTIHOP] = EMULTIHOP;
- gf_errno_to_error_array[EMULTIHOP] = GF_ERROR_CODE_MULTIHOP;
-/* EBADMSG 77 / * trying to read unreadable message */
- gf_error_to_errno_array[GF_ERROR_CODE_BADMSG] = EBADMSG;
- gf_errno_to_error_array[EBADMSG] = GF_ERROR_CODE_BADMSG;
-/* ENAMETOOLONG 78 / * path name is too long */
- gf_error_to_errno_array[GF_ERROR_CODE_NAMETOOLONG] = ENAMETOOLONG;
- gf_errno_to_error_array[ENAMETOOLONG] = GF_ERROR_CODE_NAMETOOLONG;
-/* EOVERFLOW 79 / * value too large to be stored in data type */
- gf_error_to_errno_array[GF_ERROR_CODE_OVERFLOW] = EOVERFLOW;
- gf_errno_to_error_array[EOVERFLOW] = GF_ERROR_CODE_OVERFLOW;
-/* ENOTUNIQ 80 / * given log. name not unique */
- gf_error_to_errno_array[GF_ERROR_CODE_NOTUNIQ] = ENOTUNIQ;
- gf_errno_to_error_array[ENOTUNIQ] = GF_ERROR_CODE_NOTUNIQ;
-/* EBADFD 81 / * f.d. invalid for this operation */
- gf_error_to_errno_array[GF_ERROR_CODE_BADFD] = EBADFD;
- gf_errno_to_error_array[EBADFD] = GF_ERROR_CODE_BADFD;
-/* EREMCHG 82 / * Remote address changed */
- gf_error_to_errno_array[GF_ERROR_CODE_REMCHG] = EREMCHG;
- gf_errno_to_error_array[EREMCHG] = GF_ERROR_CODE_REMCHG;
+/* ELOCKUNMAPPED 72 / * locked lock was unmapped */
+ gf_error_to_errno_array[GF_ERROR_CODE_LOCKUNMAPPED] = ELOCKUNMAPPED;
+ gf_errno_to_error_array[ELOCKUNMAPPED] = GF_ERROR_CODE_LOCKUNMAPPED;
+
+/* ENOTACTIVE 73 / * Facility is not active */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOTACTIVE] = ENOTACTIVE;
+ gf_errno_to_error_array[ENOTACTIVE] = GF_ERROR_CODE_NOTACTIVE;
+/* EMULTIHOP 74 / * multihop attempted */
+ gf_error_to_errno_array[GF_ERROR_CODE_MULTIHOP] = EMULTIHOP;
+ gf_errno_to_error_array[EMULTIHOP] = GF_ERROR_CODE_MULTIHOP;
+/* EBADMSG 77 / * trying to read unreadable message */
+ gf_error_to_errno_array[GF_ERROR_CODE_BADMSG] = EBADMSG;
+ gf_errno_to_error_array[EBADMSG] = GF_ERROR_CODE_BADMSG;
+/* ENAMETOOLONG 78 / * path name is too long */
+ gf_error_to_errno_array[GF_ERROR_CODE_NAMETOOLONG] = ENAMETOOLONG;
+ gf_errno_to_error_array[ENAMETOOLONG] = GF_ERROR_CODE_NAMETOOLONG;
+/* EOVERFLOW 79 / * value too large to be stored in data type */
+ gf_error_to_errno_array[GF_ERROR_CODE_OVERFLOW] = EOVERFLOW;
+ gf_errno_to_error_array[EOVERFLOW] = GF_ERROR_CODE_OVERFLOW;
+/* ENOTUNIQ 80 / * given log. name not unique */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOTUNIQ] = ENOTUNIQ;
+ gf_errno_to_error_array[ENOTUNIQ] = GF_ERROR_CODE_NOTUNIQ;
+/* EBADFD 81 / * f.d. invalid for this operation */
+ gf_error_to_errno_array[GF_ERROR_CODE_BADFD] = EBADFD;
+ gf_errno_to_error_array[EBADFD] = GF_ERROR_CODE_BADFD;
+/* EREMCHG 82 / * Remote address changed */
+ gf_error_to_errno_array[GF_ERROR_CODE_REMCHG] = EREMCHG;
+ gf_errno_to_error_array[EREMCHG] = GF_ERROR_CODE_REMCHG;
/* shared library problems */
-/* ELIBACC 83 / * Can't access a needed shared lib. */
- gf_error_to_errno_array[GF_ERROR_CODE_LIBACC] = ELIBACC;
- gf_errno_to_error_array[ELIBACC] = GF_ERROR_CODE_LIBACC;
-/* ELIBBAD 84 / * Accessing a corrupted shared lib. */
- gf_error_to_errno_array[GF_ERROR_CODE_LIBBAD] = ELIBBAD;
- gf_errno_to_error_array[ELIBBAD] = GF_ERROR_CODE_LIBBAD;
-/* ELIBSCN 85 / * .lib section in a.out corrupted. */
- gf_error_to_errno_array[GF_ERROR_CODE_LIBSCN] = ELIBSCN;
- gf_errno_to_error_array[ELIBSCN] = GF_ERROR_CODE_LIBSCN;
-/* ELIBMAX 86 / * Attempting to link in too many libs. */
- gf_error_to_errno_array[GF_ERROR_CODE_LIBMAX] = ELIBMAX;
- gf_errno_to_error_array[ELIBMAX] = GF_ERROR_CODE_LIBMAX;
-/* ELIBEXEC 87 / * Attempting to exec a shared library. */
- gf_error_to_errno_array[GF_ERROR_CODE_LIBEXEC] = ELIBEXEC;
- gf_errno_to_error_array[ELIBEXEC] = GF_ERROR_CODE_LIBEXEC;
-/* EILSEQ 88 / * Illegal byte sequence. */
- gf_error_to_errno_array[GF_ERROR_CODE_ILSEQ] = EILSEQ;
- gf_errno_to_error_array[EILSEQ] = GF_ERROR_CODE_ILSEQ;
-/* ENOSYS 89 / * Unsupported file system operation */
- gf_error_to_errno_array[GF_ERROR_CODE_NOSYS] = ENOSYS;
- gf_errno_to_error_array[ENOSYS] = GF_ERROR_CODE_NOSYS;
-/* ELOOP 90 / * Symbolic link loop */
- gf_error_to_errno_array[GF_ERROR_CODE_LOOP] = ELOOP;
- gf_errno_to_error_array[ELOOP] = GF_ERROR_CODE_LOOP;
-/* ERESTART 91 / * Restartable system call */
- gf_error_to_errno_array[GF_ERROR_CODE_RESTART] = ERESTART;
- gf_errno_to_error_array[ERESTART] = GF_ERROR_CODE_RESTART;
-/* ESTRPIPE 92 / * if pipe/FIFO, don't sleep in stream head */
- gf_error_to_errno_array[GF_ERROR_CODE_STRPIPE] = ESTRPIPE;
- gf_errno_to_error_array[ESTRPIPE] = GF_ERROR_CODE_STRPIPE;
-/* ENOTEMPTY 93 / * directory not empty */
- gf_error_to_errno_array[GF_ERROR_CODE_NOTEMPTY] = ENOTEMPTY;
- gf_errno_to_error_array[ENOTEMPTY] = GF_ERROR_CODE_NOTEMPTY;
-/* EUSERS 94 / * Too many users (for UFS) */
- gf_error_to_errno_array[GF_ERROR_CODE_USERS] = EUSERS;
- gf_errno_to_error_array[EUSERS] = GF_ERROR_CODE_USERS;
+/* ELIBACC 83 / * Can't access a needed shared lib. */
+ gf_error_to_errno_array[GF_ERROR_CODE_LIBACC] = ELIBACC;
+ gf_errno_to_error_array[ELIBACC] = GF_ERROR_CODE_LIBACC;
+/* ELIBBAD 84 / * Accessing a corrupted shared lib. */
+ gf_error_to_errno_array[GF_ERROR_CODE_LIBBAD] = ELIBBAD;
+ gf_errno_to_error_array[ELIBBAD] = GF_ERROR_CODE_LIBBAD;
+/* ELIBSCN 85 / * .lib section in a.out corrupted. */
+ gf_error_to_errno_array[GF_ERROR_CODE_LIBSCN] = ELIBSCN;
+ gf_errno_to_error_array[ELIBSCN] = GF_ERROR_CODE_LIBSCN;
+/* ELIBMAX 86 / * Attempting to link in too many libs. */
+ gf_error_to_errno_array[GF_ERROR_CODE_LIBMAX] = ELIBMAX;
+ gf_errno_to_error_array[ELIBMAX] = GF_ERROR_CODE_LIBMAX;
+/* ELIBEXEC 87 / * Attempting to exec a shared library. */
+ gf_error_to_errno_array[GF_ERROR_CODE_LIBEXEC] = ELIBEXEC;
+ gf_errno_to_error_array[ELIBEXEC] = GF_ERROR_CODE_LIBEXEC;
+/* EILSEQ 88 / * Illegal byte sequence. */
+ gf_error_to_errno_array[GF_ERROR_CODE_ILSEQ] = EILSEQ;
+ gf_errno_to_error_array[EILSEQ] = GF_ERROR_CODE_ILSEQ;
+/* ENOSYS 89 / * Unsupported file system operation */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOSYS] = ENOSYS;
+ gf_errno_to_error_array[ENOSYS] = GF_ERROR_CODE_NOSYS;
+/* ELOOP 90 / * Symbolic link loop */
+ gf_error_to_errno_array[GF_ERROR_CODE_LOOP] = ELOOP;
+ gf_errno_to_error_array[ELOOP] = GF_ERROR_CODE_LOOP;
+/* ERESTART 91 / * Restartable system call */
+ gf_error_to_errno_array[GF_ERROR_CODE_RESTART] = ERESTART;
+ gf_errno_to_error_array[ERESTART] = GF_ERROR_CODE_RESTART;
+/* ESTRPIPE 92 / * if pipe/FIFO, don't sleep in stream head */
+ gf_error_to_errno_array[GF_ERROR_CODE_STRPIPE] = ESTRPIPE;
+ gf_errno_to_error_array[ESTRPIPE] = GF_ERROR_CODE_STRPIPE;
+/* ENOTEMPTY 93 / * directory not empty */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOTEMPTY] = ENOTEMPTY;
+ gf_errno_to_error_array[ENOTEMPTY] = GF_ERROR_CODE_NOTEMPTY;
+/* EUSERS 94 / * Too many users (for UFS) */
+ gf_error_to_errno_array[GF_ERROR_CODE_USERS] = EUSERS;
+ gf_errno_to_error_array[EUSERS] = GF_ERROR_CODE_USERS;
/* BSD Networking Software */
- /* argument errors */
-/* ENOTSOCK 95 / * Socket operation on non-socket */
- gf_error_to_errno_array[GF_ERROR_CODE_NOTSOCK] = ENOTSOCK;
- gf_errno_to_error_array[ENOTSOCK] = GF_ERROR_CODE_NOTSOCK;
-/* EDESTADDRREQ 96 / * Destination address required */
- gf_error_to_errno_array[GF_ERROR_CODE_DESTADDRREQ] = EDESTADDRREQ;
- gf_errno_to_error_array[EDESTADDRREQ] = GF_ERROR_CODE_DESTADDRREQ;
-/* EMSGSIZE 97 / * Message too long */
- gf_error_to_errno_array[GF_ERROR_CODE_MSGSIZE] = EMSGSIZE;
- gf_errno_to_error_array[EMSGSIZE] = GF_ERROR_CODE_MSGSIZE;
-/* EPROTOTYPE 98 / * Protocol wrong type for socket */
- gf_error_to_errno_array[GF_ERROR_CODE_PROTOTYPE] = EPROTOTYPE;
- gf_errno_to_error_array[EPROTOTYPE] = GF_ERROR_CODE_PROTOTYPE;
-/* ENOPROTOOPT 99 / * Protocol not available */
- gf_error_to_errno_array[GF_ERROR_CODE_NOPROTOOPT] = ENOPROTOOPT;
- gf_errno_to_error_array[ENOPROTOOPT] = GF_ERROR_CODE_NOPROTOOPT;
-/* EPROTONOSUPPORT 120 / * Protocol not supported */
- gf_error_to_errno_array[GF_ERROR_CODE_PROTONOSUPPORT] = EPROTONOSUPPORT;
- gf_errno_to_error_array[EPROTONOSUPPORT] = GF_ERROR_CODE_PROTONOSUPPORT;
-/* ESOCKTNOSUPPORT 121 / * Socket type not supported */
- gf_error_to_errno_array[GF_ERROR_CODE_SOCKTNOSUPPORT] = ESOCKTNOSUPPORT;
- gf_errno_to_error_array[ESOCKTNOSUPPORT] = GF_ERROR_CODE_SOCKTNOSUPPORT;
-
-/* EOPNOTSUPP 122 / * Operation not supported on socket */
- gf_error_to_errno_array[GF_ERROR_CODE_OPNOTSUPP] = EOPNOTSUPP;
- gf_errno_to_error_array[EOPNOTSUPP] = GF_ERROR_CODE_OPNOTSUPP;
-/* EPFNOSUPPORT 123 / * Protocol family not supported */
- gf_error_to_errno_array[GF_ERROR_CODE_PFNOSUPPORT] = EPFNOSUPPORT;
- gf_errno_to_error_array[EPFNOSUPPORT] = GF_ERROR_CODE_PFNOSUPPORT;
-/* EAFNOSUPPORT 124 / * Address family not supported by */
- /* protocol family */
- gf_error_to_errno_array[GF_ERROR_CODE_AFNOSUPPORT] = EAFNOSUPPORT;
- gf_errno_to_error_array[EAFNOSUPPORT] = GF_ERROR_CODE_AFNOSUPPORT;
-/* EADDRINUSE 125 / * Address already in use */
- gf_error_to_errno_array[GF_ERROR_CODE_ADDRINUSE] = EADDRINUSE;
- gf_errno_to_error_array[EADDRINUSE] = GF_ERROR_CODE_ADDRINUSE;
-/* EADDRNOTAVAIL 126 / * Can't assign requested address */
- /* operational errors */
- gf_error_to_errno_array[GF_ERROR_CODE_ADDRNOTAVAIL] = EADDRNOTAVAIL;
- gf_errno_to_error_array[EADDRNOTAVAIL] = GF_ERROR_CODE_ADDRNOTAVAIL;
-/* ENETDOWN 127 / * Network is down */
- gf_error_to_errno_array[GF_ERROR_CODE_NETDOWN] = ENETDOWN;
- gf_errno_to_error_array[ENETDOWN] = GF_ERROR_CODE_NETDOWN;
-/* ENETUNREACH 128 / * Network is unreachable */
- gf_error_to_errno_array[GF_ERROR_CODE_NETUNREACH] = ENETUNREACH;
- gf_errno_to_error_array[ENETUNREACH] = GF_ERROR_CODE_NETUNREACH;
-/* ENETRESET 129 / * Network dropped connection because */
- /* of reset */
- gf_error_to_errno_array[GF_ERROR_CODE_NETRESET] = ENETRESET;
- gf_errno_to_error_array[ENETRESET] = GF_ERROR_CODE_NETRESET;
-/* ECONNABORTED 130 / * Software caused connection abort */
- gf_error_to_errno_array[GF_ERROR_CODE_CONNABORTED] = ECONNABORTED;
- gf_errno_to_error_array[ECONNABORTED] = GF_ERROR_CODE_CONNABORTED;
-/* ECONNRESET 131 / * Connection reset by peer */
- gf_error_to_errno_array[GF_ERROR_CODE_CONNRESET] = ECONNRESET;
- gf_errno_to_error_array[ECONNRESET] = GF_ERROR_CODE_CONNRESET;
-/* ENOBUFS 132 / * No buffer space available */
- gf_error_to_errno_array[GF_ERROR_CODE_NOBUFS] = ENOBUFS;
- gf_errno_to_error_array[ENOBUFS] = GF_ERROR_CODE_NOBUFS;
-/* EISCONN 133 / * Socket is already connected */
- gf_error_to_errno_array[GF_ERROR_CODE_ISCONN] = EISCONN;
- gf_errno_to_error_array[EISCONN] = GF_ERROR_CODE_ISCONN;
-/* ENOTCONN 134 / * Socket is not connected */
- gf_error_to_errno_array[GF_ERROR_CODE_NOTCONN] = ENOTCONN;
- gf_errno_to_error_array[ENOTCONN] = GF_ERROR_CODE_NOTCONN;
+ /* argument errors */
+/* ENOTSOCK 95 / * Socket operation on non-socket */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOTSOCK] = ENOTSOCK;
+ gf_errno_to_error_array[ENOTSOCK] = GF_ERROR_CODE_NOTSOCK;
+/* EDESTADDRREQ 96 / * Destination address required */
+ gf_error_to_errno_array[GF_ERROR_CODE_DESTADDRREQ] = EDESTADDRREQ;
+ gf_errno_to_error_array[EDESTADDRREQ] = GF_ERROR_CODE_DESTADDRREQ;
+/* EMSGSIZE 97 / * Message too long */
+ gf_error_to_errno_array[GF_ERROR_CODE_MSGSIZE] = EMSGSIZE;
+ gf_errno_to_error_array[EMSGSIZE] = GF_ERROR_CODE_MSGSIZE;
+/* EPROTOTYPE 98 / * Protocol wrong type for socket */
+ gf_error_to_errno_array[GF_ERROR_CODE_PROTOTYPE] = EPROTOTYPE;
+ gf_errno_to_error_array[EPROTOTYPE] = GF_ERROR_CODE_PROTOTYPE;
+/* ENOPROTOOPT 99 / * Protocol not available */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOPROTOOPT] = ENOPROTOOPT;
+ gf_errno_to_error_array[ENOPROTOOPT] = GF_ERROR_CODE_NOPROTOOPT;
+/* EPROTONOSUPPORT 120 / * Protocol not supported */
+ gf_error_to_errno_array[GF_ERROR_CODE_PROTONOSUPPORT] = EPROTONOSUPPORT;
+ gf_errno_to_error_array[EPROTONOSUPPORT] = GF_ERROR_CODE_PROTONOSUPPORT;
+/* ESOCKTNOSUPPORT 121 / * Socket type not supported */
+ gf_error_to_errno_array[GF_ERROR_CODE_SOCKTNOSUPPORT] = ESOCKTNOSUPPORT;
+ gf_errno_to_error_array[ESOCKTNOSUPPORT] = GF_ERROR_CODE_SOCKTNOSUPPORT;
+
+/* EOPNOTSUPP 122 / * Operation not supported on socket */
+ gf_error_to_errno_array[GF_ERROR_CODE_OPNOTSUPP] = EOPNOTSUPP;
+ gf_errno_to_error_array[EOPNOTSUPP] = GF_ERROR_CODE_OPNOTSUPP;
+/* EPFNOSUPPORT 123 / * Protocol family not supported */
+ gf_error_to_errno_array[GF_ERROR_CODE_PFNOSUPPORT] = EPFNOSUPPORT;
+ gf_errno_to_error_array[EPFNOSUPPORT] = GF_ERROR_CODE_PFNOSUPPORT;
+/* EAFNOSUPPORT 124 / * Address family not supported by */
+ /* protocol family */
+ gf_error_to_errno_array[GF_ERROR_CODE_AFNOSUPPORT] = EAFNOSUPPORT;
+ gf_errno_to_error_array[EAFNOSUPPORT] = GF_ERROR_CODE_AFNOSUPPORT;
+/* EADDRINUSE 125 / * Address already in use */
+ gf_error_to_errno_array[GF_ERROR_CODE_ADDRINUSE] = EADDRINUSE;
+ gf_errno_to_error_array[EADDRINUSE] = GF_ERROR_CODE_ADDRINUSE;
+/* EADDRNOTAVAIL 126 / * Can't assign requested address */
+ /* operational errors */
+ gf_error_to_errno_array[GF_ERROR_CODE_ADDRNOTAVAIL] = EADDRNOTAVAIL;
+ gf_errno_to_error_array[EADDRNOTAVAIL] = GF_ERROR_CODE_ADDRNOTAVAIL;
+/* ENETDOWN 127 / * Network is down */
+ gf_error_to_errno_array[GF_ERROR_CODE_NETDOWN] = ENETDOWN;
+ gf_errno_to_error_array[ENETDOWN] = GF_ERROR_CODE_NETDOWN;
+/* ENETUNREACH 128 / * Network is unreachable */
+ gf_error_to_errno_array[GF_ERROR_CODE_NETUNREACH] = ENETUNREACH;
+ gf_errno_to_error_array[ENETUNREACH] = GF_ERROR_CODE_NETUNREACH;
+/* ENETRESET 129 / * Network dropped connection because */
+ /* of reset */
+ gf_error_to_errno_array[GF_ERROR_CODE_NETRESET] = ENETRESET;
+ gf_errno_to_error_array[ENETRESET] = GF_ERROR_CODE_NETRESET;
+/* ECONNABORTED 130 / * Software caused connection abort */
+ gf_error_to_errno_array[GF_ERROR_CODE_CONNABORTED] = ECONNABORTED;
+ gf_errno_to_error_array[ECONNABORTED] = GF_ERROR_CODE_CONNABORTED;
+/* ECONNRESET 131 / * Connection reset by peer */
+ gf_error_to_errno_array[GF_ERROR_CODE_CONNRESET] = ECONNRESET;
+ gf_errno_to_error_array[ECONNRESET] = GF_ERROR_CODE_CONNRESET;
+/* ENOBUFS 132 / * No buffer space available */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOBUFS] = ENOBUFS;
+ gf_errno_to_error_array[ENOBUFS] = GF_ERROR_CODE_NOBUFS;
+/* EISCONN 133 / * Socket is already connected */
+ gf_error_to_errno_array[GF_ERROR_CODE_ISCONN] = EISCONN;
+ gf_errno_to_error_array[EISCONN] = GF_ERROR_CODE_ISCONN;
+/* ENOTCONN 134 / * Socket is not connected */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOTCONN] = ENOTCONN;
+ gf_errno_to_error_array[ENOTCONN] = GF_ERROR_CODE_NOTCONN;
/* XENIX has 135 - 142 */
-/* ESHUTDOWN 143 / * Can't send after socket shutdown */
- gf_error_to_errno_array[GF_ERROR_CODE_SHUTDOWN] = ESHUTDOWN;
- gf_errno_to_error_array[ESHUTDOWN] = GF_ERROR_CODE_SHUTDOWN;
-/* ETOOMANYREFS 144 / * Too many references: can't splice */
- gf_error_to_errno_array[GF_ERROR_CODE_TOOMANYREFS] = ETOOMANYREFS;
- gf_errno_to_error_array[ETOOMANYREFS] = GF_ERROR_CODE_TOOMANYREFS;
-/* ETIMEDOUT 145 / * Connection timed out */
- gf_error_to_errno_array[GF_ERROR_CODE_TIMEDOUT] = ETIMEDOUT;
- gf_errno_to_error_array[ETIMEDOUT] = GF_ERROR_CODE_TIMEDOUT;
-
-/* ECONNREFUSED 146 / * Connection refused */
- gf_error_to_errno_array[GF_ERROR_CODE_CONNREFUSED] = ECONNREFUSED;
- gf_errno_to_error_array[ECONNREFUSED] = GF_ERROR_CODE_CONNREFUSED;
-/* EHOSTDOWN 147 / * Host is down */
- gf_error_to_errno_array[GF_ERROR_CODE_HOSTDOWN] = EHOSTDOWN;
- gf_errno_to_error_array[EHOSTDOWN] = GF_ERROR_CODE_HOSTDOWN;
-/* EHOSTUNREACH 148 / * No route to host */
- gf_error_to_errno_array[GF_ERROR_CODE_HOSTUNREACH] = EHOSTUNREACH;
- gf_errno_to_error_array[EHOSTUNREACH] = GF_ERROR_CODE_HOSTUNREACH;
-/* EALREADY 149 / * operation already in progress */
- gf_error_to_errno_array[GF_ERROR_CODE_ALREADY] = EALREADY;
- gf_errno_to_error_array[EALREADY] = GF_ERROR_CODE_ALREADY;
-/* EINPROGRESS 150 / * operation now in progress */
- gf_error_to_errno_array[GF_ERROR_CODE_INPROGRESS] = EINPROGRESS;
- gf_errno_to_error_array[EINPROGRESS] = GF_ERROR_CODE_INPROGRESS;
+/* ESHUTDOWN 143 / * Can't send after socket shutdown */
+ gf_error_to_errno_array[GF_ERROR_CODE_SHUTDOWN] = ESHUTDOWN;
+ gf_errno_to_error_array[ESHUTDOWN] = GF_ERROR_CODE_SHUTDOWN;
+/* ETOOMANYREFS 144 / * Too many references: can't splice */
+ gf_error_to_errno_array[GF_ERROR_CODE_TOOMANYREFS] = ETOOMANYREFS;
+ gf_errno_to_error_array[ETOOMANYREFS] = GF_ERROR_CODE_TOOMANYREFS;
+/* ETIMEDOUT 145 / * Connection timed out */
+ gf_error_to_errno_array[GF_ERROR_CODE_TIMEDOUT] = ETIMEDOUT;
+ gf_errno_to_error_array[ETIMEDOUT] = GF_ERROR_CODE_TIMEDOUT;
+
+/* ECONNREFUSED 146 / * Connection refused */
+ gf_error_to_errno_array[GF_ERROR_CODE_CONNREFUSED] = ECONNREFUSED;
+ gf_errno_to_error_array[ECONNREFUSED] = GF_ERROR_CODE_CONNREFUSED;
+/* EHOSTDOWN 147 / * Host is down */
+ gf_error_to_errno_array[GF_ERROR_CODE_HOSTDOWN] = EHOSTDOWN;
+ gf_errno_to_error_array[EHOSTDOWN] = GF_ERROR_CODE_HOSTDOWN;
+/* EHOSTUNREACH 148 / * No route to host */
+ gf_error_to_errno_array[GF_ERROR_CODE_HOSTUNREACH] = EHOSTUNREACH;
+ gf_errno_to_error_array[EHOSTUNREACH] = GF_ERROR_CODE_HOSTUNREACH;
+/* EALREADY 149 / * operation already in progress */
+ gf_error_to_errno_array[GF_ERROR_CODE_ALREADY] = EALREADY;
+ gf_errno_to_error_array[EALREADY] = GF_ERROR_CODE_ALREADY;
+/* EINPROGRESS 150 / * operation now in progress */
+ gf_error_to_errno_array[GF_ERROR_CODE_INPROGRESS] = EINPROGRESS;
+ gf_errno_to_error_array[EINPROGRESS] = GF_ERROR_CODE_INPROGRESS;
/* SUN Network File System */
-/* ESTALE 151 / * Stale NFS file handle */
- gf_error_to_errno_array[GF_ERROR_CODE_STALE] = ESTALE;
- gf_errno_to_error_array[ESTALE] = GF_ERROR_CODE_STALE;
+/* ESTALE 151 / * Stale NFS file handle */
+ gf_error_to_errno_array[GF_ERROR_CODE_STALE] = ESTALE;
+ gf_errno_to_error_array[ESTALE] = GF_ERROR_CODE_STALE;
- return ;
+ return ;
}
#endif /* GF_SOLARIS_HOST_OS */
#ifdef GF_DARWIN_HOST_OS
-static void
+static void
init_compat_errno_arrays ()
{
- /* EDEADLK 11 / * Resource deadlock would occur */
- gf_error_to_errno_array[GF_ERROR_CODE_DEADLK] = EDEADLK;
- gf_errno_to_error_array[EDEADLK] = GF_ERROR_CODE_DEADLK;
-
- /* EAGAIN 35 / * Try Again */
- gf_error_to_errno_array[GF_ERROR_CODE_AGAIN] = EAGAIN;
- gf_errno_to_error_array[EAGAIN] = GF_ERROR_CODE_AGAIN;
-
- /* EINPROGRESS 36 / * Operation now in progress */
- gf_error_to_errno_array[GF_ERROR_CODE_INPROGRESS] = EINPROGRESS;
- gf_errno_to_error_array[EINPROGRESS] = GF_ERROR_CODE_INPROGRESS;
-
- /* EALREADY 37 / * Operation already in progress */
- gf_error_to_errno_array[GF_ERROR_CODE_ALREADY] = EALREADY;
- gf_errno_to_error_array[EALREADY] = GF_ERROR_CODE_ALREADY;
-
- /* ENOTSOCK 38 / * Socket operation on non-socket */
- gf_error_to_errno_array[GF_ERROR_CODE_NOTSOCK] = ENOTSOCK;
- gf_errno_to_error_array[ENOTSOCK] = GF_ERROR_CODE_NOTSOCK;
-
- /* EDESTADDRREQ 39 / * Destination address required */
- gf_error_to_errno_array[GF_ERROR_CODE_DESTADDRREQ] = EDESTADDRREQ;
- gf_errno_to_error_array[EDESTADDRREQ] = GF_ERROR_CODE_DESTADDRREQ;
-
- /* EMSGSIZE 40 / * Message too long */
- gf_error_to_errno_array[GF_ERROR_CODE_MSGSIZE] = EMSGSIZE;
- gf_errno_to_error_array[EMSGSIZE] = GF_ERROR_CODE_MSGSIZE;
-
- /* EPROTOTYPE 41 / * Protocol wrong type for socket */
- gf_error_to_errno_array[GF_ERROR_CODE_PROTOTYPE] = EPROTOTYPE;
- gf_errno_to_error_array[EPROTOTYPE] = GF_ERROR_CODE_PROTOTYPE;
-
- /* ENOPROTOOPT 42 / * Protocol not available */
- gf_error_to_errno_array[GF_ERROR_CODE_NOPROTOOPT] = ENOPROTOOPT;
- gf_errno_to_error_array[ENOPROTOOPT] = GF_ERROR_CODE_NOPROTOOPT;
-
- /* EPROTONOSUPPORT 43 / * Protocol not supported */
- gf_error_to_errno_array[GF_ERROR_CODE_PROTONOSUPPORT] = EPROTONOSUPPORT;
- gf_errno_to_error_array[EPROTONOSUPPORT] = GF_ERROR_CODE_PROTONOSUPPORT;
-
- /* ESOCKTNOSUPPORT 44 / * Socket type not supported */
- gf_error_to_errno_array[GF_ERROR_CODE_SOCKTNOSUPPORT] = ESOCKTNOSUPPORT;
- gf_errno_to_error_array[ESOCKTNOSUPPORT] = GF_ERROR_CODE_SOCKTNOSUPPORT;
-
- /* EOPNOTSUPP 45 / * Operation not supported */
- gf_error_to_errno_array[GF_ERROR_CODE_OPNOTSUPP] = EOPNOTSUPP;
- gf_errno_to_error_array[EOPNOTSUPP] = GF_ERROR_CODE_OPNOTSUPP;
-
- /* EPFNOSUPPORT 46 / * Protocol family not supported */
- gf_error_to_errno_array[GF_ERROR_CODE_PFNOSUPPORT] = EPFNOSUPPORT;
- gf_errno_to_error_array[EPFNOSUPPORT] = GF_ERROR_CODE_PFNOSUPPORT;
-
- /* EAFNOSUPPORT 47 / * Address family not supported by protocol family */
- gf_error_to_errno_array[GF_ERROR_CODE_AFNOSUPPORT] = EAFNOSUPPORT;
- gf_errno_to_error_array[EAFNOSUPPORT] = GF_ERROR_CODE_AFNOSUPPORT;
-
- /* EADDRINUSE 48 / * Address already in use */
- gf_error_to_errno_array[GF_ERROR_CODE_ADDRINUSE] = EADDRINUSE;
- gf_errno_to_error_array[EADDRINUSE] = GF_ERROR_CODE_ADDRINUSE;
-
- /* EADDRNOTAVAIL 49 / * Can't assign requested address */
- gf_error_to_errno_array[GF_ERROR_CODE_ADDRNOTAVAIL] = EADDRNOTAVAIL;
- gf_errno_to_error_array[EADDRNOTAVAIL] = GF_ERROR_CODE_ADDRNOTAVAIL;
-
- /* ENETDOWN 50 / * Network is down */
- gf_error_to_errno_array[GF_ERROR_CODE_NETDOWN] = ENETDOWN;
- gf_errno_to_error_array[ENETDOWN] = GF_ERROR_CODE_NETDOWN;
-
- /* ENETUNREACH 51 / * Network is unreachable */
- gf_error_to_errno_array[GF_ERROR_CODE_NETUNREACH] = ENETUNREACH;
- gf_errno_to_error_array[ENETUNREACH] = GF_ERROR_CODE_NETUNREACH;
-
- /* ENETRESET 52 / * Network dropped connection on reset */
- gf_error_to_errno_array[GF_ERROR_CODE_NETRESET] = ENETRESET;
- gf_errno_to_error_array[ENETRESET] = GF_ERROR_CODE_NETRESET;
-
- /* ECONNABORTED 53 / * Software caused connection abort */
- gf_error_to_errno_array[GF_ERROR_CODE_CONNABORTED] = ECONNABORTED;
- gf_errno_to_error_array[ECONNABORTED] = GF_ERROR_CODE_CONNABORTED;
-
- /* ECONNRESET 54 / * Connection reset by peer */
- gf_error_to_errno_array[GF_ERROR_CODE_CONNRESET] = ECONNRESET;
- gf_errno_to_error_array[ECONNRESET] = GF_ERROR_CODE_CONNRESET;
-
- /* ENOBUFS 55 / * No buffer space available */
- gf_error_to_errno_array[GF_ERROR_CODE_NOBUFS] = ENOBUFS;
- gf_errno_to_error_array[ENOBUFS] = GF_ERROR_CODE_NOBUFS;
-
- /* EISCONN 56 / * Socket is already connected */
- gf_error_to_errno_array[GF_ERROR_CODE_ISCONN] = EISCONN;
- gf_errno_to_error_array[EISCONN] = GF_ERROR_CODE_ISCONN;
-
- /* ENOTCONN 57 / * Socket is not connected */
- gf_error_to_errno_array[GF_ERROR_CODE_NOTCONN] = ENOTCONN;
- gf_errno_to_error_array[ENOTCONN] = GF_ERROR_CODE_NOTCONN;
-
- /* ESHUTDOWN 58 / * Can't send after socket shutdown */
- gf_error_to_errno_array[GF_ERROR_CODE_SHUTDOWN] = ESHUTDOWN;
- gf_errno_to_error_array[ESHUTDOWN] = GF_ERROR_CODE_SHUTDOWN;
-
- /* ETOOMANYREFS 59 / * Too many references: can't splice */
- gf_error_to_errno_array[GF_ERROR_CODE_TOOMANYREFS] = ETOOMANYREFS;
- gf_errno_to_error_array[ETOOMANYREFS] = GF_ERROR_CODE_TOOMANYREFS;
-
- /* ETIMEDOUT 60 / * Operation timed out */
- gf_error_to_errno_array[GF_ERROR_CODE_TIMEDOUT] = ETIMEDOUT;
- gf_errno_to_error_array[ETIMEDOUT] = GF_ERROR_CODE_TIMEDOUT;
-
- /* ECONNREFUSED 61 / * Connection refused */
- gf_error_to_errno_array[GF_ERROR_CODE_CONNREFUSED] = ECONNREFUSED;
- gf_errno_to_error_array[ECONNREFUSED] = GF_ERROR_CODE_CONNREFUSED;
-
- /* ELOOP 62 / * Too many levels of symbolic links */
- gf_error_to_errno_array[GF_ERROR_CODE_LOOP] = ELOOP;
- gf_errno_to_error_array[ELOOP] = GF_ERROR_CODE_LOOP;
-
- /* ENAMETOOLONG 63 / * File name too long */
- gf_error_to_errno_array[GF_ERROR_CODE_NAMETOOLONG] = ENAMETOOLONG;
- gf_errno_to_error_array[ENAMETOOLONG] = GF_ERROR_CODE_NAMETOOLONG;
-
- /* EHOSTDOWN 64 / * Host is down */
- gf_error_to_errno_array[GF_ERROR_CODE_HOSTDOWN] = EHOSTDOWN;
- gf_errno_to_error_array[EHOSTDOWN] = GF_ERROR_CODE_HOSTDOWN;
-
- /* EHOSTUNREACH 65 / * No route to host */
- gf_error_to_errno_array[GF_ERROR_CODE_HOSTUNREACH] = EHOSTUNREACH;
- gf_errno_to_error_array[EHOSTUNREACH] = GF_ERROR_CODE_HOSTUNREACH;
-
- /* ENOTEMPTY 66 / * Directory not empty */
- gf_error_to_errno_array[GF_ERROR_CODE_NOTEMPTY] = ENOTEMPTY;
- gf_errno_to_error_array[ENOTEMPTY] = GF_ERROR_CODE_NOTEMPTY;
-
- /* EPROCLIM 67 / * Too many processes */
- gf_error_to_errno_array[GF_ERROR_CODE_PROCLIM] = EPROCLIM;
- gf_errno_to_error_array[EPROCLIM] = GF_ERROR_CODE_PROCLIM;
-
- /* EUSERS 68 / * Too many users */
- gf_error_to_errno_array[GF_ERROR_CODE_USERS] = EUSERS;
- gf_errno_to_error_array[EUSERS] = GF_ERROR_CODE_USERS;
-
- /* EDQUOT 69 / * Disc quota exceeded */
- gf_error_to_errno_array[GF_ERROR_CODE_DQUOT] = EDQUOT;
- gf_errno_to_error_array[EDQUOT] = GF_ERROR_CODE_DQUOT;
-
- /* ESTALE 70 / * Stale NFS file handle */
- gf_error_to_errno_array[GF_ERROR_CODE_STALE] = ESTALE;
- gf_errno_to_error_array[ESTALE] = GF_ERROR_CODE_STALE;
-
- /* EREMOTE 71 / * Too many levels of remote in path */
- gf_error_to_errno_array[GF_ERROR_CODE_REMOTE] = EREMOTE;
- gf_errno_to_error_array[EREMOTE] = GF_ERROR_CODE_REMOTE;
-
- /* EBADRPC 72 / * RPC struct is bad */
- gf_error_to_errno_array[GF_ERROR_CODE_BADRPC] = EBADRPC;
- gf_errno_to_error_array[EBADRPC] = GF_ERROR_CODE_BADRPC;
-
- /* ERPCMISMATCH 73 / * RPC version wrong */
- gf_error_to_errno_array[GF_ERROR_CODE_RPCMISMATCH] = ERPCMISMATCH;
- gf_errno_to_error_array[ERPCMISMATCH] = GF_ERROR_CODE_RPCMISMATCH;
-
- /* EPROGUNAVAIL 74 / * RPC prog. not avail */
- gf_error_to_errno_array[GF_ERROR_CODE_PROGUNAVAIL] = EPROGUNAVAIL;
- gf_errno_to_error_array[EPROGUNAVAIL] = GF_ERROR_CODE_PROGUNAVAIL;
-
- /* EPROGMISMATCH 75 / * Program version wrong */
- gf_error_to_errno_array[GF_ERROR_CODE_PROGMISMATCH] = EPROGMISMATCH;
- gf_errno_to_error_array[EPROGMISMATCH] = GF_ERROR_CODE_PROGMISMATCH;
-
- /* EPROCUNAVAIL 76 / * Bad procedure for program */
- gf_error_to_errno_array[GF_ERROR_CODE_PROCUNAVAIL] = EPROCUNAVAIL;
- gf_errno_to_error_array[EPROCUNAVAIL] = GF_ERROR_CODE_PROCUNAVAIL;
-
- /* ENOLCK 77 / * No locks available */
- gf_error_to_errno_array[GF_ERROR_CODE_NOLCK] = ENOLCK;
- gf_errno_to_error_array[ENOLCK] = GF_ERROR_CODE_NOLCK;
-
- /* ENOSYS 78 / * Function not implemented */
- gf_error_to_errno_array[GF_ERROR_CODE_NOSYS] = ENOSYS;
- gf_errno_to_error_array[ENOSYS] = GF_ERROR_CODE_NOSYS;
-
- /* EFTYPE 79 / * Inappropriate file type or format */
- gf_error_to_errno_array[GF_ERROR_CODE_FTYPE] = EFTYPE;
- gf_errno_to_error_array[EFTYPE] = GF_ERROR_CODE_FTYPE;
-
- /* EAUTH 80 / * Authentication error */
- gf_error_to_errno_array[GF_ERROR_CODE_AUTH] = EAUTH;
- gf_errno_to_error_array[EAUTH] = GF_ERROR_CODE_AUTH;
+ /* EDEADLK 11 / * Resource deadlock would occur */
+ gf_error_to_errno_array[GF_ERROR_CODE_DEADLK] = EDEADLK;
+ gf_errno_to_error_array[EDEADLK] = GF_ERROR_CODE_DEADLK;
+
+ /* EAGAIN 35 / * Try Again */
+ gf_error_to_errno_array[GF_ERROR_CODE_AGAIN] = EAGAIN;
+ gf_errno_to_error_array[EAGAIN] = GF_ERROR_CODE_AGAIN;
+
+ /* EINPROGRESS 36 / * Operation now in progress */
+ gf_error_to_errno_array[GF_ERROR_CODE_INPROGRESS] = EINPROGRESS;
+ gf_errno_to_error_array[EINPROGRESS] = GF_ERROR_CODE_INPROGRESS;
+
+ /* EALREADY 37 / * Operation already in progress */
+ gf_error_to_errno_array[GF_ERROR_CODE_ALREADY] = EALREADY;
+ gf_errno_to_error_array[EALREADY] = GF_ERROR_CODE_ALREADY;
+
+ /* ENOTSOCK 38 / * Socket operation on non-socket */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOTSOCK] = ENOTSOCK;
+ gf_errno_to_error_array[ENOTSOCK] = GF_ERROR_CODE_NOTSOCK;
+
+ /* EDESTADDRREQ 39 / * Destination address required */
+ gf_error_to_errno_array[GF_ERROR_CODE_DESTADDRREQ] = EDESTADDRREQ;
+ gf_errno_to_error_array[EDESTADDRREQ] = GF_ERROR_CODE_DESTADDRREQ;
+
+ /* EMSGSIZE 40 / * Message too long */
+ gf_error_to_errno_array[GF_ERROR_CODE_MSGSIZE] = EMSGSIZE;
+ gf_errno_to_error_array[EMSGSIZE] = GF_ERROR_CODE_MSGSIZE;
+
+ /* EPROTOTYPE 41 / * Protocol wrong type for socket */
+ gf_error_to_errno_array[GF_ERROR_CODE_PROTOTYPE] = EPROTOTYPE;
+ gf_errno_to_error_array[EPROTOTYPE] = GF_ERROR_CODE_PROTOTYPE;
+
+ /* ENOPROTOOPT 42 / * Protocol not available */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOPROTOOPT] = ENOPROTOOPT;
+ gf_errno_to_error_array[ENOPROTOOPT] = GF_ERROR_CODE_NOPROTOOPT;
+
+ /* EPROTONOSUPPORT 43 / * Protocol not supported */
+ gf_error_to_errno_array[GF_ERROR_CODE_PROTONOSUPPORT] = EPROTONOSUPPORT;
+ gf_errno_to_error_array[EPROTONOSUPPORT] = GF_ERROR_CODE_PROTONOSUPPORT;
+
+ /* ESOCKTNOSUPPORT 44 / * Socket type not supported */
+ gf_error_to_errno_array[GF_ERROR_CODE_SOCKTNOSUPPORT] = ESOCKTNOSUPPORT;
+ gf_errno_to_error_array[ESOCKTNOSUPPORT] = GF_ERROR_CODE_SOCKTNOSUPPORT;
+
+ /* EOPNOTSUPP 45 / * Operation not supported */
+ gf_error_to_errno_array[GF_ERROR_CODE_OPNOTSUPP] = EOPNOTSUPP;
+ gf_errno_to_error_array[EOPNOTSUPP] = GF_ERROR_CODE_OPNOTSUPP;
+
+ /* EPFNOSUPPORT 46 / * Protocol family not supported */
+ gf_error_to_errno_array[GF_ERROR_CODE_PFNOSUPPORT] = EPFNOSUPPORT;
+ gf_errno_to_error_array[EPFNOSUPPORT] = GF_ERROR_CODE_PFNOSUPPORT;
+
+ /* EAFNOSUPPORT 47 / * Address family not supported by protocol family */
+ gf_error_to_errno_array[GF_ERROR_CODE_AFNOSUPPORT] = EAFNOSUPPORT;
+ gf_errno_to_error_array[EAFNOSUPPORT] = GF_ERROR_CODE_AFNOSUPPORT;
+
+ /* EADDRINUSE 48 / * Address already in use */
+ gf_error_to_errno_array[GF_ERROR_CODE_ADDRINUSE] = EADDRINUSE;
+ gf_errno_to_error_array[EADDRINUSE] = GF_ERROR_CODE_ADDRINUSE;
+
+ /* EADDRNOTAVAIL 49 / * Can't assign requested address */
+ gf_error_to_errno_array[GF_ERROR_CODE_ADDRNOTAVAIL] = EADDRNOTAVAIL;
+ gf_errno_to_error_array[EADDRNOTAVAIL] = GF_ERROR_CODE_ADDRNOTAVAIL;
+
+ /* ENETDOWN 50 / * Network is down */
+ gf_error_to_errno_array[GF_ERROR_CODE_NETDOWN] = ENETDOWN;
+ gf_errno_to_error_array[ENETDOWN] = GF_ERROR_CODE_NETDOWN;
+
+ /* ENETUNREACH 51 / * Network is unreachable */
+ gf_error_to_errno_array[GF_ERROR_CODE_NETUNREACH] = ENETUNREACH;
+ gf_errno_to_error_array[ENETUNREACH] = GF_ERROR_CODE_NETUNREACH;
+
+ /* ENETRESET 52 / * Network dropped connection on reset */
+ gf_error_to_errno_array[GF_ERROR_CODE_NETRESET] = ENETRESET;
+ gf_errno_to_error_array[ENETRESET] = GF_ERROR_CODE_NETRESET;
+
+ /* ECONNABORTED 53 / * Software caused connection abort */
+ gf_error_to_errno_array[GF_ERROR_CODE_CONNABORTED] = ECONNABORTED;
+ gf_errno_to_error_array[ECONNABORTED] = GF_ERROR_CODE_CONNABORTED;
+
+ /* ECONNRESET 54 / * Connection reset by peer */
+ gf_error_to_errno_array[GF_ERROR_CODE_CONNRESET] = ECONNRESET;
+ gf_errno_to_error_array[ECONNRESET] = GF_ERROR_CODE_CONNRESET;
+
+ /* ENOBUFS 55 / * No buffer space available */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOBUFS] = ENOBUFS;
+ gf_errno_to_error_array[ENOBUFS] = GF_ERROR_CODE_NOBUFS;
+
+ /* EISCONN 56 / * Socket is already connected */
+ gf_error_to_errno_array[GF_ERROR_CODE_ISCONN] = EISCONN;
+ gf_errno_to_error_array[EISCONN] = GF_ERROR_CODE_ISCONN;
+
+ /* ENOTCONN 57 / * Socket is not connected */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOTCONN] = ENOTCONN;
+ gf_errno_to_error_array[ENOTCONN] = GF_ERROR_CODE_NOTCONN;
+
+ /* ESHUTDOWN 58 / * Can't send after socket shutdown */
+ gf_error_to_errno_array[GF_ERROR_CODE_SHUTDOWN] = ESHUTDOWN;
+ gf_errno_to_error_array[ESHUTDOWN] = GF_ERROR_CODE_SHUTDOWN;
+
+ /* ETOOMANYREFS 59 / * Too many references: can't splice */
+ gf_error_to_errno_array[GF_ERROR_CODE_TOOMANYREFS] = ETOOMANYREFS;
+ gf_errno_to_error_array[ETOOMANYREFS] = GF_ERROR_CODE_TOOMANYREFS;
+
+ /* ETIMEDOUT 60 / * Operation timed out */
+ gf_error_to_errno_array[GF_ERROR_CODE_TIMEDOUT] = ETIMEDOUT;
+ gf_errno_to_error_array[ETIMEDOUT] = GF_ERROR_CODE_TIMEDOUT;
+
+ /* ECONNREFUSED 61 / * Connection refused */
+ gf_error_to_errno_array[GF_ERROR_CODE_CONNREFUSED] = ECONNREFUSED;
+ gf_errno_to_error_array[ECONNREFUSED] = GF_ERROR_CODE_CONNREFUSED;
+
+ /* ELOOP 62 / * Too many levels of symbolic links */
+ gf_error_to_errno_array[GF_ERROR_CODE_LOOP] = ELOOP;
+ gf_errno_to_error_array[ELOOP] = GF_ERROR_CODE_LOOP;
+
+ /* ENAMETOOLONG 63 / * File name too long */
+ gf_error_to_errno_array[GF_ERROR_CODE_NAMETOOLONG] = ENAMETOOLONG;
+ gf_errno_to_error_array[ENAMETOOLONG] = GF_ERROR_CODE_NAMETOOLONG;
+
+ /* EHOSTDOWN 64 / * Host is down */
+ gf_error_to_errno_array[GF_ERROR_CODE_HOSTDOWN] = EHOSTDOWN;
+ gf_errno_to_error_array[EHOSTDOWN] = GF_ERROR_CODE_HOSTDOWN;
+
+ /* EHOSTUNREACH 65 / * No route to host */
+ gf_error_to_errno_array[GF_ERROR_CODE_HOSTUNREACH] = EHOSTUNREACH;
+ gf_errno_to_error_array[EHOSTUNREACH] = GF_ERROR_CODE_HOSTUNREACH;
+
+ /* ENOTEMPTY 66 / * Directory not empty */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOTEMPTY] = ENOTEMPTY;
+ gf_errno_to_error_array[ENOTEMPTY] = GF_ERROR_CODE_NOTEMPTY;
+
+ /* EPROCLIM 67 / * Too many processes */
+ gf_error_to_errno_array[GF_ERROR_CODE_PROCLIM] = EPROCLIM;
+ gf_errno_to_error_array[EPROCLIM] = GF_ERROR_CODE_PROCLIM;
+
+ /* EUSERS 68 / * Too many users */
+ gf_error_to_errno_array[GF_ERROR_CODE_USERS] = EUSERS;
+ gf_errno_to_error_array[EUSERS] = GF_ERROR_CODE_USERS;
+
+ /* EDQUOT 69 / * Disc quota exceeded */
+ gf_error_to_errno_array[GF_ERROR_CODE_DQUOT] = EDQUOT;
+ gf_errno_to_error_array[EDQUOT] = GF_ERROR_CODE_DQUOT;
+
+ /* ESTALE 70 / * Stale NFS file handle */
+ gf_error_to_errno_array[GF_ERROR_CODE_STALE] = ESTALE;
+ gf_errno_to_error_array[ESTALE] = GF_ERROR_CODE_STALE;
+
+ /* EREMOTE 71 / * Too many levels of remote in path */
+ gf_error_to_errno_array[GF_ERROR_CODE_REMOTE] = EREMOTE;
+ gf_errno_to_error_array[EREMOTE] = GF_ERROR_CODE_REMOTE;
+
+ /* EBADRPC 72 / * RPC struct is bad */
+ gf_error_to_errno_array[GF_ERROR_CODE_BADRPC] = EBADRPC;
+ gf_errno_to_error_array[EBADRPC] = GF_ERROR_CODE_BADRPC;
+
+ /* ERPCMISMATCH 73 / * RPC version wrong */
+ gf_error_to_errno_array[GF_ERROR_CODE_RPCMISMATCH] = ERPCMISMATCH;
+ gf_errno_to_error_array[ERPCMISMATCH] = GF_ERROR_CODE_RPCMISMATCH;
+
+ /* EPROGUNAVAIL 74 / * RPC prog. not avail */
+ gf_error_to_errno_array[GF_ERROR_CODE_PROGUNAVAIL] = EPROGUNAVAIL;
+ gf_errno_to_error_array[EPROGUNAVAIL] = GF_ERROR_CODE_PROGUNAVAIL;
+
+ /* EPROGMISMATCH 75 / * Program version wrong */
+ gf_error_to_errno_array[GF_ERROR_CODE_PROGMISMATCH] = EPROGMISMATCH;
+ gf_errno_to_error_array[EPROGMISMATCH] = GF_ERROR_CODE_PROGMISMATCH;
+
+ /* EPROCUNAVAIL 76 / * Bad procedure for program */
+ gf_error_to_errno_array[GF_ERROR_CODE_PROCUNAVAIL] = EPROCUNAVAIL;
+ gf_errno_to_error_array[EPROCUNAVAIL] = GF_ERROR_CODE_PROCUNAVAIL;
+
+ /* ENOLCK 77 / * No locks available */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOLCK] = ENOLCK;
+ gf_errno_to_error_array[ENOLCK] = GF_ERROR_CODE_NOLCK;
- /* ENEEDAUTH 81 / * Need authenticator */
- gf_error_to_errno_array[GF_ERROR_CODE_NEEDAUTH] = ENEEDAUTH;
- gf_errno_to_error_array[ENEEDAUTH] = GF_ERROR_CODE_NEEDAUTH;
+ /* ENOSYS 78 / * Function not implemented */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOSYS] = ENOSYS;
+ gf_errno_to_error_array[ENOSYS] = GF_ERROR_CODE_NOSYS;
+
+ /* EFTYPE 79 / * Inappropriate file type or format */
+ gf_error_to_errno_array[GF_ERROR_CODE_FTYPE] = EFTYPE;
+ gf_errno_to_error_array[EFTYPE] = GF_ERROR_CODE_FTYPE;
+
+ /* EAUTH 80 / * Authentication error */
+ gf_error_to_errno_array[GF_ERROR_CODE_AUTH] = EAUTH;
+ gf_errno_to_error_array[EAUTH] = GF_ERROR_CODE_AUTH;
+
+ /* ENEEDAUTH 81 / * Need authenticator */
+ gf_error_to_errno_array[GF_ERROR_CODE_NEEDAUTH] = ENEEDAUTH;
+ gf_errno_to_error_array[ENEEDAUTH] = GF_ERROR_CODE_NEEDAUTH;
/* Intelligent device errors */
-/* EPWROFF 82 / * Device power is off */
- gf_error_to_errno_array[GF_ERROR_CODE_PWROFF] = EPWROFF;
- gf_errno_to_error_array[EPWROFF] = GF_ERROR_CODE_PWROFF;
-/* EDEVERR 83 / * Device error, e.g. paper out */
- gf_error_to_errno_array[GF_ERROR_CODE_DEVERR] = EDEVERR;
- gf_errno_to_error_array[EDEVERR] = GF_ERROR_CODE_DEVERR;
-
- /* EOVERFLOW 84 / * Value too large to be stored in data type */
- gf_error_to_errno_array[GF_ERROR_CODE_OVERFLOW] = EOVERFLOW;
- gf_errno_to_error_array[EOVERFLOW] = GF_ERROR_CODE_OVERFLOW;
+/* EPWROFF 82 / * Device power is off */
+ gf_error_to_errno_array[GF_ERROR_CODE_PWROFF] = EPWROFF;
+ gf_errno_to_error_array[EPWROFF] = GF_ERROR_CODE_PWROFF;
+/* EDEVERR 83 / * Device error, e.g. paper out */
+ gf_error_to_errno_array[GF_ERROR_CODE_DEVERR] = EDEVERR;
+ gf_errno_to_error_array[EDEVERR] = GF_ERROR_CODE_DEVERR;
+
+ /* EOVERFLOW 84 / * Value too large to be stored in data type */
+ gf_error_to_errno_array[GF_ERROR_CODE_OVERFLOW] = EOVERFLOW;
+ gf_errno_to_error_array[EOVERFLOW] = GF_ERROR_CODE_OVERFLOW;
/* Program loading errors */
-/* EBADEXEC 85 / * Bad executable */
- gf_error_to_errno_array[GF_ERROR_CODE_BADEXEC] = EBADEXEC;
- gf_errno_to_error_array[EBADEXEC] = GF_ERROR_CODE_BADEXEC;
+/* EBADEXEC 85 / * Bad executable */
+ gf_error_to_errno_array[GF_ERROR_CODE_BADEXEC] = EBADEXEC;
+ gf_errno_to_error_array[EBADEXEC] = GF_ERROR_CODE_BADEXEC;
-/* EBADARCH 86 / * Bad CPU type in executable */
- gf_error_to_errno_array[GF_ERROR_CODE_BADARCH] = EBADARCH;
- gf_errno_to_error_array[EBADARCH] = GF_ERROR_CODE_BADARCH;
+/* EBADARCH 86 / * Bad CPU type in executable */
+ gf_error_to_errno_array[GF_ERROR_CODE_BADARCH] = EBADARCH;
+ gf_errno_to_error_array[EBADARCH] = GF_ERROR_CODE_BADARCH;
-/* ESHLIBVERS 87 / * Shared library version mismatch */
- gf_error_to_errno_array[GF_ERROR_CODE_SHLIBVERS] = ESHLIBVERS;
- gf_errno_to_error_array[ESHLIBVERS] = GF_ERROR_CODE_SHLIBVERS;
+/* ESHLIBVERS 87 / * Shared library version mismatch */
+ gf_error_to_errno_array[GF_ERROR_CODE_SHLIBVERS] = ESHLIBVERS;
+ gf_errno_to_error_array[ESHLIBVERS] = GF_ERROR_CODE_SHLIBVERS;
-/* EBADMACHO 88 / * Malformed Macho file */
- gf_error_to_errno_array[GF_ERROR_CODE_BADMACHO] = EBADMACHO;
- gf_errno_to_error_array[EBADMACHO] = GF_ERROR_CODE_BADMACHO;
+/* EBADMACHO 88 / * Malformed Macho file */
+ gf_error_to_errno_array[GF_ERROR_CODE_BADMACHO] = EBADMACHO;
+ gf_errno_to_error_array[EBADMACHO] = GF_ERROR_CODE_BADMACHO;
#if 0
- /* EDOOFUS 88 / * Programming error */
- gf_error_to_errno_array[GF_ERROR_CODE_DOOFUS] = EDOOFUS;
- gf_errno_to_error_array[EDOOFUS] = GF_ERROR_CODE_DOOFUS;
+ /* EDOOFUS 88 / * Programming error */
+ gf_error_to_errno_array[GF_ERROR_CODE_DOOFUS] = EDOOFUS;
+ gf_errno_to_error_array[EDOOFUS] = GF_ERROR_CODE_DOOFUS;
#endif
- /* ECANCELED 89 / * Operation canceled */
- gf_error_to_errno_array[GF_ERROR_CODE_CANCELED] = ECANCELED;
- gf_errno_to_error_array[ECANCELED] = GF_ERROR_CODE_CANCELED;
+ /* ECANCELED 89 / * Operation canceled */
+ gf_error_to_errno_array[GF_ERROR_CODE_CANCELED] = ECANCELED;
+ gf_errno_to_error_array[ECANCELED] = GF_ERROR_CODE_CANCELED;
- /* EIDRM 90 / * Identifier removed */
- gf_error_to_errno_array[GF_ERROR_CODE_IDRM] = EIDRM;
- gf_errno_to_error_array[EIDRM] = GF_ERROR_CODE_IDRM;
- /* ENOMSG 91 / * No message of desired type */
- gf_error_to_errno_array[GF_ERROR_CODE_NOMSG] = ENOMSG;
- gf_errno_to_error_array[ENOMSG] = GF_ERROR_CODE_NOMSG;
+ /* EIDRM 90 / * Identifier removed */
+ gf_error_to_errno_array[GF_ERROR_CODE_IDRM] = EIDRM;
+ gf_errno_to_error_array[EIDRM] = GF_ERROR_CODE_IDRM;
+ /* ENOMSG 91 / * No message of desired type */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOMSG] = ENOMSG;
+ gf_errno_to_error_array[ENOMSG] = GF_ERROR_CODE_NOMSG;
- /* EILSEQ 92 / * Illegal byte sequence */
- gf_error_to_errno_array[GF_ERROR_CODE_ILSEQ] = EILSEQ;
- gf_errno_to_error_array[EILSEQ] = GF_ERROR_CODE_ILSEQ;
+ /* EILSEQ 92 / * Illegal byte sequence */
+ gf_error_to_errno_array[GF_ERROR_CODE_ILSEQ] = EILSEQ;
+ gf_errno_to_error_array[EILSEQ] = GF_ERROR_CODE_ILSEQ;
- /* ENOATTR 93 / * Attribute not found */
- gf_error_to_errno_array[GF_ERROR_CODE_NOATTR] = ENOATTR;
- gf_errno_to_error_array[ENOATTR] = GF_ERROR_CODE_NOATTR;
+ /* ENOATTR 93 / * Attribute not found */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOATTR] = ENOATTR;
+ gf_errno_to_error_array[ENOATTR] = GF_ERROR_CODE_NOATTR;
- /* EBADMSG 94 / * Bad message */
- gf_error_to_errno_array[GF_ERROR_CODE_BADMSG] = EBADMSG;
- gf_errno_to_error_array[EBADMSG] = GF_ERROR_CODE_BADMSG;
+ /* EBADMSG 94 / * Bad message */
+ gf_error_to_errno_array[GF_ERROR_CODE_BADMSG] = EBADMSG;
+ gf_errno_to_error_array[EBADMSG] = GF_ERROR_CODE_BADMSG;
- /* EMULTIHOP 95 / * Reserved */
- gf_error_to_errno_array[GF_ERROR_CODE_MULTIHOP] = EMULTIHOP;
- gf_errno_to_error_array[EMULTIHOP] = GF_ERROR_CODE_MULTIHOP;
+ /* EMULTIHOP 95 / * Reserved */
+ gf_error_to_errno_array[GF_ERROR_CODE_MULTIHOP] = EMULTIHOP;
+ gf_errno_to_error_array[EMULTIHOP] = GF_ERROR_CODE_MULTIHOP;
- /* ENODATA 96 / * No message available on STREAM */
- gf_error_to_errno_array[GF_ERROR_CODE_NEEDAUTH] = ENEEDAUTH;
- gf_errno_to_error_array[ENEEDAUTH] = GF_ERROR_CODE_NEEDAUTH;
+ /* ENODATA 96 / * No message available on STREAM */
+ gf_error_to_errno_array[GF_ERROR_CODE_NEEDAUTH] = ENEEDAUTH;
+ gf_errno_to_error_array[ENEEDAUTH] = GF_ERROR_CODE_NEEDAUTH;
- /* ENOLINK 97 / * Reserved */
- gf_error_to_errno_array[GF_ERROR_CODE_NOLINK] = ENOLINK;
- gf_errno_to_error_array[ENOLINK] = GF_ERROR_CODE_NOLINK;
+ /* ENOLINK 97 / * Reserved */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOLINK] = ENOLINK;
+ gf_errno_to_error_array[ENOLINK] = GF_ERROR_CODE_NOLINK;
- /* ENOSR 98 / * No STREAM resources */
- gf_error_to_errno_array[GF_ERROR_CODE_NOSR] = ENOSR;
- gf_errno_to_error_array[ENOSR] = GF_ERROR_CODE_NOSR;
+ /* ENOSR 98 / * No STREAM resources */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOSR] = ENOSR;
+ gf_errno_to_error_array[ENOSR] = GF_ERROR_CODE_NOSR;
- /* ENOSTR 99 / * Not a STREAM */
- gf_error_to_errno_array[GF_ERROR_CODE_NOSTR] = ENOSTR;
- gf_errno_to_error_array[ENOSTR] = GF_ERROR_CODE_NOSTR;
+ /* ENOSTR 99 / * Not a STREAM */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOSTR] = ENOSTR;
+ gf_errno_to_error_array[ENOSTR] = GF_ERROR_CODE_NOSTR;
-/* EPROTO 100 / * Protocol error */
- gf_error_to_errno_array[GF_ERROR_CODE_PROTO] = EPROTO;
- gf_errno_to_error_array[EPROTO] = GF_ERROR_CODE_PROTO;
-/* ETIME 101 / * STREAM ioctl timeout */
- gf_error_to_errno_array[GF_ERROR_CODE_TIME] = ETIME;
- gf_errno_to_error_array[ETIME] = GF_ERROR_CODE_TIME;
+/* EPROTO 100 / * Protocol error */
+ gf_error_to_errno_array[GF_ERROR_CODE_PROTO] = EPROTO;
+ gf_errno_to_error_array[EPROTO] = GF_ERROR_CODE_PROTO;
+/* ETIME 101 / * STREAM ioctl timeout */
+ gf_error_to_errno_array[GF_ERROR_CODE_TIME] = ETIME;
+ gf_errno_to_error_array[ETIME] = GF_ERROR_CODE_TIME;
/* This value is only discrete when compiling __DARWIN_UNIX03, or KERNEL */
-/* EOPNOTSUPP 102 / * Operation not supported on socket */
- gf_error_to_errno_array[GF_ERROR_CODE_OPNOTSUPP] = EOPNOTSUPP;
- gf_errno_to_error_array[EOPNOTSUPP] = GF_ERROR_CODE_OPNOTSUPP;
+/* EOPNOTSUPP 102 / * Operation not supported on socket */
+ gf_error_to_errno_array[GF_ERROR_CODE_OPNOTSUPP] = EOPNOTSUPP;
+ gf_errno_to_error_array[EOPNOTSUPP] = GF_ERROR_CODE_OPNOTSUPP;
-/* ENOPOLICY 103 / * No such policy registered */
- gf_error_to_errno_array[GF_ERROR_CODE_NOPOLICY] = ENOPOLICY;
- gf_errno_to_error_array[ENOPOLICY] = GF_ERROR_CODE_NOPOLICY;
+/* ENOPOLICY 103 / * No such policy registered */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOPOLICY] = ENOPOLICY;
+ gf_errno_to_error_array[ENOPOLICY] = GF_ERROR_CODE_NOPOLICY;
- return ;
+ return ;
}
#endif /* GF_DARWIN_HOST_OS */
#ifdef GF_BSD_HOST_OS
-static void
+static void
init_compat_errno_arrays ()
{
- /* Quite a bit of things changed in FreeBSD - current */
-
- /* EAGAIN 35 / * Try Again */
- gf_error_to_errno_array[GF_ERROR_CODE_AGAIN] = EAGAIN;
- gf_errno_to_error_array[EAGAIN] = GF_ERROR_CODE_AGAIN;
-
- /* EDEADLK 11 / * Resource deadlock would occur */
- gf_error_to_errno_array[GF_ERROR_CODE_DEADLK] = EDEADLK;
- gf_errno_to_error_array[EDEADLK] = GF_ERROR_CODE_DEADLK;
-
- /* EINPROGRESS 36 / * Operation now in progress */
- gf_error_to_errno_array[GF_ERROR_CODE_INPROGRESS] = EINPROGRESS;
- gf_errno_to_error_array[EINPROGRESS] = GF_ERROR_CODE_INPROGRESS;
-
- /* EALREADY 37 / * Operation already in progress */
- gf_error_to_errno_array[GF_ERROR_CODE_ALREADY] = EALREADY;
- gf_errno_to_error_array[EALREADY] = GF_ERROR_CODE_ALREADY;
-
- /* ENOTSOCK 38 / * Socket operation on non-socket */
- gf_error_to_errno_array[GF_ERROR_CODE_NOTSOCK] = ENOTSOCK;
- gf_errno_to_error_array[ENOTSOCK] = GF_ERROR_CODE_NOTSOCK;
-
- /* EDESTADDRREQ 39 / * Destination address required */
- gf_error_to_errno_array[GF_ERROR_CODE_DESTADDRREQ] = EDESTADDRREQ;
- gf_errno_to_error_array[EDESTADDRREQ] = GF_ERROR_CODE_DESTADDRREQ;
-
- /* EMSGSIZE 40 / * Message too long */
- gf_error_to_errno_array[GF_ERROR_CODE_MSGSIZE] = EMSGSIZE;
- gf_errno_to_error_array[EMSGSIZE] = GF_ERROR_CODE_MSGSIZE;
-
- /* EPROTOTYPE 41 / * Protocol wrong type for socket */
- gf_error_to_errno_array[GF_ERROR_CODE_PROTOTYPE] = EPROTOTYPE;
- gf_errno_to_error_array[EPROTOTYPE] = GF_ERROR_CODE_PROTOTYPE;
-
- /* ENOPROTOOPT 42 / * Protocol not available */
- gf_error_to_errno_array[GF_ERROR_CODE_NOPROTOOPT] = ENOPROTOOPT;
- gf_errno_to_error_array[ENOPROTOOPT] = GF_ERROR_CODE_NOPROTOOPT;
-
- /* EPROTONOSUPPORT 43 / * Protocol not supported */
- gf_error_to_errno_array[GF_ERROR_CODE_PROTONOSUPPORT] = EPROTONOSUPPORT;
- gf_errno_to_error_array[EPROTONOSUPPORT] = GF_ERROR_CODE_PROTONOSUPPORT;
-
- /* ESOCKTNOSUPPORT 44 / * Socket type not supported */
- gf_error_to_errno_array[GF_ERROR_CODE_SOCKTNOSUPPORT] = ESOCKTNOSUPPORT;
- gf_errno_to_error_array[ESOCKTNOSUPPORT] = GF_ERROR_CODE_SOCKTNOSUPPORT;
-
- /* EOPNOTSUPP 45 / * Operation not supported */
- gf_error_to_errno_array[GF_ERROR_CODE_OPNOTSUPP] = EOPNOTSUPP;
- gf_errno_to_error_array[EOPNOTSUPP] = GF_ERROR_CODE_OPNOTSUPP;
-
- /* EPFNOSUPPORT 46 / * Protocol family not supported */
- gf_error_to_errno_array[GF_ERROR_CODE_PFNOSUPPORT] = EPFNOSUPPORT;
- gf_errno_to_error_array[EPFNOSUPPORT] = GF_ERROR_CODE_PFNOSUPPORT;
-
- /* EAFNOSUPPORT 47 / * Address family not supported by protocol family */
- gf_error_to_errno_array[GF_ERROR_CODE_AFNOSUPPORT] = EAFNOSUPPORT;
- gf_errno_to_error_array[EAFNOSUPPORT] = GF_ERROR_CODE_AFNOSUPPORT;
-
- /* EADDRINUSE 48 / * Address already in use */
- gf_error_to_errno_array[GF_ERROR_CODE_ADDRINUSE] = EADDRINUSE;
- gf_errno_to_error_array[EADDRINUSE] = GF_ERROR_CODE_ADDRINUSE;
-
- /* EADDRNOTAVAIL 49 / * Can't assign requested address */
- gf_error_to_errno_array[GF_ERROR_CODE_ADDRNOTAVAIL] = EADDRNOTAVAIL;
- gf_errno_to_error_array[EADDRNOTAVAIL] = GF_ERROR_CODE_ADDRNOTAVAIL;
-
- /* ENETDOWN 50 / * Network is down */
- gf_error_to_errno_array[GF_ERROR_CODE_NETDOWN] = ENETDOWN;
- gf_errno_to_error_array[ENETDOWN] = GF_ERROR_CODE_NETDOWN;
-
- /* ENETUNREACH 51 / * Network is unreachable */
- gf_error_to_errno_array[GF_ERROR_CODE_NETUNREACH] = ENETUNREACH;
- gf_errno_to_error_array[ENETUNREACH] = GF_ERROR_CODE_NETUNREACH;
-
- /* ENETRESET 52 / * Network dropped connection on reset */
- gf_error_to_errno_array[GF_ERROR_CODE_NETRESET] = ENETRESET;
- gf_errno_to_error_array[ENETRESET] = GF_ERROR_CODE_NETRESET;
-
- /* ECONNABORTED 53 / * Software caused connection abort */
- gf_error_to_errno_array[GF_ERROR_CODE_CONNABORTED] = ECONNABORTED;
- gf_errno_to_error_array[ECONNABORTED] = GF_ERROR_CODE_CONNABORTED;
-
- /* ECONNRESET 54 / * Connection reset by peer */
- gf_error_to_errno_array[GF_ERROR_CODE_CONNRESET] = ECONNRESET;
- gf_errno_to_error_array[ECONNRESET] = GF_ERROR_CODE_CONNRESET;
-
- /* ENOBUFS 55 / * No buffer space available */
- gf_error_to_errno_array[GF_ERROR_CODE_NOBUFS] = ENOBUFS;
- gf_errno_to_error_array[ENOBUFS] = GF_ERROR_CODE_NOBUFS;
-
- /* EISCONN 56 / * Socket is already connected */
- gf_error_to_errno_array[GF_ERROR_CODE_ISCONN] = EISCONN;
- gf_errno_to_error_array[EISCONN] = GF_ERROR_CODE_ISCONN;
-
- /* ENOTCONN 57 / * Socket is not connected */
- gf_error_to_errno_array[GF_ERROR_CODE_NOTCONN] = ENOTCONN;
- gf_errno_to_error_array[ENOTCONN] = GF_ERROR_CODE_NOTCONN;
-
- /* ESHUTDOWN 58 / * Can't send after socket shutdown */
- gf_error_to_errno_array[GF_ERROR_CODE_SHUTDOWN] = ESHUTDOWN;
- gf_errno_to_error_array[ESHUTDOWN] = GF_ERROR_CODE_SHUTDOWN;
-
- /* ETOOMANYREFS 59 / * Too many references: can't splice */
- gf_error_to_errno_array[GF_ERROR_CODE_TOOMANYREFS] = ETOOMANYREFS;
- gf_errno_to_error_array[ETOOMANYREFS] = GF_ERROR_CODE_TOOMANYREFS;
-
- /* ETIMEDOUT 60 / * Operation timed out */
- gf_error_to_errno_array[GF_ERROR_CODE_TIMEDOUT] = ETIMEDOUT;
- gf_errno_to_error_array[ETIMEDOUT] = GF_ERROR_CODE_TIMEDOUT;
-
- /* ECONNREFUSED 61 / * Connection refused */
- gf_error_to_errno_array[GF_ERROR_CODE_CONNREFUSED] = ECONNREFUSED;
- gf_errno_to_error_array[ECONNREFUSED] = GF_ERROR_CODE_CONNREFUSED;
-
- /* ELOOP 62 / * Too many levels of symbolic links */
- gf_error_to_errno_array[GF_ERROR_CODE_LOOP] = ELOOP;
- gf_errno_to_error_array[ELOOP] = GF_ERROR_CODE_LOOP;
-
- /* ENAMETOOLONG 63 / * File name too long */
- gf_error_to_errno_array[GF_ERROR_CODE_NAMETOOLONG] = ENAMETOOLONG;
- gf_errno_to_error_array[ENAMETOOLONG] = GF_ERROR_CODE_NAMETOOLONG;
-
- /* EHOSTDOWN 64 / * Host is down */
- gf_error_to_errno_array[GF_ERROR_CODE_HOSTDOWN] = EHOSTDOWN;
- gf_errno_to_error_array[EHOSTDOWN] = GF_ERROR_CODE_HOSTDOWN;
-
- /* EHOSTUNREACH 65 / * No route to host */
- gf_error_to_errno_array[GF_ERROR_CODE_HOSTUNREACH] = EHOSTUNREACH;
- gf_errno_to_error_array[EHOSTUNREACH] = GF_ERROR_CODE_HOSTUNREACH;
-
- /* ENOTEMPTY 66 / * Directory not empty */
- gf_error_to_errno_array[GF_ERROR_CODE_NOTEMPTY] = ENOTEMPTY;
- gf_errno_to_error_array[ENOTEMPTY] = GF_ERROR_CODE_NOTEMPTY;
-
- /* EPROCLIM 67 / * Too many processes */
- gf_error_to_errno_array[GF_ERROR_CODE_PROCLIM] = EPROCLIM;
- gf_errno_to_error_array[EPROCLIM] = GF_ERROR_CODE_PROCLIM;
-
- /* EUSERS 68 / * Too many users */
- gf_error_to_errno_array[GF_ERROR_CODE_USERS] = EUSERS;
- gf_errno_to_error_array[EUSERS] = GF_ERROR_CODE_USERS;
-
- /* EDQUOT 69 / * Disc quota exceeded */
- gf_error_to_errno_array[GF_ERROR_CODE_DQUOT] = EDQUOT;
- gf_errno_to_error_array[EDQUOT] = GF_ERROR_CODE_DQUOT;
+ /* Quite a bit of things changed in FreeBSD - current */
+
+ /* EAGAIN 35 / * Try Again */
+ gf_error_to_errno_array[GF_ERROR_CODE_AGAIN] = EAGAIN;
+ gf_errno_to_error_array[EAGAIN] = GF_ERROR_CODE_AGAIN;
+
+ /* EDEADLK 11 / * Resource deadlock would occur */
+ gf_error_to_errno_array[GF_ERROR_CODE_DEADLK] = EDEADLK;
+ gf_errno_to_error_array[EDEADLK] = GF_ERROR_CODE_DEADLK;
+
+ /* EINPROGRESS 36 / * Operation now in progress */
+ gf_error_to_errno_array[GF_ERROR_CODE_INPROGRESS] = EINPROGRESS;
+ gf_errno_to_error_array[EINPROGRESS] = GF_ERROR_CODE_INPROGRESS;
+
+ /* EALREADY 37 / * Operation already in progress */
+ gf_error_to_errno_array[GF_ERROR_CODE_ALREADY] = EALREADY;
+ gf_errno_to_error_array[EALREADY] = GF_ERROR_CODE_ALREADY;
+
+ /* ENOTSOCK 38 / * Socket operation on non-socket */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOTSOCK] = ENOTSOCK;
+ gf_errno_to_error_array[ENOTSOCK] = GF_ERROR_CODE_NOTSOCK;
+
+ /* EDESTADDRREQ 39 / * Destination address required */
+ gf_error_to_errno_array[GF_ERROR_CODE_DESTADDRREQ] = EDESTADDRREQ;
+ gf_errno_to_error_array[EDESTADDRREQ] = GF_ERROR_CODE_DESTADDRREQ;
+
+ /* EMSGSIZE 40 / * Message too long */
+ gf_error_to_errno_array[GF_ERROR_CODE_MSGSIZE] = EMSGSIZE;
+ gf_errno_to_error_array[EMSGSIZE] = GF_ERROR_CODE_MSGSIZE;
+
+ /* EPROTOTYPE 41 / * Protocol wrong type for socket */
+ gf_error_to_errno_array[GF_ERROR_CODE_PROTOTYPE] = EPROTOTYPE;
+ gf_errno_to_error_array[EPROTOTYPE] = GF_ERROR_CODE_PROTOTYPE;
+
+ /* ENOPROTOOPT 42 / * Protocol not available */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOPROTOOPT] = ENOPROTOOPT;
+ gf_errno_to_error_array[ENOPROTOOPT] = GF_ERROR_CODE_NOPROTOOPT;
+
+ /* EPROTONOSUPPORT 43 / * Protocol not supported */
+ gf_error_to_errno_array[GF_ERROR_CODE_PROTONOSUPPORT] = EPROTONOSUPPORT;
+ gf_errno_to_error_array[EPROTONOSUPPORT] = GF_ERROR_CODE_PROTONOSUPPORT;
+
+ /* ESOCKTNOSUPPORT 44 / * Socket type not supported */
+ gf_error_to_errno_array[GF_ERROR_CODE_SOCKTNOSUPPORT] = ESOCKTNOSUPPORT;
+ gf_errno_to_error_array[ESOCKTNOSUPPORT] = GF_ERROR_CODE_SOCKTNOSUPPORT;
+
+ /* EOPNOTSUPP 45 / * Operation not supported */
+ gf_error_to_errno_array[GF_ERROR_CODE_OPNOTSUPP] = EOPNOTSUPP;
+ gf_errno_to_error_array[EOPNOTSUPP] = GF_ERROR_CODE_OPNOTSUPP;
+
+ /* EPFNOSUPPORT 46 / * Protocol family not supported */
+ gf_error_to_errno_array[GF_ERROR_CODE_PFNOSUPPORT] = EPFNOSUPPORT;
+ gf_errno_to_error_array[EPFNOSUPPORT] = GF_ERROR_CODE_PFNOSUPPORT;
+
+ /* EAFNOSUPPORT 47 / * Address family not supported by protocol family */
+ gf_error_to_errno_array[GF_ERROR_CODE_AFNOSUPPORT] = EAFNOSUPPORT;
+ gf_errno_to_error_array[EAFNOSUPPORT] = GF_ERROR_CODE_AFNOSUPPORT;
+
+ /* EADDRINUSE 48 / * Address already in use */
+ gf_error_to_errno_array[GF_ERROR_CODE_ADDRINUSE] = EADDRINUSE;
+ gf_errno_to_error_array[EADDRINUSE] = GF_ERROR_CODE_ADDRINUSE;
+
+ /* EADDRNOTAVAIL 49 / * Can't assign requested address */
+ gf_error_to_errno_array[GF_ERROR_CODE_ADDRNOTAVAIL] = EADDRNOTAVAIL;
+ gf_errno_to_error_array[EADDRNOTAVAIL] = GF_ERROR_CODE_ADDRNOTAVAIL;
+
+ /* ENETDOWN 50 / * Network is down */
+ gf_error_to_errno_array[GF_ERROR_CODE_NETDOWN] = ENETDOWN;
+ gf_errno_to_error_array[ENETDOWN] = GF_ERROR_CODE_NETDOWN;
- /* ESTALE 70 / * Stale NFS file handle */
- gf_error_to_errno_array[GF_ERROR_CODE_STALE] = ESTALE;
- gf_errno_to_error_array[ESTALE] = GF_ERROR_CODE_STALE;
+ /* ENETUNREACH 51 / * Network is unreachable */
+ gf_error_to_errno_array[GF_ERROR_CODE_NETUNREACH] = ENETUNREACH;
+ gf_errno_to_error_array[ENETUNREACH] = GF_ERROR_CODE_NETUNREACH;
- /* EREMOTE 71 / * Too many levels of remote in path */
- gf_error_to_errno_array[GF_ERROR_CODE_REMOTE] = EREMOTE;
- gf_errno_to_error_array[EREMOTE] = GF_ERROR_CODE_REMOTE;
+ /* ENETRESET 52 / * Network dropped connection on reset */
+ gf_error_to_errno_array[GF_ERROR_CODE_NETRESET] = ENETRESET;
+ gf_errno_to_error_array[ENETRESET] = GF_ERROR_CODE_NETRESET;
- /* EBADRPC 72 / * RPC struct is bad */
- gf_error_to_errno_array[GF_ERROR_CODE_BADRPC] = EBADRPC;
- gf_errno_to_error_array[EBADRPC] = GF_ERROR_CODE_BADRPC;
+ /* ECONNABORTED 53 / * Software caused connection abort */
+ gf_error_to_errno_array[GF_ERROR_CODE_CONNABORTED] = ECONNABORTED;
+ gf_errno_to_error_array[ECONNABORTED] = GF_ERROR_CODE_CONNABORTED;
- /* ERPCMISMATCH 73 / * RPC version wrong */
- gf_error_to_errno_array[GF_ERROR_CODE_RPCMISMATCH] = ERPCMISMATCH;
- gf_errno_to_error_array[ERPCMISMATCH] = GF_ERROR_CODE_RPCMISMATCH;
+ /* ECONNRESET 54 / * Connection reset by peer */
+ gf_error_to_errno_array[GF_ERROR_CODE_CONNRESET] = ECONNRESET;
+ gf_errno_to_error_array[ECONNRESET] = GF_ERROR_CODE_CONNRESET;
- /* EPROGUNAVAIL 74 / * RPC prog. not avail */
- gf_error_to_errno_array[GF_ERROR_CODE_PROGUNAVAIL] = EPROGUNAVAIL;
- gf_errno_to_error_array[EPROGUNAVAIL] = GF_ERROR_CODE_PROGUNAVAIL;
+ /* ENOBUFS 55 / * No buffer space available */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOBUFS] = ENOBUFS;
+ gf_errno_to_error_array[ENOBUFS] = GF_ERROR_CODE_NOBUFS;
- /* EPROGMISMATCH 75 / * Program version wrong */
- gf_error_to_errno_array[GF_ERROR_CODE_PROGMISMATCH] = EPROGMISMATCH;
- gf_errno_to_error_array[EPROGMISMATCH] = GF_ERROR_CODE_PROGMISMATCH;
+ /* EISCONN 56 / * Socket is already connected */
+ gf_error_to_errno_array[GF_ERROR_CODE_ISCONN] = EISCONN;
+ gf_errno_to_error_array[EISCONN] = GF_ERROR_CODE_ISCONN;
- /* EPROCUNAVAIL 76 / * Bad procedure for program */
- gf_error_to_errno_array[GF_ERROR_CODE_PROCUNAVAIL] = EPROCUNAVAIL;
- gf_errno_to_error_array[EPROCUNAVAIL] = GF_ERROR_CODE_PROCUNAVAIL;
+ /* ENOTCONN 57 / * Socket is not connected */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOTCONN] = ENOTCONN;
+ gf_errno_to_error_array[ENOTCONN] = GF_ERROR_CODE_NOTCONN;
- /* ENOLCK 77 / * No locks available */
- gf_error_to_errno_array[GF_ERROR_CODE_NOLCK] = ENOLCK;
- gf_errno_to_error_array[ENOLCK] = GF_ERROR_CODE_NOLCK;
+ /* ESHUTDOWN 58 / * Can't send after socket shutdown */
+ gf_error_to_errno_array[GF_ERROR_CODE_SHUTDOWN] = ESHUTDOWN;
+ gf_errno_to_error_array[ESHUTDOWN] = GF_ERROR_CODE_SHUTDOWN;
- /* ENOSYS 78 / * Function not implemented */
- gf_error_to_errno_array[GF_ERROR_CODE_NOSYS] = ENOSYS;
- gf_errno_to_error_array[ENOSYS] = GF_ERROR_CODE_NOSYS;
+ /* ETOOMANYREFS 59 / * Too many references: can't splice */
+ gf_error_to_errno_array[GF_ERROR_CODE_TOOMANYREFS] = ETOOMANYREFS;
+ gf_errno_to_error_array[ETOOMANYREFS] = GF_ERROR_CODE_TOOMANYREFS;
- /* EFTYPE 79 / * Inappropriate file type or format */
- gf_error_to_errno_array[GF_ERROR_CODE_FTYPE] = EFTYPE;
- gf_errno_to_error_array[EFTYPE] = GF_ERROR_CODE_FTYPE;
+ /* ETIMEDOUT 60 / * Operation timed out */
+ gf_error_to_errno_array[GF_ERROR_CODE_TIMEDOUT] = ETIMEDOUT;
+ gf_errno_to_error_array[ETIMEDOUT] = GF_ERROR_CODE_TIMEDOUT;
- /* EAUTH 80 / * Authentication error */
- gf_error_to_errno_array[GF_ERROR_CODE_AUTH] = EAUTH;
- gf_errno_to_error_array[EAUTH] = GF_ERROR_CODE_AUTH;
+ /* ECONNREFUSED 61 / * Connection refused */
+ gf_error_to_errno_array[GF_ERROR_CODE_CONNREFUSED] = ECONNREFUSED;
+ gf_errno_to_error_array[ECONNREFUSED] = GF_ERROR_CODE_CONNREFUSED;
- /* ENEEDAUTH 81 / * Need authenticator */
- gf_error_to_errno_array[GF_ERROR_CODE_NEEDAUTH] = ENEEDAUTH;
- gf_errno_to_error_array[ENEEDAUTH] = GF_ERROR_CODE_NEEDAUTH;
+ /* ELOOP 62 / * Too many levels of symbolic links */
+ gf_error_to_errno_array[GF_ERROR_CODE_LOOP] = ELOOP;
+ gf_errno_to_error_array[ELOOP] = GF_ERROR_CODE_LOOP;
- /* EIDRM 82 / * Identifier removed */
- gf_error_to_errno_array[GF_ERROR_CODE_IDRM] = EIDRM;
- gf_errno_to_error_array[EIDRM] = GF_ERROR_CODE_IDRM;
+ /* ENAMETOOLONG 63 / * File name too long */
+ gf_error_to_errno_array[GF_ERROR_CODE_NAMETOOLONG] = ENAMETOOLONG;
+ gf_errno_to_error_array[ENAMETOOLONG] = GF_ERROR_CODE_NAMETOOLONG;
- /* ENOMSG 83 / * No message of desired type */
- gf_error_to_errno_array[GF_ERROR_CODE_NOMSG] = ENOMSG;
- gf_errno_to_error_array[ENOMSG] = GF_ERROR_CODE_NOMSG;
+ /* EHOSTDOWN 64 / * Host is down */
+ gf_error_to_errno_array[GF_ERROR_CODE_HOSTDOWN] = EHOSTDOWN;
+ gf_errno_to_error_array[EHOSTDOWN] = GF_ERROR_CODE_HOSTDOWN;
- /* EOVERFLOW 84 / * Value too large to be stored in data type */
- gf_error_to_errno_array[GF_ERROR_CODE_OVERFLOW] = EOVERFLOW;
- gf_errno_to_error_array[EOVERFLOW] = GF_ERROR_CODE_OVERFLOW;
+ /* EHOSTUNREACH 65 / * No route to host */
+ gf_error_to_errno_array[GF_ERROR_CODE_HOSTUNREACH] = EHOSTUNREACH;
+ gf_errno_to_error_array[EHOSTUNREACH] = GF_ERROR_CODE_HOSTUNREACH;
- /* ECANCELED 85 / * Operation canceled */
- gf_error_to_errno_array[GF_ERROR_CODE_CANCELED] = ECANCELED;
- gf_errno_to_error_array[ECANCELED] = GF_ERROR_CODE_CANCELED;
+ /* ENOTEMPTY 66 / * Directory not empty */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOTEMPTY] = ENOTEMPTY;
+ gf_errno_to_error_array[ENOTEMPTY] = GF_ERROR_CODE_NOTEMPTY;
- /* EILSEQ 86 / * Illegal byte sequence */
- gf_error_to_errno_array[GF_ERROR_CODE_ILSEQ] = EILSEQ;
- gf_errno_to_error_array[EILSEQ] = GF_ERROR_CODE_ILSEQ;
+ /* EPROCLIM 67 / * Too many processes */
+ gf_error_to_errno_array[GF_ERROR_CODE_PROCLIM] = EPROCLIM;
+ gf_errno_to_error_array[EPROCLIM] = GF_ERROR_CODE_PROCLIM;
- /* ENOATTR 87 / * Attribute not found */
- gf_error_to_errno_array[GF_ERROR_CODE_NOATTR] = ENOATTR;
- gf_errno_to_error_array[ENOATTR] = GF_ERROR_CODE_NOATTR;
-
- /* EDOOFUS 88 / * Programming error */
- gf_error_to_errno_array[GF_ERROR_CODE_DOOFUS] = EDOOFUS;
- gf_errno_to_error_array[EDOOFUS] = GF_ERROR_CODE_DOOFUS;
+ /* EUSERS 68 / * Too many users */
+ gf_error_to_errno_array[GF_ERROR_CODE_USERS] = EUSERS;
+ gf_errno_to_error_array[EUSERS] = GF_ERROR_CODE_USERS;
- /* EBADMSG 89 / * Bad message */
- gf_error_to_errno_array[GF_ERROR_CODE_BADMSG] = EBADMSG;
- gf_errno_to_error_array[EBADMSG] = GF_ERROR_CODE_BADMSG;
+ /* EDQUOT 69 / * Disc quota exceeded */
+ gf_error_to_errno_array[GF_ERROR_CODE_DQUOT] = EDQUOT;
+ gf_errno_to_error_array[EDQUOT] = GF_ERROR_CODE_DQUOT;
- /* EMULTIHOP 90 / * Multihop attempted */
- gf_error_to_errno_array[GF_ERROR_CODE_MULTIHOP] = EMULTIHOP;
- gf_errno_to_error_array[EMULTIHOP] = GF_ERROR_CODE_MULTIHOP;
+ /* ESTALE 70 / * Stale NFS file handle */
+ gf_error_to_errno_array[GF_ERROR_CODE_STALE] = ESTALE;
+ gf_errno_to_error_array[ESTALE] = GF_ERROR_CODE_STALE;
- /* ENOLINK 91 / * Link has been severed */
- gf_error_to_errno_array[GF_ERROR_CODE_NOLINK] = ENOLINK;
- gf_errno_to_error_array[ENOLINK] = GF_ERROR_CODE_NOLINK;
+ /* EREMOTE 71 / * Too many levels of remote in path */
+ gf_error_to_errno_array[GF_ERROR_CODE_REMOTE] = EREMOTE;
+ gf_errno_to_error_array[EREMOTE] = GF_ERROR_CODE_REMOTE;
- /* EPROTO 92 / * Protocol error */
- gf_error_to_errno_array[GF_ERROR_CODE_PROTO] = EPROTO;
- gf_errno_to_error_array[EPROTO] = GF_ERROR_CODE_PROTO;
+ /* EBADRPC 72 / * RPC struct is bad */
+ gf_error_to_errno_array[GF_ERROR_CODE_BADRPC] = EBADRPC;
+ gf_errno_to_error_array[EBADRPC] = GF_ERROR_CODE_BADRPC;
+ /* ERPCMISMATCH 73 / * RPC version wrong */
+ gf_error_to_errno_array[GF_ERROR_CODE_RPCMISMATCH] = ERPCMISMATCH;
+ gf_errno_to_error_array[ERPCMISMATCH] = GF_ERROR_CODE_RPCMISMATCH;
- return ;
+ /* EPROGUNAVAIL 74 / * RPC prog. not avail */
+ gf_error_to_errno_array[GF_ERROR_CODE_PROGUNAVAIL] = EPROGUNAVAIL;
+ gf_errno_to_error_array[EPROGUNAVAIL] = GF_ERROR_CODE_PROGUNAVAIL;
+
+ /* EPROGMISMATCH 75 / * Program version wrong */
+ gf_error_to_errno_array[GF_ERROR_CODE_PROGMISMATCH] = EPROGMISMATCH;
+ gf_errno_to_error_array[EPROGMISMATCH] = GF_ERROR_CODE_PROGMISMATCH;
+
+ /* EPROCUNAVAIL 76 / * Bad procedure for program */
+ gf_error_to_errno_array[GF_ERROR_CODE_PROCUNAVAIL] = EPROCUNAVAIL;
+ gf_errno_to_error_array[EPROCUNAVAIL] = GF_ERROR_CODE_PROCUNAVAIL;
+
+ /* ENOLCK 77 / * No locks available */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOLCK] = ENOLCK;
+ gf_errno_to_error_array[ENOLCK] = GF_ERROR_CODE_NOLCK;
+
+ /* ENOSYS 78 / * Function not implemented */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOSYS] = ENOSYS;
+ gf_errno_to_error_array[ENOSYS] = GF_ERROR_CODE_NOSYS;
+
+ /* EFTYPE 79 / * Inappropriate file type or format */
+ gf_error_to_errno_array[GF_ERROR_CODE_FTYPE] = EFTYPE;
+ gf_errno_to_error_array[EFTYPE] = GF_ERROR_CODE_FTYPE;
+
+ /* EAUTH 80 / * Authentication error */
+ gf_error_to_errno_array[GF_ERROR_CODE_AUTH] = EAUTH;
+ gf_errno_to_error_array[EAUTH] = GF_ERROR_CODE_AUTH;
+
+ /* ENEEDAUTH 81 / * Need authenticator */
+ gf_error_to_errno_array[GF_ERROR_CODE_NEEDAUTH] = ENEEDAUTH;
+ gf_errno_to_error_array[ENEEDAUTH] = GF_ERROR_CODE_NEEDAUTH;
+
+ /* EIDRM 82 / * Identifier removed */
+ gf_error_to_errno_array[GF_ERROR_CODE_IDRM] = EIDRM;
+ gf_errno_to_error_array[EIDRM] = GF_ERROR_CODE_IDRM;
+
+ /* ENOMSG 83 / * No message of desired type */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOMSG] = ENOMSG;
+ gf_errno_to_error_array[ENOMSG] = GF_ERROR_CODE_NOMSG;
+
+ /* EOVERFLOW 84 / * Value too large to be stored in data type */
+ gf_error_to_errno_array[GF_ERROR_CODE_OVERFLOW] = EOVERFLOW;
+ gf_errno_to_error_array[EOVERFLOW] = GF_ERROR_CODE_OVERFLOW;
+
+ /* ECANCELED 85 / * Operation canceled */
+ gf_error_to_errno_array[GF_ERROR_CODE_CANCELED] = ECANCELED;
+ gf_errno_to_error_array[ECANCELED] = GF_ERROR_CODE_CANCELED;
+
+ /* EILSEQ 86 / * Illegal byte sequence */
+ gf_error_to_errno_array[GF_ERROR_CODE_ILSEQ] = EILSEQ;
+ gf_errno_to_error_array[EILSEQ] = GF_ERROR_CODE_ILSEQ;
+
+ /* ENOATTR 87 / * Attribute not found */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOATTR] = ENOATTR;
+ gf_errno_to_error_array[ENOATTR] = GF_ERROR_CODE_NOATTR;
+
+ /* EDOOFUS 88 / * Programming error */
+ gf_error_to_errno_array[GF_ERROR_CODE_DOOFUS] = EDOOFUS;
+ gf_errno_to_error_array[EDOOFUS] = GF_ERROR_CODE_DOOFUS;
+
+ /* EBADMSG 89 / * Bad message */
+ gf_error_to_errno_array[GF_ERROR_CODE_BADMSG] = EBADMSG;
+ gf_errno_to_error_array[EBADMSG] = GF_ERROR_CODE_BADMSG;
+
+ /* EMULTIHOP 90 / * Multihop attempted */
+ gf_error_to_errno_array[GF_ERROR_CODE_MULTIHOP] = EMULTIHOP;
+ gf_errno_to_error_array[EMULTIHOP] = GF_ERROR_CODE_MULTIHOP;
+
+ /* ENOLINK 91 / * Link has been severed */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOLINK] = ENOLINK;
+ gf_errno_to_error_array[ENOLINK] = GF_ERROR_CODE_NOLINK;
+
+ /* EPROTO 92 / * Protocol error */
+ gf_error_to_errno_array[GF_ERROR_CODE_PROTO] = EPROTO;
+ gf_errno_to_error_array[EPROTO] = GF_ERROR_CODE_PROTO;
+
+
+ return ;
}
#endif /* GF_BSD_HOST_OS */
#ifdef GF_LINUX_HOST_OS
-static void
+static void
init_compat_errno_arrays ()
{
- /* Things are fine. Everything should work seemlessly on GNU/Linux machines */
- return ;
+ /* Things are fine. Everything should work seemlessly on GNU/Linux machines */
+ return ;
}
#endif /* GF_LINUX_HOST_OS */
@@ -896,43 +896,42 @@ init_compat_errno_arrays ()
static void
init_errno_arrays ()
{
- int i;
- for (i=0; i < GF_ERROR_CODE_UNKNOWN; i++) {
- gf_errno_to_error_array[i] = i;
- gf_error_to_errno_array[i] = i;
- }
- /* Now change the order if it needs to be. */
- init_compat_errno_arrays();
-
- return;
+ int i;
+ for (i=0; i < GF_ERROR_CODE_UNKNOWN; i++) {
+ gf_errno_to_error_array[i] = i;
+ gf_error_to_errno_array[i] = i;
+ }
+ /* Now change the order if it needs to be. */
+ init_compat_errno_arrays();
+
+ return;
}
-int32_t
+int32_t
gf_errno_to_error (int32_t op_errno)
{
- if (!gf_compat_errno_init_done) {
- init_errno_arrays ();
- gf_compat_errno_init_done = 1;
- }
+ if (!gf_compat_errno_init_done) {
+ init_errno_arrays ();
+ gf_compat_errno_init_done = 1;
+ }
- if ((op_errno > GF_ERROR_CODE_SUCCESS) && (op_errno < GF_ERROR_CODE_UNKNOWN))
- return gf_errno_to_error_array[op_errno];
+ if ((op_errno > GF_ERROR_CODE_SUCCESS) && (op_errno < GF_ERROR_CODE_UNKNOWN))
+ return gf_errno_to_error_array[op_errno];
- return op_errno;
+ return op_errno;
}
-int32_t
+int32_t
gf_error_to_errno (int32_t error)
{
- if (!gf_compat_errno_init_done) {
- init_errno_arrays ();
- gf_compat_errno_init_done = 1;
- }
+ if (!gf_compat_errno_init_done) {
+ init_errno_arrays ();
+ gf_compat_errno_init_done = 1;
+ }
- if ((error > GF_ERROR_CODE_SUCCESS) && (error < GF_ERROR_CODE_UNKNOWN))
- return gf_error_to_errno_array[error];
+ if ((error > GF_ERROR_CODE_SUCCESS) && (error < GF_ERROR_CODE_UNKNOWN))
+ return gf_error_to_errno_array[error];
- return error;
+ return error;
}
-
diff --git a/libglusterfs/src/compat.c b/libglusterfs/src/compat.c
index 914fb200683..a24f3aabd65 100644
--- a/libglusterfs/src/compat.c
+++ b/libglusterfs/src/compat.c
@@ -1,20 +1,20 @@
/*
- Copyright (c) 2006-2010 Gluster, Inc. <http://www.gluster.com>
- This file is part of GlusterFS.
-
- GlusterFS is free software; you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation; either version 3 of the License,
- or (at your option) any later version.
-
- GlusterFS 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
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see
- <http://www.gnu.org/licenses/>.
+ Copyright (c) 2006-2010 Gluster, Inc. <http://www.gluster.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
*/
#ifndef _CONFIG_H
@@ -39,63 +39,63 @@
#include "inode.h"
#ifdef GF_SOLARIS_HOST_OS
-int
-solaris_fsetxattr(int fd,
- const char* key,
- const char *value,
- size_t size,
- int flags)
+int
+solaris_fsetxattr(int fd,
+ const char* key,
+ const char *value,
+ size_t size,
+ int flags)
{
- int attrfd = -1;
- int ret = 0;
-
- attrfd = openat (fd, key, flags|O_CREAT|O_WRONLY|O_XATTR, 0777);
- if (attrfd >= 0) {
- ftruncate (attrfd, 0);
- ret = write (attrfd, value, size);
- close (attrfd);
- } else {
- if (errno != ENOENT)
- gf_log ("libglusterfs", GF_LOG_ERROR,
- "Couldn't set extended attribute for %d (%d)",
- fd, errno);
- return -1;
- }
-
- return 0;
+ int attrfd = -1;
+ int ret = 0;
+
+ attrfd = openat (fd, key, flags|O_CREAT|O_WRONLY|O_XATTR, 0777);
+ if (attrfd >= 0) {
+ ftruncate (attrfd, 0);
+ ret = write (attrfd, value, size);
+ close (attrfd);
+ } else {
+ if (errno != ENOENT)
+ gf_log ("libglusterfs", GF_LOG_ERROR,
+ "Couldn't set extended attribute for %d (%d)",
+ fd, errno);
+ return -1;
+ }
+
+ return 0;
}
-int
-solaris_fgetxattr(int fd,
- const char* key,
- char *value,
- size_t size)
+int
+solaris_fgetxattr(int fd,
+ const char* key,
+ char *value,
+ size_t size)
{
- int attrfd = -1;
- int ret = 0;
-
- attrfd = openat (fd, key, O_RDONLY|O_XATTR);
- if (attrfd >= 0) {
- if (size == 0) {
- struct stat buf;
- fstat (attrfd, &buf);
- ret = buf.st_size;
- } else {
- ret = read (attrfd, value, size);
- }
- close (attrfd);
- } else {
- if (errno == ENOENT)
- errno = ENODATA;
- if (errno != ENOENT)
- gf_log ("libglusterfs", GF_LOG_DEBUG,
- "Couldn't read extended attribute for the file %d (%d)",
- fd, errno);
- return -1;
- }
-
- return ret;
+ int attrfd = -1;
+ int ret = 0;
+
+ attrfd = openat (fd, key, O_RDONLY|O_XATTR);
+ if (attrfd >= 0) {
+ if (size == 0) {
+ struct stat buf;
+ fstat (attrfd, &buf);
+ ret = buf.st_size;
+ } else {
+ ret = read (attrfd, value, size);
+ }
+ close (attrfd);
+ } else {
+ if (errno == ENOENT)
+ errno = ENODATA;
+ if (errno != ENOENT)
+ gf_log ("libglusterfs", GF_LOG_DEBUG,
+ "Couldn't read extended attribute for the file %d (%d)",
+ fd, errno);
+ return -1;
+ }
+
+ return ret;
}
/* Solaris does not support xattr for symlinks and dev files. Since gfid and
@@ -114,7 +114,7 @@ make_export_path (const char *real_path, char **path)
char *ptr = NULL;
char *freeptr = NULL;
uuid_t gfid = {0, };
-
+
export_path = GF_CALLOC (1, sizeof (char) * PATH_MAX, 0);
if (!export_path)
goto out;
@@ -133,7 +133,7 @@ make_export_path (const char *real_path, char **path)
goto done;
}
}
-
+
do {
ptr = strtok_r (dup, "/", &tmp);
if (!ptr)
@@ -145,7 +145,7 @@ make_export_path (const char *real_path, char **path)
ret = 0;
goto done;
}
- }
+ }
strcat (export_path, "/");
dup = tmp;
} while (ptr);
@@ -187,26 +187,26 @@ solaris_xattr_resolve_path (const char *real_path, char **path)
if (lstat (export_path, &statbuf)) {
ret = mkdir (export_path, 0777);
if (ret && (errno != EEXIST)) {
- gf_log ("", GF_LOG_DEBUG, "mkdir failed,"
+ gf_log ("", GF_LOG_DEBUG, "mkdir failed,"
" errno: %d", errno);
- goto out;
+ goto out;
}
}
-
+
snprintf(xattr_path, PATH_MAX, "%s%s%lu", export_path,
- "/", stbuf.ia_ino);
-
- ret = lstat (xattr_path, &statbuf);
-
- if (ret) {
- ret = mknod (xattr_path, S_IFREG|O_WRONLY, 0);
- if (ret && (errno != EEXIST)) {
- gf_log ("", GF_LOG_WARNING,"Failed to create "
- "mapped file %s, error %d", xattr_path,
- errno);
- goto out;
- }
- }
+ "/", stbuf.ia_ino);
+
+ ret = lstat (xattr_path, &statbuf);
+
+ if (ret) {
+ ret = mknod (xattr_path, S_IFREG|O_WRONLY, 0);
+ if (ret && (errno != EEXIST)) {
+ gf_log ("", GF_LOG_WARNING,"Failed to create "
+ "mapped file %s, error %d", xattr_path,
+ errno);
+ goto out;
+ }
+ }
*path = gf_strdup (xattr_path);
}
out:
@@ -218,15 +218,15 @@ out:
return -1;
}
-int
-solaris_setxattr(const char *path,
- const char* key,
- const char *value,
- size_t size,
- int flags)
+int
+solaris_setxattr(const char *path,
+ const char* key,
+ const char *value,
+ size_t size,
+ int flags)
{
- int attrfd = -1;
- int ret = 0;
+ int attrfd = -1;
+ int ret = 0;
char *mapped_path = NULL;
ret = solaris_xattr_resolve_path (path, &mapped_path);
@@ -236,149 +236,149 @@ solaris_setxattr(const char *path,
} else {
attrfd = attropen (path, key, flags|O_CREAT|O_WRONLY, 0777);
}
- if (attrfd >= 0) {
- ftruncate (attrfd, 0);
- ret = write (attrfd, value, size);
- close (attrfd);
+ if (attrfd >= 0) {
+ ftruncate (attrfd, 0);
+ ret = write (attrfd, value, size);
+ close (attrfd);
ret = 0;
- } else {
- if (errno != ENOENT)
- gf_log ("libglusterfs", GF_LOG_ERROR,
- "Couldn't set extended attribute for %s (%d)",
- path, errno);
- ret = -1;
- }
+ } else {
+ if (errno != ENOENT)
+ gf_log ("libglusterfs", GF_LOG_ERROR,
+ "Couldn't set extended attribute for %s (%d)",
+ path, errno);
+ ret = -1;
+ }
if (mapped_path)
- GF_FREE (mapped_path);
- return ret;
+ GF_FREE (mapped_path);
+ return ret;
}
int
-solaris_listxattr(const char *path,
- char *list,
- size_t size)
+solaris_listxattr(const char *path,
+ char *list,
+ size_t size)
{
- int attrdirfd = -1;
- ssize_t len = 0;
- DIR *dirptr = NULL;
- struct dirent *dent = NULL;
- int newfd = -1;
+ int attrdirfd = -1;
+ ssize_t len = 0;
+ DIR *dirptr = NULL;
+ struct dirent *dent = NULL;
+ int newfd = -1;
char *mapped_path = NULL;
int ret = -1;
ret = solaris_xattr_resolve_path (path, &mapped_path);
if (!ret) {
attrdirfd = attropen (mapped_path, ".", O_RDONLY, 0);
- } else {
+ } else {
attrdirfd = attropen (path, ".", O_RDONLY, 0);
}
- if (attrdirfd >= 0) {
- newfd = dup(attrdirfd);
- dirptr = fdopendir(newfd);
- if (dirptr) {
- while ((dent = readdir(dirptr))) {
- size_t listlen = strlen(dent->d_name);
- if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) {
- /* we don't want "." and ".." here */
- continue;
- }
- if (size == 0) {
- /* return the current size of the list of extended attribute names*/
- len += listlen + 1;
- } else {
- /* check size and copy entrie + nul into list. */
- if ((len + listlen + 1) > size) {
- errno = ERANGE;
- len = -1;
- break;
- } else {
- strncpy(list + len, dent->d_name, listlen);
- len += listlen;
- list[len] = '\0';
- ++len;
- }
- }
- }
-
- if (closedir(dirptr) == -1) {
- close (attrdirfd);
- len = -1;
+ if (attrdirfd >= 0) {
+ newfd = dup(attrdirfd);
+ dirptr = fdopendir(newfd);
+ if (dirptr) {
+ while ((dent = readdir(dirptr))) {
+ size_t listlen = strlen(dent->d_name);
+ if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) {
+ /* we don't want "." and ".." here */
+ continue;
+ }
+ if (size == 0) {
+ /* return the current size of the list of extended attribute names*/
+ len += listlen + 1;
+ } else {
+ /* check size and copy entrie + nul into list. */
+ if ((len + listlen + 1) > size) {
+ errno = ERANGE;
+ len = -1;
+ break;
+ } else {
+ strncpy(list + len, dent->d_name, listlen);
+ len += listlen;
+ list[len] = '\0';
+ ++len;
+ }
+ }
+ }
+
+ if (closedir(dirptr) == -1) {
+ close (attrdirfd);
+ len = -1;
goto out;
- }
- } else {
- close (attrdirfd);
- len = -1;
+ }
+ } else {
+ close (attrdirfd);
+ len = -1;
goto out;
- }
- close (attrdirfd);
- }
+ }
+ close (attrdirfd);
+ }
out:
if (mapped_path)
GF_FREE (mapped_path);
- return len;
+ return len;
}
int
solaris_flistxattr(int fd,
- char *list,
+ char *list,
size_t size)
{
- int attrdirfd = -1;
- ssize_t len = 0;
- DIR *dirptr = NULL;
- struct dirent *dent = NULL;
- int newfd = -1;
-
- attrdirfd = openat (fd, ".", O_RDONLY, 0);
- if (attrdirfd >= 0) {
- newfd = dup(attrdirfd);
- dirptr = fdopendir(newfd);
- if (dirptr) {
- while ((dent = readdir(dirptr))) {
- size_t listlen = strlen(dent->d_name);
- if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) {
- /* we don't want "." and ".." here */
- continue;
- }
- if (size == 0) {
- /* return the current size of the list of extended attribute names*/
- len += listlen + 1;
- } else {
- /* check size and copy entrie + nul into list. */
- if ((len + listlen + 1) > size) {
- errno = ERANGE;
- len = -1;
- break;
- } else {
- strncpy(list + len, dent->d_name, listlen);
- len += listlen;
- list[len] = '\0';
- ++len;
- }
- }
- }
-
- if (closedir(dirptr) == -1) {
- close (attrdirfd);
- return -1;
- }
- } else {
- close (attrdirfd);
- return -1;
- }
- close (attrdirfd);
- }
- return len;
+ int attrdirfd = -1;
+ ssize_t len = 0;
+ DIR *dirptr = NULL;
+ struct dirent *dent = NULL;
+ int newfd = -1;
+
+ attrdirfd = openat (fd, ".", O_RDONLY, 0);
+ if (attrdirfd >= 0) {
+ newfd = dup(attrdirfd);
+ dirptr = fdopendir(newfd);
+ if (dirptr) {
+ while ((dent = readdir(dirptr))) {
+ size_t listlen = strlen(dent->d_name);
+ if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) {
+ /* we don't want "." and ".." here */
+ continue;
+ }
+ if (size == 0) {
+ /* return the current size of the list of extended attribute names*/
+ len += listlen + 1;
+ } else {
+ /* check size and copy entrie + nul into list. */
+ if ((len + listlen + 1) > size) {
+ errno = ERANGE;
+ len = -1;
+ break;
+ } else {
+ strncpy(list + len, dent->d_name, listlen);
+ len += listlen;
+ list[len] = '\0';
+ ++len;
+ }
+ }
+ }
+
+ if (closedir(dirptr) == -1) {
+ close (attrdirfd);
+ return -1;
+ }
+ } else {
+ close (attrdirfd);
+ return -1;
+ }
+ close (attrdirfd);
+ }
+ return len;
}
-int
-solaris_removexattr(const char *path,
- const char* key)
+int
+solaris_removexattr(const char *path,
+ const char* key)
{
- int ret = -1;
+ int ret = -1;
int attrfd = -1;
char *mapped_path = NULL;
@@ -388,14 +388,14 @@ solaris_removexattr(const char *path,
} else {
attrfd = attropen (path, ".", O_RDONLY, 0);
}
- if (attrfd >= 0) {
- ret = unlinkat (attrfd, key, 0);
- close (attrfd);
- } else {
- if (errno == ENOENT)
- errno = ENODATA;
- ret = -1;
- }
+ if (attrfd >= 0) {
+ ret = unlinkat (attrfd, key, 0);
+ close (attrfd);
+ } else {
+ if (errno == ENOENT)
+ errno = ENODATA;
+ ret = -1;
+ }
if (mapped_path)
GF_FREE (mapped_path);
@@ -403,68 +403,68 @@ solaris_removexattr(const char *path,
return ret;
}
-int
-solaris_getxattr(const char *path,
- const char* key,
- char *value,
- size_t size)
+int
+solaris_getxattr(const char *path,
+ const char* key,
+ char *value,
+ size_t size)
{
- int attrfd = -1;
- int ret = 0;
+ int attrfd = -1;
+ int ret = 0;
char *mapped_path = NULL;
ret = solaris_xattr_resolve_path (path, &mapped_path);
if (!ret) {
attrfd = attropen (mapped_path, key, O_RDONLY, 0);
- } else {
+ } else {
attrfd = attropen (path, key, O_RDONLY, 0);
}
- if (attrfd >= 0) {
- if (size == 0) {
- struct stat buf;
- fstat (attrfd, &buf);
- ret = buf.st_size;
- } else {
- ret = read (attrfd, value, size);
- }
- close (attrfd);
- } else {
- if (errno == ENOENT)
- errno = ENODATA;
- if (errno != ENOENT)
- gf_log ("libglusterfs", GF_LOG_DEBUG,
- "Couldn't read extended attribute for the file %s (%d)",
- path, errno);
- ret = -1;
- }
+ if (attrfd >= 0) {
+ if (size == 0) {
+ struct stat buf;
+ fstat (attrfd, &buf);
+ ret = buf.st_size;
+ } else {
+ ret = read (attrfd, value, size);
+ }
+ close (attrfd);
+ } else {
+ if (errno == ENOENT)
+ errno = ENODATA;
+ if (errno != ENOENT)
+ gf_log ("libglusterfs", GF_LOG_DEBUG,
+ "Couldn't read extended attribute for the file %s (%d)",
+ path, errno);
+ ret = -1;
+ }
if (mapped_path)
GF_FREE (mapped_path);
- return ret;
+ return ret;
}
char* strsep(char** str, const char* delims)
{
- char* token;
-
- if (*str==NULL) {
- /* No more tokens */
- return NULL;
- }
-
- token=*str;
- while (**str!='\0') {
- if (strchr(delims,**str)!=NULL) {
- **str='\0';
- (*str)++;
- return token;
- }
- (*str)++;
- }
- /* There is no other token */
- *str=NULL;
- return token;
+ char* token;
+
+ if (*str==NULL) {
+ /* No more tokens */
+ return NULL;
+ }
+
+ token=*str;
+ while (**str!='\0') {
+ if (strchr(delims,**str)!=NULL) {
+ **str='\0';
+ (*str)++;
+ return token;
+ }
+ (*str)++;
+ }
+ /* There is no other token */
+ *str=NULL;
+ return token;
}
/* Code comes from libiberty */
@@ -472,49 +472,49 @@ char* strsep(char** str, const char* delims)
int
vasprintf (char **result, const char *format, va_list args)
{
- return gf_vasprintf(result, format, args);
+ return gf_vasprintf(result, format, args);
}
int
asprintf (char **buf, const char *fmt, ...)
{
- int status;
- va_list ap;
+ int status;
+ va_list ap;
- va_start (ap, fmt);
- status = vasprintf (buf, fmt, ap);
- va_end (ap);
- return status;
+ va_start (ap, fmt);
+ status = vasprintf (buf, fmt, ap);
+ va_end (ap);
+ return status;
}
int solaris_unlink (const char *path)
{
char *mapped_path = NULL;
- struct stat stbuf = {0, };
+ struct stat stbuf = {0, };
int ret = -1;
ret = solaris_xattr_resolve_path (path, &mapped_path);
-
+
if (!ret && mapped_path) {
- if (lstat(path, &stbuf)) {
- gf_log ("",GF_LOG_WARNING, "Stat failed on mapped"
- " file %s with error %d", mapped_path, errno);
- goto out;
- }
+ if (lstat(path, &stbuf)) {
+ gf_log ("",GF_LOG_WARNING, "Stat failed on mapped"
+ " file %s with error %d", mapped_path, errno);
+ goto out;
+ }
if (stbuf.st_nlink == 1) {
- if(remove (mapped_path))
- gf_log ("", GF_LOG_WARNING, "Failed to remove mapped "
- "file %s. Errno %d", mapped_path, errno);
- }
+ if(remove (mapped_path))
+ gf_log ("", GF_LOG_WARNING, "Failed to remove mapped "
+ "file %s. Errno %d", mapped_path, errno);
+ }
- }
+ }
out:
- if (mapped_path)
- GF_FREE (mapped_path);
+ if (mapped_path)
+ GF_FREE (mapped_path);
- return unlink (path);
+ return unlink (path);
}
int
@@ -530,8 +530,8 @@ solaris_rename (const char *old_path, const char *new_path)
if (!remove (mapped_path))
gf_log ("", GF_LOG_WARNING, "Failed to remove mapped "
"file %s. Errno %d", mapped_path, errno);
- GF_FREE (mapped_path);
- }
+ GF_FREE (mapped_path);
+ }
return rename(old_path, new_path);
@@ -539,12 +539,12 @@ solaris_rename (const char *old_path, const char *new_path)
#endif /* GF_SOLARIS_HOST_OS */
#ifndef HAVE_STRNLEN
-size_t
-strnlen(const char *string, size_t maxlen)
+size_t
+strnlen(const char *string, size_t maxlen)
{
- int len = 0;
- while ((len < maxlen) && string[len])
- len++;
- return len;
+ int len = 0;
+ while ((len < maxlen) && string[len])
+ len++;
+ return len;
}
#endif /* STRNLEN */
diff --git a/libglusterfs/src/dict.c b/libglusterfs/src/dict.c
index 05bcd440625..64ba7a0ac96 100644
--- a/libglusterfs/src/dict.c
+++ b/libglusterfs/src/dict.c
@@ -39,472 +39,472 @@
data_pair_t *
get_new_data_pair ()
{
- data_pair_t *data_pair_ptr = NULL;
+ data_pair_t *data_pair_ptr = NULL;
- data_pair_ptr = (data_pair_t *) GF_CALLOC (1, sizeof (data_pair_t),
+ data_pair_ptr = (data_pair_t *) GF_CALLOC (1, sizeof (data_pair_t),
gf_common_mt_data_pair_t);
if (!data_pair_ptr)
gf_log ("dict", GF_LOG_ERROR, "memory alloc failed");
- return data_pair_ptr;
+ return data_pair_ptr;
}
data_t *
get_new_data ()
{
- data_t *data = NULL;
+ data_t *data = NULL;
- data = (data_t *) GF_CALLOC (1, sizeof (data_t), gf_common_mt_data_t);
- if (!data) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "calloc () returned NULL");
- return NULL;
- }
+ data = (data_t *) GF_CALLOC (1, sizeof (data_t), gf_common_mt_data_t);
+ if (!data) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "calloc () returned NULL");
+ return NULL;
+ }
- LOCK_INIT (&data->lock);
- return data;
+ LOCK_INIT (&data->lock);
+ return data;
}
dict_t *
get_new_dict_full (int size_hint)
{
- dict_t *dict = GF_CALLOC (1, sizeof (dict_t), gf_common_mt_dict_t);
+ dict_t *dict = GF_CALLOC (1, sizeof (dict_t), gf_common_mt_dict_t);
- if (!dict) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "calloc () returned NULL");
- return NULL;
- }
+ if (!dict) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "calloc () returned NULL");
+ return NULL;
+ }
- dict->hash_size = size_hint;
- dict->members = GF_CALLOC (size_hint, sizeof (data_pair_t *),
+ dict->hash_size = size_hint;
+ dict->members = GF_CALLOC (size_hint, sizeof (data_pair_t *),
gf_common_mt_data_pair_t);
- if (!dict->members) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "calloc () returned NULL");
- return NULL;
- }
+ if (!dict->members) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "calloc () returned NULL");
+ return NULL;
+ }
- LOCK_INIT (&dict->lock);
+ LOCK_INIT (&dict->lock);
- return dict;
+ return dict;
}
dict_t *
get_new_dict (void)
{
- return get_new_dict_full (1);
+ return get_new_dict_full (1);
}
dict_t *
dict_new (void)
{
- dict_t *dict = NULL;
+ dict_t *dict = NULL;
- dict = get_new_dict_full(1);
+ dict = get_new_dict_full(1);
- if (dict)
- dict_ref (dict);
+ if (dict)
+ dict_ref (dict);
- return dict;
+ return dict;
}
int32_t
is_data_equal (data_t *one,
- data_t *two)
+ data_t *two)
{
- if (!one || !two || !one->data || !two->data)
- return 1;
+ if (!one || !two || !one->data || !two->data)
+ return 1;
- if (one == two)
- return 1;
+ if (one == two)
+ return 1;
- if (one->len != two->len)
- return 0;
+ if (one->len != two->len)
+ return 0;
- if (one->data == two->data)
- return 1;
+ if (one->data == two->data)
+ return 1;
- if (memcmp (one->data, two->data, one->len) == 0)
- return 1;
+ if (memcmp (one->data, two->data, one->len) == 0)
+ return 1;
- return 0;
+ return 0;
}
void
data_destroy (data_t *data)
{
- if (data) {
- LOCK_DESTROY (&data->lock);
+ if (data) {
+ LOCK_DESTROY (&data->lock);
- if (!data->is_static) {
- if (data->data) {
+ if (!data->is_static) {
+ if (data->data) {
if (data->is_stdalloc)
free (data->data);
- else
+ else
GF_FREE (data->data);
}
- if (data->vec)
- GF_FREE (data->vec);
- }
+ if (data->vec)
+ GF_FREE (data->vec);
+ }
- data->len = 0xbabababa;
- if (!data->is_const)
- GF_FREE (data);
- }
+ data->len = 0xbabababa;
+ if (!data->is_const)
+ GF_FREE (data);
+ }
}
data_t *
data_copy (data_t *old)
{
- if (!old) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@old is NULL");
- return NULL;
- }
+ if (!old) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@old is NULL");
+ return NULL;
+ }
- data_t *newdata = (data_t *) GF_CALLOC (1, sizeof (*newdata),
+ data_t *newdata = (data_t *) GF_CALLOC (1, sizeof (*newdata),
gf_common_mt_data_t);
- if (!newdata) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@newdata - NULL returned by CALLOC");
- return NULL;
- }
-
- if (old) {
- newdata->len = old->len;
- if (old->data) {
- newdata->data = memdup (old->data, old->len);
- if (!newdata->data)
- goto err_out;
- }
- if (old->vec) {
- newdata->vec = memdup (old->vec, old->len * (sizeof (void *) +
- sizeof (size_t)));
- if (!newdata->vec)
- goto err_out;
- }
- }
+ if (!newdata) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@newdata - NULL returned by CALLOC");
+ return NULL;
+ }
+
+ if (old) {
+ newdata->len = old->len;
+ if (old->data) {
+ newdata->data = memdup (old->data, old->len);
+ if (!newdata->data)
+ goto err_out;
+ }
+ if (old->vec) {
+ newdata->vec = memdup (old->vec, old->len * (sizeof (void *) +
+ sizeof (size_t)));
+ if (!newdata->vec)
+ goto err_out;
+ }
+ }
LOCK_INIT (&newdata->lock);
- return newdata;
+ return newdata;
- err_out:
+err_out:
- if (newdata->data)
- FREE (newdata->data);
- if (newdata->vec)
- FREE (newdata->vec);
- GF_FREE (newdata);
+ if (newdata->data)
+ FREE (newdata->data);
+ if (newdata->vec)
+ FREE (newdata->vec);
+ GF_FREE (newdata);
- gf_log ("dict", GF_LOG_CRITICAL,
- "@newdata->data || @newdata->vec got NULL from CALLOC()");
- return NULL;
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@newdata->data || @newdata->vec got NULL from CALLOC()");
+ return NULL;
}
static data_pair_t *
_dict_lookup (dict_t *this, char *key)
{
- if (!this || !key) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@this=%p @key=%p", this, key);
- return NULL;
- }
+ if (!this || !key) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@this=%p @key=%p", this, key);
+ return NULL;
+ }
- int hashval = SuperFastHash (key, strlen (key)) % this->hash_size;
- data_pair_t *pair;
+ int hashval = SuperFastHash (key, strlen (key)) % this->hash_size;
+ data_pair_t *pair;
- for (pair = this->members[hashval]; pair != NULL; pair = pair->hash_next) {
- if (pair->key && !strcmp (pair->key, key))
- return pair;
- }
+ for (pair = this->members[hashval]; pair != NULL; pair = pair->hash_next) {
+ if (pair->key && !strcmp (pair->key, key))
+ return pair;
+ }
- return NULL;
+ return NULL;
}
static int32_t
_dict_set (dict_t *this,
- char *key,
- data_t *value)
+ char *key,
+ data_t *value)
{
- int hashval;
- data_pair_t *pair;
- char key_free = 0;
- int tmp = 0;
+ int hashval;
+ data_pair_t *pair;
+ char key_free = 0;
+ int tmp = 0;
int ret = 0;
- if (!key) {
- ret = gf_asprintf (&key, "ref:%p", value);
+ if (!key) {
+ ret = gf_asprintf (&key, "ref:%p", value);
if (-1 == ret) {
gf_log ("dict", GF_LOG_ERROR, "asprintf failed");
return -1;
}
- key_free = 1;
- }
-
- tmp = SuperFastHash (key, strlen (key));
- hashval = (tmp % this->hash_size);
- pair = _dict_lookup (this, key);
-
- if (pair) {
- data_t *unref_data = pair->value;
- pair->value = data_ref (value);
- data_unref (unref_data);
- if (key_free)
- GF_FREE (key);
- /* Indicates duplicate key */
- return 0;
- }
- pair = (data_pair_t *) GF_CALLOC (1, sizeof (*pair),
- gf_common_mt_data_pair_t);
- if (!pair) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@pair - NULL returned by CALLOC");
- return -1;
- }
-
- pair->key = (char *) GF_CALLOC (1, strlen (key) + 1,
+ key_free = 1;
+ }
+
+ tmp = SuperFastHash (key, strlen (key));
+ hashval = (tmp % this->hash_size);
+ pair = _dict_lookup (this, key);
+
+ if (pair) {
+ data_t *unref_data = pair->value;
+ pair->value = data_ref (value);
+ data_unref (unref_data);
+ if (key_free)
+ GF_FREE (key);
+ /* Indicates duplicate key */
+ return 0;
+ }
+ pair = (data_pair_t *) GF_CALLOC (1, sizeof (*pair),
+ gf_common_mt_data_pair_t);
+ if (!pair) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@pair - NULL returned by CALLOC");
+ return -1;
+ }
+
+ pair->key = (char *) GF_CALLOC (1, strlen (key) + 1,
gf_common_mt_char);
- if (!pair->key) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@pair->key - NULL returned by CALLOC");
- GF_FREE (pair);
+ if (!pair->key) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@pair->key - NULL returned by CALLOC");
+ GF_FREE (pair);
if (key_free)
GF_FREE (key);
- return -1;
- }
+ return -1;
+ }
- strcpy (pair->key, key);
- pair->value = data_ref (value);
+ strcpy (pair->key, key);
+ pair->value = data_ref (value);
- pair->hash_next = this->members[hashval];
- this->members[hashval] = pair;
+ pair->hash_next = this->members[hashval];
+ this->members[hashval] = pair;
- pair->next = this->members_list;
- pair->prev = NULL;
- if (this->members_list)
- this->members_list->prev = pair;
- this->members_list = pair;
- this->count++;
+ pair->next = this->members_list;
+ pair->prev = NULL;
+ if (this->members_list)
+ this->members_list->prev = pair;
+ this->members_list = pair;
+ this->count++;
- if (key_free)
- GF_FREE (key);
- return 0;
+ if (key_free)
+ GF_FREE (key);
+ return 0;
}
int32_t
dict_set (dict_t *this,
- char *key,
- data_t *value)
+ char *key,
+ data_t *value)
{
- int32_t ret;
+ int32_t ret;
- if (!this || !value) {
- gf_log ("dict", GF_LOG_ERROR,
- "@this=%p @value=%p, key=%s", this, value, key);
- return -1;
- }
+ if (!this || !value) {
+ gf_log ("dict", GF_LOG_ERROR,
+ "@this=%p @value=%p, key=%s", this, value, key);
+ return -1;
+ }
- LOCK (&this->lock);
+ LOCK (&this->lock);
- ret = _dict_set (this, key, value);
+ ret = _dict_set (this, key, value);
- UNLOCK (&this->lock);
+ UNLOCK (&this->lock);
- return ret;
+ return ret;
}
data_t *
dict_get (dict_t *this,
- char *key)
+ char *key)
{
- data_pair_t *pair;
+ data_pair_t *pair;
- if (!this || !key) {
- gf_log_callingfn ("dict", GF_LOG_DEBUG,
+ if (!this || !key) {
+ gf_log_callingfn ("dict", GF_LOG_DEBUG,
"@this=%p key=%s", this, (key) ? key : "()");
- return NULL;
- }
+ return NULL;
+ }
- LOCK (&this->lock);
+ LOCK (&this->lock);
- pair = _dict_lookup (this, key);
+ pair = _dict_lookup (this, key);
- UNLOCK (&this->lock);
+ UNLOCK (&this->lock);
- if (pair)
- return pair->value;
+ if (pair)
+ return pair->value;
- return NULL;
+ return NULL;
}
void
dict_del (dict_t *this,
- char *key)
+ char *key)
{
- if (!this || !key) {
- gf_log ("dict", GF_LOG_DEBUG,
- "@this=%p @key=%p", this, key);
- return;
- }
+ if (!this || !key) {
+ gf_log ("dict", GF_LOG_DEBUG,
+ "@this=%p @key=%p", this, key);
+ return;
+ }
- LOCK (&this->lock);
+ LOCK (&this->lock);
- int hashval = SuperFastHash (key, strlen (key)) % this->hash_size;
- data_pair_t *pair = this->members[hashval];
- data_pair_t *prev = NULL;
+ int hashval = SuperFastHash (key, strlen (key)) % this->hash_size;
+ data_pair_t *pair = this->members[hashval];
+ data_pair_t *prev = NULL;
- while (pair) {
- if (strcmp (pair->key, key) == 0) {
- if (prev)
- prev->hash_next = pair->hash_next;
- else
- this->members[hashval] = pair->hash_next;
+ while (pair) {
+ if (strcmp (pair->key, key) == 0) {
+ if (prev)
+ prev->hash_next = pair->hash_next;
+ else
+ this->members[hashval] = pair->hash_next;
- data_unref (pair->value);
+ data_unref (pair->value);
- if (pair->prev)
- pair->prev->next = pair->next;
- else
- this->members_list = pair->next;
+ if (pair->prev)
+ pair->prev->next = pair->next;
+ else
+ this->members_list = pair->next;
- if (pair->next)
- pair->next->prev = pair->prev;
+ if (pair->next)
+ pair->next->prev = pair->prev;
- GF_FREE (pair->key);
- GF_FREE (pair);
- this->count--;
- break;
- }
+ GF_FREE (pair->key);
+ GF_FREE (pair);
+ this->count--;
+ break;
+ }
- prev = pair;
- pair = pair->hash_next;
- }
+ prev = pair;
+ pair = pair->hash_next;
+ }
- UNLOCK (&this->lock);
+ UNLOCK (&this->lock);
- return;
+ return;
}
void
dict_destroy (dict_t *this)
{
- if (!this) {
- gf_log ("dict", GF_LOG_DEBUG,
- "@this=%p", this);
- return;
- }
+ if (!this) {
+ gf_log ("dict", GF_LOG_DEBUG,
+ "@this=%p", this);
+ return;
+ }
- data_pair_t *pair = this->members_list;
- data_pair_t *prev = this->members_list;
+ data_pair_t *pair = this->members_list;
+ data_pair_t *prev = this->members_list;
- LOCK_DESTROY (&this->lock);
+ LOCK_DESTROY (&this->lock);
- while (prev) {
- pair = pair->next;
- data_unref (prev->value);
- GF_FREE (prev->key);
- GF_FREE (prev);
- prev = pair;
- }
+ while (prev) {
+ pair = pair->next;
+ data_unref (prev->value);
+ GF_FREE (prev->key);
+ GF_FREE (prev);
+ prev = pair;
+ }
- GF_FREE (this->members);
+ GF_FREE (this->members);
- if (this->extra_free)
- GF_FREE (this->extra_free);
+ if (this->extra_free)
+ GF_FREE (this->extra_free);
if (this->extra_stdfree)
free (this->extra_stdfree);
- if (!this->is_static)
- GF_FREE (this);
+ if (!this->is_static)
+ GF_FREE (this);
- return;
+ return;
}
void
dict_unref (dict_t *this)
{
- int32_t ref;
+ int32_t ref;
- if (!this) {
- gf_log ("dict", GF_LOG_DEBUG,
- "@this=%p", this);
- return;
- }
+ if (!this) {
+ gf_log ("dict", GF_LOG_DEBUG,
+ "@this=%p", this);
+ return;
+ }
- LOCK (&this->lock);
+ LOCK (&this->lock);
- this->refcount--;
- ref = this->refcount;
+ this->refcount--;
+ ref = this->refcount;
- UNLOCK (&this->lock);
+ UNLOCK (&this->lock);
- if (!ref)
- dict_destroy (this);
+ if (!ref)
+ dict_destroy (this);
}
dict_t *
dict_ref (dict_t *this)
{
- if (!this) {
- gf_log ("dict", GF_LOG_DEBUG,
- "@this=%p", this);
- return NULL;
- }
+ if (!this) {
+ gf_log ("dict", GF_LOG_DEBUG,
+ "@this=%p", this);
+ return NULL;
+ }
- LOCK (&this->lock);
+ LOCK (&this->lock);
- this->refcount++;
+ this->refcount++;
- UNLOCK (&this->lock);
+ UNLOCK (&this->lock);
- return this;
+ return this;
}
void
data_unref (data_t *this)
{
- int32_t ref;
+ int32_t ref;
- if (!this) {
- gf_log ("dict", GF_LOG_DEBUG,
- "@this=%p", this);
- return;
- }
+ if (!this) {
+ gf_log ("dict", GF_LOG_DEBUG,
+ "@this=%p", this);
+ return;
+ }
- LOCK (&this->lock);
+ LOCK (&this->lock);
- this->refcount--;
- ref = this->refcount;
+ this->refcount--;
+ ref = this->refcount;
- UNLOCK (&this->lock);
+ UNLOCK (&this->lock);
- if (!ref)
- data_destroy (this);
+ if (!ref)
+ data_destroy (this);
}
data_t *
data_ref (data_t *this)
{
- if (!this) {
- gf_log ("dict", GF_LOG_DEBUG,
- "@this=%p", this);
- return NULL;
- }
+ if (!this) {
+ gf_log ("dict", GF_LOG_DEBUG,
+ "@this=%p", this);
+ return NULL;
+ }
- LOCK (&this->lock);
+ LOCK (&this->lock);
- this->refcount++;
+ this->refcount++;
- UNLOCK (&this->lock);
+ UNLOCK (&this->lock);
- return this;
+ return this;
}
/*
@@ -523,385 +523,385 @@ int32_t
dict_serialized_length_old (dict_t *this)
{
- if (!this) {
- gf_log ("dict", GF_LOG_DEBUG,
- "@this=%p", this);
- return -1;
- }
+ if (!this) {
+ gf_log ("dict", GF_LOG_DEBUG,
+ "@this=%p", this);
+ return -1;
+ }
- int32_t len = 9; /* count + \n */
- int32_t count = this->count;
- data_pair_t *pair = this->members_list;
+ int32_t len = 9; /* count + \n */
+ int32_t count = this->count;
+ data_pair_t *pair = this->members_list;
- while (count) {
- len += 18;
- len += strlen (pair->key) + 1;
- if (pair->value->vec) {
- int i;
- for (i=0; i<pair->value->len; i++) {
- len += pair->value->vec[i].iov_len;
- }
- } else {
- len += pair->value->len;
- }
- pair = pair->next;
- count--;
- }
+ while (count) {
+ len += 18;
+ len += strlen (pair->key) + 1;
+ if (pair->value->vec) {
+ int i;
+ for (i=0; i<pair->value->len; i++) {
+ len += pair->value->vec[i].iov_len;
+ }
+ } else {
+ len += pair->value->len;
+ }
+ pair = pair->next;
+ count--;
+ }
- return len;
+ return len;
}
int32_t
dict_serialize_old (dict_t *this, char *buf)
{
- if (!this || !buf) {
- gf_log ("dict", GF_LOG_DEBUG,
- "@this=%p @buf=%p", this, buf);
- return -1;
- }
+ if (!this || !buf) {
+ gf_log ("dict", GF_LOG_DEBUG,
+ "@this=%p @buf=%p", this, buf);
+ return -1;
+ }
- data_pair_t *pair = this->members_list;
- int32_t count = this->count;
- uint64_t dcount = this->count;
+ data_pair_t *pair = this->members_list;
+ int32_t count = this->count;
+ uint64_t dcount = this->count;
- // FIXME: magic numbers
+ // FIXME: magic numbers
- sprintf (buf, "%08"PRIx64"\n", dcount);
- buf += 9;
- while (count) {
- uint64_t keylen = strlen (pair->key) + 1;
- uint64_t vallen = pair->value->len;
+ sprintf (buf, "%08"PRIx64"\n", dcount);
+ buf += 9;
+ while (count) {
+ uint64_t keylen = strlen (pair->key) + 1;
+ uint64_t vallen = pair->value->len;
- sprintf (buf, "%08"PRIx64":%08"PRIx64"\n", keylen, vallen);
- buf += 18;
- memcpy (buf, pair->key, keylen);
- buf += keylen;
- memcpy (buf, pair->value->data, pair->value->len);
- buf += pair->value->len;
- pair = pair->next;
- count--;
- }
- return (0);
+ sprintf (buf, "%08"PRIx64":%08"PRIx64"\n", keylen, vallen);
+ buf += 18;
+ memcpy (buf, pair->key, keylen);
+ buf += keylen;
+ memcpy (buf, pair->value->data, pair->value->len);
+ buf += pair->value->len;
+ pair = pair->next;
+ count--;
+ }
+ return (0);
}
dict_t *
dict_unserialize_old (char *buf, int32_t size, dict_t **fill)
{
- int32_t ret = 0;
- int32_t cnt = 0;
+ int32_t ret = 0;
+ int32_t cnt = 0;
- if (!buf || !fill || !(*fill)) {
- gf_log ("dict", GF_LOG_ERROR,
- "@buf=%p @fill=%p @*fill=%p",
+ if (!buf || !fill || !(*fill)) {
+ gf_log ("dict", GF_LOG_ERROR,
+ "@buf=%p @fill=%p @*fill=%p",
buf, fill, (fill) ? (*fill) : NULL);
- return NULL;
- }
-
- uint64_t count;
- ret = sscanf (buf, "%"SCNx64"\n", &count);
- (*fill)->count = 0;
-
- if (!ret){
- gf_log ("dict",
- GF_LOG_ERROR,
- "sscanf on buf failed");
- goto err;
- }
- buf += 9;
-
- if (count == 0) {
- gf_log ("dict",
- GF_LOG_ERROR,
- "count == 0");
- goto err;
- }
-
- for (cnt = 0; cnt < count; cnt++) {
- data_t *value = NULL;
- char *key = NULL;
- uint64_t key_len, value_len;
-
- ret = sscanf (buf, "%"SCNx64":%"SCNx64"\n", &key_len, &value_len);
- if (ret != 2) {
- gf_log ("dict",
- GF_LOG_ERROR,
- "sscanf for key_len and value_len failed");
- goto err;
- }
- buf += 18;
-
- key = buf;
- buf += key_len;
-
- value = get_new_data ();
- value->len = value_len;
- value->data = buf;
- value->is_static = 1;
- buf += value_len;
-
- dict_set (*fill, key, value);
- }
-
- goto ret;
+ return NULL;
+ }
+
+ uint64_t count;
+ ret = sscanf (buf, "%"SCNx64"\n", &count);
+ (*fill)->count = 0;
+
+ if (!ret){
+ gf_log ("dict",
+ GF_LOG_ERROR,
+ "sscanf on buf failed");
+ goto err;
+ }
+ buf += 9;
+
+ if (count == 0) {
+ gf_log ("dict",
+ GF_LOG_ERROR,
+ "count == 0");
+ goto err;
+ }
+
+ for (cnt = 0; cnt < count; cnt++) {
+ data_t *value = NULL;
+ char *key = NULL;
+ uint64_t key_len, value_len;
+
+ ret = sscanf (buf, "%"SCNx64":%"SCNx64"\n", &key_len, &value_len);
+ if (ret != 2) {
+ gf_log ("dict",
+ GF_LOG_ERROR,
+ "sscanf for key_len and value_len failed");
+ goto err;
+ }
+ buf += 18;
+
+ key = buf;
+ buf += key_len;
+
+ value = get_new_data ();
+ value->len = value_len;
+ value->data = buf;
+ value->is_static = 1;
+ buf += value_len;
+
+ dict_set (*fill, key, value);
+ }
+
+ goto ret;
err:
- GF_FREE (*fill);
- *fill = NULL;
+ GF_FREE (*fill);
+ *fill = NULL;
ret:
- return *fill;
+ return *fill;
}
int32_t
dict_iovec_len (dict_t *this)
{
- if (!this) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@this=%p", this);
- return -1;
- }
+ if (!this) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@this=%p", this);
+ return -1;
+ }
- int32_t len = 0;
- data_pair_t *pair = this->members_list;
+ int32_t len = 0;
+ data_pair_t *pair = this->members_list;
- len++; /* initial header */
- while (pair) {
- len++; /* pair header */
- len++; /* key */
+ len++; /* initial header */
+ while (pair) {
+ len++; /* pair header */
+ len++; /* key */
- if (pair->value->vec)
- len += pair->value->len;
- else
- len++;
- pair = pair->next;
- }
+ if (pair->value->vec)
+ len += pair->value->len;
+ else
+ len++;
+ pair = pair->next;
+ }
- return len;
+ return len;
}
int32_t
dict_to_iovec (dict_t *this,
- struct iovec *vec,
- int32_t count)
-{
- if (!this || !vec) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@this=%p @vec=%p", this, vec);
- return -1;
- }
-
- int32_t i = 0;
- data_pair_t *pair = this->members_list;
-
- vec[0].iov_len = 9;
- if (vec[0].iov_base)
- sprintf (vec[0].iov_base,
- "%08"PRIx64"\n",
- (int64_t)this->count);
- i++;
-
- while (pair) {
- int64_t keylen = strlen (pair->key) + 1;
- int64_t vallen = 0;
-
- if (pair->value->vec) {
- int i;
-
- for (i=0; i<pair->value->len; i++) {
- vallen += pair->value->vec[i].iov_len;
- }
- } else {
- vallen = pair->value->len;
- }
-
- vec[i].iov_len = 18;
- if (vec[i].iov_base)
- sprintf (vec[i].iov_base,
- "%08"PRIx64":%08"PRIx64"\n",
- keylen,
- vallen);
- i++;
-
- vec[i].iov_len = keylen;
- vec[i].iov_base = pair->key;
- i++;
-
- if (pair->value->vec) {
- int k;
-
- for (k=0; k<pair->value->len; k++) {
- vec[i].iov_len = pair->value->vec[k].iov_len;
- vec[i].iov_base = pair->value->vec[k].iov_base;
- i++;
- }
- } else {
- vec[i].iov_len = pair->value->len;
- vec[i].iov_base = pair->value->data;
- i++;
- }
-
- pair = pair->next;
- }
-
- return 0;
+ struct iovec *vec,
+ int32_t count)
+{
+ if (!this || !vec) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@this=%p @vec=%p", this, vec);
+ return -1;
+ }
+
+ int32_t i = 0;
+ data_pair_t *pair = this->members_list;
+
+ vec[0].iov_len = 9;
+ if (vec[0].iov_base)
+ sprintf (vec[0].iov_base,
+ "%08"PRIx64"\n",
+ (int64_t)this->count);
+ i++;
+
+ while (pair) {
+ int64_t keylen = strlen (pair->key) + 1;
+ int64_t vallen = 0;
+
+ if (pair->value->vec) {
+ int i;
+
+ for (i=0; i<pair->value->len; i++) {
+ vallen += pair->value->vec[i].iov_len;
+ }
+ } else {
+ vallen = pair->value->len;
+ }
+
+ vec[i].iov_len = 18;
+ if (vec[i].iov_base)
+ sprintf (vec[i].iov_base,
+ "%08"PRIx64":%08"PRIx64"\n",
+ keylen,
+ vallen);
+ i++;
+
+ vec[i].iov_len = keylen;
+ vec[i].iov_base = pair->key;
+ i++;
+
+ if (pair->value->vec) {
+ int k;
+
+ for (k=0; k<pair->value->len; k++) {
+ vec[i].iov_len = pair->value->vec[k].iov_len;
+ vec[i].iov_base = pair->value->vec[k].iov_base;
+ i++;
+ }
+ } else {
+ vec[i].iov_len = pair->value->len;
+ vec[i].iov_base = pair->value->data;
+ i++;
+ }
+
+ pair = pair->next;
+ }
+
+ return 0;
}
data_t *
int_to_data (int64_t value)
{
int ret = 0;
- data_t *data = get_new_data ();
+ data_t *data = get_new_data ();
- if (!data) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@data - NULL returned by CALLOC");
- return NULL;
- }
+ if (!data) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@data - NULL returned by CALLOC");
+ return NULL;
+ }
- ret = gf_asprintf (&data->data, "%"PRId64, value);
+ ret = gf_asprintf (&data->data, "%"PRId64, value);
if (-1 == ret) {
gf_log ("dict", GF_LOG_ERROR, "asprintf failed");
return NULL;
}
- data->len = strlen (data->data) + 1;
+ data->len = strlen (data->data) + 1;
- return data;
+ return data;
}
data_t *
data_from_int64 (int64_t value)
{
int ret = 0;
- data_t *data = get_new_data ();
-
- if (!data) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@data - NULL returned by CALLOC");
- return NULL;
- }
- ret = gf_asprintf (&data->data, "%"PRId64, value);
+ data_t *data = get_new_data ();
+
+ if (!data) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@data - NULL returned by CALLOC");
+ return NULL;
+ }
+ ret = gf_asprintf (&data->data, "%"PRId64, value);
if (-1 == ret) {
gf_log ("dict", GF_LOG_ERROR, "asprintf failed");
return NULL;
}
- data->len = strlen (data->data) + 1;
+ data->len = strlen (data->data) + 1;
- return data;
+ return data;
}
data_t *
data_from_int32 (int32_t value)
{
int ret = 0;
- data_t *data = get_new_data ();
-
- if (!data) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@data - NULL returned by CALLOC");
- return NULL;
- }
- ret = gf_asprintf (&data->data, "%"PRId32, value);
+ data_t *data = get_new_data ();
+
+ if (!data) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@data - NULL returned by CALLOC");
+ return NULL;
+ }
+ ret = gf_asprintf (&data->data, "%"PRId32, value);
if (-1 == ret) {
gf_log ("dict", GF_LOG_ERROR, "asprintf failed");
return NULL;
}
- data->len = strlen (data->data) + 1;
+ data->len = strlen (data->data) + 1;
- return data;
+ return data;
}
data_t *
data_from_int16 (int16_t value)
{
int ret = 0;
- data_t *data = get_new_data ();
-
- if (!data) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@data - NULL returned by CALLOC");
- return NULL;
- }
- ret = gf_asprintf (&data->data, "%"PRId16, value);
+ data_t *data = get_new_data ();
+
+ if (!data) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@data - NULL returned by CALLOC");
+ return NULL;
+ }
+ ret = gf_asprintf (&data->data, "%"PRId16, value);
if (-1 == ret) {
gf_log ("dict", GF_LOG_ERROR, "asprintf failed");
return NULL;
}
- data->len = strlen (data->data) + 1;
+ data->len = strlen (data->data) + 1;
- return data;
+ return data;
}
data_t *
data_from_int8 (int8_t value)
{
int ret = 0;
- data_t *data = get_new_data ();
-
- if (!data) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@data - NULL returned by CALLOC");
- return NULL;
- }
- ret = gf_asprintf (&data->data, "%d", value);
+ data_t *data = get_new_data ();
+
+ if (!data) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@data - NULL returned by CALLOC");
+ return NULL;
+ }
+ ret = gf_asprintf (&data->data, "%d", value);
if (-1 == ret) {
gf_log ("dict", GF_LOG_ERROR, "asprintf failed");
return NULL;
}
- data->len = strlen (data->data) + 1;
+ data->len = strlen (data->data) + 1;
- return data;
+ return data;
}
data_t *
data_from_uint64 (uint64_t value)
{
int ret = 0;
- data_t *data = get_new_data ();
-
- if (!data) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@data - NULL returned by CALLOC");
- return NULL;
- }
- ret = gf_asprintf (&data->data, "%"PRIu64, value);
+ data_t *data = get_new_data ();
+
+ if (!data) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@data - NULL returned by CALLOC");
+ return NULL;
+ }
+ ret = gf_asprintf (&data->data, "%"PRIu64, value);
if (-1 == ret) {
gf_log ("dict", GF_LOG_ERROR, "asprintf failed");
return NULL;
}
- data->len = strlen (data->data) + 1;
+ data->len = strlen (data->data) + 1;
- return data;
+ return data;
}
static data_t *
data_from_double (double value)
{
- data_t *data = NULL;
- int ret = 0;
+ data_t *data = NULL;
+ int ret = 0;
- data = get_new_data ();
+ data = get_new_data ();
- if (!data) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@data - NULL returned by CALLOC");
- return NULL;
- }
+ if (!data) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@data - NULL returned by CALLOC");
+ return NULL;
+ }
- ret = gf_asprintf (&data->data, "%f", value);
- if (ret == -1) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@data - allocation failed by ASPRINTF");
- return NULL;
- }
- data->len = strlen (data->data) + 1;
+ ret = gf_asprintf (&data->data, "%f", value);
+ if (ret == -1) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@data - allocation failed by ASPRINTF");
+ return NULL;
+ }
+ data->len = strlen (data->data) + 1;
- return data;
+ return data;
}
@@ -909,22 +909,22 @@ data_t *
data_from_uint32 (uint32_t value)
{
int ret = 0;
- data_t *data = get_new_data ();
-
- if (!data) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@data - NULL returned by CALLOC");
- return NULL;
- }
- ret = gf_asprintf (&data->data, "%"PRIu32, value);
+ data_t *data = get_new_data ();
+
+ if (!data) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@data - NULL returned by CALLOC");
+ return NULL;
+ }
+ ret = gf_asprintf (&data->data, "%"PRIu32, value);
if (-1 == ret) {
gf_log ("dict", GF_LOG_ERROR, "asprintf failed");
return NULL;
}
- data->len = strlen (data->data) + 1;
+ data->len = strlen (data->data) + 1;
- return data;
+ return data;
}
@@ -932,44 +932,44 @@ data_t *
data_from_uint16 (uint16_t value)
{
int ret = 0;
- data_t *data = get_new_data ();
-
- if (!data) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@data - NULL returned by CALLOC");
- return NULL;
- }
- ret = gf_asprintf (&data->data, "%"PRIu16, value);
+ data_t *data = get_new_data ();
+
+ if (!data) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@data - NULL returned by CALLOC");
+ return NULL;
+ }
+ ret = gf_asprintf (&data->data, "%"PRIu16, value);
if (-1 == ret) {
gf_log ("dict", GF_LOG_ERROR, "asprintf failed");
return NULL;
}
- data->len = strlen (data->data) + 1;
+ data->len = strlen (data->data) + 1;
- return data;
+ return data;
}
data_t *
data_from_ptr (void *value)
{
- if (!value) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@value=%p", value);
- return NULL;
- }
+ if (!value) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@value=%p", value);
+ return NULL;
+ }
- data_t *data = get_new_data ();
+ data_t *data = get_new_data ();
- if (!data) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@data - NULL returned by CALLOC");
- return NULL;
- }
+ if (!data) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@data - NULL returned by CALLOC");
+ return NULL;
+ }
- data->data = value;
- return data;
+ data->data = value;
+ return data;
}
data_t *
@@ -978,267 +978,267 @@ data_from_static_ptr (void *value)
/*
this is valid to set 0 as value..
- if (!value) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@value=%p", value);
- return NULL;
- }
+ if (!value) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@value=%p", value);
+ return NULL;
+ }
*/
- data_t *data = get_new_data ();
+ data_t *data = get_new_data ();
- if (!data) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@data - NULL returned by CALLOC");
- return NULL;
- }
+ if (!data) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@data - NULL returned by CALLOC");
+ return NULL;
+ }
- data->is_static = 1;
- data->data = value;
+ data->is_static = 1;
+ data->data = value;
- return data;
+ return data;
}
data_t *
str_to_data (char *value)
{
- if (!value) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@value=%p", value);
- return NULL;
- }
- data_t *data = get_new_data ();
+ if (!value) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@value=%p", value);
+ return NULL;
+ }
+ data_t *data = get_new_data ();
- if (!data) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@data - NULL returned by CALLOC");
- return NULL;
- }
- data->len = strlen (value) + 1;
+ if (!data) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@data - NULL returned by CALLOC");
+ return NULL;
+ }
+ data->len = strlen (value) + 1;
- data->data = value;
- data->is_static = 1;
+ data->data = value;
+ data->is_static = 1;
- return data;
+ return data;
}
data_t *
data_from_dynstr (char *value)
{
- if (!value) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@value=%p", value);
- return NULL;
- }
+ if (!value) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@value=%p", value);
+ return NULL;
+ }
- data_t *data = get_new_data ();
+ data_t *data = get_new_data ();
- data->len = strlen (value) + 1;
- data->data = value;
+ data->len = strlen (value) + 1;
+ data->data = value;
- return data;
+ return data;
}
data_t *
data_from_dynmstr (char *value)
{
- if (!value) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@value=%p", value);
- return NULL;
- }
+ if (!value) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@value=%p", value);
+ return NULL;
+ }
- data_t *data = get_new_data ();
+ data_t *data = get_new_data ();
- data->len = strlen (value) + 1;
- data->data = value;
+ data->len = strlen (value) + 1;
+ data->data = value;
data->is_stdalloc = 1;
- return data;
+ return data;
}
data_t *
data_from_dynptr (void *value, int32_t len)
{
- data_t *data = get_new_data ();
+ data_t *data = get_new_data ();
- data->len = len;
- data->data = value;
+ data->len = len;
+ data->data = value;
- return data;
+ return data;
}
data_t *
bin_to_data (void *value, int32_t len)
{
- if (!value) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@value=%p", value);
- return NULL;
- }
+ if (!value) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@value=%p", value);
+ return NULL;
+ }
- data_t *data = get_new_data ();
+ data_t *data = get_new_data ();
- data->is_static = 1;
- data->len = len;
- data->data = value;
+ data->is_static = 1;
+ data->len = len;
+ data->data = value;
- return data;
+ return data;
}
int64_t
data_to_int64 (data_t *data)
{
- if (!data)
- return -1;
+ if (!data)
+ return -1;
- char *str = alloca (data->len + 1);
+ char *str = alloca (data->len + 1);
if (!str)
return -1;
- memcpy (str, data->data, data->len);
- str[data->len] = '\0';
- return (int64_t) strtoull (str, NULL, 0);
+ memcpy (str, data->data, data->len);
+ str[data->len] = '\0';
+ return (int64_t) strtoull (str, NULL, 0);
}
int32_t
data_to_int32 (data_t *data)
{
- if (!data)
- return -1;
+ if (!data)
+ return -1;
- char *str = alloca (data->len + 1);
+ char *str = alloca (data->len + 1);
if (!str)
return -1;
- memcpy (str, data->data, data->len);
- str[data->len] = '\0';
+ memcpy (str, data->data, data->len);
+ str[data->len] = '\0';
- return strtoul (str, NULL, 0);
+ return strtoul (str, NULL, 0);
}
int16_t
data_to_int16 (data_t *data)
{
- if (!data)
- return -1;
+ if (!data)
+ return -1;
- char *str = alloca (data->len + 1);
+ char *str = alloca (data->len + 1);
if (!str)
return -1;
- memcpy (str, data->data, data->len);
- str[data->len] = '\0';
+ memcpy (str, data->data, data->len);
+ str[data->len] = '\0';
- return strtol (str, NULL, 0);
+ return strtol (str, NULL, 0);
}
int8_t
data_to_int8 (data_t *data)
{
- if (!data)
- return -1;
+ if (!data)
+ return -1;
- char *str = alloca (data->len + 1);
+ char *str = alloca (data->len + 1);
if (!str)
return -1;
- memcpy (str, data->data, data->len);
- str[data->len] = '\0';
+ memcpy (str, data->data, data->len);
+ str[data->len] = '\0';
- return (int8_t)strtol (str, NULL, 0);
+ return (int8_t)strtol (str, NULL, 0);
}
uint64_t
data_to_uint64 (data_t *data)
{
- if (!data)
- return -1;
- char *str = alloca (data->len + 1);
+ if (!data)
+ return -1;
+ char *str = alloca (data->len + 1);
if (!str)
return -1;
- memcpy (str, data->data, data->len);
- str[data->len] = '\0';
+ memcpy (str, data->data, data->len);
+ str[data->len] = '\0';
- return strtoll (str, NULL, 0);
+ return strtoll (str, NULL, 0);
}
uint32_t
data_to_uint32 (data_t *data)
{
- if (!data)
- return -1;
+ if (!data)
+ return -1;
- char *str = alloca (data->len + 1);
+ char *str = alloca (data->len + 1);
if (!str)
return -1;
- memcpy (str, data->data, data->len);
- str[data->len] = '\0';
+ memcpy (str, data->data, data->len);
+ str[data->len] = '\0';
- return strtol (str, NULL, 0);
+ return strtol (str, NULL, 0);
}
uint16_t
data_to_uint16 (data_t *data)
{
- if (!data)
- return -1;
+ if (!data)
+ return -1;
- char *str = alloca (data->len + 1);
+ char *str = alloca (data->len + 1);
if (!str)
return -1;
- memcpy (str, data->data, data->len);
- str[data->len] = '\0';
+ memcpy (str, data->data, data->len);
+ str[data->len] = '\0';
- return strtol (str, NULL, 0);
+ return strtol (str, NULL, 0);
}
char *
data_to_str (data_t *data)
{
- if (!data) {
- gf_log ("dict", GF_LOG_WARNING,
- "@data=%p", data);
- return NULL;
- }
- return data->data;
+ if (!data) {
+ gf_log ("dict", GF_LOG_WARNING,
+ "@data=%p", data);
+ return NULL;
+ }
+ return data->data;
}
void *
data_to_ptr (data_t *data)
{
- if (!data) {
- return NULL;
- }
- return data->data;
+ if (!data) {
+ return NULL;
+ }
+ return data->data;
}
void *
data_to_bin (data_t *data)
{
- if (!data) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@data=%p", data);
- return NULL;
- }
- return data->data;
+ if (!data) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@data=%p", data);
+ return NULL;
+ }
+ return data->data;
}
void
dict_foreach (dict_t *dict,
- void (*fn)(dict_t *this,
- char *key,
- data_t *value,
- void *data),
- void *data)
+ void (*fn)(dict_t *this,
+ char *key,
+ data_t *value,
+ void *data),
+ void *data)
{
if (!data || !dict) {
gf_log_callingfn ("dict", GF_LOG_CRITICAL,
- "@data=%p, @dict=%p", data, dict);
+ "@data=%p, @dict=%p", data, dict);
return;
}
@@ -1259,45 +1259,45 @@ _copy (dict_t *unused,
data_t *value,
void *newdict)
{
- dict_set ((dict_t *)newdict, key, (value));
+ dict_set ((dict_t *)newdict, key, (value));
}
dict_t *
dict_copy (dict_t *dict,
- dict_t *new)
+ dict_t *new)
{
- if (!dict) {
- gf_log ("dict", GF_LOG_CRITICAL,
- "@data=%p", dict);
- return NULL;
- }
+ if (!dict) {
+ gf_log ("dict", GF_LOG_CRITICAL,
+ "@data=%p", dict);
+ return NULL;
+ }
- if (!new)
- new = get_new_dict_full (dict->hash_size);
+ if (!new)
+ new = get_new_dict_full (dict->hash_size);
- dict_foreach (dict, _copy, new);
+ dict_foreach (dict, _copy, new);
- return new;
+ return new;
}
dict_t *
dict_copy_with_ref (dict_t *dict,
- dict_t *new)
+ dict_t *new)
{
- dict_t *local_new = NULL;
+ dict_t *local_new = NULL;
- GF_VALIDATE_OR_GOTO("dict", dict, fail);
+ GF_VALIDATE_OR_GOTO("dict", dict, fail);
- if (new == NULL) {
- local_new = dict_new ();
- GF_VALIDATE_OR_GOTO("dict", local_new, fail);
- new = local_new;
- }
+ if (new == NULL) {
+ local_new = dict_new ();
+ GF_VALIDATE_OR_GOTO("dict", local_new, fail);
+ new = local_new;
+ }
- dict_foreach (dict, _copy, new);
+ dict_foreach (dict, _copy, new);
fail:
- return new;
+ return new;
}
/*
@@ -1315,506 +1315,506 @@ fail:
static int
dict_get_with_ref (dict_t *this, char *key, data_t **data)
{
- data_pair_t * pair = NULL;
- int ret = -ENOENT;
+ data_pair_t * pair = NULL;
+ int ret = -ENOENT;
- if (!this || !key || !data) {
- ret = -EINVAL;
- goto err;
- }
+ if (!this || !key || !data) {
+ ret = -EINVAL;
+ goto err;
+ }
- LOCK (&this->lock);
- {
- pair = _dict_lookup (this, key);
- }
- UNLOCK (&this->lock);
+ LOCK (&this->lock);
+ {
+ pair = _dict_lookup (this, key);
+ }
+ UNLOCK (&this->lock);
- if (pair) {
- ret = 0;
- *data = data_ref (pair->value);
- }
+ if (pair) {
+ ret = 0;
+ *data = data_ref (pair->value);
+ }
err:
- return ret;
+ return ret;
}
static int
_data_to_ptr (data_t *data, void **val)
{
- int ret = 0;
+ int ret = 0;
- if (!data) {
- ret = -EINVAL;
- goto err;
- }
+ if (!data) {
+ ret = -EINVAL;
+ goto err;
+ }
- *val = data->data;
+ *val = data->data;
err:
- return ret;
+ return ret;
}
static int
_data_to_int8 (data_t *data, int8_t *val)
{
- int ret = 0;
- char * str = NULL;
+ int ret = 0;
+ char * str = NULL;
- if (!data || !val) {
- ret = -EINVAL;
- goto err;
- }
+ if (!data || !val) {
+ ret = -EINVAL;
+ goto err;
+ }
- str = alloca (data->len + 1);
- if (!str) {
- ret = -ENOMEM;
- goto err;
- }
- memcpy (str, data->data, data->len);
- str[data->len] = '\0';
+ str = alloca (data->len + 1);
+ if (!str) {
+ ret = -ENOMEM;
+ goto err;
+ }
+ memcpy (str, data->data, data->len);
+ str[data->len] = '\0';
- errno = 0;
- *val = strtol (str, NULL, 0);
- if (errno != 0)
- ret = -errno;
+ errno = 0;
+ *val = strtol (str, NULL, 0);
+ if (errno != 0)
+ ret = -errno;
err:
- return ret;
+ return ret;
}
static int
_data_to_int16 (data_t *data, int16_t *val)
{
- int ret = 0;
- char * str = NULL;
+ int ret = 0;
+ char * str = NULL;
- if (!data || !val) {
- ret = -EINVAL;
- goto err;
- }
+ if (!data || !val) {
+ ret = -EINVAL;
+ goto err;
+ }
- str = alloca (data->len + 1);
- if (!str) {
- ret = -ENOMEM;
- goto err;
- }
- memcpy (str, data->data, data->len);
- str[data->len] = '\0';
+ str = alloca (data->len + 1);
+ if (!str) {
+ ret = -ENOMEM;
+ goto err;
+ }
+ memcpy (str, data->data, data->len);
+ str[data->len] = '\0';
- errno = 0;
- *val = strtol (str, NULL, 0);
- if (errno != 0)
- ret = -errno;
+ errno = 0;
+ *val = strtol (str, NULL, 0);
+ if (errno != 0)
+ ret = -errno;
err:
- return ret;
+ return ret;
}
static int
_data_to_int32 (data_t *data, int32_t *val)
{
- int ret = 0;
- char * str = NULL;
+ int ret = 0;
+ char * str = NULL;
- if (!data || !val) {
- ret = -EINVAL;
- goto err;
- }
+ if (!data || !val) {
+ ret = -EINVAL;
+ goto err;
+ }
- str = alloca (data->len + 1);
- if (!str) {
- ret = -ENOMEM;
- goto err;
- }
- memcpy (str, data->data, data->len);
- str[data->len] = '\0';
+ str = alloca (data->len + 1);
+ if (!str) {
+ ret = -ENOMEM;
+ goto err;
+ }
+ memcpy (str, data->data, data->len);
+ str[data->len] = '\0';
- errno = 0;
- *val = strtol (str, NULL, 0);
- if (errno != 0)
- ret = -errno;
+ errno = 0;
+ *val = strtol (str, NULL, 0);
+ if (errno != 0)
+ ret = -errno;
err:
- return ret;
+ return ret;
}
static int
_data_to_int64 (data_t *data, int64_t *val)
{
- int ret = 0;
- char * str = NULL;
+ int ret = 0;
+ char * str = NULL;
- if (!data || !val) {
- ret = -EINVAL;
- goto err;
- }
+ if (!data || !val) {
+ ret = -EINVAL;
+ goto err;
+ }
- str = alloca (data->len + 1);
- if (!str) {
- ret = -ENOMEM;
- goto err;
- }
- memcpy (str, data->data, data->len);
- str[data->len] = '\0';
+ str = alloca (data->len + 1);
+ if (!str) {
+ ret = -ENOMEM;
+ goto err;
+ }
+ memcpy (str, data->data, data->len);
+ str[data->len] = '\0';
- errno = 0;
- *val = strtoll (str, NULL, 0);
- if (errno != 0)
- ret = -errno;
+ errno = 0;
+ *val = strtoll (str, NULL, 0);
+ if (errno != 0)
+ ret = -errno;
err:
- return ret;
+ return ret;
}
static int
_data_to_uint16 (data_t *data, uint16_t *val)
{
- int ret = 0;
- char * str = NULL;
+ int ret = 0;
+ char * str = NULL;
- if (!data || !val) {
- ret = -EINVAL;
- goto err;
- }
+ if (!data || !val) {
+ ret = -EINVAL;
+ goto err;
+ }
- str = alloca (data->len + 1);
- if (!str) {
- ret = -ENOMEM;
- goto err;
- }
- memcpy (str, data->data, data->len);
- str[data->len] = '\0';
+ str = alloca (data->len + 1);
+ if (!str) {
+ ret = -ENOMEM;
+ goto err;
+ }
+ memcpy (str, data->data, data->len);
+ str[data->len] = '\0';
- errno = 0;
- *val = strtoul (str, NULL, 0);
- if (errno != 0)
- ret = -errno;
+ errno = 0;
+ *val = strtoul (str, NULL, 0);
+ if (errno != 0)
+ ret = -errno;
err:
- return ret;
+ return ret;
}
static int
_data_to_uint32 (data_t *data, uint32_t *val)
{
- int ret = 0;
- char * str = NULL;
+ int ret = 0;
+ char * str = NULL;
- if (!data || !val) {
- ret = -EINVAL;
- goto err;
- }
+ if (!data || !val) {
+ ret = -EINVAL;
+ goto err;
+ }
- str = alloca (data->len + 1);
- if (!str) {
- ret = -ENOMEM;
- goto err;
- }
- memcpy (str, data->data, data->len);
- str[data->len] = '\0';
+ str = alloca (data->len + 1);
+ if (!str) {
+ ret = -ENOMEM;
+ goto err;
+ }
+ memcpy (str, data->data, data->len);
+ str[data->len] = '\0';
- errno = 0;
- *val = strtoul (str, NULL, 0);
- if (errno != 0)
- ret = -errno;
+ errno = 0;
+ *val = strtoul (str, NULL, 0);
+ if (errno != 0)
+ ret = -errno;
err:
- return ret;
+ return ret;
}
static int
_data_to_uint64 (data_t *data, uint64_t *val)
{
- int ret = 0;
- char * str = NULL;
+ int ret = 0;
+ char * str = NULL;
- if (!data || !val) {
- ret = -EINVAL;
- goto err;
- }
+ if (!data || !val) {
+ ret = -EINVAL;
+ goto err;
+ }
- str = alloca (data->len + 1);
- if (!str) {
- ret = -ENOMEM;
- goto err;
- }
- memcpy (str, data->data, data->len);
- str[data->len] = '\0';
+ str = alloca (data->len + 1);
+ if (!str) {
+ ret = -ENOMEM;
+ goto err;
+ }
+ memcpy (str, data->data, data->len);
+ str[data->len] = '\0';
- errno = 0;
- *val = strtoull (str, NULL, 0);
- if (errno != 0)
- ret = -errno;
+ errno = 0;
+ *val = strtoull (str, NULL, 0);
+ if (errno != 0)
+ ret = -errno;
err:
- return ret;
+ return ret;
}
static int
_data_to_double (data_t *data, double *val)
{
- int ret = 0;
- char * str = NULL;
+ int ret = 0;
+ char * str = NULL;
- if (!data || !val) {
- ret = -EINVAL;
- goto err;
- }
+ if (!data || !val) {
+ ret = -EINVAL;
+ goto err;
+ }
- str = alloca (data->len + 1);
- if (!str) {
- ret = -ENOMEM;
- goto err;
- }
- memcpy (str, data->data, data->len);
- str[data->len] = '\0';
+ str = alloca (data->len + 1);
+ if (!str) {
+ ret = -ENOMEM;
+ goto err;
+ }
+ memcpy (str, data->data, data->len);
+ str[data->len] = '\0';
- errno = 0;
- *val = strtod (str, NULL);
- if (errno != 0)
- ret = -errno;
+ errno = 0;
+ *val = strtod (str, NULL);
+ if (errno != 0)
+ ret = -errno;
err:
- return ret;
+ return ret;
}
int
dict_get_int8 (dict_t *this, char *key, int8_t *val)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- if (!this || !key || !val) {
- ret = -EINVAL;
- goto err;
- }
+ if (!this || !key || !val) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_get_with_ref (this, key, &data);
- if (ret != 0) {
- goto err;
- }
+ ret = dict_get_with_ref (this, key, &data);
+ if (ret != 0) {
+ goto err;
+ }
- ret = _data_to_int8 (data, val);
+ ret = _data_to_int8 (data, val);
err:
- if (data)
- data_unref (data);
- return ret;
+ if (data)
+ data_unref (data);
+ return ret;
}
int
dict_set_int8 (dict_t *this, char *key, int8_t val)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- data = data_from_int8 (val);
- if (!data) {
- ret = -EINVAL;
- goto err;
- }
+ data = data_from_int8 (val);
+ if (!data) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_set (this, key, data);
+ ret = dict_set (this, key, data);
err:
- return ret;
+ return ret;
}
int
dict_get_int16 (dict_t *this, char *key, int16_t *val)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- if (!this || !key || !val) {
- ret = -EINVAL;
- goto err;
- }
+ if (!this || !key || !val) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_get_with_ref (this, key, &data);
- if (ret != 0) {
- goto err;
- }
+ ret = dict_get_with_ref (this, key, &data);
+ if (ret != 0) {
+ goto err;
+ }
- ret = _data_to_int16 (data, val);
+ ret = _data_to_int16 (data, val);
err:
- if (data)
- data_unref (data);
- return ret;
+ if (data)
+ data_unref (data);
+ return ret;
}
int
dict_set_int16 (dict_t *this, char *key, int16_t val)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- data = data_from_int16 (val);
- if (!data) {
- ret = -EINVAL;
- goto err;
- }
+ data = data_from_int16 (val);
+ if (!data) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_set (this, key, data);
+ ret = dict_set (this, key, data);
err:
- return ret;
+ return ret;
}
int
dict_get_int32 (dict_t *this, char *key, int32_t *val)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- if (!this || !key || !val) {
- ret = -EINVAL;
- goto err;
- }
+ if (!this || !key || !val) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_get_with_ref (this, key, &data);
- if (ret != 0) {
- goto err;
- }
+ ret = dict_get_with_ref (this, key, &data);
+ if (ret != 0) {
+ goto err;
+ }
- ret = _data_to_int32 (data, val);
+ ret = _data_to_int32 (data, val);
err:
- if (data)
- data_unref (data);
- return ret;
+ if (data)
+ data_unref (data);
+ return ret;
}
int
dict_set_int32 (dict_t *this, char *key, int32_t val)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- data = data_from_int32 (val);
- if (!data) {
- ret = -EINVAL;
- goto err;
- }
+ data = data_from_int32 (val);
+ if (!data) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_set (this, key, data);
+ ret = dict_set (this, key, data);
err:
- return ret;
+ return ret;
}
int
dict_get_int64 (dict_t *this, char *key, int64_t *val)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- if (!this || !key || !val) {
- ret = -EINVAL;
- goto err;
- }
+ if (!this || !key || !val) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_get_with_ref (this, key, &data);
- if (ret != 0) {
- goto err;
- }
+ ret = dict_get_with_ref (this, key, &data);
+ if (ret != 0) {
+ goto err;
+ }
- ret = _data_to_int64 (data, val);
+ ret = _data_to_int64 (data, val);
err:
- if (data)
- data_unref (data);
- return ret;
+ if (data)
+ data_unref (data);
+ return ret;
}
int
dict_set_int64 (dict_t *this, char *key, int64_t val)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- data = data_from_int64 (val);
- if (!data) {
- ret = -EINVAL;
- goto err;
- }
+ data = data_from_int64 (val);
+ if (!data) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_set (this, key, data);
+ ret = dict_set (this, key, data);
err:
- return ret;
+ return ret;
}
int
dict_get_uint16 (dict_t *this, char *key, uint16_t *val)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- if (!this || !key || !val) {
- ret = -EINVAL;
- goto err;
- }
+ if (!this || !key || !val) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_get_with_ref (this, key, &data);
- if (ret != 0) {
- goto err;
- }
+ ret = dict_get_with_ref (this, key, &data);
+ if (ret != 0) {
+ goto err;
+ }
- ret = _data_to_uint16 (data, val);
+ ret = _data_to_uint16 (data, val);
err:
- if (data)
- data_unref (data);
- return ret;
+ if (data)
+ data_unref (data);
+ return ret;
}
int
dict_set_uint16 (dict_t *this, char *key, uint16_t val)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- data = data_from_uint16 (val);
- if (!data) {
- ret = -EINVAL;
- goto err;
- }
+ data = data_from_uint16 (val);
+ if (!data) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_set (this, key, data);
+ ret = dict_set (this, key, data);
err:
- return ret;
+ return ret;
}
int
dict_get_uint32 (dict_t *this, char *key, uint32_t *val)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- if (!this || !key || !val) {
- ret = -EINVAL;
- goto err;
- }
+ if (!this || !key || !val) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_get_with_ref (this, key, &data);
- if (ret != 0) {
- goto err;
- }
+ ret = dict_get_with_ref (this, key, &data);
+ if (ret != 0) {
+ goto err;
+ }
- ret = _data_to_uint32 (data, val);
+ ret = _data_to_uint32 (data, val);
err:
- if (data)
- data_unref (data);
- return ret;
+ if (data)
+ data_unref (data);
+ return ret;
}
@@ -1822,355 +1822,355 @@ err:
int
dict_set_uint32 (dict_t *this, char *key, uint32_t val)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- data = data_from_uint32 (val);
- if (!data) {
- ret = -EINVAL;
- goto err;
- }
+ data = data_from_uint32 (val);
+ if (!data) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_set (this, key, data);
+ ret = dict_set (this, key, data);
err:
- return ret;
+ return ret;
}
int
dict_get_uint64 (dict_t *this, char *key, uint64_t *val)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- if (!this || !key || !val) {
- ret = -EINVAL;
- goto err;
- }
+ if (!this || !key || !val) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_get_with_ref (this, key, &data);
- if (ret != 0) {
- goto err;
- }
+ ret = dict_get_with_ref (this, key, &data);
+ if (ret != 0) {
+ goto err;
+ }
- ret = _data_to_uint64 (data, val);
+ ret = _data_to_uint64 (data, val);
err:
- if (data)
- data_unref (data);
- return ret;
+ if (data)
+ data_unref (data);
+ return ret;
}
int
dict_set_uint64 (dict_t *this, char *key, uint64_t val)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- data = data_from_uint64 (val);
- if (!data) {
- ret = -EINVAL;
- goto err;
- }
+ data = data_from_uint64 (val);
+ if (!data) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_set (this, key, data);
+ ret = dict_set (this, key, data);
err:
- return ret;
+ return ret;
}
int
dict_get_double (dict_t *this, char *key, double *val)
{
- data_t *data = NULL;
- int ret = 0;
+ data_t *data = NULL;
+ int ret = 0;
- if (!this || !key || !val) {
- ret = -EINVAL;
- goto err;
- }
+ if (!this || !key || !val) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_get_with_ref (this, key, &data);
- if (ret != 0) {
- goto err;
- }
+ ret = dict_get_with_ref (this, key, &data);
+ if (ret != 0) {
+ goto err;
+ }
- ret = _data_to_double (data, val);
+ ret = _data_to_double (data, val);
err:
- if (data)
- data_unref (data);
- return ret;
+ if (data)
+ data_unref (data);
+ return ret;
}
int
dict_set_double (dict_t *this, char *key, double val)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- data = data_from_double (val);
- if (!data) {
- ret = -EINVAL;
- goto err;
- }
+ data = data_from_double (val);
+ if (!data) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_set (this, key, data);
+ ret = dict_set (this, key, data);
err:
- return ret;
+ return ret;
}
int
dict_set_static_ptr (dict_t *this, char *key, void *ptr)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- data = data_from_static_ptr (ptr);
- if (!data) {
- ret = -EINVAL;
- goto err;
- }
+ data = data_from_static_ptr (ptr);
+ if (!data) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_set (this, key, data);
+ ret = dict_set (this, key, data);
err:
- return ret;
+ return ret;
}
int
dict_set_dynptr (dict_t *this, char *key, void *ptr, size_t len)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- data = data_from_dynptr (ptr, len);
- if (!data) {
- ret = -EINVAL;
- goto err;
- }
+ data = data_from_dynptr (ptr, len);
+ if (!data) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_set (this, key, data);
+ ret = dict_set (this, key, data);
err:
- return ret;
+ return ret;
}
int
dict_get_ptr (dict_t *this, char *key, void **ptr)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- if (!this || !key || !ptr) {
- ret = -EINVAL;
- goto err;
- }
+ if (!this || !key || !ptr) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_get_with_ref (this, key, &data);
- if (ret != 0) {
- goto err;
- }
+ ret = dict_get_with_ref (this, key, &data);
+ if (ret != 0) {
+ goto err;
+ }
- ret = _data_to_ptr (data, ptr);
- if (ret != 0) {
- goto err;
- }
+ ret = _data_to_ptr (data, ptr);
+ if (ret != 0) {
+ goto err;
+ }
err:
- if (data)
- data_unref (data);
+ if (data)
+ data_unref (data);
- return ret;
+ return ret;
}
int
dict_set_ptr (dict_t *this, char *key, void *ptr)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- data = data_from_ptr (ptr);
- if (!data) {
- ret = -EINVAL;
- goto err;
- }
+ data = data_from_ptr (ptr);
+ if (!data) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_set (this, key, data);
+ ret = dict_set (this, key, data);
err:
- return ret;
+ return ret;
}
int
dict_get_str (dict_t *this, char *key, char **str)
{
- data_t * data = NULL;
- int ret = -EINVAL;
+ data_t * data = NULL;
+ int ret = -EINVAL;
- if (!this || !key || !str) {
- goto err;
- }
+ if (!this || !key || !str) {
+ goto err;
+ }
- ret = dict_get_with_ref (this, key, &data);
- if (ret < 0) {
- goto err;
- }
+ ret = dict_get_with_ref (this, key, &data);
+ if (ret < 0) {
+ goto err;
+ }
- if (!data || !data->data) {
- goto err;
- }
- *str = data->data;
+ if (!data || !data->data) {
+ goto err;
+ }
+ *str = data->data;
err:
- if (data)
- data_unref (data);
+ if (data)
+ data_unref (data);
- return ret;
+ return ret;
}
int
dict_set_str (dict_t *this, char *key, char *str)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- data = str_to_data (str);
- if (!data) {
- ret = -EINVAL;
- goto err;
- }
+ data = str_to_data (str);
+ if (!data) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_set (this, key, data);
+ ret = dict_set (this, key, data);
err:
- return ret;
+ return ret;
}
int
dict_set_dynstr (dict_t *this, char *key, char *str)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- data = data_from_dynstr (str);
- if (!data) {
- ret = -EINVAL;
- goto err;
- }
+ data = data_from_dynstr (str);
+ if (!data) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_set (this, key, data);
+ ret = dict_set (this, key, data);
err:
- return ret;
+ return ret;
}
/*
- for malloced strings we should do a free instead of GF_FREE
+ for malloced strings we should do a free instead of GF_FREE
*/
int
dict_set_dynmstr (dict_t *this, char *key, char *str)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- data = data_from_dynmstr (str);
- if (!data) {
- ret = -EINVAL;
- goto err;
- }
+ data = data_from_dynmstr (str);
+ if (!data) {
+ ret = -EINVAL;
+ goto err;
+ }
- ret = dict_set (this, key, data);
+ ret = dict_set (this, key, data);
err:
- return ret;
+ return ret;
}
int
dict_get_bin (dict_t *this, char *key, void **bin)
{
- data_t * data = NULL;
- int ret = -EINVAL;
+ data_t * data = NULL;
+ int ret = -EINVAL;
- if (!this || !key || !bin) {
- goto err;
- }
+ if (!this || !key || !bin) {
+ goto err;
+ }
- ret = dict_get_with_ref (this, key, &data);
- if (ret < 0) {
- goto err;
- }
+ ret = dict_get_with_ref (this, key, &data);
+ if (ret < 0) {
+ goto err;
+ }
- if (!data || !data->data) {
- goto err;
- }
- *bin = data->data;
+ if (!data || !data->data) {
+ goto err;
+ }
+ *bin = data->data;
err:
- if (data)
- data_unref (data);
+ if (data)
+ data_unref (data);
- return ret;
+ return ret;
}
int
dict_set_bin (dict_t *this, char *key, void *ptr, size_t size)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- if (!ptr || (size < 0)) {
- ret = -EINVAL;
- goto err;
- }
+ if (!ptr || (size < 0)) {
+ ret = -EINVAL;
+ goto err;
+ }
- data = bin_to_data (ptr, size);
- if (!data) {
- ret = -EINVAL;
- goto err;
- }
+ data = bin_to_data (ptr, size);
+ if (!data) {
+ ret = -EINVAL;
+ goto err;
+ }
- data->data = ptr;
- data->len = size;
- data->is_static = 0;
+ data->data = ptr;
+ data->len = size;
+ data->is_static = 0;
- ret = dict_set (this, key, data);
+ ret = dict_set (this, key, data);
err:
- return ret;
+ return ret;
}
int
dict_set_static_bin (dict_t *this, char *key, void *ptr, size_t size)
{
- data_t * data = NULL;
- int ret = 0;
+ data_t * data = NULL;
+ int ret = 0;
- if (!ptr || (size < 0)) {
- ret = -EINVAL;
- goto err;
- }
+ if (!ptr || (size < 0)) {
+ ret = -EINVAL;
+ goto err;
+ }
- data = bin_to_data (ptr, size);
- if (!data) {
- ret = -EINVAL;
- goto err;
- }
+ data = bin_to_data (ptr, size);
+ if (!data) {
+ ret = -EINVAL;
+ goto err;
+ }
- data->data = ptr;
- data->len = size;
- data->is_static = 1;
+ data->data = ptr;
+ data->len = size;
+ data->is_static = 1;
- ret = dict_set (this, key, data);
+ ret = dict_set (this, key, data);
err:
- return ret;
+ return ret;
}
@@ -2258,73 +2258,73 @@ err:
int
_dict_serialized_length (dict_t *this)
{
- int ret = -EINVAL;
- int count = 0;
- int len = 0;
- int i = 0;
- data_pair_t * pair = NULL;
-
- len = DICT_HDR_LEN;
- count = this->count;
-
- if (count < 0) {
- gf_log ("dict", GF_LOG_ERROR, "count (%d) < 0!", count);
- goto out;
- }
-
- pair = this->members_list;
-
- while (count) {
- if (!pair) {
- gf_log ("dict", GF_LOG_ERROR,
- "less than count data pairs found!");
- goto out;
- }
-
- len += DICT_DATA_HDR_KEY_LEN + DICT_DATA_HDR_VAL_LEN;
-
- if (!pair->key) {
- gf_log ("dict", GF_LOG_ERROR, "pair->key is null!");
- goto out;
- }
-
- len += strlen (pair->key) + 1 /* for '\0' */;
-
- if (!pair->value) {
- gf_log ("dict", GF_LOG_ERROR,
- "pair->value is null!");
- goto out;
- }
-
- if (pair->value->vec) {
- for (i = 0; i < pair->value->len; i++) {
- if (pair->value->vec[i].iov_len < 0) {
- gf_log ("dict", GF_LOG_ERROR,
- "iov_len (%"GF_PRI_SIZET") < 0!",
- pair->value->vec[i].iov_len);
- goto out;
- }
-
- len += pair->value->vec[i].iov_len;
- }
- } else {
- if (pair->value->len < 0) {
- gf_log ("dict", GF_LOG_ERROR,
- "value->len (%d) < 0",
- pair->value->len);
- goto out;
- }
-
- len += pair->value->len;
- }
-
- pair = pair->next;
- count--;
- }
-
- ret = len;
+ int ret = -EINVAL;
+ int count = 0;
+ int len = 0;
+ int i = 0;
+ data_pair_t * pair = NULL;
+
+ len = DICT_HDR_LEN;
+ count = this->count;
+
+ if (count < 0) {
+ gf_log ("dict", GF_LOG_ERROR, "count (%d) < 0!", count);
+ goto out;
+ }
+
+ pair = this->members_list;
+
+ while (count) {
+ if (!pair) {
+ gf_log ("dict", GF_LOG_ERROR,
+ "less than count data pairs found!");
+ goto out;
+ }
+
+ len += DICT_DATA_HDR_KEY_LEN + DICT_DATA_HDR_VAL_LEN;
+
+ if (!pair->key) {
+ gf_log ("dict", GF_LOG_ERROR, "pair->key is null!");
+ goto out;
+ }
+
+ len += strlen (pair->key) + 1 /* for '\0' */;
+
+ if (!pair->value) {
+ gf_log ("dict", GF_LOG_ERROR,
+ "pair->value is null!");
+ goto out;
+ }
+
+ if (pair->value->vec) {
+ for (i = 0; i < pair->value->len; i++) {
+ if (pair->value->vec[i].iov_len < 0) {
+ gf_log ("dict", GF_LOG_ERROR,
+ "iov_len (%"GF_PRI_SIZET") < 0!",
+ pair->value->vec[i].iov_len);
+ goto out;
+ }
+
+ len += pair->value->vec[i].iov_len;
+ }
+ } else {
+ if (pair->value->len < 0) {
+ gf_log ("dict", GF_LOG_ERROR,
+ "value->len (%d) < 0",
+ pair->value->len);
+ goto out;
+ }
+
+ len += pair->value->len;
+ }
+
+ pair = pair->next;
+ count--;
+ }
+
+ ret = len;
out:
- return ret;
+ return ret;
}
/**
@@ -2352,9 +2352,9 @@ _dict_serialize (dict_t *this, char *buf)
if (!buf) {
gf_log ("dict", GF_LOG_ERROR,
- "buf is null!");
- goto out;
- }
+ "buf is null!");
+ goto out;
+ }
count = this->count;
@@ -2376,9 +2376,9 @@ _dict_serialize (dict_t *this, char *buf)
}
if (!pair->key) {
- gf_log ("dict", GF_LOG_ERROR,
- "pair->key is null!");
- goto out;
+ gf_log ("dict", GF_LOG_ERROR,
+ "pair->key is null!");
+ goto out;
}
keylen = strlen (pair->key);
@@ -2387,9 +2387,9 @@ _dict_serialize (dict_t *this, char *buf)
buf += DICT_DATA_HDR_KEY_LEN;
if (!pair->value) {
- gf_log ("dict", GF_LOG_ERROR,
- "pair->value is null!");
- goto out;
+ gf_log ("dict", GF_LOG_ERROR,
+ "pair->value is null!");
+ goto out;
}
vallen = pair->value->len;
@@ -2402,9 +2402,9 @@ _dict_serialize (dict_t *this, char *buf)
*buf++ = '\0';
if (!pair->value->data) {
- gf_log ("dict", GF_LOG_ERROR,
- "pair->value->data is null!");
- goto out;
+ gf_log ("dict", GF_LOG_ERROR,
+ "pair->value->data is null!");
+ goto out;
}
memcpy (buf, pair->value->data, vallen);
buf += vallen;
@@ -2430,12 +2430,12 @@ out:
int
dict_serialized_length (dict_t *this)
{
- int ret = -EINVAL;
+ int ret = -EINVAL;
- if (!this) {
- gf_log ("dict", GF_LOG_ERROR, "this is null!");
- goto out;
- }
+ if (!this) {
+ gf_log ("dict", GF_LOG_ERROR, "this is null!");
+ goto out;
+ }
LOCK (&this->lock);
{
@@ -2444,7 +2444,7 @@ dict_serialized_length (dict_t *this)
UNLOCK (&this->lock);
out:
- return ret;
+ return ret;
}
/**
@@ -2461,18 +2461,18 @@ out:
int
dict_serialize (dict_t *this, char *buf)
{
- int ret = -1;
+ int ret = -1;
- if (!this) {
- gf_log ("dict", GF_LOG_ERROR,
- "this is null!");
- goto out;
- }
- if (!buf) {
- gf_log ("dict", GF_LOG_ERROR,
- "buf is null!");
- goto out;
- }
+ if (!this) {
+ gf_log ("dict", GF_LOG_ERROR,
+ "this is null!");
+ goto out;
+ }
+ if (!buf) {
+ gf_log ("dict", GF_LOG_ERROR,
+ "buf is null!");
+ goto out;
+ }
LOCK (&this->lock);
{
@@ -2480,7 +2480,7 @@ dict_serialize (dict_t *this, char *buf)
}
UNLOCK (&this->lock);
out:
- return ret;
+ return ret;
}
@@ -2514,100 +2514,100 @@ dict_unserialize (char *orig_buf, int32_t size, dict_t **fill)
if (!buf) {
gf_log ("dict", GF_LOG_ERROR,
"buf is null!");
- goto out;
- }
-
- if (size == 0) {
- gf_log ("dict", GF_LOG_ERROR,
- "size is 0!");
- goto out;
- }
-
- if (!fill) {
- gf_log ("dict", GF_LOG_ERROR,
- "fill is null!");
- goto out;
- }
-
- if (!*fill) {
- gf_log ("dict", GF_LOG_ERROR,
- "*fill is null!");
- goto out;
- }
-
- if ((buf + DICT_HDR_LEN) > (orig_buf + size)) {
- gf_log ("dict", GF_LOG_ERROR,
- "undersized buffer passed");
- goto out;
- }
-
- memcpy (&hostord, buf, sizeof(hostord));
- count = ntoh32 (hostord);
- buf += DICT_HDR_LEN;
-
- if (count < 0) {
- gf_log ("dict", GF_LOG_ERROR,
- "count (%d) <= 0", count);
- goto out;
- }
-
- /* count will be set by the dict_set's below */
- (*fill)->count = 0;
-
- for (i = 0; i < count; i++) {
- if ((buf + DICT_DATA_HDR_KEY_LEN) > (orig_buf + size)) {
- gf_log ("dict", GF_LOG_DEBUG,
- "No room for keylen (size %d).",
- DICT_DATA_HDR_KEY_LEN);
- gf_log ("dict", GF_LOG_ERROR,
- "undersized buffer passed");
- goto out;
- }
- memcpy (&hostord, buf, sizeof(hostord));
- keylen = ntoh32 (hostord);
- buf += DICT_DATA_HDR_KEY_LEN;
-
- if ((buf + DICT_DATA_HDR_VAL_LEN) > (orig_buf + size)) {
- gf_log ("dict", GF_LOG_DEBUG,
- "No room for vallen (size %d).",
- DICT_DATA_HDR_VAL_LEN);
- gf_log ("dict", GF_LOG_ERROR,
- "undersized buffer passed");
- goto out;
- }
- memcpy (&hostord, buf, sizeof(hostord));
- vallen = ntoh32 (hostord);
- buf += DICT_DATA_HDR_VAL_LEN;
-
- if ((buf + keylen) > (orig_buf + size)) {
- gf_log ("dict", GF_LOG_DEBUG,
- "No room for key (size %d).", keylen);
- gf_log ("dict", GF_LOG_ERROR,
- "undersized buffer passed");
- goto out;
- }
- key = buf;
- buf += keylen + 1; /* for '\0' */
-
- if ((buf + vallen) > (orig_buf + size)) {
- gf_log ("dict", GF_LOG_DEBUG,
- "No room for value (size %d).", vallen);
- gf_log ("dict", GF_LOG_ERROR,
- "undersized buffer passed");
- goto out;
- }
- value = get_new_data ();
- value->len = vallen;
- value->data = memdup (buf, vallen);
- value->is_static = 0;
- buf += vallen;
-
- dict_set (*fill, key, value);
- }
-
- ret = 0;
+ goto out;
+ }
+
+ if (size == 0) {
+ gf_log ("dict", GF_LOG_ERROR,
+ "size is 0!");
+ goto out;
+ }
+
+ if (!fill) {
+ gf_log ("dict", GF_LOG_ERROR,
+ "fill is null!");
+ goto out;
+ }
+
+ if (!*fill) {
+ gf_log ("dict", GF_LOG_ERROR,
+ "*fill is null!");
+ goto out;
+ }
+
+ if ((buf + DICT_HDR_LEN) > (orig_buf + size)) {
+ gf_log ("dict", GF_LOG_ERROR,
+ "undersized buffer passed");
+ goto out;
+ }
+
+ memcpy (&hostord, buf, sizeof(hostord));
+ count = ntoh32 (hostord);
+ buf += DICT_HDR_LEN;
+
+ if (count < 0) {
+ gf_log ("dict", GF_LOG_ERROR,
+ "count (%d) <= 0", count);
+ goto out;
+ }
+
+ /* count will be set by the dict_set's below */
+ (*fill)->count = 0;
+
+ for (i = 0; i < count; i++) {
+ if ((buf + DICT_DATA_HDR_KEY_LEN) > (orig_buf + size)) {
+ gf_log ("dict", GF_LOG_DEBUG,
+ "No room for keylen (size %d).",
+ DICT_DATA_HDR_KEY_LEN);
+ gf_log ("dict", GF_LOG_ERROR,
+ "undersized buffer passed");
+ goto out;
+ }
+ memcpy (&hostord, buf, sizeof(hostord));
+ keylen = ntoh32 (hostord);
+ buf += DICT_DATA_HDR_KEY_LEN;
+
+ if ((buf + DICT_DATA_HDR_VAL_LEN) > (orig_buf + size)) {
+ gf_log ("dict", GF_LOG_DEBUG,
+ "No room for vallen (size %d).",
+ DICT_DATA_HDR_VAL_LEN);
+ gf_log ("dict", GF_LOG_ERROR,
+ "undersized buffer passed");
+ goto out;
+ }
+ memcpy (&hostord, buf, sizeof(hostord));
+ vallen = ntoh32 (hostord);
+ buf += DICT_DATA_HDR_VAL_LEN;
+
+ if ((buf + keylen) > (orig_buf + size)) {
+ gf_log ("dict", GF_LOG_DEBUG,
+ "No room for key (size %d).", keylen);
+ gf_log ("dict", GF_LOG_ERROR,
+ "undersized buffer passed");
+ goto out;
+ }
+ key = buf;
+ buf += keylen + 1; /* for '\0' */
+
+ if ((buf + vallen) > (orig_buf + size)) {
+ gf_log ("dict", GF_LOG_DEBUG,
+ "No room for value (size %d).", vallen);
+ gf_log ("dict", GF_LOG_ERROR,
+ "undersized buffer passed");
+ goto out;
+ }
+ value = get_new_data ();
+ value->len = vallen;
+ value->data = memdup (buf, vallen);
+ value->is_static = 0;
+ buf += vallen;
+
+ dict_set (*fill, key, value);
+ }
+
+ ret = 0;
out:
- return ret;
+ return ret;
}
@@ -2625,19 +2625,19 @@ out:
int32_t
dict_allocate_and_serialize (dict_t *this, char **buf, size_t *length)
{
- int ret = -EINVAL;
+ int ret = -EINVAL;
ssize_t len = 0;
- if (!this) {
- gf_log ("dict", GF_LOG_DEBUG,
- "NULL passed as this pointer");
- goto out;
- }
- if (!buf) {
- gf_log ("dict", GF_LOG_DEBUG,
- "NULL passed as buf");
- goto out;
- }
+ if (!this) {
+ gf_log ("dict", GF_LOG_DEBUG,
+ "NULL passed as this pointer");
+ goto out;
+ }
+ if (!buf) {
+ gf_log ("dict", GF_LOG_DEBUG,
+ "NULL passed as buf");
+ goto out;
+ }
LOCK (&this->lock);
{
@@ -2668,5 +2668,5 @@ dict_allocate_and_serialize (dict_t *this, char **buf, size_t *length)
unlock:
UNLOCK (&this->lock);
out:
- return ret;
+ return ret;
}
diff --git a/libglusterfs/src/event.c b/libglusterfs/src/event.c
index cb6abd4180e..4f64966b2d9 100644
--- a/libglusterfs/src/event.c
+++ b/libglusterfs/src/event.c
@@ -1,20 +1,20 @@
/*
- Copyright (c) 2008-2010 Gluster, Inc. <http://www.gluster.com>
- This file is part of GlusterFS.
-
- GlusterFS is free software; you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation; either version 3 of the License,
- or (at your option) any later version.
-
- GlusterFS 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
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see
- <http://www.gnu.org/licenses/>.
+ Copyright (c) 2008-2010 Gluster, Inc. <http://www.gluster.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
*/
#include <sys/poll.h>
@@ -37,440 +37,440 @@
static int
event_register_poll (struct event_pool *event_pool, int fd,
- event_handler_t handler,
- void *data, int poll_in, int poll_out);
+ event_handler_t handler,
+ void *data, int poll_in, int poll_out);
static int
__flush_fd (int fd, int idx, void *data,
- int poll_in, int poll_out, int poll_err)
+ int poll_in, int poll_out, int poll_err)
{
- char buf[64];
- int ret = -1;
-
- if (!poll_in)
- return ret;
-
- do {
- ret = read (fd, buf, 64);
- if (ret == -1 && errno != EAGAIN) {
- gf_log ("poll", GF_LOG_ERROR,
- "read on %d returned error (%s)",
- fd, strerror (errno));
- }
- } while (ret == 64);
-
- return ret;
+ char buf[64];
+ int ret = -1;
+
+ if (!poll_in)
+ return ret;
+
+ do {
+ ret = read (fd, buf, 64);
+ if (ret == -1 && errno != EAGAIN) {
+ gf_log ("poll", GF_LOG_ERROR,
+ "read on %d returned error (%s)",
+ fd, strerror (errno));
+ }
+ } while (ret == 64);
+
+ return ret;
}
static int
__event_getindex (struct event_pool *event_pool, int fd, int idx)
{
- int ret = -1;
- int i = 0;
-
- if (event_pool == NULL) {
- gf_log ("event", GF_LOG_ERROR, "invalid argument");
- return -1;
- }
-
- if (idx > -1 && idx < event_pool->used) {
- if (event_pool->reg[idx].fd == fd)
- ret = idx;
- }
-
- for (i=0; ret == -1 && i<event_pool->used; i++) {
- if (event_pool->reg[i].fd == fd) {
- ret = i;
- break;
- }
- }
-
- return ret;
+ int ret = -1;
+ int i = 0;
+
+ if (event_pool == NULL) {
+ gf_log ("event", GF_LOG_ERROR, "invalid argument");
+ return -1;
+ }
+
+ if (idx > -1 && idx < event_pool->used) {
+ if (event_pool->reg[idx].fd == fd)
+ ret = idx;
+ }
+
+ for (i=0; ret == -1 && i<event_pool->used; i++) {
+ if (event_pool->reg[i].fd == fd) {
+ ret = i;
+ break;
+ }
+ }
+
+ return ret;
}
static struct event_pool *
event_pool_new_poll (int count)
{
- struct event_pool *event_pool = NULL;
- int ret = -1;
+ struct event_pool *event_pool = NULL;
+ int ret = -1;
- event_pool = GF_CALLOC (1, sizeof (*event_pool),
+ event_pool = GF_CALLOC (1, sizeof (*event_pool),
gf_common_mt_event_pool);
- if (!event_pool)
- return NULL;
-
- event_pool->count = count;
- event_pool->reg = GF_CALLOC (event_pool->count,
- sizeof (*event_pool->reg),
- gf_common_mt_reg);
-
- if (!event_pool->reg) {
- gf_log ("poll", GF_LOG_CRITICAL,
- "failed to allocate event registry");
- GF_FREE (event_pool);
- return NULL;
- }
-
- pthread_mutex_init (&event_pool->mutex, NULL);
-
- ret = pipe (event_pool->breaker);
-
- if (ret == -1) {
- gf_log ("poll", GF_LOG_ERROR,
- "pipe creation failed (%s)", strerror (errno));
- GF_FREE (event_pool->reg);
- GF_FREE (event_pool);
- return NULL;
- }
-
- ret = fcntl (event_pool->breaker[0], F_SETFL, O_NONBLOCK);
- if (ret == -1) {
- gf_log ("poll", GF_LOG_ERROR,
- "could not set pipe to non blocking mode (%s)",
- strerror (errno));
- close (event_pool->breaker[0]);
- close (event_pool->breaker[1]);
- event_pool->breaker[0] = event_pool->breaker[1] = -1;
-
- GF_FREE (event_pool->reg);
- GF_FREE (event_pool);
- return NULL;
- }
-
- ret = fcntl (event_pool->breaker[1], F_SETFL, O_NONBLOCK);
- if (ret == -1) {
- gf_log ("poll", GF_LOG_ERROR,
- "could not set pipe to non blocking mode (%s)",
- strerror (errno));
-
- close (event_pool->breaker[0]);
- close (event_pool->breaker[1]);
- event_pool->breaker[0] = event_pool->breaker[1] = -1;
-
- GF_FREE (event_pool->reg);
- GF_FREE (event_pool);
- return NULL;
- }
-
- ret = event_register_poll (event_pool, event_pool->breaker[0],
- __flush_fd, NULL, 1, 0);
- if (ret == -1) {
- gf_log ("poll", GF_LOG_ERROR,
- "could not register pipe fd with poll event loop");
- close (event_pool->breaker[0]);
- close (event_pool->breaker[1]);
- event_pool->breaker[0] = event_pool->breaker[1] = -1;
-
- GF_FREE (event_pool->reg);
- GF_FREE (event_pool);
- return NULL;
- }
-
- return event_pool;
+ if (!event_pool)
+ return NULL;
+
+ event_pool->count = count;
+ event_pool->reg = GF_CALLOC (event_pool->count,
+ sizeof (*event_pool->reg),
+ gf_common_mt_reg);
+
+ if (!event_pool->reg) {
+ gf_log ("poll", GF_LOG_CRITICAL,
+ "failed to allocate event registry");
+ GF_FREE (event_pool);
+ return NULL;
+ }
+
+ pthread_mutex_init (&event_pool->mutex, NULL);
+
+ ret = pipe (event_pool->breaker);
+
+ if (ret == -1) {
+ gf_log ("poll", GF_LOG_ERROR,
+ "pipe creation failed (%s)", strerror (errno));
+ GF_FREE (event_pool->reg);
+ GF_FREE (event_pool);
+ return NULL;
+ }
+
+ ret = fcntl (event_pool->breaker[0], F_SETFL, O_NONBLOCK);
+ if (ret == -1) {
+ gf_log ("poll", GF_LOG_ERROR,
+ "could not set pipe to non blocking mode (%s)",
+ strerror (errno));
+ close (event_pool->breaker[0]);
+ close (event_pool->breaker[1]);
+ event_pool->breaker[0] = event_pool->breaker[1] = -1;
+
+ GF_FREE (event_pool->reg);
+ GF_FREE (event_pool);
+ return NULL;
+ }
+
+ ret = fcntl (event_pool->breaker[1], F_SETFL, O_NONBLOCK);
+ if (ret == -1) {
+ gf_log ("poll", GF_LOG_ERROR,
+ "could not set pipe to non blocking mode (%s)",
+ strerror (errno));
+
+ close (event_pool->breaker[0]);
+ close (event_pool->breaker[1]);
+ event_pool->breaker[0] = event_pool->breaker[1] = -1;
+
+ GF_FREE (event_pool->reg);
+ GF_FREE (event_pool);
+ return NULL;
+ }
+
+ ret = event_register_poll (event_pool, event_pool->breaker[0],
+ __flush_fd, NULL, 1, 0);
+ if (ret == -1) {
+ gf_log ("poll", GF_LOG_ERROR,
+ "could not register pipe fd with poll event loop");
+ close (event_pool->breaker[0]);
+ close (event_pool->breaker[1]);
+ event_pool->breaker[0] = event_pool->breaker[1] = -1;
+
+ GF_FREE (event_pool->reg);
+ GF_FREE (event_pool);
+ return NULL;
+ }
+
+ return event_pool;
}
static int
event_register_poll (struct event_pool *event_pool, int fd,
- event_handler_t handler,
- void *data, int poll_in, int poll_out)
+ event_handler_t handler,
+ void *data, int poll_in, int poll_out)
{
- int idx = -1;
-
- if (event_pool == NULL) {
- gf_log ("event", GF_LOG_ERROR, "invalid argument");
- return -1;
- }
-
- pthread_mutex_lock (&event_pool->mutex);
- {
- if (event_pool->count == event_pool->used)
- {
- event_pool->count += 256;
-
- event_pool->reg = GF_REALLOC (event_pool->reg,
- event_pool->count *
- sizeof (*event_pool->reg));
+ int idx = -1;
+
+ if (event_pool == NULL) {
+ gf_log ("event", GF_LOG_ERROR, "invalid argument");
+ return -1;
+ }
+
+ pthread_mutex_lock (&event_pool->mutex);
+ {
+ if (event_pool->count == event_pool->used)
+ {
+ event_pool->count += 256;
+
+ event_pool->reg = GF_REALLOC (event_pool->reg,
+ event_pool->count *
+ sizeof (*event_pool->reg));
if (!event_pool->reg)
goto unlock;
- }
-
- idx = event_pool->used++;
-
- event_pool->reg[idx].fd = fd;
- event_pool->reg[idx].events = POLLPRI;
- event_pool->reg[idx].handler = handler;
- event_pool->reg[idx].data = data;
-
- switch (poll_in) {
- case 1:
- event_pool->reg[idx].events |= POLLIN;
- break;
- case 0:
- event_pool->reg[idx].events &= ~POLLIN;
- break;
- case -1:
- /* do nothing */
- break;
- default:
- gf_log ("poll", GF_LOG_ERROR,
- "invalid poll_in value %d", poll_in);
- break;
- }
-
- switch (poll_out) {
- case 1:
- event_pool->reg[idx].events |= POLLOUT;
- break;
- case 0:
- event_pool->reg[idx].events &= ~POLLOUT;
- break;
- case -1:
- /* do nothing */
- break;
- default:
- gf_log ("poll", GF_LOG_ERROR,
- "invalid poll_out value %d", poll_out);
- break;
- }
-
- event_pool->changed = 1;
-
- }
+ }
+
+ idx = event_pool->used++;
+
+ event_pool->reg[idx].fd = fd;
+ event_pool->reg[idx].events = POLLPRI;
+ event_pool->reg[idx].handler = handler;
+ event_pool->reg[idx].data = data;
+
+ switch (poll_in) {
+ case 1:
+ event_pool->reg[idx].events |= POLLIN;
+ break;
+ case 0:
+ event_pool->reg[idx].events &= ~POLLIN;
+ break;
+ case -1:
+ /* do nothing */
+ break;
+ default:
+ gf_log ("poll", GF_LOG_ERROR,
+ "invalid poll_in value %d", poll_in);
+ break;
+ }
+
+ switch (poll_out) {
+ case 1:
+ event_pool->reg[idx].events |= POLLOUT;
+ break;
+ case 0:
+ event_pool->reg[idx].events &= ~POLLOUT;
+ break;
+ case -1:
+ /* do nothing */
+ break;
+ default:
+ gf_log ("poll", GF_LOG_ERROR,
+ "invalid poll_out value %d", poll_out);
+ break;
+ }
+
+ event_pool->changed = 1;
+
+ }
unlock:
- pthread_mutex_unlock (&event_pool->mutex);
+ pthread_mutex_unlock (&event_pool->mutex);
- return idx;
+ return idx;
}
static int
event_unregister_poll (struct event_pool *event_pool, int fd, int idx_hint)
{
- int idx = -1;
-
- if (event_pool == NULL) {
- gf_log ("event", GF_LOG_ERROR, "invalid argument");
- return -1;
- }
-
- pthread_mutex_lock (&event_pool->mutex);
- {
- idx = __event_getindex (event_pool, fd, idx_hint);
-
- if (idx == -1) {
- gf_log ("poll", GF_LOG_ERROR,
- "index not found for fd=%d (idx_hint=%d)",
- fd, idx_hint);
- errno = ENOENT;
- goto unlock;
- }
-
- event_pool->reg[idx] = event_pool->reg[--event_pool->used];
- event_pool->changed = 1;
- }
+ int idx = -1;
+
+ if (event_pool == NULL) {
+ gf_log ("event", GF_LOG_ERROR, "invalid argument");
+ return -1;
+ }
+
+ pthread_mutex_lock (&event_pool->mutex);
+ {
+ idx = __event_getindex (event_pool, fd, idx_hint);
+
+ if (idx == -1) {
+ gf_log ("poll", GF_LOG_ERROR,
+ "index not found for fd=%d (idx_hint=%d)",
+ fd, idx_hint);
+ errno = ENOENT;
+ goto unlock;
+ }
+
+ event_pool->reg[idx] = event_pool->reg[--event_pool->used];
+ event_pool->changed = 1;
+ }
unlock:
- pthread_mutex_unlock (&event_pool->mutex);
+ pthread_mutex_unlock (&event_pool->mutex);
- return idx;
+ return idx;
}
static int
event_select_on_poll (struct event_pool *event_pool, int fd, int idx_hint,
- int poll_in, int poll_out)
+ int poll_in, int poll_out)
{
- int idx = -1;
-
- if (event_pool == NULL) {
- gf_log ("event", GF_LOG_ERROR, "invalid argument");
- return -1;
- }
-
- pthread_mutex_lock (&event_pool->mutex);
- {
- idx = __event_getindex (event_pool, fd, idx_hint);
-
- if (idx == -1) {
- gf_log ("poll", GF_LOG_ERROR,
- "index not found for fd=%d (idx_hint=%d)",
- fd, idx_hint);
- errno = ENOENT;
- goto unlock;
- }
-
- switch (poll_in) {
- case 1:
- event_pool->reg[idx].events |= POLLIN;
- break;
- case 0:
- event_pool->reg[idx].events &= ~POLLIN;
- break;
- case -1:
- /* do nothing */
- break;
- default:
- /* TODO: log error */
- break;
- }
-
- switch (poll_out) {
- case 1:
- event_pool->reg[idx].events |= POLLOUT;
- break;
- case 0:
- event_pool->reg[idx].events &= ~POLLOUT;
- break;
- case -1:
- /* do nothing */
- break;
- default:
- /* TODO: log error */
- break;
- }
-
- if (poll_in + poll_out > -2)
- event_pool->changed = 1;
- }
+ int idx = -1;
+
+ if (event_pool == NULL) {
+ gf_log ("event", GF_LOG_ERROR, "invalid argument");
+ return -1;
+ }
+
+ pthread_mutex_lock (&event_pool->mutex);
+ {
+ idx = __event_getindex (event_pool, fd, idx_hint);
+
+ if (idx == -1) {
+ gf_log ("poll", GF_LOG_ERROR,
+ "index not found for fd=%d (idx_hint=%d)",
+ fd, idx_hint);
+ errno = ENOENT;
+ goto unlock;
+ }
+
+ switch (poll_in) {
+ case 1:
+ event_pool->reg[idx].events |= POLLIN;
+ break;
+ case 0:
+ event_pool->reg[idx].events &= ~POLLIN;
+ break;
+ case -1:
+ /* do nothing */
+ break;
+ default:
+ /* TODO: log error */
+ break;
+ }
+
+ switch (poll_out) {
+ case 1:
+ event_pool->reg[idx].events |= POLLOUT;
+ break;
+ case 0:
+ event_pool->reg[idx].events &= ~POLLOUT;
+ break;
+ case -1:
+ /* do nothing */
+ break;
+ default:
+ /* TODO: log error */
+ break;
+ }
+
+ if (poll_in + poll_out > -2)
+ event_pool->changed = 1;
+ }
unlock:
- pthread_mutex_unlock (&event_pool->mutex);
+ pthread_mutex_unlock (&event_pool->mutex);
- return idx;
+ return idx;
}
static int
event_dispatch_poll_handler (struct event_pool *event_pool,
- struct pollfd *ufds, int i)
+ struct pollfd *ufds, int i)
{
- event_handler_t handler = NULL;
- void *data = NULL;
- int idx = -1;
- int ret = 0;
-
- handler = NULL;
- data = NULL;
-
- pthread_mutex_lock (&event_pool->mutex);
- {
- idx = __event_getindex (event_pool, ufds[i].fd, i);
-
- if (idx == -1) {
- gf_log ("poll", GF_LOG_ERROR,
- "index not found for fd=%d (idx_hint=%d)",
- ufds[i].fd, i);
- goto unlock;
- }
-
- handler = event_pool->reg[idx].handler;
- data = event_pool->reg[idx].data;
- }
+ event_handler_t handler = NULL;
+ void *data = NULL;
+ int idx = -1;
+ int ret = 0;
+
+ handler = NULL;
+ data = NULL;
+
+ pthread_mutex_lock (&event_pool->mutex);
+ {
+ idx = __event_getindex (event_pool, ufds[i].fd, i);
+
+ if (idx == -1) {
+ gf_log ("poll", GF_LOG_ERROR,
+ "index not found for fd=%d (idx_hint=%d)",
+ ufds[i].fd, i);
+ goto unlock;
+ }
+
+ handler = event_pool->reg[idx].handler;
+ data = event_pool->reg[idx].data;
+ }
unlock:
- pthread_mutex_unlock (&event_pool->mutex);
+ pthread_mutex_unlock (&event_pool->mutex);
- if (handler)
- ret = handler (ufds[i].fd, idx, data,
- (ufds[i].revents & (POLLIN|POLLPRI)),
- (ufds[i].revents & (POLLOUT)),
- (ufds[i].revents & (POLLERR|POLLHUP|POLLNVAL)));
+ if (handler)
+ ret = handler (ufds[i].fd, idx, data,
+ (ufds[i].revents & (POLLIN|POLLPRI)),
+ (ufds[i].revents & (POLLOUT)),
+ (ufds[i].revents & (POLLERR|POLLHUP|POLLNVAL)));
- return ret;
+ return ret;
}
static int
event_dispatch_poll_resize (struct event_pool *event_pool,
- struct pollfd *ufds, int size)
+ struct pollfd *ufds, int size)
{
- int i = 0;
+ int i = 0;
- pthread_mutex_lock (&event_pool->mutex);
- {
- if (event_pool->changed == 0) {
- goto unlock;
- }
+ pthread_mutex_lock (&event_pool->mutex);
+ {
+ if (event_pool->changed == 0) {
+ goto unlock;
+ }
- if (event_pool->used > event_pool->evcache_size) {
- if (event_pool->evcache)
- GF_FREE (event_pool->evcache);
+ if (event_pool->used > event_pool->evcache_size) {
+ if (event_pool->evcache)
+ GF_FREE (event_pool->evcache);
- event_pool->evcache = ufds = NULL;
+ event_pool->evcache = ufds = NULL;
- event_pool->evcache_size = event_pool->used;
+ event_pool->evcache_size = event_pool->used;
- ufds = GF_CALLOC (sizeof (struct pollfd),
- event_pool->evcache_size,
+ ufds = GF_CALLOC (sizeof (struct pollfd),
+ event_pool->evcache_size,
gf_common_mt_pollfd);
if (!ufds)
goto unlock;
- event_pool->evcache = ufds;
- }
+ event_pool->evcache = ufds;
+ }
- for (i = 0; i < event_pool->used; i++) {
- ufds[i].fd = event_pool->reg[i].fd;
- ufds[i].events = event_pool->reg[i].events;
- ufds[i].revents = 0;
- }
+ for (i = 0; i < event_pool->used; i++) {
+ ufds[i].fd = event_pool->reg[i].fd;
+ ufds[i].events = event_pool->reg[i].events;
+ ufds[i].revents = 0;
+ }
- size = i;
- }
+ size = i;
+ }
unlock:
- pthread_mutex_unlock (&event_pool->mutex);
+ pthread_mutex_unlock (&event_pool->mutex);
- return size;
+ return size;
}
static int
event_dispatch_poll (struct event_pool *event_pool)
{
- struct pollfd *ufds = NULL;
- int size = 0;
- int i = 0;
- int ret = -1;
+ struct pollfd *ufds = NULL;
+ int size = 0;
+ int i = 0;
+ int ret = -1;
- if (event_pool == NULL) {
- gf_log ("event", GF_LOG_ERROR, "invalid argument");
- return -1;
- }
-
- while (1) {
- size = event_dispatch_poll_resize (event_pool, ufds, size);
- ufds = event_pool->evcache;
+ if (event_pool == NULL) {
+ gf_log ("event", GF_LOG_ERROR, "invalid argument");
+ return -1;
+ }
- ret = poll (ufds, size, 1);
+ while (1) {
+ size = event_dispatch_poll_resize (event_pool, ufds, size);
+ ufds = event_pool->evcache;
- if (ret == 0)
- /* timeout */
- continue;
+ ret = poll (ufds, size, 1);
- if (ret == -1 && errno == EINTR)
- /* sys call */
- continue;
+ if (ret == 0)
+ /* timeout */
+ continue;
- for (i = 0; i < size; i++) {
- if (!ufds[i].revents)
- continue;
+ if (ret == -1 && errno == EINTR)
+ /* sys call */
+ continue;
- event_dispatch_poll_handler (event_pool, ufds, i);
- }
- }
+ for (i = 0; i < size; i++) {
+ if (!ufds[i].revents)
+ continue;
- return -1;
+ event_dispatch_poll_handler (event_pool, ufds, i);
+ }
+ }
+
+ return -1;
}
static struct event_ops event_ops_poll = {
- .new = event_pool_new_poll,
- .event_register = event_register_poll,
- .event_select_on = event_select_on_poll,
- .event_unregister = event_unregister_poll,
- .event_dispatch = event_dispatch_poll
+ .new = event_pool_new_poll,
+ .event_register = event_register_poll,
+ .event_select_on = event_select_on_poll,
+ .event_unregister = event_unregister_poll,
+ .event_dispatch = event_dispatch_poll
};
@@ -482,412 +482,412 @@ static struct event_ops event_ops_poll = {
static struct event_pool *
event_pool_new_epoll (int count)
{
- struct event_pool *event_pool = NULL;
- int epfd = -1;
+ struct event_pool *event_pool = NULL;
+ int epfd = -1;
- event_pool = GF_CALLOC (1, sizeof (*event_pool),
+ event_pool = GF_CALLOC (1, sizeof (*event_pool),
gf_common_mt_event_pool);
- if (!event_pool)
- return NULL;
+ if (!event_pool)
+ return NULL;
- event_pool->count = count;
- event_pool->reg = GF_CALLOC (event_pool->count,
- sizeof (*event_pool->reg),
- gf_common_mt_reg);
+ event_pool->count = count;
+ event_pool->reg = GF_CALLOC (event_pool->count,
+ sizeof (*event_pool->reg),
+ gf_common_mt_reg);
- if (!event_pool->reg) {
- gf_log ("epoll", GF_LOG_CRITICAL,
- "event registry allocation failed");
- GF_FREE (event_pool);
- return NULL;
- }
+ if (!event_pool->reg) {
+ gf_log ("epoll", GF_LOG_CRITICAL,
+ "event registry allocation failed");
+ GF_FREE (event_pool);
+ return NULL;
+ }
- epfd = epoll_create (count);
+ epfd = epoll_create (count);
- if (epfd == -1) {
- gf_log ("epoll", GF_LOG_ERROR, "epoll fd creation failed (%s)",
- strerror (errno));
- GF_FREE (event_pool->reg);
- GF_FREE (event_pool);
- return NULL;
- }
+ if (epfd == -1) {
+ gf_log ("epoll", GF_LOG_ERROR, "epoll fd creation failed (%s)",
+ strerror (errno));
+ GF_FREE (event_pool->reg);
+ GF_FREE (event_pool);
+ return NULL;
+ }
- event_pool->fd = epfd;
+ event_pool->fd = epfd;
- event_pool->count = count;
+ event_pool->count = count;
- pthread_mutex_init (&event_pool->mutex, NULL);
- pthread_cond_init (&event_pool->cond, NULL);
+ pthread_mutex_init (&event_pool->mutex, NULL);
+ pthread_cond_init (&event_pool->cond, NULL);
- return event_pool;
+ return event_pool;
}
int
event_register_epoll (struct event_pool *event_pool, int fd,
- event_handler_t handler,
- void *data, int poll_in, int poll_out)
+ event_handler_t handler,
+ void *data, int poll_in, int poll_out)
{
- int idx = -1;
- int ret = -1;
- struct epoll_event epoll_event = {0, };
- struct event_data *ev_data = (void *)&epoll_event.data;
-
-
- if (event_pool == NULL) {
- gf_log ("event", GF_LOG_ERROR, "invalid argument");
- return -1;
- }
-
- pthread_mutex_lock (&event_pool->mutex);
- {
- if (event_pool->count == event_pool->used) {
- event_pool->count *= 2;
-
- event_pool->reg = GF_REALLOC (event_pool->reg,
- event_pool->count *
- sizeof (*event_pool->reg));
-
- if (!event_pool->reg) {
- gf_log ("epoll", GF_LOG_ERROR,
- "event registry re-allocation failed");
- goto unlock;
- }
- }
-
- idx = event_pool->used;
- event_pool->used++;
-
- event_pool->reg[idx].fd = fd;
- event_pool->reg[idx].events = EPOLLPRI;
- event_pool->reg[idx].handler = handler;
- event_pool->reg[idx].data = data;
-
- switch (poll_in) {
- case 1:
- event_pool->reg[idx].events |= EPOLLIN;
- break;
- case 0:
- event_pool->reg[idx].events &= ~EPOLLIN;
- break;
- case -1:
- /* do nothing */
- break;
- default:
- gf_log ("epoll", GF_LOG_ERROR,
- "invalid poll_in value %d", poll_in);
- break;
- }
-
- switch (poll_out) {
- case 1:
- event_pool->reg[idx].events |= EPOLLOUT;
- break;
- case 0:
- event_pool->reg[idx].events &= ~EPOLLOUT;
- break;
- case -1:
- /* do nothing */
- break;
- default:
- gf_log ("epoll", GF_LOG_ERROR,
- "invalid poll_out value %d", poll_out);
- break;
- }
-
- event_pool->changed = 1;
-
- epoll_event.events = event_pool->reg[idx].events;
- ev_data->fd = fd;
- ev_data->idx = idx;
-
- ret = epoll_ctl (event_pool->fd, EPOLL_CTL_ADD, fd,
- &epoll_event);
-
- if (ret == -1) {
- gf_log ("epoll", GF_LOG_ERROR,
- "failed to add fd(=%d) to epoll fd(=%d) (%s)",
- fd, event_pool->fd, strerror (errno));
- goto unlock;
- }
-
- pthread_cond_broadcast (&event_pool->cond);
- }
+ int idx = -1;
+ int ret = -1;
+ struct epoll_event epoll_event = {0, };
+ struct event_data *ev_data = (void *)&epoll_event.data;
+
+
+ if (event_pool == NULL) {
+ gf_log ("event", GF_LOG_ERROR, "invalid argument");
+ return -1;
+ }
+
+ pthread_mutex_lock (&event_pool->mutex);
+ {
+ if (event_pool->count == event_pool->used) {
+ event_pool->count *= 2;
+
+ event_pool->reg = GF_REALLOC (event_pool->reg,
+ event_pool->count *
+ sizeof (*event_pool->reg));
+
+ if (!event_pool->reg) {
+ gf_log ("epoll", GF_LOG_ERROR,
+ "event registry re-allocation failed");
+ goto unlock;
+ }
+ }
+
+ idx = event_pool->used;
+ event_pool->used++;
+
+ event_pool->reg[idx].fd = fd;
+ event_pool->reg[idx].events = EPOLLPRI;
+ event_pool->reg[idx].handler = handler;
+ event_pool->reg[idx].data = data;
+
+ switch (poll_in) {
+ case 1:
+ event_pool->reg[idx].events |= EPOLLIN;
+ break;
+ case 0:
+ event_pool->reg[idx].events &= ~EPOLLIN;
+ break;
+ case -1:
+ /* do nothing */
+ break;
+ default:
+ gf_log ("epoll", GF_LOG_ERROR,
+ "invalid poll_in value %d", poll_in);
+ break;
+ }
+
+ switch (poll_out) {
+ case 1:
+ event_pool->reg[idx].events |= EPOLLOUT;
+ break;
+ case 0:
+ event_pool->reg[idx].events &= ~EPOLLOUT;
+ break;
+ case -1:
+ /* do nothing */
+ break;
+ default:
+ gf_log ("epoll", GF_LOG_ERROR,
+ "invalid poll_out value %d", poll_out);
+ break;
+ }
+
+ event_pool->changed = 1;
+
+ epoll_event.events = event_pool->reg[idx].events;
+ ev_data->fd = fd;
+ ev_data->idx = idx;
+
+ ret = epoll_ctl (event_pool->fd, EPOLL_CTL_ADD, fd,
+ &epoll_event);
+
+ if (ret == -1) {
+ gf_log ("epoll", GF_LOG_ERROR,
+ "failed to add fd(=%d) to epoll fd(=%d) (%s)",
+ fd, event_pool->fd, strerror (errno));
+ goto unlock;
+ }
+
+ pthread_cond_broadcast (&event_pool->cond);
+ }
unlock:
- pthread_mutex_unlock (&event_pool->mutex);
+ pthread_mutex_unlock (&event_pool->mutex);
- return ret;
+ return ret;
}
static int
event_unregister_epoll (struct event_pool *event_pool, int fd, int idx_hint)
{
- int idx = -1;
- int ret = -1;
-
- struct epoll_event epoll_event = {0, };
- struct event_data *ev_data = (void *)&epoll_event.data;
- int lastidx = -1;
-
- if (event_pool == NULL) {
- gf_log ("event", GF_LOG_ERROR, "invalid argument");
- return -1;
- }
-
- pthread_mutex_lock (&event_pool->mutex);
- {
- idx = __event_getindex (event_pool, fd, idx_hint);
-
- if (idx == -1) {
- gf_log ("epoll", GF_LOG_ERROR,
- "index not found for fd=%d (idx_hint=%d)",
- fd, idx_hint);
- errno = ENOENT;
- goto unlock;
- }
-
- ret = epoll_ctl (event_pool->fd, EPOLL_CTL_DEL, fd, NULL);
-
- /* if ret is -1, this array member should never be accessed */
- /* if it is 0, the array member might be used by idx_cache
- * in which case the member should not be accessed till
- * it is reallocated
- */
-
- event_pool->reg[idx].fd = -1;
-
- if (ret == -1) {
- gf_log ("epoll", GF_LOG_ERROR,
- "fail to del fd(=%d) from epoll fd(=%d) (%s)",
- fd, event_pool->fd, strerror (errno));
- goto unlock;
- }
-
- lastidx = event_pool->used - 1;
- if (lastidx == idx) {
- event_pool->used--;
- goto unlock;
- }
-
- epoll_event.events = event_pool->reg[lastidx].events;
- ev_data->fd = event_pool->reg[lastidx].fd;
- ev_data->idx = idx;
-
- ret = epoll_ctl (event_pool->fd, EPOLL_CTL_MOD, ev_data->fd,
- &epoll_event);
- if (ret == -1) {
- gf_log ("epoll", GF_LOG_ERROR,
- "fail to modify fd(=%d) index %d to %d (%s)",
- ev_data->fd, event_pool->used, idx,
- strerror (errno));
- goto unlock;
- }
-
- /* just replace the unregistered idx by last one */
- event_pool->reg[idx] = event_pool->reg[lastidx];
- event_pool->used--;
- }
+ int idx = -1;
+ int ret = -1;
+
+ struct epoll_event epoll_event = {0, };
+ struct event_data *ev_data = (void *)&epoll_event.data;
+ int lastidx = -1;
+
+ if (event_pool == NULL) {
+ gf_log ("event", GF_LOG_ERROR, "invalid argument");
+ return -1;
+ }
+
+ pthread_mutex_lock (&event_pool->mutex);
+ {
+ idx = __event_getindex (event_pool, fd, idx_hint);
+
+ if (idx == -1) {
+ gf_log ("epoll", GF_LOG_ERROR,
+ "index not found for fd=%d (idx_hint=%d)",
+ fd, idx_hint);
+ errno = ENOENT;
+ goto unlock;
+ }
+
+ ret = epoll_ctl (event_pool->fd, EPOLL_CTL_DEL, fd, NULL);
+
+ /* if ret is -1, this array member should never be accessed */
+ /* if it is 0, the array member might be used by idx_cache
+ * in which case the member should not be accessed till
+ * it is reallocated
+ */
+
+ event_pool->reg[idx].fd = -1;
+
+ if (ret == -1) {
+ gf_log ("epoll", GF_LOG_ERROR,
+ "fail to del fd(=%d) from epoll fd(=%d) (%s)",
+ fd, event_pool->fd, strerror (errno));
+ goto unlock;
+ }
+
+ lastidx = event_pool->used - 1;
+ if (lastidx == idx) {
+ event_pool->used--;
+ goto unlock;
+ }
+
+ epoll_event.events = event_pool->reg[lastidx].events;
+ ev_data->fd = event_pool->reg[lastidx].fd;
+ ev_data->idx = idx;
+
+ ret = epoll_ctl (event_pool->fd, EPOLL_CTL_MOD, ev_data->fd,
+ &epoll_event);
+ if (ret == -1) {
+ gf_log ("epoll", GF_LOG_ERROR,
+ "fail to modify fd(=%d) index %d to %d (%s)",
+ ev_data->fd, event_pool->used, idx,
+ strerror (errno));
+ goto unlock;
+ }
+
+ /* just replace the unregistered idx by last one */
+ event_pool->reg[idx] = event_pool->reg[lastidx];
+ event_pool->used--;
+ }
unlock:
- pthread_mutex_unlock (&event_pool->mutex);
+ pthread_mutex_unlock (&event_pool->mutex);
- return ret;
+ return ret;
}
static int
event_select_on_epoll (struct event_pool *event_pool, int fd, int idx_hint,
- int poll_in, int poll_out)
+ int poll_in, int poll_out)
{
- int idx = -1;
- int ret = -1;
-
- struct epoll_event epoll_event = {0, };
- struct event_data *ev_data = (void *)&epoll_event.data;
-
-
- if (event_pool == NULL) {
- gf_log ("event", GF_LOG_ERROR, "invalid argument");
- return -1;
- }
-
- pthread_mutex_lock (&event_pool->mutex);
- {
- idx = __event_getindex (event_pool, fd, idx_hint);
-
- if (idx == -1) {
- gf_log ("epoll", GF_LOG_ERROR,
- "index not found for fd=%d (idx_hint=%d)",
- fd, idx_hint);
- errno = ENOENT;
- goto unlock;
- }
-
- switch (poll_in) {
- case 1:
- event_pool->reg[idx].events |= EPOLLIN;
- break;
- case 0:
- event_pool->reg[idx].events &= ~EPOLLIN;
- break;
- case -1:
- /* do nothing */
- break;
- default:
- gf_log ("epoll", GF_LOG_ERROR,
- "invalid poll_in value %d", poll_in);
- break;
- }
-
- switch (poll_out) {
- case 1:
- event_pool->reg[idx].events |= EPOLLOUT;
- break;
- case 0:
- event_pool->reg[idx].events &= ~EPOLLOUT;
- break;
- case -1:
- /* do nothing */
- break;
- default:
- gf_log ("epoll", GF_LOG_ERROR,
- "invalid poll_out value %d", poll_out);
- break;
- }
-
- epoll_event.events = event_pool->reg[idx].events;
- ev_data->fd = fd;
- ev_data->idx = idx;
-
- ret = epoll_ctl (event_pool->fd, EPOLL_CTL_MOD, fd,
- &epoll_event);
- if (ret == -1) {
- gf_log ("epoll", GF_LOG_ERROR,
- "failed to modify fd(=%d) events to %d",
- fd, epoll_event.events);
- }
- }
+ int idx = -1;
+ int ret = -1;
+
+ struct epoll_event epoll_event = {0, };
+ struct event_data *ev_data = (void *)&epoll_event.data;
+
+
+ if (event_pool == NULL) {
+ gf_log ("event", GF_LOG_ERROR, "invalid argument");
+ return -1;
+ }
+
+ pthread_mutex_lock (&event_pool->mutex);
+ {
+ idx = __event_getindex (event_pool, fd, idx_hint);
+
+ if (idx == -1) {
+ gf_log ("epoll", GF_LOG_ERROR,
+ "index not found for fd=%d (idx_hint=%d)",
+ fd, idx_hint);
+ errno = ENOENT;
+ goto unlock;
+ }
+
+ switch (poll_in) {
+ case 1:
+ event_pool->reg[idx].events |= EPOLLIN;
+ break;
+ case 0:
+ event_pool->reg[idx].events &= ~EPOLLIN;
+ break;
+ case -1:
+ /* do nothing */
+ break;
+ default:
+ gf_log ("epoll", GF_LOG_ERROR,
+ "invalid poll_in value %d", poll_in);
+ break;
+ }
+
+ switch (poll_out) {
+ case 1:
+ event_pool->reg[idx].events |= EPOLLOUT;
+ break;
+ case 0:
+ event_pool->reg[idx].events &= ~EPOLLOUT;
+ break;
+ case -1:
+ /* do nothing */
+ break;
+ default:
+ gf_log ("epoll", GF_LOG_ERROR,
+ "invalid poll_out value %d", poll_out);
+ break;
+ }
+
+ epoll_event.events = event_pool->reg[idx].events;
+ ev_data->fd = fd;
+ ev_data->idx = idx;
+
+ ret = epoll_ctl (event_pool->fd, EPOLL_CTL_MOD, fd,
+ &epoll_event);
+ if (ret == -1) {
+ gf_log ("epoll", GF_LOG_ERROR,
+ "failed to modify fd(=%d) events to %d",
+ fd, epoll_event.events);
+ }
+ }
unlock:
- pthread_mutex_unlock (&event_pool->mutex);
+ pthread_mutex_unlock (&event_pool->mutex);
- return ret;
+ return ret;
}
static int
event_dispatch_epoll_handler (struct event_pool *event_pool,
- struct epoll_event *events, int i)
+ struct epoll_event *events, int i)
{
- struct event_data *event_data = NULL;
- event_handler_t handler = NULL;
- void *data = NULL;
- int idx = -1;
- int ret = -1;
-
-
- event_data = (void *)&events[i].data;
- handler = NULL;
- data = NULL;
-
- pthread_mutex_lock (&event_pool->mutex);
- {
- idx = __event_getindex (event_pool, event_data->fd,
- event_data->idx);
-
- if (idx == -1) {
- gf_log ("epoll", GF_LOG_ERROR,
- "index not found for fd(=%d) (idx_hint=%d)",
- event_data->fd, event_data->idx);
- goto unlock;
- }
-
- handler = event_pool->reg[idx].handler;
- data = event_pool->reg[idx].data;
- }
+ struct event_data *event_data = NULL;
+ event_handler_t handler = NULL;
+ void *data = NULL;
+ int idx = -1;
+ int ret = -1;
+
+
+ event_data = (void *)&events[i].data;
+ handler = NULL;
+ data = NULL;
+
+ pthread_mutex_lock (&event_pool->mutex);
+ {
+ idx = __event_getindex (event_pool, event_data->fd,
+ event_data->idx);
+
+ if (idx == -1) {
+ gf_log ("epoll", GF_LOG_ERROR,
+ "index not found for fd(=%d) (idx_hint=%d)",
+ event_data->fd, event_data->idx);
+ goto unlock;
+ }
+
+ handler = event_pool->reg[idx].handler;
+ data = event_pool->reg[idx].data;
+ }
unlock:
- pthread_mutex_unlock (&event_pool->mutex);
-
- if (handler)
- ret = handler (event_data->fd, event_data->idx, data,
- (events[i].events & (EPOLLIN|EPOLLPRI)),
- (events[i].events & (EPOLLOUT)),
- (events[i].events & (EPOLLERR|EPOLLHUP)));
- return ret;
+ pthread_mutex_unlock (&event_pool->mutex);
+
+ if (handler)
+ ret = handler (event_data->fd, event_data->idx, data,
+ (events[i].events & (EPOLLIN|EPOLLPRI)),
+ (events[i].events & (EPOLLOUT)),
+ (events[i].events & (EPOLLERR|EPOLLHUP)));
+ return ret;
}
static int
event_dispatch_epoll (struct event_pool *event_pool)
{
- struct epoll_event *events = NULL;
- int size = 0;
- int i = 0;
- int ret = -1;
-
-
- if (event_pool == NULL) {
- gf_log ("event", GF_LOG_ERROR, "invalid argument");
- return -1;
- }
-
- while (1) {
- pthread_mutex_lock (&event_pool->mutex);
- {
- while (event_pool->used == 0)
- pthread_cond_wait (&event_pool->cond,
- &event_pool->mutex);
-
- if (event_pool->used > event_pool->evcache_size) {
- if (event_pool->evcache)
- GF_FREE (event_pool->evcache);
-
- event_pool->evcache = events = NULL;
-
- event_pool->evcache_size =
- event_pool->used + 256;
-
- events = GF_CALLOC (event_pool->evcache_size,
- sizeof (struct epoll_event),
+ struct epoll_event *events = NULL;
+ int size = 0;
+ int i = 0;
+ int ret = -1;
+
+
+ if (event_pool == NULL) {
+ gf_log ("event", GF_LOG_ERROR, "invalid argument");
+ return -1;
+ }
+
+ while (1) {
+ pthread_mutex_lock (&event_pool->mutex);
+ {
+ while (event_pool->used == 0)
+ pthread_cond_wait (&event_pool->cond,
+ &event_pool->mutex);
+
+ if (event_pool->used > event_pool->evcache_size) {
+ if (event_pool->evcache)
+ GF_FREE (event_pool->evcache);
+
+ event_pool->evcache = events = NULL;
+
+ event_pool->evcache_size =
+ event_pool->used + 256;
+
+ events = GF_CALLOC (event_pool->evcache_size,
+ sizeof (struct epoll_event),
gf_common_mt_epoll_event);
- event_pool->evcache = events;
- }
- }
- pthread_mutex_unlock (&event_pool->mutex);
+ event_pool->evcache = events;
+ }
+ }
+ pthread_mutex_unlock (&event_pool->mutex);
- ret = epoll_wait (event_pool->fd, event_pool->evcache,
- event_pool->evcache_size, -1);
+ ret = epoll_wait (event_pool->fd, event_pool->evcache,
+ event_pool->evcache_size, -1);
- if (ret == 0)
- /* timeout */
- continue;
+ if (ret == 0)
+ /* timeout */
+ continue;
- if (ret == -1 && errno == EINTR)
- /* sys call */
- continue;
+ if (ret == -1 && errno == EINTR)
+ /* sys call */
+ continue;
- size = ret;
+ size = ret;
- for (i = 0; i < size; i++) {
- if (!events || !events[i].events)
- continue;
+ for (i = 0; i < size; i++) {
+ if (!events || !events[i].events)
+ continue;
- ret = event_dispatch_epoll_handler (event_pool,
- events, i);
- }
- }
+ ret = event_dispatch_epoll_handler (event_pool,
+ events, i);
+ }
+ }
- return -1;
+ return -1;
}
static struct event_ops event_ops_epoll = {
- .new = event_pool_new_epoll,
- .event_register = event_register_epoll,
- .event_select_on = event_select_on_epoll,
- .event_unregister = event_unregister_epoll,
- .event_dispatch = event_dispatch_epoll
+ .new = event_pool_new_epoll,
+ .event_register = event_register_epoll,
+ .event_select_on = event_select_on_epoll,
+ .event_unregister = event_unregister_epoll,
+ .event_dispatch = event_dispatch_epoll
};
#endif
@@ -896,92 +896,92 @@ static struct event_ops event_ops_epoll = {
struct event_pool *
event_pool_new (int count)
{
- struct event_pool *event_pool = NULL;
+ struct event_pool *event_pool = NULL;
#ifdef HAVE_SYS_EPOLL_H
- event_pool = event_ops_epoll.new (count);
-
- if (event_pool) {
- event_pool->ops = &event_ops_epoll;
- } else {
- gf_log ("event", GF_LOG_WARNING,
- "failing back to poll based event handling");
- }
+ event_pool = event_ops_epoll.new (count);
+
+ if (event_pool) {
+ event_pool->ops = &event_ops_epoll;
+ } else {
+ gf_log ("event", GF_LOG_WARNING,
+ "failing back to poll based event handling");
+ }
#endif
- if (!event_pool) {
- event_pool = event_ops_poll.new (count);
+ if (!event_pool) {
+ event_pool = event_ops_poll.new (count);
- if (event_pool)
- event_pool->ops = &event_ops_poll;
- }
+ if (event_pool)
+ event_pool->ops = &event_ops_poll;
+ }
- return event_pool;
+ return event_pool;
}
int
event_register (struct event_pool *event_pool, int fd,
- event_handler_t handler,
- void *data, int poll_in, int poll_out)
+ event_handler_t handler,
+ void *data, int poll_in, int poll_out)
{
- int ret = -1;
-
- if (event_pool == NULL) {
- gf_log ("event", GF_LOG_ERROR, "invalid argument");
- return -1;
- }
-
- ret = event_pool->ops->event_register (event_pool, fd, handler, data,
- poll_in, poll_out);
- return ret;
+ int ret = -1;
+
+ if (event_pool == NULL) {
+ gf_log ("event", GF_LOG_ERROR, "invalid argument");
+ return -1;
+ }
+
+ ret = event_pool->ops->event_register (event_pool, fd, handler, data,
+ poll_in, poll_out);
+ return ret;
}
int
event_unregister (struct event_pool *event_pool, int fd, int idx)
{
- int ret = -1;
+ int ret = -1;
+
+ if (event_pool == NULL) {
+ gf_log ("event", GF_LOG_ERROR, "invalid argument");
+ return -1;
+ }
- if (event_pool == NULL) {
- gf_log ("event", GF_LOG_ERROR, "invalid argument");
- return -1;
- }
-
- ret = event_pool->ops->event_unregister (event_pool, fd, idx);
+ ret = event_pool->ops->event_unregister (event_pool, fd, idx);
- return ret;
+ return ret;
}
int
event_select_on (struct event_pool *event_pool, int fd, int idx_hint,
- int poll_in, int poll_out)
+ int poll_in, int poll_out)
{
- int ret = -1;
-
- if (event_pool == NULL) {
- gf_log ("event", GF_LOG_ERROR, "invalid argument");
- return -1;
- }
-
- ret = event_pool->ops->event_select_on (event_pool, fd, idx_hint,
- poll_in, poll_out);
- return ret;
+ int ret = -1;
+
+ if (event_pool == NULL) {
+ gf_log ("event", GF_LOG_ERROR, "invalid argument");
+ return -1;
+ }
+
+ ret = event_pool->ops->event_select_on (event_pool, fd, idx_hint,
+ poll_in, poll_out);
+ return ret;
}
int
event_dispatch (struct event_pool *event_pool)
{
- int ret = -1;
+ int ret = -1;
+
+ if (event_pool == NULL) {
+ gf_log ("event", GF_LOG_ERROR, "invalid argument");
+ return -1;
+ }
- if (event_pool == NULL) {
- gf_log ("event", GF_LOG_ERROR, "invalid argument");
- return -1;
- }
-
- ret = event_pool->ops->event_dispatch (event_pool);
+ ret = event_pool->ops->event_dispatch (event_pool);
- return ret;
+ return ret;
}
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c
index def15255728..b793eaae1f2 100644
--- a/libglusterfs/src/fd.c
+++ b/libglusterfs/src/fd.c
@@ -38,8 +38,8 @@ fd_t *
_fd_ref (fd_t *fd);
/*
- Allocate in memory chunks of power of 2 starting from 1024B
- Assumes fdtable->lock is held
+ Allocate in memory chunks of power of 2 starting from 1024B
+ Assumes fdtable->lock is held
*/
static inline int
gf_roundup_power_of_two (uint32_t nr)
@@ -48,8 +48,8 @@ gf_roundup_power_of_two (uint32_t nr)
if (nr < 0) {
gf_log ("server-protocol/fd",
- GF_LOG_ERROR,
- "Negative number passed");
+ GF_LOG_ERROR,
+ "Negative number passed");
return -1;
}
@@ -85,35 +85,35 @@ gf_fd_chain_fd_entries (fdentry_t *entries, uint32_t startidx,
static int
gf_fd_fdtable_expand (fdtable_t *fdtable, uint32_t nr)
{
- fdentry_t *oldfds = NULL;
- uint32_t oldmax_fds = -1;
+ fdentry_t *oldfds = NULL;
+ uint32_t oldmax_fds = -1;
int ret = -1;
- if (fdtable == NULL || nr < 0) {
- gf_log ("fd", GF_LOG_ERROR, "invalid argument");
+ if (fdtable == NULL || nr < 0) {
+ gf_log ("fd", GF_LOG_ERROR, "invalid argument");
ret = EINVAL;
goto out;
- }
+ }
- nr /= (1024 / sizeof (fdentry_t));
- nr = gf_roundup_power_of_two (nr + 1);
- nr *= (1024 / sizeof (fdentry_t));
+ nr /= (1024 / sizeof (fdentry_t));
+ nr = gf_roundup_power_of_two (nr + 1);
+ nr *= (1024 / sizeof (fdentry_t));
- oldfds = fdtable->fdentries;
- oldmax_fds = fdtable->max_fds;
+ oldfds = fdtable->fdentries;
+ oldmax_fds = fdtable->max_fds;
- fdtable->fdentries = GF_CALLOC (nr, sizeof (fdentry_t),
+ fdtable->fdentries = GF_CALLOC (nr, sizeof (fdentry_t),
gf_common_mt_fdentry_t);
- if (!fdtable->fdentries) {
+ if (!fdtable->fdentries) {
ret = ENOMEM;
goto out;
}
- fdtable->max_fds = nr;
+ fdtable->max_fds = nr;
- if (oldfds) {
- uint32_t cpy = oldmax_fds * sizeof (fdentry_t);
- memcpy (fdtable->fdentries, oldfds, cpy);
- }
+ if (oldfds) {
+ uint32_t cpy = oldmax_fds * sizeof (fdentry_t);
+ memcpy (fdtable->fdentries, oldfds, cpy);
+ }
gf_fd_chain_fd_entries (fdtable->fdentries, oldmax_fds,
fdtable->max_fds);
@@ -123,31 +123,31 @@ gf_fd_fdtable_expand (fdtable_t *fdtable, uint32_t nr)
* using the expanded table.
*/
fdtable->first_free = oldmax_fds;
- GF_FREE (oldfds);
+ GF_FREE (oldfds);
ret = 0;
out:
- return ret;
+ return ret;
}
fdtable_t *
gf_fd_fdtable_alloc (void)
{
- fdtable_t *fdtable = NULL;
+ fdtable_t *fdtable = NULL;
- fdtable = GF_CALLOC (1, sizeof (*fdtable), gf_common_mt_fdtable_t);
- if (!fdtable)
- return NULL;
+ fdtable = GF_CALLOC (1, sizeof (*fdtable), gf_common_mt_fdtable_t);
+ if (!fdtable)
+ return NULL;
- pthread_mutex_init (&fdtable->lock, NULL);
+ pthread_mutex_init (&fdtable->lock, NULL);
- pthread_mutex_lock (&fdtable->lock);
- {
- gf_fd_fdtable_expand (fdtable, 0);
- }
- pthread_mutex_unlock (&fdtable->lock);
+ pthread_mutex_lock (&fdtable->lock);
+ {
+ gf_fd_fdtable_expand (fdtable, 0);
+ }
+ pthread_mutex_unlock (&fdtable->lock);
- return fdtable;
+ return fdtable;
}
@@ -199,15 +199,15 @@ gf_fd_fdtable_destroy (fdtable_t *fdtable)
INIT_LIST_HEAD (&list);
- if (!fdtable)
+ if (!fdtable)
return;
- pthread_mutex_lock (&fdtable->lock);
- {
+ pthread_mutex_lock (&fdtable->lock);
+ {
fdentries = __gf_fd_fdtable_get_all_fds (fdtable, &fd_count);
- GF_FREE (fdtable->fdentries);
- }
- pthread_mutex_unlock (&fdtable->lock);
+ GF_FREE (fdtable->fdentries);
+ }
+ pthread_mutex_unlock (&fdtable->lock);
if (fdentries != NULL) {
for (i = 0; i < fd_count; i++) {
@@ -218,36 +218,36 @@ gf_fd_fdtable_destroy (fdtable_t *fdtable)
}
GF_FREE (fdentries);
- pthread_mutex_destroy (&fdtable->lock);
- GF_FREE (fdtable);
- }
+ pthread_mutex_destroy (&fdtable->lock);
+ GF_FREE (fdtable);
+ }
}
int
gf_fd_unused_get (fdtable_t *fdtable, fd_t *fdptr)
{
- int32_t fd = -1;
+ int32_t fd = -1;
fdentry_t *fde = NULL;
- int error;
+ int error;
int alloc_attempts = 0;
- if (fdtable == NULL || fdptr == NULL)
- {
- gf_log ("fd", GF_LOG_ERROR, "invalid argument");
- return EINVAL;
- }
+ if (fdtable == NULL || fdptr == NULL)
+ {
+ gf_log ("fd", GF_LOG_ERROR, "invalid argument");
+ return EINVAL;
+ }
- pthread_mutex_lock (&fdtable->lock);
- {
-fd_alloc_try_again:
+ pthread_mutex_lock (&fdtable->lock);
+ {
+ fd_alloc_try_again:
if (fdtable->first_free != GF_FDTABLE_END) {
fde = &fdtable->fdentries[fdtable->first_free];
fd = fdtable->first_free;
fdtable->first_free = fde->next_free;
fde->next_free = GF_FDENTRY_ALLOCATED;
fde->fd = fdptr;
- } else {
+ } else {
/* If this is true, there is something
* seriously wrong with our data structures.
*/
@@ -259,12 +259,12 @@ fd_alloc_try_again:
}
error = gf_fd_fdtable_expand (fdtable,
fdtable->max_fds + 1);
- if (error) {
- gf_log ("server-protocol.c",
- GF_LOG_ERROR,
- "Cannot expand fdtable:%s", strerror (error));
+ if (error) {
+ gf_log ("server-protocol.c",
+ GF_LOG_ERROR,
+ "Cannot expand fdtable:%s", strerror (error));
goto out;
- }
+ }
++alloc_attempts;
/* At this point, the table stands expanded
* with the first_free referring to the first
@@ -273,33 +273,33 @@ fd_alloc_try_again:
* above logic should just work.
*/
goto fd_alloc_try_again;
- }
- }
+ }
+ }
out:
- pthread_mutex_unlock (&fdtable->lock);
+ pthread_mutex_unlock (&fdtable->lock);
- return fd;
+ return fd;
}
inline void
gf_fd_put (fdtable_t *fdtable, int32_t fd)
{
- fd_t *fdptr = NULL;
+ fd_t *fdptr = NULL;
fdentry_t *fde = NULL;
- if (fdtable == NULL || fd < 0) {
- gf_log ("fd", GF_LOG_ERROR, "invalid argument");
- return;
- }
+ if (fdtable == NULL || fd < 0) {
+ gf_log ("fd", GF_LOG_ERROR, "invalid argument");
+ return;
+ }
- if (!(fd < fdtable->max_fds)) {
- gf_log ("fd", GF_LOG_ERROR, "invalid argument");
- return;
- }
+ if (!(fd < fdtable->max_fds)) {
+ gf_log ("fd", GF_LOG_ERROR, "invalid argument");
+ return;
+ }
- pthread_mutex_lock (&fdtable->lock);
- {
+ pthread_mutex_lock (&fdtable->lock);
+ {
fde = &fdtable->fdentries[fd];
/* If the entry is not allocated, put operation must return
* without doing anything.
@@ -314,85 +314,85 @@ gf_fd_put (fdtable_t *fdtable, int32_t fd)
fde->fd = NULL;
fde->next_free = fdtable->first_free;
fdtable->first_free = fd;
- }
+ }
unlock_out:
- pthread_mutex_unlock (&fdtable->lock);
+ pthread_mutex_unlock (&fdtable->lock);
- if (fdptr) {
- fd_unref (fdptr);
- }
+ if (fdptr) {
+ fd_unref (fdptr);
+ }
}
fd_t *
gf_fd_fdptr_get (fdtable_t *fdtable, int64_t fd)
{
- fd_t *fdptr = NULL;
-
- if (fdtable == NULL || fd < 0) {
- gf_log ("fd", GF_LOG_ERROR, "invalid argument");
- errno = EINVAL;
- return NULL;
- }
-
- if (!(fd < fdtable->max_fds)) {
- gf_log ("fd", GF_LOG_ERROR, "invalid argument");
- errno = EINVAL;
- return NULL;
- }
-
- pthread_mutex_lock (&fdtable->lock);
- {
- fdptr = fdtable->fdentries[fd].fd;
- if (fdptr) {
- fd_ref (fdptr);
- }
- }
- pthread_mutex_unlock (&fdtable->lock);
-
- return fdptr;
+ fd_t *fdptr = NULL;
+
+ if (fdtable == NULL || fd < 0) {
+ gf_log ("fd", GF_LOG_ERROR, "invalid argument");
+ errno = EINVAL;
+ return NULL;
+ }
+
+ if (!(fd < fdtable->max_fds)) {
+ gf_log ("fd", GF_LOG_ERROR, "invalid argument");
+ errno = EINVAL;
+ return NULL;
+ }
+
+ pthread_mutex_lock (&fdtable->lock);
+ {
+ fdptr = fdtable->fdentries[fd].fd;
+ if (fdptr) {
+ fd_ref (fdptr);
+ }
+ }
+ pthread_mutex_unlock (&fdtable->lock);
+
+ return fdptr;
}
fd_t *
_fd_ref (fd_t *fd)
{
- ++fd->refcount;
+ ++fd->refcount;
- return fd;
+ return fd;
}
fd_t *
fd_ref (fd_t *fd)
{
- fd_t *refed_fd = NULL;
+ fd_t *refed_fd = NULL;
- if (!fd) {
- gf_log ("fd", GF_LOG_ERROR, "@fd=%p", fd);
- return NULL;
- }
+ if (!fd) {
+ gf_log ("fd", GF_LOG_ERROR, "@fd=%p", fd);
+ return NULL;
+ }
- LOCK (&fd->inode->lock);
- refed_fd = _fd_ref (fd);
- UNLOCK (&fd->inode->lock);
+ LOCK (&fd->inode->lock);
+ refed_fd = _fd_ref (fd);
+ UNLOCK (&fd->inode->lock);
- return refed_fd;
+ return refed_fd;
}
fd_t *
_fd_unref (fd_t *fd)
{
- GF_ASSERT (fd->refcount);
+ GF_ASSERT (fd->refcount);
- --fd->refcount;
+ --fd->refcount;
- if (fd->refcount == 0) {
- list_del_init (&fd->inode_list);
- }
+ if (fd->refcount == 0) {
+ list_del_init (&fd->inode_list);
+ }
- return fd;
+ return fd;
}
@@ -400,9 +400,9 @@ static void
fd_destroy (fd_t *fd)
{
xlator_t *xl = NULL;
- int i = 0;
+ int i = 0;
xlator_t *old_THIS = NULL;
- struct mem_pool *tmp_pool = NULL;
+ struct mem_pool *tmp_pool = NULL;
if (fd == NULL){
gf_log ("xlator", GF_LOG_ERROR, "invalid arugument");
@@ -413,42 +413,42 @@ fd_destroy (fd_t *fd)
gf_log ("xlator", GF_LOG_ERROR, "fd->inode is NULL");
goto out;
}
- if (!fd->_ctx)
- goto out;
+ if (!fd->_ctx)
+ goto out;
- tmp_pool = fd->inode->table->fd_mem_pool;
+ tmp_pool = fd->inode->table->fd_mem_pool;
if (IA_ISDIR (fd->inode->ia_type)) {
- for (i = 0; i < fd->xl_count; i++) {
- if (fd->_ctx[i].key) {
- xl = fd->_ctx[i].xl_key;
+ for (i = 0; i < fd->xl_count; i++) {
+ if (fd->_ctx[i].key) {
+ xl = fd->_ctx[i].xl_key;
old_THIS = THIS;
THIS = xl;
- if (xl->cbks->releasedir)
- xl->cbks->releasedir (xl, fd);
+ if (xl->cbks->releasedir)
+ xl->cbks->releasedir (xl, fd);
THIS = old_THIS;
- }
- }
+ }
+ }
} else {
- for (i = 0; i < fd->xl_count; i++) {
- if (fd->_ctx[i].key) {
- xl = fd->_ctx[i].xl_key;
+ for (i = 0; i < fd->xl_count; i++) {
+ if (fd->_ctx[i].key) {
+ xl = fd->_ctx[i].xl_key;
old_THIS = THIS;
THIS = xl;
- if (xl->cbks->release)
- xl->cbks->release (xl, fd);
+ if (xl->cbks->release)
+ xl->cbks->release (xl, fd);
THIS = old_THIS;
- }
- }
+ }
+ }
}
LOCK_DESTROY (&fd->lock);
- GF_FREE (fd->_ctx);
+ GF_FREE (fd->_ctx);
inode_unref (fd->inode);
fd->inode = (inode_t *)0xaaaaaaaa;
mem_put (tmp_pool,fd);
- tmp_pool = NULL;
+ tmp_pool = NULL;
out:
return;
}
@@ -591,7 +591,7 @@ fd_list_empty (inode_t *inode)
int
__fd_ctx_set (fd_t *fd, xlator_t *xlator, uint64_t value)
{
- int index = 0;
+ int index = 0;
int ret = 0;
int set_idx = -1;
@@ -620,7 +620,7 @@ __fd_ctx_set (fd_t *fd, xlator_t *xlator, uint64_t value)
fd->_ctx[set_idx].value1 = value;
out:
- return ret;
+ return ret;
}
@@ -645,11 +645,11 @@ fd_ctx_set (fd_t *fd, xlator_t *xlator, uint64_t value)
int
__fd_ctx_get (fd_t *fd, xlator_t *xlator, uint64_t *value)
{
- int index = 0;
+ int index = 0;
int ret = 0;
- if (!fd || !xlator)
- return -1;
+ if (!fd || !xlator)
+ return -1;
for (index = 0; index < fd->xl_count; index++) {
if (fd->_ctx[index].xl_key == xlator)
@@ -665,7 +665,7 @@ __fd_ctx_get (fd_t *fd, xlator_t *xlator, uint64_t *value)
*value = fd->_ctx[index].value1;
out:
- return ret;
+ return ret;
}
@@ -674,8 +674,8 @@ fd_ctx_get (fd_t *fd, xlator_t *xlator, uint64_t *value)
{
int ret = 0;
- if (!fd || !xlator)
- return -1;
+ if (!fd || !xlator)
+ return -1;
LOCK (&fd->lock);
{
@@ -690,11 +690,11 @@ fd_ctx_get (fd_t *fd, xlator_t *xlator, uint64_t *value)
int
__fd_ctx_del (fd_t *fd, xlator_t *xlator, uint64_t *value)
{
- int index = 0;
+ int index = 0;
int ret = 0;
- if (!fd || !xlator)
- return -1;
+ if (!fd || !xlator)
+ return -1;
for (index = 0; index < fd->xl_count; index++) {
if (fd->_ctx[index].xl_key == xlator)
@@ -713,7 +713,7 @@ __fd_ctx_del (fd_t *fd, xlator_t *xlator, uint64_t *value)
fd->_ctx[index].value1 = 0;
out:
- return ret;
+ return ret;
}
@@ -722,8 +722,8 @@ fd_ctx_del (fd_t *fd, xlator_t *xlator, uint64_t *value)
{
int ret = 0;
- if (!fd || !xlator)
- return -1;
+ if (!fd || !xlator)
+ return -1;
LOCK (&fd->lock);
{
@@ -781,10 +781,10 @@ fdtable_dump (fdtable_t *fdtable, char *prefix)
if (!fdtable)
return;
- ret = pthread_mutex_trylock (&fdtable->lock);
+ ret = pthread_mutex_trylock (&fdtable->lock);
if (ret) {
- gf_log ("fd", GF_LOG_WARNING, "Unable to acquire lock");
+ gf_log ("fd", GF_LOG_WARNING, "Unable to acquire lock");
return;
}
@@ -798,7 +798,7 @@ fdtable_dump (fdtable_t *fdtable, char *prefix)
for ( i = 0 ; i < fdtable->max_fds; i++) {
if (GF_FDENTRY_ALLOCATED ==
- fdtable->fdentries[i].next_free) {
+ fdtable->fdentries[i].next_free) {
gf_proc_dump_build_key(key, prefix, "fdentry[%d]", i);
gf_proc_dump_add_section(key);
fdentry_dump(&fdtable->fdentries[i], key);
@@ -815,7 +815,7 @@ fd_ctx_dump (fd_t *fd, char *prefix)
struct _fd_ctx *fd_ctx = NULL;
xlator_t *xl = NULL;
int i = 0;
-
+
if ((fd == NULL) || (fd->_ctx == NULL)) {
goto out;
@@ -840,7 +840,7 @@ fd_ctx_dump (fd_t *fd, char *prefix)
}
unlock:
UNLOCK (&fd->lock);
-
+
if (fd_ctx == NULL) {
goto out;
}
diff --git a/libglusterfs/src/gf-dirent.c b/libglusterfs/src/gf-dirent.c
index af09cb06c0f..93364758983 100644
--- a/libglusterfs/src/gf-dirent.c
+++ b/libglusterfs/src/gf-dirent.c
@@ -33,51 +33,51 @@
gf_dirent_t *
gf_dirent_for_namelen (int len)
{
- gf_dirent_t *gf_dirent = NULL;
+ gf_dirent_t *gf_dirent = NULL;
- /* TODO: use mem-pool */
- gf_dirent = CALLOC (len, sizeof(char));
- if (!gf_dirent)
- return NULL;
+ /* TODO: use mem-pool */
+ gf_dirent = CALLOC (len, sizeof(char));
+ if (!gf_dirent)
+ return NULL;
- INIT_LIST_HEAD (&gf_dirent->list);
+ INIT_LIST_HEAD (&gf_dirent->list);
- gf_dirent->d_off = 0;
- gf_dirent->d_ino = -1;
- gf_dirent->d_type = 0;
+ gf_dirent->d_off = 0;
+ gf_dirent->d_ino = -1;
+ gf_dirent->d_type = 0;
- return gf_dirent;
+ return gf_dirent;
}
gf_dirent_t *
gf_dirent_for_name (const char *name)
{
- gf_dirent_t *gf_dirent = NULL;
+ gf_dirent_t *gf_dirent = NULL;
- /* TODO: use mem-pool */
- gf_dirent = GF_CALLOC (gf_dirent_size (name), 1,
- gf_common_mt_gf_dirent_t);
- if (!gf_dirent)
- return NULL;
+ /* TODO: use mem-pool */
+ gf_dirent = GF_CALLOC (gf_dirent_size (name), 1,
+ gf_common_mt_gf_dirent_t);
+ if (!gf_dirent)
+ return NULL;
- INIT_LIST_HEAD (&gf_dirent->list);
- strcpy (gf_dirent->d_name, name);
+ INIT_LIST_HEAD (&gf_dirent->list);
+ strcpy (gf_dirent->d_name, name);
- gf_dirent->d_off = 0;
- gf_dirent->d_ino = -1;
- gf_dirent->d_type = 0;
- gf_dirent->d_len = strlen (name);
+ gf_dirent->d_off = 0;
+ gf_dirent->d_ino = -1;
+ gf_dirent->d_type = 0;
+ gf_dirent->d_len = strlen (name);
- return gf_dirent;
+ return gf_dirent;
}
void
gf_dirent_free (gf_dirent_t *entries)
{
- gf_dirent_t *entry = NULL;
- gf_dirent_t *tmp = NULL;
+ gf_dirent_t *entry = NULL;
+ gf_dirent_t *tmp = NULL;
if (!entries)
return;
@@ -85,10 +85,8 @@ gf_dirent_free (gf_dirent_t *entries)
if (list_empty (&entries->list))
return;
- list_for_each_entry_safe (entry, tmp, &entries->list, list) {
- list_del (&entry->list);
- GF_FREE (entry);
- }
+ list_for_each_entry_safe (entry, tmp, &entries->list, list) {
+ list_del (&entry->list);
+ GF_FREE (entry);
+ }
}
-
-
diff --git a/libglusterfs/src/globals.c b/libglusterfs/src/globals.c
index 9e9870e0bf0..10f370b5c53 100644
--- a/libglusterfs/src/globals.c
+++ b/libglusterfs/src/globals.c
@@ -1,20 +1,20 @@
/*
- Copyright (c) 2010 Gluster, Inc. <http://www.gluster.com>
- This file is part of GlusterFS.
-
- GlusterFS is free software; you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation; either version 3 of the License,
- or (at your option) any later version.
-
- GlusterFS 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
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see
- <http://www.gnu.org/licenses/>.
+ Copyright (c) 2010 Gluster, Inc. <http://www.gluster.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
*/
#ifndef _CONFIG_H
@@ -39,54 +39,54 @@ char *gf_mgmt_list[GF_MGMT_MAXVALUE];
void
gf_op_list_init()
{
- gf_fop_list[GF_FOP_NULL] = "NULL";
- gf_fop_list[GF_FOP_STAT] = "STAT";
- gf_fop_list[GF_FOP_READLINK] = "READLINK";
- gf_fop_list[GF_FOP_MKNOD] = "MKNOD";
- gf_fop_list[GF_FOP_MKDIR] = "MKDIR";
- gf_fop_list[GF_FOP_UNLINK] = "UNLINK";
- gf_fop_list[GF_FOP_RMDIR] = "RMDIR";
- gf_fop_list[GF_FOP_SYMLINK] = "SYMLINK";
- gf_fop_list[GF_FOP_RENAME] = "RENAME";
- gf_fop_list[GF_FOP_LINK] = "LINK";
- gf_fop_list[GF_FOP_TRUNCATE] = "TRUNCATE";
- gf_fop_list[GF_FOP_OPEN] = "OPEN";
- gf_fop_list[GF_FOP_READ] = "READ";
- gf_fop_list[GF_FOP_WRITE] = "WRITE";
- gf_fop_list[GF_FOP_STATFS] = "STATFS";
- gf_fop_list[GF_FOP_FLUSH] = "FLUSH";
- gf_fop_list[GF_FOP_FSYNC] = "FSYNC";
- gf_fop_list[GF_FOP_SETXATTR] = "SETXATTR";
- gf_fop_list[GF_FOP_GETXATTR] = "GETXATTR";
- gf_fop_list[GF_FOP_REMOVEXATTR] = "REMOVEXATTR";
- gf_fop_list[GF_FOP_OPENDIR] = "OPENDIR";
- gf_fop_list[GF_FOP_FSYNCDIR] = "FSYNCDIR";
- gf_fop_list[GF_FOP_ACCESS] = "ACCESS";
- gf_fop_list[GF_FOP_CREATE] = "CREATE";
- gf_fop_list[GF_FOP_FTRUNCATE] = "FTRUNCATE";
- gf_fop_list[GF_FOP_FSTAT] = "FSTAT";
- gf_fop_list[GF_FOP_LK] = "LK";
- gf_fop_list[GF_FOP_LOOKUP] = "LOOKUP";
- gf_fop_list[GF_FOP_READDIR] = "READDIR";
- gf_fop_list[GF_FOP_INODELK] = "INODELK";
- gf_fop_list[GF_FOP_FINODELK] = "FINODELK";
- gf_fop_list[GF_FOP_ENTRYLK] = "ENTRYLK";
- gf_fop_list[GF_FOP_FENTRYLK] = "FENTRYLK";
- gf_fop_list[GF_FOP_XATTROP] = "XATTROP";
- gf_fop_list[GF_FOP_FXATTROP] = "FXATTROP";
- gf_fop_list[GF_FOP_FSETXATTR] = "FSETXATTR";
- gf_fop_list[GF_FOP_FGETXATTR] = "FGETXATTR";
+ gf_fop_list[GF_FOP_NULL] = "NULL";
+ gf_fop_list[GF_FOP_STAT] = "STAT";
+ gf_fop_list[GF_FOP_READLINK] = "READLINK";
+ gf_fop_list[GF_FOP_MKNOD] = "MKNOD";
+ gf_fop_list[GF_FOP_MKDIR] = "MKDIR";
+ gf_fop_list[GF_FOP_UNLINK] = "UNLINK";
+ gf_fop_list[GF_FOP_RMDIR] = "RMDIR";
+ gf_fop_list[GF_FOP_SYMLINK] = "SYMLINK";
+ gf_fop_list[GF_FOP_RENAME] = "RENAME";
+ gf_fop_list[GF_FOP_LINK] = "LINK";
+ gf_fop_list[GF_FOP_TRUNCATE] = "TRUNCATE";
+ gf_fop_list[GF_FOP_OPEN] = "OPEN";
+ gf_fop_list[GF_FOP_READ] = "READ";
+ gf_fop_list[GF_FOP_WRITE] = "WRITE";
+ gf_fop_list[GF_FOP_STATFS] = "STATFS";
+ gf_fop_list[GF_FOP_FLUSH] = "FLUSH";
+ gf_fop_list[GF_FOP_FSYNC] = "FSYNC";
+ gf_fop_list[GF_FOP_SETXATTR] = "SETXATTR";
+ gf_fop_list[GF_FOP_GETXATTR] = "GETXATTR";
+ gf_fop_list[GF_FOP_REMOVEXATTR] = "REMOVEXATTR";
+ gf_fop_list[GF_FOP_OPENDIR] = "OPENDIR";
+ gf_fop_list[GF_FOP_FSYNCDIR] = "FSYNCDIR";
+ gf_fop_list[GF_FOP_ACCESS] = "ACCESS";
+ gf_fop_list[GF_FOP_CREATE] = "CREATE";
+ gf_fop_list[GF_FOP_FTRUNCATE] = "FTRUNCATE";
+ gf_fop_list[GF_FOP_FSTAT] = "FSTAT";
+ gf_fop_list[GF_FOP_LK] = "LK";
+ gf_fop_list[GF_FOP_LOOKUP] = "LOOKUP";
+ gf_fop_list[GF_FOP_READDIR] = "READDIR";
+ gf_fop_list[GF_FOP_INODELK] = "INODELK";
+ gf_fop_list[GF_FOP_FINODELK] = "FINODELK";
+ gf_fop_list[GF_FOP_ENTRYLK] = "ENTRYLK";
+ gf_fop_list[GF_FOP_FENTRYLK] = "FENTRYLK";
+ gf_fop_list[GF_FOP_XATTROP] = "XATTROP";
+ gf_fop_list[GF_FOP_FXATTROP] = "FXATTROP";
+ gf_fop_list[GF_FOP_FSETXATTR] = "FSETXATTR";
+ gf_fop_list[GF_FOP_FGETXATTR] = "FGETXATTR";
gf_fop_list[GF_FOP_RCHECKSUM] = "RCHECKSUM";
gf_fop_list[GF_FOP_SETATTR] = "SETATTR";
gf_fop_list[GF_FOP_FSETATTR] = "FSETATTR";
- gf_fop_list[GF_FOP_READDIRP] = "READDIRP";
- gf_fop_list[GF_FOP_GETSPEC] = "GETSPEC";
- gf_fop_list[GF_FOP_FORGET] = "FORGET";
- gf_fop_list[GF_FOP_RELEASE] = "RELEASE";
- gf_fop_list[GF_FOP_RELEASEDIR] = "RELEASEDIR";
-
- gf_fop_list[GF_MGMT_NULL] = "NULL";
- return;
+ gf_fop_list[GF_FOP_READDIRP] = "READDIRP";
+ gf_fop_list[GF_FOP_GETSPEC] = "GETSPEC";
+ gf_fop_list[GF_FOP_FORGET] = "FORGET";
+ gf_fop_list[GF_FOP_RELEASE] = "RELEASE";
+ gf_fop_list[GF_FOP_RELEASEDIR] = "RELEASEDIR";
+
+ gf_fop_list[GF_MGMT_NULL] = "NULL";
+ return;
}
@@ -398,4 +398,3 @@ glusterfs_strevent (glusterfs_event_t ev)
{
return eventstring[ev];
}
-
diff --git a/libglusterfs/src/graph-print.c b/libglusterfs/src/graph-print.c
index 53d8643ee0d..65a36b2640b 100644
--- a/libglusterfs/src/graph-print.c
+++ b/libglusterfs/src/graph-print.c
@@ -93,13 +93,13 @@ gpprintf (struct gf_printer *gp, const char *format, ...)
static int
glusterfs_graph_print (struct gf_printer *gp, glusterfs_graph_t *graph)
{
-#define GPPRINTF(gp, fmt, ...) do { \
- ret = gpprintf (gp, fmt, ## __VA_ARGS__); \
- if (ret == -1) \
- goto out; \
- else \
- len += ret; \
-} while (0)
+#define GPPRINTF(gp, fmt, ...) do { \
+ ret = gpprintf (gp, fmt, ## __VA_ARGS__); \
+ if (ret == -1) \
+ goto out; \
+ else \
+ len += ret; \
+ } while (0)
xlator_t *trav = NULL;
data_pair_t *pair = NULL;
@@ -135,7 +135,7 @@ glusterfs_graph_print (struct gf_printer *gp, glusterfs_graph_t *graph)
GPPRINTF (gp, "\n");
}
- out:
+out:
if (ret == -1) {
gf_log ("graph-print", GF_LOG_ERROR, "printing failed");
@@ -152,7 +152,7 @@ glusterfs_graph_print_file (FILE *file, glusterfs_graph_t *graph)
{
struct gf_printer gp = { .write = gp_write_file,
.priv = file
- };
+ };
return glusterfs_graph_print (&gp, graph);
}
@@ -166,7 +166,7 @@ glusterfs_graph_print_buf (glusterfs_graph_t *graph)
char *buf = NULL;
struct gf_printer gp = { .write = gp_write_buf,
.priv = &iov
- };
+ };
f = fopen ("/dev/null", "a");
if (!f) {
diff --git a/libglusterfs/src/graph.c b/libglusterfs/src/graph.c
index a2d03fa0b64..fb829d48441 100644
--- a/libglusterfs/src/graph.c
+++ b/libglusterfs/src/graph.c
@@ -537,5 +537,3 @@ glusterfs_graph_destroy (glusterfs_graph_t *graph)
{
return 0;
}
-
-
diff --git a/libglusterfs/src/hashfn.c b/libglusterfs/src/hashfn.c
index 98f74188599..b3870712c7a 100644
--- a/libglusterfs/src/hashfn.c
+++ b/libglusterfs/src/hashfn.c
@@ -1,20 +1,20 @@
/*
- Copyright (c) 2006-2010 Gluster, Inc. <http://www.gluster.com>
- This file is part of GlusterFS.
-
- GlusterFS is free software; you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation; either version 3 of the License,
- or (at your option) any later version.
-
- GlusterFS 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
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see
- <http://www.gnu.org/licenses/>.
+ Copyright (c) 2006-2010 Gluster, Inc. <http://www.gluster.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
@@ -31,7 +31,7 @@
#define DM_DELTA 0x9E3779B9
#define DM_FULLROUNDS 10 /* 32 is overkill, 16 is strong crypto */
-#define DM_PARTROUNDS 6 /* 6 gets complete mixing */
+#define DM_PARTROUNDS 6 /* 6 gets complete mixing */
uint32_t
@@ -52,48 +52,48 @@ ReallySimpleHash (char *path, int len)
/* In any case make sure, you return 1 */
uint32_t SuperFastHash (const char * data, int32_t len) {
- uint32_t hash = len, tmp;
- int32_t rem;
-
- if (len <= 1 || data == NULL) return 1;
-
- rem = len & 3;
- len >>= 2;
-
- /* Main loop */
- for (;len > 0; len--) {
- hash += get16bits (data);
- tmp = (get16bits (data+2) << 11) ^ hash;
- hash = (hash << 16) ^ tmp;
- data += 2*sizeof (uint16_t);
- hash += hash >> 11;
- }
-
- /* Handle end cases */
- switch (rem) {
- case 3: hash += get16bits (data);
- hash ^= hash << 16;
- hash ^= data[sizeof (uint16_t)] << 18;
- hash += hash >> 11;
- break;
- case 2: hash += get16bits (data);
- hash ^= hash << 11;
- hash += hash >> 17;
- break;
- case 1: hash += *data;
- hash ^= hash << 10;
- hash += hash >> 1;
- }
-
- /* Force "avalanching" of final 127 bits */
- hash ^= hash << 3;
- hash += hash >> 5;
- hash ^= hash << 4;
- hash += hash >> 17;
- hash ^= hash << 25;
- hash += hash >> 6;
-
- return hash;
+ uint32_t hash = len, tmp;
+ int32_t rem;
+
+ if (len <= 1 || data == NULL) return 1;
+
+ rem = len & 3;
+ len >>= 2;
+
+ /* Main loop */
+ for (;len > 0; len--) {
+ hash += get16bits (data);
+ tmp = (get16bits (data+2) << 11) ^ hash;
+ hash = (hash << 16) ^ tmp;
+ data += 2*sizeof (uint16_t);
+ hash += hash >> 11;
+ }
+
+ /* Handle end cases */
+ switch (rem) {
+ case 3: hash += get16bits (data);
+ hash ^= hash << 16;
+ hash ^= data[sizeof (uint16_t)] << 18;
+ hash += hash >> 11;
+ break;
+ case 2: hash += get16bits (data);
+ hash ^= hash << 11;
+ hash += hash >> 17;
+ break;
+ case 1: hash += *data;
+ hash ^= hash << 10;
+ hash += hash >> 1;
+ }
+
+ /* Force "avalanching" of final 127 bits */
+ hash ^= hash << 3;
+ hash += hash >> 5;
+ hash ^= hash << 4;
+ hash += hash >> 17;
+ hash ^= hash << 25;
+ hash += hash >> 6;
+
+ return hash;
}
@@ -102,95 +102,95 @@ uint32_t SuperFastHash (const char * data, int32_t len) {
static int
dm_round (int rounds, uint32_t *array, uint32_t *h0, uint32_t *h1)
{
- uint32_t sum = 0;
- int n = 0;
- uint32_t b0 = 0;
- uint32_t b1 = 0;
-
- b0 = *h0;
- b1 = *h1;
-
- n = rounds;
-
- do {
- sum += DM_DELTA;
- b0 += ((b1 << 4) + array[0])
- ^ (b1 + sum)
- ^ ((b1 >> 5) + array[1]);
- b1 += ((b0 << 4) + array[2])
- ^ (b0 + sum)
- ^ ((b0 >> 5) + array[3]);
- } while (--n);
-
- *h0 += b0;
- *h1 += b1;
-
- return 0;
+ uint32_t sum = 0;
+ int n = 0;
+ uint32_t b0 = 0;
+ uint32_t b1 = 0;
+
+ b0 = *h0;
+ b1 = *h1;
+
+ n = rounds;
+
+ do {
+ sum += DM_DELTA;
+ b0 += ((b1 << 4) + array[0])
+ ^ (b1 + sum)
+ ^ ((b1 >> 5) + array[1]);
+ b1 += ((b0 << 4) + array[2])
+ ^ (b0 + sum)
+ ^ ((b0 >> 5) + array[3]);
+ } while (--n);
+
+ *h0 += b0;
+ *h1 += b1;
+
+ return 0;
}
uint32_t
__pad (int len)
{
- uint32_t pad = 0;
+ uint32_t pad = 0;
- pad = (uint32_t) len | ((uint32_t) len << 8);
- pad |= pad << 16;
+ pad = (uint32_t) len | ((uint32_t) len << 8);
+ pad |= pad << 16;
- return pad;
+ return pad;
}
uint32_t
gf_dm_hashfn (const char *msg, int len)
{
- uint32_t h0 = 0x9464a485;
- uint32_t h1 = 0x542e1a94;
- uint32_t array[4];
- uint32_t pad = 0;
- int i = 0;
- int j = 0;
- int full_quads = 0;
- int full_words = 0;
- int full_bytes = 0;
- uint32_t *intmsg = NULL;
- int word = 0;
-
-
- intmsg = (uint32_t *) msg;
- pad = __pad (len);
-
- full_bytes = len;
- full_words = len / 4;
- full_quads = len / 16;
-
- for (i = 0; i < full_quads; i++) {
- for (j = 0; j < 4; j++) {
- word = *intmsg;
- array[j] = word;
- intmsg++;
- full_words--;
- full_bytes -= 4;
- }
- dm_round (DM_PARTROUNDS, &array[0], &h0, &h1);
- }
-
- for (j = 0; j < 4; j++) {
- if (full_words) {
- word = *intmsg;
- array[j] = word;
- intmsg++;
- full_words--;
- full_bytes -= 4;
- } else {
- array[j] = pad;
- while (full_bytes) {
- array[j] <<= 8;
- array[j] |= msg[len - full_bytes];
- full_bytes--;
- }
- }
- }
- dm_round (DM_FULLROUNDS, &array[0], &h0, &h1);
-
- return h0 ^ h1;
+ uint32_t h0 = 0x9464a485;
+ uint32_t h1 = 0x542e1a94;
+ uint32_t array[4];
+ uint32_t pad = 0;
+ int i = 0;
+ int j = 0;
+ int full_quads = 0;
+ int full_words = 0;
+ int full_bytes = 0;
+ uint32_t *intmsg = NULL;
+ int word = 0;
+
+
+ intmsg = (uint32_t *) msg;
+ pad = __pad (len);
+
+ full_bytes = len;
+ full_words = len / 4;
+ full_quads = len / 16;
+
+ for (i = 0; i < full_quads; i++) {
+ for (j = 0; j < 4; j++) {
+ word = *intmsg;
+ array[j] = word;
+ intmsg++;
+ full_words--;
+ full_bytes -= 4;
+ }
+ dm_round (DM_PARTROUNDS, &array[0], &h0, &h1);
+ }
+
+ for (j = 0; j < 4; j++) {
+ if (full_words) {
+ word = *intmsg;
+ array[j] = word;
+ intmsg++;
+ full_words--;
+ full_bytes -= 4;
+ } else {
+ array[j] = pad;
+ while (full_bytes) {
+ array[j] <<= 8;
+ array[j] |= msg[len - full_bytes];
+ full_bytes--;
+ }
+ }
+ }
+ dm_round (DM_FULLROUNDS, &array[0], &h0, &h1);
+
+ return h0 ^ h1;
}
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index e193d782400..dac314b977d 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -37,7 +37,7 @@
move latest accessed dentry to list_head of inode
*/
-#define INODE_DUMP_LIST(head, key_buf, key_prefix, list_type) \
+#define INODE_DUMP_LIST(head, key_buf, key_prefix, list_type) \
{ \
int i = 1; \
inode_t *inode = NULL; \
@@ -311,7 +311,7 @@ noctx:
LOCK_DESTROY (&inode->lock);
// memset (inode, 0xb, sizeof (*inode));
mem_put (tmp_pool, inode);
- tmp_pool = NULL;
+ tmp_pool = NULL;
}
@@ -512,7 +512,7 @@ __inode_create (inode_table_t *table)
newi->_ctx = GF_CALLOC (1, (sizeof (struct _inode_ctx) *
table->xl->graph->xl_count),
- gf_common_mt_inode_ctx);
+ gf_common_mt_inode_ctx);
if (newi->_ctx == NULL) {
gf_log ("inode", GF_LOG_ERROR, "out of memory");
@@ -1155,12 +1155,12 @@ inode_table_new (size_t lru_limit, xlator_t *xl)
return NULL;
}
- new->fd_mem_pool = mem_pool_new (fd_t, 16384);
+ new->fd_mem_pool = mem_pool_new (fd_t, 16384);
- if (!new->fd_mem_pool) {
- GF_FREE (new->inode_hash);
- GF_FREE (new);
- }
+ if (!new->fd_mem_pool) {
+ GF_FREE (new->inode_hash);
+ GF_FREE (new);
+ }
for (i = 0; i < 65536; i++) {
INIT_LIST_HEAD (&new->inode_hash[i]);
diff --git a/libglusterfs/src/iobuf.c b/libglusterfs/src/iobuf.c
index a8bd192cf88..a717792ce98 100644
--- a/libglusterfs/src/iobuf.c
+++ b/libglusterfs/src/iobuf.c
@@ -1,20 +1,20 @@
/*
- Copyright (c) 2010 Gluster, Inc. <http://www.gluster.com>
- This file is part of GlusterFS.
-
- GlusterFS is free software; you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation; either version 3 of the License,
- or (at your option) any later version.
-
- GlusterFS 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
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see
- <http://www.gnu.org/licenses/>.
+ Copyright (c) 2010 Gluster, Inc. <http://www.gluster.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
*/
@@ -42,7 +42,7 @@ __iobuf_arena_init_iobufs (struct iobuf_arena *iobuf_arena)
iobuf_cnt = arena_size / page_size;
iobuf_arena->iobufs = GF_CALLOC (sizeof (*iobuf), iobuf_cnt,
- gf_common_mt_iobuf);
+ gf_common_mt_iobuf);
if (!iobuf_arena->iobufs)
return;
@@ -119,7 +119,7 @@ __iobuf_arena_alloc (struct iobuf_pool *iobuf_pool)
size_t arena_size = 0;
iobuf_arena = GF_CALLOC (sizeof (*iobuf_arena), 1,
- gf_common_mt_iobuf_arena);
+ gf_common_mt_iobuf_arena);
if (!iobuf_arena)
goto err;
@@ -642,51 +642,51 @@ out:
return size;
}
-void
+void
iobuf_info_dump (struct iobuf *iobuf, const char *key_prefix)
{
char key[GF_DUMP_MAX_BUF_LEN];
struct iobuf my_iobuf;
int ret = 0;
- if (!iobuf)
+ if (!iobuf)
return;
memset(&my_iobuf, 0, sizeof(my_iobuf));
-
+
ret = TRY_LOCK(&iobuf->lock);
if (ret) {
gf_log("", GF_LOG_WARNING, "Unable to dump iobuf"
- " errno: %d", errno);
+ " errno: %d", errno);
return;
}
memcpy(&my_iobuf, iobuf, sizeof(my_iobuf));
UNLOCK(&iobuf->lock);
- gf_proc_dump_build_key(key, key_prefix,"ref");
+ gf_proc_dump_build_key(key, key_prefix,"ref");
gf_proc_dump_write(key, "%d", my_iobuf.ref);
- gf_proc_dump_build_key(key, key_prefix,"ptr");
+ gf_proc_dump_build_key(key, key_prefix,"ptr");
gf_proc_dump_write(key, "%p", my_iobuf.ptr);
}
-void
+void
iobuf_arena_info_dump (struct iobuf_arena *iobuf_arena, const char *key_prefix)
{
- char key[GF_DUMP_MAX_BUF_LEN];
- int i = 1;
+ char key[GF_DUMP_MAX_BUF_LEN];
+ int i = 1;
struct iobuf *trav;
- if (!iobuf_arena)
+ if (!iobuf_arena)
return;
gf_proc_dump_build_key(key, key_prefix,"mem_base");
gf_proc_dump_write(key, "%p", iobuf_arena->mem_base);
- gf_proc_dump_build_key(key, key_prefix, "active_cnt");
+ gf_proc_dump_build_key(key, key_prefix, "active_cnt");
gf_proc_dump_write(key, "%d", iobuf_arena->active_cnt);
- gf_proc_dump_build_key(key, key_prefix, "passive_cnt");
+ gf_proc_dump_build_key(key, key_prefix, "passive_cnt");
gf_proc_dump_write(key, "%d", iobuf_arena->passive_cnt);
- list_for_each_entry (trav, &iobuf_arena->active.list, list) {
+ list_for_each_entry (trav, &iobuf_arena->active.list, list) {
gf_proc_dump_build_key(key, key_prefix,"active_iobuf.%d", i++);
gf_proc_dump_add_section(key);
iobuf_info_dump(trav, key);
@@ -697,7 +697,7 @@ iobuf_arena_info_dump (struct iobuf_arena *iobuf_arena, const char *key_prefix)
void
iobuf_stats_dump (struct iobuf_pool *iobuf_pool)
{
-
+
char msg[1024];
struct iobuf_arena *trav = NULL;
int i = 1;
@@ -712,26 +712,26 @@ iobuf_stats_dump (struct iobuf_pool *iobuf_pool)
if (ret) {
gf_log("", GF_LOG_WARNING, "Unable to dump iobuf pool"
- " errno: %d", errno);
+ " errno: %d", errno);
return;
}
gf_proc_dump_add_section("iobuf.global");
gf_proc_dump_write("iobuf.global.iobuf_pool","%p", iobuf_pool);
gf_proc_dump_write("iobuf.global.iobuf_pool.page_size", "%d",
- iobuf_pool->page_size);
+ iobuf_pool->page_size);
gf_proc_dump_write("iobuf.global.iobuf_pool.arena_size", "%d",
- iobuf_pool->arena_size);
+ iobuf_pool->arena_size);
gf_proc_dump_write("iobuf.global.iobuf_pool.arena_cnt", "%d",
- iobuf_pool->arena_cnt);
+ iobuf_pool->arena_cnt);
list_for_each_entry (trav, &iobuf_pool->arenas.list, list) {
snprintf(msg, sizeof(msg), "iobuf.global.iobuf_pool.arena.%d",
- i);
- gf_proc_dump_add_section(msg);
+ i);
+ gf_proc_dump_add_section(msg);
iobuf_arena_info_dump(trav,msg);
i++;
}
-
+
pthread_mutex_unlock(&iobuf_pool->mutex);
return;
@@ -744,4 +744,3 @@ iobuf_to_iovec(struct iobuf *iob, struct iovec *iov)
iov->iov_base = iobuf_ptr (iob);
iov->iov_len = iobuf_pagesize (iob);
}
-
diff --git a/libglusterfs/src/latency.c b/libglusterfs/src/latency.c
index bc2409138c4..7dfa13d14db 100644
--- a/libglusterfs/src/latency.c
+++ b/libglusterfs/src/latency.c
@@ -95,9 +95,9 @@ gf_set_fop_from_fn_pointer (call_frame_t *frame, struct xlator_fops *fops, void
fop = GF_FOP_INODELK;
else if (fops->finodelk == fn)
fop = GF_FOP_FINODELK;
- else if (fops->entrylk == fn)
+ else if (fops->entrylk == fn)
fop = GF_FOP_ENTRYLK;
- else if (fops->fentrylk == fn)
+ else if (fops->fentrylk == fn)
fop = GF_FOP_FENTRYLK;
else if (fops->xattrop == fn)
fop = GF_FOP_XATTROP;
@@ -140,7 +140,7 @@ gf_update_latency (call_frame_t *frame)
lat = &frame->this->latencies[frame->op];
- lat->total += elapsed;
+ lat->total += elapsed;
lat->count++;
lat->mean = lat->mean + (elapsed - lat->mean) / lat->count;
}
@@ -162,7 +162,7 @@ gf_proc_dump_latency_info (xlator_t *xl)
gf_proc_dump_write (key, "%.03f,%"PRId64",%.03f",
xl->latencies[i].mean,
xl->latencies[i].count,
- xl->latencies[i].total);
+ xl->latencies[i].total);
}
}
diff --git a/libglusterfs/src/rbthash.c b/libglusterfs/src/rbthash.c
index 3a45d9fb6f6..dc2f7395259 100644
--- a/libglusterfs/src/rbthash.c
+++ b/libglusterfs/src/rbthash.c
@@ -423,4 +423,3 @@ rbthash_table_destroy (rbthash_table_t *tbl)
GF_FREE (tbl->buckets);
GF_FREE (tbl);
}
-
diff --git a/libglusterfs/src/scheduler.c b/libglusterfs/src/scheduler.c
index dc49d22d2dc..e06b0185781 100644
--- a/libglusterfs/src/scheduler.c
+++ b/libglusterfs/src/scheduler.c
@@ -1,20 +1,20 @@
/*
- Copyright (c) 2006-2010 Gluster, Inc. <http://www.gluster.com>
- This file is part of GlusterFS.
+ Copyright (c) 2006-2010 Gluster, Inc. <http://www.gluster.com>
+ This file is part of GlusterFS.
- GlusterFS is free software; you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation; either version 3 of the License,
- or (at your option) any later version.
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
- GlusterFS 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
- Affero General Public License for more details.
+ GlusterFS 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
+ Affero General Public License for more details.
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see
- <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
*/
#ifndef _CONFIG_H
@@ -31,61 +31,61 @@
struct sched_ops *
get_scheduler (xlator_t *xl, const char *name)
{
- struct sched_ops *tmp_sched = NULL;
- volume_opt_list_t *vol_opt = NULL;
- char *sched_file = NULL;
- void *handle = NULL;
+ struct sched_ops *tmp_sched = NULL;
+ volume_opt_list_t *vol_opt = NULL;
+ char *sched_file = NULL;
+ void *handle = NULL;
int ret = 0;
- if (name == NULL) {
- gf_log ("scheduler", GF_LOG_ERROR,
- "'name' not specified, EINVAL");
- return NULL;
- }
-
- ret = gf_asprintf (&sched_file, "%s/%s.so", SCHEDULERDIR, name);
+ if (name == NULL) {
+ gf_log ("scheduler", GF_LOG_ERROR,
+ "'name' not specified, EINVAL");
+ return NULL;
+ }
+
+ ret = gf_asprintf (&sched_file, "%s/%s.so", SCHEDULERDIR, name);
if (-1 == ret) {
gf_log ("scheduler", GF_LOG_ERROR, "asprintf failed");
return NULL;
}
- gf_log ("scheduler", GF_LOG_DEBUG,
- "attempt to load file %s.so", name);
+ gf_log ("scheduler", GF_LOG_DEBUG,
+ "attempt to load file %s.so", name);
- handle = dlopen (sched_file, RTLD_LAZY);
- if (!handle) {
+ handle = dlopen (sched_file, RTLD_LAZY);
+ if (!handle) {
gf_log ("scheduler", GF_LOG_ERROR,
"dlopen(%s): %s", sched_file, dlerror ());
GF_FREE(sched_file);
return NULL;
- }
+ }
- tmp_sched = dlsym (handle, "sched");
- if (!tmp_sched) {
+ tmp_sched = dlsym (handle, "sched");
+ if (!tmp_sched) {
gf_log ("scheduler", GF_LOG_ERROR,
"dlsym(sched) on %s", dlerror ());
GF_FREE(sched_file);
return NULL;
- }
-
- vol_opt = GF_CALLOC (1, sizeof (volume_opt_list_t),
+ }
+
+ vol_opt = GF_CALLOC (1, sizeof (volume_opt_list_t),
gf_common_mt_volume_opt_list_t);
- vol_opt->given_opt = dlsym (handle, "options");
- if (vol_opt->given_opt == NULL) {
- gf_log ("scheduler", GF_LOG_DEBUG,
- "volume option validation not specified");
- } else {
- list_add_tail (&vol_opt->list, &xl->volume_options);
- if (validate_xlator_volume_options (xl, vol_opt->given_opt)
- == -1) {
- gf_log ("scheduler", GF_LOG_ERROR,
- "volume option validation failed");
+ vol_opt->given_opt = dlsym (handle, "options");
+ if (vol_opt->given_opt == NULL) {
+ gf_log ("scheduler", GF_LOG_DEBUG,
+ "volume option validation not specified");
+ } else {
+ list_add_tail (&vol_opt->list, &xl->volume_options);
+ if (validate_xlator_volume_options (xl, vol_opt->given_opt)
+ == -1) {
+ gf_log ("scheduler", GF_LOG_ERROR,
+ "volume option validation failed");
GF_FREE(sched_file);
- return NULL;
- }
- }
+ return NULL;
+ }
+ }
GF_FREE(sched_file);
GF_FREE (vol_opt);
-
- return tmp_sched;
+
+ return tmp_sched;
}
diff --git a/libglusterfs/src/stack.c b/libglusterfs/src/stack.c
index 53c21f7c625..3f8cf08c9b7 100644
--- a/libglusterfs/src/stack.c
+++ b/libglusterfs/src/stack.c
@@ -21,7 +21,7 @@
#include "stack.h"
static inline
-int call_frames_count (call_frame_t *call_frame)
+int call_frames_count (call_frame_t *call_frame)
{
call_frame_t *pos;
int32_t count = 0;
@@ -38,7 +38,7 @@ int call_frames_count (call_frame_t *call_frame)
void
gf_proc_dump_call_frame (call_frame_t *call_frame, const char *key_buf,...)
{
-
+
char prefix[GF_DUMP_MAX_BUF_LEN];
va_list ap;
char key[GF_DUMP_MAX_BUF_LEN];
@@ -53,24 +53,24 @@ gf_proc_dump_call_frame (call_frame_t *call_frame, const char *key_buf,...)
memset(prefix, 0, sizeof(prefix));
memset(&my_frame, 0, sizeof(my_frame));
va_start(ap, key_buf);
- vsnprintf(prefix, GF_DUMP_MAX_BUF_LEN, key_buf, ap);
+ vsnprintf(prefix, GF_DUMP_MAX_BUF_LEN, key_buf, ap);
va_end(ap);
ret = TRY_LOCK(&call_frame->lock);
if (ret) {
gf_log("", GF_LOG_WARNING, "Unable to dump call frame"
- " errno: %d", errno);
+ " errno: %d", errno);
return;
}
memcpy(&my_frame, call_frame, sizeof(my_frame));
UNLOCK(&call_frame->lock);
- gf_proc_dump_build_key(key, prefix,"ref_count");
+ gf_proc_dump_build_key(key, prefix,"ref_count");
gf_proc_dump_write(key, "%d", my_frame.ref_count);
- gf_proc_dump_build_key(key, prefix,"translator");
+ gf_proc_dump_build_key(key, prefix,"translator");
gf_proc_dump_write(key, "%s", my_frame.this->name);
- gf_proc_dump_build_key(key, prefix,"complete");
+ gf_proc_dump_build_key(key, prefix,"complete");
gf_proc_dump_write(key, "%d", my_frame.complete);
if (my_frame.parent) {
gf_proc_dump_build_key(key, prefix,"parent");
@@ -97,27 +97,27 @@ gf_proc_dump_call_stack (call_stack_t *call_stack, const char *key_buf,...)
memset(prefix, 0, sizeof(prefix));
va_start(ap, key_buf);
- vsnprintf(prefix, GF_DUMP_MAX_BUF_LEN, key_buf, ap);
+ vsnprintf(prefix, GF_DUMP_MAX_BUF_LEN, key_buf, ap);
va_end(ap);
- gf_proc_dump_build_key(key, prefix,"uid");
+ gf_proc_dump_build_key(key, prefix,"uid");
gf_proc_dump_write(key, "%d", call_stack->uid);
- gf_proc_dump_build_key(key, prefix,"gid");
+ gf_proc_dump_build_key(key, prefix,"gid");
gf_proc_dump_write(key, "%d", call_stack->gid);
- gf_proc_dump_build_key(key, prefix,"pid");
+ gf_proc_dump_build_key(key, prefix,"pid");
gf_proc_dump_write(key, "%d", call_stack->pid);
- gf_proc_dump_build_key(key, prefix,"unique");
+ gf_proc_dump_build_key(key, prefix,"unique");
gf_proc_dump_write(key, "%Ld", call_stack->unique);
- gf_proc_dump_build_key(key, prefix,"op");
+ gf_proc_dump_build_key(key, prefix,"op");
if (call_stack->type == GF_OP_TYPE_FOP)
gf_proc_dump_write(key, "%s", gf_fop_list[call_stack->op]);
else if (call_stack->type == GF_OP_TYPE_MGMT)
gf_proc_dump_write(key, "%s", gf_mgmt_list[call_stack->op]);
- gf_proc_dump_build_key(key, prefix,"type");
+ gf_proc_dump_build_key(key, prefix,"type");
gf_proc_dump_write(key, "%d", call_stack->type);
- gf_proc_dump_build_key(key, prefix,"cnt");
+ gf_proc_dump_build_key(key, prefix,"cnt");
gf_proc_dump_write(key, "%d", cnt);
trav = &call_stack->frames;
@@ -126,7 +126,7 @@ gf_proc_dump_call_stack (call_stack_t *call_stack, const char *key_buf,...)
if (trav) {
gf_proc_dump_add_section("%s.frame.%d", prefix, i);
gf_proc_dump_call_frame(trav, "%s.frame.%d", prefix, i);
- trav = trav->next;
+ trav = trav->next;
}
}
}
@@ -134,7 +134,7 @@ gf_proc_dump_call_stack (call_stack_t *call_stack, const char *key_buf,...)
void
gf_proc_dump_pending_frames (call_pool_t *call_pool)
{
-
+
call_stack_t *trav = NULL;
int i = 1;
int ret = -1;
@@ -145,11 +145,11 @@ gf_proc_dump_pending_frames (call_pool_t *call_pool)
ret = TRY_LOCK (&(call_pool->lock));
if (ret) {
gf_log("", GF_LOG_WARNING, "Unable to dump call pool"
- " errno: %d", errno);
+ " errno: %d", errno);
return;
}
-
+
gf_proc_dump_add_section("global.callpool");
gf_proc_dump_write("global.callpool","%p", call_pool);
gf_proc_dump_write("global.callpool.cnt","%d", call_pool->cnt);
@@ -160,7 +160,7 @@ gf_proc_dump_pending_frames (call_pool_t *call_pool)
gf_proc_dump_call_stack(trav, "global.callpool.stack.%d", i);
i++;
}
- UNLOCK (&(call_pool->lock));
+ UNLOCK (&(call_pool->lock));
}
gf_boolean_t
diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c
index d3e1272c565..4a49353ef40 100644
--- a/libglusterfs/src/statedump.c
+++ b/libglusterfs/src/statedump.c
@@ -29,10 +29,10 @@
#endif /* MALLOC_H */
-#define GF_PROC_DUMP_IS_OPTION_ENABLED(opt) \
+#define GF_PROC_DUMP_IS_OPTION_ENABLED(opt) \
(dump_options.dump_##opt == _gf_true)
-#define GF_PROC_DUMP_IS_XL_OPTION_ENABLED(opt)\
+#define GF_PROC_DUMP_IS_XL_OPTION_ENABLED(opt) \
(dump_options.xl_options.dump_##opt == _gf_true)
extern xlator_t global_xlator;
@@ -45,14 +45,14 @@ gf_dump_options_t dump_options;
static void
gf_proc_dump_lock (void)
{
- pthread_mutex_lock (&gf_proc_dump_mutex);
+ pthread_mutex_lock (&gf_proc_dump_mutex);
}
static void
gf_proc_dump_unlock (void)
{
- pthread_mutex_unlock (&gf_proc_dump_mutex);
+ pthread_mutex_unlock (&gf_proc_dump_mutex);
}
@@ -66,10 +66,10 @@ gf_proc_dump_open (void)
snprintf (path, sizeof (path), "%s.%d", GF_DUMP_LOGFILE_ROOT, getpid ());
dump_fd = open (path, O_CREAT|O_RDWR|O_TRUNC|O_APPEND, 0600);
- if (dump_fd < 0)
+ if (dump_fd < 0)
return -1;
- gf_dump_fd = dump_fd;
+ gf_dump_fd = dump_fd;
return 0;
}
@@ -90,7 +90,7 @@ gf_proc_dump_add_section (char *key, ...)
va_list ap;
int ret;
- GF_ASSERT(key);
+ GF_ASSERT(key);
memset (buf, 0, sizeof(buf));
snprintf (buf, GF_DUMP_MAX_BUF_LEN, "\n[");
@@ -110,10 +110,10 @@ gf_proc_dump_write (char *key, char *value,...)
char buf[GF_DUMP_MAX_BUF_LEN];
int offset = 0;
- va_list ap;
+ va_list ap;
int ret;
- GF_ASSERT (key);
+ GF_ASSERT (key);
offset = strlen (key);
@@ -148,15 +148,15 @@ gf_proc_dump_xlator_mem_info (xlator_t *xl)
gf_proc_dump_write ("num_types", "%d", xl->mem_acct.num_types);
for (i = 0; i < xl->mem_acct.num_types; i++) {
- if (!(memcmp (&xl->mem_acct.rec[i], &rec,
- sizeof (struct mem_acct))))
- continue;
+ if (!(memcmp (&xl->mem_acct.rec[i], &rec,
+ sizeof (struct mem_acct))))
+ continue;
- gf_proc_dump_add_section ("%s.%s - usage-type %d", xl->type,
- xl->name,i);
+ gf_proc_dump_add_section ("%s.%s - usage-type %d", xl->type,
+ xl->name,i);
gf_proc_dump_build_key (prefix, "memusage", "%s.%s.type.%d",
xl->type, xl->name, i);
- gf_proc_dump_build_key (key, prefix, "size");
+ gf_proc_dump_build_key (key, prefix, "size");
gf_proc_dump_write (key, "%u", xl->mem_acct.rec[i].size);
gf_proc_dump_build_key (key, prefix, "num_allocs");
gf_proc_dump_write (key, "%u", xl->mem_acct.rec[i].num_allocs);
@@ -202,53 +202,53 @@ void gf_proc_dump_latency_info (xlator_t *xl);
void
gf_proc_dump_xlator_info (xlator_t *this_xl)
{
- glusterfs_ctx_t *ctx = NULL;
- xlator_t *fuse_xlator, *this_xlator;
-
+ glusterfs_ctx_t *ctx = NULL;
+ xlator_t *fuse_xlator, *this_xlator;
+
if (!this_xl)
return;
-
- ctx = glusterfs_ctx_get ();
- if (!ctx)
- return;
- if (ctx->master){
+ ctx = glusterfs_ctx_get ();
+ if (!ctx)
+ return;
+
+ if (ctx->master){
- fuse_xlator = (xlator_t *) ctx->master;
+ fuse_xlator = (xlator_t *) ctx->master;
- if (!fuse_xlator->dumpops)
- return;
+ if (!fuse_xlator->dumpops)
+ return;
- if (fuse_xlator->dumpops->priv &&
+ if (fuse_xlator->dumpops->priv &&
GF_PROC_DUMP_IS_XL_OPTION_ENABLED (priv))
- fuse_xlator->dumpops->priv (fuse_xlator);
+ fuse_xlator->dumpops->priv (fuse_xlator);
if (fuse_xlator->dumpops->inode &&
GF_PROC_DUMP_IS_XL_OPTION_ENABLED (inode)) {
-
- if (!ctx->active)
- return;
- this_xlator = (xlator_t *) ctx->active->top;
-
- if (this_xlator && this_xlator->itable)
- inode_table_dump (this_xlator->itable,
- "xlator.mount.fuse.itable");
- else
- return;
- }
+
+ if (!ctx->active)
+ return;
+ this_xlator = (xlator_t *) ctx->active->top;
+
+ if (this_xlator && this_xlator->itable)
+ inode_table_dump (this_xlator->itable,
+ "xlator.mount.fuse.itable");
+ else
+ return;
+ }
if (fuse_xlator->dumpops->fd &&
GF_PROC_DUMP_IS_XL_OPTION_ENABLED (fd))
fuse_xlator->dumpops->fd (fuse_xlator);
- }
-
+ }
+
while (this_xl) {
-
- if (ctx->measure_latency)
- gf_proc_dump_latency_info (this_xl);
- gf_proc_dump_xlator_mem_info(this_xl);
+ if (ctx->measure_latency)
+ gf_proc_dump_latency_info (this_xl);
+
+ gf_proc_dump_xlator_mem_info(this_xl);
if (!this_xl->dumpops) {
this_xl = this_xl->next;
@@ -257,17 +257,17 @@ gf_proc_dump_xlator_info (xlator_t *this_xl)
if (this_xl->dumpops->priv &&
GF_PROC_DUMP_IS_XL_OPTION_ENABLED (priv))
- this_xl->dumpops->priv (this_xl);
+ this_xl->dumpops->priv (this_xl);
if (this_xl->dumpops->inode &&
GF_PROC_DUMP_IS_XL_OPTION_ENABLED (inode))
this_xl->dumpops->inode (this_xl);
-
-
+
+
if (this_xl->dumpops->fd &&
GF_PROC_DUMP_IS_XL_OPTION_ENABLED (fd))
this_xl->dumpops->fd (this_xl);
-
+
this_xl = this_xl->next;
}
@@ -278,7 +278,7 @@ gf_proc_dump_parse_set_option (char *key, char *value)
{
gf_boolean_t *opt_key = NULL;
gf_boolean_t opt_value = _gf_false;
- char buf[GF_DUMP_MAX_BUF_LEN];
+ char buf[GF_DUMP_MAX_BUF_LEN];
if (!strncasecmp (key, "mem", 3)) {
opt_key = &dump_options.dump_mem;
@@ -300,15 +300,15 @@ gf_proc_dump_parse_set_option (char *key, char *value)
if (!opt_key) {
//None of dump options match the key, return back
- snprintf (buf, sizeof (buf), "[Warning]:None of the options "
- "matched key : %s\n", key);
- write (gf_dump_fd, buf, strlen (buf));
+ snprintf (buf, sizeof (buf), "[Warning]:None of the options "
+ "matched key : %s\n", key);
+ write (gf_dump_fd, buf, strlen (buf));
return -1;
}
opt_value = (strncasecmp (value, "yes", 3) ?
- _gf_false: _gf_true);
+ _gf_false: _gf_true);
GF_PROC_DUMP_SET_OPTION (*opt_key, opt_value);
@@ -342,7 +342,7 @@ gf_proc_dump_disable_all_options ()
GF_PROC_DUMP_SET_OPTION (dump_options.dump_callpool, _gf_false);
GF_PROC_DUMP_SET_OPTION (dump_options.xl_options.dump_priv, _gf_false);
GF_PROC_DUMP_SET_OPTION (dump_options.xl_options.dump_inode,
- _gf_false);
+ _gf_false);
GF_PROC_DUMP_SET_OPTION (dump_options.xl_options.dump_fd, _gf_false);
GF_PROC_DUMP_SET_OPTION (dump_options.xl_options.dump_inodectx,
_gf_false);
@@ -357,11 +357,11 @@ gf_proc_dump_options_init ()
int ret = -1;
FILE *fp = NULL;
char buf[256];
- char dumpbuf[GF_DUMP_MAX_BUF_LEN];
+ char dumpbuf[GF_DUMP_MAX_BUF_LEN];
char *key = NULL, *value = NULL;
char *saveptr = NULL;
-
-
+
+
fp = fopen (GF_DUMP_OPTIONFILE, "r");
if (!fp) {
@@ -389,8 +389,8 @@ gf_proc_dump_options_init ()
continue;
}
- snprintf (dumpbuf, sizeof (dumpbuf), "[Debug]:key=%s, value=%s\n",key,value);
- write (gf_dump_fd, dumpbuf, strlen (dumpbuf));
+ snprintf (dumpbuf, sizeof (dumpbuf), "[Debug]:key=%s, value=%s\n",key,value);
+ write (gf_dump_fd, dumpbuf, strlen (dumpbuf));
gf_proc_dump_parse_set_option (key, value);
@@ -405,14 +405,14 @@ gf_proc_dump_info (int signum)
int ret = -1;
glusterfs_ctx_t *ctx = NULL;
-
+
gf_proc_dump_lock ();
ret = gf_proc_dump_open ();
if (ret < 0)
goto out;
ret = gf_proc_dump_options_init ();
-
+
if (ret < 0)
goto out;
@@ -420,13 +420,13 @@ gf_proc_dump_info (int signum)
gf_proc_dump_mem_info ();
ctx = glusterfs_ctx_get ();
-
+
if (ctx) {
- if (GF_PROC_DUMP_IS_OPTION_ENABLED (iobuf))
- iobuf_stats_dump (ctx->iobuf_pool);
+ if (GF_PROC_DUMP_IS_OPTION_ENABLED (iobuf))
+ iobuf_stats_dump (ctx->iobuf_pool);
if (GF_PROC_DUMP_IS_OPTION_ENABLED (callpool))
gf_proc_dump_pending_frames (ctx->pool);
- gf_proc_dump_xlator_info (ctx->active->top);
+ gf_proc_dump_xlator_info (ctx->active->top);
}
@@ -441,23 +441,21 @@ out:
void
gf_proc_dump_fini (void)
{
- pthread_mutex_destroy (&gf_proc_dump_mutex);
+ pthread_mutex_destroy (&gf_proc_dump_mutex);
}
void
gf_proc_dump_init ()
{
- pthread_mutex_init (&gf_proc_dump_mutex, NULL);
+ pthread_mutex_init (&gf_proc_dump_mutex, NULL);
- return;
+ return;
}
void
gf_proc_dump_cleanup (void)
{
- pthread_mutex_destroy (&gf_proc_dump_mutex);
+ pthread_mutex_destroy (&gf_proc_dump_mutex);
}
-
-
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index 6b46a14d320..267e4b3a2d1 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -1,20 +1,20 @@
/*
- Copyright (c) 2010 Gluster, Inc. <http://www.gluster.com>
- This file is part of GlusterFS.
-
- GlusterFS is free software; you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation; either version 3 of the License,
- or (at your option) any later version.
-
- GlusterFS 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
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see
- <http://www.gnu.org/licenses/>.
+ Copyright (c) 2010 Gluster, Inc. <http://www.gluster.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
*/
#ifndef _CONFIG_H
@@ -337,11 +337,11 @@ entry_copy (gf_dirent_t *source)
int32_t
syncop_readdirp_cbk (call_frame_t *frame,
- void *cookie,
- xlator_t *this,
- int32_t op_ret,
- int32_t op_errno,
- gf_dirent_t *entries)
+ void *cookie,
+ xlator_t *this,
+ int32_t op_ret,
+ int32_t op_errno,
+ gf_dirent_t *entries)
{
struct syncargs *args = NULL;
gf_dirent_t *entry = NULL;
@@ -375,9 +375,9 @@ syncop_readdirp_cbk (call_frame_t *frame,
int
syncop_readdirp (xlator_t *subvol,
- fd_t *fd,
- size_t size,
- off_t off,
+ fd_t *fd,
+ size_t size,
+ off_t off,
gf_dirent_t *entries)
{
struct syncargs args = {0, };
@@ -460,8 +460,8 @@ syncop_setxattr (xlator_t *subvol, loc_t *loc, dict_t *dict, int32_t flags)
int
syncop_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct statvfs *buf)
+ int32_t op_ret, int32_t op_errno,
+ struct statvfs *buf)
{
struct syncargs *args = NULL;
@@ -537,4 +537,3 @@ syncop_setattr (xlator_t *subvol, loc_t *loc, struct iatt *iatt, int valid,
errno = args.op_errno;
return args.op_ret;
}
-
diff --git a/libglusterfs/src/syscall.c b/libglusterfs/src/syscall.c
index 6750b313da7..b8ee38de8a4 100644
--- a/libglusterfs/src/syscall.c
+++ b/libglusterfs/src/syscall.c
@@ -64,14 +64,14 @@ sys_readdir (DIR *dir)
}
-ssize_t
+ssize_t
sys_readlink (const char *path, char *buf, size_t bufsiz)
{
return readlink (path, buf, bufsiz);
}
-int
+int
sys_closedir (DIR *dir)
{
return closedir (dir);
@@ -85,14 +85,14 @@ sys_mknod (const char *pathname, mode_t mode, dev_t dev)
}
-int
+int
sys_mkdir (const char *pathname, mode_t mode)
{
return mkdir (pathname, mode);
}
-int
+int
sys_unlink (const char *pathname)
{
#ifdef GF_SOLARIS_HOST_OS
@@ -102,14 +102,14 @@ sys_unlink (const char *pathname)
}
-int
+int
sys_rmdir (const char *pathname)
{
return rmdir (pathname);
}
-int
+int
sys_symlink (const char *oldpath, const char *newpath)
{
return symlink (oldpath, newpath);
@@ -126,7 +126,7 @@ sys_rename (const char *oldpath, const char *newpath)
}
-int
+int
sys_link (const char *oldpath, const char *newpath)
{
return link (oldpath, newpath);
@@ -147,7 +147,7 @@ sys_fchmod (int fd, mode_t mode)
}
-int
+int
sys_chown (const char *path, uid_t owner, gid_t group)
{
return chown (path, owner, group);
@@ -168,21 +168,21 @@ sys_lchown (const char *path, uid_t owner, gid_t group)
}
-int
+int
sys_truncate (const char *path, off_t length)
{
return truncate (path, length);
}
-int
+int
sys_ftruncate (int fd, off_t length)
{
return ftruncate (fd, length);
}
-int
+int
sys_utimes (const char *filename, const struct timeval times[2])
{
return utimes (filename, times);
@@ -217,7 +217,7 @@ sys_read (int fd, void *buf, size_t count)
}
-ssize_t
+ssize_t
sys_write (int fd, const void *buf, size_t count)
{
return write (fd, buf, count);
@@ -238,21 +238,21 @@ sys_statvfs (const char *path, struct statvfs *buf)
}
-int
+int
sys_close (int fd)
{
return close (fd);
}
-int
+int
sys_fsync (int fd)
{
return fsync (fd);
}
-int
+int
sys_fdatasync (int fd)
{
#ifdef HAVE_FDATASYNC
@@ -263,36 +263,36 @@ sys_fdatasync (int fd)
}
-int
-sys_lsetxattr (const char *path, const char *name, const void *value,
- size_t size, int flags)
+int
+sys_lsetxattr (const char *path, const char *name, const void *value,
+ size_t size, int flags)
{
-
+
#ifdef GF_LINUX_HOST_OS
return lsetxattr (path, name, value, size, flags);
#endif
#ifdef GF_BSD_HOST_OS
- return extattr_set_link (path, EXTATTR_NAMESPACE_USER,
+ return extattr_set_link (path, EXTATTR_NAMESPACE_USER,
name, value, size);
#endif
-
+
#ifdef GF_SOLARIS_HOST_OS
return solaris_setxattr (path, name, value, size, flags);
#endif
#ifdef GF_DARWIN_HOST_OS
- return setxattr (path, name, value, size, 0,
+ return setxattr (path, name, value, size, 0,
flags|XATTR_NOFOLLOW);
#endif
-
+
}
ssize_t
-sys_llistxattr (const char *path, char *list, size_t size)
+sys_llistxattr (const char *path, char *list, size_t size)
{
-
+
#ifdef GF_LINUX_HOST_OS
return llistxattr (path, list, size);
#endif
@@ -300,7 +300,7 @@ sys_llistxattr (const char *path, char *list, size_t size)
#ifdef GF_BSD_HOST_OS
return extattr_list_link (path, EXTATTR_NAMESPACE_USER, list, size);
#endif
-
+
#ifdef GF_SOLARIS_HOST_OS
return solaris_listxattr (path, list, size);
#endif
@@ -308,23 +308,23 @@ sys_llistxattr (const char *path, char *list, size_t size)
#ifdef GF_DARWIN_HOST_OS
return listxattr (path, list, size, XATTR_NOFOLLOW);
#endif
-
+
}
ssize_t
-sys_lgetxattr (const char *path, const char *name, void *value, size_t size)
+sys_lgetxattr (const char *path, const char *name, void *value, size_t size)
{
-
+
#ifdef GF_LINUX_HOST_OS
return lgetxattr (path, name, value, size);
#endif
#ifdef GF_BSD_HOST_OS
- return extattr_get_link (path, EXTATTR_NAMESPACE_USER, name, value,
+ return extattr_get_link (path, EXTATTR_NAMESPACE_USER, name, value,
size);
#endif
-
+
#ifdef GF_SOLARIS_HOST_OS
return solaris_getxattr (path, name, value, size);
#endif
@@ -336,19 +336,19 @@ sys_lgetxattr (const char *path, const char *name, void *value, size_t size)
}
-ssize_t
-sys_fgetxattr (int filedes, const char *name, void *value, size_t size)
+ssize_t
+sys_fgetxattr (int filedes, const char *name, void *value, size_t size)
{
-
+
#ifdef GF_LINUX_HOST_OS
return fgetxattr (filedes, name, value, size);
#endif
#ifdef GF_BSD_HOST_OS
- return extattr_get_fd (filedes, EXTATTR_NAMESPACE_USER, name,
+ return extattr_get_fd (filedes, EXTATTR_NAMESPACE_USER, name,
value, size);
#endif
-
+
#ifdef GF_SOLARIS_HOST_OS
return solaris_fgetxattr (filedes, name, value, size);
#endif
@@ -360,8 +360,8 @@ sys_fgetxattr (int filedes, const char *name, void *value, size_t size)
}
-int
-sys_fsetxattr (int filedes, const char *name, const void *value,
+int
+sys_fsetxattr (int filedes, const char *name, const void *value,
size_t size, int flags)
{
@@ -370,10 +370,10 @@ sys_fsetxattr (int filedes, const char *name, const void *value,
#endif
#ifdef GF_BSD_HOST_OS
- return extattr_set_fd (filedes, EXTATTR_NAMESPACE_USER, name,
+ return extattr_set_fd (filedes, EXTATTR_NAMESPACE_USER, name,
value, size);
#endif
-
+
#ifdef GF_SOLARIS_HOST_OS
return solaris_fsetxattr (filedes, name, value, size, flags);
#endif
@@ -385,10 +385,10 @@ sys_fsetxattr (int filedes, const char *name, const void *value,
}
-ssize_t
-sys_flistxattr (int filedes, char *list, size_t size)
+ssize_t
+sys_flistxattr (int filedes, char *list, size_t size)
{
-
+
#ifdef GF_LINUX_HOST_OS
return flistxattr (filedes, list, size);
#endif
@@ -408,10 +408,10 @@ sys_flistxattr (int filedes, char *list, size_t size)
}
-int
+int
sys_lremovexattr (const char *path, const char *name)
{
-
+
#ifdef GF_LINUX_HOST_OS
return lremovexattr (path, name);
#endif
@@ -419,7 +419,7 @@ sys_lremovexattr (const char *path, const char *name)
#ifdef GF_BSD_HOST_OS
return extattr_delete_link (path, EXTATTR_NAMESPACE_USER, name);
#endif
-
+
#ifdef GF_SOLARIS_HOST_OS
return solaris_removexattr (path, name);
#endif
@@ -431,7 +431,7 @@ sys_lremovexattr (const char *path, const char *name)
}
-int
+int
sys_access (const char *pathname, int mode)
{
return access (pathname, mode);
diff --git a/libglusterfs/src/timer.c b/libglusterfs/src/timer.c
index b926644ff31..20d45bbb377 100644
--- a/libglusterfs/src/timer.c
+++ b/libglusterfs/src/timer.c
@@ -1,20 +1,20 @@
/*
- Copyright (c) 2007-2010 Gluster, Inc. <http://www.gluster.com>
- This file is part of GlusterFS.
-
- GlusterFS is free software; you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation; either version 3 of the License,
- or (at your option) any later version.
-
- GlusterFS 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
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see
- <http://www.gnu.org/licenses/>.
+ Copyright (c) 2007-2010 Gluster, Inc. <http://www.gluster.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
*/
#ifndef _CONFIG_H
@@ -39,7 +39,7 @@ gf_timer_call_after (glusterfs_ctx_t *ctx,
gf_timer_t *event = NULL;
gf_timer_t *trav = NULL;
unsigned long long at = 0L;
-
+
if (ctx == NULL)
{
gf_log ("timer", GF_LOG_ERROR, "invalid argument");
@@ -92,7 +92,7 @@ gf_timer_call_stale (gf_timer_registry_t *reg,
gf_log ("timer", GF_LOG_ERROR, "invalid argument");
return 0;
}
-
+
event->next->prev = event->prev;
event->prev->next = event->next;
event->next = &reg->stale;
@@ -108,13 +108,13 @@ gf_timer_call_cancel (glusterfs_ctx_t *ctx,
gf_timer_t *event)
{
gf_timer_registry_t *reg = NULL;
-
+
if (ctx == NULL || event == NULL)
{
gf_log ("timer", GF_LOG_ERROR, "invalid argument");
return 0;
}
-
+
reg = gf_timer_registry_init (ctx);
if (!reg) {
gf_log ("timer", GF_LOG_ERROR, "!reg");
@@ -137,13 +137,13 @@ void *
gf_timer_proc (void *ctx)
{
gf_timer_registry_t *reg = NULL;
-
+
if (ctx == NULL)
{
gf_log ("timer", GF_LOG_ERROR, "invalid argument");
return NULL;
}
-
+
reg = gf_timer_registry_init (ctx);
if (!reg) {
gf_log ("timer", GF_LOG_ERROR, "!reg");