[Libsysio-commit] HEAD: libsysio/src link.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2009-08-03 17:55:36
|
Update of /cvsroot/libsysio/libsysio/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14443 Modified Files: link.c Log Message: Oh heck! Redundant implementations of _sysio_p_{rmdir,symlink,rename} removed, just like the previous check-in. Index: link.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/link.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -w -b -B -p -r1.18 -r1.19 --- link.c 3 Aug 2009 17:47:42 -0000 1.18 +++ link.c 3 Aug 2009 17:55:27 -0000 1.19 @@ -9,7 +9,7 @@ * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * - * Cplant(TM) Copyright 1998-2007 Sandia Corporation. + * Cplant(TM) Copyright 1998-2009 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States @@ -36,7 +36,7 @@ * Lee Ward * Sandia National Laboratories, New Mexico * P.O. Box 5800 - * Albuquerque, NM 87185-1110 + * Albuquerque, NM 87185-1319 * * le...@sa... */ @@ -86,133 +86,6 @@ _sysio_p_link(struct pnode *old, struct return 0; } -/* - * Perform symlink operation; oldpath to new. - */ -int -_sysio_p_symlink(const char *oldpath, struct pnode *new) -{ - - if (new->p_base->pb_ino) - return -EEXIST; - if (IS_RDONLY(new->p_parent)) - return -EROFS; - return PNOP_SYMLINK(new, oldpath); -} - -/* - * Perform remove directory operation on some pnode. - */ -int -_sysio_p_rmdir(struct pnode *pno) -{ - int err; - - if (IS_RDONLY(pno)) - return -EROFS; - if (!pno->p_base->pb_ino) - return -ENOENT; /* huh? */ - if (!S_ISDIR(pno->p_base->pb_ino->i_stbuf.st_mode)) - return -ENOTDIR; - /* - * Don't allow unlink of a root or a mount point. - */ - if (pno->p_cover || pno->p_mount->mnt_root == pno) - return -EBUSY; - /* - * Call the FS implementation. - */ - err = PNOP_RMDIR(pno); - if (err) - return err; - /* - * Clean the namespace graphs to reflect the unlink. - */ - _sysio_i_undead(pno->p_base->pb_ino); - _sysio_pb_disconnect(pno->p_base); - return 0; -} - -/* - * Perform rename operation on some pnode. - */ -int -_sysio_p_rename(struct pnode *old, struct pnode *new) -{ - struct pnode_base *nxtpb, *pb; - int err; - - /* - * Check for rename to self. - */ - if (old == new) - return 0; - - /* - * No xdev renames please. - */ - if (old->p_mount->mnt_fs != new->p_mount->mnt_fs) - return -EXDEV; - - /* - * Must not be a read-only mount. - * - * NB: Invariant old->p_mount->mnt_fs == new->p_mount->mnt_fs. - */ - if (IS_RDONLY(new)) - return -EROFS; - - /* - * Don't allow mount points to move. - */ - if (old->p_mount->mnt_root == old || - old->p_cover || - new->p_mount->mnt_root == new) - return -EBUSY; - - /* - * Make sure the old pnode can't be found in the ancestor chain - * for the new. If it can, they are trying to move into a subdirectory - * of the old. - */ - nxtpb = new->p_base; - do { - pb = nxtpb; - nxtpb = pb->pb_key.pbk_parent; - if (pb == old->p_base) - return -EINVAL; - } while (nxtpb); - - if (new->p_base->pb_ino) { - /* - * Existing entry. We're replacing the new. Make sure that's - * ok. - */ - if (S_ISDIR(new->p_base->pb_ino->i_stbuf.st_mode)) { - if (!S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)) - return -EISDIR; - } else if (S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)) - return -ENOTDIR; - } - - /* - * Give the op a try. - */ - err = PNOP_RENAME(old, new); - if (err) - return err; - /* - * Disconnect the old. - */ - _sysio_pb_disconnect(old->p_base); - /* - * Disconnect the new if positive. We want new lookups - * to find the just renamed entity. - */ - if (new->p_base->pb_ino) - _sysio_pb_disconnect(new->p_base); - return 0; -} int SYSIO_INTERFACE_NAME(link)(const char *oldpath, const char *newpath) { |