From 9d3af972f516b6ba38d2736ce2016e34a452d569 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Tue, 20 Mar 2012 17:22:24 +0530 Subject: core: adding extra data for fops with this change, the xlator APIs will have a dictionary as extra argument, which is passed between all the layers. This can be utilized for overloading in some of the operations. Change-Id: I58a8186b3ef647650280e63f3e5e9b9de7827b40 Signed-off-by: Amar Tumballi BUG: 782265 Reviewed-on: http://review.gluster.com/2960 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfs/src/call-stub.h | 187 +++++++++++++++++++++---------------------- 1 file changed, 92 insertions(+), 95 deletions(-) (limited to 'libglusterfs/src/call-stub.h') diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h index 081f6d200f0..85e04ec6967 100644 --- a/libglusterfs/src/call-stub.h +++ b/libglusterfs/src/call-stub.h @@ -34,21 +34,20 @@ typedef struct { char wind; call_frame_t *frame; glusterfs_fop_t fop; - struct mem_pool *stub_mem_pool; /* pointer to stub mempool in glusterfs ctx */ + struct mem_pool *stub_mem_pool; /* pointer to stub mempool in ctx_t */ + dict_t *xdata; /* common accross all the fops */ union { /* lookup */ struct { fop_lookup_t fn; loc_t loc; - dict_t *xattr_req; } lookup; struct { fop_lookup_cbk_t fn; int32_t op_ret, op_errno; inode_t *inode; struct iatt buf; - dict_t *dict; struct iatt postparent; } lookup_cbk; @@ -130,7 +129,7 @@ typedef struct { loc_t loc; mode_t mode; dev_t rdev; - dict_t *params; + mode_t umask; } mknod; struct { fop_mknod_cbk_t fn; @@ -146,7 +145,7 @@ typedef struct { fop_mkdir_t fn; loc_t loc; mode_t mode; - dict_t *params; + mode_t umask; } mkdir; struct { fop_mkdir_cbk_t fn; @@ -161,6 +160,7 @@ typedef struct { struct { fop_unlink_t fn; loc_t loc; + int xflag; } unlink; struct { fop_unlink_cbk_t fn; @@ -187,7 +187,7 @@ typedef struct { fop_symlink_t fn; const char *linkname; loc_t loc; - dict_t *params; + mode_t umask; } symlink; struct { fop_symlink_cbk_t fn; @@ -236,7 +236,7 @@ typedef struct { int32_t flags; mode_t mode; fd_t *fd; - dict_t *params; + mode_t umask; } create; struct { fop_create_cbk_t fn; @@ -254,7 +254,6 @@ typedef struct { loc_t loc; int32_t flags; fd_t *fd; - int32_t wbflags; } open; struct { fop_open_cbk_t fn; @@ -516,7 +515,6 @@ typedef struct { fd_t *fd; size_t size; off_t off; - dict_t *dict; } readdirp; struct { fop_readdirp_cbk_t fn; @@ -603,7 +601,7 @@ call_stub_t * fop_lookup_stub (call_frame_t *frame, fop_lookup_t fn, loc_t *loc, - dict_t *xattr_req); + dict_t *xdata); call_stub_t * fop_lookup_cbk_stub (call_frame_t *frame, @@ -612,34 +610,34 @@ fop_lookup_cbk_stub (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct iatt *buf, - dict_t *dict, + dict_t *xdata, struct iatt *postparent); call_stub_t * fop_stat_stub (call_frame_t *frame, fop_stat_t fn, - loc_t *loc); + loc_t *loc, dict_t *xdata); 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); + struct iatt *buf, dict_t *xdata); call_stub_t * fop_fstat_stub (call_frame_t *frame, fop_fstat_t fn, - fd_t *fd); + fd_t *fd, dict_t *xdata); 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); + struct iatt *buf, dict_t *xdata); call_stub_t * fop_truncate_stub (call_frame_t *frame, fop_truncate_t fn, loc_t *loc, - off_t off); + off_t off, dict_t *xdata); call_stub_t * fop_truncate_cbk_stub (call_frame_t *frame, @@ -647,13 +645,13 @@ fop_truncate_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf); + struct iatt *postbuf, dict_t *xdata); call_stub_t * fop_ftruncate_stub (call_frame_t *frame, fop_ftruncate_t fn, fd_t *fd, - off_t off); + off_t off, dict_t *xdata); call_stub_t * fop_ftruncate_cbk_stub (call_frame_t *frame, @@ -661,25 +659,25 @@ fop_ftruncate_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf); + struct iatt *postbuf, dict_t *xdata); call_stub_t * fop_access_stub (call_frame_t *frame, fop_access_t fn, loc_t *loc, - int32_t mask); + int32_t mask, dict_t *xdata); call_stub_t * fop_access_cbk_stub (call_frame_t *frame, fop_access_cbk_t fn, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, dict_t *xdata); call_stub_t * fop_readlink_stub (call_frame_t *frame, fop_readlink_t fn, loc_t *loc, - size_t size); + size_t size, dict_t *xdata); call_stub_t * fop_readlink_cbk_stub (call_frame_t *frame, @@ -687,11 +685,11 @@ fop_readlink_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, const char *path, - struct iatt *buf); + struct iatt *buf, dict_t *xdata); 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); +fop_mknod_stub (call_frame_t *frame, fop_mknod_t fn, loc_t *loc, mode_t mode, + dev_t rdev, mode_t umask, dict_t *xdata); call_stub_t * fop_mknod_cbk_stub (call_frame_t *frame, @@ -701,11 +699,11 @@ fop_mknod_cbk_stub (call_frame_t *frame, inode_t *inode, struct iatt *buf, struct iatt *preparent, - struct iatt *postparent); + struct iatt *postparent, dict_t *xdata); call_stub_t * -fop_mkdir_stub (call_frame_t *frame, fop_mkdir_t fn, - loc_t *loc, mode_t mode, dict_t *params); +fop_mkdir_stub (call_frame_t *frame, fop_mkdir_t fn, loc_t *loc, mode_t mode, + mode_t umask, dict_t *xdata); call_stub_t * fop_mkdir_cbk_stub (call_frame_t *frame, @@ -715,12 +713,11 @@ fop_mkdir_cbk_stub (call_frame_t *frame, inode_t *inode, struct iatt *buf, struct iatt *preparent, - struct iatt *postparent); + struct iatt *postparent, dict_t *xdata); call_stub_t * -fop_unlink_stub (call_frame_t *frame, - fop_unlink_t fn, - loc_t *loc); +fop_unlink_stub (call_frame_t *frame, fop_unlink_t fn, + loc_t *loc, int xflag, dict_t *xdata); call_stub_t * fop_unlink_cbk_stub (call_frame_t *frame, @@ -728,11 +725,11 @@ fop_unlink_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, struct iatt *preparent, - struct iatt *postparent); + struct iatt *postparent, dict_t *xdata); call_stub_t * fop_rmdir_stub (call_frame_t *frame, fop_rmdir_t fn, - loc_t *loc, int flags); + loc_t *loc, int flags, dict_t *xdata); call_stub_t * fop_rmdir_cbk_stub (call_frame_t *frame, @@ -740,11 +737,11 @@ fop_rmdir_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, struct iatt *preparent, - struct iatt *postparent); + struct iatt *postparent, dict_t *xdata); 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, mode_t umask, dict_t *xdata); call_stub_t * fop_symlink_cbk_stub (call_frame_t *frame, @@ -754,13 +751,13 @@ fop_symlink_cbk_stub (call_frame_t *frame, inode_t *inode, struct iatt *buf, struct iatt *preparent, - struct iatt *postparent); + struct iatt *postparent, dict_t *xdata); call_stub_t * fop_rename_stub (call_frame_t *frame, fop_rename_t fn, loc_t *oldloc, - loc_t *newloc); + loc_t *newloc, dict_t *xdata); call_stub_t * fop_rename_cbk_stub (call_frame_t *frame, @@ -771,13 +768,13 @@ fop_rename_cbk_stub (call_frame_t *frame, struct iatt *preoldparent, struct iatt *postoldparent, struct iatt *prenewparent, - struct iatt *postnewparent); + struct iatt *postnewparent, dict_t *xdata); call_stub_t * fop_link_stub (call_frame_t *frame, fop_link_t fn, loc_t *oldloc, - loc_t *newloc); + loc_t *newloc, dict_t *xdata); call_stub_t * fop_link_cbk_stub (call_frame_t *frame, @@ -787,12 +784,12 @@ fop_link_cbk_stub (call_frame_t *frame, inode_t *inode, struct iatt *buf, struct iatt *preparent, - struct iatt *postparent); + struct iatt *postparent, dict_t *xdata); call_stub_t * fop_create_stub (call_frame_t *frame, fop_create_t fn, loc_t *loc, int32_t flags, mode_t mode, - fd_t *fd, dict_t *params); + mode_t umask, fd_t *fd, dict_t *xdata); call_stub_t * fop_create_cbk_stub (call_frame_t *frame, @@ -803,7 +800,7 @@ fop_create_cbk_stub (call_frame_t *frame, inode_t *inode, struct iatt *buf, struct iatt *preparent, - struct iatt *postparent); + struct iatt *postparent, dict_t *xdata); call_stub_t * fop_open_stub (call_frame_t *frame, @@ -811,21 +808,21 @@ fop_open_stub (call_frame_t *frame, loc_t *loc, int32_t flags, fd_t *fd, - int32_t wbflags); + dict_t *xdata); 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); + fd_t *fd, dict_t *xdata); call_stub_t * fop_readv_stub (call_frame_t *frame, fop_readv_t fn, fd_t *fd, size_t size, - off_t off, uint32_t flags); + off_t off, uint32_t flags, dict_t *xdata); call_stub_t * fop_readv_cbk_stub (call_frame_t *frame, @@ -835,7 +832,7 @@ fop_readv_cbk_stub (call_frame_t *frame, struct iovec *vector, int32_t count, struct iatt *stbuf, - struct iobref *iobref); + struct iobref *iobref, dict_t *xdata); call_stub_t * fop_writev_stub (call_frame_t *frame, @@ -844,7 +841,7 @@ fop_writev_stub (call_frame_t *frame, struct iovec *vector, int32_t count, off_t off, uint32_t flags, - struct iobref *iobref); + struct iobref *iobref, dict_t *xdata); call_stub_t * fop_writev_cbk_stub (call_frame_t *frame, @@ -852,24 +849,24 @@ fop_writev_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf); + struct iatt *postbuf, dict_t *xdata); call_stub_t * fop_flush_stub (call_frame_t *frame, fop_flush_t fn, - fd_t *fd); + fd_t *fd, dict_t *xdata); call_stub_t * fop_flush_cbk_stub (call_frame_t *frame, fop_flush_cbk_t fn, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, dict_t *xdata); call_stub_t * fop_fsync_stub (call_frame_t *frame, fop_fsync_t fn, fd_t *fd, - int32_t datasync); + int32_t datasync, dict_t *xdata); call_stub_t * fop_fsync_cbk_stub (call_frame_t *frame, @@ -877,177 +874,177 @@ fop_fsync_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf); + struct iatt *postbuf, dict_t *xdata); call_stub_t * fop_opendir_stub (call_frame_t *frame, fop_opendir_t fn, - loc_t *loc, fd_t *fd); + loc_t *loc, fd_t *fd, dict_t *xdata); 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); + fd_t *fd, dict_t *xdata); call_stub_t * fop_fsyncdir_stub (call_frame_t *frame, fop_fsyncdir_t fn, fd_t *fd, - int32_t datasync); + int32_t datasync, dict_t *xdata); call_stub_t * fop_fsyncdir_cbk_stub (call_frame_t *frame, fop_fsyncdir_cbk_t fn, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, dict_t *xdata); call_stub_t * fop_statfs_stub (call_frame_t *frame, fop_statfs_t fn, - loc_t *loc); + loc_t *loc, dict_t *xdata); 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); + struct statvfs *buf, dict_t *xdata); call_stub_t * fop_setxattr_stub (call_frame_t *frame, fop_setxattr_t fn, loc_t *loc, dict_t *dict, - int32_t flags); + int32_t flags, dict_t *xdata); call_stub_t * fop_setxattr_cbk_stub (call_frame_t *frame, fop_setxattr_cbk_t fn, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, dict_t *xdata); call_stub_t * fop_getxattr_stub (call_frame_t *frame, fop_getxattr_t fn, loc_t *loc, - const char *name); + const char *name, dict_t *xdata); 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 *value); + dict_t *value, dict_t *xdata); call_stub_t * fop_fsetxattr_stub (call_frame_t *frame, fop_fsetxattr_t fn, fd_t *fd, dict_t *dict, - int32_t flags); + int32_t flags, dict_t *xdata); call_stub_t * fop_fsetxattr_cbk_stub (call_frame_t *frame, fop_fsetxattr_cbk_t fn, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, dict_t *xdata); call_stub_t * fop_fgetxattr_stub (call_frame_t *frame, fop_fgetxattr_t fn, fd_t *fd, - const char *name); + const char *name, dict_t *xdata); call_stub_t * fop_fgetxattr_cbk_stub (call_frame_t *frame, fop_fgetxattr_cbk_t fn, int32_t op_ret, int32_t op_errno, - dict_t *value); + dict_t *value, dict_t *xdata); call_stub_t * fop_removexattr_stub (call_frame_t *frame, fop_removexattr_t fn, loc_t *loc, - const char *name); + const char *name, dict_t *xdata); call_stub_t * fop_removexattr_cbk_stub (call_frame_t *frame, fop_removexattr_cbk_t fn, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, dict_t *xdata); call_stub_t * fop_fremovexattr_stub (call_frame_t *frame, fop_fremovexattr_t fn, fd_t *fd, - const char *name); + const char *name, dict_t *xdata); call_stub_t * fop_fremovexattr_cbk_stub (call_frame_t *frame, fop_fremovexattr_cbk_t fn, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, dict_t *xdata); call_stub_t * fop_lk_stub (call_frame_t *frame, fop_lk_t fn, fd_t *fd, int32_t cmd, - struct gf_flock *lock); + struct gf_flock *lock, dict_t *xdata); 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); + struct gf_flock *lock, dict_t *xdata); 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); + struct gf_flock *lock, dict_t *xdata); 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); + struct gf_flock *lock, dict_t *xdata); call_stub_t * fop_entrylk_stub (call_frame_t *frame, fop_entrylk_t fn, const char *volume, loc_t *loc, const char *basename, - entrylk_cmd cmd, entrylk_type type); + entrylk_cmd cmd, entrylk_type type, dict_t *xdata); call_stub_t * fop_fentrylk_stub (call_frame_t *frame, fop_fentrylk_t fn, const char *volume, fd_t *fd, const char *basename, - entrylk_cmd cmd, entrylk_type type); + entrylk_cmd cmd, entrylk_type type, dict_t *xdata); 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, dict_t *xdata); 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, dict_t *xdata); 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, dict_t *xdata); call_stub_t * fop_fentrylk_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, dict_t *xdata); call_stub_t * fop_readdir_stub (call_frame_t *frame, fop_readdir_t fn, fd_t *fd, size_t size, - off_t off); + off_t off, dict_t *xdata); call_stub_t * fop_readdirp_stub (call_frame_t *frame, @@ -1055,27 +1052,27 @@ fop_readdirp_stub (call_frame_t *frame, fd_t *fd, size_t size, off_t off, - dict_t *dict); + dict_t *xdata); call_stub_t * fop_readdirp_cbk_stub (call_frame_t *frame, fop_readdir_cbk_t fn, int32_t op_ret, int32_t op_errno, - gf_dirent_t *entries); + gf_dirent_t *entries, dict_t *xdata); 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); + gf_dirent_t *entries, dict_t *xdata); call_stub_t * fop_rchecksum_stub (call_frame_t *frame, fop_rchecksum_t fn, fd_t *fd, off_t offset, - int32_t len); + int32_t len, dict_t *xdata); call_stub_t * fop_rchecksum_cbk_stub (call_frame_t *frame, @@ -1083,40 +1080,40 @@ fop_rchecksum_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, uint32_t weak_checksum, - uint8_t *strong_checksum); + uint8_t *strong_checksum, dict_t *xdata); 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); + dict_t *xattr, dict_t *xdata); call_stub_t * fop_xattrop_stub_cbk_stub (call_frame_t *frame, fop_xattrop_cbk_t fn, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, dict_t *xdata); 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); + dict_t *xattr, dict_t *xdata); call_stub_t * fop_fxattrop_stub_cbk_stub (call_frame_t *frame, fop_xattrop_cbk_t fn, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, dict_t *xdata); call_stub_t * fop_setattr_stub (call_frame_t *frame, fop_setattr_t fn, loc_t *loc, struct iatt *stbuf, - int32_t valid); + int32_t valid, dict_t *xdata); call_stub_t * fop_setattr_cbk_stub (call_frame_t *frame, @@ -1124,14 +1121,14 @@ fop_setattr_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, struct iatt *statpre, - struct iatt *statpost); + struct iatt *statpost, dict_t *xdata); call_stub_t * fop_fsetattr_stub (call_frame_t *frame, fop_fsetattr_t fn, fd_t *fd, struct iatt *stbuf, - int32_t valid); + int32_t valid, dict_t *xdata); call_stub_t * fop_fsetattr_cbk_stub (call_frame_t *frame, @@ -1139,7 +1136,7 @@ fop_fsetattr_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, struct iatt *statpre, - struct iatt *statpost); + struct iatt *statpost, dict_t *xdata); void call_resume (call_stub_t *stub); void call_stub_destroy (call_stub_t *stub); -- cgit