libsysio-commit Mailing List for libsysio (Page 13)
Brought to you by:
lward
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
(25) |
May
(28) |
Jun
(25) |
Jul
(30) |
Aug
(60) |
Sep
(52) |
Oct
(100) |
Nov
(15) |
Dec
(34) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(89) |
Feb
(48) |
Mar
(22) |
Apr
(59) |
May
(16) |
Jun
(15) |
Jul
(50) |
Aug
(26) |
Sep
(40) |
Oct
(27) |
Nov
(12) |
Dec
|
2005 |
Jan
(24) |
Feb
(11) |
Mar
|
Apr
|
May
(3) |
Jun
(6) |
Jul
|
Aug
(14) |
Sep
(21) |
Oct
(10) |
Nov
|
Dec
|
2006 |
Jan
(8) |
Feb
(5) |
Mar
(2) |
Apr
(6) |
May
(11) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2007 |
Jan
(3) |
Feb
(5) |
Mar
(20) |
Apr
(41) |
May
(21) |
Jun
(3) |
Jul
(5) |
Aug
(12) |
Sep
(21) |
Oct
(5) |
Nov
(16) |
Dec
|
2008 |
Jan
|
Feb
(2) |
Mar
(4) |
Apr
(23) |
May
|
Jun
(22) |
Jul
(13) |
Aug
|
Sep
|
Oct
(9) |
Nov
(3) |
Dec
(13) |
2009 |
Jan
(14) |
Feb
(10) |
Mar
(2) |
Apr
(11) |
May
(7) |
Jun
(1) |
Jul
(1) |
Aug
(36) |
Sep
(12) |
Oct
|
Nov
|
Dec
(10) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: Lee W. <lw...@us...> - 2007-04-12 19:15:41
|
Update of /cvsroot/libsysio/libsysio/drivers/incore In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv25122/drivers/incore Modified Files: fs_incore.c Log Message: Too small a buffer passed would result in a premature EOF. Per Cray SPR #734717. The directory enumeration routine now tracks the number of valid copies it could have made. The filldirentries routine now checks that counter. If non-zero but no data was copied, it will return the proper "invalid argument" error. Index: fs_incore.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/incore/fs_incore.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -w -b -B -p -r1.27 -r1.28 --- fs_incore.c 14 Mar 2007 19:14:33 -0000 1.27 +++ fs_incore.c 12 Apr 2007 19:15:37 -0000 1.28 @@ -954,20 +954,29 @@ incore_directory_position(struct intnl_d struct copy_info { void *data; size_t nbytes; + unsigned count; }; /* * Eumeration callback. * * Note: - * On those systems supporting white-out entries, they are returned. On - * systems without, they are not. + * Whiteout entries are never returned. */ static void * incore_directory_enumerate(struct intnl_dirent *de, size_t reclen, struct copy_info *cinfo) { +#ifdef DT_WHT + if (de->d_type == DT_WHT) { + /* + * Keep going but skip the copy. + */ + return NULL; + } +#endif + cinfo->count++; if (reclen > cinfo->nbytes) return de; (void *)memcpy(cinfo->data, de, reclen); @@ -1006,6 +1015,7 @@ _sysio_incore_dirop_filldirentries(struc copy_info.data = buf; copy_info.nbytes = nbytes; + copy_info.count = 0; off = (char *)de - (char *)icino->ici_data; de = incore_directory_probe(de, @@ -1014,10 +1024,14 @@ _sysio_incore_dirop_filldirentries(struc (probe_ty )incore_directory_enumerate, NULL, ©_info); - nbytes -= copy_info.nbytes; icino->ici_st.st_atime = time(NULL); + if (nbytes == copy_info.nbytes && copy_info.count) + return -EINVAL; + nbytes -= copy_info.nbytes; +#if 0 if (!nbytes) return -EOVERFLOW; +#endif *posp += nbytes; return (ssize_t )nbytes; } |
From: Lee W. <lw...@us...> - 2007-04-12 18:01:26
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv26307/src Modified Files: rw.c Log Message: Use F_CHKRW macro to test desired access. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -w -b -B -p -r1.16 -r1.17 --- rw.c 25 Jan 2005 00:37:14 -0000 1.16 +++ rw.c 12 Apr 2007 18:01:23 -0000 1.17 @@ -105,9 +105,7 @@ _sysio_iiox(int (*f)(struct inode *, str /* * Check that it was opened with flags supporting the operation. */ - if (!(wr - ? (fil->f_flags & (O_RDWR | O_WRONLY)) - : !(fil->f_flags & O_WRONLY))) + if (!F_CHKRW(fil, wr ? 'w' : 'r')) return -EBADF; ino = fil->f_ino; |
From: Lee W. <lw...@us...> - 2007-04-12 18:00:49
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv25748/src Modified Files: truncate.c Log Message: F_CHKRW macro in file.h was improperly implemented. Not according to comment. From Bob Glossman at Cray. Reimplemented and new implementation used in truncate.c Index: truncate.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/truncate.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -b -B -p -r1.14 -r1.15 --- truncate.c 10 Apr 2006 23:25:54 -0000 1.14 +++ truncate.c 12 Apr 2007 18:00:42 -0000 1.15 @@ -136,9 +136,10 @@ PREPEND(_, SYSIO_INTERFACE_NAME(ftruncat err = -EBADF; goto out; } - err = F_CHKRW(fil, 'w'); - if (err) + if (!F_CHKRW(fil, 'w')) { + err = -EBADF; goto out; + } err = do_truncate(NULL, fil->f_ino, length); out: SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); |
From: Lee W. <lw...@us...> - 2007-04-12 18:00:49
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv25748/include Modified Files: file.h Log Message: F_CHKRW macro in file.h was improperly implemented. Not according to comment. From Bob Glossman at Cray. Reimplemented and new implementation used in truncate.c Index: file.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/file.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -w -b -B -p -r1.16 -r1.17 --- file.h 3 May 2006 22:34:46 -0000 1.16 +++ file.h 12 Apr 2007 18:00:42 -0000 1.17 @@ -115,15 +115,17 @@ struct file { /* * Determine if a file may be read/written. * - * Given a ptr to an open file table entry and a flag indicating read or - * write return 0 if the file record indicates that the access is permitted - * or -EBADF, if not. + * Given a ptr to an open file table entry and a flag indicating desired + * access return non-zero if the file record indicates that the access is + * permitted or zero, if not. + * + * 'r' for read access check + * 'w' for write access check */ #define F_CHKRW(_fil, _c) \ - (((_c) == O_RDONLY && \ - ((_fil)->f_flags & O_RDONLY || (_fil)->f_flags & O_RDWR)) || \ - ((_fil)->f_flags & O_WRONLY || (_fil)->f_flags & O_RDWR)) + (((_c) == 'r' && !((_fil)->f_flags & O_WRONLY)) || \ + ((_c) == 'w' && ((_fil)->f_flags & (O_WRONLY | O_RDWR)))) struct ioctx; |
From: Lee W. <lw...@us...> - 2007-04-12 17:27:57
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv13033 Modified Files: Tag: unification mount.c Log Message: Modified to work with the new graph architecture semantics. Index: mount.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mount.c,v retrieving revision 1.21.4.2 retrieving revision 1.21.4.3 diff -u -w -b -B -p -r1.21.4.2 -r1.21.4.3 --- mount.c 10 Apr 2007 21:25:31 -0000 1.21.4.2 +++ mount.c 12 Apr 2007 17:27:53 -0000 1.21.4.3 @@ -166,13 +166,8 @@ _sysio_do_mount(struct filesys *fs, goto error; } /* - * It may have been a while since the root inode was validated; - * better validate again. And it better be a directory! + * It better be a directory! */ - err = _sysio_p_validate(mnt->mnt_root, NULL, NULL); - if (err) - goto error; - if (!S_ISDIR(mnt->mnt_root->p_base->pb_ino->i_stbuf.st_mode)) { err = -ENOTDIR; goto error; @@ -198,7 +193,7 @@ _sysio_do_mount(struct filesys *fs, error: if (mnt->mnt_root) { P_RELE(mnt->mnt_root); - _sysio_p_prune(mnt->mnt_root); + _sysio_p_gone(mnt->mnt_root); } free(mnt); return err; @@ -211,6 +206,7 @@ int _sysio_do_unmount(struct mount *mnt) { struct pnode *root; + struct pnode_base *rootpb; struct filesys *fs; root = mnt->mnt_root; @@ -241,7 +237,10 @@ _sysio_do_unmount(struct mount *mnt) */ P_RELE(root); root->p_cover = NULL; + rootpb = root->p_base; _sysio_p_gone(root); + if (!(rootpb->pb_aliases.lh_first || rootpb->pb_children.lh_first)) + _sysio_pb_gone(rootpb); /* * Release mount record resource. */ @@ -370,6 +369,7 @@ SYSIO_INTERFACE_NAME(umount)(const char { int err; struct pnode *pno; + struct mount *mnt; SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER(umount, target); @@ -379,7 +379,12 @@ SYSIO_INTERFACE_NAME(umount)(const char err = _sysio_namei(_sysio_cwd, target, 0, NULL, &pno); if (err) goto out; + mnt = pno->p_mount; + if (!err && mnt->mnt_root != pno) + err = -EINVAL; P_RELE(pno); /* was ref'd */ + if (err) + goto out; /* * Do the deed. @@ -390,8 +395,7 @@ SYSIO_INTERFACE_NAME(umount)(const char goto error; } #endif - assert(pno->p_mount); - err = _sysio_do_unmount(pno->p_mount); + err = _sysio_do_unmount(mnt); out: SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, umount, 0); @@ -419,23 +423,9 @@ _sysio_unmount_all() */ if (!_sysio_p_prune(pno)) continue; -#ifdef notdef - /* - * Need a ref but only if this is not the root of a - * disconnected graph. If it is, then it is covered by itself - * and, so, already referenced. - */ - if (pno->p_cover != pno) - P_REF(pno); -#endif err = _sysio_do_unmount(mnt); - if (err) { -#ifdef notdef - if (pno->p_cover != pno) - P_RELE(pno); -#endif + if (err) break; - } if (pno == _sysio_root) _sysio_root = NULL; } |
From: Lee W. <lw...@us...> - 2007-04-12 17:27:02
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv12084 Modified Files: Tag: unification rw.c Log Message: Rewritten to work with file handles by pnode, new graph architecture semantics and to reduce redundant code paths. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.16.4.1 retrieving revision 1.16.4.2 diff -u -w -b -B -p -r1.16.4.1 -r1.16.4.2 --- rw.c 5 Feb 2007 15:54:28 -0000 1.16.4.1 +++ rw.c 12 Apr 2007 17:26:58 -0000 1.16.4.2 @@ -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... */ @@ -44,6 +44,7 @@ #include <stdlib.h> #include <unistd.h> [...1940 lines suppressed...] +SYSIO_INTERFACE_NAME(read)(int fd, void *buf, size_t count) { - SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; - SYSIO_INTERFACE_RETURN(-1, -ENOSYS); + return _do_io(fd, SYSIO_INTERFACE_NAME(iread), buf, count); +} + +ssize_t +SYSIO_INTERFACE_NAME(write)(int fd, const void *buf, size_t count) +{ + + return _do_io(fd, + (ioid_t (*)(int, + void *, + size_t))SYSIO_INTERFACE_NAME(iwrite), + (void *)buf, count); } -#endif |
From: Lee W. <lw...@us...> - 2007-04-12 17:13:33
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3117 Modified Files: Tag: unification inode.c mount.c rw.c Log Message: _sysio_p_validate will now disconnect the sub-graph if the validation fails. _sysio_pb_disconnect moved up in the file to provide a forward declaration for _sysio_p_validate. _sysio_p_rename modified so as not to use prune as some sort of a test. The sub-tree is simply disconnected. This can have weird results on stateless file system client implementations. They would need something like NFS's silly delete to preserve access to open files, of course. Index: inode.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/inode.c,v retrieving revision 1.25.2.2 retrieving revision 1.25.2.3 diff -u -w -b -B -p -r1.25.2.2 -r1.25.2.3 --- inode.c 11 Apr 2007 20:44:14 -0000 1.25.2.2 +++ inode.c 12 Apr 2007 17:13:30 -0000 1.25.2.3 @@ -447,6 +447,30 @@ _sysio_pb_gone(struct pnode_base *pb) } /* + * Clean up the namespace graph after an unlink. + */ +static void +_sysio_pb_disconnect(struct pnode_base *pb) +{ + struct pnode *pno; + + /* + * Disconnect all aliases associated with the referenced base node. + */ + pno = pb->pb_aliases.lh_first; + do { + pno->p_parent = NULL; + } while ((pno = pno->p_links.le_next)); + /* + * Remove name from the names cache so that it can't + * be found anymore. + */ + if (pb->pb_name.len) + LIST_REMOVE(pb, pb_names); + pb->pb_name.len = 0; +} + +/* * Generate more path (alias) nodes for the fast allocator. */ static void @@ -569,7 +593,8 @@ _sysio_p_validate(struct pnode *pno, str err = -ESTALE; I_RELE(ino); } - } + } else if (pno->p_base->pb_ino) + _sysio_pb_disconnect(pno->p_base); return err; } @@ -885,30 +910,6 @@ _sysio_p_setattr(struct pnode *pno, } /* - * Clean up the namespace graph after an unlink. - */ -static void -_sysio_pb_disconnect(struct pnode_base *pb) -{ - struct pnode *pno; - - /* - * Disconnect all aliases associated with the referenced base node. - */ - pno = pb->pb_aliases.lh_first; - do { - pno->p_parent = NULL; - } while ((pno = pno->p_links.le_next)); - /* - * Remove name from the names cache so that it can't - * be found anymore. - */ - if (pb->pb_name.len) - LIST_REMOVE(pb, pb_names); - pb->pb_name.len = 0; -} - -/* * Perform unlink operation on some pnode. */ int @@ -1010,16 +1011,6 @@ _sysio_p_rename(struct pnode *old, struc 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; - /* - * Should check that the directory is empty. We - * can't reliably depend on any check we can make - * from here, though. - * - * We can check if anything is open in the sub-tree - * though. - */ - if (_sysio_p_prune(new) != 1) - return -EBUSY; } else if (S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)) return -ENOTDIR; } @@ -1035,7 +1026,7 @@ _sysio_p_rename(struct pnode *old, struc */ _sysio_pb_disconnect(old->p_base); /* - * Discionnect the new if positive. We want new lookups + * Disconnect the new if positive. We want new lookups * to find the just renamed entity. */ if (new->p_base->pb_ino) Index: mount.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mount.c,v retrieving revision 1.21.4.3 retrieving revision 1.21.4.4 diff -u -w -b -B -p -r1.21.4.3 -r1.21.4.4 --- mount.c 12 Apr 2007 01:51:13 -0000 1.21.4.3 +++ mount.c 12 Apr 2007 17:13:30 -0000 1.21.4.4 @@ -166,14 +166,6 @@ _sysio_do_mount(struct filesys *fs, goto error; } /* - * It may have been a while since the root inode was validated; - * better validate again. - */ - err = _sysio_p_validate(mnt->mnt_root, NULL, NULL); - if (err) - goto error; - - /* * It better be a directory! */ if (!S_ISDIR(mnt->mnt_root->p_base->pb_ino->i_stbuf.st_mode)) { Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.16.4.2 retrieving revision 1.16.4.3 diff -u -w -b -B -p -r1.16.4.2 -r1.16.4.3 --- rw.c 10 Apr 2007 21:25:31 -0000 1.16.4.2 +++ rw.c 12 Apr 2007 17:13:30 -0000 1.16.4.3 @@ -106,7 +106,7 @@ _sysio_post_io(int (*f)(struct inode *in /* * Post the op. */ - err = PNOP_CALL(f, pno->p_base->pb_ino, ioctx); + err = INOP_CALL(f, pno->p_base->pb_ino, ioctx); } while (0); if (!err) { *ioctxp = ioctx; |
From: Lee W. <lw...@us...> - 2007-04-12 17:04:06
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv841 Modified Files: Tag: unification inode.h Log Message: Modified _PNOP_MKCALL macro to use the root pnode's attached inode -- Must *always* be present -- when the passed pnode has no attached inode. This should have the, now correct, effect of generating revalidations on extant nodes but applying the correct ops when the alias is not yet attached to an inode. Index: inode.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/inode.h,v retrieving revision 1.27.2.4 retrieving revision 1.27.2.5 diff -u -w -b -B -p -r1.27.2.4 -r1.27.2.5 --- inode.h 11 Apr 2007 20:46:32 -0000 1.27.2.4 +++ inode.h 12 Apr 2007 17:04:02 -0000 1.27.2.5 @@ -281,93 +281,74 @@ struct pnode { /* * Path node meta-call. */ -#define PNOP_CALL(_f, ...) \ +#define INOP_CALL(_f, ...) \ ((*_f)(__VA_ARGS__)) +#define _INOP_FUNC(_ino, _fbase) \ + ((_ino)->i_ops.inop_##_fbase) #define PNOP_FUNC(_pno, _fbase) \ - ((_pno)->p_base->pb_ino->i_ops.inop_##_fbase) + _INOP_FUNC((_pno)->p_base->pb_ino, _fbase) +#define _PNOP_CALL(_pno, _fbase, ...) \ + INOP_CALL(PNOP_FUNC((_pno), _fbase), __VA_ARGS__) #define _PNOP_MKCALL(_pno, _fbase, ...) \ ((_pno)->p_base->pb_ino \ - ? PNOP_CALL(PNOP_FUNC(_pno, _fbase), __VA_ARGS__) \ - : -ESTALE) + ? _PNOP_CALL((_pno), _fbase, __VA_ARGS__) \ + : _PNOP_CALL((_pno)->p_mount->mnt_root, _fbase, __VA_ARGS__)) + /* * Operations */ #define PNOP_LOOKUP(_pno, _inop, _intnt, _path) \ - _PNOP_MKCALL((_pno)->p_parent, lookup, \ - (_pno), (_inop), (_intnt), (_path)) + _PNOP_MKCALL((_pno), lookup, (_pno), (_inop), (_intnt), (_path)) #define PNOP_GETATTR(_pno, _stbuf) \ - _PNOP_MKCALL((_pno), getattr, \ - (_pno), (_pno)->p_base->pb_ino, (_stbuf)) + _PNOP_CALL((_pno), getattr, (_pno), (_pno)->p_base->pb_ino, (_stbuf)) #define PNOP_SETATTR(_pno, _mask, _stbuf) \ - _PNOP_MKCALL((_pno), setattr, \ + _PNOP_CALL((_pno), setattr, \ (_pno), (_pno)->p_base->pb_ino, (_mask), (_stbuf)) #define PNOP_FILLDIRENTRIES(_pno, _posp, _buf, _nbytes) \ - _PNOP_MKCALL((_pno), filldirentries, \ + _PNOP_CALL((_pno), filldirentries, \ (_pno)->p_base->pb_ino, (_posp), (_buf), (_nbytes)) #define PNOP_MKDIR(_pno, _mode) \ - _PNOP_MKCALL((_pno)->p_parent, mkdir, \ - (_pno), (_mode)) + _PNOP_MKCALL((_pno), mkdir, (_pno), (_mode)) #define PNOP_RMDIR(_pno) \ - _PNOP_MKCALL((_pno), rmdir, \ - (_pno)) + _PNOP_MKCALL((_pno), rmdir, (_pno)) #define PNOP_SYMLINK(_pno, _data) \ - _PNOP_MKCALL((_pno)->p_parent, symlink, \ - (_pno), (_data)) + _PNOP_MKCALL((_pno), symlink, (_pno), (_data)) #define PNOP_READLINK(_pno, _buf, _bufsiz) \ - _PNOP_MKCALL((_pno), readlink, \ - (_pno), (_buf), (_bufsiz)) + _PNOP_CALL((_pno), readlink, (_pno), (_buf), (_bufsiz)) #define PNOP_OPEN(_pno, _flags, _mode) \ - _PNOP_MKCALL((((_flags) & O_CREAT) ? \ - (_pno)->p_parent : \ - (_pno)), open, \ - (_pno), (_flags), (_mode)) + _PNOP_MKCALL((_pno), open, (_pno), (_flags), (_mode)) #define PNOP_CLOSE(_pno) \ - _PNOP_MKCALL((_pno), close, \ - (_pno)->p_base->pb_ino) + _PNOP_CALL((_pno), close, (_pno)->p_base->pb_ino) #define PNOP_LINK(_old, _new) \ - _PNOP_MKCALL((_old)->p_parent, link, \ - (_old), (_new)) + _PNOP_CALL((_old), link, (_old), (_new)) #define PNOP_UNLINK(_pno) \ - _PNOP_MKCALL((_pno), unlink, \ - (_pno)) + _PNOP_CALL((_pno), unlink, (_pno)) #define PNOP_RENAME(_old, _new) \ - _PNOP_MKCALL((_old)->p_parent, rename, \ - (_old), (_new)) + _PNOP_CALL((_old), rename, (_old), (_new)) #define PNOP_READ(_pno, _ioctx) \ - _PNOP_MKCALL((_pno), read, \ - (_pno)->p_base->pb_ino, (_ioctx)) + _PNOP_CALL((_pno), read, (_pno)->p_base->pb_ino, (_ioctx)) #define PNOP_WRITE(_pno, _ioctx) \ - _PNOP_MKCALL((_pno), write, \ - (_pno)->p_base->pb_ino, (_ioctx)) + _PNOP_CALL((_pno), write, (_pno)->p_base->pb_ino, (_ioctx)) #define PNOP_POS(_pno, _off) \ - _PNOP_MKCALL((_pno), pos, \ - (_pno)->p_base->pb_ino, (_off)) + _PNOP_CALL((_pno), pos, (_pno)->p_base->pb_ino, (_off)) #define PNOP_IODONE(_pno, _ioctx) \ - _PNOP_MKCALL((_pno), iodone, \ - (_ioctx)) + _PNOP_CALL((_pno), iodone, (_ioctx)) #define PNOP_FCNTL(_pno, _cmd, _ap, _rtn) \ - _PNOP_MKCALL((_pno), fcntl, \ - (_pno)->p_base->pb_ino, (_cmd), (_ap), (_rtn)) + _PNOP_CALL((_pno), fcntl, (_pno)->p_base->pb_ino, (_cmd), (_ap), (_rtn)) #define PNOP_SYNC(_pno) \ - _PNOP_MKCALL((_pno), sync, \ - (_pno)->p_base->pb_ino) + _PNOP_CALL((_pno), sync, (_pno)->p_base->pb_ino) #define PNOP_DATASYNC(_pno) \ - _PNOP_MKCALL((_pno), datasync, \ - (_pno)->p_base->pb_ino) + _PNOP_CALL((_pno), datasync, (_pno)->p_base->pb_ino) #define PNOP_IOCTL(_pno, _request, _ap) \ - _PNOP_MKCALL((_pno), ioctl, \ - (_pno)->p_base->pb_ino, (_request), (_ap)) + _PNOP_CALL((_pno), ioctl, (_pno)->p_base->pb_ino, (_request), (_ap)) #define PNOP_MKNOD(_pno, _mode, _dev) \ - _PNOP_MKCALL((_pno)->p_parent, mknod, \ - (_pno), (_mode), (_dev)) + _PNOP_MKCALL((_pno), mknod, (_pno), (_mode), (_dev)) #ifdef _HAVE_STATVFS #define PNOP_STATVFS(_pno, _buf) \ - _PNOP_MKCALL((_pno), statvfs, \ - (_pno), (_pno)->p_base->pb_ino, (_buf)) + _PNOP_CALL((_pno), statvfs, (_pno), (_pno)->p_base->pb_ino, (_buf)) #endif #define PNOP_GONE(_pno) \ - _PNOP_MKCALL((_pno), gone, \ - (_pno)->p_base->pb_ino) + _PNOP_CALL((_pno), gone, (_pno)->p_base->pb_ino) /* * An intent record allows callers of namei and lookup to pass some information |
From: Lee W. <lw...@us...> - 2007-04-12 17:00:59
|
Update of /cvsroot/libsysio/libsysio/drivers/incore In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv32364 Modified Files: Tag: unification fs_incore.c Log Message: Need to provide a lookup for files as well now. The _sysio_p_find_alias routine will try to validate them. Previously, we just forwarded to the library-supplied illop() routine. Which resulted in a nice abort. Index: fs_incore.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/incore/fs_incore.c,v retrieving revision 1.24 retrieving revision 1.24.4.1 diff -u -w -b -B -p -r1.24 -r1.24.4.1 --- fs_incore.c 4 Aug 2005 20:17:09 -0000 1.24 +++ fs_incore.c 12 Apr 2007 17:00:55 -0000 1.24.4.1 @@ -212,11 +212,10 @@ static struct inode_ops _sysio_incore_di _sysio_incore_inop_gone }; -#define _sysio_incore_filop_lookup \ - (int (*)(struct pnode *, \ - struct inode **, \ - struct intent *, \ - const char *))_sysio_do_illop +static int _sysio_incore_filop_lookup(struct pnode *pno, + struct inode **inop, + struct intent *intnt, + const char *path); #define _sysio_incore_filop_filldirentries \ (ssize_t (*)(struct inode *, \ _SYSIO_OFF_T *, \ @@ -866,6 +865,26 @@ out: } static int +_sysio_incore_filop_lookup(struct pnode *pno __IS_UNUSED, + struct inode **inop, + struct intent *intnt __IS_UNUSED, + const char *path __IS_UNUSED) +{ + struct incore_inode *icino; + + /* + * We revalidate only. + */ + if (!*inop) + return -ENOTDIR; + + icino = I2IC(*inop); + assert(icino); + (*inop)->i_stbuf = icino->ici_st; + return 0; +} + +static int _sysio_incore_inop_getattr(struct pnode *pno, struct inode *ino, struct intnl_stat *stbuf) |
From: Lee W. <lw...@us...> - 2007-04-12 16:58:54
|
Update of /cvsroot/libsysio/libsysio/misc In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv31916 Modified Files: Tag: unification init-env.sh Log Message: Grrr. Permissions. Will be glad when we integrate with the head and the owner of all these mounts and directories becomes the caller. Index: init-env.sh =================================================================== RCS file: /cvsroot/libsysio/libsysio/misc/init-env.sh,v retrieving revision 1.6 retrieving revision 1.6.8.1 diff -u -w -b -B -p -r1.6 -r1.6.8.1 --- init-env.sh 14 Oct 2004 14:59:29 -0000 1.6 +++ init-env.sh 12 Apr 2007 16:58:51 -0000 1.6.8.1 @@ -15,15 +15,15 @@ if [ "x${SYSIO_AUTOMOUNT}" == "xyes" ]; # file system. Further automounts in the sub-mounts are not enabled. # _extras=" \ - {mnt, dev=\"incore:0755+0+0\",dir=\"/mnt\",fl=2} \ - {creat, ft=dir,nm=\"/mnt/home\",pm=04755,ow=0,gr=0} \ + {mnt, dev=\"incore:0777+0+0\",dir=\"/mnt\",fl=2} \ + {creat, ft=dir,nm=\"/mnt/home\",pm=04777} \ {creat, ft=file,nm=\"/mnt/home/.mount\",pm=0600, \ str=\"native:/home\"} \ " fi export SYSIO_NAMESPACE="\ {mnt, dev=\"native:/\",dir=/,fl=${_root_flags:-0}} \ - {mnt, dev=\"incore:0755+0+0\",dir=\"/dev\"} \ + {mnt, dev=\"incore:0777+0+0\",dir=\"/dev\"} \ {creat, ft=chr,nm=\"/dev/stdin\",pm=0400,mm=0+0} \ {creat, ft=chr,nm=\"/dev/stdout\",pm=0200,mm=0+1} \ {creat, ft=chr,nm=\"/dev/stderr\",pm=0200,mm=0+2} \ |
From: Lee W. <lw...@us...> - 2007-04-12 02:37:53
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3445 Modified Files: Tag: unification test_mkdir.c Log Message: Call to mkdir had perms 777. Um, that needs to be 0777. Index: test_mkdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_mkdir.c,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -w -b -B -p -r1.1 -r1.1.2.1 --- test_mkdir.c 3 May 2006 22:31:04 -0000 1.1 +++ test_mkdir.c 12 Apr 2007 02:37:49 -0000 1.1.2.1 @@ -142,7 +142,7 @@ static int do_mkdir(const char *path) { - if (SYSIO_INTERFACE_NAME(mkdir)(path, 777) != 0) { + if (SYSIO_INTERFACE_NAME(mkdir)(path, 0777) != 0) { perror(path); return -1; } |
From: Lee W. <lw...@us...> - 2007-04-12 01:51:16
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv17493 Modified Files: Tag: unification access.c chdir.c mount.c namei.c Log Message: Altered to use new _sysio_p_gone and the changes that come with NULL parent in pnodes. Index: access.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/access.c,v retrieving revision 1.13.2.1 retrieving revision 1.13.2.2 diff -u -w -b -B -p -r1.13.2.1 -r1.13.2.2 --- access.c 10 Apr 2007 21:25:30 -0000 1.13.2.1 +++ access.c 12 Apr 2007 01:51:13 -0000 1.13.2.2 @@ -75,6 +75,8 @@ _sysio_check_permission(struct pnode *pn gid_t *gids; int ngids; + assert(pno); + /* * Check amode. */ Index: chdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chdir.c,v retrieving revision 1.25.2.1 retrieving revision 1.25.2.2 diff -u -w -b -B -p -r1.25.2.1 -r1.25.2.2 --- chdir.c 10 Apr 2007 21:25:30 -0000 1.25.2.1 +++ chdir.c 12 Apr 2007 01:51:13 -0000 1.25.2.2 @@ -173,7 +173,8 @@ _sysio_p_path(struct pnode *pno, char ** * the *covered* nodes name, not this one unless we are at * the root of the name-space. */ - while (pno == pno->p_mount->mnt_root && pno != pno->p_parent ) + while (pno == pno->p_mount->mnt_root && + pno != pno->p_parent) pno = pno->p_mount->mnt_covers; /* @@ -187,7 +188,9 @@ _sysio_p_path(struct pnode *pno, char ** n++; assert(n); pno = pno->p_parent; - } while (pno != pno->p_parent); + } while (pno && pno != pno->p_parent); + if (!pno) + return -ENOENT; if (!*buf) size = len + n + 1; @@ -214,7 +217,8 @@ _sysio_p_path(struct pnode *pno, char ** * the *covered* nodes name, not this one unless we are at * the root of the name-space. */ - while (pno == pno->p_mount->mnt_root && pno != pno->p_parent ) + while (pno == pno->p_mount->mnt_root && + pno != pno->p_parent ) pno = pno->p_mount->mnt_covers; /* Index: mount.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mount.c,v retrieving revision 1.21.4.2 retrieving revision 1.21.4.3 diff -u -w -b -B -p -r1.21.4.2 -r1.21.4.3 --- mount.c 10 Apr 2007 21:25:31 -0000 1.21.4.2 +++ mount.c 12 Apr 2007 01:51:13 -0000 1.21.4.3 @@ -167,12 +167,15 @@ _sysio_do_mount(struct filesys *fs, } /* * It may have been a while since the root inode was validated; - * better validate again. And it better be a directory! + * better validate again. */ err = _sysio_p_validate(mnt->mnt_root, NULL, NULL); if (err) goto error; + /* + * It better be a directory! + */ if (!S_ISDIR(mnt->mnt_root->p_base->pb_ino->i_stbuf.st_mode)) { err = -ENOTDIR; goto error; @@ -198,7 +201,7 @@ _sysio_do_mount(struct filesys *fs, error: if (mnt->mnt_root) { P_RELE(mnt->mnt_root); - _sysio_p_prune(mnt->mnt_root); + _sysio_p_gone(mnt->mnt_root); } free(mnt); return err; @@ -211,6 +214,7 @@ int _sysio_do_unmount(struct mount *mnt) { struct pnode *root; + struct pnode_base *rootpb; struct filesys *fs; root = mnt->mnt_root; @@ -241,7 +245,10 @@ _sysio_do_unmount(struct mount *mnt) */ P_RELE(root); root->p_cover = NULL; + rootpb = root->p_base; _sysio_p_gone(root); + if (!(rootpb->pb_aliases.lh_first || rootpb->pb_children.lh_first)) + _sysio_pb_gone(rootpb); /* * Release mount record resource. */ @@ -370,6 +377,7 @@ SYSIO_INTERFACE_NAME(umount)(const char { int err; struct pnode *pno; + struct mount *mnt; SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER(umount, target); @@ -379,7 +387,12 @@ SYSIO_INTERFACE_NAME(umount)(const char err = _sysio_namei(_sysio_cwd, target, 0, NULL, &pno); if (err) goto out; + mnt = pno->p_mount; + if (!err && mnt->mnt_root != pno) + err = -EINVAL; P_RELE(pno); /* was ref'd */ + if (err) + goto out; /* * Do the deed. @@ -390,8 +403,7 @@ SYSIO_INTERFACE_NAME(umount)(const char goto error; } #endif - assert(pno->p_mount); - err = _sysio_do_unmount(pno->p_mount); + err = _sysio_do_unmount(mnt); out: SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, umount, 0); @@ -419,23 +431,9 @@ _sysio_unmount_all() */ if (!_sysio_p_prune(pno)) continue; -#ifdef notdef - /* - * Need a ref but only if this is not the root of a - * disconnected graph. If it is, then it is covered by itself - * and, so, already referenced. - */ - if (pno->p_cover != pno) - P_REF(pno); -#endif err = _sysio_do_unmount(mnt); - if (err) { -#ifdef notdef - if (pno->p_cover != pno) - P_RELE(pno); -#endif + if (err) break; - } if (pno == _sysio_root) _sysio_root = NULL; } Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.23.2.1 retrieving revision 1.23.2.2 diff -u -w -b -B -p -r1.23.2.1 -r1.23.2.2 --- namei.c 5 Feb 2007 15:54:28 -0000 1.23.2.1 +++ namei.c 12 Apr 2007 01:51:13 -0000 1.23.2.2 @@ -96,11 +96,11 @@ lookup(struct pnode *parent, assert(parent != NULL); /* - * The parent must be valid and should be connected or a root. + * The parent must be valid and a directory. */ - if (parent->p_base->pb_parent == parent->p_base) + if (!parent->p_parent) return -ENOENT; - if (!parent->p_base->pb_ino) + if (!S_ISDIR(parent->p_base->pb_ino->i_stbuf.st_mode)) return -ENOTDIR; /* @@ -119,8 +119,11 @@ lookup(struct pnode *parent, pno = NULL; if (name->len == 1 && name->name[0] == '.') pno = parent; - else if (name->len == 2 && name->name[0] == '.' && name->name[1] == '.') + else if (name->len == 2 && + name->name[0] == '.' && + name->name[1] == '.') { pno = parent->p_parent; + } if (pno) P_REF(pno); else { @@ -131,10 +134,6 @@ lookup(struct pnode *parent, if (err) return err; } - if (pno->p_base->pb_parent == pno->p_base) { - P_RELE(pno); - return -ENOENT; - } /* * While covered, move to the covering node. @@ -153,11 +152,7 @@ lookup(struct pnode *parent, /* * (Re)validate the pnode. */ - err = _sysio_p_validate(pno, intnt, path); - if (err) - return err; - - return 0; + return _sysio_p_validate(pno, intnt, path); } /* |
From: Lee W. <lw...@us...> - 2007-04-12 01:50:00
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv17042 Modified Files: Tag: unification utime.c Log Message: Name of _sysio_setattr was changed to _sysio_p_setattr. Reflecting that. Index: utime.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/utime.c,v retrieving revision 1.7.8.2 retrieving revision 1.7.8.3 diff -u -w -b -B -p -r1.7.8.2 -r1.7.8.3 --- utime.c 10 Apr 2007 21:25:31 -0000 1.7.8.2 +++ utime.c 12 Apr 2007 01:49:57 -0000 1.7.8.3 @@ -88,7 +88,7 @@ SYSIO_INTERFACE_NAME(utime)(const char * stbuf.st_atime = buf->actime; stbuf.st_mtime = buf->modtime; err = - _sysio_setattr(pno, SETATTR_ATIME | SETATTR_MTIME, &stbuf); + _sysio_p_setattr(pno, SETATTR_ATIME | SETATTR_MTIME, &stbuf); P_RELE(pno); out: SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, utime, buf); |
From: Lee W. <lw...@us...> - 2007-04-12 01:48:45
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16258 Modified Files: Tag: unification chmod.c chown.c init.c truncate.c Log Message: Reflect changed name of _sysio_setattr to _sysio_p_setattr. Index: chmod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chmod.c,v retrieving revision 1.14.10.2 retrieving revision 1.14.10.3 diff -u -w -b -B -p -r1.14.10.2 -r1.14.10.3 --- chmod.c 10 Apr 2007 21:25:30 -0000 1.14.10.2 +++ chmod.c 12 Apr 2007 01:48:40 -0000 1.14.10.3 @@ -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... */ @@ -64,7 +64,7 @@ do_chmod(struct pnode *pno, mode_t mode) (void )memset(&stbuf, 0, sizeof(struct intnl_stat)); stbuf.st_mode = mode & 07777; mask = SETATTR_MODE; - err = _sysio_setattr(pno, mask, &stbuf); + err = _sysio_p_setattr(pno, mask, &stbuf); return err; } Index: chown.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chown.c,v retrieving revision 1.13.10.2 retrieving revision 1.13.10.3 diff -u -w -b -B -p -r1.13.10.2 -r1.13.10.3 --- chown.c 10 Apr 2007 21:25:30 -0000 1.13.10.2 +++ chown.c 12 Apr 2007 01:48:41 -0000 1.13.10.3 @@ -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... */ @@ -71,7 +71,7 @@ _do_chown(struct pnode *pno, uid_t owner stbuf.st_gid = group; mask |= SETATTR_GID; } - err = _sysio_setattr(pno, mask, &stbuf); + err = _sysio_p_setattr(pno, mask, &stbuf); return err; } Index: init.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/init.c,v retrieving revision 1.30.2.2 retrieving revision 1.30.2.3 diff -u -w -b -B -p -r1.30.2.2 -r1.30.2.3 --- init.c 10 Apr 2007 21:25:31 -0000 1.30.2.2 +++ init.c 12 Apr 2007 01:48:41 -0000 1.30.2.3 @@ -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... */ @@ -825,7 +825,7 @@ do_chmd(char *args) err = _sysio_namei(dir, v[0].ovi_value, ND_NOPERMCHECK, NULL, &pno); if (err) return err; - err = _sysio_setattr(pno, SETATTR_MODE, &stbuf); + err = _sysio_p_setattr(pno, SETATTR_MODE, &stbuf); P_RELE(pno); return err; Index: truncate.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/truncate.c,v retrieving revision 1.14.2.2 retrieving revision 1.14.2.3 diff -u -w -b -B -p -r1.14.2.2 -r1.14.2.3 --- truncate.c 10 Apr 2007 21:25:31 -0000 1.14.2.2 +++ truncate.c 12 Apr 2007 01:48:41 -0000 1.14.2.3 @@ -80,7 +80,7 @@ do_truncate(struct pnode *pno, _SYSIO_OF (void )memset(&stbuf, 0, sizeof(stbuf)); stbuf.st_size = length; mask = SETATTR_LEN; - return _sysio_setattr(pno, mask, &stbuf); + return _sysio_p_setattr(pno, mask, &stbuf); } static int |
From: Lee W. <lw...@us...> - 2007-04-11 20:48:38
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv26755 Modified Files: Tag: unification unlink.c rmdir.c rename.c Log Message: New internal function supoprting this operation motivated significant change. Now, we just call namei to get path nodes and pass the buck. Index: unlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/unlink.c,v retrieving revision 1.18.2.2 retrieving revision 1.18.2.3 diff -u -w -b -B -p -r1.18.2.2 -r1.18.2.3 --- unlink.c 10 Apr 2007 21:25:31 -0000 1.18.2.2 +++ unlink.c 11 Apr 2007 20:48:35 -0000 1.18.2.3 @@ -63,26 +63,23 @@ SYSIO_INTERFACE_NAME(unlink)(const char SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER(unlink, path); + do { INTENT_INIT(&intent, INT_UPDPARENT, NULL, NULL); - err = _sysio_namei(_sysio_cwd, path, ND_NOFOLLOW, &intent, &pno); - if (err) - goto out; - + err = + _sysio_namei(_sysio_cwd, path, ND_NOFOLLOW, &intent, &pno); + if (err) { + pno = NULL; + break; + } err = _sysio_permitted(pno->p_parent, W_OK); if (err) - goto error; - - err = PNOP_UNLINK(pno); + break; + err = _sysio_p_unlink(pno); if (err) - goto error; - /* - * Disconnect the newly removed node from the graph. - */ - _sysio_pb_disconnect(pno->p_base); - -error: + break; + } while (0); + if (pno) P_RELE(pno); -out: SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, unlink, 0); } Index: rmdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rmdir.c,v retrieving revision 1.20.2.2 retrieving revision 1.20.2.3 diff -u -w -b -B -p -r1.20.2.2 -r1.20.2.3 --- rmdir.c 10 Apr 2007 21:25:31 -0000 1.20.2.2 +++ rmdir.c 11 Apr 2007 20:48:35 -0000 1.20.2.3 @@ -63,31 +63,22 @@ SYSIO_INTERFACE_NAME(rmdir)(const char * SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER(rmdir, path); + do { INTENT_INIT(&intent, INT_UPDPARENT, NULL, NULL); err = _sysio_namei(_sysio_cwd, path, 0, &intent, &pno); - if (err) - goto out; - if (!S_ISDIR(pno->p_base->pb_ino->i_stbuf.st_mode)) { - err = -ENOTDIR; - goto error; + if (err) { + pno = NULL; + break; } err = _sysio_permitted(pno->p_parent, W_OK); if (err) - goto error; - if (pno->p_ref > 1) { - err = -EBUSY; - goto error; - } - err = PNOP_RMDIR(pno); + break; + err = _sysio_p_rmdir(pno); if (err) - goto error; - /* - * Disconnect the path node from the existing graph. - */ - _sysio_pb_disconnect(pno->p_base); -error: + break; + } while (0); + if (pno) P_RELE(pno); -out: SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, rmdir, 0); } Index: rename.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rename.c,v retrieving revision 1.11.4.2 retrieving revision 1.11.4.3 diff -u -w -b -B -p -r1.11.4.2 -r1.11.4.3 --- rename.c 10 Apr 2007 21:25:31 -0000 1.11.4.2 +++ rename.c 11 Apr 2007 20:48:35 -0000 1.11.4.3 @@ -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... */ @@ -60,7 +60,6 @@ SYSIO_INTERFACE_NAME(rename)(const char struct intent intent; int err; struct pnode *old, *new; - struct pnode_base *nxtpb, *pb; SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER(rename, oldpath, newpath); @@ -71,13 +70,17 @@ SYSIO_INTERFACE_NAME(rename)(const char if (*oldpath == '\0' || *newpath == '\0') SYSIO_INTERFACE_RETURN(-1, -ENOENT, rename, 0); + old = new = NULL; + do { /* * Resolve oldpath to a path node. */ INTENT_INIT(&intent, INT_UPDPARENT, NULL, NULL); err = _sysio_namei(_sysio_cwd, oldpath, ND_NOFOLLOW, &intent, &old); - if (err) - goto error3; + if (err) { + old = NULL; + break; + } /* * Resolve newpath to a path node. */ @@ -88,97 +91,17 @@ SYSIO_INTERFACE_NAME(rename)(const char ND_NOFOLLOW | ND_NEGOK, &intent, &new); - if (err) - goto error2; - - /* - * Don't allow mount points to move. - */ - if (old->p_mount->mnt_root == old || old->p_cover || - new->p_mount->mnt_root == new) { - err = -EBUSY; - goto error1; + if (err) { + new = NULL; + break; } - /* - * No xdev renames either. - */ - if (old->p_mount->mnt_fs != new->p_mount->mnt_fs) { - err = -EXDEV; - goto error1; - } - - /* - * 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_parent; - if (pb == old->p_base) { - err = -EINVAL; - goto error1; - } - } while (nxtpb); - - /* - * If old == new, we're done. - */ - if (old->p_base->pb_ino == new->p_base->pb_ino) - goto out; - - 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)) { - err = -EISDIR; - goto error1; - } - if (new->p_base->pb_ino->i_stbuf.st_nlink > 2) { - err = -ENOTEMPTY; - goto error1; - } - } else if (S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)) { - err = -ENOTDIR; - goto error1; - } - } - - /* - * It's not impossible to clean up the altered name space after - * a rename. However, it is onerous and I don't want to do it right - * now. If it becomes an issue, we can do it later. For now, I've - * elected to use the semantic that says, basically, the entire - * sub-tree must be unreferenced. That's per POSIX, but it's a nasty - * thing to do to the caller. - */ - if (_sysio_p_prune(new) != 1) { - err = -EBUSY; - goto error1; - } - err = PNOP_RENAME(old, new); - if (err) - goto error1; - /* - * Reflect the successful rename in the active name space graph by - * "losing" the existing, relevant, parts of the graph. A subsequent - * lookup will reestablish the proper graph. - */ - _sysio_pb_disconnect(old->p_base); + err = _sysio_p_rename(old, new); + } while (0); -error1: + if (new) P_RELE(new); -error2: + if (old) P_RELE(old); -error3: - if (err) - goto out; - _sysio_p_gone(old); /* kill it! */ -out: SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, rename, 0); } |
From: Lee W. <lw...@us...> - 2007-04-11 20:46:36
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv25546 Modified Files: Tag: unification inode.h Log Message: Added prototypes for _sysio_p_unlink, _sysio_p_rmdir, and _sysio_p_rename. Changed the name of _sysio_setattr to _sysio_p_setattr for consistency. Some syntactic prettiness changes Index: inode.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/inode.h,v retrieving revision 1.27.2.3 retrieving revision 1.27.2.4 diff -u -w -b -B -p -r1.27.2.3 -r1.27.2.4 --- inode.h 10 Apr 2007 21:25:30 -0000 1.27.2.3 +++ inode.h 11 Apr 2007 20:46:32 -0000 1.27.2.4 @@ -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... */ @@ -286,10 +286,9 @@ struct pnode { #define PNOP_FUNC(_pno, _fbase) \ ((_pno)->p_base->pb_ino->i_ops.inop_##_fbase) #define _PNOP_MKCALL(_pno, _fbase, ...) \ - ((_pno)->p_base->pb_ino ? \ - PNOP_CALL(PNOP_FUNC(_pno, _fbase), __VA_ARGS__) : \ - -ESTALE) - + ((_pno)->p_base->pb_ino \ + ? PNOP_CALL(PNOP_FUNC(_pno, _fbase), __VA_ARGS__) \ + : -ESTALE) /* * Operations */ @@ -532,13 +531,18 @@ extern struct pnode *_sysio_p_new_alias( struct pnode_base *pb, struct mount *mnt); extern void _sysio_p_gone(struct pnode *pno); -extern void _sysio_pb_disconnect(struct pnode_base *pb); extern size_t _sysio_p_prune(struct pnode *root); extern int _sysio_p_kill_all(struct pnode *root); +extern int _sysio_pb_pathof(struct pnode_base *pb, + char separator, + char **pathp); extern char *_sysio_pb_path(struct pnode_base *pb, char separator); -extern int _sysio_setattr(struct pnode *pno, +extern int _sysio_p_setattr(struct pnode *pno, unsigned mask, struct intnl_stat *stbuf); +extern int _sysio_p_unlink(struct pnode *pno); +extern int _sysio_p_rmdir(struct pnode *pno); +extern int _sysio_p_rename(struct pnode *old, struct pnode *new); extern void _sysio_do_noop(void); extern void _sysio_do_illop(void); extern int _sysio_do_ebadf(void); |
From: Lee W. <lw...@us...> - 2007-04-11 20:44:20
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv25129/src Modified Files: Tag: unification inode.c Log Message: _sysio_p_gone no longer automagically kills the base path node. This to get around a problem where if a mount fails the driver expects to be responsible for cleaning up it's own mess. Disconnects are now "real" in that all aliases for a base node have their parent pointers set to NULL. _sysio_pb_disconnect no longer disconnects the path node. Instead, it removes the name from the names cache, smashes the name in the node, and sets the parent of all the aliases to NULL. _sysio_pb_disconnect is now private to this file. _sysio_p_validate will fail to validate a NULL path node or one that has no parent -- Supporting the "real" disconnects. A new routine, _sysio_pb_pathof, returns an int and will discriminate a failure. The _sysio_pb_path routine remains but is deprecated. It still returns an empty string when encountering disconnected nodes. New routines, _sysio_p_unlink, _sysio_p_rmdir, and _sysio_p_rename, support appropriate operations and manipulate the namespace graph accordingly. Index: inode.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/inode.c,v retrieving revision 1.25.2.1 retrieving revision 1.25.2.2 diff -u -w -b -B -p -r1.25.2.1 -r1.25.2.2 --- inode.c 5 Feb 2007 15:54:27 -0000 1.25.2.1 +++ inode.c 11 Apr 2007 20:44:14 -0000 1.25.2.2 @@ -344,19 +344,13 @@ p_reclaim() t = max_names / 2; do { pno = next; - if (pno->p_ref) { - next = pno->p_nodes.tqe_next; - continue; - } - pno->p_ref++; - assert(pno->p_ref); - (void )_sysio_p_prune(pno); next = pno->p_nodes.tqe_next; - assert(pno->p_ref); - pno->p_ref--; if (pno->p_ref) continue; + next->p_ref++; + assert(next->p_ref); (void )_sysio_p_prune(pno); + next->p_ref--; } while (n_names > t && next); if (n_names > t) @@ -537,39 +532,16 @@ _sysio_p_new_alias(struct pnode *parent, void _sysio_p_gone(struct pnode *pno) { - struct pnode_base *pb; - assert(!pno->p_ref); assert(!pno->p_cover); TAILQ_REMOVE(&_sysio_pnodes, pno, p_nodes); LIST_REMOVE(pno, p_links); - pb = pno->p_base; - if (!(pb->pb_aliases.lh_first || pb->pb_children.lh_first)) - _sysio_pb_gone(pb); - LIST_INSERT_HEAD(&free_pnodes, pno, p_links); } /* - * Disconnect name referenced by the given path node from our reflection of - * the graph. - */ -void -_sysio_pb_disconnect(struct pnode_base *pb) -{ - /* - * We can't really do this. Callers aren't prepared to have - * path nodes disappear out from underneath. Then, there might be - * referenced aliases. Instead, we arrange things so that the - * referenced path-base node will never be found by the graph - * search routines again. - */ - pb->pb_parent = pb; -} - -/* * (Re)Validate passed path node. */ int @@ -578,6 +550,9 @@ _sysio_p_validate(struct pnode *pno, str struct inode *ino; int err; + if (!(pno && pno->p_parent)) + return -ENOENT; + ino = pno->p_base->pb_ino; err = PNOP_LOOKUP(pno, &ino, intnt, path); if (!err) { @@ -595,21 +570,12 @@ _sysio_p_validate(struct pnode *pno, str I_RELE(ino); } } - if (err && pno->p_base->pb_ino) { - /* - * Something has gone wrong with a valid path-base node. We - * need to disconnect the underlying path-base node from the - * tree. Setting the hash value of the name to zero will - * cause the graph search routines to ignore the node. - */ - _sysio_pb_disconnect(pno->p_base); - } return err; } /* * Find (or create!) an alias for the given parent and name. A misnomer, - * really -- This is a "get". Returned path node is referenced. + * really -- This is a "lookup". Returned path node is referenced. */ int _sysio_p_find_alias(struct pnode *parent, @@ -676,6 +642,7 @@ _sysio_p_find_alias(struct pnode *parent return err; } +#if 0 /* * Prune idle path base nodes from the passed sub-tree, including the root. */ @@ -699,6 +666,7 @@ _sysio_prune(struct pnode_base *rpb) return; _sysio_pb_gone(rpb); } +#endif /* * Prune idle nodes from the passed sub-tree, including the root. @@ -718,10 +686,12 @@ _sysio_p_prune(struct pnode *root) while ((pb = nxtpb)) { nxtpb = pb->pb_sibs.le_next; nxtpno = pb->pb_aliases.lh_first; +#if 0 if (!nxtpno) { _sysio_prune(pb); continue; } +#endif while ((pno = nxtpno)) { nxtpno = pno->p_links.le_next; if (pno->p_mount != root->p_mount) { @@ -766,6 +736,9 @@ _sysio_p_prune(struct pnode *root) #endif } _sysio_p_gone(pno); + if (!(pb->pb_aliases.lh_first || + pb->pb_children.lh_first)) + _sysio_pb_gone(pb); } } @@ -773,7 +746,9 @@ _sysio_p_prune(struct pnode *root) /* * Can't get the root or we disconnect the sub-trees. */ - return count + (root->p_ref ? 1 : 0); + if (root->p_ref) + count++; + return count; } /* @@ -787,7 +762,7 @@ _sysio_p_prune(struct pnode *root) #else /* * This is an automount-point. Must - * unmount before relcaim. + * unmount before reclaim. */ P_REF(root); if (_sysio_do_unmount(root->p_mount) != 0) { @@ -795,8 +770,13 @@ _sysio_p_prune(struct pnode *root) count++; } #endif - } else + } else { + pb = root->p_base; _sysio_p_gone(root); + if (!(pb->pb_aliases.lh_first || + pb->pb_children.lh_first)) + _sysio_pb_gone(pb); + } return count; } @@ -808,8 +788,8 @@ _sysio_p_prune(struct pnode *root) * path (alias) nodes track path relative to our name space -- They cross * mount points. */ -char * -_sysio_pb_path(struct pnode_base *pb, const char separator) +int +_sysio_pb_pathof(struct pnode_base *pb, const char separator, char **pathp) { size_t len, n; struct pnode_base *tmp; @@ -828,21 +808,17 @@ _sysio_pb_path(struct pnode_base *pb, co if (n) len++; tmp = tmp->pb_parent; - } while (tmp && tmp != tmp->pb_parent); + } while (tmp); + if (tmp && !tmp->pb_name.len) + return -ENOENT; if (!len) len++; - if (tmp && tmp->pb_parent == tmp) - len = 0; /* * Alloc space. */ buf = malloc(len + 1); if (!buf) - return NULL; - if (tmp && tmp->pb_parent == tmp) { - buf[0] = '\0'; - return buf; - } + return -ENOMEM; /* * Fill in the path buffer -- Backwards, since we're starting * from the end. @@ -862,14 +838,38 @@ _sysio_pb_path(struct pnode_base *pb, co tmp = tmp->pb_parent; } while (tmp); - return buf; + *pathp = buf; + return 0; +} + +/* + * Return path tracked by the base path node ancestor chain. + * + * NB: Deprecated. + */ +char * +_sysio_pb_path(struct pnode_base *pb, const char separator) +{ + int err; + char *path; + + err = _sysio_pb_pathof(pb, separator, &path); + if (err) { + if (err == -ENOMEM) + return NULL; + path = malloc(1); + if (path == NULL) + return NULL; + *path = '\0'; + } + return path; } /* * Common set attributes routine. */ int -_sysio_setattr(struct pnode *pno, +_sysio_p_setattr(struct pnode *pno, unsigned mask, struct intnl_stat *stbuf) { @@ -885,6 +885,165 @@ _sysio_setattr(struct pnode *pno, } /* + * Clean up the namespace graph after an unlink. + */ +static void +_sysio_pb_disconnect(struct pnode_base *pb) +{ + struct pnode *pno; + + /* + * Disconnect all aliases associated with the referenced base node. + */ + pno = pb->pb_aliases.lh_first; + do { + pno->p_parent = NULL; + } while ((pno = pno->p_links.le_next)); + /* + * Remove name from the names cache so that it can't + * be found anymore. + */ + if (pb->pb_name.len) + LIST_REMOVE(pb, pb_names); + pb->pb_name.len = 0; +} + +/* + * Perform unlink operation on some pnode. + */ +int +_sysio_p_unlink(struct pnode *pno) +{ + int err; + + 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_pb_disconnect(pno->p_base); + return 0; +} + +/* + * Perform unlink operation on some pnode. + */ +int +_sysio_p_rmdir(struct pnode *pno) +{ + int err; + + 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_pb_disconnect(pno->p_base); + return 0; +} + +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; + + /* + * 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_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; + /* + * Should check that the directory is empty. We + * can't reliably depend on any check we can make + * from here, though. + * + * We can check if anything is open in the sub-tree + * though. + */ + if (_sysio_p_prune(new) != 1) + return -EBUSY; + } 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); + /* + * Discionnect 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; +} + +/* * Do nothing. */ void |
From: Lee W. <lw...@us...> - 2007-04-10 21:25:38
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9556/include Modified Files: Tag: unification inode.h sysio-cmn.h Log Message: Modified tracing to support intrumentation of tracked formals. SYSIO_INTERFACE_ENTER additionally takes a tag and a variable number of arguments. SYSIO_INTERFACE_RETURN dditionally takes a tag and a variable number of arguments. Be aware, the return code and error number are implicitly passed. Index: inode.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/inode.h,v retrieving revision 1.27.2.2 retrieving revision 1.27.2.3 diff -u -w -b -B -p -r1.27.2.2 -r1.27.2.3 --- inode.h 5 Feb 2007 16:25:24 -0000 1.27.2.2 +++ inode.h 10 Apr 2007 21:25:30 -0000 1.27.2.3 @@ -279,11 +279,15 @@ struct pnode { } while (0) /* - * Pnode meta-call. + * Path node meta-call. */ +#define PNOP_CALL(_f, ...) \ + ((*_f)(__VA_ARGS__)) +#define PNOP_FUNC(_pno, _fbase) \ + ((_pno)->p_base->pb_ino->i_ops.inop_##_fbase) #define _PNOP_MKCALL(_pno, _fbase, ...) \ ((_pno)->p_base->pb_ino ? \ - (*(_pno)->p_base->pb_ino->i_ops.inop_##_fbase)(__VA_ARGS__) : \ + PNOP_CALL(PNOP_FUNC(_pno, _fbase), __VA_ARGS__) : \ -ESTALE) /* @@ -572,5 +576,15 @@ extern int _sysio_ioctx_done(struct ioct extern ssize_t _sysio_ioctx_wait(struct ioctx *ioctx); extern void _sysio_ioctx_complete(struct ioctx *ioctx); extern int _sysio_open(struct pnode *pno, int flags, mode_t mode); +extern int _sysio_p_aread(struct pnode *pno, + _SYSIO_OFF_T off, + void *buf, + size_t count, + struct ioctx **ioctxp); +extern int _sysio_p_awrite(struct pnode *pno, + _SYSIO_OFF_T off, + void *buf, + size_t count, + struct ioctx **ioctxp); extern int _sysio_mkdir(struct pnode *where, mode_t mode); extern int _sysio_mknod(struct pnode *where, mode_t mode, dev_t dev); Index: sysio-cmn.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio-cmn.h,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -u -w -b -B -p -r1.11 -r1.11.2.1 --- sysio-cmn.h 3 May 2006 22:34:46 -0000 1.11 +++ sysio-cmn.h 10 Apr 2007 21:25:30 -0000 1.11.2.1 @@ -140,20 +140,74 @@ struct iovec; */ #define SYSIO_INTERFACE_DISPLAY_BLOCK \ int _saved_errno; -#define SYSIO_INTERFACE_ENTER \ +#define SYSIO_INTERFACE_ENTER(tag, ...) \ do { \ _saved_errno = errno; \ - SYSIO_ENTER; \ + SYSIO_ENTER(tag, __VA_ARGS__); \ } while (0) -#define SYSIO_INTERFACE_RETURN(rtn, err) \ +#define SYSIO_INTERFACE_RETURN(rtn, err, tag, ...) \ do { \ - SYSIO_LEAVE; \ + SYSIO_LEAVE(tag, (rtn), (err), __VA_ARGS__); \ errno = (err) ? -(err) : _saved_errno; \ return (rtn); \ } while(0) /* Interface enter/leave hook functions */ #if SYSIO_TRACING + +#define _SYSIO_TTAG(name) \ + PREPEND(_SYSIO_TRACING_, name) + +/* + * Supported tracing tags. + */ +typedef enum { + _SYSIO_TTAG(unsupported) = -1, + _SYSIO_TTAG(access), + _SYSIO_TTAG(chdir), + _SYSIO_TTAG(getcwd), + _SYSIO_TTAG(chmod), + _SYSIO_TTAG(fchmod), + _SYSIO_TTAG(chown), + _SYSIO_TTAG(fchown), + _SYSIO_TTAG(dup2), + _SYSIO_TTAG(dup), + _SYSIO_TTAG(vfcntl), + _SYSIO_TTAG(fsync), + _SYSIO_TTAG(fdatasync), + _SYSIO_TTAG(getdirentries64), + _SYSIO_TTAG(getdirentries), + _SYSIO_TTAG(ioctl), + _SYSIO_TTAG(iodone), + _SYSIO_TTAG(iowait), + _SYSIO_TTAG(link), + _SYSIO_TTAG(lseek64), + _SYSIO_TTAG(lseek), + _SYSIO_TTAG(llseek), + _SYSIO_TTAG(mkdir), + _SYSIO_TTAG(xmknod), + _SYSIO_TTAG(mount), + _SYSIO_TTAG(umount), + _SYSIO_TTAG(open), + _SYSIO_TTAG(close), + _SYSIO_TTAG(ireadx), + _SYSIO_TTAG(iwritex), + _SYSIO_TTAG(ireadv), + _SYSIO_TTAG(iwritev), + _SYSIO_TTAG(rename), + _SYSIO_TTAG(rmdir), + _SYSIO_TTAG(xstatnd), + _SYSIO_TTAG(fxstat), + _SYSIO_TTAG(opendir), + _SYSIO_TTAG(closedir), + _SYSIO_TTAG(symlink), + _SYSIO_TTAG(readlink), + _SYSIO_TTAG(truncate), + _SYSIO_TTAG(ftruncate), + _SYSIO_TTAG(unlink), + _SYSIO_TTAG(utime), +} tracing_tag; + extern void *_sysio_entry_trace_q; extern void *_sysio_exit_trace_q; @@ -161,30 +215,39 @@ extern void *_sysio_register_trace(void void (*)(const char *file, const char *func, int line, - void *data), + void *data, + tracing_tag tag, + va_list ap), void *data, void (*destructor)(void *data)); extern void _sysio_remove_trace(void *q, void *p); extern void _sysio_run_trace_q(void *q, const char *file, const char *func, - int line); -#define SYSIO_ENTER \ + int line, + tracing_tag tag, + ...); + +#define SYSIO_ENTER(tag, ...) \ do { \ _sysio_run_trace_q(_sysio_entry_trace_q, \ - __FILE__, __func__, __LINE__); \ + __FILE__, __func__, __LINE__, \ + _SYSIO_TTAG(tag), \ + __VA_ARGS__); \ } while (0) -#define SYSIO_LEAVE \ +#define SYSIO_LEAVE(tag, ...) \ do { \ _sysio_run_trace_q(_sysio_exit_trace_q, \ - __FILE__, __func__, __LINE__); \ + __FILE__, __func__, __LINE__, \ + _SYSIO_TTAG(tag), \ + __VA_ARGS__); \ } while (0) #else -#define SYSIO_ENTER \ +#define SYSIO_ENTER(tag, ...) \ do { } while (0) -#define SYSIO_LEAVE \ +#define SYSIO_LEAVE(tag, ...) \ do { } while (0) #endif |
From: Lee W. <lw...@us...> - 2007-04-10 21:25:38
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9556/src Modified Files: Tag: unification access.c chdir.c chmod.c chown.c dup.c fcntl.c fsync.c getdirentries.c init.c ioctl.c iowait.c link.c lseek.c mkdir.c mknod.c mount.c open.c readdir.c readlink.c rename.c rmdir.c rw.c stat.c statvfs.c statvfs64.c stddir.c symlink.c truncate.c unlink.c utime.c Log Message: Modified tracing to support intrumentation of tracked formals. SYSIO_INTERFACE_ENTER additionally takes a tag and a variable number of arguments. SYSIO_INTERFACE_RETURN dditionally takes a tag and a variable number of arguments. Be aware, the return code and error number are implicitly passed. Index: access.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/access.c,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -u -w -b -B -p -r1.13 -r1.13.2.1 --- access.c 1 Jun 2006 21:28:57 -0000 1.13 +++ access.c 10 Apr 2007 21:25:30 -0000 1.13.2.1 @@ -250,12 +250,12 @@ SYSIO_INTERFACE_NAME(access)(const char SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(access, path, amode); INTENT_INIT(&intent, INT_GETATTR, NULL, NULL); err = _sysio_namei(_sysio_cwd, path, 0, &intent, &pno); if (err) - SYSIO_INTERFACE_RETURN(-1, err); + SYSIO_INTERFACE_RETURN(-1, err, access, 0); err = _sysio_ldcreds(geteuid(), getegid(), &cr); if (err < 0) goto out; @@ -263,7 +263,7 @@ SYSIO_INTERFACE_NAME(access)(const char _sysio_check_permission(pno, &cr, amode); out: P_RELE(pno); - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, access, 0); } #ifdef REDSTORM Index: chdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chdir.c,v retrieving revision 1.25 retrieving revision 1.25.2.1 diff -u -w -b -B -p -r1.25 -r1.25.2.1 --- chdir.c 3 May 2006 22:34:46 -0000 1.25 +++ chdir.c 10 Apr 2007 21:25:30 -0000 1.25.2.1 @@ -124,15 +124,15 @@ SYSIO_INTERFACE_NAME(chdir)(const char * struct pnode *pno; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(chdir, path); err = _sysio_namei(_sysio_cwd, path, 0, NULL, &pno); if (err) - SYSIO_INTERFACE_RETURN(-1, err); + SYSIO_INTERFACE_RETURN(-1, err, chdir, 0); err = _sysio_p_chdir(pno); if (err) P_RELE(pno); - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, chdir, 0); } #ifdef REDSTORM @@ -237,7 +237,7 @@ SYSIO_INTERFACE_NAME(getcwd)(char *buf, int err; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(getcwd, buf, size); #if DEFER_INIT_CWD if (!_sysio_cwd) { struct pnode *pno; @@ -252,7 +252,7 @@ SYSIO_INTERFACE_NAME(getcwd)(char *buf, } #endif err = _sysio_p_path(_sysio_cwd, &buf, buf ? size : 0); - SYSIO_INTERFACE_RETURN(err ? NULL : buf, err); + SYSIO_INTERFACE_RETURN(err ? NULL : buf, err, getcwd, buf, size); } #ifdef __GLIBC__ Index: chmod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chmod.c,v retrieving revision 1.14.10.1 retrieving revision 1.14.10.2 diff -u -w -b -B -p -r1.14.10.1 -r1.14.10.2 --- chmod.c 5 Feb 2007 15:54:27 -0000 1.14.10.1 +++ chmod.c 10 Apr 2007 21:25:30 -0000 1.14.10.2 @@ -75,14 +75,14 @@ SYSIO_INTERFACE_NAME(chmod)(const char * struct pnode *pno; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(chmod, path, mode); err = _sysio_namei(_sysio_cwd, path, 0, NULL, &pno); if (err) goto out; err = do_chmod(pno, mode); P_RELE(pno); out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, chmod, 0); } #ifdef REDSTORM @@ -98,7 +98,7 @@ SYSIO_INTERFACE_NAME(fchmod)(int fd, mod struct file *fil; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(fchmod, fd, mode); err = 0; fil = _sysio_fd_find(fd); if (!fil) { @@ -108,7 +108,7 @@ SYSIO_INTERFACE_NAME(fchmod)(int fd, mod err = do_chmod(fil->f_pno, mode); out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, fchmod, 0); } #ifdef REDSTORM Index: chown.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chown.c,v retrieving revision 1.13.10.1 retrieving revision 1.13.10.2 diff -u -w -b -B -p -r1.13.10.1 -r1.13.10.2 --- chown.c 5 Feb 2007 15:54:27 -0000 1.13.10.1 +++ chown.c 10 Apr 2007 21:25:30 -0000 1.13.10.2 @@ -82,7 +82,7 @@ SYSIO_INTERFACE_NAME(chown)(const char * struct pnode *pno; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(chown, path, owner, group); err = _sysio_namei(_sysio_cwd, path, 0, NULL, &pno); if (err) goto out; @@ -90,7 +90,7 @@ SYSIO_INTERFACE_NAME(chown)(const char * err = _do_chown(pno, owner, group); P_RELE(pno); out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, chown, 0); } #ifdef REDSTORM @@ -106,7 +106,7 @@ SYSIO_INTERFACE_NAME(fchown)(int fd, uid struct file *fil; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(fchown, fd, owner, group); err = 0; fil = _sysio_fd_find(fd); if (!fil) { @@ -116,7 +116,7 @@ SYSIO_INTERFACE_NAME(fchown)(int fd, uid err = _do_chown(fil->f_pno, owner, group); out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, fchown, 0); } #ifdef REDSTORM Index: dup.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/dup.c,v retrieving revision 1.12 retrieving revision 1.12.4.1 diff -u -w -b -B -p -r1.12 -r1.12.4.1 --- dup.c 16 Jun 2005 21:01:14 -0000 1.12 +++ dup.c 10 Apr 2007 21:25:30 -0000 1.12.4.1 @@ -56,11 +56,11 @@ SYSIO_INTERFACE_NAME(dup2)(int oldfd, in int fd; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(dup2, oldfd, newfd); if (newfd < 0) - SYSIO_INTERFACE_RETURN(-1, -EBADF); + SYSIO_INTERFACE_RETURN(-1, -EBADF, dup2, 0); fd = _sysio_fd_dup(oldfd, newfd, 1); - SYSIO_INTERFACE_RETURN(fd < 0 ? -1 : fd, fd < 0 ? fd : 0); + SYSIO_INTERFACE_RETURN(fd < 0 ? -1 : fd, fd < 0 ? fd : 0, dup2, 0); } #ifdef REDSTORM @@ -75,9 +75,9 @@ SYSIO_INTERFACE_NAME(dup)(int oldfd) int fd; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(dup, oldfd); fd = _sysio_fd_dup(oldfd, -1, 0); - SYSIO_INTERFACE_RETURN(fd < 0 ? -1 : fd, fd < 0 ? fd : 0); + SYSIO_INTERFACE_RETURN(fd < 0 ? -1 : fd, fd < 0 ? fd : 0, dup, 0); } #ifdef __GLIBC__ Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.25.2.1 retrieving revision 1.25.2.2 diff -u -w -b -B -p -r1.25.2.1 -r1.25.2.2 --- fcntl.c 5 Feb 2007 15:54:27 -0000 1.25.2.1 +++ fcntl.c 10 Apr 2007 21:25:31 -0000 1.25.2.2 @@ -160,7 +160,7 @@ _sysio_vfcntl(int fd, int cmd, va_list a struct file *fil; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(vfcntl, fd, cmd); err = 0; fil = _sysio_fd_find(fd); if (!fil) { @@ -267,7 +267,7 @@ _sysio_vfcntl(int fd, int cmd, va_list a } out: - SYSIO_INTERFACE_RETURN(rtn, err); + SYSIO_INTERFACE_RETURN(rtn, err, vfcntl, 0); } int Index: fsync.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fsync.c,v retrieving revision 1.8.8.1 retrieving revision 1.8.8.2 diff -u -w -b -B -p -r1.8.8.1 -r1.8.8.2 --- fsync.c 5 Feb 2007 15:54:27 -0000 1.8.8.1 +++ fsync.c 10 Apr 2007 21:25:31 -0000 1.8.8.2 @@ -58,12 +58,12 @@ SYSIO_INTERFACE_NAME(fsync)(int fd) int err; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(fsync, fd); fil = _sysio_fd_find(fd); if (!(fil && fil->f_pno)) - SYSIO_INTERFACE_RETURN(-1, -EBADF); + SYSIO_INTERFACE_RETURN(-1, -EBADF, fsync, 0); err = PNOP_SYNC(fil->f_pno); - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, fsync, 0); } int @@ -73,10 +73,10 @@ SYSIO_INTERFACE_NAME(fdatasync)(int fd) int err; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(fdatasync, fd); fil = _sysio_fd_find(fd); if (!(fil && fil->f_pno)) - SYSIO_INTERFACE_RETURN(-1, -EBADF); + SYSIO_INTERFACE_RETURN(-1, -EBADF, fdatasync, 0); err = PNOP_DATASYNC(fil->f_pno); - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, fdatasync, 0); } Index: getdirentries.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/getdirentries.c,v retrieving revision 1.20.4.1 retrieving revision 1.20.4.2 diff -u -w -b -B -p -r1.20.4.1 -r1.20.4.2 --- getdirentries.c 5 Feb 2007 15:54:27 -0000 1.20.4.1 +++ getdirentries.c 10 Apr 2007 21:25:31 -0000 1.20.4.2 @@ -117,11 +117,13 @@ PREPEND(_, SYSIO_INTERFACE_NAME(getdiren ssize_t cc; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(getdirentries64, fd, buf, nbytes, basep); fil = _sysio_fd_find(fd); cc = filldirents(fil, buf, nbytes, basep); - SYSIO_INTERFACE_RETURN(cc < 0 ? -1 : cc, cc < 0 ? (int )cc : 0); + SYSIO_INTERFACE_RETURN(cc < 0 ? -1 : cc, + cc < 0 ? (int )cc : 0, + getdirentries64, buf, basep); } #if _LARGEFILE64_SOURCE @@ -184,7 +186,7 @@ SYSIO_INTERFACE_NAME(getdirentries)(int char *cp; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(getdirentries, fd, buf, nbytes, basep); fil = _sysio_fd_find(fd); count = cc = filldirents(fil, buf, nbytes, &b); @@ -244,10 +246,10 @@ SYSIO_INTERFACE_NAME(getdirentries)(int } if (cc < 0) - SYSIO_INTERFACE_RETURN(-1, cc); + SYSIO_INTERFACE_RETURN(-1, cc, getdirentries, buf, basep); cc = (char *)dp - buf; *basep = b; - SYSIO_INTERFACE_RETURN(cc, 0); + SYSIO_INTERFACE_RETURN(cc, 0, getdirentries, buf, basep); } #else /* !defined(DIRENT64_IS_NATURAL) */ sysio_sym_strong_alias(PREPEND(_, SYSIO_INTERFACE_NAME(getdirentries64), Index: init.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/init.c,v retrieving revision 1.30.2.1 retrieving revision 1.30.2.2 diff -u -w -b -B -p -r1.30.2.1 -r1.30.2.2 --- init.c 5 Feb 2007 15:54:27 -0000 1.30.2.1 +++ init.c 10 Apr 2007 21:25:31 -0000 1.30.2.2 @@ -89,7 +89,9 @@ struct trace_callback { void (*f)(const char *file, /* callback function */ const char *func, int line, - void *data); + void *data, + int tag, + va_list ap); void *data; /* callback data */ void (*destructor)(void *data); /* data destructor */ }; @@ -321,7 +323,9 @@ _sysio_register_trace(void *q, void (*f)(const char *file, const char *func, int line, - void *data), + void *data, + int tag, + va_list ap), void *data, void (*destructor)(void *data)) { @@ -358,35 +362,46 @@ void _sysio_run_trace_q(void *q, const char *file, const char *func, - int line) + int line, + int tag, + ...) { + va_list ap, aq; struct trace_callback *tcb; + va_start(ap, tag); tcb = ((struct trace_q *)q)->tqh_first; while (tcb) { - (*tcb->f)(file, func, line, tcb->data); + va_copy(aq, ap); + (*tcb->f)(file, func, line, tcb->data, tag, ap); + va_end(aq); tcb = tcb->links.tqe_next; } + va_end(ap); } static void _sysio_trace_entry(const char *file __IS_UNUSED, const char *func, int line __IS_UNUSED, - void *data __IS_UNUSED) + void *data __IS_UNUSED, + tracing_tag tag, + va_list ap __IS_UNUSED) { - _sysio_cprintf("+ENTER+ %s\n", func); + _sysio_cprintf("+ENTER+ %s (%d)\n", func, tag); } static void _sysio_trace_exit(const char *file __IS_UNUSED, const char *func, int line __IS_UNUSED, - void *data __IS_UNUSED) + void *data __IS_UNUSED, + tracing_tag tag, + va_list ap __IS_UNUSED) { - _sysio_cprintf("+EXIT+ %s\n", func); + _sysio_cprintf("+EXIT+ %s (%d)\n", func, tag); } #endif /* defined(SYSIO_TRACING) */ @@ -639,36 +654,28 @@ do_creat(char *args) if (err) break; if (v[6].ovi_value) { - struct iovec iovec; - struct intnl_xtvec xtvec; - struct ioctx io_context; + size_t count; + struct ioctx *ioctx; /* * Deposit optional file content. */ - iovec.iov_base = v[6].ovi_value; - iovec.iov_len = strlen(v[6].ovi_value); - xtvec.xtv_off = 0; - xtvec.xtv_len = iovec.iov_len; - IOCTX_INIT(&io_context, - 1, - 1, - pno, - &iovec, 1, - &xtvec, 1); - _sysio_ioctx_enter(&io_context); + count = strlen(v[6].ovi_value); err = - PNOP_WRITE(pno, &io_context); + _sysio_p_awrite(pno, + 0, + v[6].ovi_value, + count, + &ioctx); if (!err) { ssize_t cc; - cc = _sysio_ioctx_wait(&io_context); + cc = _sysio_ioctx_wait(ioctx); if (cc < 0) err = cc; - else if ((size_t )cc != iovec.iov_len) + else if ((size_t )cc != count) err = -EIO; /* huh? */ - } else - _sysio_ioctx_complete(&io_context); + } } i = PNOP_CLOSE(pno); if (!err) Index: ioctl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/ioctl.c,v retrieving revision 1.12.8.1 retrieving revision 1.12.8.2 diff -u -w -b -B -p -r1.12.8.1 -r1.12.8.2 --- ioctl.c 5 Feb 2007 15:54:27 -0000 1.12.8.1 +++ ioctl.c 10 Apr 2007 21:25:31 -0000 1.12.8.2 @@ -61,7 +61,7 @@ SYSIO_INTERFACE_NAME(ioctl)(int fd, unsi va_list ap; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(ioctl, fd, request); err = 0; fil = _sysio_fd_find(fd); if (!fil) { @@ -74,7 +74,7 @@ SYSIO_INTERFACE_NAME(ioctl)(int fd, unsi va_end(ap); out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, ioctl, request); } Index: iowait.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/iowait.c,v retrieving revision 1.11 retrieving revision 1.11.4.1 diff -u -w -b -B -p -r1.11 -r1.11.4.1 --- iowait.c 25 Feb 2005 00:01:06 -0000 1.11 +++ iowait.c 10 Apr 2007 21:25:31 -0000 1.11.4.1 @@ -63,13 +63,13 @@ SYSIO_INTERFACE_NAME(iodone)(void *ioid) int rc; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(iodone, ioid); ioctx = _sysio_ioctx_find(ioid); if (!ioctx) - SYSIO_INTERFACE_RETURN(-1, -EINVAL); + SYSIO_INTERFACE_RETURN(-1, -EINVAL, iodone, 0); rc = _sysio_ioctx_done(ioctx); - SYSIO_INTERFACE_RETURN(rc < 0 ? -1 : rc, rc < 0 ? rc : 0); + SYSIO_INTERFACE_RETURN(rc < 0 ? -1 : rc, rc < 0 ? rc : 0, iodone, 0); } /* @@ -85,11 +85,12 @@ SYSIO_INTERFACE_NAME(iowait)(void *ioid) ssize_t cc; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(iowait, ioid); ioctx = _sysio_ioctx_find(ioid); if (!ioctx) - SYSIO_INTERFACE_RETURN(-1, -EINVAL); + SYSIO_INTERFACE_RETURN(-1, -EINVAL, iowait, 0); cc = _sysio_ioctx_wait(ioctx); - SYSIO_INTERFACE_RETURN(cc < 0 ? -1 : cc, cc < 0 ? (int )cc : 0); + SYSIO_INTERFACE_RETURN(cc < 0 ? -1 : cc, cc < 0 ? (int )cc : 0, + iowait, 0); } Index: link.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/link.c,v retrieving revision 1.12.4.1 retrieving revision 1.12.4.2 diff -u -w -b -B -p -r1.12.4.1 -r1.12.4.2 --- link.c 5 Feb 2007 15:54:28 -0000 1.12.4.1 +++ link.c 10 Apr 2007 21:25:31 -0000 1.12.4.2 @@ -62,7 +62,7 @@ SYSIO_INTERFACE_NAME(link)(const char *o struct pnode *old, *new; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(link, oldpath, newpath); INTENT_INIT(&intent, 0, NULL, NULL); err = _sysio_namei(_sysio_cwd, oldpath, 0, &intent, &old); if (err) @@ -104,7 +104,7 @@ error2: error1: P_RELE(old); out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, link, 0); } #ifdef REDSTORM Index: lseek.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/lseek.c,v retrieving revision 1.27.2.1 retrieving revision 1.27.2.2 diff -u -w -b -B -p -r1.27.2.1 -r1.27.2.2 --- lseek.c 5 Feb 2007 15:54:28 -0000 1.27.2.1 +++ lseek.c 10 Apr 2007 21:25:31 -0000 1.27.2.2 @@ -128,13 +128,14 @@ SYSIO_INTERFACE_NAME(lseek64)(int fd, of off64_t off; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(lseek64, fd, offset, whence); fil = _sysio_fd_find(fd); if (!fil) - SYSIO_INTERFACE_RETURN((off64_t )-1, -EBADF); + SYSIO_INTERFACE_RETURN((off64_t )-1, -EBADF, lseek64, 0); off = _sysio_lseek(fil, offset, whence, _SEEK_MAX(fil)); SYSIO_INTERFACE_RETURN(off < 0 ? (off64_t )-1 : off, - off < 0 ? (int )off : 0); + off < 0 ? (int )off : 0, + lseek64, 0); } #ifdef __GLIBC__ @@ -159,16 +160,16 @@ SYSIO_INTERFACE_NAME(lseek)(int fd, off_ off_t rtn; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(lseek, fd, offset, whence); fil = _sysio_fd_find(fd); if (!fil) - SYSIO_INTERFACE_RETURN((off_t )-1, -EBADF); + SYSIO_INTERFACE_RETURN((off_t )-1, -EBADF, lseek, 0); off = _sysio_lseek(fil, offset, whence, LONG_MAX); if (off < 0) - SYSIO_INTERFACE_RETURN((off_t )-1, (int )off); + SYSIO_INTERFACE_RETURN((off_t )-1, (int )off, lseek, 0); rtn = (off_t )off; assert(rtn == off); - SYSIO_INTERFACE_RETURN(rtn, 0); + SYSIO_INTERFACE_RETURN(rtn, 0, lseek, 0); } #ifdef __GLIBC__ @@ -193,17 +194,21 @@ SYSIO_INTERFACE_NAME(llseek)(unsigned in /* * This is just plain goofy. */ - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(llseek, + fd, + offset_high, offset_low, + result, + whence); fil = _sysio_fd_find(fd); if (!fil) - SYSIO_INTERFACE_RETURN(-1, -EBADF); + SYSIO_INTERFACE_RETURN(-1, -EBADF, llseek, NULL); #if !_LARGEFILE64_SOURCE if (offset_high) { /* * We are using 32-bit internals. This just isn't * going to work. */ - SYSIO_INTERFACE_RETURN(-1, -EOVERFLOW); + SYSIO_INTERFACE_RETURN(-1, -EOVERFLOW, llseek, NULL); } #else off = offset_high; @@ -212,9 +217,9 @@ SYSIO_INTERFACE_NAME(llseek)(unsigned in #endif off = _sysio_lseek(fil, off, whence, _SEEK_MAX(fil)); if (off < 0) - SYSIO_INTERFACE_RETURN((off_t )-1, (int )off); + SYSIO_INTERFACE_RETURN((off_t )-1, (int )off, llseek, NULL); *result = off; - SYSIO_INTERFACE_RETURN(0, 0); + SYSIO_INTERFACE_RETURN(0, 0, llseek, result); } #undef __llseek Index: mkdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mkdir.c,v retrieving revision 1.19.2.1 retrieving revision 1.19.2.2 diff -u -w -b -B -p -r1.19.2.1 -r1.19.2.2 --- mkdir.c 5 Feb 2007 15:54:28 -0000 1.19.2.1 +++ mkdir.c 10 Apr 2007 21:25:31 -0000 1.19.2.2 @@ -78,7 +78,7 @@ SYSIO_INTERFACE_NAME(mkdir)(const char * struct pnode *pno; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(mkdir, path, mode); INTENT_INIT(&intent, INT_CREAT, &mode, NULL); err = _sysio_namei(_sysio_cwd, path, ND_NEGOK, &intent, &pno); if (err) @@ -88,7 +88,7 @@ SYSIO_INTERFACE_NAME(mkdir)(const char * err = _sysio_mkdir(pno, mode); P_RELE(pno); out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, mkdir, 0); } #ifdef REDSTORM Index: mknod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mknod.c,v retrieving revision 1.18.2.1 retrieving revision 1.18.2.2 diff -u -w -b -B -p -r1.18.2.1 -r1.18.2.2 --- mknod.c 5 Feb 2007 15:54:28 -0000 1.18.2.1 +++ mknod.c 10 Apr 2007 21:25:31 -0000 1.18.2.2 @@ -96,7 +96,7 @@ PREPEND(__, SYSIO_INTERFACE_NAME(xmknod) struct pnode *pno; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(xmknod, __ver, path, mode, dev); if (__ver != _MKNOD_VER) { err = -ENOSYS; goto out; @@ -116,7 +116,7 @@ PREPEND(__, SYSIO_INTERFACE_NAME(xmknod) error: P_RELE(pno); out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, xmknod, 0); } #ifdef REDSTORM Index: mount.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mount.c,v retrieving revision 1.21.4.1 retrieving revision 1.21.4.2 diff -u -w -b -B -p -r1.21.4.1 -r1.21.4.2 --- mount.c 5 Feb 2007 15:54:28 -0000 1.21.4.1 +++ mount.c 10 Apr 2007 21:25:31 -0000 1.21.4.2 @@ -351,7 +351,10 @@ SYSIO_INTERFACE_NAME(mount)(const char * int err; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(mount, + source, target, + filesystemtype, + mountflags); err = _sysio_mount(_sysio_cwd, source, @@ -359,7 +362,7 @@ SYSIO_INTERFACE_NAME(mount)(const char * filesystemtype, mountflags, data); - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, mount, 0); } int @@ -369,7 +372,7 @@ SYSIO_INTERFACE_NAME(umount)(const char struct pnode *pno; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(umount, target); /* * Look up the target path node. */ @@ -391,7 +394,7 @@ SYSIO_INTERFACE_NAME(umount)(const char err = _sysio_do_unmount(pno->p_mount); out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, umount, 0); } /* @@ -642,9 +645,8 @@ _sysio_automount(struct pnode *mntpno) { int err; struct inode *ino; - struct iovec iovec; - struct ioctx iocontext; - struct intnl_xtvec xtvec; + char *buf; + struct ioctx *ioctx; ssize_t cc; char *fstype, *source, *opts; unsigned flags; @@ -668,42 +670,27 @@ _sysio_automount(struct pnode *mntpno) */ return -EINVAL; } - iovec.iov_base = malloc(ino->i_stbuf.st_size + 1); - if (!iovec.iov_base) + buf = malloc(ino->i_stbuf.st_size + 1); + if (!buf) return -ENOMEM; - iovec.iov_len = ino->i_stbuf.st_size; err = _sysio_open(mntpno, O_RDONLY, 0); if (err) goto out; - xtvec.xtv_off = 0; - xtvec.xtv_len = ino->i_stbuf.st_size; - IOCTX_INIT(&iocontext, - 1, - 0, - mntpno, - &iovec, 1, - &xtvec, 1); - _sysio_ioctx_enter(&iocontext); - err = PNOP_READ(mntpno, &iocontext); - if (err) { - _sysio_ioctx_complete(&iocontext); - (void )PNOP_CLOSE(mntpno); - goto out; + err = _sysio_p_aread(mntpno, 0, buf, ino->i_stbuf.st_size, &ioctx); + if (!err) { + cc = _sysio_ioctx_wait(ioctx); + if (cc < 0) + err = (int )cc; } - cc = _sysio_ioctx_wait(&iocontext); - err = PNOP_CLOSE(mntpno); + (void )PNOP_CLOSE(mntpno); if (err) goto out; - if (cc < 0) { - err = (int )cc; - goto out; - } - ((char *)iovec.iov_base)[cc] = '\0'; + buf[cc] = '\0'; /* NUL terminate */ /* * Parse. */ - err = parse_automount_spec(iovec.iov_base, &fstype, &source, &opts); + err = parse_automount_spec(buf, &fstype, &source, &opts); if (err) goto out; flags = 0; @@ -733,8 +720,8 @@ _sysio_automount(struct pnode *mntpno) P_RELE(mntpno->p_parent); out: - if (iovec.iov_base) - free(iovec.iov_base); + if (buf) + free(buf); return err; } #endif Index: open.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/open.c,v retrieving revision 1.28.2.1 retrieving revision 1.28.2.2 diff -u -w -b -B -p -r1.28.2.1 -r1.28.2.2 --- open.c 5 Feb 2007 15:54:28 -0000 1.28.2.1 +++ open.c 10 Apr 2007 21:25:31 -0000 1.28.2.2 @@ -129,7 +129,6 @@ SYSIO_INTERFACE_NAME(open)(const char *p struct file *fil; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; /* * Get mode argument and determine parameters for namei */ @@ -162,6 +161,7 @@ SYSIO_INTERFACE_NAME(open)(const char *p if (flags & O_NOFOLLOW) ndflags |= ND_NOFOLLOW; #endif + SYSIO_INTERFACE_ENTER(open, path, flags, mode); /* * Find the file. @@ -192,14 +192,14 @@ SYSIO_INTERFACE_NAME(open)(const char *p P_RELE(pno); - SYSIO_INTERFACE_RETURN(rtn, 0); + SYSIO_INTERFACE_RETURN(rtn, 0, open, 0); error: if (fil) F_RELE(fil); if (pno) P_RELE(pno); - SYSIO_INTERFACE_RETURN(-1, rtn); + SYSIO_INTERFACE_RETURN(-1, rtn, open, 0); } #ifdef __GLIBC__ @@ -231,9 +231,9 @@ SYSIO_INTERFACE_NAME(close)(int fd) int err; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(close, fd); err = _sysio_fd_close(fd); - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, close, 0); } #ifdef __GLIBC__ Index: readdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/readdir.c,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -u -w -b -B -p -r1.2 -r1.2.4.1 --- readdir.c 25 Jan 2005 00:37:14 -0000 1.2 +++ readdir.c 10 Apr 2007 21:25:31 -0000 1.2.4.1 @@ -49,9 +49,6 @@ _READDIR(DIR *dir) #else int rc; #endif - SYSIO_INTERFACE_DISPLAY_BLOCK; - - SYSIO_INTERFACE_ENTER; /* need to read new data? */ rc = 0; @@ -61,7 +58,8 @@ _READDIR(DIR *dir) if (sizeof(dbase) != sizeof(dir->base) && dbase != dir->base) { dir->effective = 0; - SYSIO_INTERFACE_RETURN(NULL, -EOVERFLOW); + errno = EOVERFLOW; + return NULL; } rc = _GETDIRENTRIES(dir->fd, dir->buf, @@ -79,7 +77,7 @@ _READDIR(DIR *dir) rc = 0; if (rc <= 0) { dir->effective = 0; - SYSIO_INTERFACE_RETURN(NULL, rc); + return NULL; } dir->effective = rc; } @@ -96,7 +94,7 @@ _READDIR(DIR *dir) dir->filepos = dir->cur; #endif - SYSIO_INTERFACE_RETURN(dp, 0); + return dp; } sysio_sym_weak_alias(_READDIR, PREPEND(__,_READDIR)) @@ -113,12 +111,9 @@ _SCANDIR(const char *dirname, **s = NULL; int n = 32, i = 0; size_t desize; - SYSIO_INTERFACE_DISPLAY_BLOCK; - - SYSIO_INTERFACE_ENTER; if ((dir = SYSIO_INTERFACE_NAME(opendir)(dirname)) == NULL) - SYSIO_INTERFACE_RETURN(-1, -errno); + return -1; while ((de = _READDIR(dir)) != NULL) { if ((filter == NULL) || filter(de)) { @@ -127,12 +122,12 @@ _SCANDIR(const char *dirname, s = (_DIRENT_T **)realloc(s, (size_t )(n * sizeof(_DIRENT_T *))); if (!s) - SYSIO_INTERFACE_RETURN(-1, -ENOMEM); + return -1; } desize = &de->d_name[_D_ALLOC_NAMLEN(de)] - (char * )de; nextde = (_DIRENT_T *)malloc(desize); if (!nextde) - SYSIO_INTERFACE_RETURN(-1, -ENOMEM); + return -1; s[i++] = (_DIRENT_T *)memcpy(nextde, de, desize); } @@ -147,7 +142,7 @@ _SCANDIR(const char *dirname, SYSIO_INTERFACE_NAME(closedir)(dir); - SYSIO_INTERFACE_RETURN(i, 0); + return i; } sysio_sym_weak_alias(_SCANDIR, PREPEND(__,_SCANDIR)) Index: readlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/readlink.c,v retrieving revision 1.6.8.1 retrieving revision 1.6.8.2 diff -u -w -b -B -p -r1.6.8.1 -r1.6.8.2 --- readlink.c 5 Feb 2007 15:54:28 -0000 1.6.8.1 +++ readlink.c 10 Apr 2007 21:25:31 -0000 1.6.8.2 @@ -63,7 +63,7 @@ SYSIO_INTERFACE_NAME(readlink)(const cha struct pnode *pno; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(readlink, path, bufsiz); INTENT_INIT(&intent, INT_GETATTR, NULL, NULL); err = _sysio_namei(_sysio_cwd, path, ND_NOFOLLOW, &intent, &pno); if (err) @@ -76,7 +76,8 @@ SYSIO_INTERFACE_NAME(readlink)(const cha error: P_RELE(pno); out: - SYSIO_INTERFACE_RETURN(err < 0 ? -1 : err, err >= 0 ? 0 : err); + SYSIO_INTERFACE_RETURN(err < 0 ? -1 : err, err >= 0 ? 0 : err, + readlink, buf); } #ifdef REDSTORM Index: rename.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rename.c,v retrieving revision 1.11.4.1 retrieving revision 1.11.4.2 diff -u -w -b -B -p -r1.11.4.1 -r1.11.4.2 --- rename.c 5 Feb 2007 15:54:28 -0000 1.11.4.1 +++ rename.c 10 Apr 2007 21:25:31 -0000 1.11.4.2 @@ -63,13 +63,13 @@ SYSIO_INTERFACE_NAME(rename)(const char struct pnode_base *nxtpb, *pb; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(rename, oldpath, newpath); /* * Neither old nor new may be the empty string. */ if (*oldpath == '\0' || *newpath == '\0') - SYSIO_INTERFACE_RETURN(-1, -ENOENT); + SYSIO_INTERFACE_RETURN(-1, -ENOENT, rename, 0); /* * Resolve oldpath to a path node. @@ -180,5 +180,5 @@ error3: goto out; _sysio_p_gone(old); /* kill it! */ out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, rename, 0); } Index: rmdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rmdir.c,v retrieving revision 1.20.2.1 retrieving revision 1.20.2.2 diff -u -w -b -B -p -r1.20.2.1 -r1.20.2.2 --- rmdir.c 5 Feb 2007 15:54:28 -0000 1.20.2.1 +++ rmdir.c 10 Apr 2007 21:25:31 -0000 1.20.2.2 @@ -62,7 +62,7 @@ SYSIO_INTERFACE_NAME(rmdir)(const char * struct pnode *pno; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(rmdir, path); INTENT_INIT(&intent, INT_UPDPARENT, NULL, NULL); err = _sysio_namei(_sysio_cwd, path, 0, &intent, &pno); if (err) @@ -88,7 +88,7 @@ SYSIO_INTERFACE_NAME(rmdir)(const char * error: P_RELE(pno); out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, rmdir, 0); } #ifdef REDSTORM Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.16.4.1 retrieving revision 1.16.4.2 diff -u -w -b -B -p -r1.16.4.1 -r1.16.4.2 --- rw.c 5 Feb 2007 15:54:28 -0000 1.16.4.1 +++ rw.c 10 Apr 2007 21:25:31 -0000 1.16.4.2 @@ -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... */ @@ -44,6 +44,7 @@ #include <stdlib.h> #include <unistd.h> [...1940 lines suppressed...] +SYSIO_INTERFACE_NAME(read)(int fd, void *buf, size_t count) { - SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; - SYSIO_INTERFACE_RETURN(-1, -ENOSYS); + return _do_io(fd, SYSIO_INTERFACE_NAME(iread), buf, count); +} + +ssize_t +SYSIO_INTERFACE_NAME(write)(int fd, const void *buf, size_t count) +{ + + return _do_io(fd, + (ioid_t (*)(int, + void *, + size_t))SYSIO_INTERFACE_NAME(iwrite), + (void *)buf, count); } -#endif Index: stat.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/stat.c,v retrieving revision 1.17.8.1 retrieving revision 1.17.8.2 diff -u -w -b -B -p -r1.17.8.1 -r1.17.8.2 --- stat.c 5 Feb 2007 15:54:28 -0000 1.17.8.1 +++ stat.c 10 Apr 2007 21:25:31 -0000 1.17.8.2 @@ -66,7 +66,7 @@ _sysio_fxstat(int ver, int fildes, struc int err; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(fxstat, ver, fildes); if (ver != _STAT_VER) { err = -ENOSYS; goto out; @@ -84,7 +84,7 @@ _sysio_fxstat(int ver, int fildes, struc */ err = PNOP_GETATTR(fil->f_pno, stat_buf); out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, fxstat, stat_buf); } static int @@ -98,7 +98,7 @@ _sysio_xstatnd(int ver, struct pnode *pno; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(xstatnd, ver, filename, ndflags); if (ver != _STAT_VER) { err = -ENOSYS; goto out; @@ -118,7 +118,7 @@ _sysio_xstatnd(int ver, sizeof(struct intnl_stat)); P_RELE(pno); out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, xstatnd, stat_buf); } #if _LARGEFILE64_SOURCE Index: statvfs.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/statvfs.c,v retrieving revision 1.12.10.1 retrieving revision 1.12.10.2 diff -u -w -b -B -p -r1.12.10.1 -r1.12.10.2 --- statvfs.c 5 Feb 2007 15:54:28 -0000 1.12.10.1 +++ statvfs.c 10 Apr 2007 21:25:31 -0000 1.12.10.2 @@ -89,7 +89,7 @@ SYSIO_INTERFACE_NAME(statvfs)(const char #endif SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(statvfs, path); err = _sysio_namei(_sysio_cwd, path, 0, NULL, &pno); if (err) goto out; @@ -104,7 +104,7 @@ SYSIO_INTERFACE_NAME(statvfs)(const char goto out; err: out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, statvfs, buf); } #ifdef REDSTORM @@ -126,7 +126,7 @@ SYSIO_INTERFACE_NAME(fstatvfs)(int fd, s #endif SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(statvfs, fd); err = 0; filp = _sysio_fd_find(fd); if (!filp) { @@ -143,7 +143,7 @@ SYSIO_INTERFACE_NAME(fstatvfs)(int fd, s goto out; err: out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, fstatvfs, buf); } #ifdef REDSTORM Index: statvfs64.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/statvfs64.c,v retrieving revision 1.14.10.1 retrieving revision 1.14.10.2 diff -u -w -b -B -p -r1.14.10.1 -r1.14.10.2 --- statvfs64.c 5 Feb 2007 15:54:28 -0000 1.14.10.1 +++ statvfs64.c 10 Apr 2007 21:25:31 -0000 1.14.10.2 @@ -61,7 +61,7 @@ SYSIO_INTERFACE_NAME(statvfs64)(const ch struct pnode *pno; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(statvfs64, path); err = _sysio_namei(_sysio_cwd, path, 0, NULL, &pno); if (err) goto out; @@ -69,7 +69,7 @@ SYSIO_INTERFACE_NAME(statvfs64)(const ch err = PNOP_STATVFS(pno, buf); P_RELE(pno); out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, statvfs64, buf); } #ifdef REDSTORM @@ -85,7 +85,7 @@ SYSIO_INTERFACE_NAME(fstatvfs64)(int fd, struct file *filp; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(fstatvfs64, fd, buf); err = 0; filp = _sysio_fd_find(fd); if (!filp) { @@ -95,7 +95,7 @@ SYSIO_INTERFACE_NAME(fstatvfs64)(int fd, err = PNOP_STATVFS(filp->f_pno, buf); out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, fstatvfs64, buf); } #ifdef REDSTORM Index: stddir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/stddir.c,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -u -w -b -B -p -r1.2 -r1.2.4.1 --- stddir.c 25 Jan 2005 00:37:19 -0000 1.2 +++ stddir.c 10 Apr 2007 21:25:31 -0000 1.2.4.1 @@ -51,16 +51,16 @@ SYSIO_INTERFACE_NAME(opendir)(const char SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(opendir, name); dir = (DIR * )calloc(1, sizeof(DIR)); if (!dir) - SYSIO_INTERFACE_RETURN(NULL, -ENOMEM); + SYSIO_INTERFACE_RETURN(NULL, -ENOMEM, opendir, 0); dir->fd = SYSIO_INTERFACE_NAME(open)(name, O_RDONLY); if (dir->fd < 0) { free(dir); - SYSIO_INTERFACE_RETURN(NULL, -errno); + SYSIO_INTERFACE_RETURN(NULL, -errno, opendir, 0); } return dir; } @@ -74,12 +74,12 @@ SYSIO_INTERFACE_NAME(closedir)(DIR *dir) int rc; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(closedir, dir); rc = SYSIO_INTERFACE_NAME(close)(dir->fd); free(dir); - SYSIO_INTERFACE_RETURN(rc, 0); + SYSIO_INTERFACE_RETURN(rc, 0, closedir, 0); } sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(closedir), Index: symlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/symlink.c,v retrieving revision 1.16.2.1 retrieving revision 1.16.2.2 diff -u -w -b -B -p -r1.16.2.1 -r1.16.2.2 --- symlink.c 5 Feb 2007 15:54:28 -0000 1.16.2.1 +++ symlink.c 10 Apr 2007 21:25:31 -0000 1.16.2.2 @@ -62,7 +62,7 @@ SYSIO_INTERFACE_NAME(symlink)(const char struct pnode *pno; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(symlink, oldpath, newpath); INTENT_INIT(&intent, INT_CREAT, NULL, NULL); err = _sysio_namei(_sysio_cwd, @@ -84,7 +84,7 @@ SYSIO_INTERFACE_NAME(symlink)(const char error: P_RELE(pno); out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, symlink, 0); } #ifdef REDSTORM Index: truncate.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/truncate.c,v retrieving revision 1.14.2.1 retrieving revision 1.14.2.2 diff -u -w -b -B -p -r1.14.2.1 -r1.14.2.2 --- truncate.c 5 Feb 2007 15:54:28 -0000 1.14.2.1 +++ truncate.c 10 Apr 2007 21:25:31 -0000 1.14.2.2 @@ -91,7 +91,7 @@ PREPEND(_, SYSIO_INTERFACE_NAME(truncate struct pnode *pno; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(truncate, path, length); err = _sysio_namei(_sysio_cwd, path, 0, NULL, &pno); if (err) goto out; @@ -99,7 +99,7 @@ PREPEND(_, SYSIO_INTERFACE_NAME(truncate P_RELE(pno); out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, truncate, 0); } #if _LARGEFILE64_SOURCE @@ -127,7 +127,7 @@ PREPEND(_, SYSIO_INTERFACE_NAME(ftruncat struct file *fil; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(ftruncate, fd, length); err = 0; fil = _sysio_fd_find(fd); if (!fil) { @@ -139,7 +139,7 @@ PREPEND(_, SYSIO_INTERFACE_NAME(ftruncat goto out; err = do_truncate(fil->f_pno, length); out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, ftruncate, 0); } #if _LARGEFILE64_SOURCE Index: unlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/unlink.c,v retrieving revision 1.18.2.1 retrieving revision 1.18.2.2 diff -u -w -b -B -p -r1.18.2.1 -r1.18.2.2 --- unlink.c 5 Feb 2007 15:54:28 -0000 1.18.2.1 +++ unlink.c 10 Apr 2007 21:25:31 -0000 1.18.2.2 @@ -62,7 +62,7 @@ SYSIO_INTERFACE_NAME(unlink)(const char struct pnode *pno; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(unlink, path); INTENT_INIT(&intent, INT_UPDPARENT, NULL, NULL); err = _sysio_namei(_sysio_cwd, path, ND_NOFOLLOW, &intent, &pno); if (err) @@ -83,7 +83,7 @@ SYSIO_INTERFACE_NAME(unlink)(const char error: P_RELE(pno); out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, unlink, 0); } #ifdef REDSTORM Index: utime.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/utime.c,v retrieving revision 1.7.8.1 retrieving revision 1.7.8.2 diff -u -w -b -B -p -r1.7.8.1 -r1.7.8.2 --- utime.c 5 Feb 2007 15:54:28 -0000 1.7.8.1 +++ utime.c 10 Apr 2007 21:25:31 -0000 1.7.8.2 @@ -76,7 +76,7 @@ SYSIO_INTERFACE_NAME(utime)(const char * struct intnl_stat stbuf; SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; + SYSIO_INTERFACE_ENTER(utime, path); err = _sysio_namei(_sysio_cwd, path, 0, NULL, &pno); if (err) goto out; @@ -91,5 +91,5 @@ SYSIO_INTERFACE_NAME(utime)(const char * _sysio_setattr(pno, SETATTR_ATIME | SETATTR_MTIME, &stbuf); P_RELE(pno); out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN(err ? -1 : 0, err, utime, buf); } |
From: Lee W. <lw...@us...> - 2007-03-28 21:30:12
|
Update of /cvsroot/libsysio/libsysio In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv19222 Modified Files: configure.in Log Message: Go back to the old way of testing readlink. It works fine when strange env variables aren't defined -- They aren't really needed anymore. Index: configure.in =================================================================== RCS file: /cvsroot/libsysio/libsysio/configure.in,v retrieving revision 1.27 retrieving revision 1.28 diff -u -w -b -B -p -r1.27 -r1.28 --- configure.in 23 Mar 2007 20:02:13 -0000 1.27 +++ configure.in 28 Mar 2007 21:30:09 -0000 1.28 @@ -242,10 +242,7 @@ AC_MSG_CHECKING(if readlink returns ssiz AC_TRY_COMPILE([ #include <unistd.h> ],[ -static void test_code() { - ssize_t rtn; - rtn = readlink("old", "new"); -} + extern ssize_t readlink(const char *, char *, size_t); ], readlink_returns_ssize_t="yes", readlink_returns_ssize_t="no" |
From: Lee W. <lw...@us...> - 2007-03-28 21:29:03
|
Update of /cvsroot/libsysio/libsysio In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv18805 Modified Files: Rules.make Log Message: Don't add build environment specific definitions here. That can be done by the user via the environment or in the configure file. Index: Rules.make =================================================================== RCS file: /cvsroot/libsysio/libsysio/Rules.make,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -b -B -p -r1.11 -r1.12 --- Rules.make 19 Oct 2005 19:30:56 -0000 1.11 +++ Rules.make 28 Mar 2007 21:28:59 -0000 1.12 @@ -13,7 +13,6 @@ endif DEV_CPPFLAGS = $(STDFD_DEV_CPPFLAGS) AM_CPPFLAGS = \ - -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=600 \ $(TRACING) \ $(AUTOMOUNT) $(ZERO_SUM_MEMORY) $(DEV_CPPFLAGS) $(SOCKETS_CPPFLAGS) \ $(DEFER_INIT_CWD) $(SYSIO_LABEL_NAMES) -I$(top_srcdir)/include |
From: Lee W. <lw...@us...> - 2007-03-28 21:27:57
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv18388/src Modified Files: mkdir.c Log Message: Remove file type from mode bits. The drivers should add that, themselves. Index: mkdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mkdir.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -w -b -B -p -r1.19 -r1.20 --- mkdir.c 1 Jun 2006 21:28:57 -0000 1.19 +++ mkdir.c 28 Mar 2007 21:27:54 -0000 1.20 @@ -41,11 +41,11 @@ * le...@sa... */ -#include <unistd.h> #include <errno.h> #include <assert.h> #include <sys/types.h> #include <sys/stat.h> +#include <unistd.h> #include <sys/queue.h> #include "sysio.h" @@ -67,7 +67,6 @@ _sysio_mkdir(struct pnode *pno, mode_t m if (err) return err; - mode |= S_IFDIR; parenti = pno->p_parent->p_base->pb_ino; assert(parenti); return (*parenti->i_ops.inop_mkdir)(pno, mode); |
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv17947 Modified Files: test_chown.c test_copy.c test_fcntl_lock.c test_getcwd.c test_link.c test_list.c test_mkdir.c test_path.c test_regions.c test_rename.c test_stats.c test_symlink.c test_unlink.c Log Message: Include <getopt.h> now. If _BSD_SOURCE was defined, that was removed. Index: test_chown.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_chown.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1 -r1.2 --- test_chown.c 14 Mar 2007 21:03:12 -0000 1.1 +++ test_chown.c 28 Mar 2007 21:27:12 -0000 1.2 @@ -48,6 +48,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> +#include <getopt.h> #if defined(SYSIO_LABEL_NAMES) #include "sysio.h" Index: test_copy.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_copy.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -b -B -p -r1.13 -r1.14 --- test_copy.c 28 Oct 2005 16:42:26 -0000 1.13 +++ test_copy.c 28 Mar 2007 21:27:12 -0000 1.14 @@ -41,8 +41,6 @@ * le...@sa... */ -#define _BSD_SOURCE - #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -52,6 +50,7 @@ #include <fcntl.h> #include <sys/uio.h> #include <sys/queue.h> +#include <getopt.h> #if defined(SYSIO_LABEL_NAMES) #include "sysio.h" Index: test_fcntl_lock.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_fcntl_lock.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1 -r1.2 --- test_fcntl_lock.c 28 Oct 2005 17:59:31 -0000 1.1 +++ test_fcntl_lock.c 28 Mar 2007 21:27:12 -0000 1.2 @@ -41,8 +41,6 @@ * le...@sa... */ -#define _BSD_SOURCE - #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -51,6 +49,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> +#include <getopt.h> #if defined(SYSIO_LABEL_NAMES) #include "sysio.h" Index: test_getcwd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_getcwd.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- test_getcwd.c 28 Oct 2005 16:42:26 -0000 1.7 +++ test_getcwd.c 28 Mar 2007 21:27:12 -0000 1.8 @@ -52,6 +52,7 @@ #include <sys/uio.h> #include <sys/queue.h> #include <dirent.h> +#include <getopt.h> #if defined(SYSIO_LABEL_NAMES) #include "sysio.h" Index: test_link.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_link.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- test_link.c 28 Oct 2005 16:42:26 -0000 1.5 +++ test_link.c 28 Mar 2007 21:27:12 -0000 1.6 @@ -53,6 +53,7 @@ #endif #include <sys/uio.h> #include <sys/queue.h> +#include <getopt.h> #if defined(SYSIO_LABEL_NAMES) #include "sysio.h" Index: test_list.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_list.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -b -B -p -r1.12 -r1.13 --- test_list.c 28 Oct 2005 16:42:26 -0000 1.12 +++ test_list.c 28 Mar 2007 21:27:12 -0000 1.13 @@ -41,8 +41,6 @@ * le...@sa... */ -#define _BSD_SOURCE - #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -54,6 +52,7 @@ #include <dirent.h> #include <sys/uio.h> #include <sys/queue.h> +#include <getopt.h> #if defined(SYSIO_LABEL_NAMES) #include "sysio.h" Index: test_mkdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_mkdir.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1 -r1.2 --- test_mkdir.c 3 May 2006 22:31:04 -0000 1.1 +++ test_mkdir.c 28 Mar 2007 21:27:12 -0000 1.2 @@ -50,6 +50,7 @@ #if 0 #include <dirent.h> #endif +#include <getopt.h> #if defined(SYSIO_LABEL_NAMES) #include "sysio.h" Index: test_path.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_path.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -b -B -p -r1.13 -r1.14 --- test_path.c 3 Jan 2006 13:33:06 -0000 1.13 +++ test_path.c 28 Mar 2007 21:27:12 -0000 1.14 @@ -41,8 +41,6 @@ * le...@sa... */ -#define _BSD_SOURCE - #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -51,6 +49,7 @@ #include <sys/stat.h> #include <unistd.h> #include <sys/uio.h> +#include <getopt.h> #if defined(SYSIO_LABEL_NAMES) #include "sysio.h" Index: test_regions.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_regions.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- test_regions.c 28 Oct 2005 16:42:26 -0000 1.7 +++ test_regions.c 28 Mar 2007 21:27:12 -0000 1.8 @@ -41,19 +41,6 @@ * le...@sa... */ -#define _BSD_SOURCE - -#if (_LARGEFILE64_SOURCE && \ - ((defined(__STDC_VERSION__) && __STDC_VERSION__ == 199901L))) -#define GO64 -#else -#warning Cannot prompt the 64-bit interface -#endif - -#if defined(GO64) && defined(__GLIBC__) -#define _ISOC99_SOURCE 1 -#endif - #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -64,6 +51,7 @@ #include <sys/stat.h> #include <fcntl.h> #include <sys/uio.h> +#include <getopt.h> #if defined(SYSIO_LABEL_NAMES) #include "sysio.h" @@ -80,9 +68,7 @@ * Destination will not be overwritten if it already exist. */ -#if (_LARGEFILE64_SOURCE && \ - ((defined(__STDC_VERSION__) && __STDC_VERSION__ == 199901L) || \ - (defined(_ISOC99_SOURCE) && _ISOC99_SOURCE))) +#if defined(_LARGEFILE64_SOURCE) && _LARGEFILE64_SOURCE #define GO64 #else #warning Cannot prompt the 64-bit interface Index: test_rename.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_rename.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- test_rename.c 28 Oct 2005 16:42:26 -0000 1.7 +++ test_rename.c 28 Mar 2007 21:27:12 -0000 1.8 @@ -41,8 +41,6 @@ * le...@sa... */ -#define _BSD_SOURCE - #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -51,6 +49,7 @@ #include <sys/stat.h> #include <fcntl.h> #include <sys/uio.h> +#include <getopt.h> #if defined(SYSIO_LABEL_NAMES) #include "sysio.h" Index: test_stats.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_stats.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -b -B -p -r1.9 -r1.10 --- test_stats.c 28 Oct 2005 16:42:26 -0000 1.9 +++ test_stats.c 28 Mar 2007 21:27:12 -0000 1.10 @@ -41,8 +41,6 @@ * le...@sa... */ -#define _BSD_SOURCE - #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -54,6 +52,7 @@ #include <sys/statvfs.h> #endif #include <sys/uio.h> +#include <getopt.h> #if defined(SYSIO_LABEL_NAMES) #include "sysio.h" Index: test_symlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_symlink.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1 -r1.2 --- test_symlink.c 28 Apr 2006 14:59:42 -0000 1.1 +++ test_symlink.c 28 Mar 2007 21:27:12 -0000 1.2 @@ -53,6 +53,7 @@ #endif #include <sys/uio.h> #include <sys/queue.h> +#include <getopt.h> #if defined(SYSIO_LABEL_NAMES) #include "sysio.h" Index: test_unlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_unlink.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -b -B -p -r1.6 -r1.7 --- test_unlink.c 28 Oct 2005 16:42:26 -0000 1.6 +++ test_unlink.c 28 Mar 2007 21:27:12 -0000 1.7 @@ -51,6 +51,7 @@ #include <dirent.h> #endif #include <sys/uio.h> +#include <getopt.h> #if defined(SYSIO_LABEL_NAMES) #include "sysio.h" |
From: Lee W. <lw...@us...> - 2007-03-28 21:26:32
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv17922 Modified Files: test_mknod.c Log Message: Need to include <getopt.h> now, as well. Index: test_mknod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_mknod.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1 -r1.2 --- test_mknod.c 3 May 2006 22:31:04 -0000 1.1 +++ test_mknod.c 28 Mar 2007 21:26:29 -0000 1.2 @@ -41,6 +41,11 @@ * le...@sa... */ +/* + * Can't provoke a definition of the S_IFMT macros without a little extra work. + */ +#define _BSD_SOURCE + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -49,6 +54,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> +#include <getopt.h> #if defined(SYSIO_LABEL_NAMES) #include "sysio.h" |
From: Lee W. <lw...@us...> - 2007-03-28 20:50:46
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2180/src Modified Files: fcntl.c Log Message: Need to include definition for struct stat from the system. Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -w -b -B -p -r1.25 -r1.26 --- fcntl.c 24 Mar 2006 16:34:07 -0000 1.25 +++ fcntl.c 28 Mar 2007 20:50:41 -0000 1.26 @@ -42,11 +42,12 @@ */ #include <string.h> -#include <unistd.h> #include <stdlib.h> #include <errno.h> #include <assert.h> #include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> #include <fcntl.h> #include <sys/queue.h> |