Thread: [Libsysio-commit] HEAD: libsysio/misc fhi.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2009-02-25 06:01:34
|
Update of /cvsroot/libsysio/libsysio/misc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7705 Modified Files: fhi.c Log Message: fhi_lookup now sets ND_NOFOLLOW; It won't follow if the last component of the passed path is a symbolic link. Index: fhi.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/misc/fhi.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1 -r1.2 --- fhi.c 4 Feb 2009 20:07:23 -0000 1.1 +++ fhi.c 25 Feb 2009 06:01:23 -0000 1.2 @@ -562,7 +562,7 @@ SYSIO_INTERFACE_NAME(fhi_lookup)(struct do { INTENT_INIT(&intent, iopmask, NULL, NULL); - err = fhi_namei(parent_fhi, path, 0, &intent, &pno); + err = fhi_namei(parent_fhi, path, ND_NOFOLLOW, &intent, &pno); if (err) break; len = fhi_load(parent_fhi->fhi_export, pno, result); |
From: Lee W. <lw...@us...> - 2009-07-28 17:00:16
|
Update of /cvsroot/libsysio/libsysio/misc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16096 Modified Files: fhi.c Log Message: fhi_unlink would unlink file that a symbolic link pointed to. Oops. Found and fixed by Jason Cope <co...@mc...>. Index: fhi.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/misc/fhi.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -b -B -p -r1.2 -r1.3 --- fhi.c 25 Feb 2009 06:01:23 -0000 1.2 +++ fhi.c 28 Jul 2009 17:00:04 -0000 1.3 @@ -792,7 +792,7 @@ SYSIO_INTERFACE_NAME(fhi_unlink)(struct err = fhi_namei(where->fhida_dir, where->fhida_path, - 0, + ND_NOFOLLOW, &intent, &pno); if (err) |
From: Lee W. <lw...@us...> - 2009-08-03 23:19:07
|
Update of /cvsroot/libsysio/libsysio/misc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25532 Modified Files: fhi.c Log Message: fhi_getdirentries64 routine failed unless somebody already had the directory open. We must always open and close it ourselves. Fixed. Index: fhi.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/misc/fhi.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -b -B -p -r1.3 -r1.4 --- fhi.c 28 Jul 2009 17:00:04 -0000 1.3 +++ fhi.c 3 Aug 2009 23:18:52 -0000 1.4 @@ -1031,7 +1031,13 @@ SYSIO_INTERFACE_NAME(fhi_getdirentries64 err = -ESTALE; break; } + + cc = _sysio_open(pno, O_RDONLY, 0); + if (cc) + break; cc = _sysio_p_filldirentries(pno, buf, nbytes, basep); + if (PNOP_CLOSE(pno) != 0) + abort(); P_PUT(pno); } while (0); |
From: Lee W. <lw...@us...> - 2009-08-04 06:04:08
|
Update of /cvsroot/libsysio/libsysio/misc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12485 Modified Files: fhi.c Log Message: In fhi_link, added a check to make sure the new pnode was not already associated. Index: fhi.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/misc/fhi.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- fhi.c 3 Aug 2009 23:18:52 -0000 1.4 +++ fhi.c 4 Aug 2009 06:03:58 -0000 1.5 @@ -889,6 +889,10 @@ SYSIO_INTERFACE_NAME(fhi_link)(struct fi &new); if (err) break; + if (new->p_base->pb_ino) { + err = -EEXIST; + break; + } err = _sysio_p_link(old, new); } while (0); if (new) @@ -901,8 +905,6 @@ SYSIO_INTERFACE_NAME(fhi_link)(struct fi fhi_link, "%d", 0); - - return err; } int |
From: Lee W. <lw...@us...> - 2009-08-17 17:50:01
|
Update of /cvsroot/libsysio/libsysio/misc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30248 Modified Files: fhi.c Log Message: Modified to use the new ND_WATNPARENT flag everywhere it's appropriate; Calls that change the name space. Index: fhi.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/misc/fhi.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- fhi.c 4 Aug 2009 06:03:58 -0000 1.5 +++ fhi.c 17 Aug 2009 17:49:40 -0000 1.6 @@ -753,7 +753,7 @@ SYSIO_INTERFACE_NAME(fhi_create)(struct err = fhi_namei(where->fhida_dir, where->fhida_path, - ND_NEGOK, + ND_NEGOK|ND_WANTPARENT, &intent, &pno); if (err) @@ -765,6 +765,7 @@ SYSIO_INTERFACE_NAME(fhi_create)(struct if (PNOP_CLOSE(pno) != 0) abort(); } while (0); + P_PUT(pno->p_parent); P_PUT(pno); } while (0); @@ -792,12 +793,13 @@ SYSIO_INTERFACE_NAME(fhi_unlink)(struct err = fhi_namei(where->fhida_dir, where->fhida_path, - ND_NOFOLLOW, + ND_NOFOLLOW|ND_WANTPARENT, &intent, &pno); if (err) break; err = _sysio_p_unlink(pno); + P_PUT(pno->p_parent); P_PUT(pno); } while (0); @@ -823,30 +825,35 @@ SYSIO_INTERFACE_NAME(fhi_rename)(struct to->fhida_dir, to->fhida_path); old = new = NULL; - INTENT_INIT(&intent, INT_UPDPARENT, NULL, NULL); do { + INTENT_INIT(&intent, INT_UPDPARENT, NULL, NULL); err = fhi_namei(from->fhida_dir, from->fhida_path, - 0, + ND_WANTPARENT, &intent, &old); if (err) break; + INTENT_INIT(&intent, INT_CREAT, NULL, NULL); err = fhi_namei(to->fhida_dir, to->fhida_path, - ND_NEGOK, + ND_NEGOK|ND_WANTPARENT, &intent, &new); if (err) break; err = _sysio_p_rename(old, new); } while (0); - if (new) + if (new) { + P_PUT(new->p_parent); P_PUT(new); - if (old) + } + if (old) { + P_PUT(old->p_parent); P_PUT(old); + } SYSIO_INTERFACE_RETURN(err, err, @@ -880,11 +887,11 @@ SYSIO_INTERFACE_NAME(fhi_link)(struct fi &old); if (err) break; - INTENT_INIT(&intent, INT_UPDPARENT, NULL, NULL); + INTENT_INIT(&intent, INT_CREAT, NULL, NULL); err = fhi_namei(to->fhida_dir, to->fhida_path, - ND_NEGOK, + ND_NEGOK|ND_WANTPARENT, &intent, &new); if (err) @@ -895,8 +902,10 @@ SYSIO_INTERFACE_NAME(fhi_link)(struct fi } err = _sysio_p_link(old, new); } while (0); - if (new) + if (new) { + P_PUT(new->p_parent); P_PUT(new); + } if (old) P_PUT(old); @@ -926,12 +935,13 @@ SYSIO_INTERFACE_NAME(fhi_symlink)(struct err = fhi_namei(from->fhida_dir, from->fhida_path, - ND_NEGOK, + ND_NEGOK|ND_WANTPARENT, &intent, &pno); if (err) break; err = _sysio_p_symlink(to, pno); + P_PUT(pno->p_parent); P_PUT(pno); } while (0); @@ -961,12 +971,13 @@ SYSIO_INTERFACE_NAME(fhi_mkdir)(struct f err = fhi_namei(where->fhida_dir, where->fhida_path, - ND_NEGOK, + ND_NEGOK|ND_WANTPARENT, &intent, &pno); if (err) break; err = _sysio_mkdir(pno, mode); + P_PUT(pno->p_parent); P_PUT(pno); } while (0); @@ -994,12 +1005,13 @@ SYSIO_INTERFACE_NAME(fhi_rmdir)(struct f err = fhi_namei(where->fhida_dir, where->fhida_path, - 0, + ND_WANTPARENT, &intent, &pno); if (err) return err; err = _sysio_p_rmdir(pno); + P_PUT(pno->p_parent); P_PUT(pno); } while (0); |
From: Lee W. <lw...@us...> - 2009-08-17 23:04:34
|
Update of /cvsroot/libsysio/libsysio/misc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32383 Modified Files: fhi.c Log Message: Both the getattr and rmdir routines could return early without going through SYSIO_INTERFACE_RETURN. This had the unfortunate side-effect of leaving the biglock in the locked state :( Fixed. Index: fhi.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/misc/fhi.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -b -B -p -r1.6 -r1.7 --- fhi.c 17 Aug 2009 17:49:40 -0000 1.6 +++ fhi.c 17 Aug 2009 23:04:25 -0000 1.7 @@ -417,10 +417,13 @@ SYSIO_INTERFACE_NAME(fhi_getattr)(struct "%hY", fhi); + err = 0; do { err = find_alias(fhi, &pno); - if (err) - return -ESTALE; + if (err) { + err = -ESTALE; + break; + } (void )memset(buf, 0, sizeof(struct stat64)); buf->st_dev = pno->p_base->pb_ino->i_stbuf.st_dev; @@ -1009,7 +1012,7 @@ SYSIO_INTERFACE_NAME(fhi_rmdir)(struct f &intent, &pno); if (err) - return err; + break; err = _sysio_p_rmdir(pno); P_PUT(pno->p_parent); P_PUT(pno); |
From: Lee W. <lw...@us...> - 2009-12-07 22:00:33
|
Update of /cvsroot/libsysio/libsysio/misc In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv2260/misc Modified Files: fhi.c Log Message: Added ifsync and ifdatasync. These are asynchronous versions of the standard calls. In fact, the core has been reworked so that the async versions are the core implementation. For backward compatibility, if your driver has old versions you may set the new inop_isync ad inop_idatasync fields to NULL and retain the old interface and, synchronous, semantics. The existing fields were renamed to inop_old_sync and inop_old_datasync and will be deprecated in the future. One important, related, change is that the ioctx record has a new field, called ioctx_args, which is a void * type. It's only used to pass the real function to call aby the code that is faking the async API but using the old fsync and fdatasync. Index: fhi.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/misc/fhi.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -b -B -p -r1.9 -r1.10 --- fhi.c 21 Sep 2009 14:53:05 -0000 1.9 +++ fhi.c 7 Dec 2009 22:00:23 -0000 1.10 @@ -637,6 +637,7 @@ iio64x(int (*f)(struct ioctx *), iov, iov_count, NULL, xtv, xtv_count, NULL, NULL, NULL, + NULL, ioctxp); if (err) { if (err == -EBADF) |
From: Lee W. <lw...@us...> - 2009-12-17 17:41:26
|
Update of /cvsroot/libsysio/libsysio/misc In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv20980/misc Modified Files: fhi.c Log Message: Fixed for 32-bit build. The 64-bit getdirentries routines in both the regular source and the file handles interface assumed 64-bit _SYSIO_OFF_T. Fixed, now. They will return (-1, EINVAL) if given a base pointer outside what is supported by the internal offset. Index: fhi.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/misc/fhi.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -b -B -p -r1.10 -r1.11 --- fhi.c 7 Dec 2009 22:00:23 -0000 1.10 +++ fhi.c 17 Dec 2009 17:41:17 -0000 1.11 @@ -1031,8 +1031,9 @@ ssize_t SYSIO_INTERFACE_NAME(fhi_getdirentries64)(struct file_handle_info *fhi, char *buf, size_t nbytes, - off_t * __restrict basep) + off64_t * __restrict basep) { + _SYSIO_OFF_T ibase; struct pnode *pno; int err; ssize_t cc; @@ -1045,6 +1046,11 @@ SYSIO_INTERFACE_NAME(fhi_getdirentries64 basep); do { + ibase = *basep; + if (ibase != *basep) { + cc =- EINVAL; + break; + } err = find_alias(fhi, &pno); if (err) { cc = -ESTALE; @@ -1054,10 +1060,13 @@ SYSIO_INTERFACE_NAME(fhi_getdirentries64 cc = _sysio_open(pno, O_RDONLY, 0); if (cc) break; - cc = _sysio_p_filldirentries(pno, buf, nbytes, basep); + cc = _sysio_p_filldirentries(pno, buf, nbytes, &ibase); if (PNOP_CLOSE(pno) != 0) abort(); P_PUT(pno); + if (cc < 0) + break; + *basep = ibase; } while (0); SYSIO_INTERFACE_RETURN(cc, |