diff options
Diffstat (limited to 'xlators/nfs/server/src/nfs-inodes.c')
| -rw-r--r-- | xlators/nfs/server/src/nfs-inodes.c | 75 |
1 files changed, 33 insertions, 42 deletions
diff --git a/xlators/nfs/server/src/nfs-inodes.c b/xlators/nfs/server/src/nfs-inodes.c index ddc1a9c0d..63d5e8a19 100644 --- a/xlators/nfs/server/src/nfs-inodes.c +++ b/xlators/nfs/server/src/nfs-inodes.c @@ -1,20 +1,11 @@ /* - Copyright (c) 2010 Gluster, Inc. <http://www.gluster.com> + Copyright (c) 2010-2011 Gluster, Inc. <http://www.gluster.com> This file is part of GlusterFS. - GlusterFS is free software; you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published - by the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - GlusterFS is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see - <http://www.gnu.org/licenses/>. + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. */ #ifndef _CONFIG_H @@ -36,7 +27,7 @@ do { \ nflocal = fram->local; \ fram->local = nflocal->proglocal; \ - pcbk = nflocal->progcbk; \ + *VOID(&pcbk) = nflocal->progcbk; \ nfs_fop_local_wipe (nflocal->nfsx, nflocal); \ } while (0) \ @@ -57,10 +48,10 @@ nfl_inodes_init (struct nfs_fop_local *nfl, inode_t *inode, inode_t *parent, nfl->newparent = inode_ref (newparent); if (name) - strcpy (nfl->path, name); + strncpy (nfl->path, name, NFS_NAME_MAX); if (newname) - strcpy (nfl->newpath, newname); + strncpy (nfl->newpath, newname, NFS_NAME_MAX); return; } @@ -70,7 +61,7 @@ int32_t nfs_inode_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode , struct iatt *buf, struct iatt *preparent, - struct iatt *postparent) + struct iatt *postparent, dict_t *xdata) { struct nfs_fop_local *nfl = frame->local; fop_create_cbk_t progcbk = NULL; @@ -90,7 +81,7 @@ do_not_link: inodes_nfl_to_prog_data (nfl, progcbk, frame); if (progcbk) progcbk (frame, cookie, this, op_ret, op_errno, fd, inode, buf, - preparent, postparent); + preparent, postparent, xdata); if (linked_inode) { inode_lookup (linked_inode); @@ -142,7 +133,7 @@ int32_t nfs_inode_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *buf, struct iatt *preparent, - struct iatt *postparent) + struct iatt *postparent, dict_t *xdata) { struct nfs_fop_local *nfl = frame->local; fop_mkdir_cbk_t progcbk = NULL; @@ -157,7 +148,7 @@ do_not_link: inodes_nfl_to_prog_data (nfl, progcbk, frame); if (progcbk) progcbk (frame, cookie, this, op_ret, op_errno, inode, buf, - preparent, postparent); + preparent, postparent, xdata); if (linked_inode) { inode_lookup (linked_inode); @@ -193,7 +184,7 @@ err: int32_t nfs_inode_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, fd_t *fd) + int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) { struct nfs_fop_local *nfl = NULL; @@ -209,14 +200,14 @@ nfs_inode_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ inodes_nfl_to_prog_data (nfl, progcbk, frame); if (progcbk) - progcbk (frame, cookie, this, op_ret, op_errno, fd); + progcbk (frame, cookie, this, op_ret, op_errno, fd, xdata); return 0; } int nfs_inode_open (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, - int32_t flags, int32_t wbflags, fop_open_cbk_t cbk, void *local) + int32_t flags, fop_open_cbk_t cbk, void *local) { struct nfs_fop_local *nfl = NULL; fd_t *newfd = NULL; @@ -233,7 +224,7 @@ nfs_inode_open (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, } nfs_fop_handle_local_init (NULL, nfsx, nfl, cbk, local, ret, fd_err); - ret = nfs_fop_open (nfsx, xl, nfu, loc, flags, newfd, wbflags, + ret = nfs_fop_open (nfsx, xl, nfu, loc, flags, newfd, nfs_inode_open_cbk, nfl); if (ret < 0) @@ -255,7 +246,8 @@ int32_t nfs_inode_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *buf, struct iatt *preoldparent, struct iatt *postoldparent, - struct iatt *prenewparent, struct iatt *postnewparent) + struct iatt *prenewparent, struct iatt *postnewparent, + dict_t *xdata) { struct nfs_fop_local *nfl = NULL; fop_rename_cbk_t progcbk = NULL; @@ -272,7 +264,7 @@ do_not_link: if (progcbk) progcbk (frame, cookie, this, op_ret, op_errno, buf, preoldparent, postoldparent, prenewparent, - postnewparent); + postnewparent, xdata); return 0; } @@ -305,7 +297,7 @@ int32_t nfs_inode_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *buf, struct iatt *preparent, - struct iatt *postparent) + struct iatt *postparent, dict_t *xdata) { struct nfs_fop_local *nfl = NULL; fop_link_cbk_t progcbk = NULL; @@ -321,7 +313,7 @@ do_not_link: inodes_nfl_to_prog_data (nfl, progcbk, frame); if (progcbk) progcbk (frame, cookie, this, op_ret, op_errno, inode, buf, - preparent, postparent); + preparent, postparent, xdata); if (linked_inode) { inode_lookup (linked_inode); @@ -358,7 +350,7 @@ err: int32_t nfs_inode_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *preparent, - struct iatt *postparent) + struct iatt *postparent, dict_t *xdata) { struct nfs_fop_local *nfl = NULL; fop_unlink_cbk_t progcbk = NULL; @@ -375,7 +367,7 @@ do_not_unlink: inodes_nfl_to_prog_data (nfl, progcbk, frame); if (progcbk) progcbk (frame, cookie, this, op_ret, op_errno, preparent, - postparent); + postparent, xdata); return 0; } @@ -406,7 +398,7 @@ err: int32_t nfs_inode_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *preparent, - struct iatt *postparent) + struct iatt *postparent, dict_t *xdata) { struct nfs_fop_local *nfl = NULL; fop_rmdir_cbk_t progcbk = NULL; @@ -423,7 +415,7 @@ do_not_unlink: inodes_nfl_to_prog_data (nfl, progcbk, frame); if (progcbk) progcbk (frame, cookie, this, op_ret, op_errno, preparent, - postparent); + postparent, xdata); return 0; } @@ -456,7 +448,7 @@ int32_t nfs_inode_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *buf, struct iatt *preparent, - struct iatt *postparent) + struct iatt *postparent, dict_t *xdata) { struct nfs_fop_local *nfl = NULL; fop_mknod_cbk_t progcbk = NULL; @@ -473,7 +465,7 @@ do_not_link: inodes_nfl_to_prog_data (nfl, progcbk, frame); if (progcbk) progcbk (frame, cookie, this, op_ret, op_errno, inode, buf, - preparent, postparent); + preparent, postparent, xdata); if (linked_inode) { inode_lookup (linked_inode); @@ -513,7 +505,7 @@ int32_t nfs_inode_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *buf, struct iatt *preparent, - struct iatt *postparent) + struct iatt *postparent, dict_t *xdata) { struct nfs_fop_local *nfl = NULL; fop_symlink_cbk_t progcbk = NULL; @@ -529,7 +521,7 @@ do_not_link: inodes_nfl_to_prog_data (nfl, progcbk, frame); if (progcbk) progcbk (frame, cookie, this, op_ret, op_errno, inode, buf, - preparent, postparent); + preparent, postparent, xdata); if (linked_inode) { inode_lookup (linked_inode); @@ -565,21 +557,20 @@ err: int32_t nfs_inode_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, fd_t *fd) + int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) { struct nfs_fop_local *nfl = NULL; fop_open_cbk_t progcbk = NULL; - if ((op_ret == -1) && (fd)) - fd_unref (fd); - else + if (op_ret != -1) fd_bind (fd); inodes_nfl_to_prog_data (nfl, progcbk, frame); if (progcbk) - progcbk (frame, cookie, this, op_ret, op_errno, fd); + progcbk (frame, cookie, this, op_ret, op_errno, fd, xdata); + return 0; } |
