Thread: [Libsysio-commit] HEAD: libsysio/src link.c
Brought to you by:
lward
From: Ruth K. <rk...@us...> - 2003-10-20 21:06:21
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv7563 Modified Files: link.c Log Message: fix link - was returning EEXIST always Index: link.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/link.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1 -r1.2 --- link.c 27 Sep 2003 19:42:03 -0000 1.1 +++ link.c 20 Oct 2003 16:31:23 -0000 1.2 @@ -72,7 +72,7 @@ link(const char *oldpath, const char *ne err = _sysio_namei(_sysio_cwd, newpath, ND_NEGOK, &intent, &new); if (err && !new) goto error2; - if (!err || (err && err != -ENOENT)) { + if (err && err != -ENOENT) { err = -EEXIST; goto error1; } |
From: Lee W. <lw...@us...> - 2004-04-27 16:03:26
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31471 Modified Files: link.c Log Message: From Cray SPR 728648; LINK() IS NOT ALWAYS RETURNING -1 ON ERROR Fix from Kevin Pedretti. Namei failures jumped to the exit point without setting an error/errno appropriately. Index: link.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/link.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- link.c 14 Feb 2004 19:42:59 -0000 1.4 +++ link.c 27 Apr 2004 16:03:17 -0000 1.5 @@ -96,11 +96,11 @@ error2: P_RELE(new); error1: P_RELE(old); +out: if (err) { errno = -err; err = -1; } -out: return err; } |
From: Lee W. <lw...@us...> - 2009-08-03 17:47:57
|
Update of /cvsroot/libsysio/libsysio/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13658 Modified Files: link.c Log Message: Removed redundant copy of _sysio_p_unlink, it's also in unlink.c How did this creep in? Did we move it and forget to delete the old? Anyway, it's gone now. Index: link.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/link.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -b -B -p -r1.17 -r1.18 --- link.c 28 Jan 2009 16:13:19 -0000 1.17 +++ link.c 3 Aug 2009 17:47:42 -0000 1.18 @@ -87,34 +87,6 @@ _sysio_p_link(struct pnode *old, struct } /* - * Perform unlink operation on some pnode. - */ -int -_sysio_p_unlink(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 -EISDIR; - /* - * Call the FS implementation. - */ - err = PNOP_UNLINK(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 symlink operation; oldpath to new. */ int |
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) { |
From: Lee W. <lw...@us...> - 2009-08-04 05:52:32
|
Update of /cvsroot/libsysio/libsysio/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10579 Modified Files: link.c Log Message: Weird thred-safe logic removed; I'll desl with it later when I get after the big lock. Modified to work with the new PB_SET_ASSOC logic. Index: link.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/link.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -w -b -B -p -r1.19 -r1.20 --- link.c 3 Aug 2009 17:55:27 -0000 1.19 +++ link.c 4 Aug 2009 05:52:23 -0000 1.20 @@ -82,7 +82,7 @@ _sysio_p_link(struct pnode *old, struct if (err) return err; PB_SET_ASSOC(new->p_base, old->p_base->pb_ino); - I_REF(new->p_base->pb_ino); + I_GET(new->p_base->pb_ino); return 0; } @@ -103,28 +103,21 @@ SYSIO_INTERFACE_NAME(link)(const char *o _sysio_namei(_sysio_cwd, oldpath, 0, &intent, &old); if (err) break; - P_REF(old); - P_PUT(old); INTENT_INIT(&intent, INT_UPDPARENT, NULL, NULL); err = _sysio_namei(_sysio_cwd, newpath, ND_NEGOK, &intent, &new); if (err) break; - P_REF(new); - P_PUT(new); if (new->p_base->pb_ino) { err = -EEXIST; break; } - _sysio_p_get2(old, new->p_parent); err = _sysio_p_link(old, new); - P_PUT(new->p_parent); - P_PUT(old); } while (0); if (new) - P_RELE(new); + P_PUT(new); if (old) - P_RELE(old); + P_PUT(old); SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, link, "%d", 0); } |