diff options
author | Shehjar Tikoo <shehjart@gluster.com> | 2010-08-10 02:41:54 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-08-10 02:44:22 -0700 |
commit | 0af39ff8d03173a7ba3df1b13476b7ed447131aa (patch) | |
tree | 2180ff57269b73aa8fee6a5802a8d5d4a169f624 /xlators | |
parent | b0304d47f67aa8fa677e4898fa46b96df88c8322 (diff) |
nfs, nfs/rpc: Rename functions to prevent gfrpcsvc conflict
Signed-off-by: Shehjar Tikoo <shehjart@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 1274 (nfs fails to start)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1274
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/nfs/lib/src/auth-null.c | 19 | ||||
-rw-r--r-- | xlators/nfs/lib/src/auth-unix.c | 23 | ||||
-rw-r--r-- | xlators/nfs/lib/src/msg-nfs3.c | 194 | ||||
-rw-r--r-- | xlators/nfs/lib/src/rpc-socket.c | 34 | ||||
-rw-r--r-- | xlators/nfs/lib/src/rpc-socket.h | 22 | ||||
-rw-r--r-- | xlators/nfs/lib/src/rpcsvc-auth.c | 66 | ||||
-rw-r--r-- | xlators/nfs/lib/src/rpcsvc.c | 682 | ||||
-rw-r--r-- | xlators/nfs/lib/src/rpcsvc.h | 151 | ||||
-rw-r--r-- | xlators/nfs/lib/src/xdr-common.h | 14 | ||||
-rw-r--r-- | xlators/nfs/lib/src/xdr-rpc.c | 44 | ||||
-rw-r--r-- | xlators/nfs/lib/src/xdr-rpc.h | 54 | ||||
-rw-r--r-- | xlators/nfs/server/src/mount3.c | 75 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs.c | 12 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs3-helpers.c | 2 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs3.c | 439 |
15 files changed, 948 insertions, 883 deletions
diff --git a/xlators/nfs/lib/src/auth-null.c b/xlators/nfs/lib/src/auth-null.c index b162db11247..a98d4728000 100644 --- a/xlators/nfs/lib/src/auth-null.c +++ b/xlators/nfs/lib/src/auth-null.c @@ -29,7 +29,7 @@ int -auth_null_request_init (rpcsvc_request_t *req, void *priv) +nfs_auth_null_request_init (rpcsvc_request_t *req, void *priv) { if (!req) return -1; @@ -43,29 +43,30 @@ auth_null_request_init (rpcsvc_request_t *req, void *priv) return 0; } -int auth_null_authenticate (rpcsvc_request_t *req, void *priv) +int +nfs_auth_null_authenticate (rpcsvc_request_t *req, void *priv) { /* Always succeed. */ return RPCSVC_AUTH_ACCEPT; } -rpcsvc_auth_ops_t auth_null_ops = { +rpcsvc_auth_ops_t nfs_auth_null_ops = { .conn_init = NULL, - .request_init = auth_null_request_init, - .authenticate = auth_null_authenticate + .request_init = nfs_auth_null_request_init, + .authenticate = nfs_auth_null_authenticate }; -rpcsvc_auth_t rpcsvc_auth_null = { +rpcsvc_auth_t nfs_rpcsvc_auth_null = { .authname = "AUTH_NULL", .authnum = AUTH_NULL, - .authops = &auth_null_ops, + .authops = &nfs_auth_null_ops, .authprivate = NULL }; rpcsvc_auth_t * -rpcsvc_auth_null_init (rpcsvc_t *svc, dict_t *options) +nfs_rpcsvc_auth_null_init (rpcsvc_t *svc, dict_t *options) { - return &rpcsvc_auth_null; + return &nfs_rpcsvc_auth_null; } diff --git a/xlators/nfs/lib/src/auth-unix.c b/xlators/nfs/lib/src/auth-unix.c index 0eaf0686654..a3e9c83bae1 100644 --- a/xlators/nfs/lib/src/auth-unix.c +++ b/xlators/nfs/lib/src/auth-unix.c @@ -31,7 +31,7 @@ int -auth_unix_request_init (rpcsvc_request_t *req, void *priv) +nfs_auth_unix_request_init (rpcsvc_request_t *req, void *priv) { if (!req) return -1; @@ -42,7 +42,8 @@ auth_unix_request_init (rpcsvc_request_t *req, void *priv) return 0; } -int auth_unix_authenticate (rpcsvc_request_t *req, void *priv) +int +nfs_auth_unix_authenticate (rpcsvc_request_t *req, void *priv) { int ret = RPCSVC_AUTH_REJECT; struct authunix_parms aup; @@ -51,8 +52,8 @@ int auth_unix_authenticate (rpcsvc_request_t *req, void *priv) if (!req) return ret; - ret = xdr_to_auth_unix_cred (req->cred.authdata, req->cred.datalen, - &aup, machname, req->auxgids); + ret = nfs_xdr_to_auth_unix_cred (req->cred.authdata, req->cred.datalen, + &aup, machname, req->auxgids); if (ret == -1) { ret = RPCSVC_AUTH_REJECT; goto err; @@ -69,23 +70,23 @@ err: return ret; } -rpcsvc_auth_ops_t auth_unix_ops = { +rpcsvc_auth_ops_t nfs_auth_unix_ops = { .conn_init = NULL, - .request_init = auth_unix_request_init, - .authenticate = auth_unix_authenticate + .request_init = nfs_auth_unix_request_init, + .authenticate = nfs_auth_unix_authenticate }; -rpcsvc_auth_t rpcsvc_auth_unix = { +rpcsvc_auth_t nfs_rpcsvc_auth_unix = { .authname = "AUTH_UNIX", .authnum = AUTH_UNIX, - .authops = &auth_unix_ops, + .authops = &nfs_auth_unix_ops, .authprivate = NULL }; rpcsvc_auth_t * -rpcsvc_auth_unix_init (rpcsvc_t *svc, dict_t *options) +nfs_rpcsvc_auth_unix_init (rpcsvc_t *svc, dict_t *options) { - return &rpcsvc_auth_unix; + return &nfs_rpcsvc_auth_unix; } diff --git a/xlators/nfs/lib/src/msg-nfs3.c b/xlators/nfs/lib/src/msg-nfs3.c index 3eefd4c984d..9ad499364cf 100644 --- a/xlators/nfs/lib/src/msg-nfs3.c +++ b/xlators/nfs/lib/src/msg-nfs3.c @@ -56,7 +56,7 @@ xdr_to_mountpath (struct iovec outpath, struct iovec inmsg) goto ret; } - ret = xdr_decoded_length (xdr); + ret = nfs_xdr_decoded_length (xdr); ret: return ret; @@ -64,7 +64,7 @@ ret: ssize_t -xdr_serialize_generic (struct iovec outmsg, void *res, xdrproc_t proc) +nfs_xdr_serialize_generic (struct iovec outmsg, void *res, xdrproc_t proc) { ssize_t ret = -1; XDR xdr; @@ -80,7 +80,7 @@ xdr_serialize_generic (struct iovec outmsg, void *res, xdrproc_t proc) goto ret; } - ret = xdr_encoded_length (xdr); + ret = nfs_xdr_encoded_length (xdr); ret: return ret; @@ -88,7 +88,7 @@ ret: ssize_t -xdr_to_generic (struct iovec inmsg, void *args, xdrproc_t proc) +nfs_xdr_to_generic (struct iovec inmsg, void *args, xdrproc_t proc) { XDR xdr; ssize_t ret = -1; @@ -104,15 +104,15 @@ xdr_to_generic (struct iovec inmsg, void *args, xdrproc_t proc) goto ret; } - ret = xdr_decoded_length (xdr); + ret = nfs_xdr_decoded_length (xdr); ret: return ret; } ssize_t -xdr_to_generic_payload (struct iovec inmsg, void *args, xdrproc_t proc, - struct iovec *pendingpayload) +nfs_xdr_to_generic_payload (struct iovec inmsg, void *args, xdrproc_t proc, + struct iovec *pendingpayload) { XDR xdr; ssize_t ret = -1; @@ -128,11 +128,11 @@ xdr_to_generic_payload (struct iovec inmsg, void *args, xdrproc_t proc, goto ret; } - ret = xdr_decoded_length (xdr); + ret = nfs_xdr_decoded_length (xdr); if (pendingpayload) { - pendingpayload->iov_base = xdr_decoded_remaining_addr (xdr); - pendingpayload->iov_len = xdr_decoded_remaining_len (xdr); + pendingpayload->iov_base = nfs_xdr_decoded_remaining_addr (xdr); + pendingpayload->iov_len = nfs_xdr_decoded_remaining_len (xdr); } ret: @@ -147,135 +147,140 @@ ret: ssize_t xdr_serialize_mountres3 (struct iovec outmsg, mountres3 *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_mountres3); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_mountres3); } ssize_t xdr_serialize_mountbody (struct iovec outmsg, mountbody *mb) { - return xdr_serialize_generic (outmsg, (void *)mb, - (xdrproc_t)xdr_mountbody); + return nfs_xdr_serialize_generic (outmsg, (void *)mb, + (xdrproc_t)xdr_mountbody); } ssize_t xdr_serialize_mountlist (struct iovec outmsg, mountlist *ml) { - return xdr_serialize_generic (outmsg, (void *)ml, - (xdrproc_t)xdr_mountlist); + return nfs_xdr_serialize_generic (outmsg, (void *)ml, + (xdrproc_t)xdr_mountlist); } ssize_t xdr_serialize_mountstat3 (struct iovec outmsg, mountstat3 *m) { - return xdr_serialize_generic (outmsg, (void *)m, - (xdrproc_t)xdr_mountstat3); + return nfs_xdr_serialize_generic (outmsg, (void *)m, + (xdrproc_t)xdr_mountstat3); } ssize_t xdr_to_getattr3args (struct iovec inmsg, getattr3args *ga) { - return xdr_to_generic (inmsg, (void *)ga,(xdrproc_t)xdr_getattr3args); + return nfs_xdr_to_generic (inmsg, (void *)ga, + (xdrproc_t)xdr_getattr3args); } ssize_t xdr_serialize_getattr3res (struct iovec outmsg, getattr3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_getattr3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_getattr3res); } ssize_t xdr_serialize_setattr3res (struct iovec outmsg, setattr3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_setattr3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_setattr3res); } ssize_t xdr_to_setattr3args (struct iovec inmsg, setattr3args *sa) { - return xdr_to_generic (inmsg, (void *)sa, (xdrproc_t)xdr_setattr3args); + return nfs_xdr_to_generic (inmsg, (void *)sa, + (xdrproc_t)xdr_setattr3args); } ssize_t xdr_serialize_lookup3res (struct iovec outmsg, lookup3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_lookup3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_lookup3res); } ssize_t xdr_to_lookup3args (struct iovec inmsg, lookup3args *la) { - return xdr_to_generic (inmsg, (void *)la, (xdrproc_t)xdr_lookup3args); + return nfs_xdr_to_generic (inmsg, (void *)la, + (xdrproc_t)xdr_lookup3args); } ssize_t xdr_to_access3args (struct iovec inmsg, access3args *ac) { - return xdr_to_generic (inmsg,(void *)ac, (xdrproc_t)xdr_access3args); + return nfs_xdr_to_generic (inmsg,(void *)ac, + (xdrproc_t)xdr_access3args); } ssize_t xdr_serialize_access3res (struct iovec outmsg, access3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_access3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_access3res); } ssize_t xdr_to_readlink3args (struct iovec inmsg, readlink3args *ra) { - return xdr_to_generic (inmsg, (void *)ra, (xdrproc_t)xdr_readlink3args); + return nfs_xdr_to_generic (inmsg, (void *)ra, + (xdrproc_t)xdr_readlink3args); } ssize_t xdr_serialize_readlink3res (struct iovec outmsg, readlink3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_readlink3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_readlink3res); } ssize_t xdr_to_read3args (struct iovec inmsg, read3args *ra) { - return xdr_to_generic (inmsg, (void *)ra, (xdrproc_t)xdr_read3args); + return nfs_xdr_to_generic (inmsg, (void *)ra, (xdrproc_t)xdr_read3args); } ssize_t xdr_serialize_read3res (struct iovec outmsg, read3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_read3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_read3res); } ssize_t xdr_serialize_read3res_nocopy (struct iovec outmsg, read3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_read3res_nocopy); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_read3res_nocopy); } ssize_t xdr_to_write3args (struct iovec inmsg, write3args *wa) { - return xdr_to_generic (inmsg, (void *)wa,(xdrproc_t)xdr_write3args); + return nfs_xdr_to_generic (inmsg, (void *)wa,(xdrproc_t)xdr_write3args); } @@ -283,224 +288,237 @@ ssize_t xdr_to_write3args_nocopy (struct iovec inmsg, write3args *wa, struct iovec *payload) { - return xdr_to_generic_payload (inmsg, (void *)wa, - (xdrproc_t)xdr_write3args, payload); + return nfs_xdr_to_generic_payload (inmsg, (void *)wa, + (xdrproc_t)xdr_write3args, payload); } ssize_t xdr_serialize_write3res (struct iovec outmsg, write3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_write3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_write3res); } ssize_t xdr_to_create3args (struct iovec inmsg, create3args *ca) { - return xdr_to_generic (inmsg, (void *)ca, (xdrproc_t)xdr_create3args); + return nfs_xdr_to_generic (inmsg, (void *)ca, + (xdrproc_t)xdr_create3args); } ssize_t xdr_serialize_create3res (struct iovec outmsg, create3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_create3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_create3res); } ssize_t xdr_serialize_mkdir3res (struct iovec outmsg, mkdir3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_mkdir3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_mkdir3res); } ssize_t xdr_to_mkdir3args (struct iovec inmsg, mkdir3args *ma) { - return xdr_to_generic (inmsg, (void *)ma, (xdrproc_t)xdr_mkdir3args); + return nfs_xdr_to_generic (inmsg, (void *)ma, + (xdrproc_t)xdr_mkdir3args); } ssize_t xdr_to_symlink3args (struct iovec inmsg, symlink3args *sa) { - return xdr_to_generic (inmsg, (void *)sa, (xdrproc_t)xdr_symlink3args); + return nfs_xdr_to_generic (inmsg, (void *)sa, + (xdrproc_t)xdr_symlink3args); } ssize_t xdr_serialize_symlink3res (struct iovec outmsg, symlink3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_symlink3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_symlink3res); } ssize_t xdr_to_mknod3args (struct iovec inmsg, mknod3args *ma) { - return xdr_to_generic (inmsg, (void *)ma, (xdrproc_t)xdr_mknod3args); + return nfs_xdr_to_generic (inmsg, (void *)ma, + (xdrproc_t)xdr_mknod3args); } ssize_t xdr_serialize_mknod3res (struct iovec outmsg, mknod3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_mknod3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_mknod3res); } ssize_t xdr_to_remove3args (struct iovec inmsg, remove3args *ra) { - return xdr_to_generic (inmsg, (void *)ra, (xdrproc_t)xdr_remove3args); + return nfs_xdr_to_generic (inmsg, (void *)ra, + (xdrproc_t)xdr_remove3args); } ssize_t xdr_serialize_remove3res (struct iovec outmsg, remove3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_remove3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_remove3res); } ssize_t xdr_to_rmdir3args (struct iovec inmsg, rmdir3args *ra) { - return xdr_to_generic (inmsg, (void *)ra, (xdrproc_t)xdr_rmdir3args); + return nfs_xdr_to_generic (inmsg, (void *)ra, + (xdrproc_t)xdr_rmdir3args); } ssize_t xdr_serialize_rmdir3res (struct iovec outmsg, rmdir3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_rmdir3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_rmdir3res); } ssize_t xdr_serialize_rename3res (struct iovec outmsg, rename3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_rename3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_rename3res); } ssize_t xdr_to_rename3args (struct iovec inmsg, rename3args *ra) { - return xdr_to_generic (inmsg, (void *)ra, (xdrproc_t)xdr_rename3args); + return nfs_xdr_to_generic (inmsg, (void *)ra, + (xdrproc_t)xdr_rename3args); } ssize_t xdr_serialize_link3res (struct iovec outmsg, link3res *li) { - return xdr_serialize_generic (outmsg, (void *)li, - (xdrproc_t)xdr_link3res); + return nfs_xdr_serialize_generic (outmsg, (void *)li, + (xdrproc_t)xdr_link3res); } ssize_t xdr_to_link3args (struct iovec inmsg, link3args *la) { - return xdr_to_generic (inmsg, (void *)la, (xdrproc_t)xdr_link3args); + return nfs_xdr_to_generic (inmsg, (void *)la, (xdrproc_t)xdr_link3args); } ssize_t xdr_to_readdir3args (struct iovec inmsg, readdir3args *rd) { - return xdr_to_generic (inmsg, (void *)rd, (xdrproc_t)xdr_readdir3args); + return nfs_xdr_to_generic (inmsg, (void *)rd, + (xdrproc_t)xdr_readdir3args); } ssize_t xdr_serialize_readdir3res (struct iovec outmsg, readdir3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_readdir3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_readdir3res); } ssize_t xdr_to_readdirp3args (struct iovec inmsg, readdirp3args *rp) { - return xdr_to_generic (inmsg, (void *)rp, (xdrproc_t)xdr_readdirp3args); + return nfs_xdr_to_generic (inmsg, (void *)rp, + (xdrproc_t)xdr_readdirp3args); } ssize_t xdr_serialize_readdirp3res (struct iovec outmsg, readdirp3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_readdirp3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_readdirp3res); } ssize_t xdr_to_fsstat3args (struct iovec inmsg, fsstat3args *fa) { - return xdr_to_generic (inmsg, (void *)fa, (xdrproc_t)xdr_fsstat3args); + return nfs_xdr_to_generic (inmsg, (void *)fa, + (xdrproc_t)xdr_fsstat3args); } ssize_t xdr_serialize_fsstat3res (struct iovec outmsg, fsstat3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_fsstat3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_fsstat3res); } ssize_t xdr_to_fsinfo3args (struct iovec inmsg, fsinfo3args *fi) { - return xdr_to_generic (inmsg, (void *)fi, (xdrproc_t)xdr_fsinfo3args); + return nfs_xdr_to_generic (inmsg, (void *)fi, + (xdrproc_t)xdr_fsinfo3args); } ssize_t xdr_serialize_fsinfo3res (struct iovec outmsg, fsinfo3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_fsinfo3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_fsinfo3res); } ssize_t xdr_to_pathconf3args (struct iovec inmsg, pathconf3args *pc) { - return xdr_to_generic (inmsg, (void *)pc, (xdrproc_t)xdr_pathconf3args);} + return nfs_xdr_to_generic (inmsg, (void *)pc, + (xdrproc_t)xdr_pathconf3args);} ssize_t xdr_serialize_pathconf3res (struct iovec outmsg, pathconf3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_pathconf3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_pathconf3res); } ssize_t xdr_to_commit3args (struct iovec inmsg, commit3args *ca) { - return xdr_to_generic (inmsg, (void *)ca, (xdrproc_t)xdr_commit3args); + return nfs_xdr_to_generic (inmsg, (void *)ca, + (xdrproc_t)xdr_commit3args); } ssize_t xdr_serialize_commit3res (struct iovec outmsg, commit3res *res) { - return xdr_serialize_generic (outmsg, (void *)res, - (xdrproc_t)xdr_commit3res); + return nfs_xdr_serialize_generic (outmsg, (void *)res, + (xdrproc_t)xdr_commit3res); } @@ -519,7 +537,7 @@ xdr_serialize_exports (struct iovec outmsg, exports *elist) if (!xdr_exports (&xdr, elist)) goto ret; - ret = xdr_decoded_length (xdr); + ret = nfs_xdr_decoded_length (xdr); ret: return ret; @@ -529,8 +547,8 @@ ret: ssize_t xdr_serialize_nfsstat3 (struct iovec outmsg, nfsstat3 *s) { - return xdr_serialize_generic (outmsg, (void *)s, - (xdrproc_t)xdr_nfsstat3); + return nfs_xdr_serialize_generic (outmsg, (void *)s, + (xdrproc_t)xdr_nfsstat3); } diff --git a/xlators/nfs/lib/src/rpc-socket.c b/xlators/nfs/lib/src/rpc-socket.c index 01f114a8530..aacf7ff03d2 100644 --- a/xlators/nfs/lib/src/rpc-socket.c +++ b/xlators/nfs/lib/src/rpc-socket.c @@ -38,10 +38,10 @@ #include <netinet/tcp.h> static int -rpcsvc_socket_server_get_local_socket (int addrfam, char *listenhost, - uint16_t listenport, - struct sockaddr *addr, - socklen_t *addr_len) +nfs_rpcsvc_socket_server_get_local_socket (int addrfam, char *listenhost, + uint16_t listenport, + struct sockaddr *addr, + socklen_t *addr_len) { struct addrinfo hints, *res = 0; char service[NI_MAXSERV]; @@ -76,7 +76,7 @@ err: int -rpcsvc_socket_listen (int addrfam, char *listenhost, uint16_t listenport) +nfs_rpcsvc_socket_listen (int addrfam, char *listenhost, uint16_t listenport) { int sock = -1; struct sockaddr_storage sockaddr; @@ -85,9 +85,10 @@ rpcsvc_socket_listen (int addrfam, char *listenhost, uint16_t listenport) int ret = -1; int opt = 1; - ret = rpcsvc_socket_server_get_local_socket (addrfam, listenhost, - listenport,SA (&sockaddr), - &sockaddr_len); + ret = nfs_rpcsvc_socket_server_get_local_socket (addrfam, listenhost, + listenport, + SA (&sockaddr), + &sockaddr_len); if (ret == -1) return ret; @@ -149,7 +150,7 @@ err: int -rpcsvc_socket_accept (int listenfd) +nfs_rpcsvc_socket_accept (int listenfd) { int new_sock = -1; struct sockaddr_storage new_sockaddr = {0, }; @@ -197,7 +198,7 @@ err: } ssize_t -rpcsvc_socket_read (int sockfd, char *readaddr, size_t readsize) +nfs_rpcsvc_socket_read (int sockfd, char *readaddr, size_t readsize) { ssize_t dataread = 0; ssize_t readlen = -1; @@ -226,7 +227,7 @@ rpcsvc_socket_read (int sockfd, char *readaddr, size_t readsize) ssize_t -rpcsvc_socket_write (int sockfd, char *buffer, size_t size) +nfs_rpcsvc_socket_write (int sockfd, char *buffer, size_t size) { size_t writelen = -1; ssize_t written = 0; @@ -255,7 +256,7 @@ rpcsvc_socket_write (int sockfd, char *buffer, size_t size) int -rpcsvc_socket_peername (int sockfd, char *hostname, int hostlen) +nfs_rpcsvc_socket_peername (int sockfd, char *hostname, int hostlen) { struct sockaddr sa; socklen_t sl = sizeof (sa); @@ -282,8 +283,8 @@ err: int -rpcsvc_socket_peeraddr (int sockfd, char *addrstr, int addrlen, - struct sockaddr *returnsa, socklen_t sasize) +nfs_rpcsvc_socket_peeraddr (int sockfd, char *addrstr, int addrlen, + struct sockaddr *returnsa, socklen_t sasize) { struct sockaddr sa; int ret = EAI_FAIL; @@ -323,8 +324,9 @@ err: int -rpcsvc_socket_block_tx (int sockfd) +nfs_rpcsvc_socket_block_tx (int sockfd) { + int ret = -1; int on = 1; @@ -341,7 +343,7 @@ rpcsvc_socket_block_tx (int sockfd) int -rpcsvc_socket_unblock_tx (int sockfd) +nfs_rpcsvc_socket_unblock_tx (int sockfd) { int ret = -1; int off = 0; diff --git a/xlators/nfs/lib/src/rpc-socket.h b/xlators/nfs/lib/src/rpc-socket.h index 3a50c97a98d..d95e5ddd65b 100644 --- a/xlators/nfs/lib/src/rpc-socket.h +++ b/xlators/nfs/lib/src/rpc-socket.h @@ -17,8 +17,8 @@ <http://www.gnu.org/licenses/>. */ -#ifndef _RPCSVC_SOCKET_H_ -#define _RPCSVC_SOCKET_H_ +#ifndef _NFS_RPCSVC_SOCKET_H_ +#define _NFS_RPCSVC_SOCKET_H_ #ifndef _CONFIG_H #define _CONFIG_H @@ -40,26 +40,26 @@ #define SA(ptr) ((struct sockaddr *)ptr) #define GF_RPCSVC_SOCK "rpc-socket" extern int -rpcsvc_socket_listen (int addrfam, char *listenhost, uint16_t listenport); +nfs_rpcsvc_socket_listen (int addrfam, char *listenhost, uint16_t listenport); extern int -rpcsvc_socket_accept (int listenfd); +nfs_rpcsvc_socket_accept (int listenfd); extern ssize_t -rpcsvc_socket_read (int sockfd, char *readaddr, size_t readsize); +nfs_rpcsvc_socket_read (int sockfd, char *readaddr, size_t readsize); extern ssize_t -rpcsvc_socket_write (int sockfd, char *buffer, size_t size); +nfs_rpcsvc_socket_write (int sockfd, char *buffer, size_t size); extern int -rpcsvc_socket_peername (int sockfd, char *hostname, int hostlen); +nfs_rpcsvc_socket_peername (int sockfd, char *hostname, int hostlen); extern int -rpcsvc_socket_peeraddr (int sockfd, char *addrstr, int addrlen, - struct sockaddr *returnsa, socklen_t sasize); +nfs_rpcsvc_socket_peeraddr (int sockfd, char *addrstr, int addrlen, + struct sockaddr *returnsa, socklen_t sasize); extern int -rpcsvc_socket_block_tx (int sockfd); +nfs_rpcsvc_socket_block_tx (int sockfd); extern int -rpcsvc_socket_unblock_tx (int sockfd); +nfs_rpcsvc_socket_unblock_tx (int sockfd); #endif diff --git a/xlators/nfs/lib/src/rpcsvc-auth.c b/xlators/nfs/lib/src/rpcsvc-auth.c index f61fe91d0b2..b3e2e36a3b0 100644 --- a/xlators/nfs/lib/src/rpcsvc-auth.c +++ b/xlators/nfs/lib/src/rpcsvc-auth.c @@ -22,14 +22,14 @@ #include "dict.h" extern rpcsvc_auth_t * -rpcsvc_auth_null_init (rpcsvc_t *svc, dict_t *options); +nfs_rpcsvc_auth_null_init (rpcsvc_t *svc, dict_t *options); extern rpcsvc_auth_t * -rpcsvc_auth_unix_init (rpcsvc_t *svc, dict_t *options); +nfs_rpcsvc_auth_unix_init (rpcsvc_t *svc, dict_t *options); int -rpcsvc_auth_add_initer (struct list_head *list, char *idfier, - rpcsvc_auth_initer_t init) +nfs_rpcsvc_auth_add_initer (struct list_head *list, char *idfier, + rpcsvc_auth_initer_t init) { struct rpcsvc_auth_list *new = NULL; @@ -52,21 +52,21 @@ rpcsvc_auth_add_initer (struct list_head *list, char *idfier, int -rpcsvc_auth_add_initers (rpcsvc_t *svc) +nfs_rpcsvc_auth_add_initers (rpcsvc_t *svc) { int ret = -1; - ret = rpcsvc_auth_add_initer (&svc->authschemes, "auth-unix", - (rpcsvc_auth_initer_t) - rpcsvc_auth_unix_init); + ret = nfs_rpcsvc_auth_add_initer (&svc->authschemes, "auth-unix", + (rpcsvc_auth_initer_t) + nfs_rpcsvc_auth_unix_init); if (ret == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to add AUTH_UNIX"); goto err; } - ret = rpcsvc_auth_add_initer (&svc->authschemes, "auth-null", - (rpcsvc_auth_initer_t) - rpcsvc_auth_null_init); + ret = nfs_rpcsvc_auth_add_initer (&svc->authschemes, "auth-null", + (rpcsvc_auth_initer_t) + nfs_rpcsvc_auth_null_init); if (ret == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to add AUTH_NULL"); goto err; @@ -79,8 +79,8 @@ err: int -rpcsvc_auth_init_auth (rpcsvc_t *svc, dict_t *options, - struct rpcsvc_auth_list *authitem) +nfs_rpcsvc_auth_init_auth (rpcsvc_t *svc, dict_t *options, + struct rpcsvc_auth_list *authitem) { int ret = -1; @@ -112,7 +112,7 @@ err: int -rpcsvc_auth_init_auths (rpcsvc_t *svc, dict_t *options) +nfs_rpcsvc_auth_init_auths (rpcsvc_t *svc, dict_t *options) { int ret = -1; struct rpcsvc_auth_list *auth = NULL; @@ -138,7 +138,7 @@ rpcsvc_auth_init_auths (rpcsvc_t *svc, dict_t *options) ret = dict_set_dynstr (options, "rpc-auth.auth-unix", "on"); list_for_each_entry_safe (auth, tmp, &svc->authschemes, authlist) { - ret = rpcsvc_auth_init_auth (svc, options, auth); + ret = nfs_rpcsvc_auth_init_auth (svc, options, auth); if (ret == -1) goto err; } @@ -150,20 +150,20 @@ err: } int -rpcsvc_auth_init (rpcsvc_t *svc, dict_t *options) +nfs_rpcsvc_auth_init (rpcsvc_t *svc, dict_t *options) { int ret = -1; if ((!svc) || (!options)) return -1; - ret = rpcsvc_auth_add_initers (svc); + ret = nfs_rpcsvc_auth_add_initers (svc); if (ret == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to add initers"); goto out; } - ret = rpcsvc_auth_init_auths (svc, options); + ret = nfs_rpcsvc_auth_init_auths (svc, options); if (ret == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to init auth schemes"); goto out; @@ -175,7 +175,7 @@ out: rpcsvc_auth_t * -__rpcsvc_auth_get_handler (rpcsvc_request_t *req) +__nfs_rpcsvc_auth_get_handler (rpcsvc_request_t *req) { int ret = -1; struct rpcsvc_auth_list *auth = NULL; @@ -185,7 +185,7 @@ __rpcsvc_auth_get_handler (rpcsvc_request_t *req) if (!req) return NULL; - svc = rpcsvc_request_service (req); + svc = nfs_rpcsvc_request_service (req); if (list_empty (&svc->authschemes)) { gf_log (GF_RPCSVC, GF_LOG_WARNING, "No authentication!"); ret = 0; @@ -209,11 +209,11 @@ err: } rpcsvc_auth_t * -rpcsvc_auth_get_handler (rpcsvc_request_t *req) +nfs_rpcsvc_auth_get_handler (rpcsvc_request_t *req) { rpcsvc_auth_t *auth = NULL; - auth = __rpcsvc_auth_get_handler (req); + auth = __nfs_rpcsvc_auth_get_handler (req); if (auth) goto ret; @@ -225,14 +225,14 @@ rpcsvc_auth_get_handler (rpcsvc_request_t *req) */ req->cred.flavour = AUTH_NULL; req->verf.flavour = AUTH_NULL; - auth = __rpcsvc_auth_get_handler (req); + auth = __nfs_rpcsvc_auth_get_handler (req); ret: return auth; } int -rpcsvc_auth_request_init (rpcsvc_request_t *req) +nfs_rpcsvc_auth_request_init (rpcsvc_request_t *req) { int ret = -1; rpcsvc_auth_t *auth = NULL; @@ -240,7 +240,7 @@ rpcsvc_auth_request_init (rpcsvc_request_t *req) if (!req) return -1; - auth = rpcsvc_auth_get_handler (req); + auth = nfs_rpcsvc_auth_get_handler (req); if (!auth) goto err; ret = 0; @@ -254,7 +254,7 @@ err: int -rpcsvc_authenticate (rpcsvc_request_t *req) +nfs_rpcsvc_authenticate (rpcsvc_request_t *req) { int ret = RPCSVC_AUTH_REJECT; rpcsvc_auth_t *auth = NULL; @@ -263,14 +263,14 @@ rpcsvc_authenticate (rpcsvc_request_t *req) if (!req) return ret; - minauth = rpcsvc_request_prog_minauth (req); - if (minauth > rpcsvc_request_cred_flavour (req)) { + minauth = nfs_rpcsvc_request_prog_minauth (req); + if (minauth > nfs_rpcsvc_request_cred_flavour (req)) { gf_log (GF_RPCSVC, GF_LOG_DEBUG, "Auth too weak"); - rpcsvc_request_set_autherr (req, AUTH_TOOWEAK); + nfs_rpcsvc_request_set_autherr (req, AUTH_TOOWEAK); goto err; } - auth = rpcsvc_auth_get_handler (req); + auth = nfs_rpcsvc_auth_get_handler (req); if (!auth) { gf_log (GF_RPCSVC, GF_LOG_DEBUG, "No auth handler found"); goto err; @@ -285,7 +285,7 @@ err: int -rpcsvc_auth_array (rpcsvc_t *svc, char *volname, int *autharr, int arrlen) +nfs_rpcsvc_auth_array (rpcsvc_t *svc, char *volname, int *autharr, int arrlen) { int count = 0; int gen = RPCSVC_AUTH_REJECT; @@ -361,7 +361,7 @@ rpcsvc_auth_array (rpcsvc_t *svc, char *volname, int *autharr, int arrlen) } GF_FREE (srchstr); - final = rpcsvc_combine_gen_spec_volume_checks (gen, spec); + final = nfs_rpcsvc_combine_gen_spec_volume_checks (gen, spec); if (final == RPCSVC_AUTH_ACCEPT) { autharr[count] = auth->auth->authnum; ++count; @@ -374,7 +374,7 @@ err: gid_t * -rpcsvc_auth_unix_auxgids (rpcsvc_request_t *req, int *arrlen) +nfs_rpcsvc_auth_unix_auxgids (rpcsvc_request_t *req, int *arrlen) { if ((!req) || (!arrlen)) return NULL; diff --git a/xlators/nfs/lib/src/rpcsvc.c b/xlators/nfs/lib/src/rpcsvc.c index 4ea008b882c..0a105ab0dff 100644 --- a/xlators/nfs/lib/src/rpcsvc.c +++ b/xlators/nfs/lib/src/rpcsvc.c @@ -46,7 +46,7 @@ #include <stdio.h> -#define rpcsvc_alloc_request(con, request) \ +#define nfs_rpcsvc_alloc_request(con, request) \ do { \ request = (rpcsvc_request_t *) mem_get ((con)->rxpool); \ memset (request, 0, sizeof (rpcsvc_request_t)); \ @@ -54,7 +54,7 @@ /* The generic event handler for every stage */ void * -rpcsvc_stage_proc (void *arg) +nfs_rpcsvc_stage_proc (void *arg) { rpcsvc_stage_t *stg = (rpcsvc_stage_t *)arg; @@ -67,7 +67,7 @@ rpcsvc_stage_proc (void *arg) rpcsvc_stage_t * -rpcsvc_stage_init (rpcsvc_t *svc) +nfs_rpcsvc_stage_init (rpcsvc_t *svc) { rpcsvc_stage_t *stg = NULL; int ret = -1; @@ -94,7 +94,7 @@ rpcsvc_stage_init (rpcsvc_t *svc) gf_log (GF_RPCSVC, GF_LOG_WARNING, "Using default thread stack size"); - ret = pthread_create (&stg->tid, &stgattr, rpcsvc_stage_proc, + ret = pthread_create (&stg->tid, &stgattr, nfs_rpcsvc_stage_proc, (void *)stg); if (ret != 0) { ret = -1; @@ -115,7 +115,7 @@ free_stg: int -rpcsvc_init_options (rpcsvc_t *svc, dict_t *options) +nfs_rpcsvc_init_options (rpcsvc_t *svc, dict_t *options) { svc->memfactor = RPCSVC_DEFAULT_MEMFACTOR; return 0; @@ -127,7 +127,7 @@ rpcsvc_init_options (rpcsvc_t *svc, dict_t *options) * to come in. */ rpcsvc_t * -rpcsvc_init (glusterfs_ctx_t *ctx, dict_t *options) +nfs_rpcsvc_init (glusterfs_ctx_t *ctx, dict_t *options) { rpcsvc_t *svc = NULL; int ret = -1; @@ -143,13 +143,13 @@ rpcsvc_init (glusterfs_ctx_t *ctx, dict_t *options) INIT_LIST_HEAD (&svc->stages); INIT_LIST_HEAD (&svc->authschemes); - ret = rpcsvc_init_options (svc, options); + ret = nfs_rpcsvc_init_options (svc, options); if (ret == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to init options"); goto free_svc; } - ret = rpcsvc_auth_init (svc, options); + ret = nfs_rpcsvc_auth_init (svc, options); if (ret == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to init " "authentication"); @@ -157,7 +157,7 @@ rpcsvc_init (glusterfs_ctx_t *ctx, dict_t *options) } ret = -1; - svc->defaultstage = rpcsvc_stage_init (svc); + svc->defaultstage = nfs_rpcsvc_stage_init (svc); if (!svc->defaultstage) { gf_log (GF_RPCSVC, GF_LOG_ERROR,"RPC service init failed."); goto free_svc; @@ -182,7 +182,7 @@ free_svc: * function selects one from among all the stages. */ rpcsvc_stage_t * -rpcsvc_select_stage (rpcsvc_t *rpcservice) +nfs_rpcsvc_select_stage (rpcsvc_t *rpcservice) { if (!rpcservice) return NULL; @@ -192,7 +192,7 @@ rpcsvc_select_stage (rpcsvc_t *rpcservice) int -rpcsvc_conn_peer_check_search (dict_t *options, char *pattern, char *clstr) +nfs_rpcsvc_conn_peer_check_search (dict_t *options, char *pattern, char *clstr) { int ret = -1; char *addrtok = NULL; @@ -234,7 +234,7 @@ err: int -rpcsvc_conn_peer_check_allow (dict_t *options, char *volname, char *clstr) +nfs_rpcsvc_conn_peer_check_allow (dict_t *options, char *volname, char *clstr) { int ret = RPCSVC_AUTH_DONTCARE; char *srchstr = NULL; @@ -257,7 +257,7 @@ rpcsvc_conn_peer_check_allow (dict_t *options, char *volname, char *clstr) } else srchstr = globalrule; - ret = rpcsvc_conn_peer_check_search (options, srchstr, clstr); + ret = nfs_rpcsvc_conn_peer_check_search (options, srchstr, clstr); if (volname) GF_FREE (srchstr); @@ -270,7 +270,7 @@ out: } int -rpcsvc_conn_peer_check_reject (dict_t *options, char *volname, char *clstr) +nfs_rpcsvc_conn_peer_check_reject (dict_t *options, char *volname, char *clstr) { int ret = RPCSVC_AUTH_DONTCARE; char *srchstr = NULL; @@ -280,7 +280,8 @@ rpcsvc_conn_peer_check_reject (dict_t *options, char *volname, char *clstr) return ret; if (volname) { - ret = gf_asprintf (&srchstr, "rpc-auth.addr.%s.reject", volname); + ret = gf_asprintf (&srchstr, "rpc-auth.addr.%s.reject", + volname); if (ret == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "asprintf failed"); ret = RPCSVC_AUTH_REJECT; @@ -289,7 +290,7 @@ rpcsvc_conn_peer_check_reject (dict_t *options, char *volname, char *clstr) } else srchstr = generalrule; - ret = rpcsvc_conn_peer_check_search (options, srchstr, clstr); + ret = nfs_rpcsvc_conn_peer_check_search (options, srchstr, clstr); if (volname) GF_FREE (srchstr); @@ -318,7 +319,7 @@ out: * | D | R | R | */ int -rpcsvc_combine_allow_reject_volume_check (int allow, int reject) +nfs_rpcsvc_combine_allow_reject_volume_check (int allow, int reject) { int final = RPCSVC_AUTH_REJECT; @@ -360,7 +361,7 @@ rpcsvc_combine_allow_reject_volume_check (int allow, int reject) * | R | R | R | */ int -rpcsvc_combine_gen_spec_addr_checks (int gen, int spec) +nfs_rpcsvc_combine_gen_spec_addr_checks (int gen, int spec) { int final = RPCSVC_AUTH_REJECT; @@ -403,7 +404,7 @@ rpcsvc_combine_gen_spec_addr_checks (int gen, int spec) * | R | R | R | */ int -rpcsvc_combine_gen_spec_volume_checks (int gen, int spec) +nfs_rpcsvc_combine_gen_spec_volume_checks (int gen, int spec) { int final = RPCSVC_AUTH_REJECT; @@ -432,8 +433,8 @@ rpcsvc_combine_gen_spec_volume_checks (int gen, int spec) int -rpcsvc_conn_peer_check_name (dict_t *options, char *volname, - rpcsvc_conn_t *conn) +nfs_rpcsvc_conn_peer_check_name (dict_t *options, char *volname, + rpcsvc_conn_t *conn) { int ret = RPCSVC_AUTH_REJECT; int aret = RPCSVC_AUTH_REJECT; @@ -443,7 +444,7 @@ rpcsvc_conn_peer_check_name (dict_t *options, char *volname, if (!conn) return ret; - ret = rpcsvc_conn_peername (conn, clstr, RPCSVC_PEER_STRLEN); + ret = nfs_rpcsvc_conn_peername (conn, clstr, RPCSVC_PEER_STRLEN); if (ret != 0) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to get remote addr: " "%s", gai_strerror (ret)); @@ -451,10 +452,10 @@ rpcsvc_conn_peer_check_name (dict_t *options, char *volname, goto err; } - aret = rpcsvc_conn_peer_check_allow (options, volname, clstr); - rjret = rpcsvc_conn_peer_check_reject (options, volname, clstr); + aret = nfs_rpcsvc_conn_peer_check_allow (options, volname, clstr); + rjret = nfs_rpcsvc_conn_peer_check_reject (options, volname, clstr); - ret = rpcsvc_combine_allow_reject_volume_check (aret, rjret); + ret = nfs_rpcsvc_combine_allow_reject_volume_check (aret, rjret); err: return ret; @@ -462,7 +463,8 @@ err: int -rpcsvc_conn_peer_check_addr (dict_t *options, char *volname,rpcsvc_conn_t *conn) +nfs_rpcsvc_conn_peer_check_addr (dict_t *options, char *volname, + rpcsvc_conn_t *conn) { int ret = RPCSVC_AUTH_REJECT; int aret = RPCSVC_AUTH_DONTCARE; @@ -472,7 +474,8 @@ rpcsvc_conn_peer_check_addr (dict_t *options, char *volname,rpcsvc_conn_t *conn) if (!conn) return ret; - ret = rpcsvc_conn_peeraddr (conn, clstr, RPCSVC_PEER_STRLEN, NULL, 0); + ret = nfs_rpcsvc_conn_peeraddr (conn, clstr, RPCSVC_PEER_STRLEN, NULL, + 0); if (ret != 0) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to get remote addr: " "%s", gai_strerror (ret)); @@ -480,18 +483,18 @@ rpcsvc_conn_peer_check_addr (dict_t *options, char *volname,rpcsvc_conn_t *conn) goto err; } - aret = rpcsvc_conn_peer_check_allow (options, volname, clstr); - rjret = rpcsvc_conn_peer_check_reject (options, volname, clstr); + aret = nfs_rpcsvc_conn_peer_check_allow (options, volname, clstr); + rjret = nfs_rpcsvc_conn_peer_check_reject (options, volname, clstr); - ret = rpcsvc_combine_allow_reject_volume_check (aret, rjret); + ret = nfs_rpcsvc_combine_allow_reject_volume_check (aret, rjret); err: return ret; } int -rpcsvc_conn_check_volume_specific (dict_t *options, char *volname, - rpcsvc_conn_t *conn) +nfs_rpcsvc_conn_check_volume_specific (dict_t *options, char *volname, + rpcsvc_conn_t *conn) { int namechk = RPCSVC_AUTH_REJECT; int addrchk = RPCSVC_AUTH_REJECT; @@ -515,11 +518,13 @@ rpcsvc_conn_check_volume_specific (dict_t *options, char *volname, * specific which will over-ride the network address rules. */ if (namelookup) - namechk = rpcsvc_conn_peer_check_name (options, volname, conn); - addrchk = rpcsvc_conn_peer_check_addr (options, volname, conn); + namechk = nfs_rpcsvc_conn_peer_check_name (options, volname, + conn); + addrchk = nfs_rpcsvc_conn_peer_check_addr (options, volname, conn); if (namelookup) - ret = rpcsvc_combine_gen_spec_addr_checks (addrchk, namechk); + ret = nfs_rpcsvc_combine_gen_spec_addr_checks (addrchk, + namechk); else ret = addrchk; @@ -528,7 +533,7 @@ rpcsvc_conn_check_volume_specific (dict_t *options, char *volname, int -rpcsvc_conn_check_volume_general (dict_t *options, rpcsvc_conn_t *conn) +nfs_rpcsvc_conn_check_volume_general (dict_t *options, rpcsvc_conn_t *conn) { int addrchk = RPCSVC_AUTH_REJECT; int namechk = RPCSVC_AUTH_REJECT; @@ -552,11 +557,12 @@ rpcsvc_conn_check_volume_general (dict_t *options, rpcsvc_conn_t *conn) * specific which will over-ride the network address rules. */ if (namelookup) - namechk = rpcsvc_conn_peer_check_name (options, NULL, conn); - addrchk = rpcsvc_conn_peer_check_addr (options, NULL, conn); + namechk = nfs_rpcsvc_conn_peer_check_name (options, NULL, conn); + addrchk = nfs_rpcsvc_conn_peer_check_addr (options, NULL, conn); if (namelookup) - ret = rpcsvc_combine_gen_spec_addr_checks (addrchk, namechk); + ret = nfs_rpcsvc_combine_gen_spec_addr_checks (addrchk, + namechk); else ret = addrchk; @@ -564,7 +570,7 @@ rpcsvc_conn_check_volume_general (dict_t *options, rpcsvc_conn_t *conn) } int -rpcsvc_conn_peer_check (dict_t *options, char *volname, rpcsvc_conn_t *conn) +nfs_rpcsvc_conn_peer_check (dict_t *options, char *volname, rpcsvc_conn_t *conn) { int general_chk = RPCSVC_AUTH_REJECT; int specific_chk = RPCSVC_AUTH_REJECT; @@ -572,16 +578,17 @@ rpcsvc_conn_peer_check (dict_t *options, char *volname, rpcsvc_conn_t *conn) if ((!options) || (!volname) || (!conn)) return RPCSVC_AUTH_REJECT; - general_chk = rpcsvc_conn_check_volume_general (options, conn); - specific_chk = rpcsvc_conn_check_volume_specific (options, volname, - conn); + general_chk = nfs_rpcsvc_conn_check_volume_general (options, conn); + specific_chk = nfs_rpcsvc_conn_check_volume_specific (options, volname, + conn); - return rpcsvc_combine_gen_spec_volume_checks (general_chk,specific_chk); + return nfs_rpcsvc_combine_gen_spec_volume_checks (general_chk, + specific_chk); } char * -rpcsvc_volume_allowed (dict_t *options, char *volname) +nfs_rpcsvc_volume_allowed (dict_t *options, char *volname) { char globalrule[] = "rpc-auth.addr.allow"; char *srchstr = NULL; @@ -611,7 +618,7 @@ out: /* Initialize the core of a connection */ rpcsvc_conn_t * -rpcsvc_conn_init (rpcsvc_t *svc, rpcsvc_program_t *prog, int sockfd) +nfs_rpcsvc_conn_init (rpcsvc_t *svc, rpcsvc_program_t *prog, int sockfd) { rpcsvc_conn_t *conn = NULL; int ret = -1; @@ -668,7 +675,7 @@ free_conn: void -rpcsvc_conn_destroy (rpcsvc_conn_t *conn) +nfs_rpcsvc_conn_destroy (rpcsvc_conn_t *conn) { mem_pool_destroy (conn->txpool); mem_pool_destroy (conn->rxpool); @@ -683,7 +690,7 @@ rpcsvc_conn_destroy (rpcsvc_conn_t *conn) int -__rpcsvc_conn_unref (rpcsvc_conn_t *conn) +__nfs_rpcsvc_conn_unref (rpcsvc_conn_t *conn) { --conn->connref; return conn->connref; @@ -691,7 +698,7 @@ __rpcsvc_conn_unref (rpcsvc_conn_t *conn) void -__rpcsvc_conn_deinit (rpcsvc_conn_t *conn) +__nfs_rpcsvc_conn_deinit (rpcsvc_conn_t *conn) { if (!conn) return; @@ -701,7 +708,7 @@ __rpcsvc_conn_deinit (rpcsvc_conn_t *conn) conn->eventidx); } - if (rpcsvc_conn_check_active (conn)) { + if (nfs_rpcsvc_conn_check_active (conn)) { gf_log (GF_RPCSVC, GF_LOG_DEBUG, "Connection de-activated:" " sockfd: %d", conn->sockfd); conn->connstate = RPCSVC_CONNSTATE_DISCONNECTED; @@ -715,7 +722,7 @@ __rpcsvc_conn_deinit (rpcsvc_conn_t *conn) void -rpcsvc_conn_deinit (rpcsvc_conn_t *conn) +nfs_rpcsvc_conn_deinit (rpcsvc_conn_t *conn) { int ref = 0; @@ -724,20 +731,20 @@ rpcsvc_conn_deinit (rpcsvc_conn_t *conn) pthread_mutex_lock (&conn->connlock); { - __rpcsvc_conn_deinit (conn); - ref = __rpcsvc_conn_unref (conn); + __nfs_rpcsvc_conn_deinit (conn); + ref = __nfs_rpcsvc_conn_unref (conn); } pthread_mutex_unlock (&conn->connlock); if (ref == 0) - rpcsvc_conn_destroy (conn); + nfs_rpcsvc_conn_destroy (conn); return; } void -rpcsvc_conn_unref (rpcsvc_conn_t *conn) +nfs_rpcsvc_conn_unref (rpcsvc_conn_t *conn) { int ref = 0; if (!conn) @@ -745,17 +752,17 @@ rpcsvc_conn_unref (rpcsvc_conn_t *conn) pthread_mutex_lock (&conn->connlock); { - ref = __rpcsvc_conn_unref (conn); + ref = __nfs_rpcsvc_conn_unref (conn); } pthread_mutex_unlock (&conn->connlock); if (ref == 0) - rpcsvc_conn_destroy (conn); + nfs_rpcsvc_conn_destroy (conn); } int -rpcsvc_conn_active (rpcsvc_conn_t *conn) +nfs_rpcsvc_conn_active (rpcsvc_conn_t *conn) { int status = 0; @@ -764,7 +771,7 @@ rpcsvc_conn_active (rpcsvc_conn_t *conn) pthread_mutex_lock (&conn->connlock); { - status = rpcsvc_conn_check_active (conn); + status = nfs_rpcsvc_conn_check_active (conn); } pthread_mutex_unlock (&conn->connlock); @@ -774,7 +781,7 @@ rpcsvc_conn_active (rpcsvc_conn_t *conn) void -rpcsvc_conn_ref (rpcsvc_conn_t *conn) +nfs_rpcsvc_conn_ref (rpcsvc_conn_t *conn) { if (!conn) return; @@ -790,7 +797,7 @@ rpcsvc_conn_ref (rpcsvc_conn_t *conn) void -rpcsvc_conn_state_init (rpcsvc_conn_t *conn) +nfs_rpcsvc_conn_state_init (rpcsvc_conn_t *conn) { if (!conn) return; @@ -802,7 +809,7 @@ rpcsvc_conn_state_init (rpcsvc_conn_t *conn) /* Builds a rpcsvc_conn_t with the aim of listening on it. */ rpcsvc_conn_t * -rpcsvc_conn_listen_init (rpcsvc_t *svc, rpcsvc_program_t *newprog) +nfs_rpcsvc_conn_listen_init (rpcsvc_t *svc, rpcsvc_program_t *newprog) { rpcsvc_conn_t *conn = NULL; int sock = -1; @@ -810,16 +817,16 @@ rpcsvc_conn_listen_init (rpcsvc_t *svc, rpcsvc_program_t *newprog) if (!newprog) return NULL; - sock = rpcsvc_socket_listen (newprog->progaddrfamily, newprog->proghost, - newprog->progport); + sock = nfs_rpcsvc_socket_listen (newprog->progaddrfamily, + newprog->proghost, newprog->progport); if (sock == -1) goto err; - conn = rpcsvc_conn_init (svc, newprog, sock); + conn = nfs_rpcsvc_conn_init (svc, newprog, sock); if (!conn) goto sock_close_err; - rpcsvc_conn_state_init (conn); + nfs_rpcsvc_conn_state_init (conn); sock_close_err: if (!conn) close (sock); @@ -829,7 +836,7 @@ err: } void -rpcsvc_record_init (rpcsvc_record_state_t *rs, struct iobuf_pool *pool) +nfs_rpcsvc_record_init (rpcsvc_record_state_t *rs, struct iobuf_pool *pool) { if (!rs) return; @@ -865,7 +872,8 @@ rpcsvc_record_init (rpcsvc_record_state_t *rs, struct iobuf_pool *pool) int -rpcsvc_conn_privport_check (rpcsvc_t *svc, char *volname, rpcsvc_conn_t *conn) +nfs_rpcsvc_conn_privport_check (rpcsvc_t *svc, char *volname, + rpcsvc_conn_t *conn) { struct sockaddr_in sa; int ret = RPCSVC_AUTH_REJECT; @@ -880,8 +888,8 @@ rpcsvc_conn_privport_check (rpcsvc_t *svc, char *volname, rpcsvc_conn_t *conn) if ((!svc) || (!volname) || (!conn)) return ret; - ret = rpcsvc_conn_peeraddr (conn, NULL, 0, (struct sockaddr *)&sa, - sasize); + ret = nfs_rpcsvc_conn_peeraddr (conn, NULL, 0, (struct sockaddr *)&sa, + sasize); if (ret != 0) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to get peer addr: %s", gai_strerror (ret)); @@ -941,8 +949,8 @@ rpcsvc_conn_privport_check (rpcsvc_t *svc, char *volname, rpcsvc_conn_t *conn) " read rpc-auth.ports.insecure value"); } - ret = rpcsvc_combine_gen_spec_volume_checks (globalinsecure, - exportinsecure); + ret = nfs_rpcsvc_combine_gen_spec_volume_checks (globalinsecure, + exportinsecure); if (ret == RPCSVC_AUTH_ACCEPT) gf_log (GF_RPCSVC, GF_LOG_DEBUG, "Unprivileged port allowed"); else @@ -956,26 +964,26 @@ err: /* Inits a rpcsvc_conn_t after accepting the connection. */ rpcsvc_conn_t * -rpcsvc_conn_accept_init (rpcsvc_t *svc, int listenfd, - rpcsvc_program_t *destprog) +nfs_rpcsvc_conn_accept_init (rpcsvc_t *svc, int listenfd, + rpcsvc_program_t *destprog) { rpcsvc_conn_t *newconn = NULL; int sock = -1; int ret = -1; - sock = rpcsvc_socket_accept (listenfd); + sock = nfs_rpcsvc_socket_accept (listenfd); if (sock == -1) goto err; - newconn = rpcsvc_conn_init (svc, destprog, sock); + newconn = nfs_rpcsvc_conn_init (svc, destprog, sock); if (!newconn) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to init conn object"); ret = -1; goto err; } - rpcsvc_record_init (&newconn->rstate, svc->ctx->iobuf_pool); - rpcsvc_conn_state_init (newconn); + nfs_rpcsvc_record_init (&newconn->rstate, svc->ctx->iobuf_pool); + nfs_rpcsvc_conn_state_init (newconn); if (destprog->conn_init) destprog->conn_init (destprog->private, newconn); ret = 0; @@ -995,8 +1003,8 @@ err: * should be handed to the handler when running in this particular stage. */ int -rpcsvc_stage_conn_associate (rpcsvc_stage_t *stg, rpcsvc_conn_t *conn, - event_handler_t handler, void *data) +nfs_rpcsvc_stage_conn_associate (rpcsvc_stage_t *stg, rpcsvc_conn_t *conn, + event_handler_t handler, void *data) { int ret = -1; @@ -1017,16 +1025,16 @@ err: /* Depending on the state we're in, return the size of the next read request. */ size_t -rpcsvc_record_read_size (rpcsvc_record_state_t *rs) +nfs_rpcsvc_record_read_size (rpcsvc_record_state_t *rs) { size_t toread = -1; if (!rs) return -1; - if (rpcsvc_record_readfraghdr (rs)) + if (nfs_rpcsvc_record_readfraghdr (rs)) toread = rs->remainingfraghdr; - else if (rpcsvc_record_readfrag (rs)) + else if (nfs_rpcsvc_record_readfrag (rs)) toread = rs->remainingfrag; else toread = RPCSVC_CONN_READ; @@ -1036,7 +1044,7 @@ rpcsvc_record_read_size (rpcsvc_record_state_t *rs) uint32_t -rpcsvc_record_extract_fraghdr (char *fraghdr) +nfs_rpcsvc_record_extract_fraghdr (char *fraghdr) { uint32_t hdr = 0; if (!fraghdr) @@ -1050,7 +1058,8 @@ rpcsvc_record_extract_fraghdr (char *fraghdr) ssize_t -rpcsvc_record_read_complete_fraghdr (rpcsvc_record_state_t *rs,ssize_t dataread) +nfs_rpcsvc_record_read_complete_fraghdr (rpcsvc_record_state_t *rs, + ssize_t dataread) { uint32_t remhdr = 0; char *fraghdrstart = NULL; @@ -1058,11 +1067,11 @@ rpcsvc_record_read_complete_fraghdr (rpcsvc_record_state_t *rs,ssize_t dataread) fraghdrstart = &rs->fragheader[0]; remhdr = rs->remainingfraghdr; - fraghdr = rpcsvc_record_extract_fraghdr (fraghdrstart); + fraghdr = nfs_rpcsvc_record_extract_fraghdr (fraghdrstart); rs->fragsize = RPCSVC_FRAGSIZE (fraghdr); gf_log (GF_RPCSVC, GF_LOG_TRACE, "Received fragment size: %d", rs->fragsize); - if (rpcsvc_record_vectored (rs)) { + if (nfs_rpcsvc_record_vectored (rs)) { gf_log (GF_RPCSVC, GF_LOG_TRACE, "Vectored RPC header," " remaining: %d", RPCSVC_BARERPC_MSGSZ); rs->remainingfrag = RPCSVC_BARERPC_MSGSZ; @@ -1082,7 +1091,8 @@ rpcsvc_record_read_complete_fraghdr (rpcsvc_record_state_t *rs,ssize_t dataread) ssize_t -rpcsvc_record_read_partial_fraghdr (rpcsvc_record_state_t *rs, ssize_t dataread) +nfs_rpcsvc_record_read_partial_fraghdr (rpcsvc_record_state_t *rs, + ssize_t dataread) { /* In case we got less than even the remaining header size, @@ -1090,7 +1100,7 @@ rpcsvc_record_read_partial_fraghdr (rpcsvc_record_state_t *rs, ssize_t dataread) * bytes to come in. */ rs->remainingfraghdr -= dataread; - rpcsvc_record_update_currenthdr (rs, dataread); + nfs_rpcsvc_record_update_currenthdr (rs, dataread); dataread = 0; gf_log (GF_RPCSVC, GF_LOG_TRACE, "Fragment header remaining: %d", rs->remainingfraghdr); @@ -1100,7 +1110,7 @@ rpcsvc_record_read_partial_fraghdr (rpcsvc_record_state_t *rs, ssize_t dataread) ssize_t -rpcsvc_record_update_fraghdr (rpcsvc_record_state_t *rs, ssize_t dataread) +nfs_rpcsvc_record_update_fraghdr (rpcsvc_record_state_t *rs, ssize_t dataread) { if ((!rs) || (dataread <= 0)) return -1; @@ -1108,7 +1118,7 @@ rpcsvc_record_update_fraghdr (rpcsvc_record_state_t *rs, ssize_t dataread) /* Why are we even here, we're not supposed to be in the fragment * header processing state. */ - if (!rpcsvc_record_readfraghdr(rs)) { + if (!nfs_rpcsvc_record_readfraghdr(rs)) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "record state inconsistent" ": request to update frag header when state is not" "RPCSVC_READ_FRAGHDR"); @@ -1127,15 +1137,18 @@ rpcsvc_record_update_fraghdr (rpcsvc_record_state_t *rs, ssize_t dataread) /* We've definitely got the full header now and may be even more. */ if (dataread >= rs->remainingfraghdr) - dataread = rpcsvc_record_read_complete_fraghdr (rs, dataread); + dataread = nfs_rpcsvc_record_read_complete_fraghdr (rs, + dataread); else - dataread = rpcsvc_record_read_partial_fraghdr (rs, dataread); + dataread = nfs_rpcsvc_record_read_partial_fraghdr (rs, + dataread); return dataread; } ssize_t -rpcsvc_record_read_complete_frag (rpcsvc_record_state_t *rs, ssize_t dataread) +nfs_rpcsvc_record_read_complete_frag (rpcsvc_record_state_t *rs, + ssize_t dataread) { uint32_t remfrag; @@ -1162,12 +1175,13 @@ rpcsvc_record_read_complete_frag (rpcsvc_record_state_t *rs, ssize_t dataread) ssize_t -rpcsvc_record_read_partial_frag (rpcsvc_record_state_t *rs, ssize_t dataread) +nfs_rpcsvc_record_read_partial_frag (rpcsvc_record_state_t *rs, + ssize_t dataread) { /* Just take whatever has come through the current network buffer. */ rs->remainingfrag -= dataread; - rpcsvc_record_update_currentfrag (rs, dataread); + nfs_rpcsvc_record_update_currentfrag (rs, dataread); /* Since we know we're consuming the whole buffer from dataread * simply setting to 0 zero is fine. */ @@ -1179,12 +1193,12 @@ rpcsvc_record_read_partial_frag (rpcsvc_record_state_t *rs, ssize_t dataread) ssize_t -rpcsvc_record_update_frag (rpcsvc_record_state_t *rs, ssize_t dataread) +nfs_rpcsvc_record_update_frag (rpcsvc_record_state_t *rs, ssize_t dataread) { if ((!rs) || (dataread <= 0)) return -1; - if (!rpcsvc_record_readfrag (rs)) { + if (!nfs_rpcsvc_record_readfrag (rs)) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "record state inconsistent" ": request to update fragment when record state is not" "RPCSVC_READ_FRAG."); @@ -1200,9 +1214,9 @@ rpcsvc_record_update_frag (rpcsvc_record_state_t *rs, ssize_t dataread) /* We've read in more data than the current fragment requires. */ if (dataread >= rs->remainingfrag) - dataread = rpcsvc_record_read_complete_frag (rs, dataread); + dataread = nfs_rpcsvc_record_read_complete_frag (rs, dataread); else - dataread = rpcsvc_record_read_partial_frag (rs, dataread); + dataread = nfs_rpcsvc_record_read_partial_frag (rs, dataread); return dataread; } @@ -1213,7 +1227,7 @@ rpcsvc_record_update_frag (rpcsvc_record_state_t *rs, ssize_t dataread) * of the pointers below are NULL. */ rpcsvc_actor_t * -rpcsvc_program_actor (rpcsvc_conn_t *conn, rpcsvc_request_t *req) +nfs_rpcsvc_program_actor (rpcsvc_conn_t *conn, rpcsvc_request_t *req) { rpcsvc_program_t *program = NULL; int err = SYSTEM_ERR; @@ -1273,8 +1287,8 @@ err: rpcsvc_txbuf_t * -rpcsvc_init_txbuf (rpcsvc_conn_t *conn, struct iovec msg, struct iobuf *iob, - struct iobref *iobref, int txflags) +nfs_rpcsvc_init_txbuf (rpcsvc_conn_t *conn, struct iovec msg, struct iobuf *iob, + struct iobref *iobref, int txflags) { rpcsvc_txbuf_t *txbuf = NULL; @@ -1301,15 +1315,15 @@ rpcsvc_init_txbuf (rpcsvc_conn_t *conn, struct iovec msg, struct iobuf *iob, int -rpcsvc_conn_append_txlist (rpcsvc_conn_t *conn, struct iovec msg, - struct iobuf *iob, int txflags) +nfs_rpcsvc_conn_append_txlist (rpcsvc_conn_t *conn, struct iovec msg, + struct iobuf *iob, int txflags) { rpcsvc_txbuf_t *txbuf = NULL; if ((!conn) || (!msg.iov_base) || (!iob)) return -1; - txbuf = rpcsvc_init_txbuf (conn, msg, iob, NULL, txflags); + txbuf = nfs_rpcsvc_init_txbuf (conn, msg, iob, NULL, txflags); if (!txbuf) return -1; @@ -1319,22 +1333,22 @@ rpcsvc_conn_append_txlist (rpcsvc_conn_t *conn, struct iovec msg, void -rpcsvc_set_lastfrag (uint32_t *fragsize) { +nfs_rpcsvc_set_lastfrag (uint32_t *fragsize) { (*fragsize) |= 0x80000000U; } void -rpcsvc_set_frag_header_size (uint32_t size, char *haddr) +nfs_rpcsvc_set_frag_header_size (uint32_t size, char *haddr) { size = htonl (size); memcpy (haddr, &size, sizeof (size)); } void -rpcsvc_set_last_frag_header_size (uint32_t size, char *haddr) +nfs_rpcsvc_set_last_frag_header_size (uint32_t size, char *haddr) { - rpcsvc_set_lastfrag (&size); - rpcsvc_set_frag_header_size (size, haddr); + nfs_rpcsvc_set_lastfrag (&size); + nfs_rpcsvc_set_frag_header_size (size, haddr); } @@ -1342,8 +1356,8 @@ rpcsvc_set_last_frag_header_size (uint32_t size, char *haddr) * encode the RPC record header into the buffer pointed by recordstart. */ struct iovec -rpcsvc_record_build_header (char *recordstart, size_t rlen, - struct rpc_msg reply, size_t payload) +nfs_rpcsvc_record_build_header (char *recordstart, size_t rlen, + struct rpc_msg reply, size_t payload) { struct iovec replyhdr; struct iovec txrecord = {0, 0}; @@ -1353,8 +1367,8 @@ rpcsvc_record_build_header (char *recordstart, size_t rlen, /* After leaving aside the 4 bytes for the fragment header, lets * encode the RPC reply structure into the buffer given to us. */ - ret = rpc_reply_to_xdr (&reply,(recordstart + RPCSVC_FRAGHDR_SIZE), - rlen, &replyhdr); + ret = nfs_rpc_reply_to_xdr (&reply,(recordstart + RPCSVC_FRAGHDR_SIZE), + rlen, &replyhdr); if (ret == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to create RPC reply"); goto err; @@ -1368,7 +1382,7 @@ rpcsvc_record_build_header (char *recordstart, size_t rlen, * we just set this fragment as the first and last fragment for this * record. */ - rpcsvc_set_last_frag_header_size (fraglen, recordstart); + nfs_rpcsvc_set_last_frag_header_size (fraglen, recordstart); /* Even though the RPC record starts at recordstart+RPCSVC_FRAGHDR_SIZE * we need to transmit the record with the fragment header, which starts @@ -1389,9 +1403,9 @@ err: int -rpcsvc_conn_submit (rpcsvc_conn_t *conn, struct iovec hdr, - struct iobuf *hdriob, struct iovec msgvec, - struct iobuf *msgiob) +nfs_rpcsvc_conn_submit (rpcsvc_conn_t *conn, struct iovec hdr, + struct iobuf *hdriob, struct iovec msgvec, + struct iobuf *msgiob) { int ret = -1; @@ -1405,13 +1419,13 @@ rpcsvc_conn_submit (rpcsvc_conn_t *conn, struct iovec hdr, */ pthread_mutex_lock (&conn->connlock); { - if (!rpcsvc_conn_check_active (conn)) { + if (!nfs_rpcsvc_conn_check_active (conn)) { gf_log (GF_RPCSVC, GF_LOG_DEBUG, "Connection inactive"); goto unlock_err; } - ret = rpcsvc_conn_append_txlist (conn, hdr, hdriob, - RPCSVC_TXB_FIRST); + ret = nfs_rpcsvc_conn_append_txlist (conn, hdr, hdriob, + RPCSVC_TXB_FIRST); if (ret == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to append " "header to transmission list"); @@ -1423,8 +1437,9 @@ rpcsvc_conn_submit (rpcsvc_conn_t *conn, struct iovec hdr, */ ret = 0; if (msgiob) - ret = rpcsvc_conn_append_txlist (conn, msgvec, msgiob, - RPCSVC_TXB_LAST); + ret = nfs_rpcsvc_conn_append_txlist (conn, msgvec, + msgiob, + RPCSVC_TXB_LAST); if (ret == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to append" " payload to transmission list"); @@ -1450,22 +1465,24 @@ err: int -rpcsvc_fill_reply (rpcsvc_request_t *req, struct rpc_msg *reply) +nfs_rpcsvc_fill_reply (rpcsvc_request_t *req, struct rpc_msg *reply) { rpcsvc_program_t *prog = NULL; if ((!req) || (!reply)) return -1; - prog = rpcsvc_request_program (req); - rpc_fill_empty_reply (reply, req->xid); + prog = nfs_rpcsvc_request_program (req); + nfs_rpc_fill_empty_reply (reply, req->xid); if (req->rpc_stat == MSG_DENIED) - rpc_fill_denied_reply (reply, req->rpc_err, req->auth_err); + nfs_rpc_fill_denied_reply (reply, req->rpc_err, req->auth_err); else if (req->rpc_stat == MSG_ACCEPTED) - rpc_fill_accepted_reply (reply, req->rpc_err, prog->proglowvers, - prog->proghighvers, req->verf.flavour, - req->verf.datalen, - req->verf.authdata); + nfs_rpc_fill_accepted_reply (reply, req->rpc_err, + prog->proglowvers, + prog->proghighvers, + req->verf.flavour, + req->verf.datalen, + req->verf.authdata); else gf_log (GF_RPCSVC, GF_LOG_ERROR, "Invalid rpc_stat value"); @@ -1482,8 +1499,8 @@ rpcsvc_fill_reply (rpcsvc_request_t *req, struct rpc_msg *reply) * we should account for the length of that buffer in the RPC fragment header. */ struct iobuf * -rpcsvc_record_build_record (rpcsvc_request_t *req, size_t payload, - struct iovec *recbuf) +nfs_rpcsvc_record_build_record (rpcsvc_request_t *req, size_t payload, + struct iovec *recbuf) { struct rpc_msg reply; struct iobuf *replyiob = NULL; @@ -1500,7 +1517,7 @@ rpcsvc_record_build_record (rpcsvc_request_t *req, size_t payload, * layer can use. */ conn = req->conn; - svc = rpcsvc_conn_rpcsvc (conn); + svc = nfs_rpcsvc_conn_rpcsvc (conn); replyiob = iobuf_get (svc->ctx->iobuf_pool); pagesize = iobpool_pagesize ((struct iobuf_pool *)svc->ctx->iobuf_pool); if (!replyiob) { @@ -1511,9 +1528,9 @@ rpcsvc_record_build_record (rpcsvc_request_t *req, size_t payload, record = iobuf_ptr (replyiob); /* Now we have it. */ /* Fill the rpc structure and XDR it into the buffer got above. */ - rpcsvc_fill_reply (req, &reply); - recordhdr = rpcsvc_record_build_header (record, pagesize, reply, - payload); + nfs_rpcsvc_fill_reply (req, &reply); + recordhdr = nfs_rpcsvc_record_build_header (record, pagesize, reply, + payload); if (!recordhdr.iov_base) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to build record " " header"); @@ -1557,8 +1574,8 @@ err_exit: */ int -rpcsvc_submit_generic (rpcsvc_request_t *req, struct iovec msgvec, - struct iobuf *msg) +nfs_rpcsvc_submit_generic (rpcsvc_request_t *req, struct iovec msgvec, + struct iobuf *msg) { int ret = -1; struct iobuf *replyiob = NULL; @@ -1571,7 +1588,8 @@ rpcsvc_submit_generic (rpcsvc_request_t *req, struct iovec msgvec, conn = req->conn; gf_log (GF_RPCSVC, GF_LOG_TRACE, "Tx message: %zu", msgvec.iov_len); /* Build the buffer containing the encoded RPC reply. */ - replyiob = rpcsvc_record_build_record (req, msgvec.iov_len, &recordhdr); + replyiob = nfs_rpcsvc_record_build_record (req, msgvec.iov_len, + &recordhdr); if (!replyiob) { gf_log (GF_RPCSVC, GF_LOG_ERROR,"Reply record creation failed"); goto disconnect_exit; @@ -1584,7 +1602,7 @@ rpcsvc_submit_generic (rpcsvc_request_t *req, struct iovec msgvec, */ if (msg) iobuf_ref (msg); - ret = rpcsvc_conn_submit (conn, recordhdr, replyiob, msgvec, msg); + ret = nfs_rpcsvc_conn_submit (conn, recordhdr, replyiob, msgvec, msg); mem_put (conn->rxpool, req); if (ret == -1) { @@ -1604,18 +1622,18 @@ disconnect_exit: * no actor was called, we will be losing the ref held for the RPC * layer. */ - if ((rpcsvc_request_accepted (req)) && - (rpcsvc_request_accepted_success (req))) - rpcsvc_conn_unref (conn); + if ((nfs_rpcsvc_request_accepted (req)) && + (nfs_rpcsvc_request_accepted_success (req))) + nfs_rpcsvc_conn_unref (conn); return ret; } int -rpcsvc_request_attach_vector (rpcsvc_request_t *req, struct iovec msgvec, - struct iobuf *iob, struct iobref *iobref, - int finalvector) +nfs_rpcsvc_request_attach_vector (rpcsvc_request_t *req, struct iovec msgvec, + struct iobuf *iob, struct iobref *iobref, + int finalvector) { rpcsvc_txbuf_t *txb = NULL; int txflags = 0; @@ -1629,7 +1647,7 @@ rpcsvc_request_attach_vector (rpcsvc_request_t *req, struct iovec msgvec, /* We only let the user decide whether this is the last vector for the * record, since the first vector is always the RPC header. */ - txb = rpcsvc_init_txbuf (req->conn, msgvec, iob, iobref, txflags); + txb = nfs_rpcsvc_init_txbuf (req->conn, msgvec, iob, iobref, txflags); if (!txb) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Could not init tx buf"); return -1; @@ -1647,15 +1665,15 @@ rpcsvc_request_attach_vector (rpcsvc_request_t *req, struct iovec msgvec, int -rpcsvc_request_attach_vectors (rpcsvc_request_t *req, struct iovec *payload, - int vcount, struct iobref *piobref) +nfs_rpcsvc_request_attach_vectors (rpcsvc_request_t *req, struct iovec *payload, + int vcount, struct iobref *piobref) { int c = 0; int ret = -1; for (;c < (vcount-1); c++) { - ret = rpcsvc_request_attach_vector (req, payload[c], NULL, - piobref, 0); + ret = nfs_rpcsvc_request_attach_vector (req, payload[c], NULL, + piobref, 0); if (ret < 0) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to attach " "vector"); @@ -1663,8 +1681,8 @@ rpcsvc_request_attach_vectors (rpcsvc_request_t *req, struct iovec *payload, } } - ret = rpcsvc_request_attach_vector (req, payload[vcount-1], NULL, - piobref, 1); + ret = nfs_rpcsvc_request_attach_vector (req, payload[vcount-1], NULL, + piobref, 1); if (ret < 0) gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to attach final vec"); @@ -1674,7 +1692,7 @@ out: int -rpcsvc_submit_vectors (rpcsvc_request_t *req) +nfs_rpcsvc_submit_vectors (rpcsvc_request_t *req) { int ret = -1; struct iobuf *replyiob = NULL; @@ -1685,15 +1703,15 @@ rpcsvc_submit_vectors (rpcsvc_request_t *req) return -1; /* Build the buffer containing the encoded RPC reply. */ - replyiob = rpcsvc_record_build_record (req, req->payloadsize, - &recordhdr); + replyiob = nfs_rpcsvc_record_build_record (req, req->payloadsize, + &recordhdr); if (!replyiob) { gf_log (GF_RPCSVC, GF_LOG_ERROR,"Reply record creation failed"); goto disconnect_exit; } - rpctxb = rpcsvc_init_txbuf (req->conn, recordhdr, replyiob, NULL, - RPCSVC_TXB_FIRST); + rpctxb = nfs_rpcsvc_init_txbuf (req->conn, recordhdr, replyiob, NULL, + RPCSVC_TXB_FIRST); if (!rpctxb) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to create tx buf"); goto disconnect_exit; @@ -1715,7 +1733,7 @@ disconnect_exit: * response to the ref that is performed on the conn when a request is * handed to the RPC program. */ - rpcsvc_conn_unref (req->conn); + nfs_rpcsvc_conn_unref (req->conn); if (ret == -1) iobuf_unref (replyiob); @@ -1725,7 +1743,7 @@ disconnect_exit: int -rpcsvc_error_reply (rpcsvc_request_t *req) +nfs_rpcsvc_error_reply (rpcsvc_request_t *req) { struct iovec dummyvec = {0, }; @@ -1735,13 +1753,13 @@ rpcsvc_error_reply (rpcsvc_request_t *req) /* At this point the req should already have been filled with the * appropriate RPC error numbers. */ - return rpcsvc_submit_generic (req, dummyvec, NULL); + return nfs_rpcsvc_submit_generic (req, dummyvec, NULL); } rpcsvc_request_t * -rpcsvc_request_init (rpcsvc_conn_t *conn, struct rpc_msg *callmsg, - struct iovec progmsg, rpcsvc_request_t *req) +nfs_rpcsvc_request_init (rpcsvc_conn_t *conn, struct rpc_msg *callmsg, + struct iovec progmsg, rpcsvc_request_t *req) { if ((!conn) || (!callmsg)|| (!req)) return NULL; @@ -1749,10 +1767,10 @@ rpcsvc_request_init (rpcsvc_conn_t *conn, struct rpc_msg *callmsg, /* We start a RPC request as always denied. */ req->rpc_stat = MSG_DENIED; - req->xid = rpc_call_xid (callmsg); - req->prognum = rpc_call_program (callmsg); - req->progver = rpc_call_progver (callmsg); - req->procnum = rpc_call_progproc (callmsg); + req->xid = nfs_rpc_call_xid (callmsg); + req->prognum = nfs_rpc_call_program (callmsg); + req->progver = nfs_rpc_call_progver (callmsg); + req->procnum = nfs_rpc_call_progproc (callmsg); req->conn = conn; req->msg = progmsg; req->recordiob = conn->rstate.activeiob; @@ -1763,19 +1781,19 @@ rpcsvc_request_init (rpcsvc_conn_t *conn, struct rpc_msg *callmsg, * been copied into the required sections of the req structure, * we just need to fill in the meta-data about it now. */ - req->cred.flavour = rpc_call_cred_flavour (callmsg); - req->cred.datalen = rpc_call_cred_len (callmsg); - req->verf.flavour = rpc_call_verf_flavour (callmsg); - req->verf.datalen = rpc_call_verf_len (callmsg); + req->cred.flavour = nfs_rpc_call_cred_flavour (callmsg); + req->cred.datalen = nfs_rpc_call_cred_len (callmsg); + req->verf.flavour = nfs_rpc_call_verf_flavour (callmsg); + req->verf.datalen = nfs_rpc_call_verf_len (callmsg); /* AUTH */ - rpcsvc_auth_request_init (req); + nfs_rpcsvc_auth_request_init (req); return req; } rpcsvc_request_t * -rpcsvc_request_create (rpcsvc_conn_t *conn) +nfs_rpcsvc_request_create (rpcsvc_conn_t *conn) { char *msgbuf = NULL; struct rpc_msg rpcmsg; @@ -1792,43 +1810,45 @@ rpcsvc_request_create (rpcsvc_conn_t *conn) * This avoids a need to keep a temp buffer into which the auth data * would've been copied otherwise. */ - rpcsvc_alloc_request (conn, req); + nfs_rpcsvc_alloc_request (conn, req); if (!req) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to alloc request"); goto err; } msgbuf = iobuf_ptr (conn->rstate.activeiob); - ret = xdr_to_rpc_call (msgbuf, conn->rstate.recordsize, &rpcmsg, - &progmsg, req->cred.authdata,req->verf.authdata); + ret = nfs_xdr_to_rpc_call (msgbuf, conn->rstate.recordsize, &rpcmsg, + &progmsg, req->cred.authdata, + req->verf.authdata); if (ret == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "RPC call decoding failed"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto err; } ret = -1; - rpcsvc_request_init (conn, &rpcmsg, progmsg, req); + nfs_rpcsvc_request_init (conn, &rpcmsg, progmsg, req); gf_log (GF_RPCSVC, GF_LOG_DEBUG, "RPC XID: %lx, Ver: %ld, Program: %ld," - " ProgVers: %ld, Proc: %ld", rpc_call_xid (&rpcmsg), - rpc_call_rpcvers (&rpcmsg), rpc_call_program (&rpcmsg), - rpc_call_progver (&rpcmsg), rpc_call_progproc (&rpcmsg)); + " ProgVers: %ld, Proc: %ld", nfs_rpc_call_xid (&rpcmsg), + nfs_rpc_call_rpcvers (&rpcmsg), nfs_rpc_call_program (&rpcmsg), + nfs_rpc_call_progver (&rpcmsg), + nfs_rpc_call_progproc (&rpcmsg)); - if (rpc_call_rpcvers (&rpcmsg) != 2) { + if (nfs_rpc_call_rpcvers (&rpcmsg) != 2) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "RPC version not supported"); - rpcsvc_request_seterr (req, RPC_MISMATCH); + nfs_rpcsvc_request_seterr (req, RPC_MISMATCH); goto err; } - ret = rpcsvc_authenticate (req); + ret = nfs_rpcsvc_authenticate (req); if (ret == RPCSVC_AUTH_REJECT) { /* No need to set auth_err, that is the responsibility of * the authentication handler since only that know what exact * error happened. */ - rpcsvc_request_seterr (req, AUTH_ERROR); + nfs_rpcsvc_request_seterr (req, AUTH_ERROR); gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed authentication"); ret = -1; goto err; @@ -1842,7 +1862,7 @@ rpcsvc_request_create (rpcsvc_conn_t *conn) ret = 0; err: if (ret == -1) { - ret = rpcsvc_error_reply (req); + ret = nfs_rpcsvc_error_reply (req); req = NULL; } @@ -1851,7 +1871,7 @@ err: int -rpcsvc_handle_rpc_call (rpcsvc_conn_t *conn) +nfs_rpcsvc_handle_rpc_call (rpcsvc_conn_t *conn) { rpcsvc_actor_t *actor = NULL; rpcsvc_request_t *req = NULL; @@ -1860,25 +1880,25 @@ rpcsvc_handle_rpc_call (rpcsvc_conn_t *conn) if (!conn) return -1; - req = rpcsvc_request_create (conn); + req = nfs_rpcsvc_request_create (conn); if (!req) goto err; - if (!rpcsvc_request_accepted (req)) + if (!nfs_rpcsvc_request_accepted (req)) goto err_reply; - actor = rpcsvc_program_actor (conn, req); + actor = nfs_rpcsvc_program_actor (conn, req); if (!actor) goto err_reply; if ((actor) && (actor->actor)) { - rpcsvc_conn_ref (conn); + nfs_rpcsvc_conn_ref (conn); ret = actor->actor (req); } err_reply: if (ret == RPCSVC_ACTOR_ERROR) - ret = rpcsvc_error_reply (req); + ret = nfs_rpcsvc_error_reply (req); /* No need to propagate error beyond this function since the reply * has now been queued. */ @@ -1887,17 +1907,17 @@ err: return ret; } -#define rpc_call_cred_addr(rs) (iobuf_ptr ((rs)->activeiob) + RPCSVC_BARERPC_MSGSZ - 4) +#define nfs_rpc_call_cred_addr(rs) (iobuf_ptr ((rs)->activeiob) + RPCSVC_BARERPC_MSGSZ - 4) uint32_t -rpcsvc_call_credlen (rpcsvc_record_state_t *rs) +nfs_rpcsvc_call_credlen (rpcsvc_record_state_t *rs) { char *credaddr = NULL; uint32_t credlen_nw = 0; uint32_t credlen_host = 0; /* Position to the start of the credential length field. */ - credaddr = rpc_call_cred_addr (rs); + credaddr = nfs_rpc_call_cred_addr (rs); credlen_nw = *(uint32_t *)credaddr; credlen_host = ntohl (credlen_nw); @@ -1905,7 +1925,7 @@ rpcsvc_call_credlen (rpcsvc_record_state_t *rs) } uint32_t -rpcsvc_call_verflen (rpcsvc_record_state_t *rs) +nfs_rpcsvc_call_verflen (rpcsvc_record_state_t *rs) { char *verfaddr = NULL; uint32_t verflen_nw = 0; @@ -1913,8 +1933,8 @@ rpcsvc_call_verflen (rpcsvc_record_state_t *rs) uint32_t credlen = 0; /* Position to the start of the verifier length field. */ - credlen = rpcsvc_call_credlen (rs); - verfaddr = (rpc_call_cred_addr (rs) + 4 + credlen); + credlen = nfs_rpcsvc_call_credlen (rs); + verfaddr = (nfs_rpc_call_cred_addr (rs) + 4 + credlen); verflen_nw = *(uint32_t *)verfaddr; verflen_host = ntohl (verflen_nw); @@ -1923,18 +1943,18 @@ rpcsvc_call_verflen (rpcsvc_record_state_t *rs) void -rpcsvc_update_vectored_verf (rpcsvc_record_state_t *rs) +nfs_rpcsvc_update_vectored_verf (rpcsvc_record_state_t *rs) { if (!rs) return; - rs->recordsize += rpcsvc_call_verflen (rs); + rs->recordsize += nfs_rpcsvc_call_verflen (rs); return; } void -rpcsvc_handle_vectored_prep_rpc_call (rpcsvc_conn_t *conn) +nfs_rpcsvc_handle_vectored_prep_rpc_call (rpcsvc_conn_t *conn) { rpcsvc_actor_t *actor = NULL; rpcsvc_request_t *req = NULL; @@ -1955,31 +1975,31 @@ rpcsvc_handle_vectored_prep_rpc_call (rpcsvc_conn_t *conn) */ rs->remainingfrag = rs->fragsize - rs->recordsize; rs->vecstate = RPCSVC_VECTOR_IGNORE; - req = rpcsvc_request_create (conn); - svc = rpcsvc_conn_rpcsvc (conn); + req = nfs_rpcsvc_request_create (conn); + svc = nfs_rpcsvc_conn_rpcsvc (conn); if (!req) goto err; - if (!rpcsvc_request_accepted (req)) + if (!nfs_rpcsvc_request_accepted (req)) goto err_reply; - actor = rpcsvc_program_actor (conn, req); + actor = nfs_rpcsvc_program_actor (conn, req); if (!actor) goto err_reply; if (!actor->vector_sizer) { ret = -1; - rpcsvc_request_seterr (req, PROC_UNAVAIL); + nfs_rpcsvc_request_seterr (req, PROC_UNAVAIL); goto err_reply; } - rpcsvc_conn_ref (conn); + nfs_rpcsvc_conn_ref (conn); ret = actor->vector_sizer (req, &remfrag, &newbuf); - rpcsvc_conn_unref (conn); + nfs_rpcsvc_conn_unref (conn); if (ret == RPCSVC_ACTOR_ERROR) { ret = -1; - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); goto err_reply; } @@ -1998,7 +2018,7 @@ rpcsvc_handle_vectored_prep_rpc_call (rpcsvc_conn_t *conn) err_reply: if (ret == -1) - ret = rpcsvc_error_reply (req); + ret = nfs_rpcsvc_error_reply (req); /* No need to propagate error beyond this function since the reply * has now been queued. */ @@ -2009,7 +2029,7 @@ err: void -rpcsvc_update_vectored_verfsz (rpcsvc_conn_t *conn) +nfs_rpcsvc_update_vectored_verfsz (rpcsvc_conn_t *conn) { rpcsvc_record_state_t *rs = NULL; uint32_t verflen = 0; @@ -2019,7 +2039,7 @@ rpcsvc_update_vectored_verfsz (rpcsvc_conn_t *conn) rs = &conn->rstate; - verflen = rpcsvc_call_verflen (rs); + verflen = nfs_rpcsvc_call_verflen (rs); rs->recordsize += 8; if (verflen > 0) { rs->remainingfrag = verflen; @@ -2028,7 +2048,7 @@ rpcsvc_update_vectored_verfsz (rpcsvc_conn_t *conn) rs->vecstate = RPCSVC_VECTOR_READVERF; } else { gf_log (GF_RPCSVC, GF_LOG_TRACE, "Vectored RPC preparing call"); - rpcsvc_handle_vectored_prep_rpc_call (conn); + nfs_rpcsvc_handle_vectored_prep_rpc_call (conn); } return; @@ -2036,14 +2056,14 @@ rpcsvc_update_vectored_verfsz (rpcsvc_conn_t *conn) void -rpcsvc_update_vectored_cred (rpcsvc_record_state_t *rs) +nfs_rpcsvc_update_vectored_cred (rpcsvc_record_state_t *rs) { uint32_t credlen = 0; if (!rs) return; - credlen = rpcsvc_call_credlen (rs); + credlen = nfs_rpcsvc_call_credlen (rs); /* Update remainingfrag to read the 8 bytes needed for * reading verf flavour and verf len. */ @@ -2057,14 +2077,14 @@ rpcsvc_update_vectored_cred (rpcsvc_record_state_t *rs) } void -rpcsvc_update_vectored_barerpc (rpcsvc_record_state_t *rs) +nfs_rpcsvc_update_vectored_barerpc (rpcsvc_record_state_t *rs) { uint32_t credlen = 0; if (!rs) return; - credlen = rpcsvc_call_credlen (rs); + credlen = nfs_rpcsvc_call_credlen (rs); rs->recordsize = RPCSVC_BARERPC_MSGSZ; if (credlen == 0) { rs->remainingfrag = 8; @@ -2083,7 +2103,7 @@ rpcsvc_update_vectored_barerpc (rpcsvc_record_state_t *rs) void -rpcsvc_handle_vectored_rpc_call (rpcsvc_conn_t *conn) +nfs_rpcsvc_handle_vectored_rpc_call (rpcsvc_conn_t *conn) { rpcsvc_actor_t *actor = NULL; rpcsvc_request_t *req = NULL; @@ -2099,28 +2119,28 @@ rpcsvc_handle_vectored_rpc_call (rpcsvc_conn_t *conn) rs = &conn->rstate; req = conn->vectoredreq; - svc = rpcsvc_conn_rpcsvc (conn); + svc = nfs_rpcsvc_conn_rpcsvc (conn); if (!req) goto err; - actor = rpcsvc_program_actor (conn, req); + actor = nfs_rpcsvc_program_actor (conn, req); if (!actor) goto err_reply; if (!actor->vector_sizer) { ret = -1; - rpcsvc_request_seterr (req, PROC_UNAVAIL); + nfs_rpcsvc_request_seterr (req, PROC_UNAVAIL); goto err_reply; } req->msg.iov_len = (unsigned long)((long)rs->fragcurrent - (long)req->msg.iov_base); - rpcsvc_conn_ref (conn); + nfs_rpcsvc_conn_ref (conn); ret = actor->vector_sizer (req, &remfrag, &newbuf); - rpcsvc_conn_unref (conn); + nfs_rpcsvc_conn_unref (conn); if (ret == RPCSVC_ACTOR_ERROR) { ret = -1; - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); goto err_reply; } @@ -2140,7 +2160,7 @@ rpcsvc_handle_vectored_rpc_call (rpcsvc_conn_t *conn) ret = 0; err_reply: if (ret == -1) - ret = rpcsvc_error_reply (req); + ret = nfs_rpcsvc_error_reply (req); /* No need to propagate error beyond this function since the reply * has now been queued. */ @@ -2152,7 +2172,7 @@ err: void -rpcsvc_record_vectored_call_actor (rpcsvc_conn_t *conn) +nfs_rpcsvc_record_vectored_call_actor (rpcsvc_conn_t *conn) { rpcsvc_actor_t *actor = NULL; rpcsvc_request_t *req = NULL; @@ -2165,27 +2185,27 @@ rpcsvc_record_vectored_call_actor (rpcsvc_conn_t *conn) rs = &conn->rstate; req = conn->vectoredreq; - svc = rpcsvc_conn_rpcsvc (conn); + svc = nfs_rpcsvc_conn_rpcsvc (conn); if (!req) goto err; - actor = rpcsvc_program_actor (conn, req); + actor = nfs_rpcsvc_program_actor (conn, req); if (!actor) goto err_reply; if (actor->vector_actor) { - rpcsvc_conn_ref (conn); + nfs_rpcsvc_conn_ref (conn); ret = actor->vector_actor (req, rs->vectoriob); } else { - rpcsvc_request_seterr (req, PROC_UNAVAIL); + nfs_rpcsvc_request_seterr (req, PROC_UNAVAIL); gf_log (GF_RPCSVC, GF_LOG_ERROR, "No vectored handler present"); ret = RPCSVC_ACTOR_ERROR; } err_reply: if (ret == RPCSVC_ACTOR_ERROR) - ret = rpcsvc_error_reply (req); + ret = nfs_rpcsvc_error_reply (req); /* No need to propagate error beyond this function since the reply * has now been queued. */ @@ -2197,7 +2217,7 @@ err: ssize_t -rpcsvc_update_vectored_state (rpcsvc_conn_t *conn) +nfs_rpcsvc_update_vectored_state (rpcsvc_conn_t *conn) { rpcsvc_record_state_t *rs = NULL; rpcsvc_t *svc = NULL; @@ -2215,26 +2235,26 @@ rpcsvc_update_vectored_state (rpcsvc_conn_t *conn) */ rs = &conn->rstate; - if (rpcsvc_record_vectored_baremsg (rs)) - rpcsvc_update_vectored_barerpc (rs); - else if (rpcsvc_record_vectored_cred (rs)) - rpcsvc_update_vectored_cred (rs); - else if (rpcsvc_record_vectored_verfsz (rs)) - rpcsvc_update_vectored_verfsz (conn); - else if (rpcsvc_record_vectored_verfread (rs)) { - rpcsvc_update_vectored_verf (rs); + if (nfs_rpcsvc_record_vectored_baremsg (rs)) + nfs_rpcsvc_update_vectored_barerpc (rs); + else if (nfs_rpcsvc_record_vectored_cred (rs)) + nfs_rpcsvc_update_vectored_cred (rs); + else if (nfs_rpcsvc_record_vectored_verfsz (rs)) + nfs_rpcsvc_update_vectored_verfsz (conn); + else if (nfs_rpcsvc_record_vectored_verfread (rs)) { + nfs_rpcsvc_update_vectored_verf (rs); gf_log (GF_RPCSVC, GF_LOG_TRACE, "Vectored RPC preparing call"); - rpcsvc_handle_vectored_prep_rpc_call (conn); - } else if (rpcsvc_record_vectored_readprochdr (rs)) - rpcsvc_handle_vectored_rpc_call (conn); - else if (rpcsvc_record_vectored_ignore (rs)) { - svc = rpcsvc_conn_rpcsvc (conn); - rpcsvc_record_init (rs, svc->ctx->iobuf_pool); - } else if (rpcsvc_record_vectored_readvec (rs)) { - svc = rpcsvc_conn_rpcsvc (conn); + nfs_rpcsvc_handle_vectored_prep_rpc_call (conn); + } else if (nfs_rpcsvc_record_vectored_readprochdr (rs)) + nfs_rpcsvc_handle_vectored_rpc_call (conn); + else if (nfs_rpcsvc_record_vectored_ignore (rs)) { + svc = nfs_rpcsvc_conn_rpcsvc (conn); + nfs_rpcsvc_record_init (rs, svc->ctx->iobuf_pool); + } else if (nfs_rpcsvc_record_vectored_readvec (rs)) { + svc = nfs_rpcsvc_conn_rpcsvc (conn); gf_log (GF_RPCSVC, GF_LOG_TRACE, "Vectored RPC vector read"); - rpcsvc_record_vectored_call_actor (conn); - rpcsvc_record_init (rs, svc->ctx->iobuf_pool); + nfs_rpcsvc_record_vectored_call_actor (conn); + nfs_rpcsvc_record_init (rs, svc->ctx->iobuf_pool); } return 0; @@ -2242,10 +2262,11 @@ rpcsvc_update_vectored_state (rpcsvc_conn_t *conn) ssize_t -rpcsvc_record_read_partial_frag (rpcsvc_record_state_t *rs, ssize_t dataread); +nfs_rpcsvc_record_read_partial_frag (rpcsvc_record_state_t *rs, + ssize_t dataread); ssize_t -rpcsvc_update_vectored_msg (rpcsvc_conn_t *conn, ssize_t dataread) +nfs_rpcsvc_update_vectored_msg (rpcsvc_conn_t *conn, ssize_t dataread) { if (!conn) @@ -2262,7 +2283,7 @@ rpcsvc_update_vectored_msg (rpcsvc_conn_t *conn, ssize_t dataread) * rstate to be RPCSVC_BARERPC_MSGSZ for the purpose of a vectored * fragment. */ - return rpcsvc_record_read_partial_frag (&conn->rstate, dataread); + return nfs_rpcsvc_record_read_partial_frag (&conn->rstate, dataread); } /* FIX: As a first version of vectored reading, I am assuming dataread will @@ -2271,7 +2292,7 @@ rpcsvc_update_vectored_msg (rpcsvc_conn_t *conn, ssize_t dataread) * poll_in. */ ssize_t -rpcsvc_handle_vectored_frag (rpcsvc_conn_t *conn, ssize_t dataread) +nfs_rpcsvc_handle_vectored_frag (rpcsvc_conn_t *conn, ssize_t dataread) { if (!conn) return dataread; @@ -2287,11 +2308,11 @@ rpcsvc_handle_vectored_frag (rpcsvc_conn_t *conn, ssize_t dataread) * to, as a first step, identify which (program, actor) we need to call. */ - dataread = rpcsvc_update_vectored_msg (conn, dataread); + dataread = nfs_rpcsvc_update_vectored_msg (conn, dataread); if (conn->rstate.remainingfrag == 0) { gf_log (GF_RPCSVC, GF_LOG_TRACE, "Vectored frag complete"); - dataread = rpcsvc_update_vectored_state (conn); + dataread = nfs_rpcsvc_update_vectored_state (conn); } return dataread; @@ -2299,7 +2320,7 @@ rpcsvc_handle_vectored_frag (rpcsvc_conn_t *conn, ssize_t dataread) int -rpcsvc_record_update_state (rpcsvc_conn_t *conn, ssize_t dataread) +nfs_rpcsvc_record_update_state (rpcsvc_conn_t *conn, ssize_t dataread) { rpcsvc_record_state_t *rs = NULL; rpcsvc_t *svc = NULL; @@ -2312,10 +2333,10 @@ rpcsvc_record_update_state (rpcsvc_conn_t *conn, ssize_t dataread) * start of the area into which dataread number of bytes were read. */ - if (rpcsvc_record_readfraghdr(rs)) - dataread = rpcsvc_record_update_fraghdr (rs, dataread); + if (nfs_rpcsvc_record_readfraghdr(rs)) + dataread = nfs_rpcsvc_record_update_fraghdr (rs, dataread); - if (rpcsvc_record_readfrag(rs)) { + if (nfs_rpcsvc_record_readfrag(rs)) { /* The minimum needed for triggering the vectored handler is * the frag size field. The fragsize member remains set to this * size till this request is completely extracted from the @@ -2326,12 +2347,13 @@ rpcsvc_record_update_state (rpcsvc_conn_t *conn, ssize_t dataread) * condition as the flag to tell us that this is a vectored * fragment. */ - if ((dataread > 0) && (rpcsvc_record_vectored (rs))) { + if ((dataread > 0) && (nfs_rpcsvc_record_vectored (rs))) { gf_log (GF_RPCSVC, GF_LOG_TRACE, "Vectored frag"); - dataread = rpcsvc_handle_vectored_frag (conn, dataread); + dataread = nfs_rpcsvc_handle_vectored_frag (conn, + dataread); } else if (dataread > 0) { gf_log (GF_RPCSVC, GF_LOG_TRACE, "Regular frag"); - dataread = rpcsvc_record_update_frag (rs, dataread); + dataread = nfs_rpcsvc_record_update_frag (rs, dataread); } } @@ -2351,11 +2373,11 @@ rpcsvc_record_update_state (rpcsvc_conn_t *conn, ssize_t dataread) * XDR formatted buffer in activeiob followed by the upcall to the * protocol actor. */ - if ((rpcsvc_record_readfraghdr(rs)) && (rs->islastfrag)) { + if ((nfs_rpcsvc_record_readfraghdr(rs)) && (rs->islastfrag)) { gf_log (GF_RPCSVC, GF_LOG_TRACE, "Full Record Received."); - rpcsvc_handle_rpc_call (conn); - svc = rpcsvc_conn_rpcsvc (conn); - rpcsvc_record_init (rs, svc->ctx->iobuf_pool); + nfs_rpcsvc_handle_rpc_call (conn); + svc = nfs_rpcsvc_conn_rpcsvc (conn); + nfs_rpcsvc_record_init (rs, svc->ctx->iobuf_pool); } return 0; @@ -2363,40 +2385,40 @@ rpcsvc_record_update_state (rpcsvc_conn_t *conn, ssize_t dataread) char * -rpcsvc_record_read_addr (rpcsvc_record_state_t *rs) +nfs_rpcsvc_record_read_addr (rpcsvc_record_state_t *rs) { - if (rpcsvc_record_readfraghdr (rs)) - return rpcsvc_record_currenthdr_addr (rs); - else if (rpcsvc_record_readfrag (rs)) - return rpcsvc_record_currentfrag_addr (rs); + if (nfs_rpcsvc_record_readfraghdr (rs)) + return nfs_rpcsvc_record_currenthdr_addr (rs); + else if (nfs_rpcsvc_record_readfrag (rs)) + return nfs_rpcsvc_record_currentfrag_addr (rs); return NULL; } int -rpcsvc_conn_data_poll_in (rpcsvc_conn_t *conn) +nfs_rpcsvc_conn_data_poll_in (rpcsvc_conn_t *conn) { ssize_t dataread = -1; size_t readsize = 0; char *readaddr = NULL; int ret = -1; - readaddr = rpcsvc_record_read_addr (&conn->rstate); + readaddr = nfs_rpcsvc_record_read_addr (&conn->rstate); if (!readaddr) goto err; - readsize = rpcsvc_record_read_size (&conn->rstate); + readsize = nfs_rpcsvc_record_read_size (&conn->rstate); if (readsize == -1) goto err; - dataread = rpcsvc_socket_read (conn->sockfd, readaddr, readsize); - gf_log (GF_RPCSVC, GF_LOG_TRACE, "conn: 0x%lx, readsize: %zu, dataread: %zd", - (long)conn, readsize, dataread); + dataread = nfs_rpcsvc_socket_read (conn->sockfd, readaddr, readsize); + gf_log (GF_RPCSVC, GF_LOG_TRACE, "conn: 0x%lx, readsize: %zu, dataread:" + "%zd", (long)conn, readsize, dataread); if (dataread > 0) - ret = rpcsvc_record_update_state (conn, dataread); + ret = nfs_rpcsvc_record_update_state (conn, dataread); err: return ret; @@ -2404,16 +2426,16 @@ err: int -rpcsvc_conn_data_poll_err (rpcsvc_conn_t *conn) +nfs_rpcsvc_conn_data_poll_err (rpcsvc_conn_t *conn) { gf_log (GF_RPCSVC, GF_LOG_TRACE, "Received error event"); - rpcsvc_conn_deinit (conn); + nfs_rpcsvc_conn_deinit (conn); return 0; } int -__rpcsvc_conn_data_poll_out (rpcsvc_conn_t *conn) +__nfs_rpcsvc_conn_data_poll_out (rpcsvc_conn_t *conn) { rpcsvc_txbuf_t *txbuf = NULL; rpcsvc_txbuf_t *tmp = NULL; @@ -2432,14 +2454,14 @@ tx_remaining: if (txbuf->txbehave & RPCSVC_TXB_FIRST) { gf_log (GF_RPCSVC, GF_LOG_TRACE, "First Tx Buf"); - rpcsvc_socket_block_tx (conn->sockfd); + nfs_rpcsvc_socket_block_tx (conn->sockfd); } - written = rpcsvc_socket_write (conn->sockfd, writeaddr, - writesize); + written = nfs_rpcsvc_socket_write (conn->sockfd, writeaddr, + writesize); if (txbuf->txbehave & RPCSVC_TXB_LAST) { gf_log (GF_RPCSVC, GF_LOG_TRACE, "Last Tx Buf"); - rpcsvc_socket_unblock_tx (conn->sockfd); + nfs_rpcsvc_socket_unblock_tx (conn->sockfd); } gf_log (GF_RPCSVC, GF_LOG_TRACE, "conn: 0x%lx, Tx request: %zu," " Tx sent: %zd", (long)conn, writesize, written); @@ -2476,7 +2498,7 @@ tx_remaining: /* If we've broken out of the loop above then we must unblock * the transmission now. */ - rpcsvc_socket_unblock_tx (conn->sockfd); + nfs_rpcsvc_socket_unblock_tx (conn->sockfd); if (list_empty (&conn->txbufs)) conn->eventidx = event_select_on (conn->stage->eventpool, conn->sockfd, conn->eventidx, @@ -2487,7 +2509,7 @@ tx_remaining: int -rpcsvc_conn_data_poll_out (rpcsvc_conn_t *conn) +nfs_rpcsvc_conn_data_poll_out (rpcsvc_conn_t *conn) { if (!conn) return -1; @@ -2495,7 +2517,7 @@ rpcsvc_conn_data_poll_out (rpcsvc_conn_t *conn) pthread_mutex_lock (&conn->connlock); { - __rpcsvc_conn_data_poll_out (conn); + __nfs_rpcsvc_conn_data_poll_out (conn); } pthread_mutex_unlock (&conn->connlock); @@ -2504,8 +2526,8 @@ rpcsvc_conn_data_poll_out (rpcsvc_conn_t *conn) int -rpcsvc_conn_data_handler (int fd, int idx, void *data, int poll_in, int poll_out - , int poll_err) +nfs_rpcsvc_conn_data_handler (int fd, int idx, void *data, int poll_in, + int poll_out, int poll_err) { rpcsvc_conn_t *conn = NULL; int ret = 0; @@ -2516,28 +2538,28 @@ rpcsvc_conn_data_handler (int fd, int idx, void *data, int poll_in, int poll_out conn = (rpcsvc_conn_t *)data; if (poll_out) - ret = rpcsvc_conn_data_poll_out (conn); + ret = nfs_rpcsvc_conn_data_poll_out (conn); if (poll_err) { - ret = rpcsvc_conn_data_poll_err (conn); + ret = nfs_rpcsvc_conn_data_poll_err (conn); return 0; } if (poll_in) { ret = 0; - ret = rpcsvc_conn_data_poll_in (conn); + ret = nfs_rpcsvc_conn_data_poll_in (conn); } if (ret == -1) - rpcsvc_conn_data_poll_err (conn); + nfs_rpcsvc_conn_data_poll_err (conn); return 0; } int -rpcsvc_conn_listening_handler (int fd, int idx, void *data, int poll_in, - int poll_out, int poll_err) +nfs_rpcsvc_conn_listening_handler (int fd, int idx, void *data, int poll_in, + int poll_out, int poll_err) { rpcsvc_conn_t *newconn = NULL; rpcsvc_stage_t *selectedstage = NULL; @@ -2551,22 +2573,23 @@ rpcsvc_conn_listening_handler (int fd, int idx, void *data, int poll_in, conn = (rpcsvc_conn_t *)data; prog = (rpcsvc_program_t *)conn->program; - svc = rpcsvc_conn_rpcsvc (conn); - newconn = rpcsvc_conn_accept_init (svc, fd, prog); + svc = nfs_rpcsvc_conn_rpcsvc (conn); + newconn = nfs_rpcsvc_conn_accept_init (svc, fd, prog); if (!newconn) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "failed to accept connection"); goto err; } - selectedstage = rpcsvc_select_stage (svc); + selectedstage = nfs_rpcsvc_select_stage (svc); if (!selectedstage) goto close_err; /* Now that we've accepted the connection, we need to associate * its events to a stage. */ - ret = rpcsvc_stage_conn_associate (selectedstage, newconn, - rpcsvc_conn_data_handler, newconn); + ret = nfs_rpcsvc_stage_conn_associate (selectedstage, newconn, + nfs_rpcsvc_conn_data_handler, + newconn); if (ret == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "could not associated stage " " with new connection"); @@ -2578,7 +2601,7 @@ rpcsvc_conn_listening_handler (int fd, int idx, void *data, int poll_in, ret = 0; close_err: if (ret == -1) - rpcsvc_conn_unref (newconn); + nfs_rpcsvc_conn_unref (newconn); err: return ret; @@ -2587,7 +2610,7 @@ err: /* Register the program with the local portmapper service. */ int -rpcsvc_program_register_portmap (rpcsvc_program_t *newprog) +nfs_rpcsvc_program_register_portmap (rpcsvc_program_t *newprog) { if (!newprog) return -1; @@ -2604,7 +2627,7 @@ rpcsvc_program_register_portmap (rpcsvc_program_t *newprog) int -rpcsvc_program_unregister_portmap (rpcsvc_program_t *prog) +nfs_rpcsvc_program_unregister_portmap (rpcsvc_program_t *prog) { if (!prog) return -1; @@ -2620,7 +2643,8 @@ rpcsvc_program_unregister_portmap (rpcsvc_program_t *prog) int -rpcsvc_stage_program_register (rpcsvc_stage_t *stg, rpcsvc_program_t *newprog) +nfs_rpcsvc_stage_program_register (rpcsvc_stage_t *stg, + rpcsvc_program_t *newprog) { rpcsvc_conn_t *newconn = NULL; rpcsvc_t *svc = NULL; @@ -2628,18 +2652,18 @@ rpcsvc_stage_program_register (rpcsvc_stage_t *stg, rpcsvc_program_t *newprog) if ((!stg) || (!newprog)) return -1; - svc = rpcsvc_stage_service (stg); + svc = nfs_rpcsvc_stage_service (stg); /* Create a listening socket */ - newconn = rpcsvc_conn_listen_init (svc, newprog); + newconn = nfs_rpcsvc_conn_listen_init (svc, newprog); if (!newconn) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "could not create listening" " connection"); return -1; } - if ((rpcsvc_stage_conn_associate (stg, newconn, - rpcsvc_conn_listening_handler, - newconn)) == -1) { + if ((nfs_rpcsvc_stage_conn_associate (stg, newconn, + nfs_rpcsvc_conn_listening_handler, + newconn)) == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR,"could not associate stage with" " listening connection"); return -1; @@ -2650,7 +2674,7 @@ rpcsvc_stage_program_register (rpcsvc_stage_t *stg, rpcsvc_program_t *newprog) int -rpcsvc_program_register (rpcsvc_t *svc, rpcsvc_program_t program) +nfs_rpcsvc_program_register (rpcsvc_t *svc, rpcsvc_program_t program) { rpcsvc_program_t *newprog = NULL; rpcsvc_stage_t *selectedstage = NULL; @@ -2659,7 +2683,7 @@ rpcsvc_program_register (rpcsvc_t *svc, rpcsvc_program_t program) if (!svc) return -1; - newprog = GF_CALLOC (1, sizeof(*newprog), gf_common_mt_rpcsvc_program_t); + newprog = GF_CALLOC (1, sizeof(*newprog),gf_common_mt_rpcsvc_program_t); if (!newprog) return -1; @@ -2667,16 +2691,16 @@ rpcsvc_program_register (rpcsvc_t *svc, rpcsvc_program_t program) goto free_prog; memcpy (newprog, &program, sizeof (program)); - selectedstage = rpcsvc_select_stage (svc); + selectedstage = nfs_rpcsvc_select_stage (svc); - ret = rpcsvc_stage_program_register (selectedstage, newprog); + ret = nfs_rpcsvc_stage_program_register (selectedstage, newprog); if (ret == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "stage registration of program" " failed"); goto free_prog; } - ret = rpcsvc_program_register_portmap (newprog); + ret = nfs_rpcsvc_program_register_portmap (newprog); if (ret == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "portmap registration of" " program failed"); @@ -2706,18 +2730,18 @@ free_prog: * we must perform NULL checks before calling the generic submit. */ int -rpcsvc_submit_message (rpcsvc_request_t *req, struct iovec msgvec, - struct iobuf *msg) +nfs_rpcsvc_submit_message (rpcsvc_request_t *req, struct iovec msgvec, + struct iobuf *msg) { if ((!req) || (!req->conn) || (!msg) || (!msgvec.iov_base)) return -1; - return rpcsvc_submit_generic (req, msgvec, msg); + return nfs_rpcsvc_submit_generic (req, msgvec, msg); } int -rpcsvc_program_unregister (rpcsvc_t *svc, rpcsvc_program_t prog) +nfs_rpcsvc_program_unregister (rpcsvc_t *svc, rpcsvc_program_t prog) { int ret = -1; @@ -2725,7 +2749,7 @@ rpcsvc_program_unregister (rpcsvc_t *svc, rpcsvc_program_t prog) return -1; /* TODO: De-init the listening connection for this program. */ - ret = rpcsvc_program_unregister_portmap (&prog); + ret = nfs_rpcsvc_program_unregister_portmap (&prog); if (ret == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "portmap unregistration of" " program failed"); @@ -2748,23 +2772,23 @@ err: int -rpcsvc_conn_peername (rpcsvc_conn_t *conn, char *hostname, int hostlen) +nfs_rpcsvc_conn_peername (rpcsvc_conn_t *conn, char *hostname, int hostlen) { if (!conn) return -1; - return rpcsvc_socket_peername (conn->sockfd, hostname, hostlen); + return nfs_rpcsvc_socket_peername (conn->sockfd, hostname, hostlen); } int -rpcsvc_conn_peeraddr (rpcsvc_conn_t *conn, char *addrstr, int addrlen, - struct sockaddr *sa, socklen_t sasize) +nfs_rpcsvc_conn_peeraddr (rpcsvc_conn_t *conn, char *addrstr, int addrlen, + struct sockaddr *sa, socklen_t sasize) { if (!conn) return -1; - return rpcsvc_socket_peeraddr (conn->sockfd, addrstr, addrlen, sa, - sasize); + return nfs_rpcsvc_socket_peeraddr (conn->sockfd, addrstr, addrlen, sa, + sasize); } diff --git a/xlators/nfs/lib/src/rpcsvc.h b/xlators/nfs/lib/src/rpcsvc.h index a77021ac47e..a56b70d4eed 100644 --- a/xlators/nfs/lib/src/rpcsvc.h +++ b/xlators/nfs/lib/src/rpcsvc.h @@ -17,8 +17,8 @@ <http://www.gnu.org/licenses/>. */ -#ifndef _RPCSVC_H -#define _RPCSVC_H +#ifndef _NFS_RPCSVC_H +#define _NFS_RPCSVC_H #ifndef _CONFIG_H @@ -43,7 +43,7 @@ #define NGRPS RPCAUTH_UNIXGIDS #endif -#define GF_RPCSVC "rpc-service" +#define GF_RPCSVC "nfsrpc" #define RPCSVC_THREAD_STACK_SIZE ((size_t)(1024 * GF_UNIT_KB)) #define RPCSVC_DEFAULT_MEMFACTOR 15 @@ -87,14 +87,14 @@ #define RPCSVC_VECTOR_READVEC 1007 #define RPCSVC_VECTOR_READPROCHDR 1008 -#define rpcsvc_record_vectored_baremsg(rs) (((rs)->state == RPCSVC_READ_FRAG) && (rs)->vecstate == 0) -#define rpcsvc_record_vectored_cred(rs) ((rs)->vecstate == RPCSVC_VECTOR_READCRED) -#define rpcsvc_record_vectored_verfsz(rs) ((rs)->vecstate == RPCSVC_VECTOR_READVERFSZ) -#define rpcsvc_record_vectored_verfread(rs) ((rs)->vecstate == RPCSVC_VECTOR_READVERF) -#define rpcsvc_record_vectored_ignore(rs) ((rs)->vecstate == RPCSVC_VECTOR_IGNORE) -#define rpcsvc_record_vectored_readvec(rs) ((rs)->vecstate == RPCSVC_VECTOR_READVEC) -#define rpcsvc_record_vectored_readprochdr(rs) ((rs)->vecstate == RPCSVC_VECTOR_READPROCHDR) -#define rpcsvc_record_vectored(rs) ((rs)->fragsize > RPCSVC_VECTORED_FRAGSZ) +#define nfs_rpcsvc_record_vectored_baremsg(rs) (((rs)->state == RPCSVC_READ_FRAG) && (rs)->vecstate == 0) +#define nfs_rpcsvc_record_vectored_cred(rs) ((rs)->vecstate == RPCSVC_VECTOR_READCRED) +#define nfs_rpcsvc_record_vectored_verfsz(rs) ((rs)->vecstate == RPCSVC_VECTOR_READVERFSZ) +#define nfs_rpcsvc_record_vectored_verfread(rs) ((rs)->vecstate == RPCSVC_VECTOR_READVERF) +#define nfs_rpcsvc_record_vectored_ignore(rs) ((rs)->vecstate == RPCSVC_VECTOR_IGNORE) +#define nfs_rpcsvc_record_vectored_readvec(rs) ((rs)->vecstate == RPCSVC_VECTOR_READVEC) +#define nfs_rpcsvc_record_vectored_readprochdr(rs) ((rs)->vecstate == RPCSVC_VECTOR_READPROCHDR) +#define nfs_rpcsvc_record_vectored(rs) ((rs)->fragsize > RPCSVC_VECTORED_FRAGSZ) /* Includes bytes up to and including the credential length field. The credlen * will be followed by @credlen bytes of credential data which will have to be * read separately by the vectored reader. After the credentials comes the @@ -102,10 +102,10 @@ * verf flavour and verflen. */ #define RPCSVC_BARERPC_MSGSZ 32 -#define rpcsvc_record_readfraghdr(rs) ((rs)->state == RPCSVC_READ_FRAGHDR) -#define rpcsvc_record_readfrag(rs) ((rs)->state == RPCSVC_READ_FRAG) +#define nfs_rpcsvc_record_readfraghdr(rs) ((rs)->state == RPCSVC_READ_FRAGHDR) +#define nfs_rpcsvc_record_readfrag(rs) ((rs)->state == RPCSVC_READ_FRAG) -#define rpcsvc_conn_rpcsvc(conn) ((conn)->stage->svc) +#define nfs_rpcsvc_conn_rpcsvc(conn) ((conn)->stage->svc) #define RPCSVC_LOWVERS 2 #define RPCSVC_HIGHVERS 2 @@ -197,7 +197,7 @@ typedef struct rpcsvc_record_state { #define RPCSVC_CONNSTATE_CONNECTED 1 #define RPCSVC_CONNSTATE_DISCONNECTED 2 -#define rpcsvc_conn_check_active(conn) ((conn)->connstate==RPCSVC_CONNSTATE_CONNECTED) +#define nfs_rpcsvc_conn_check_active(conn) ((conn)->connstate==RPCSVC_CONNSTATE_CONNECTED) typedef struct rpcsvc_request rpcsvc_request_t; /* Contains the state for each connection that is used for transmitting and @@ -275,7 +275,7 @@ typedef struct rpcsvc_auth_data { char authdata[RPCSVC_MAX_AUTH_BYTES]; } rpcsvc_auth_data_t; -#define rpcsvc_auth_flavour(au) ((au).flavour) +#define nfs_rpcsvc_auth_flavour(au) ((au).flavour) /* The container for the RPC call handed up to an actor. * Dynamically allocated. Lives till the call reply is completely @@ -366,28 +366,28 @@ struct rpcsvc_request { }; -#define rpcsvc_request_program(req) ((rpcsvc_program_t *)((req)->conn->program)) -#define rpcsvc_request_program_private(req) (((rpcsvc_program_t *)((req)->conn->program))->private) -#define rpcsvc_request_conn(req) (req)->conn -#define rpcsvc_request_accepted(req) ((req)->rpc_stat == MSG_ACCEPTED) -#define rpcsvc_request_accepted_success(req) ((req)->rpc_err == SUCCESS) -#define rpcsvc_request_uid(req) ((req)->uid) -#define rpcsvc_request_gid(req) ((req)->gid) -#define rpcsvc_stage_service(stg) ((rpcsvc_t *)((stg)->svc)) -#define rpcsvc_conn_stage(conn) ((conn)->stage) -#define rpcsvc_request_service(req) (rpcsvc_stage_service(rpcsvc_conn_stage(rpcsvc_request_conn(req)))) -#define rpcsvc_request_prog_minauth(req) (rpcsvc_request_program(req)->min_auth) -#define rpcsvc_request_cred_flavour(req) (rpcsvc_auth_flavour(req->cred)) -#define rpcsvc_request_verf_flavour(req) (rpcsvc_auth_flavour(req->verf)) - -#define rpcsvc_request_uid(req) ((req)->uid) -#define rpcsvc_request_gid(req) ((req)->gid) -#define rpcsvc_request_private(req) ((req)->private) -#define rpcsvc_request_xid(req) ((req)->xid) -#define rpcsvc_request_set_private(req,prv) (req)->private = (void *)(prv) -#define rpcsvc_request_record_iob(rq) ((rq)->recordiob) -#define rpcsvc_request_record_ref(req) (iobuf_ref ((req)->recordiob)) -#define rpcsvc_request_record_unref(req) (iobuf_unref ((req)->recordiob)) +#define nfs_rpcsvc_request_program(req) ((rpcsvc_program_t *)((req)->conn->program)) +#define nfs_rpcsvc_request_program_private(req) (((rpcsvc_program_t *)((req)->conn->program))->private) +#define nfs_rpcsvc_request_conn(req) (req)->conn +#define nfs_rpcsvc_request_accepted(req) ((req)->rpc_stat == MSG_ACCEPTED) +#define nfs_rpcsvc_request_accepted_success(req) ((req)->rpc_err == SUCCESS) +#define nfs_rpcsvc_request_uid(req) ((req)->uid) +#define nfs_rpcsvc_request_gid(req) ((req)->gid) +#define nfs_rpcsvc_stage_service(stg) ((rpcsvc_t *)((stg)->svc)) +#define nfs_rpcsvc_conn_stage(conn) ((conn)->stage) +#define nfs_rpcsvc_request_service(req) (nfs_rpcsvc_stage_service(nfs_rpcsvc_conn_stage(nfs_rpcsvc_request_conn(req)))) +#define nfs_rpcsvc_request_prog_minauth(req) (nfs_rpcsvc_request_program(req)->min_auth) +#define nfs_rpcsvc_request_cred_flavour(req) (nfs_rpcsvc_auth_flavour(req->cred)) +#define nfs_rpcsvc_request_verf_flavour(req) (nfs_rpcsvc_auth_flavour(req->verf)) + +#define nfs_rpcsvc_request_uid(req) ((req)->uid) +#define nfs_rpcsvc_request_gid(req) ((req)->gid) +#define nfs_rpcsvc_request_private(req) ((req)->private) +#define nfs_rpcsvc_request_xid(req) ((req)->xid) +#define nfs_rpcsvc_request_set_private(req,prv) (req)->private = (void *)(prv) +#define nfs_rpcsvc_request_record_iob(rq) ((rq)->recordiob) +#define nfs_rpcsvc_request_record_ref(req) (iobuf_ref ((req)->recordiob)) +#define nfs_rpcsvc_request_record_unref(req) (iobuf_unref ((req)->recordiob)) #define RPCSVC_ACTOR_SUCCESS 0 @@ -533,34 +533,34 @@ typedef struct rpc_svc_state { * procedure handlers. */ extern int -rpcsvc_program_register (rpcsvc_t *svc, rpcsvc_program_t program); +nfs_rpcsvc_program_register (rpcsvc_t *svc, rpcsvc_program_t program); extern int -rpcsvc_program_unregister (rpcsvc_t *svc, rpcsvc_program_t program); +nfs_rpcsvc_program_unregister (rpcsvc_t *svc, rpcsvc_program_t program); /* Inits the global RPC service data structures. * Called in main. */ extern rpcsvc_t * -rpcsvc_init (glusterfs_ctx_t *ctx, dict_t *options); +nfs_rpcsvc_init (glusterfs_ctx_t *ctx, dict_t *options); extern int -rpcsvc_submit_message (rpcsvc_request_t * req, struct iovec msg, - struct iobuf *iob); +nfs_rpcsvc_submit_message (rpcsvc_request_t * req, struct iovec msg, + struct iobuf *iob); int -rpcsvc_submit_generic (rpcsvc_request_t *req, struct iovec msgvec, - struct iobuf *msg); -#define rpcsvc_record_currentfrag_addr(rs) ((rs)->fragcurrent) -#define rpcsvc_record_currenthdr_addr(rs) ((rs)->hdrcurrent) +nfs_rpcsvc_submit_generic (rpcsvc_request_t *req, struct iovec msgvec, + struct iobuf *msg); +#define nfs_rpcsvc_record_currentfrag_addr(rs) ((rs)->fragcurrent) +#define nfs_rpcsvc_record_currenthdr_addr(rs) ((rs)->hdrcurrent) -#define rpcsvc_record_update_currentfrag(rs, size) \ +#define nfs_rpcsvc_record_update_currentfrag(rs, size) \ do { \ (rs)->fragcurrent += size; \ } while (0) \ -#define rpcsvc_record_update_currenthdr(rs, size) \ +#define nfs_rpcsvc_record_update_currenthdr(rs, size) \ do { \ (rs)->hdrcurrent += size; \ } while (0) \ @@ -616,7 +616,7 @@ typedef struct rpcsvc_txbuf { } rpcsvc_txbuf_t; extern int -rpcsvc_error_reply (rpcsvc_request_t *req); +nfs_rpcsvc_error_reply (rpcsvc_request_t *req); #define RPCSVC_PEER_STRLEN 1024 #define RPCSVC_AUTH_ACCEPT 1 @@ -624,33 +624,36 @@ rpcsvc_error_reply (rpcsvc_request_t *req); #define RPCSVC_AUTH_DONTCARE 3 extern int -rpcsvc_conn_peername (rpcsvc_conn_t *conn, char *hostname, int hostlen); +nfs_rpcsvc_conn_peername (rpcsvc_conn_t *conn, char *hostname, int hostlen); extern int -rpcsvc_conn_peeraddr (rpcsvc_conn_t *conn, char *addrstr, int addrlen, - struct sockaddr *returnsa, socklen_t sasize); +nfs_rpcsvc_conn_peeraddr (rpcsvc_conn_t *conn, char *addrstr, int addrlen, + struct sockaddr *returnsa, socklen_t sasize); extern int -rpcsvc_conn_peer_check (dict_t *options, char *volname, rpcsvc_conn_t *conn); +nfs_rpcsvc_conn_peer_check (dict_t *options, char *volname,rpcsvc_conn_t *conn); extern int -rpcsvc_conn_privport_check (rpcsvc_t *svc, char *volname, rpcsvc_conn_t *conn); -#define rpcsvc_request_seterr(req, err) (req)->rpc_err = err -#define rpcsvc_request_set_autherr(req, err) (req)->auth_err = err +nfs_rpcsvc_conn_privport_check (rpcsvc_t *svc, char *volname, + rpcsvc_conn_t *conn); +#define nfs_rpcsvc_request_seterr(req, err) (req)->rpc_err = err +#define nfs_rpcsvc_request_set_autherr(req, err) (req)->auth_err = err extern void -rpcsvc_conn_deinit (rpcsvc_conn_t *conn); -extern void rpcsvc_conn_ref (rpcsvc_conn_t *conn); -extern void rpcsvc_conn_unref (rpcsvc_conn_t *conn); +nfs_rpcsvc_conn_deinit (rpcsvc_conn_t *conn); +extern void nfs_rpcsvc_conn_ref (rpcsvc_conn_t *conn); +extern void nfs_rpcsvc_conn_unref (rpcsvc_conn_t *conn); -extern int rpcsvc_submit_vectors (rpcsvc_request_t *req); +extern int nfs_rpcsvc_submit_vectors (rpcsvc_request_t *req); -extern int rpcsvc_request_attach_vector (rpcsvc_request_t *req, - struct iovec msgvec, struct iobuf *iob, - struct iobref *ioref, int finalvector); +extern int nfs_rpcsvc_request_attach_vector (rpcsvc_request_t *req, + struct iovec msgvec, + struct iobuf *iob, + struct iobref *ioref, + int finalvector); extern int -rpcsvc_request_attach_vectors (rpcsvc_request_t *req, struct iovec *payload, - int vcount, struct iobref *piobref); +nfs_rpcsvc_request_attach_vectors (rpcsvc_request_t *req, struct iovec *payload, + int vcount, struct iobref *piobref); typedef int (*auth_init_conn) (rpcsvc_conn_t *conn, void *priv); typedef int (*auth_init_request) (rpcsvc_request_t *req, void *priv); @@ -691,19 +694,19 @@ struct rpcsvc_auth_list { }; extern int -rpcsvc_auth_request_init (rpcsvc_request_t *req); +nfs_rpcsvc_auth_request_init (rpcsvc_request_t *req); extern int -rpcsvc_auth_init (rpcsvc_t *svc, dict_t *options); +nfs_rpcsvc_auth_init (rpcsvc_t *svc, dict_t *options); extern int -rpcsvc_auth_conn_init (rpcsvc_conn_t *conn); +nfs_rpcsvc_auth_conn_init (rpcsvc_conn_t *conn); extern int -rpcsvc_authenticate (rpcsvc_request_t *req); +nfs_rpcsvc_authenticate (rpcsvc_request_t *req); extern int -rpcsvc_auth_array (rpcsvc_t *svc, char *volname, int *autharr, int arrlen); +nfs_rpcsvc_auth_array (rpcsvc_t *svc, char *volname, int *autharr, int arrlen); /* If the request has been sent using AUTH_UNIX, this function returns the * auxiliary gids as an array, otherwise, it returns NULL. @@ -711,11 +714,11 @@ rpcsvc_auth_array (rpcsvc_t *svc, char *volname, int *autharr, int arrlen); * authentication code even further to support mode auth schemes. */ extern gid_t * -rpcsvc_auth_unix_auxgids (rpcsvc_request_t *req, int *arrlen); +nfs_rpcsvc_auth_unix_auxgids (rpcsvc_request_t *req, int *arrlen); extern int -rpcsvc_combine_gen_spec_volume_checks (int gen, int spec); +nfs_rpcsvc_combine_gen_spec_volume_checks (int gen, int spec); extern char * -rpcsvc_volume_allowed (dict_t *options, char *volname); +nfs_rpcsvc_volume_allowed (dict_t *options, char *volname); #endif diff --git a/xlators/nfs/lib/src/xdr-common.h b/xlators/nfs/lib/src/xdr-common.h index 50a57ade932..0f60cd2c962 100644 --- a/xlators/nfs/lib/src/xdr-common.h +++ b/xlators/nfs/lib/src/xdr-common.h @@ -17,8 +17,8 @@ <http://www.gnu.org/licenses/>. */ -#ifndef _XDR_COMMON_H_ -#define _XDR_COMMON_H_ +#ifndef _NFS_XDR_COMMON_H_ +#define _NFS_XDR_COMMON_H_ #ifndef _CONFIG_H #define _CONFIG_H @@ -26,23 +26,23 @@ #endif #include <rpc/rpc.h> -#define XDR_BYTES_PER_UNIT 4 +#define NFS_XDR_BYTES_PER_UNIT 4 /* Returns the address of the byte that follows the * last byte used for decoding the previous xdr component. * For eg, once the RPC call for NFS has been decoded, thie macro will return * the address from which the NFS header starts. */ -#define xdr_decoded_remaining_addr(xdr) ((&xdr)->x_private) +#define nfs_xdr_decoded_remaining_addr(xdr) ((&xdr)->x_private) /* Returns the length of the remaining record after the previous decode * operation completed. */ -#define xdr_decoded_remaining_len(xdr) ((&xdr)->x_handy) +#define nfs_xdr_decoded_remaining_len(xdr) ((&xdr)->x_handy) /* Returns the number of bytes used by the last encode operation. */ -#define xdr_encoded_length(xdr) (((size_t)(&xdr)->x_private) - ((size_t)(&xdr)->x_base)) +#define nfs_xdr_encoded_length(xdr) (((size_t)(&xdr)->x_private) - ((size_t)(&xdr)->x_base)) -#define xdr_decoded_length(xdr) (((size_t)(&xdr)->x_private) - ((size_t)(&xdr)->x_base)) +#define nfs_xdr_decoded_length(xdr) (((size_t)(&xdr)->x_private) - ((size_t)(&xdr)->x_base)) #endif diff --git a/xlators/nfs/lib/src/xdr-rpc.c b/xlators/nfs/lib/src/xdr-rpc.c index 071462242b1..b61b4db1fd0 100644 --- a/xlators/nfs/lib/src/xdr-rpc.c +++ b/xlators/nfs/lib/src/xdr-rpc.c @@ -39,8 +39,8 @@ * The remaining payload is returned into payload. */ int -xdr_to_rpc_call (char *msgbuf, size_t len, struct rpc_msg *call, - struct iovec *payload, char *credbytes, char *verfbytes) +nfs_xdr_to_rpc_call (char *msgbuf, size_t len, struct rpc_msg *call, + struct iovec *payload, char *credbytes, char *verfbytes) { XDR xdr; char opaquebytes[MAX_AUTH_BYTES]; @@ -68,8 +68,8 @@ xdr_to_rpc_call (char *msgbuf, size_t len, struct rpc_msg *call, return -1; if (payload) { - payload->iov_base = xdr_decoded_remaining_addr (xdr); - payload->iov_len = xdr_decoded_remaining_len (xdr); + payload->iov_base = nfs_xdr_decoded_remaining_addr (xdr); + payload->iov_len = nfs_xdr_decoded_remaining_len (xdr); } return 0; @@ -77,14 +77,14 @@ xdr_to_rpc_call (char *msgbuf, size_t len, struct rpc_msg *call, bool_t -true_func (XDR *s, caddr_t *a) +nfs_true_func (XDR *s, caddr_t *a) { return TRUE; } int -rpc_fill_empty_reply (struct rpc_msg *reply, uint32_t xid) +nfs_rpc_fill_empty_reply (struct rpc_msg *reply, uint32_t xid) { if (!reply) return -1; @@ -100,7 +100,7 @@ rpc_fill_empty_reply (struct rpc_msg *reply, uint32_t xid) } int -rpc_fill_denied_reply (struct rpc_msg *reply, int rjstat, int auth_err) +nfs_rpc_fill_denied_reply (struct rpc_msg *reply, int rjstat, int auth_err) { if (!reply) return -1; @@ -122,8 +122,8 @@ rpc_fill_denied_reply (struct rpc_msg *reply, int rjstat, int auth_err) int -rpc_fill_accepted_reply (struct rpc_msg *reply, int arstat, int proglow, - int proghigh, int verf, int len, char *vdata) +nfs_rpc_fill_accepted_reply (struct rpc_msg *reply, int arstat, int proglow, + int proghigh, int verf, int len, char *vdata) { if (!reply) return -1; @@ -142,7 +142,7 @@ rpc_fill_accepted_reply (struct rpc_msg *reply, int arstat, int proglow, /* This is a hack. I'd really like to build a custom * XDR library because Sun RPC interface is not very flexible. */ - reply->acpted_rply.ar_results.proc = (xdrproc_t)true_func; + reply->acpted_rply.ar_results.proc = (xdrproc_t)nfs_true_func; reply->acpted_rply.ar_results.where = NULL; } @@ -150,8 +150,8 @@ rpc_fill_accepted_reply (struct rpc_msg *reply, int arstat, int proglow, } int -rpc_reply_to_xdr (struct rpc_msg *reply, char *dest, size_t len, - struct iovec *dst) +nfs_rpc_reply_to_xdr (struct rpc_msg *reply, char *dest, size_t len, + struct iovec *dst) { XDR xdr; @@ -163,15 +163,15 @@ rpc_reply_to_xdr (struct rpc_msg *reply, char *dest, size_t len, return -1; dst->iov_base = dest; - dst->iov_len = xdr_encoded_length (xdr); + dst->iov_len = nfs_xdr_encoded_length (xdr); return 0; } int -xdr_to_auth_unix_cred (char *msgbuf, int msglen, struct authunix_parms *au, - char *machname, gid_t *gids) +nfs_xdr_to_auth_unix_cred (char *msgbuf, int msglen, struct authunix_parms *au, + char *machname, gid_t *gids) { XDR xdr; @@ -194,13 +194,13 @@ xdr_to_auth_unix_cred (char *msgbuf, int msglen, struct authunix_parms *au, } ssize_t -xdr_length_round_up (size_t len, size_t bufsize) +nfs_xdr_length_round_up (size_t len, size_t bufsize) { int roundup = 0; - roundup = len % XDR_BYTES_PER_UNIT; + roundup = len % NFS_XDR_BYTES_PER_UNIT; if (roundup > 0) - roundup = XDR_BYTES_PER_UNIT - roundup; + roundup = NFS_XDR_BYTES_PER_UNIT - roundup; if ((roundup > 0) && ((roundup + len) <= bufsize)) len += roundup; @@ -209,18 +209,18 @@ xdr_length_round_up (size_t len, size_t bufsize) } int -xdr_bytes_round_up (struct iovec *vec, size_t bufsize) +nfs_xdr_bytes_round_up (struct iovec *vec, size_t bufsize) { - vec->iov_len = xdr_length_round_up (vec->iov_len, bufsize); + vec->iov_len = nfs_xdr_length_round_up (vec->iov_len, bufsize); return 0; } void -xdr_vector_round_up (struct iovec *vec, int vcount, uint32_t count) +nfs_xdr_vector_round_up (struct iovec *vec, int vcount, uint32_t count) { uint32_t round_count = 0; - round_count = xdr_length_round_up (count, 1048576); + round_count = nfs_xdr_length_round_up (count, 1048576); round_count -= count; if (round_count == 0) return; diff --git a/xlators/nfs/lib/src/xdr-rpc.h b/xlators/nfs/lib/src/xdr-rpc.h index 48acdaa4399..f8dbd33b75b 100644 --- a/xlators/nfs/lib/src/xdr-rpc.h +++ b/xlators/nfs/lib/src/xdr-rpc.h @@ -17,8 +17,8 @@ <http://www.gnu.org/licenses/>. */ -#ifndef _XDR_RPC_H -#define _XDR_RPC_H_ +#ifndef _NFS_XDR_RPC_H +#define _NFS_XDR_RPC_H_ #ifndef _CONFIG_H #define _CONFIG_H @@ -35,48 +35,48 @@ * that contains everything an RPC call needs to work. */ extern int -xdr_to_rpc_call (char *msgbuf, size_t len, struct rpc_msg *call, - struct iovec *payload, char *credbytes, char *verfbytes); +nfs_xdr_to_rpc_call (char *msgbuf, size_t len, struct rpc_msg *call, + struct iovec *payload, char *credbytes, char *verfbytes); extern int -rpc_fill_empty_reply (struct rpc_msg *reply, uint32_t xid); +nfs_rpc_fill_empty_reply (struct rpc_msg *reply, uint32_t xid); extern int -rpc_fill_denied_reply (struct rpc_msg *reply, int rjstat, int auth_err); +nfs_rpc_fill_denied_reply (struct rpc_msg *reply, int rjstat, int auth_err); extern int -rpc_fill_accepted_reply (struct rpc_msg *reply, int arstat, int proglow, - int proghigh, int verf, int len, char *vdata); +nfs_rpc_fill_accepted_reply (struct rpc_msg *reply, int arstat, int proglow, + int proghigh, int verf, int len, char *vdata); extern int -rpc_reply_to_xdr (struct rpc_msg *reply, char *dest, size_t len, - struct iovec *dst); +nfs_rpc_reply_to_xdr (struct rpc_msg *reply, char *dest, size_t len, + struct iovec *dst); extern int -xdr_to_auth_unix_cred (char *msgbuf, int msglen, struct authunix_parms *au, - char *machname, gid_t *gids); +nfs_xdr_to_auth_unix_cred (char *msgbuf, int msglen, struct authunix_parms *au, + char *machname, gid_t *gids); /* Macros that simplify accesing the members of an RPC call structure. */ -#define rpc_call_xid(call) ((call)->rm_xid) -#define rpc_call_direction(call) ((call)->rm_direction) -#define rpc_call_rpcvers(call) ((call)->ru.RM_cmb.cb_rpcvers) -#define rpc_call_program(call) ((call)->ru.RM_cmb.cb_prog) -#define rpc_call_progver(call) ((call)->ru.RM_cmb.cb_vers) -#define rpc_call_progproc(call) ((call)->ru.RM_cmb.cb_proc) -#define rpc_opaque_auth_flavour(oa) ((oa)->oa_flavor) -#define rpc_opaque_auth_len(oa) ((oa)->oa_length) +#define nfs_rpc_call_xid(call) ((call)->rm_xid) +#define nfs_rpc_call_direction(call) ((call)->rm_direction) +#define nfs_rpc_call_rpcvers(call) ((call)->ru.RM_cmb.cb_rpcvers) +#define nfs_rpc_call_program(call) ((call)->ru.RM_cmb.cb_prog) +#define nfs_rpc_call_progver(call) ((call)->ru.RM_cmb.cb_vers) +#define nfs_rpc_call_progproc(call) ((call)->ru.RM_cmb.cb_proc) +#define nfs_rpc_opaque_auth_flavour(oa) ((oa)->oa_flavor) +#define nfs_rpc_opaque_auth_len(oa) ((oa)->oa_length) -#define rpc_call_cred_flavour(call) (rpc_opaque_auth_flavour ((&(call)->ru.RM_cmb.cb_cred))) -#define rpc_call_cred_len(call) (rpc_opaque_auth_len ((&(call)->ru.RM_cmb.cb_cred))) +#define nfs_rpc_call_cred_flavour(call) (nfs_rpc_opaque_auth_flavour ((&(call)->ru.RM_cmb.cb_cred))) +#define nfs_rpc_call_cred_len(call) (nfs_rpc_opaque_auth_len ((&(call)->ru.RM_cmb.cb_cred))) -#define rpc_call_verf_flavour(call) (rpc_opaque_auth_flavour ((&(call)->ru.RM_cmb.cb_verf))) -#define rpc_call_verf_len(call) (rpc_opaque_auth_len ((&(call)->ru.RM_cmb.cb_verf))) +#define nfs_rpc_call_verf_flavour(call) (nfs_rpc_opaque_auth_flavour ((&(call)->ru.RM_cmb.cb_verf))) +#define nfs_rpc_call_verf_len(call) (nfs_rpc_opaque_auth_len ((&(call)->ru.RM_cmb.cb_verf))) extern int -xdr_bytes_round_up (struct iovec *vec, size_t bufsize); +nfs_xdr_bytes_round_up (struct iovec *vec, size_t bufsize); extern ssize_t -xdr_length_round_up (size_t len, size_t bufsize); +nfs_xdr_length_round_up (size_t len, size_t bufsize); void -xdr_vector_round_up (struct iovec *vec, int vcount, uint32_t count); +nfs_xdr_vector_round_up (struct iovec *vec, int vcount, uint32_t count); #endif diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c index b943d1290c3..97f713a757e 100644 --- a/xlators/nfs/server/src/mount3.c +++ b/xlators/nfs/server/src/mount3.c @@ -58,7 +58,7 @@ mnt3svc_submit_reply (rpcsvc_request_t *req, void *arg, mnt3_serializer sfunc) if (!req) return -1; - ms = (struct mount3_state *)rpcsvc_request_program_private (req); + ms = (struct mount3_state *)nfs_rpcsvc_request_program_private (req); if (!ms) { gf_log (GF_MNT, GF_LOG_ERROR, "mount state not found"); goto ret; @@ -80,7 +80,7 @@ mnt3svc_submit_reply (rpcsvc_request_t *req, void *arg, mnt3_serializer sfunc) outmsg.iov_len = sfunc (outmsg, arg); /* Then, submit the message for transmission. */ - ret = rpcsvc_submit_message (req, outmsg, iob); + ret = nfs_rpcsvc_submit_message (req, outmsg, iob); iobuf_unref (iob); if (ret == -1) { gf_log (GF_MNT, GF_LOG_ERROR, "Reply submission failed"); @@ -183,7 +183,8 @@ mnt3svc_update_mountlist (struct mount3_state *ms, rpcsvc_request_t *req, if ((!ms) || (!req) || (!expname)) return -1; - me = (struct mountentry *)GF_CALLOC (1, sizeof (*me), gf_nfs_mt_mountentry); + me = (struct mountentry *)GF_CALLOC (1, sizeof (*me), + gf_nfs_mt_mountentry); if (!me) return -1; @@ -192,7 +193,7 @@ mnt3svc_update_mountlist (struct mount3_state *ms, rpcsvc_request_t *req, /* Must get the IP or hostname of the client so we * can map it into the mount entry. */ - ret = rpcsvc_conn_peername (req->conn, me->hostname, MNTPATHLEN); + ret = nfs_rpcsvc_conn_peername (req->conn, me->hostname, MNTPATHLEN); if (ret == -1) goto free_err; @@ -230,7 +231,7 @@ mnt3svc_lookup_mount_cbk (call_frame_t *frame, void *cookie, if (!req) return -1; - ms = (struct mount3_state *)rpcsvc_request_program_private (req); + ms = (struct mount3_state *)nfs_rpcsvc_request_program_private (req); if (!ms) { gf_log (GF_MNT, GF_LOG_ERROR, "mount state not found"); op_ret = -1; @@ -248,8 +249,9 @@ mnt3svc_lookup_mount_cbk (call_frame_t *frame, void *cookie, xmit_res: gf_log (GF_MNT, GF_LOG_DEBUG, "Mount reply status: %d", status); if (op_ret == 0) { - svc = rpcsvc_request_service (req); - autharrlen = rpcsvc_auth_array (svc, this->name, autharr, 10); + svc = nfs_rpcsvc_request_service (req); + autharrlen = nfs_rpcsvc_auth_array (svc, this->name, autharr, + 10); } res = mnt3svc_set_mountres3 (status, &fh, autharr, autharrlen); @@ -506,8 +508,9 @@ err: if (op_ret == -1) { gf_log (GF_MNT, GF_LOG_DEBUG, "Mount reply status: %d", mntstat); - svc = rpcsvc_request_service (mres->req); - autharrlen = rpcsvc_auth_array (svc, this->name, autharr, 10); + svc = nfs_rpcsvc_request_service (mres->req); + autharrlen = nfs_rpcsvc_auth_array (svc, this->name, autharr, + 10); res = mnt3svc_set_mountres3 (mntstat, &fh, autharr, autharrlen); mnt3svc_submit_reply (mres->req, (void *)&res, @@ -661,16 +664,16 @@ mnt3_check_client_net (struct mount3_state *ms, rpcsvc_request_t *req, if ((!ms) || (!req) || (!targetxl)) return -1; - svc = rpcsvc_request_service (req); - ret = rpcsvc_conn_peer_check (svc->options, targetxl->name, - rpcsvc_request_conn (req)); + svc = nfs_rpcsvc_request_service (req); + ret = nfs_rpcsvc_conn_peer_check (svc->options, targetxl->name, + nfs_rpcsvc_request_conn (req)); if (ret == RPCSVC_AUTH_REJECT) { gf_log (GF_MNT, GF_LOG_TRACE, "Peer not allowed"); goto err; } - ret = rpcsvc_conn_privport_check (svc, targetxl->name, - rpcsvc_request_conn (req)); + ret = nfs_rpcsvc_conn_privport_check (svc, targetxl->name, + nfs_rpcsvc_request_conn (req)); if (ret == RPCSVC_AUTH_REJECT) { gf_log (GF_MNT, GF_LOG_TRACE, "Unprivileged port not allowed"); goto err; @@ -700,14 +703,14 @@ mnt3svc_mnt (rpcsvc_request_t *req) ret = xdr_to_mountpath (pvec, req->msg); if (ret == -1) { gf_log (GF_MNT, GF_LOG_ERROR, "Failed to decode args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } - ms = (struct mount3_state *)rpcsvc_request_program_private (req); + ms = (struct mount3_state *)nfs_rpcsvc_request_program_private (req); if (!ms) { gf_log (GF_MNT, GF_LOG_ERROR, "Mount state not present"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = -1; goto rpcerr; } @@ -753,7 +756,7 @@ mnt3svc_null (rpcsvc_request_t *req) return 0; } - rpcsvc_submit_generic (req, dummyvec, NULL); + nfs_rpcsvc_submit_generic (req, dummyvec, NULL); return 0; } @@ -859,9 +862,9 @@ mnt3svc_dump (rpcsvc_request_t *req) if (!req) return -1; - ms = (struct mount3_state *)rpcsvc_request_program_private (req); + ms = (struct mount3_state *)nfs_rpcsvc_request_program_private (req); if (!ms) { - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); goto rpcerr; } @@ -871,7 +874,7 @@ mnt3svc_dump (rpcsvc_request_t *req) sfunc = (mnt3_serializer)xdr_serialize_mountlist; if (!mlist) { if (ret != 0) { - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = -1; goto rpcerr; } else { @@ -975,19 +978,19 @@ mnt3svc_umnt (rpcsvc_request_t *req) ret = xdr_to_mountpath (pvec, req->msg);; if (ret == -1) { gf_log (GF_MNT, GF_LOG_ERROR, "Failed decode args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } - ms = (struct mount3_state *)rpcsvc_request_program_private (req); + ms = (struct mount3_state *)nfs_rpcsvc_request_program_private (req); if (!ms) { gf_log (GF_MNT, GF_LOG_ERROR, "Mount state not present"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = -1; goto rpcerr; } - ret = rpcsvc_conn_peername (req->conn, hostname, MNTPATHLEN); + ret = nfs_rpcsvc_conn_peername (req->conn, hostname, MNTPATHLEN); if (ret != 0) { gf_log (GF_MNT, GF_LOG_ERROR, "Failed to get remote name: %s", gai_strerror (ret)); @@ -1004,13 +1007,13 @@ mnt3svc_umnt (rpcsvc_request_t *req) try_umount_with_addr: if (ret != 0) - ret = rpcsvc_conn_peeraddr (req->conn, hostname, MNTPATHLEN, - NULL, 0); + ret = nfs_rpcsvc_conn_peeraddr (req->conn, hostname, MNTPATHLEN, + NULL, 0); if (ret != 0) { gf_log (GF_MNT, GF_LOG_ERROR, "Failed to get remote addr: %s", gai_strerror (ret)); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); goto rpcerr; } @@ -1074,10 +1077,10 @@ mnt3svc_umntall (rpcsvc_request_t *req) if (!req) return -1; - ms = (struct mount3_state *)rpcsvc_request_program_private (req); + ms = (struct mount3_state *)nfs_rpcsvc_request_program_private (req); if (!ms) { gf_log (GF_MNT, GF_LOG_ERROR, "Mount state not present"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = -1; goto rpcerr; } @@ -1124,7 +1127,8 @@ mnt3_xlchildren_to_exports (rpcsvc_t *svc, struct mount3_state *ms) strcpy (elist->ex_dir, ent->expname); - addrstr = rpcsvc_volume_allowed (svc->options, ent->vol->name); + addrstr = nfs_rpcsvc_volume_allowed (svc->options, + ent->vol->name); if (addrstr) addrstr = gf_strdup (addrstr); else @@ -1171,18 +1175,19 @@ mnt3svc_export (rpcsvc_request_t *req) if (!req) return -1; - ms = (struct mount3_state *)rpcsvc_request_program_private (req); + ms = (struct mount3_state *)nfs_rpcsvc_request_program_private (req); if (!ms) { gf_log (GF_MNT, GF_LOG_ERROR, "mount state not found"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); goto err; } /* Using the children translator names, build the export list */ - elist = mnt3_xlchildren_to_exports (rpcsvc_request_service (req), ms); + elist = mnt3_xlchildren_to_exports (nfs_rpcsvc_request_service (req), + ms); if (!elist) { gf_log (GF_MNT, GF_LOG_ERROR, "Failed to build exports list"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); goto err; } diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index d7d2a5fd6e2..c74691cceac 100644 --- a/xlators/nfs/server/src/nfs.c +++ b/xlators/nfs/server/src/nfs.c @@ -81,7 +81,7 @@ nfs_deinit_versions (struct list_head *versions, xlator_t *this) version->deinit (this); */ if (version->program) - rpcsvc_program_unregister (nfs->rpcsvc, + nfs_rpcsvc_program_unregister (nfs->rpcsvc, *(version->program)); list_del (&version->list); @@ -121,7 +121,7 @@ nfs_init_versions (struct nfs_state *nfs, xlator_t *this) gf_log (GF_NFS, GF_LOG_DEBUG, "Starting program: %s", prog->progname); - ret = rpcsvc_program_register (nfs->rpcsvc, *prog); + ret = nfs_rpcsvc_program_register (nfs->rpcsvc, *prog); if (ret == -1) { gf_log (GF_NFS, GF_LOG_ERROR, "Program init failed"); goto err; @@ -430,9 +430,9 @@ nfs_request_user_init (nfs_user_t *nfu, rpcsvc_request_t *req) if ((!req) || (!nfu)) return; - gidarr = rpcsvc_auth_unix_auxgids (req, &gids); - nfs_user_create (nfu, rpcsvc_request_uid (req), rpcsvc_request_gid (req) - , gidarr, gids); + gidarr = nfs_rpcsvc_auth_unix_auxgids (req, &gids); + nfs_user_create (nfu, nfs_rpcsvc_request_uid (req), + nfs_rpcsvc_request_gid (req), gidarr, gids); return; } @@ -479,7 +479,7 @@ init (xlator_t *this) { } /* RPC service needs to be started before NFS versions can be inited. */ - nfs->rpcsvc = rpcsvc_init (this->ctx, this->options); + nfs->rpcsvc = nfs_rpcsvc_init (this->ctx, this->options); if (!nfs->rpcsvc) { gf_log (GF_NFS, GF_LOG_ERROR, "RPC service init failed"); goto free_nfs; diff --git a/xlators/nfs/server/src/nfs3-helpers.c b/xlators/nfs/server/src/nfs3-helpers.c index d41bd1815ce..35f5853255e 100644 --- a/xlators/nfs/server/src/nfs3-helpers.c +++ b/xlators/nfs/server/src/nfs3-helpers.c @@ -2020,7 +2020,7 @@ nfs3_file_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, fd->refcount); } - nfs3 = rpcsvc_request_program_private (cs->req); + nfs3 = nfs_rpcsvc_request_program_private (cs->req); nfs3_flush_open_wait_call_states (cs, fd); nfs3_fdcache_add (nfs3, fd); return 0; diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c index 812bb8372a2..7aadcae3efb 100644 --- a/xlators/nfs/server/src/nfs3.c +++ b/xlators/nfs/server/src/nfs3.c @@ -57,7 +57,7 @@ #define nfs3_validate_nfs3_state(request, state, status, label, retval) \ do { \ - state = rpcsvc_request_program_private (request); \ + state = nfs_rpcsvc_request_program_private (request); \ if (!nfs3) { \ gf_log (GF_NFS3, GF_LOG_ERROR, "NFSv3 state " \ "missing from RPC request"); \ @@ -91,7 +91,7 @@ } else { \ gf_log (GF_NFS3, GF_LOG_TRACE, "FH to Volume: %s"\ ,volume->name); \ - rpcsvc_request_set_private (req, volume); \ + nfs_rpcsvc_request_set_private (req, volume); \ } \ } while (0); \ @@ -246,7 +246,7 @@ nfs3_serialize_reply (rpcsvc_request_t *req, void *arg, nfs3_serializer sfunc, struct iobuf *iob = NULL; ssize_t retlen = -1; - nfs3 = (struct nfs3_state *)rpcsvc_request_program_private (req); + nfs3 = (struct nfs3_state *)nfs_rpcsvc_request_program_private (req); if (!nfs3) { gf_log (GF_NFS3, GF_LOG_ERROR, "NFSv3 state not found in RPC" " request"); @@ -305,7 +305,7 @@ nfs3svc_submit_reply (rpcsvc_request_t *req, void *arg, nfs3_serializer sfunc) } /* Then, submit the message for transmission. */ - ret = rpcsvc_submit_message (req, outmsg, iob); + ret = nfs_rpcsvc_submit_message (req, outmsg, iob); /* Now that we've done our job of handing the message to the RPC layer * we can safely unref the iob in the hope that RPC layer must have @@ -341,16 +341,16 @@ nfs3svc_submit_vector_reply (rpcsvc_request_t *req, void *arg, goto err; } - ret = rpcsvc_request_attach_vector (req, outmsg, iob, NULL, 0); + ret = nfs_rpcsvc_request_attach_vector (req, outmsg, iob, NULL, 0); iobuf_unref (iob); if (piobref) - ret = rpcsvc_request_attach_vectors (req, payload, vcount, + ret = nfs_rpcsvc_request_attach_vectors (req, payload, vcount, piobref); if (ret == -1) goto err; - ret = rpcsvc_submit_vectors (req); + ret = nfs_rpcsvc_submit_vectors (req); err: return ret; @@ -366,8 +366,8 @@ nfs3_request_xlator_id (rpcsvc_request_t *rq) if (!rq) return 0; - xl = rpcsvc_request_private (rq); - nfs3 = rpcsvc_request_program_private (rq); + xl = nfs_rpcsvc_request_private (rq); + nfs3 = nfs_rpcsvc_request_program_private (rq); return nfs_xlator_to_xlid (nfs3->exportslist, xl); } @@ -379,7 +379,7 @@ nfs3svc_null (rpcsvc_request_t *req) if (!req) return RPCSVC_ACTOR_ERROR; - rpcsvc_submit_generic (req, dummyvec, NULL); + nfs_rpcsvc_submit_generic (req, dummyvec, NULL); return RPCSVC_ACTOR_SUCCESS; } @@ -415,8 +415,8 @@ nfs3svc_getattr_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1) status = nfs3_errno_to_nfsstat3 (op_errno); - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "GETATTR", status, - op_errno); + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "GETATTR", + status, op_errno); nfs3_getattr_reply (cs->req, status, buf); nfs3_call_state_wipe (cs); @@ -439,8 +439,8 @@ nfs3svc_getattr_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1) status = nfs3_errno_to_nfsstat3 (op_errno); - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "GETATTR", status, - op_errno); + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "GETATTR", + status, op_errno); nfs3_getattr_reply (cs->req, status, buf); nfs3_call_state_wipe (cs); @@ -484,8 +484,8 @@ nfs3_getattr_resume (void *carg) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "GETATTR", - stat, -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), + "GETATTR", stat, -ret); nfs3_getattr_reply (cs->req, stat, NULL); nfs3_call_state_wipe (cs); ret = 0; @@ -507,7 +507,7 @@ nfs3_getattr (rpcsvc_request_t *req, struct nfs3_fh *fh) if ((!req) || (!fh)) return -1; - nfs3_log_common_call (rpcsvc_request_xid (req), "GETATTR", fh); + nfs3_log_common_call (nfs_rpcsvc_request_xid (req), "GETATTR", fh); nfs3_validate_gluster_fh (fh, stat, nfs3err); nfs3_validate_nfs3_state (req, nfs3, stat, nfs3err, ret); nfs3_map_fh_to_volume (nfs3, fh, req, vol, stat, nfs3err); @@ -519,8 +519,8 @@ nfs3_getattr (rpcsvc_request_t *req, struct nfs3_fh *fh) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "GETATTR", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), "GETATTR", + stat, -ret); nfs3_getattr_reply (req, stat, NULL); ret = 0; nfs3_call_state_wipe (cstate); @@ -543,14 +543,14 @@ nfs3svc_getattr (rpcsvc_request_t *req) nfs3_prep_getattr3args (&args, &fh); if (xdr_to_getattr3args (req->msg, &args) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } ret = nfs3_getattr (req, &fh); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "GETATTR procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -600,7 +600,7 @@ nfs3svc_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, stat = NFS3_OK; nfs3err: - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "SETATTR", stat, + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "SETATTR", stat, op_errno); nfs3_setattr_reply (cs->req, stat, prestat, postbuf); nfs3_call_state_wipe (cs); @@ -658,8 +658,8 @@ nfs3svc_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "SETATTR", - stat, op_errno); + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), + "SETATTR", stat, op_errno); nfs3_setattr_reply (cs->req, stat, prebuf, postop); nfs3_call_state_wipe (cs); } @@ -701,8 +701,8 @@ nfs3svc_setattr_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "SETATTR", - stat, op_errno); + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), + "SETATTR", stat, op_errno); nfs3_setattr_reply (cs->req, stat, NULL, NULL); nfs3_call_state_wipe (cs); } @@ -739,8 +739,8 @@ nfs3_setattr_resume (void *carg) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "SETATTR", - stat, -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), + "SETATTR", stat, -ret); nfs3_setattr_reply (cs->req, stat, NULL, NULL); nfs3_call_state_wipe (cs); } @@ -764,7 +764,7 @@ nfs3_setattr (rpcsvc_request_t *req, struct nfs3_fh *fh, sattr3 *sattr, return -1; } - nfs3_log_common_call (rpcsvc_request_xid (req), "SETATTR", fh); + nfs3_log_common_call (nfs_rpcsvc_request_xid (req), "SETATTR", fh); nfs3_validate_gluster_fh (fh, stat, nfs3err); nfs3_validate_nfs3_state (req, nfs3, stat, nfs3err, ret); nfs3_map_fh_to_volume (nfs3, fh, req, vol, stat, nfs3err); @@ -794,8 +794,8 @@ nfs3_setattr (rpcsvc_request_t *req, struct nfs3_fh *fh, sattr3 *sattr, nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "SETATTR", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), "SETATTR", + stat, -ret); nfs3_setattr_reply (req, stat, NULL, NULL); nfs3_call_state_wipe (cs); /* Ret must be 0 after this so that the caller does not @@ -822,14 +822,14 @@ nfs3svc_setattr (rpcsvc_request_t *req) nfs3_prep_setattr3args (&args, &fh); if (xdr_to_setattr3args (req->msg, &args) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } ret = nfs3_setattr (req, &fh, &args.new_attributes, &args.guard); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "SETATTR procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -869,7 +869,7 @@ nfs3svc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, nfs3_fh_build_child_fh (&cs->parent, buf, &newfh); xmit_res: - nfs3_log_newfh_res (rpcsvc_request_xid (cs->req), "LOOKUP", status, + nfs3_log_newfh_res (nfs_rpcsvc_request_xid (cs->req), "LOOKUP", status, op_errno, &newfh); nfs3_lookup_reply (cs->req, status, &newfh, buf, postparent); nfs3_call_state_wipe (cs); @@ -905,7 +905,7 @@ nfs3svc_lookup_parentdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, cs->vol); xmit_res: - nfs3_log_newfh_res (rpcsvc_request_xid (cs->req), "LOOKUP", status, + nfs3_log_newfh_res (nfs_rpcsvc_request_xid (cs->req), "LOOKUP", status, op_errno, &newfh); nfs3_lookup_reply (cs->req, status, &newfh, buf, postparent); nfs3_call_state_wipe (cs); @@ -970,7 +970,7 @@ errtostat: nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "LOOKUP", + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "LOOKUP", stat, -ret); nfs3_lookup_reply (cs->req, stat, NULL, NULL, NULL); nfs3_call_state_wipe (cs); @@ -1005,7 +1005,7 @@ nfs3_lookup_resume (void *carg) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "LOOKUP", + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "LOOKUP", stat, -ret); nfs3_lookup_reply (cs->req, stat, NULL, NULL, NULL); nfs3_call_state_wipe (cs); @@ -1029,7 +1029,8 @@ nfs3_lookup (rpcsvc_request_t *req, struct nfs3_fh *fh, int fhlen, char *name) return -1; } - nfs3_log_fh_entry_call (rpcsvc_request_xid (req), "LOOKUP", fh, name); + nfs3_log_fh_entry_call (nfs_rpcsvc_request_xid (req), "LOOKUP", fh, + name); nfs3_validate_nfs3_state (req, nfs3, stat, nfs3err, ret); if (nfs3_solaris_zerolen_fh (fh, fhlen)) nfs3_funge_solaris_zerolen_fh (nfs3, fh, name, stat, nfs3err); @@ -1051,7 +1052,8 @@ nfs3_lookup (rpcsvc_request_t *req, struct nfs3_fh *fh, int fhlen, char *name) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "LOOKUP", stat, + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), "LOOKUP", + stat, -ret); nfs3_lookup_reply (req, stat, NULL, NULL, NULL); nfs3_call_state_wipe (cs); @@ -1079,14 +1081,14 @@ nfs3svc_lookup (rpcsvc_request_t *req) nfs3_prep_lookup3args (&args, &fh, name); if (xdr_to_lookup3args (req->msg, &args) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } ret = nfs3_lookup (req, &fh, args.what.dir.data.data_len, name); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "LOOKUP procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -1104,7 +1106,8 @@ nfs3_access_reply (rpcsvc_request_t *req, nfsstat3 status, struct iatt *buf, xlid = nfs3_request_xlator_id (req); nfs3_fill_access3res (&res, status, buf, accbits, - rpcsvc_request_uid (req), rpcsvc_request_gid (req) + nfs_rpcsvc_request_uid (req), + nfs_rpcsvc_request_gid (req) , xlid); nfs3svc_submit_reply (req, &res, (nfs3_serializer)xdr_serialize_access3res); @@ -1124,7 +1127,7 @@ nfs3svc_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1) status = nfs3_errno_to_nfsstat3 (op_errno); - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "ACCESS", status, + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "ACCESS", status, op_errno); nfs3_access_reply (cs->req, status, buf, cs->accessbits); nfs3_call_state_wipe (cs); @@ -1154,7 +1157,7 @@ nfs3_access_resume (void *carg) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "ACCESS", + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "ACCESS", stat, -ret); nfs3_access_reply (cs->req, stat, NULL, 0); nfs3_call_state_wipe (cs); @@ -1177,7 +1180,7 @@ nfs3_access (rpcsvc_request_t *req, struct nfs3_fh *fh, uint32_t accbits) if ((!req) || (!fh)) return -1; - nfs3_log_common_call (rpcsvc_request_xid (req), "ACCESS", fh); + nfs3_log_common_call (nfs_rpcsvc_request_xid (req), "ACCESS", fh); nfs3_validate_gluster_fh (fh, stat, nfs3err); nfs3_validate_nfs3_state (req, nfs3, stat, nfs3err, ret); nfs3_map_fh_to_volume (nfs3, fh, req, vol, stat, nfs3err); @@ -1190,8 +1193,8 @@ nfs3_access (rpcsvc_request_t *req, struct nfs3_fh *fh, uint32_t accbits) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "ACCESS", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), "ACCESS", + stat, -ret); nfs3_access_reply (req, stat, NULL, 0); nfs3_call_state_wipe (cs); ret = 0; @@ -1214,14 +1217,14 @@ nfs3svc_access (rpcsvc_request_t *req) nfs3_prep_access3args (&args, &fh); if (xdr_to_access3args (req->msg, &args) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } ret = nfs3_access (req, &fh, args.access); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "ACCESS procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -1263,7 +1266,7 @@ nfs3svc_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, stat = NFS3_OK; nfs3err: - nfs3_log_readlink_res (rpcsvc_request_xid (cs->req), stat, op_errno, + nfs3_log_readlink_res (nfs_rpcsvc_request_xid (cs->req), stat, op_errno, (char *)path); nfs3_readlink_reply (cs->req, stat, (char *)path, buf); nfs3_call_state_wipe (cs); @@ -1293,8 +1296,8 @@ nfs3_readlink_resume (void *carg) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "READLINK", - stat, -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), + "READLINK", stat, -ret); nfs3_readlink_reply (cs->req, stat, NULL, NULL); nfs3_call_state_wipe (cs); } @@ -1317,7 +1320,7 @@ nfs3_readlink (rpcsvc_request_t *req, struct nfs3_fh *fh) return -1; } - nfs3_log_common_call (rpcsvc_request_xid (req), "READLINK", fh); + nfs3_log_common_call (nfs_rpcsvc_request_xid (req), "READLINK", fh); nfs3_validate_gluster_fh (fh, stat, nfs3err); nfs3_validate_nfs3_state (req, nfs3, stat, nfs3err, ret); nfs3_map_fh_to_volume (nfs3, fh, req, vol, stat, nfs3err); @@ -1329,8 +1332,8 @@ nfs3_readlink (rpcsvc_request_t *req, struct nfs3_fh *fh) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "READLINK", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), "READLINK", + stat, -ret); nfs3_readlink_reply (req, stat, NULL, NULL); nfs3_call_state_wipe (cs); /* Ret must be 0 after this so that the caller does not @@ -1356,14 +1359,14 @@ nfs3svc_readlink (rpcsvc_request_t *req) nfs3_prep_readlink3args (&args, &fh); if (xdr_to_readlink3args (req->msg, &args) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } ret = nfs3_readlink (req, &fh); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "READLINK procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -1383,7 +1386,7 @@ nfs3_read_reply (rpcsvc_request_t *req, nfsstat3 stat, count3 count, xlid = nfs3_request_xlator_id (req); nfs3_fill_read3res (&res, stat, count, poststat, is_eof, xlid); if (stat == NFS3_OK) { - xdr_vector_round_up (vec, vcount, count); + nfs_xdr_vector_round_up (vec, vcount, count); /* iob can be zero if the file size was zero. If so, op_ret * would be 0 and count = 0. */ @@ -1425,7 +1428,7 @@ nfs3svc_read_cbk (call_frame_t *frame, void *cookie, xlator_t *this, is_eof = 1; err: - nfs3_log_read_res (rpcsvc_request_xid (cs->req), stat, op_errno, + nfs3_log_read_res (nfs_rpcsvc_request_xid (cs->req), stat, op_errno, op_ret, is_eof, vector, count); nfs3_read_reply (cs->req, stat, op_ret, vector, count, iobref, stbuf, is_eof); @@ -1455,8 +1458,8 @@ nfs3_read_fd_resume (void *carg) stat = nfs3_errno_to_nfsstat3 (-ret); nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "READ", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "READ", + stat, -ret); nfs3_read_reply (cs->req, stat, 0, NULL, 0, NULL, NULL, 0); nfs3_call_state_wipe (cs); } @@ -1483,8 +1486,8 @@ nfs3_read_resume (void *carg) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "READ", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "READ", + stat, -ret); nfs3_read_reply (cs->req, stat, 0, NULL,0, NULL, NULL, 0); nfs3_call_state_wipe (cs); } @@ -1507,8 +1510,8 @@ nfs3_read (rpcsvc_request_t *req, struct nfs3_fh *fh, offset3 offset, return -1; } - nfs3_log_rw_call (rpcsvc_request_xid (req), "READ", fh, offset, count, - -1); + nfs3_log_rw_call (nfs_rpcsvc_request_xid (req), "READ", fh, offset, + count, -1); nfs3_validate_gluster_fh (fh, stat, nfs3err); nfs3_validate_nfs3_state (req, nfs3, stat, nfs3err, ret); nfs3_map_fh_to_volume (nfs3, fh, req, vol, stat, nfs3err); @@ -1522,7 +1525,7 @@ nfs3_read (rpcsvc_request_t *req, struct nfs3_fh *fh, offset3 offset, nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "READ", stat, + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), "READ", stat, -ret); nfs3_read_reply (req, stat, 0, NULL,0, NULL, NULL, 0); nfs3_call_state_wipe (cs); @@ -1546,14 +1549,14 @@ nfs3svc_read (rpcsvc_request_t *req) nfs3_prep_read3args (&args, &fh); if (xdr_to_read3args (req->msg, &args) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } ret = nfs3_read (req, &fh, args.offset, args.count); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "READ procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -1589,14 +1592,14 @@ nfs3svc_write_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, nfs3_call_state_t *cs = NULL; cs = frame->local; - nfs3 = rpcsvc_request_program_private (cs->req); + nfs3 = nfs_rpcsvc_request_program_private (cs->req); if (op_ret == -1) stat = nfs3_errno_to_nfsstat3 (op_errno); else stat = NFS3_OK; - nfs3_log_write_res (rpcsvc_request_xid (cs->req), stat, op_errno, + nfs3_log_write_res (nfs_rpcsvc_request_xid (cs->req), stat, op_errno, cs->maxcount, cs->writetype, nfs3->serverstart); nfs3_write_reply (cs->req, stat, cs->maxcount, cs->writetype, nfs3->serverstart, &cs->stbuf, postbuf); @@ -1686,7 +1689,7 @@ nfs3svc_write_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int sync_trusted = 0; cs = frame->local; - nfs3 = rpcsvc_request_program_private (cs->req); + nfs3 = nfs_rpcsvc_request_program_private (cs->req); if (op_ret == -1) { stat = nfs3_errno_to_nfsstat3 (op_errno); goto err; @@ -1716,7 +1719,7 @@ nfs3svc_write_cbk (call_frame_t *frame, void *cookie, xlator_t *this, err: if (ret < 0) { - nfs3_log_write_res (rpcsvc_request_xid (cs->req), stat, + nfs3_log_write_res (nfs_rpcsvc_request_xid (cs->req), stat, op_errno, cs->maxcount, cs->writetype, nfs3->serverstart); nfs3_write_reply (cs->req, stat, cs->maxcount, @@ -1776,7 +1779,7 @@ nfs3_write_resume (void *carg) stat = nfs3_errno_to_nfsstat3 (-ret); nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "WRITE", + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "WRITE", stat, -ret); nfs3_write_reply (cs->req, stat, 0, cs->writetype, 0, NULL, NULL); @@ -1803,7 +1806,7 @@ nfs3_write_open_resume (void *carg) stat = nfs3_errno_to_nfsstat3 (-ret); nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "WRITE", + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "WRITE", stat, -ret); nfs3_write_reply (cs->req, stat, 0, cs->writetype, 0, NULL, NULL); @@ -1830,8 +1833,8 @@ nfs3_write (rpcsvc_request_t *req, struct nfs3_fh *fh, offset3 offset, return -1; } - nfs3_log_rw_call (rpcsvc_request_xid (req), "WRITE", fh, offset, count, - stable); + nfs3_log_rw_call (nfs_rpcsvc_request_xid (req), "WRITE", fh, offset, + count, stable); nfs3_validate_gluster_fh (fh, stat, nfs3err); nfs3_validate_nfs3_state (req, nfs3, stat, nfs3err, ret); nfs3_map_fh_to_volume (nfs3, fh, req, vol, stat, nfs3err); @@ -1850,8 +1853,8 @@ nfs3_write (rpcsvc_request_t *req, struct nfs3_fh *fh, offset3 offset, nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "WRITE", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), "WRITE", + stat, -ret); nfs3_write_reply (req, stat, 0, stable, 0, NULL, NULL); nfs3_call_state_wipe (cs); ret = 0; @@ -1879,21 +1882,21 @@ nfs3svc_write_vecsizer (rpcsvc_request_t *req, ssize_t *readsize, int *newbuf) if (!req) return ret; - state = (long)rpcsvc_request_private (req); + state = (long)nfs_rpcsvc_request_private (req); *newbuf = 0; if (state == 0) { - rpcsvc_request_set_private (req, NFS3_VECWRITE_READFHLEN); + nfs_rpcsvc_request_set_private (req, NFS3_VECWRITE_READFHLEN); *readsize = 4; ret = 0; } else if (state == NFS3_VECWRITE_READFHLEN) { fhlen_n = *(uint32_t *)req->msg.iov_base; fhlen = ntohl (fhlen_n); - *readsize = xdr_length_round_up (fhlen, NFS3_FHSIZE); - rpcsvc_request_set_private (req, NFS3_VECWRITE_READFH); + *readsize = nfs_xdr_length_round_up (fhlen, NFS3_FHSIZE); + nfs_rpcsvc_request_set_private (req, NFS3_VECWRITE_READFH); ret = 0; } else if (state == NFS3_VECWRITE_READFH) { *readsize = NFS3_WRITE_POSTFH_SIZE; - rpcsvc_request_set_private (req, NFS3_VECWRITE_READREST); + nfs_rpcsvc_request_set_private (req, NFS3_VECWRITE_READREST); ret = 0; } else if (state == NFS3_VECWRITE_READREST) { args = GF_CALLOC (1, sizeof (*args), gf_nfs_mt_write3args); @@ -1902,11 +1905,11 @@ nfs3svc_write_vecsizer (rpcsvc_request_t *req, ssize_t *readsize, int *newbuf) if (xdr_to_write3args_nocopy (req->msg, args, NULL) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } - rpcsvc_request_set_private (req, args); - ret = xdr_length_round_up (args->data.data_len, 1048576); + nfs_rpcsvc_request_set_private (req, args); + ret = nfs_xdr_length_round_up (args->data.data_len, 1048576); *readsize = ret; *newbuf = 1; ret = 0; @@ -1928,7 +1931,7 @@ nfs3svc_write_vec (rpcsvc_request_t *req, struct iobuf *iob) if ((!req) || (!iob)) return ret; - args = rpcsvc_request_private (req); + args = nfs_rpcsvc_request_private (req); iobuf_to_iovec (iob, &payload); iobuf_ref (iob); ret = nfs3_write (req, (struct nfs3_fh *)args->file.data.data_val, @@ -1936,7 +1939,7 @@ nfs3svc_write_vec (rpcsvc_request_t *req, struct iobuf *iob) xdr_free_write3args_nocopy (args); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "WRITE procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -1958,7 +1961,7 @@ nfs3svc_write (rpcsvc_request_t *req) nfs3_prep_write3args (&args, &fh); if (xdr_to_write3args_nocopy (req->msg, &args, &payload) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } @@ -1967,12 +1970,12 @@ nfs3svc_write (rpcsvc_request_t *req) * ourselves because the RPC call handler who called us will unref its * own ref of the record's iobuf when it is done handling the request. */ - rpcsvc_request_record_ref (req); + nfs_rpcsvc_request_record_ref (req); ret = nfs3_write (req, &fh, args.offset, args.count, args.stable, - payload, rpcsvc_request_record_iob (req)); + payload, nfs_rpcsvc_request_record_iob (req)); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "WRITE procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -2011,7 +2014,7 @@ nfs3svc_create_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, stat = NFS3_OK; nfs3err: - nfs3_log_newfh_res (rpcsvc_request_xid (cs->req), "CREATE", stat, + nfs3_log_newfh_res (nfs_rpcsvc_request_xid (cs->req), "CREATE", stat, op_errno, &cs->fh); nfs3_create_reply (cs->req, stat, &cs->fh, postop, &cs->preparent, &cs->postparent); @@ -2057,7 +2060,7 @@ nfs3svc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, nfs3err: if (ret < 0) { - nfs3_log_newfh_res (rpcsvc_request_xid (cs->req), "CREATE", + nfs3_log_newfh_res (nfs_rpcsvc_request_xid (cs->req), "CREATE", stat, op_errno, &cs->fh); nfs3_create_reply (cs->req, stat, &cs->fh, buf, preparent, postparent); @@ -2124,7 +2127,7 @@ nfs3svc_create_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "CREATE", + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "CREATE", stat, op_errno); nfs3_create_reply (cs->req, stat, NULL, NULL, NULL, NULL); nfs3_call_state_wipe (cs); @@ -2196,7 +2199,7 @@ nfs3_create_resume (void *carg) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "CREATE", + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "CREATE", stat, -ret); nfs3_create_reply (cs->req, stat, NULL, NULL, NULL, NULL); nfs3_call_state_wipe (cs); @@ -2218,7 +2221,7 @@ nfs3_create (rpcsvc_request_t *req, struct nfs3_fh *dirfh, char *name, if ((!req) || (!dirfh) || (!name) || (!sattr)) return -1; - nfs3_log_create_call (rpcsvc_request_xid (req), dirfh, name, mode); + nfs3_log_create_call (nfs_rpcsvc_request_xid (req), dirfh, name, mode); nfs3_validate_gluster_fh (dirfh, stat, nfs3err); nfs3_validate_nfs3_state (req, nfs3, stat, nfs3err, ret); nfs3_validate_strlen_or_goto (name, NFS_NAME_MAX, nfs3err, stat, ret); @@ -2238,8 +2241,8 @@ nfs3_create (rpcsvc_request_t *req, struct nfs3_fh *dirfh, char *name, nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "CREATE", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), "CREATE", + stat, -ret); nfs3_create_reply (req, stat, NULL, NULL, NULL, NULL); nfs3_call_state_wipe (cs); ret = 0; @@ -2264,7 +2267,7 @@ nfs3svc_create (rpcsvc_request_t *req) nfs3_prep_create3args (&args, &dirfh, name); if (xdr_to_create3args (req->msg, &args) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } @@ -2273,7 +2276,7 @@ nfs3svc_create (rpcsvc_request_t *req) &args.how.createhow3_u.obj_attributes, cverf); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "CREATE procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -2311,7 +2314,7 @@ nfs3svc_mkdir_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, stat = NFS3_OK; nfs3err: - nfs3_log_newfh_res (rpcsvc_request_xid (cs->req), "MKDIR", stat, + nfs3_log_newfh_res (nfs_rpcsvc_request_xid (cs->req), "MKDIR", stat, op_errno, &cs->fh); nfs3_mkdir_reply (cs->req, stat, &cs->fh, postop, &cs->preparent, &cs->postparent); @@ -2356,8 +2359,8 @@ nfs3svc_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, nfs3err: if (ret < 0) { - nfs3_log_newfh_res (rpcsvc_request_xid (cs->req), "MKDIR", stat, - op_errno, &cs->fh); + nfs3_log_newfh_res (nfs_rpcsvc_request_xid (cs->req), "MKDIR", + stat, op_errno, &cs->fh); nfs3_mkdir_reply (cs->req, stat, &cs->fh, buf, preparent, postparent); nfs3_call_state_wipe (cs); @@ -2395,8 +2398,8 @@ nfs3_mkdir_resume (void *carg) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "MKDIR",stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "MKDIR", + stat, -ret); nfs3_mkdir_reply (cs->req, stat, NULL, NULL, NULL, NULL); nfs3_call_state_wipe (cs); } @@ -2421,7 +2424,8 @@ nfs3_mkdir (rpcsvc_request_t *req, struct nfs3_fh *dirfh, char *name, return -1; } - nfs3_log_fh_entry_call (rpcsvc_request_xid (req), "MKDIR", dirfh, name); + nfs3_log_fh_entry_call (nfs_rpcsvc_request_xid (req), "MKDIR", dirfh, + name); nfs3_validate_gluster_fh (dirfh, stat, nfs3err); nfs3_validate_nfs3_state (req, nfs3, stat, nfs3err, ret); nfs3_validate_strlen_or_goto (name, NFS_NAME_MAX, nfs3err, stat, ret); @@ -2438,8 +2442,8 @@ nfs3_mkdir (rpcsvc_request_t *req, struct nfs3_fh *dirfh, char *name, nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "MKDIR", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), "MKDIR", + stat, -ret); nfs3_mkdir_reply (req, stat, NULL, NULL, NULL, NULL); nfs3_call_state_wipe (cs); ret = 0; @@ -2462,14 +2466,14 @@ nfs3svc_mkdir (rpcsvc_request_t *req) nfs3_prep_mkdir3args (&args, &dirfh, name); if (xdr_to_mkdir3args (req->msg, &args) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } ret = nfs3_mkdir (req, &dirfh, name, &args.attributes); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "MKDIR procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -2512,7 +2516,7 @@ nfs3svc_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, stat = NFS3_OK; nfs3err: - nfs3_log_newfh_res (rpcsvc_request_xid (cs->req), "SYMLINK", stat, + nfs3_log_newfh_res (nfs_rpcsvc_request_xid (cs->req), "SYMLINK", stat, op_errno, &cs->fh); nfs3_symlink_reply (cs->req, stat, &cs->fh, buf, preparent, postparent); @@ -2542,8 +2546,8 @@ nfs3_symlink_resume (void *carg) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "SYMLINK", - stat, -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), + "SYMLINK", stat, -ret); nfs3_symlink_reply (cs->req, stat, NULL, NULL, NULL, NULL); nfs3_call_state_wipe (cs); } @@ -2567,7 +2571,8 @@ nfs3_symlink (rpcsvc_request_t *req, struct nfs3_fh *dirfh, char *name, return -1; } - nfs3_log_symlink_call (rpcsvc_request_xid (req), dirfh, name, target); + nfs3_log_symlink_call (nfs_rpcsvc_request_xid (req), dirfh, name, + target); nfs3_validate_gluster_fh (dirfh, stat, nfs3err); nfs3_validate_nfs3_state (req, nfs3, stat, nfs3err, ret); nfs3_validate_strlen_or_goto (name, NFS_NAME_MAX, nfs3err, stat, ret); @@ -2589,8 +2594,8 @@ nfs3_symlink (rpcsvc_request_t *req, struct nfs3_fh *dirfh, char *name, nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "SYMLINK", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), "SYMLINK", + stat, -ret); nfs3_symlink_reply (req, stat, NULL, NULL, NULL, NULL); nfs3_call_state_wipe (cs); /* Ret must be 0 after this so that the caller does not @@ -2617,7 +2622,7 @@ nfs3svc_symlink (rpcsvc_request_t *req) nfs3_prep_symlink3args (&args, &dirfh, name, target); if (xdr_to_symlink3args (req->msg, &args) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } @@ -2625,7 +2630,7 @@ nfs3svc_symlink (rpcsvc_request_t *req) &args.symlink.symlink_attributes); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "SYMLINK procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -2663,7 +2668,7 @@ nfs3svc_mknod_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, stat = NFS3_OK; nfs3err: - nfs3_log_newfh_res (rpcsvc_request_xid (cs->req), "MKNOD", stat, + nfs3_log_newfh_res (nfs_rpcsvc_request_xid (cs->req), "MKNOD", stat, op_errno, &cs->fh); nfs3_mknod_reply (cs->req, stat, &cs->fh, postop, &cs->preparent, &cs->postparent); @@ -2708,7 +2713,8 @@ nfs3svc_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, stat = nfs3_errno_to_nfsstat3 (-ret); nfs3err: if (ret < 0) { - nfs3_log_newfh_res (rpcsvc_request_xid (cs->req), "MKNOD", stat, + nfs3_log_newfh_res (nfs_rpcsvc_request_xid (cs->req), "MKNOD", + stat, op_errno, &cs->fh); nfs3_mknod_reply (cs->req, stat, &cs->fh, buf, preparent, postparent); @@ -2806,8 +2812,8 @@ nfs3_mknod_resume (void *carg) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "MKNOD",stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "MKNOD", + stat, -ret); nfs3_mknod_reply (cs->req, stat, NULL, NULL, NULL, NULL); nfs3_call_state_wipe (cs); } @@ -2833,7 +2839,8 @@ nfs3_mknod (rpcsvc_request_t *req, struct nfs3_fh *fh, char *name, return -1; } - nfs3_log_mknod_call (rpcsvc_request_xid (req), fh, name,nodedata->type); + nfs3_log_mknod_call (nfs_rpcsvc_request_xid (req), fh, name, + nodedata->type); nfs3_validate_gluster_fh (fh, stat, nfs3err); nfs3_validate_nfs3_state (req, nfs3, stat, nfs3err, ret); nfs3_validate_strlen_or_goto (name, NFS_NAME_MAX, nfs3err, stat, ret); @@ -2868,8 +2875,8 @@ nfs3_mknod (rpcsvc_request_t *req, struct nfs3_fh *fh, char *name, nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "MKNOD", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), "MKNOD", + stat, -ret); nfs3_mknod_reply (req, stat, NULL, NULL, NULL, NULL); /* Ret must be 0 after this so that the caller does not * also send an RPC reply. @@ -2895,14 +2902,14 @@ nfs3svc_mknod (rpcsvc_request_t *req) nfs3_prep_mknod3args (&args, &fh, name); if (xdr_to_mknod3args (req->msg, &args) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } ret = nfs3_mknod (req, &fh, name, &args.what); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "MKNOD procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -2946,7 +2953,7 @@ nfs3svc_remove_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * finishes, the file is finally removed. */ openfd = fd_lookup (cs->resolvedloc.inode, 0); - nfs3 = rpcsvc_request_program_private (cs->req); + nfs3 = nfs_rpcsvc_request_program_private (cs->req); if (openfd) { fd_unref (openfd); nfs3_fdcache_remove (nfs3, openfd); @@ -2958,7 +2965,7 @@ nfs3svc_remove_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ inode_unref (cs->resolvedloc.inode); do_not_unref_cached_fd: - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "REMOVE", stat, + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "REMOVE", stat, op_errno); nfs3_remove_reply (cs->req, stat, preparent, postparent); nfs3_call_state_wipe (cs); @@ -3007,7 +3014,7 @@ nfs3_remove_resume (void *carg) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "REMOVE", + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "REMOVE", stat, -ret); nfs3_remove_reply (cs->req, stat, NULL, NULL); nfs3_call_state_wipe (cs); @@ -3031,7 +3038,8 @@ nfs3_remove (rpcsvc_request_t *req, struct nfs3_fh *fh, char *name) return -1; } - nfs3_log_fh_entry_call (rpcsvc_request_xid (req), "REMOVE", fh, name); + nfs3_log_fh_entry_call (nfs_rpcsvc_request_xid (req), "REMOVE", fh, + name); nfs3_validate_gluster_fh (fh, stat, nfs3err); nfs3_validate_nfs3_state (req, nfs3, stat, nfs3err, ret); nfs3_validate_strlen_or_goto (name, NFS_NAME_MAX, nfs3err, stat, ret); @@ -3045,8 +3053,8 @@ nfs3_remove (rpcsvc_request_t *req, struct nfs3_fh *fh, char *name) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "REMOVE", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), "REMOVE", + stat, -ret); nfs3_remove_reply (req, stat, NULL, NULL); nfs3_call_state_wipe (cs); /* Ret must be 0 after this so that the caller does not @@ -3072,14 +3080,14 @@ nfs3svc_remove (rpcsvc_request_t *req) nfs3_prep_remove3args (&args, &fh, name); if (xdr_to_remove3args (req->msg, &args) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } ret = nfs3_remove (req, &fh, name); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "REMOVE procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -3119,7 +3127,7 @@ nfs3svc_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, stat = NFS3_OK; } - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "RMDIR", stat, + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "RMDIR", stat, op_errno); nfs3_rmdir_reply (cs->req, stat, preparent, postparent); nfs3_call_state_wipe (cs); @@ -3148,7 +3156,7 @@ nfs3_rmdir_resume (void *carg) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "RMDIR", + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "RMDIR", stat, -ret); nfs3_rmdir_reply (cs->req, stat, NULL, NULL); nfs3_call_state_wipe (cs); @@ -3173,7 +3181,8 @@ nfs3_rmdir (rpcsvc_request_t *req, struct nfs3_fh *fh, char *name) return -1; } - nfs3_log_fh_entry_call (rpcsvc_request_xid (req), "RMDIR", fh, name); + nfs3_log_fh_entry_call (nfs_rpcsvc_request_xid (req), "RMDIR", fh, + name); nfs3_validate_gluster_fh (fh, stat, nfs3err); nfs3_validate_nfs3_state (req, nfs3, stat, nfs3err, ret); nfs3_validate_strlen_or_goto (name, NFS_NAME_MAX, nfs3err, stat, ret); @@ -3187,8 +3196,8 @@ nfs3_rmdir (rpcsvc_request_t *req, struct nfs3_fh *fh, char *name) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "RMDIR", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), "RMDIR", + stat, -ret); nfs3_rmdir_reply (req, stat, NULL, NULL); nfs3_call_state_wipe (cs); /* Ret must be 0 after this so that the caller does not @@ -3214,14 +3223,14 @@ nfs3svc_rmdir (rpcsvc_request_t *req) nfs3_prep_rmdir3args (&args, &fh, name); if (xdr_to_rmdir3args (req->msg, &args) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } ret = nfs3_rmdir (req, &fh, name); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "RMDIR procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -3268,7 +3277,8 @@ nfs3svc_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, stat = NFS3_OK; nfs3err: - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "RENAME", stat,-ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "RENAME", stat, + -ret); nfs3_rename_reply (cs->req, stat, buf, preoldparent, postoldparent, prenewparent, postnewparent); nfs3_call_state_wipe (cs); @@ -3298,7 +3308,7 @@ nfs3_rename_resume_dst (void *carg) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "RENAME", + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "RENAME", stat, -ret); nfs3_rename_reply (cs->req, stat, NULL, NULL, NULL, NULL, NULL); nfs3_call_state_wipe (cs); @@ -3334,7 +3344,7 @@ nfs3_rename_resume_src (void *carg) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "RENAME", + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "RENAME", stat, -ret); nfs3_rename_reply (cs->req, stat, NULL, NULL, NULL, NULL, NULL); nfs3_call_state_wipe (cs); @@ -3359,7 +3369,7 @@ nfs3_rename (rpcsvc_request_t *req, struct nfs3_fh *olddirfh, char *oldname, return -1; } - nfs3_log_rename_call (rpcsvc_request_xid (req), olddirfh, oldname, + nfs3_log_rename_call (nfs_rpcsvc_request_xid (req), olddirfh, oldname, newdirfh, newname); nfs3_validate_gluster_fh (olddirfh, stat, nfs3err); nfs3_validate_gluster_fh (newdirfh, stat, nfs3err); @@ -3388,8 +3398,8 @@ nfs3_rename (rpcsvc_request_t *req, struct nfs3_fh *olddirfh, char *oldname, nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "RENAME", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), "RENAME", + stat, -ret); nfs3_rename_reply (req, stat, NULL, NULL, NULL, NULL, NULL); nfs3_call_state_wipe (cs); /* Ret must be 0 after this so that the caller does not @@ -3417,14 +3427,14 @@ nfs3svc_rename (rpcsvc_request_t *req) nfs3_prep_rename3args (&args, &olddirfh, oldname, &newdirfh, newname); if (xdr_to_rename3args (req->msg, &args) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } ret = nfs3_rename (req, &olddirfh, oldname, &newdirfh, newname); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "RENAME procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -3464,7 +3474,7 @@ nfs3svc_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, else stat = NFS3_OK; - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "LINK", stat, + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "LINK", stat, op_errno); nfs3_link_reply (cs->req, stat, buf, preparent, postparent); nfs3_call_state_wipe (cs); @@ -3495,8 +3505,8 @@ nfs3_link_resume_lnk (void *carg) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "LINK", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "LINK", + stat, -ret); nfs3_link_reply (cs->req, stat, NULL, NULL, NULL); nfs3_call_state_wipe (cs); } @@ -3526,8 +3536,8 @@ nfs3_link_resume_tgt (void *carg) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "LINK", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "LINK", + stat, -ret); nfs3_link_reply (cs->req, stat, NULL, NULL, NULL); nfs3_call_state_wipe (cs); } @@ -3574,7 +3584,7 @@ nfs3_link (rpcsvc_request_t *req, struct nfs3_fh *targetfh, nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "LINK", stat, + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), "LINK", stat, -ret); nfs3_link_reply (req, stat, NULL, NULL, NULL); nfs3_call_state_wipe (cs); @@ -3601,14 +3611,14 @@ nfs3svc_link (rpcsvc_request_t *req) nfs3_prep_link3args (&args, &targetfh, &dirfh, newpath); if (xdr_to_link3args (req->msg, &args) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } ret = nfs3_link (req, &targetfh, &dirfh, newpath); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "LINK procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -3676,14 +3686,14 @@ nfs3svc_readdir_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, stat = NFS3_OK; nfs3err: if (cs->maxcount == 0) { - nfs3_log_readdir_res (rpcsvc_request_xid (cs->req), stat, + nfs3_log_readdir_res (nfs_rpcsvc_request_xid (cs->req), stat, op_errno, (uintptr_t)cs->fd, cs->dircount, is_eof); nfs3_readdir_reply (cs->req, stat, &cs->parent, (uintptr_t)cs->fd, buf, &cs->entries, cs->dircount, is_eof); } else { - nfs3_log_readdirp_res (rpcsvc_request_xid (cs->req), stat, + nfs3_log_readdirp_res (nfs_rpcsvc_request_xid (cs->req), stat, op_errno, (uintptr_t)cs->fd, cs->dircount, cs->maxcount, is_eof); nfs3_readdirp_reply (cs->req, stat, &cs->parent, @@ -3734,12 +3744,12 @@ err: goto ret; if (cs->maxcount == 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "READDIR", - stat, op_errno); + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), + "READDIR", stat, op_errno); nfs3_readdir_reply (cs->req, stat, NULL, 0, NULL, NULL, 0, 0); } else { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "READDIRP" - , stat, op_errno); + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), + "READDIRP", stat, op_errno); nfs3_readdirp_reply (cs->req, stat, NULL, 0, NULL, NULL, 0, 0, 0); } @@ -3783,7 +3793,7 @@ nfs3_readdir_read_resume (void *carg) cs = (nfs3_call_state_t *)carg; nfs3_check_fh_resolve_status (cs, stat, nfs3err); - nfs3 = rpcsvc_request_program_private (cs->req); + nfs3 = nfs_rpcsvc_request_program_private (cs->req); ret = nfs3_verify_dircookie (nfs3, cs->fd, cs->cookie, cs->cookieverf, &stat); if (ret < 0) /* Stat already set by verifier function above. */ @@ -3795,12 +3805,12 @@ nfs3_readdir_read_resume (void *carg) nfs3err: if (ret < 0) { if (cs->maxcount == 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "READDIR", stat, -ret); nfs3_readdir_reply (cs->req, stat, NULL, 0, NULL, NULL, 0, 0); } else { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "READDIRP", stat, -ret); nfs3_readdirp_reply (cs->req, stat, NULL, 0, NULL, NULL, 0, 0, 0); @@ -3831,12 +3841,12 @@ nfs3_readdir_open_resume (void *carg) nfs3err: if (ret < 0) { if (cs->maxcount == 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "READDIR", stat, -ret); nfs3_readdir_reply (cs->req, stat, NULL, 0, NULL, NULL, 0, 0); } else { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "READDIRP", stat, -ret); nfs3_readdirp_reply (cs->req, stat, NULL, 0, NULL, NULL, 0, 0, 0); @@ -3864,7 +3874,8 @@ nfs3_readdir (rpcsvc_request_t *req, struct nfs3_fh *fh, cookie3 cookie, return -1; } - nfs3_log_readdir_call (rpcsvc_request_xid (req), fh, dircount,maxcount); + nfs3_log_readdir_call (nfs_rpcsvc_request_xid (req), fh, dircount, + maxcount); nfs3_validate_gluster_fh (fh, stat, nfs3err); nfs3_validate_nfs3_state (req, nfs3, stat, nfs3err, ret); nfs3_map_fh_to_volume (nfs3, fh, req, vol, stat, nfs3err); @@ -3883,13 +3894,13 @@ nfs3_readdir (rpcsvc_request_t *req, struct nfs3_fh *fh, cookie3 cookie, nfs3err: if (ret < 0) { if (maxcount == 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "READDIR" - , stat, -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), + "READDIR", stat, -ret); nfs3_readdir_reply (req, stat, NULL, 0, NULL, NULL, 0, 0); } else { - nfs3_log_common_res (rpcsvc_request_xid (req),"READDIRP" - , stat, -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), + "READDIRP", stat, -ret); nfs3_readdirp_reply (req, stat, NULL, 0, NULL, NULL, 0, 0, 0); } @@ -3917,7 +3928,7 @@ nfs3svc_readdir (rpcsvc_request_t *req) nfs3_prep_readdir3args (&ra, &fh); if (xdr_to_readdir3args (req->msg, &ra) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } @@ -3925,7 +3936,7 @@ nfs3svc_readdir (rpcsvc_request_t *req) ret = nfs3_readdir (req, &fh, ra.cookie, verf, ra.count, 0); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "READDIR procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -3947,7 +3958,7 @@ nfs3svc_readdirp (rpcsvc_request_t *req) nfs3_prep_readdirp3args (&ra, &fh); if (xdr_to_readdirp3args (req->msg, &ra) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } @@ -3956,7 +3967,7 @@ nfs3svc_readdirp (rpcsvc_request_t *req) ra.maxcount); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "READDIRP procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -3993,7 +4004,7 @@ nfs3_fsstat_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, else stat = NFS3_OK; - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "FSTAT", stat, + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "FSTAT", stat, op_errno); nfs3_fsstat_reply (cs->req, stat, &cs->fsstat, buf); nfs3_call_state_wipe (cs); @@ -4029,7 +4040,7 @@ nfs3_fsstat_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "FSTAT", + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "FSTAT", stat, -ret); nfs3_fsstat_reply (cs->req, stat, NULL, NULL); nfs3_call_state_wipe (cs); @@ -4061,8 +4072,8 @@ nfs3_fsstat_resume (void *carg) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "FSTAT", - stat, -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "FSTAT", + stat, -ret); nfs3_fsstat_reply (cs->req, stat, NULL, NULL); nfs3_call_state_wipe (cs); } @@ -4086,7 +4097,7 @@ nfs3_fsstat (rpcsvc_request_t *req, struct nfs3_fh *fh) return -1; } - nfs3_log_common_call (rpcsvc_request_xid (req), "FSSTAT", fh); + nfs3_log_common_call (nfs_rpcsvc_request_xid (req), "FSSTAT", fh); nfs3_validate_gluster_fh (fh, stat, nfs3err); nfs3_validate_nfs3_state (req, nfs3, stat, nfs3err, ret); nfs3_map_fh_to_volume (nfs3, fh, req, vol, stat, nfs3err); @@ -4098,8 +4109,8 @@ nfs3_fsstat (rpcsvc_request_t *req, struct nfs3_fh *fh) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "FSTAT", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), "FSTAT", + stat, -ret); nfs3_fsstat_reply (req, stat, NULL, NULL); nfs3_call_state_wipe (cs); /* Ret must be 0 after this so that the caller does not @@ -4124,14 +4135,14 @@ nfs3svc_fsstat (rpcsvc_request_t *req) nfs3_prep_fsstat3args (&args, &fh); if (xdr_to_fsstat3args (req->msg, &args) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } ret = nfs3_fsstat (req, &fh); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "FSTAT procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -4148,7 +4159,7 @@ nfs3_fsinfo_reply (rpcsvc_request_t *req, nfsstat3 status, struct iatt *fsroot) uint16_t xlid = 0; xlid = nfs3_request_xlator_id (req); - nfs3 = rpcsvc_request_program_private (req); + nfs3 = nfs_rpcsvc_request_program_private (req); nfs3_fill_fsinfo3res (nfs3, &res, status, fsroot, xlid); nfs3svc_submit_reply (req, &res, @@ -4171,7 +4182,7 @@ nfs3svc_fsinfo_cbk (call_frame_t *frame, void *cookie, xlator_t *this, else status = NFS3_OK; - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "FSINFO", status, + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "FSINFO", status, op_errno); nfs3_fsinfo_reply (cs->req, status, buf); @@ -4204,7 +4215,7 @@ nfs3_fsinfo_resume (void *carg) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "FSINFO", + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "FSINFO", stat, -ret); nfs3_fsinfo_reply (cs->req, stat, NULL); nfs3_call_state_wipe (cs); @@ -4228,7 +4239,7 @@ nfs3_fsinfo (rpcsvc_request_t *req, struct nfs3_fh *fh) return -1; } - nfs3_log_common_call (rpcsvc_request_xid (req), "FSINFO", fh); + nfs3_log_common_call (nfs_rpcsvc_request_xid (req), "FSINFO", fh); nfs3_validate_gluster_fh (fh, stat, nfs3err); nfs3_validate_nfs3_state (req, nfs3, stat, nfs3err, ret); nfs3_map_fh_to_volume (nfs3, fh, req, vol, stat, nfs3err); @@ -4240,8 +4251,8 @@ nfs3_fsinfo (rpcsvc_request_t *req, struct nfs3_fh *fh) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "FSINFO", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), "FSINFO", + stat, -ret); nfs3_fsinfo_reply (req, stat, NULL); nfs3_call_state_wipe (cs); ret = 0; @@ -4264,14 +4275,14 @@ nfs3svc_fsinfo (rpcsvc_request_t *req) nfs3_prep_fsinfo3args (&args, &root); if (xdr_to_fsinfo3args (req->msg, &args) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding arguments"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } ret = nfs3_fsinfo (req, &root); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "FSINFO procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -4313,7 +4324,7 @@ nfs3svc_pathconf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, stat = NFS3_OK; } - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "PATHCONF", stat, + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "PATHCONF", stat, op_errno); nfs3_pathconf_reply (cs->req, stat, sbuf); nfs3_call_state_wipe (cs); @@ -4342,8 +4353,8 @@ nfs3_pathconf_resume (void *carg) stat = nfs3_errno_to_nfsstat3 (-ret); nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "PATHCONF", - stat, -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), + "PATHCONF", stat, -ret); nfs3_pathconf_reply (cs->req, stat, NULL); nfs3_call_state_wipe (cs); } @@ -4365,7 +4376,7 @@ nfs3_pathconf (rpcsvc_request_t *req, struct nfs3_fh *fh) return -1; } - nfs3_log_common_call (rpcsvc_request_xid (req), "PATHCONF", fh); + nfs3_log_common_call (nfs_rpcsvc_request_xid (req), "PATHCONF", fh); nfs3_validate_gluster_fh (fh, stat, nfs3err); nfs3_validate_nfs3_state (req, nfs3, stat, nfs3err, ret); nfs3_map_fh_to_volume (nfs3, fh, req, vol, stat, nfs3err); @@ -4377,8 +4388,8 @@ nfs3_pathconf (rpcsvc_request_t *req, struct nfs3_fh *fh) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "PATHCONF", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), "PATHCONF", + stat, -ret); nfs3_pathconf_reply (req, stat, NULL); nfs3_call_state_wipe (cs); /* Ret must be 0 after this so that the caller does not @@ -4403,14 +4414,14 @@ nfs3svc_pathconf (rpcsvc_request_t *req) nfs3_prep_pathconf3args (&args, &fh); if (xdr_to_pathconf3args (req->msg, &args) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } ret = nfs3_pathconf (req, &fh); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "PATHCONF procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } @@ -4449,8 +4460,8 @@ nfs3svc_commit_cbk (call_frame_t *frame, void *cookie, xlator_t *this, else stat = NFS3_OK; - nfs3 = rpcsvc_request_program_private (cs->req); - nfs3_log_commit_res (rpcsvc_request_xid (cs->req), stat, op_errno, + nfs3 = nfs_rpcsvc_request_program_private (cs->req); + nfs3_log_commit_res (nfs_rpcsvc_request_xid (cs->req), stat, op_errno, nfs3->serverstart); nfs3_commit_reply (cs->req, stat, nfs3->serverstart, prebuf, postbuf); nfs3_call_state_wipe (cs); @@ -4486,7 +4497,7 @@ nfs3_commit_resume (void *carg) nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "COMMIT", + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "COMMIT", stat, -ret); nfs3_commit_reply (cs->req, stat, cs->nfs3state->serverstart, NULL, NULL); @@ -4516,7 +4527,7 @@ nfs3_commit_open_resume (void *carg) stat = nfs3_errno_to_nfsstat3 (-ret); nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (cs->req), "COMMIT", + nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "COMMIT", stat, -ret); nfs3_commit_reply (cs->req, stat, 0, NULL, NULL); nfs3_call_state_wipe (cs); @@ -4542,8 +4553,8 @@ nfs3_commit (rpcsvc_request_t *req, struct nfs3_fh *fh, offset3 offset, return -1; } - nfs3_log_rw_call (rpcsvc_request_xid (req), "COMMIT", fh, offset, count, - -1); + nfs3_log_rw_call (nfs_rpcsvc_request_xid (req), "COMMIT", fh, offset, + count, -1); nfs3_validate_gluster_fh (fh, stat, nfs3err); nfs3_validate_nfs3_state (req, nfs3, stat, nfs3err, ret); nfs3_map_fh_to_volume (nfs3, fh, req, vol, stat, nfs3err); @@ -4559,8 +4570,8 @@ nfs3_commit (rpcsvc_request_t *req, struct nfs3_fh *fh, offset3 offset, nfs3err: if (ret < 0) { - nfs3_log_common_res (rpcsvc_request_xid (req), "COMMIT", stat, - -ret); + nfs3_log_common_res (nfs_rpcsvc_request_xid (req), "COMMIT", + stat, -ret); nfs3_commit_reply (req, stat, 0, NULL, NULL); nfs3_call_state_wipe (cs); ret = 0; @@ -4583,14 +4594,14 @@ nfs3svc_commit (rpcsvc_request_t *req) nfs3_prep_commit3args (&args, &fh); if (xdr_to_commit3args (req->msg, &args) <= 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args"); - rpcsvc_request_seterr (req, GARBAGE_ARGS); + nfs_rpcsvc_request_seterr (req, GARBAGE_ARGS); goto rpcerr; } ret = nfs3_commit (req, &fh, args.offset, args.count); if (ret < 0) { gf_log (GF_NFS3, GF_LOG_ERROR, "COMMIT procedure failed"); - rpcsvc_request_seterr (req, SYSTEM_ERR); + nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); ret = RPCSVC_ACTOR_ERROR; } |