diff options
author | Amar Tumballi <amarts@redhat.com> | 2012-03-20 17:22:24 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-03-22 16:40:27 -0700 |
commit | 9d3af972f516b6ba38d2736ce2016e34a452d569 (patch) | |
tree | 1dcdc620748a42cdfb5464c3adaae5a4a3a6f869 /rpc/xdr/src | |
parent | afe542eca18888463798747d2a95e5a9d239a4a0 (diff) |
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 <amarts@redhat.com>
BUG: 782265
Reviewed-on: http://review.gluster.com/2960
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'rpc/xdr/src')
-rw-r--r-- | rpc/xdr/src/glusterfs3-xdr.c | 73 | ||||
-rw-r--r-- | rpc/xdr/src/glusterfs3-xdr.h | 32 | ||||
-rw-r--r-- | rpc/xdr/src/glusterfs3-xdr.x | 18 |
3 files changed, 72 insertions, 51 deletions
diff --git a/rpc/xdr/src/glusterfs3-xdr.c b/rpc/xdr/src/glusterfs3-xdr.c index 47d7328db28..5dffda3e070 100644 --- a/rpc/xdr/src/glusterfs3-xdr.c +++ b/rpc/xdr/src/glusterfs3-xdr.c @@ -317,9 +317,9 @@ xdr_gfs3_mknod_req (XDR *xdrs, gfs3_mknod_req *objp) return FALSE; if (!xdr_u_int (xdrs, &objp->mode)) return FALSE; - if (!xdr_string (xdrs, &objp->bname, ~0)) + if (!xdr_u_int (xdrs, &objp->umask)) return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) + if (!xdr_string (xdrs, &objp->bname, ~0)) return FALSE; if (!xdr_bytes (xdrs, (char **)&objp->xdata.xdata_val, (u_int *) &objp->xdata.xdata_len, ~0)) return FALSE; @@ -357,9 +357,9 @@ xdr_gfs3_mkdir_req (XDR *xdrs, gfs3_mkdir_req *objp) return FALSE; if (!xdr_u_int (xdrs, &objp->mode)) return FALSE; - if (!xdr_string (xdrs, &objp->bname, ~0)) + if (!xdr_u_int (xdrs, &objp->umask)) return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) + if (!xdr_string (xdrs, &objp->bname, ~0)) return FALSE; if (!xdr_bytes (xdrs, (char **)&objp->xdata.xdata_val, (u_int *) &objp->xdata.xdata_len, ~0)) return FALSE; @@ -397,6 +397,8 @@ xdr_gfs3_unlink_req (XDR *xdrs, gfs3_unlink_req *objp) return FALSE; if (!xdr_string (xdrs, &objp->bname, ~0)) return FALSE; + if (!xdr_u_int (xdrs, &objp->xflags)) + return FALSE; if (!xdr_bytes (xdrs, (char **)&objp->xdata.xdata_val, (u_int *) &objp->xdata.xdata_len, ~0)) return FALSE; return TRUE; @@ -429,7 +431,7 @@ xdr_gfs3_rmdir_req (XDR *xdrs, gfs3_rmdir_req *objp) if (!xdr_opaque (xdrs, objp->pargfid, 16)) return FALSE; - if (!xdr_int (xdrs, &objp->flags)) + if (!xdr_int (xdrs, &objp->xflags)) return FALSE; if (!xdr_string (xdrs, &objp->bname, ~0)) return FALSE; @@ -467,9 +469,9 @@ xdr_gfs3_symlink_req (XDR *xdrs, gfs3_symlink_req *objp) return FALSE; if (!xdr_string (xdrs, &objp->bname, ~0)) return FALSE; - if (!xdr_string (xdrs, &objp->linkname, ~0)) + if (!xdr_u_int (xdrs, &objp->umask)) return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) + if (!xdr_string (xdrs, &objp->linkname, ~0)) return FALSE; if (!xdr_bytes (xdrs, (char **)&objp->xdata.xdata_val, (u_int *) &objp->xdata.xdata_len, ~0)) return FALSE; @@ -623,8 +625,6 @@ xdr_gfs3_open_req (XDR *xdrs, gfs3_open_req *objp) return FALSE; if (!xdr_u_int (xdrs, &objp->flags)) return FALSE; - if (!xdr_u_int (xdrs, &objp->wbflags)) - return FALSE; if (!xdr_bytes (xdrs, (char **)&objp->xdata.xdata_val, (u_int *) &objp->xdata.xdata_len, ~0)) return FALSE; return TRUE; @@ -701,8 +701,6 @@ xdr_gfs3_lookup_req (XDR *xdrs, gfs3_lookup_req *objp) return FALSE; if (!xdr_string (xdrs, &objp->bname, ~0)) return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) - return FALSE; if (!xdr_bytes (xdrs, (char **)&objp->xdata.xdata_val, (u_int *) &objp->xdata.xdata_len, ~0)) return FALSE; return TRUE; @@ -722,8 +720,6 @@ xdr_gfs3_lookup_rsp (XDR *xdrs, gfs3_lookup_rsp *objp) return FALSE; if (!xdr_gf_iatt (xdrs, &objp->postparent)) return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) - return FALSE; if (!xdr_bytes (xdrs, (char **)&objp->xdata.xdata_val, (u_int *) &objp->xdata.xdata_len, ~0)) return FALSE; return TRUE; @@ -1272,15 +1268,62 @@ xdr_gfs3_create_req (XDR *xdrs, gfs3_create_req *objp) register int32_t *buf; buf = NULL; + + if (xdrs->x_op == XDR_ENCODE) { + if (!xdr_opaque (xdrs, objp->pargfid, 16)) + return FALSE; + buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_u_int (xdrs, &objp->flags)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->mode)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->umask)) + return FALSE; + + } else { + IXDR_PUT_U_LONG(buf, objp->flags); + IXDR_PUT_U_LONG(buf, objp->mode); + IXDR_PUT_U_LONG(buf, objp->umask); + } + if (!xdr_string (xdrs, &objp->bname, ~0)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->xdata.xdata_val, (u_int *) &objp->xdata.xdata_len, ~0)) + return FALSE; + return TRUE; + } else if (xdrs->x_op == XDR_DECODE) { + if (!xdr_opaque (xdrs, objp->pargfid, 16)) + return FALSE; + buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_u_int (xdrs, &objp->flags)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->mode)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->umask)) + return FALSE; + + } else { + objp->flags = IXDR_GET_U_LONG(buf); + objp->mode = IXDR_GET_U_LONG(buf); + objp->umask = IXDR_GET_U_LONG(buf); + } + if (!xdr_string (xdrs, &objp->bname, ~0)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->xdata.xdata_val, (u_int *) &objp->xdata.xdata_len, ~0)) + return FALSE; + return TRUE; + } + if (!xdr_opaque (xdrs, objp->pargfid, 16)) return FALSE; if (!xdr_u_int (xdrs, &objp->flags)) return FALSE; if (!xdr_u_int (xdrs, &objp->mode)) return FALSE; - if (!xdr_string (xdrs, &objp->bname, ~0)) + if (!xdr_u_int (xdrs, &objp->umask)) return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) + if (!xdr_string (xdrs, &objp->bname, ~0)) return FALSE; if (!xdr_bytes (xdrs, (char **)&objp->xdata.xdata_val, (u_int *) &objp->xdata.xdata_len, ~0)) return FALSE; diff --git a/rpc/xdr/src/glusterfs3-xdr.h b/rpc/xdr/src/glusterfs3-xdr.h index 49e9d6cc0b4..124b21e2266 100644 --- a/rpc/xdr/src/glusterfs3-xdr.h +++ b/rpc/xdr/src/glusterfs3-xdr.h @@ -137,12 +137,9 @@ struct gfs3_mknod_req { char pargfid[16]; u_quad_t dev; u_int mode; + u_int umask; char *bname; struct { - u_int dict_len; - char *dict_val; - } dict; - struct { u_int xdata_len; char *xdata_val; } xdata; @@ -165,12 +162,9 @@ typedef struct gfs3_mknod_rsp gfs3_mknod_rsp; struct gfs3_mkdir_req { char pargfid[16]; u_int mode; + u_int umask; char *bname; struct { - u_int dict_len; - char *dict_val; - } dict; - struct { u_int xdata_len; char *xdata_val; } xdata; @@ -193,6 +187,7 @@ typedef struct gfs3_mkdir_rsp gfs3_mkdir_rsp; struct gfs3_unlink_req { char pargfid[16]; char *bname; + u_int xflags; struct { u_int xdata_len; char *xdata_val; @@ -214,7 +209,7 @@ typedef struct gfs3_unlink_rsp gfs3_unlink_rsp; struct gfs3_rmdir_req { char pargfid[16]; - int flags; + int xflags; char *bname; struct { u_int xdata_len; @@ -238,12 +233,9 @@ typedef struct gfs3_rmdir_rsp gfs3_rmdir_rsp; struct gfs3_symlink_req { char pargfid[16]; char *bname; + u_int umask; char *linkname; struct { - u_int dict_len; - char *dict_val; - } dict; - struct { u_int xdata_len; char *xdata_val; } xdata; @@ -339,7 +331,6 @@ typedef struct gfs3_truncate_rsp gfs3_truncate_rsp; struct gfs3_open_req { char gfid[16]; u_int flags; - u_int wbflags; struct { u_int xdata_len; char *xdata_val; @@ -389,10 +380,6 @@ struct gfs3_lookup_req { u_int flags; char *bname; struct { - u_int dict_len; - char *dict_val; - } dict; - struct { u_int xdata_len; char *xdata_val; } xdata; @@ -405,10 +392,6 @@ struct gfs3_lookup_rsp { struct gf_iatt stat; struct gf_iatt postparent; struct { - u_int dict_len; - char *dict_val; - } dict; - struct { u_int xdata_len; char *xdata_val; } xdata; @@ -789,12 +772,9 @@ struct gfs3_create_req { char pargfid[16]; u_int flags; u_int mode; + u_int umask; char *bname; struct { - u_int dict_len; - char *dict_val; - } dict; - struct { u_int xdata_len; char *xdata_val; } xdata; diff --git a/rpc/xdr/src/glusterfs3-xdr.x b/rpc/xdr/src/glusterfs3-xdr.x index f35820b57cb..64c2d206113 100644 --- a/rpc/xdr/src/glusterfs3-xdr.x +++ b/rpc/xdr/src/glusterfs3-xdr.x @@ -73,8 +73,8 @@ struct gfs3_readlink_req { opaque pargfid[16]; unsigned hyper dev; unsigned int mode; + unsigned int umask; string bname<>; /* NULL terminated */ - opaque dict<>; opaque xdata<>; /* Extra data */ } ; struct gfs3_mknod_rsp { @@ -90,9 +90,9 @@ struct gfs3_readlink_req { struct gfs3_mkdir_req { opaque pargfid[16]; unsigned int mode; + unsigned int umask; string bname<>; /* NULL terminated */ - opaque dict<>; - opaque xdata<>; /* Extra data */ + opaque xdata<>; /* Extra data */ } ; struct gfs3_mkdir_rsp { int op_ret; @@ -107,6 +107,7 @@ struct gfs3_readlink_req { struct gfs3_unlink_req { opaque pargfid[16]; string bname<>; /* NULL terminated */ + unsigned int xflags; opaque xdata<>; /* Extra data */ }; struct gfs3_unlink_rsp { @@ -120,9 +121,9 @@ struct gfs3_readlink_req { struct gfs3_rmdir_req { opaque pargfid[16]; - int flags; + int xflags; string bname<>; /* NULL terminated */ - opaque xdata<>; /* Extra data */ + opaque xdata<>; /* Extra data */ }; struct gfs3_rmdir_rsp { int op_ret; @@ -136,8 +137,8 @@ struct gfs3_readlink_req { struct gfs3_symlink_req { opaque pargfid[16]; string bname<>; + unsigned int umask; string linkname<>; - opaque dict<>; opaque xdata<>; /* Extra data */ }; struct gfs3_symlink_rsp { @@ -201,7 +202,6 @@ struct gfs3_readlink_req { struct gfs3_open_req { opaque gfid[16]; unsigned int flags; - unsigned int wbflags; opaque xdata<>; /* Extra data */ }; struct gfs3_open_rsp { @@ -233,7 +233,6 @@ struct gfs3_lookup_req { opaque pargfid[16]; unsigned int flags; string bname<>; - opaque dict<>; opaque xdata<>; /* Extra data */ }; struct gfs3_lookup_rsp { @@ -241,7 +240,6 @@ struct gfs3_lookup_req { int op_errno; struct gf_iatt stat; struct gf_iatt postparent; - opaque dict<>; opaque xdata<>; /* Extra data */ } ; @@ -482,8 +480,8 @@ struct gfs3_create_req { opaque pargfid[16]; unsigned int flags; unsigned int mode; + unsigned int umask; string bname<>; - opaque dict<>; opaque xdata<>; /* Extra data */ } ; struct gfs3_create_rsp { |