libsysio-commit Mailing List for libsysio (Page 4)
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...> - 2009-04-10 21:32:45
|
Update of /cvsroot/libsysio/libsysio/include In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20458/include Modified Files: dev.h Log Message: Adjusted copyright dates to reflect the last change. Index: dev.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/dev.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -b -B -p -r1.14 -r1.15 --- dev.h 10 Apr 2009 21:31:48 -0000 1.14 +++ dev.h 10 Apr 2009 21:32:28 -0000 1.15 @@ -9,7 +9,7 @@ * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * - * Cplant(TM) Copyright 1998-2003 Sandia Corporation. + * Cplant(TM) Copyright 1998-2009 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States |
From: Lee W. <lw...@us...> - 2009-04-10 21:32:03
|
Update of /cvsroot/libsysio/libsysio/include In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20182/include Modified Files: dev.h Log Message: Modified to reflect the new filldirentries2 operation. Index: dev.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/dev.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -b -B -p -r1.13 -r1.14 --- dev.h 11 Jul 2008 18:23:57 -0000 1.13 +++ dev.h 10 Apr 2009 21:31:48 -0000 1.14 @@ -83,6 +83,11 @@ extern const struct inode_ops _sysio_nod _SYSIO_OFF_T *, \ char *, \ size_t))_sysio_do_illop +#define _sysio_nodev_filldirentries2 \ + (int (*)(struct pnode *, \ + _SYSIO_OFF_T *, \ + filldir_t, \ + void *))_sysio_do_illop #define _sysio_nodev_inop_mkdir \ (int (*)(struct pnode *, \ mode_t))_sysio_do_illop |
From: Lee W. <lw...@us...> - 2009-04-10 21:32:01
|
Update of /cvsroot/libsysio/libsysio/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20182/src Modified Files: dev.c Log Message: Modified to reflect the new filldirentries2 operation. Index: dev.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/dev.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -b -B -p -r1.12 -r1.13 --- dev.c 9 May 2007 23:16:20 -0000 1.12 +++ dev.c 10 Apr 2009 21:31:48 -0000 1.13 @@ -9,7 +9,7 @@ * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * - * Cplant(TM) Copyright 1998-2003 Sandia Corporation. + * Cplant(TM) Copyright 1998-2009 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States @@ -57,6 +57,7 @@ const struct inode_ops _sysio_nodev_ops _sysio_nodev_inop_getattr, _sysio_nodev_inop_setattr, _sysio_nodev_filldirentries, + _sysio_nodev_filldirentries2, _sysio_nodev_inop_mkdir, _sysio_nodev_inop_rmdir, _sysio_nodev_inop_symlink, |
From: Lee W. <lw...@us...> - 2009-04-10 21:30:09
|
Update of /cvsroot/libsysio/libsysio/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv19468/src Modified Files: Tag: 2.0 getdirentries.c Log Message: Re-implemented all of the getdirentries routines in order to provide a simplified interface for the drivers. A driver that does not wish to make use of the new interface need only add a new member, for filldirentries2, that points to NULL. When you are ready, though, your filldirentries2 service would look like: int filldirentries2(struct pnode *pno, _SYSIO_OFF_T * __restrict basep, filldir_t fill, void *data); For each entry you wish to populate, call the fill function with: res = (*fill)(data, inum, off, name, namlen, type); Where: inum is ino_t off is _SYSIO_OFF_T name point to the entry name namlen is length of the name, not including trailing NUL type is entry type, an unsigned char If the result is other than zero, you should stop trying to populate with entries and return the result the caller received. If your routine encounters errors you may return the error code in the usual fashion, a negated error value. That's it. No more populating internal scratch buffers or silly conversion passes. --- NEW FILE --- /* * This Cplant(TM) source code is the property of Sandia National * Laboratories. * * This Cplant(TM) source code is copyrighted by Sandia National * Laboratories. * * The redistribution of this Cplant(TM) source code is subject to the * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * * Cplant(TM) Copyright 1998-2009 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States * Government. */ /* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Questions or comments about this library should be sent to: * * Lee Ward * Sandia National Laboratories, New Mexico * P.O. Box 5800 * Albuquerque, NM 87185-1319 * * le...@sa... */ #include <unistd.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> #include <sys/queue.h> #include "sysio.h" #include "inode.h" #include "file.h" #include "sysio-symbols.h" #ifndef __GNUC__ #define __restrict #endif /* * Argument to filldir call-back function. */ struct filldir_info { char *buf; /* ptr to buf */ size_t remain; /* remaining in buf */ }; #ifndef _rndup #define _rndup(_n, _boundary) \ ((((_n) + (_boundary) - 1 ) / (_boundary)) * (_boundary)) #endif /* * Given directory entry type and length of name, without trailing * NUL, return the size of the directory entry. */ #define _dreclen(_ty, _namlen) \ _rndup(OFFSETOF(_ty, d_name) + (_namlen) + 1, sizeof(void *)) /* * Fake the old method of filling the directory entries for drivers * that have not yet implemented the new. */ static int helper(struct pnode *pno, _SYSIO_OFF_T * __restrict basep, filldir_t fill, void *info) { size_t nbytes = 16 * 1024; char *buf; ssize_t cc; struct dirent64 *d64p; int res; /* * Alloc scratch buffer. */ buf = malloc(nbytes); if (!buf) return -ENOMEM; /* * Fill. */ cc = PNOP_FILLDIRENTRIES(pno, basep, buf, nbytes); /* * Enumerate the entries in the scratch buffer, making the * call-back for each. */ res = 0; d64p = (struct dirent64 *)buf; while (cc > 0) { res = (*fill)(info, d64p->d_ino, d64p->d_off, d64p->d_name, strlen(d64p->d_name), d64p->d_type); if (res != 0) break; *basep = d64p->d_off; if (*basep != d64p->d_off) { res = -EOVERFLOW; break; } cc -= d64p->d_reclen; d64p = (struct dirent64 *)((char *)d64p + d64p->d_reclen); } /* * Clean up and return. */ free(buf); return res; } static ssize_t _p_getdirentries(struct pnode *pno, char *buf, size_t nbytes, _SYSIO_OFF_T * __restrict basep, filldir_t fill) { struct inode *ino; _SYSIO_OFF_T pos; struct filldir_info info; int res; ino = pno->p_base->pb_ino; if (!ino) return -EBADF; if (!S_ISDIR(ino->i_stbuf.st_mode)) return -ENOTDIR; pos = *basep; info.buf = buf; info.remain = nbytes; /* * If new filldirentries op is advertised use it. Otherwise, * fall back to the old. */ res = (ino->i_ops.inop_filldirentries2 ? PNOP_FILLDIRENTRIES2(pno, &pos, fill, &info) : helper(pno, &pos, fill, &info)); if (info.buf == buf) return res; *basep = pos; return info.buf - buf; } static ssize_t _getdirentries(int fd, char *buf, size_t nbytes, _SYSIO_OFF_T * __restrict basep, filldir_t fill) { struct file *fil; ssize_t cc; SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER(getdirentries, "%d%zu%d", fd, nbytes, *basep); do { fil = _sysio_fd_find(fd); if (!(fil && FIL_FILEOK(fil))) { cc = -EBADF; break; } cc = _p_getdirentries(fil->f_pno, buf, nbytes, basep, fill); } while (0); FIL_PUT(fil); SYSIO_INTERFACE_RETURN(cc < 0 ? -1 : cc, cc, getdirentries, "%zd%oY", *basep); } /* * Fill in one directory entry. */ static int filldir64(struct filldir_info *info, ino_t inum, _SYSIO_OFF_T off, const char *name, size_t namlen, unsigned char type) { size_t len; struct dirent64 *d64p; char *cp; len = _dreclen(dirent64, namlen); if (info->remain < len) return -EINVAL; d64p = (struct dirent64 *)info->buf; d64p->d_ino = inum; d64p->d_off = off; d64p->d_reclen = len; d64p->d_type = type; (void )memcpy(d64p->d_name, name, namlen); cp = d64p->d_name + namlen; info->buf += len; info->remain -= len; /* * NUL pad remainder of d_name. */ while (cp < info->buf) *cp++ = '\0'; return 0; } ssize_t _sysio_p_filldirentries(struct pnode *pno, char *buf, size_t nbytes, _SYSIO_OFF_T * __restrict basep) { return _p_getdirentries(pno, buf, nbytes, basep, (filldir_t )filldir64); } #ifdef _LARGEFILE64_SOURCE static ssize_t PREPEND(_, SYSIO_INTERFACE_NAME(getdirentries64))(int fd, char *buf, size_t nbytes, off_t * __restrict basep) { return _getdirentries(fd, buf, nbytes, basep, (filldir_t )filldir64); } #undef getdirentries64 sysio_sym_strong_alias(PREPEND(_, SYSIO_INTERFACE_NAME(getdirentries64)), SYSIO_INTERFACE_NAME(getdirentries64)) #endif #ifndef DIRENT64_IS_NATURAL /* * Fill in one directory entry. */ static int filldir(struct filldir_info *info, ino_t inum, _SYSIO_OFF_T off, const char *name, size_t namlen, unsigned char type) { size_t len; struct dirent *dp; char *cp; len = _dreclen(dirent, namlen); if (info->remain < len) return -EINVAL; dp = (struct dirent *)info->buf; dp->d_ino = inum; if (dp->d_ino != inum) return -EOVERFLOW; dp->d_off = off; if (dp->d_off != off) return -EOVERFLOW; dp->d_reclen = len; dp->d_type = type; (void )memcpy(dp->d_name, name, namlen); cp = dp->d_name + namlen; info->buf += len; info->remain -= len; /* * NUL pad remainder of d_name. */ while (cp < info->buf) *cp++ = '\0'; return 0; } #ifndef BSD ssize_t SYSIO_INTERFACE_NAME(getdirentries)(int fd, char *buf, size_t nbytes, off_t * __restrict basep) #else int SYSIO_INTERFACE_NAME(getdirentries)(int fd, char *buf, int nbytes, long * __restrict basep) #endif { _SYSIO_OFF_T pos; ssize_t cc; #ifndef BSD #define _cast #else #define _cast (int ) #endif pos = *basep; cc = _getdirentries(fd, buf, nbytes, &pos, (filldir_t )filldir); if (cc > 0) *basep = pos; return _cast cc; #undef _cast } #else /* !defined(DIRENT64_IS_NATURAL) */ sysio_sym_strong_alias(PREPEND(_, SYSIO_INTERFACE_NAME(getdirentries64), SYSIO_INTERFACE_NAME(getdirentries))) #endif #ifdef REDSTORM #undef __getdirentries sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(getdirentries), PREPEND(__, SYSIO_INTERFACE_NAME(getdirentries))) #endif #if defined(BSD) || defined(REDSTORM) #undef _getdirentries sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(getdirentries), PREPEND(_, SYSIO_INTERFACE_NAME(getdirentries))) #endif |
From: Lee W. <lw...@us...> - 2009-04-10 21:14:39
|
Update of /cvsroot/libsysio/libsysio/include In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16754/include Modified Files: inode.h Log Message: Support the new inode op, filldirentries2. Added op member, PNOP call, and type definition for fill directory entries helper, filldir_t. Index: inode.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/inode.h,v retrieving revision 1.52 retrieving revision 1.53 diff -u -w -b -B -p -r1.52 -r1.53 --- inode.h 4 Feb 2009 19:11:40 -0000 1.52 +++ inode.h 10 Apr 2009 21:14:20 -0000 1.53 @@ -73,6 +73,16 @@ struct io_arguments; struct ioctx; /* + * Fill directory entry routines. + */ +typedef int (*filldir_t)(void *, + ino_t, + _SYSIO_OFF_T, + const char *, + size_t, + unsigned char); + +/* * Operations on i-nodes. * * Should this be split up into file and name space operations? @@ -90,6 +100,10 @@ struct inode_ops { _SYSIO_OFF_T *posp, char *buf, size_t nbytes); + int (*inop_filldirentries2)(struct pnode *pno, + _SYSIO_OFF_T *, + filldir_t, + void *); int (*inop_mkdir)(struct pnode *pno, mode_t mode); int (*inop_rmdir)(struct pnode *pno); int (*inop_symlink)(struct pnode *pno, const char *data); @@ -575,6 +589,8 @@ struct pnode { (_pno), (_mask), (_stbuf)) #define PNOP_FILLDIRENTRIES(_pno, _posp, _buf, _nbytes) \ _PNOP_CALL((_pno), filldirentries, (_pno), (_posp), (_buf), (_nbytes)) +#define PNOP_FILLDIRENTRIES2(_pno, _posp, _fill, _data) \ + _PNOP_CALL((_pno), filldirentries2, (_pno), (_posp), (_fill), (_data)) #define PNOP_MKDIR(_pno, _mode) \ _PNOP_MKCALL((_pno), mkdir, (_pno), (_mode)) #define PNOP_RMDIR(_pno) \ |
From: Lee W. <lw...@us...> - 2009-03-24 18:12:29
|
Update of /cvsroot/libsysio/libsysio/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv418 Modified Files: Tag: RELEASE_1_3 inode.c Log Message: Path node reference counts are not being maintained correctly. Unmounts will abort the application. This change is a workaround to avoid that. As well, the library should not be built with the shutdown code. Index: inode.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/inode.c,v retrieving revision 1.27 retrieving revision 1.27.2.1 diff -u -w -b -B -p -r1.27 -r1.27.2.1 --- inode.c 1 May 2007 16:33:53 -0000 1.27 +++ inode.c 24 Mar 2009 18:12:19 -0000 1.27.2.1 @@ -744,7 +744,7 @@ _sysio_p_prune(struct pnode *root) * Ok to prune. */ if (pno->p_mount->mnt_root == pno) { -#ifndef AUTOMOUNT_FILE_NAME +#if 1 count++; continue; #else @@ -782,7 +782,7 @@ _sysio_p_prune(struct pnode *root) if (root->p_ref) { count++; } else if (root->p_mount->mnt_root == root) { -#ifndef AUTOMOUNT_FILE_NAME +#if 1 count++; #else /* |
From: Lee W. <lw...@us...> - 2009-03-19 21:03:37
|
Update of /cvsroot/libsysio/libsysio/tests In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23619 Modified Files: test_chown.c test_mkdir.c test_mknod.c Log Message: Also include xtio.h. From Dries Kimpe <dk...@mc...>. Index: test_chown.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_chown.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -b -B -p -r1.2 -r1.3 --- test_chown.c 28 Mar 2007 21:27:12 -0000 1.2 +++ test_chown.c 19 Mar 2009 21:03:25 -0000 1.3 @@ -53,6 +53,7 @@ #if defined(SYSIO_LABEL_NAMES) #include "sysio.h" #endif +#include "xtio.h" #include "test.h" /* Index: test_mkdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_mkdir.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -b -B -p -r1.3 -r1.4 --- test_mkdir.c 30 Apr 2007 16:52:20 -0000 1.3 +++ test_mkdir.c 19 Mar 2009 21:03:25 -0000 1.4 @@ -55,6 +55,7 @@ #if defined(SYSIO_LABEL_NAMES) #include "sysio.h" #endif +#include "xtio.h" #include "test.h" /* Index: test_mknod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_mknod.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -b -B -p -r1.2 -r1.3 --- test_mknod.c 28 Mar 2007 21:26:29 -0000 1.2 +++ test_mknod.c 19 Mar 2009 21:03:25 -0000 1.3 @@ -59,6 +59,7 @@ #if defined(SYSIO_LABEL_NAMES) #include "sysio.h" #endif +#include "xtio.h" #include "test.h" /* |
From: Lee W. <lw...@us...> - 2009-02-26 14:57:19
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31358/drivers/native Modified Files: fs_native.c Log Message: Include syscall.h from .../sys instead of just wherever. Inspired by a similar change to Lustre. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.69 retrieving revision 1.70 diff -u -w -b -B -p -r1.69 -r1.70 --- fs_native.c 28 Jan 2009 16:10:32 -0000 1.69 +++ fs_native.c 26 Feb 2009 14:57:03 -0000 1.70 @@ -56,7 +56,7 @@ #endif #include <errno.h> #include <assert.h> -#include <syscall.h> +#include <sys/syscall.h> #include <sys/time.h> #include <sys/types.h> #include <sys/stat.h> |
From: Lee W. <lw...@us...> - 2009-02-25 06:01:34
|
Update of /cvsroot/libsysio/libsysio/misc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7705 Modified Files: fhi.c Log Message: fhi_lookup now sets ND_NOFOLLOW; It won't follow if the last component of the passed path is a symbolic link. Index: fhi.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/misc/fhi.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1 -r1.2 --- fhi.c 4 Feb 2009 20:07:23 -0000 1.1 +++ fhi.c 25 Feb 2009 06:01:23 -0000 1.2 @@ -562,7 +562,7 @@ SYSIO_INTERFACE_NAME(fhi_lookup)(struct do { INTENT_INIT(&intent, iopmask, NULL, NULL); - err = fhi_namei(parent_fhi, path, 0, &intent, &pno); + err = fhi_namei(parent_fhi, path, ND_NOFOLLOW, &intent, &pno); if (err) break; len = fhi_load(parent_fhi->fhi_export, pno, result); |
From: Lee W. <lw...@us...> - 2009-02-25 05:09:06
|
Update of /cvsroot/libsysio/libsysio/tests In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5390 Modified Files: test_fhipath.c Log Message: Fixed usage message; Prints the right name, has space before first argument now. Index: test_fhipath.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_fhipath.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1 -r1.2 --- test_fhipath.c 4 Feb 2009 20:07:23 -0000 1.1 +++ test_fhipath.c 25 Feb 2009 05:08:58 -0000 1.2 @@ -280,7 +280,7 @@ usage() { (void )fprintf(stderr, - "Usage: test_path" + "Usage: test_fhipath" "<export-path> " " [<path>...]\n"); |
From: Lee W. <lw...@us...> - 2009-02-25 04:52:02
|
Update of /cvsroot/libsysio/libsysio/misc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4318 Added Files: module.mk Log Message: Build source out of misc directory as well. --- NEW FILE --- if WITH_FILE_HANDLE_INTERFACE FHI_INTERFACE_SRCS = misc/fhi.c else FHI_INTERFACE_SRCS = endif MISCDIR_SRCS = $(FHI_INTERFACE_SRCS) MISCDIR_EXTRA = misc/module.mk |
From: Lee W. <lw...@us...> - 2009-02-04 20:07:36
|
Update of /cvsroot/libsysio/libsysio/tests In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1058/tests Modified Files: Makefile.am module.mk Added Files: test_fhipath.c Log Message: A new API, built when --with-file-handle-interface is set to yes, is available with this deposit. The API allows operation by handles derived from exported volumes. At this point, it's not incredibly well tested. What is tested is the export/unexport functionality and the root_of, lookup, and stat functions. Hopefully, this will mature quickly. Not yet included is the ability to use credentials other than the caller's from it's process credentials. That ability should be here soon. --- NEW FILE --- /* * This Cplant(TM) source code is the property of Sandia National * Laboratories. * * This Cplant(TM) source code is copyrighted by Sandia National * Laboratories. * * The redistribution of this Cplant(TM) source code is subject to the * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * * Cplant(TM) Copyright 1998-2003 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States * Government. */ /* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Questions or comments about this library should be sent to: * * Lee Ward * Sandia National Laboratories, New Mexico * P.O. Box 5800 * Albuquerque, NM 87185-1110 * * le...@sa... */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <sys/uio.h> #include <getopt.h> #include <sys/statvfs.h> #if defined(SYSIO_LABEL_NAMES) #include "sysio.h" #endif #include "xtio.h" #include "test.h" #include "../misc/fhi.h" /* * Stat files. * * Usage: test_path [export-path] [path...] * * Without any path arguments, the program reads from standard-in, dealing with * each line as an absolute or relative path until EOF. */ static int key; static char root_handle_data[128]; static struct file_handle_info root_handle = { NULL, root_handle_data, sizeof(root_handle_data) }; static int statit(const char *path); static void usage(void); int main(int argc, char *const argv[]) { int i; int err; ssize_t cc; int n; extern int _test_sysio_startup(void); /* * Parse command line arguments. */ while ((i = getopt(argc, argv, "")) != -1) switch (i) { default: usage(); } /* * Init sysio lib. */ err = _test_sysio_startup(); if (err) { errno = -err; perror("sysio startup"); exit(1); } if (!(argc - optind)) usage(); key = 1; err = SYSIO_INTERFACE_NAME(fhi_export)(&key, sizeof(key), argv[optind], 0, &root_handle.fhi_export); if (err) { perror(argv[optind]); exit(1); } cc = SYSIO_INTERFACE_NAME(fhi_root_of)(root_handle.fhi_export, &root_handle); if (cc < 0) { perror(argv[optind]); exit(1); } if ((size_t )cc >= sizeof(root_handle_data)) { (void )fprintf(stderr, "%s: handle data too large\n", argv[optind]); exit(1); } optind++; n = argc - optind; /* * Try path(s) listed on command-line. */ while (optind < argc) { const char *path; path = argv[optind++]; (void )statit(path); } /* * If no command-line arguments, read from stdin until EOF. */ if (!n) { int doflush; static char buf[4096]; size_t len; char *cp; char c; doflush = 0; while (fgets(buf, sizeof(buf), stdin) != NULL) { len = strlen(buf); cp = buf + len - 1; c = *cp; *cp = '\0'; if (!doflush) statit(buf); doflush = c == '\n' ? 0 : 1; } } /* * Clean up. */ err = SYSIO_INTERFACE_NAME(fhi_unexport)(root_handle.fhi_export); if (err) { perror("FHI unexport"); exit(1); } _test_sysio_shutdown(); return 0; } static int statit(const char *path) { char handle_data[128]; struct file_handle_info handle = { NULL, handle_data, sizeof(handle_data) }; int err; struct stat64 stbuf; char t; static char buf[4096]; ssize_t cc; /* * Get file attrs. */ cc = SYSIO_INTERFACE_NAME(fhi_lookup)(&root_handle, path, 0, &handle); if (cc < 0) { perror(path); return -1; } if ((size_t )cc >= sizeof(root_handle_data)) { (void )fprintf(stderr, "%s: handle data too large\n", path); exit(1); } err = SYSIO_INTERFACE_NAME(fhi_getattr)(&handle, &stbuf); if (err) { perror(path); return -1; } /* * Get readable representation of file type. */ if (S_ISDIR(stbuf.st_mode)) t = 'd'; else if (S_ISCHR(stbuf.st_mode)) t = 'c'; else if (S_ISBLK(stbuf.st_mode)) t = 'b'; else if (S_ISREG(stbuf.st_mode)) t = 'f'; #ifdef S_ISFIFO else if (S_ISFIFO(stbuf.st_mode)) t = 'p'; #endif #ifdef S_ISLNK else if (S_ISLNK(stbuf.st_mode)) t = 'S'; #endif #ifdef S_ISSOCK else if (S_ISSOCK(stbuf.st_mode)) t = 's'; #endif #ifdef S_TYPEISMQ else if (S_TYPEISMQ(&stbuf)) t = 'q'; #endif #ifdef S_TYPEISSEM else if (S_TYPEISSEM(&stbuf)) t = 'M'; #endif #ifdef S_TYPEISSHM else if (S_TYPEISSHM(&stbuf)) t = 'm'; #endif else t = '?'; /* * Print path and type. */ if (S_ISLNK(stbuf.st_mode)) { cc = SYSIO_INTERFACE_NAME(readlink)(path, buf, sizeof(buf)); if (cc < 0) { perror(path); return -1; } } (void )printf("%s: %c", path, t); if (S_ISLNK(stbuf.st_mode) && (size_t )cc < sizeof(buf)) (void )printf(" %.*s", (int )cc, buf); (void )putchar('\n'); return 0; } static void usage() { (void )fprintf(stderr, "Usage: test_path" "<export-path> " " [<path>...]\n"); exit(1); } Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Makefile.am,v retrieving revision 1.34 retrieving revision 1.35 diff -u -w -b -B -p -r1.34 -r1.35 --- Makefile.am 28 Jan 2009 16:17:20 -0000 1.34 +++ Makefile.am 4 Feb 2009 20:07:23 -0000 1.35 @@ -4,10 +4,16 @@ else STATVFS_PROG= endif +if WITH_FILE_HANDLE_INTERFACE +FHI_PROG=test_fhipath +else +FHI_PROG= +endif + noinst_PROGRAMS = test_copy test_stats test_path test_list \ test_getcwd test_link test_unlink test_symlink \ test_rename test_regions test_stddir test_fcntl_lock test_mknod \ - test_mkdir test_chown $(STATVFS_PROG) + test_mkdir test_chown $(STATVFS_PROG) $(FHI_PROG) CLEANFILES=drv_data.c @@ -103,6 +109,10 @@ test_statvfs_SOURCES=test_statvfs.c $(CM test_statvfs_CFLAGS=$(CFL) test_statvfs_DEPENDENCIES=$(LIBS) +test_fhipath_SOURCES=test_fhipath.c $(CMNSRC) +test_fhipath_CFLAGS=$(CFL) +test_fhipath_DEPENDENCIES=$(LIBS) + drv_data.c: $(CONFIG_DEPENDENCIES) $(top_srcdir)/tests/gendrvdata.sh test -z "drv_data.c" && rm -f drv_data.c; \ $(SHELL) $(top_srcdir)/tests/gendrvdata.sh $(DRIVERS) > drv_data.c Index: module.mk =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/module.mk,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- module.mk 28 Jan 2009 15:54:36 -0000 1.4 +++ module.mk 4 Feb 2009 20:07:23 -0000 1.5 @@ -20,4 +20,5 @@ TESTS_EXTRA = \ tests/test_stddir.c \ tests/test_symlink.c \ tests/test_unlink.c \ + tests/test_fhipath.c \ tests/Makefile.am tests/Makefile.in tests/module.mk |
From: Lee W. <lw...@us...> - 2009-02-04 20:07:29
|
Update of /cvsroot/libsysio/libsysio/include In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1058/include Modified Files: sysio-cmn.h Log Message: A new API, built when --with-file-handle-interface is set to yes, is available with this deposit. The API allows operation by handles derived from exported volumes. At this point, it's not incredibly well tested. What is tested is the export/unexport functionality and the root_of, lookup, and stat functions. Hopefully, this will mature quickly. Not yet included is the ability to use credentials other than the caller's from it's process credentials. That ability should be here soon. Index: sysio-cmn.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio-cmn.h,v retrieving revision 1.20 retrieving revision 1.21 diff -u -w -b -B -p -r1.20 -r1.21 --- sysio-cmn.h 17 Jun 2008 17:18:57 -0000 1.20 +++ sysio-cmn.h 4 Feb 2009 20:07:23 -0000 1.21 @@ -222,6 +222,27 @@ typedef enum { SYSIO_TTAG(ftruncate), SYSIO_TTAG(unlink), SYSIO_TTAG(utime), +#ifdef FILE_HANDLE_INTERFACE + SYSIO_TTAG(fhi_export), + SYSIO_TTAG(fhi_unexport), + SYSIO_TTAG(fhi_root_of), + SYSIO_TTAG(fhi_iowait), + SYSIO_TTAG(fhi_getattr), + SYSIO_TTAG(fhi_setattr), + SYSIO_TTAG(fhi_lookup), + SYSIO_TTAG(fhi_readlink), + SYSIO_TTAG(fhi_read64x), + SYSIO_TTAG(fhi_write64x), + SYSIO_TTAG(fhi_create), + SYSIO_TTAG(fhi_unlink), + SYSIO_TTAG(fhi_rename), + SYSIO_TTAG(fhi_link), + SYSIO_TTAG(fhi_symlink), + SYSIO_TTAG(fhi_mkdir), + SYSIO_TTAG(fhi_rmdir), + SYSIO_TTAG(fhi_getdirentries64), + SYSIO_TTAG(fhi_statvfs64), +#endif } tracing_tag; extern void *_sysio_initializer_trace_q; |
From: Lee W. <lw...@us...> - 2009-02-04 20:07:29
|
Update of /cvsroot/libsysio/libsysio/misc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1058/misc Added Files: fhi.c fhi.h Log Message: A new API, built when --with-file-handle-interface is set to yes, is available with this deposit. The API allows operation by handles derived from exported volumes. At this point, it's not incredibly well tested. What is tested is the export/unexport functionality and the root_of, lookup, and stat functions. Hopefully, this will mature quickly. Not yet included is the ability to use credentials other than the caller's from it's process credentials. That ability should be here soon. --- NEW FILE --- /* * This Cplant(TM) source code is the property of Sandia National * Laboratories. * * This Cplant(TM) source code is copyrighted by Sandia National * Laboratories. * * The redistribution of this Cplant(TM) source code is subject to the * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * * Cplant(TM) Copyright 1998-2009 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States * Government. */ /* [...1030 lines suppressed...] SYSIO_INTERFACE_ENTER(fhi_statvfs64, "%hY", fhi); do { err = find_alias(fhi, &pno); if (err) break; err = PNOP_STATVFS(pno, buf); P_PUT(pno); } while (0); SYSIO_INTERFACE_RETURN(err, err, fhi_statvfs64, "%d%lvY", buf, 0); } --- NEW FILE --- /* * This Cplant(TM) source code is the property of Sandia National * Laboratories. * * This Cplant(TM) source code is copyrighted by Sandia National * Laboratories. * * The redistribution of this Cplant(TM) source code is subject to the * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * * Cplant(TM) Copyright 1998-2009 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States * Government. */ /* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Questions or comments about this library should be sent to: * * Lee Ward * Sandia National Laboratories, New Mexico * P.O. Box 5800 * Albuquerque, NM 87185-1319 * * le...@sa... */ struct file_handle_info_export; /* * File handle information contains everything necessary to uniquely * identify a file system object. */ struct file_handle_info { struct file_handle_info_export *fhi_export; /* associated export */ void *fhi_handle; /* opaque handle data */ size_t fhi_handle_len; /* opaque handle len */ }; /* * Set attributes record, used to alter an existing attribute. One sets * the flag, corresponding to the field to be changed, and the field itself. */ struct file_handle_info_sattr { unsigned fhisattr_mode_set : 1, /* set mode */ fhisattr_uid_set : 1, /* set uid */ fhisattr_gid_set : 1, /* set gid */ fhisattr_size_set : 1, /* set file length */ fhisattr_atime_set : 1, /* set last access */ fhisattr_mtime_set : 1; /* set last modify */ mode_t fhisattr_mode; /* desired mode */ uid_t fhisattr_uid; /* desired uid */ gid_t fhisattr_gid; /* desired gid */ off64_t fhisattr_size; /* desired length */ time_t fhisattr_atime; /* desired access */ time_t fhisattr_mtime; /* desired modify */ }; /* * Set an attribute value in the passed buffer. */ #define _FHISATTR_SET(_fhisattr, _n, _v) \ do { \ (_fhisattr)->fhisattr_ ##_n _set = 1; \ (_fhisattr)->fhisattr_ ##_n = (_v); \ } while (0) /* * Helper macros to set both the mask and value in the file handle info set * attribute record. */ #define FHISATTR_SET_MODE(_fhisattr, _v) \ _FHISATTR_SET((_fhisattr), mode, (_v) & 07777) #define FHISATTR_SET_UID(_fhisattr, _v) \ _FHISATTR_SET((_fhisattr), uid, (_v)) #define FHISATTR_SET_GID(_fhisattr, _v) \ _FHISATTR_SET((_fhisattr), gid, (_v)) #define FHISATTR_SET_SIZE(_fhisattr, _v) \ _FHISATTR_SET((_fhisattr), size, (_v)) #define FHISATTR_SET_ATIME(_fhisattr, _v) \ _FHISATTR_SET((_fhisattr), atime, (_v)) #define FHISATTR_SET_MTIME(_fhisattr, _v) \ _FHISATTR_SET((_fhisattr), mtime, (_v)) /* * Clear all attribute values in passed file handle info set attribute record * buffer. */ #define FHISATTR_CLEAR(_fhisattr) \ do { \ FHISATTR_MODE_SET((_fhisattr), 0); \ FHISATTR_UID_SET((_fhisattr), -1); \ FHISATTR_GID_SET((_fhisattr), -1); \ FHISATTR_SIZE_SET((_fhisattr), 0); \ FHISATTR_ATIME_SET((_fhisattr), 0); \ FHISATTR_MTIME_SET((_fhisattr), 0); \ } while (0); /* * Arguments for file handle information directory operations. */ struct file_handle_info_dirop_args { struct file_handle_info *fhida_dir; const char *fhida_path; }; extern int SYSIO_INTERFACE_NAME(fhi_export)(const void *key, size_t keylen, const char *source, unsigned flags, struct file_handle_info_export **fhiexpp); extern int SYSIO_INTERFACE_NAME(fhi_unexport)(struct file_handle_info_export *fhiexp); extern ssize_t SYSIO_INTERFACE_NAME(fhi_root_of)(struct file_handle_info_export *fhiexp, struct file_handle_info *fhi); extern ssize_t SYSIO_INTERFACE_NAME(fhi_iowait)(ioid_t ioid); extern int SYSIO_INTERFACE_NAME(fhi_iodone)(ioid_t ioid); extern int SYSIO_INTERFACE_NAME(fhi_getattr)(struct file_handle_info *fhi, struct stat64 *buf); extern int SYSIO_INTERFACE_NAME(fhi_setattr)(struct file_handle_info *fhi, struct file_handle_info_sattr *fhisattr); extern ssize_t SYSIO_INTERFACE_NAME(fhi_lookup)(struct file_handle_info *parent_fhi, const char *path, unsigned iopmask, struct file_handle_info *result); extern ssize_t SYSIO_INTERFACE_NAME(fhi_readlink)(struct file_handle_info *fhi, char *buf, size_t bufsiz); extern int SYSIO_INTERFACE_NAME(fhi_iread64x)(struct file_handle_info *fhi, const struct iovec *iov, size_t iov_count, const struct xtvec64 *xtv, size_t xtv_count, ioid_t *ioidp); extern int SYSIO_INTERFACE_NAME(fhi_iwrite64x)(struct file_handle_info *fhi, const struct iovec *iov, size_t iov_count, const struct xtvec64 *xtv, size_t xtv_count, ioid_t *ioidp); extern int SYSIO_INTERFACE_NAME(fhi_create)(struct file_handle_info_dirop_args *where, mode_t mode); extern int SYSIO_INTERFACE_NAME(fhi_unlink)(struct file_handle_info_dirop_args *where); extern int SYSIO_INTERFACE_NAME(fhi_rename)(struct file_handle_info_dirop_args *from, struct file_handle_info_dirop_args *to); extern int SYSIO_INTERFACE_NAME(fhi_link)(struct file_handle_info_dirop_args *from, struct file_handle_info_dirop_args *to); extern int SYSIO_INTERFACE_NAME(fhi_symlink)(struct file_handle_info_dirop_args *from, const char *to); extern int SYSIO_INTERFACE_NAME(fhi_mkdir)(struct file_handle_info_dirop_args *where, mode_t mode); extern int SYSIO_INTERFACE_NAME(fhi_rmdir)(struct file_handle_info_dirop_args *where); extern ssize_t SYSIO_INTERFACE_NAME(fhi_getdirents64)(struct file_handle_info *fhi, char *buf, size_t nbytes, off64_t * __restrict basep); extern int SYSIO_INTERFACE_NAME(fhi_statvfs)(struct file_handle_info *fhi, struct statvfs64 *buf); |
From: Lee W. <lw...@us...> - 2009-02-04 20:07:29
|
Update of /cvsroot/libsysio/libsysio In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1058 Modified Files: Makefile.am configure.in Log Message: A new API, built when --with-file-handle-interface is set to yes, is available with this deposit. The API allows operation by handles derived from exported volumes. At this point, it's not incredibly well tested. What is tested is the export/unexport functionality and the root_of, lookup, and stat functions. Hopefully, this will mature quickly. Not yet included is the ability to use credentials other than the caller's from it's process credentials. That ability should be here soon. Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/Makefile.am,v retrieving revision 1.18 retrieving revision 1.19 diff -u -w -b -B -p -r1.18 -r1.19 --- Makefile.am 15 Oct 2008 22:01:01 -0000 1.18 +++ Makefile.am 4 Feb 2009 20:07:22 -0000 1.19 @@ -13,6 +13,7 @@ include $(top_srcdir)/dev/module.mk include $(top_srcdir)/dev/stdfd/module.mk include $(top_srcdir)/drivers/incore/module.mk include $(top_srcdir)/drivers/native/module.mk +include $(top_srcdir)/misc/module.mk lib_LIBRARIES = ${LIBBUILD_DIR}/libsysio.a @@ -43,6 +44,7 @@ endif __LIBBUILD_DIR__libsysio_a_SOURCES = \ $(SRCDIR_SRCS) \ $(THREAD_MODEL_POSIX_SRCS) \ + $(MISCDIR_SRCS) \ $(OPTIONAL_STDDEV_SRCS) \ $(OPTIONAL_STDFD_SRCS) \ $(OPTIONAL_INCORE_SRCS) \ Index: configure.in =================================================================== RCS file: /cvsroot/libsysio/libsysio/configure.in,v retrieving revision 1.43 retrieving revision 1.44 diff -u -w -b -B -p -r1.43 -r1.44 --- configure.in 15 Oct 2008 22:01:01 -0000 1.43 +++ configure.in 4 Feb 2009 20:07:22 -0000 1.44 @@ -175,6 +175,22 @@ if test x$with_threads = xposix; then fi AM_CONDITIONAL(WITH_THREAD_MODEL_POSIX, test x$with_threads = xposix) +AC_ARG_WITH(file-handle-interface, + AC_HELP_STRING([--with-file-handle-interface], + [enable file handle API support]), + [ case "${withval}" in + yes) ;; + no) ;; + *) AC_MSG_ERROR(bad value ${withval} for --with-file-handle-interface) ;; + esac], + ) +AM_CONDITIONAL(WITH_FILE_HANDLE_INTERFACE, + test x$with_file_handle_interface = xyes) +if test x$with_file_handle_interface = xyes; then + AC_DEFINE(I_ASSOCIATIONS) + AC_DEFINE(FILE_HANDLE_INTERFACE) +fi + # We keep the original values in `$config_*' and never modify them, so we # can write them unchanged into config.make. Everything else uses # $machine, $vendor, and $os, and changes them whenever convenient. |
From: Lee W. <lw...@us...> - 2009-02-04 19:17:47
|
Update of /cvsroot/libsysio/libsysio/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27400/src Modified Files: namei.c Log Message: Added support for the new ND_NXMNT flag. Changed the local routine that traverses to the next component in a path, called lookup. It now takes nameidata flags, and honors ND_NOPERMCHECK and ND_NXMNT. Removed the check_permissions flag as it's function is captured in this more general mechanism. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -w -b -B -p -r1.33 -r1.34 --- namei.c 6 Dec 2008 21:56:25 -0000 1.33 +++ namei.c 4 Feb 2009 19:17:42 -0000 1.34 @@ -82,10 +82,10 @@ _sysio_next_component(const char *path, static int lookup(struct pnode *parent, struct qstr *name, + unsigned flags, struct pnode **pnop, struct intent *intnt, - const char *path, - int check_permissions) + const char *path) { int err; struct pnode *pno; @@ -98,7 +98,7 @@ lookup(struct pnode *parent, * Sometimes we don't want to check permissions. At initialization * time, for instance. */ - if (check_permissions) { + if (!(flags & ND_NOPERMCHECK)) { err = _sysio_permitted(parent, X_OK); if (err) return err; @@ -123,7 +123,9 @@ lookup(struct pnode *parent, * one node in any given type locked while we're doing this. */ pno = parent; - if (pno == pno->p_parent && pno->p_cover != pno) { + if (!(flags & ND_NXMNT) && + pno == pno->p_parent && + pno->p_cover != pno) { /* * This node loops on itself and is not the root @@ -168,6 +170,7 @@ lookup(struct pnode *parent, err = _sysio_p_find_alias(parent, name, &pno); if (err) return err; + if (!(flags & ND_NXMNT)) { /* * While covered, move to the covering node. */ @@ -180,6 +183,7 @@ lookup(struct pnode *parent, pno = cover; } } + } *pnop = pno; @@ -198,6 +202,7 @@ lookup(struct pnode *parent, * ND_NEGOK if terminal/leaf does not exist, return * path node (alias) anyway. * ND_NOPERMCHECK do not check permissions + * ND_NXMNT do not cross mount points */ int _sysio_path_walk(struct pnode *parent, struct nameidata *nd) @@ -247,7 +252,11 @@ _sysio_path_walk(struct pnode *parent, s parent = nd->nd_root; if (!parent) abort(); - (void )_sysio_namei(nd->nd_root, icwd, 0, NULL, &parent); + (void )_sysio_namei(nd->nd_root, + icwd, + nd->nd_flags & ND_NXMNT, + NULL, + &parent); if (_sysio_p_chdir(parent) != 0) abort(); P_PUT(parent); @@ -328,7 +337,8 @@ _sysio_path_walk(struct pnode *parent, s ino = nd->nd_pno->p_base->pb_ino; } #ifdef AUTOMOUNT_FILE_NAME - else if (ino && + else if ((nd->nd_flags & ND_NXMNT) && + ino && nd->nd_amcnt < MAX_MOUNT_DEPTH && S_ISDIR(ino->i_stbuf.st_mode) && ino->i_stbuf.st_mode & S_ISUID && @@ -351,10 +361,10 @@ _sysio_path_walk(struct pnode *parent, s err = lookup(nd->nd_pno, &_sysio_mount_file_name, + 0, &pno, NULL, - NULL, - 1); + NULL); } if (!err && (err = _sysio_automount(pno)) == 0) { struct pnode *covered; @@ -463,12 +473,12 @@ _sysio_path_walk(struct pnode *parent, s err = lookup(parent, &this, + (nd->nd_flags & (ND_NOPERMCHECK|ND_NXMNT)), &nd->nd_pno, (path || !next.len) ? nd->nd_intent : NULL, - (path && next.len) ? path : NULL, - !(nd->nd_flags & ND_NOPERMCHECK)); + (path && next.len) ? path : NULL); if (err) { if (err == -ENOENT && !next.len && |
From: Lee W. <lw...@us...> - 2009-02-04 19:11:47
|
Update of /cvsroot/libsysio/libsysio/include In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26722/include Modified Files: inode.h Log Message: Added a new flag for namei, ND_NXMNT. This flag will cause namei to refrain from crossing mount points while resolving a path. Index: inode.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/inode.h,v retrieving revision 1.51 retrieving revision 1.52 diff -u -w -b -B -p -r1.51 -r1.52 --- inode.h 28 Jan 2009 16:13:19 -0000 1.51 +++ inode.h 4 Feb 2009 19:11:40 -0000 1.52 @@ -664,6 +664,7 @@ struct nameidata { #define ND_NOFOLLOW 0x01 /* no follow symlinks */ #define ND_NEGOK 0x02 /* last missing is ok */ #define ND_NOPERMCHECK 0x04 /* don't check perms */ +#define ND_NXMNT 0x08 /* don't cross mounts */ #ifdef AUTOMOUNT_FILE_NAME #define _ND_INIT_AUTOMOUNT(nd) ((nd)->nd_amcnt = 0) |
From: Lee W. <lw...@us...> - 2009-01-28 16:17:27
|
Update of /cvsroot/libsysio/libsysio/tests In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32227 Modified Files: Makefile.am Log Message: Last change got rid of *one* of the redundant test_stddir specifications; Oops. This one gets the second. Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Makefile.am,v retrieving revision 1.33 retrieving revision 1.34 diff -u -w -b -B -p -r1.33 -r1.34 --- Makefile.am 28 Jan 2009 16:15:35 -0000 1.33 +++ Makefile.am 28 Jan 2009 16:17:20 -0000 1.34 @@ -71,10 +71,6 @@ test_symlink_SOURCES=test_symlink.c $(CM test_symlink_CFLAGS=$(CFL) test_symlink_DEPENDENCIES=$(LIBS) -test_stddir_SOURCES=test_stddir.c $(CMNSRC) -test_stddir_CFLAGS=$(CFL) -test_stddir_DEPENDENCIES=$(LIBS) - test_rename_SOURCES=test_rename.c $(CMNSRC) test_rename_CFLAGS=$(CFL) test_rename_DEPENDENCIES=$(LIBS) |
From: Lee W. <lw...@us...> - 2009-01-28 16:15:43
|
Update of /cvsroot/libsysio/libsysio/tests In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32064 Modified Files: Makefile.am Log Message: Had specified test_stddir twice. This caused a warning but no problem. Got rid of the redundant one, anyway. Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Makefile.am,v retrieving revision 1.32 retrieving revision 1.33 diff -u -w -b -B -p -r1.32 -r1.33 --- Makefile.am 28 Jan 2009 15:54:36 -0000 1.32 +++ Makefile.am 28 Jan 2009 16:15:35 -0000 1.33 @@ -5,7 +5,7 @@ STATVFS_PROG= endif noinst_PROGRAMS = test_copy test_stats test_path test_list \ - test_getcwd test_link test_unlink test_symlink test_stddir \ + test_getcwd test_link test_unlink test_symlink \ test_rename test_regions test_stddir test_fcntl_lock test_mknod \ test_mkdir test_chown $(STATVFS_PROG) |
From: Lee W. <lw...@us...> - 2009-01-28 16:13:26
|
Update of /cvsroot/libsysio/libsysio/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31818/src Modified Files: getdirentries.c inode.c link.c readlink.c rename.c rmdir.c rw.c symlink.c unlink.c Log Message: Big code refactor to pave the way folr the handles-based API. No, real, functional change. Index: getdirentries.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/getdirentries.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -w -b -B -p -r1.27 -r1.28 --- getdirentries.c 17 Jun 2008 17:18:57 -0000 1.27 +++ getdirentries.c 28 Jan 2009 16:13:19 -0000 1.28 @@ -63,25 +63,40 @@ #define __restrict #endif -static ssize_t -filldirents(struct file *fil, - char *buf, size_t nbytes, +ssize_t +_sysio_p_filldirentries(struct pnode *pno, + char *buf, + size_t nbytes, _SYSIO_OFF_T *__restrict basep) { - _SYSIO_OFF_T opos; + _SYSIO_OFF_T pos; ssize_t cc; - if (!(fil && fil->f_pno->p_base->pb_ino)) + if (!pno->p_base->pb_ino) return -EBADF; - if (!S_ISDIR(fil->f_pno->p_base->pb_ino->i_stbuf.st_mode)) + if (!S_ISDIR(pno->p_base->pb_ino->i_stbuf.st_mode)) return -ENOTDIR; - opos = fil->f_pos; + pos = *basep; cc = - PNOP_FILLDIRENTRIES(fil->f_pno, &fil->f_pos, buf, nbytes); - if (cc < 0) + PNOP_FILLDIRENTRIES(pno, &pos, buf, nbytes); + if (cc >= 0) + *basep = pos; return cc; - *basep = opos; +} + +static ssize_t +filldirents(struct file *fil, + char *buf, size_t nbytes, + _SYSIO_OFF_T *__restrict basep) +{ + ssize_t cc; + + if (!fil) + return -EBADF; + cc = _sysio_p_filldirentries(fil->f_pno, buf, nbytes, basep); + if (cc >= 0) + fil->f_pos = *basep; return cc; } @@ -175,7 +190,10 @@ SYSIO_INTERFACE_NAME(getdirentries)(int cc = -EBADF; /* assume failure */ fil = _sysio_fd_find(fd); - if (FIL_FILEOK(fil)) { + if (*basep < 0) + cc = 0; + else if (FIL_FILEOK(fil)) { + b = *basep; cc = filldirents(fil, buf, nbytes, &b); FIL_PUT(fil); } Index: inode.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/inode.c,v retrieving revision 1.54 retrieving revision 1.55 diff -u -w -b -B -p -r1.54 -r1.55 --- inode.c 22 Jan 2009 19:12:19 -0000 1.54 +++ inode.c 28 Jan 2009 16:13:19 -0000 1.55 @@ -608,7 +608,7 @@ _sysio_pb_gone(struct pnode_base *pb) /* * Clean up the namespace graph after an unlink. */ -static void +void _sysio_pb_disconnect(struct pnode_base *pb) { @@ -1263,194 +1263,6 @@ _sysio_p_setattr(struct pnode *pno, } /* - * Perform link operation; old to new. - */ -int -_sysio_p_link(struct pnode *old, struct pnode *new) -{ - int err; - - if (S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)) - return -EPERM; - if (new->p_base->pb_ino) - return -EEXIST; - /* - * Make sure they aren't trying to link across a mount-point. - * - * NB: Arguably, should check that the root pnodes are the same. - * However, that would allow linking across bound mounts. I'm thinking - * we don't want to allow that. Though, I don't really know why not. - * I'm a pedant? - */ - if (old->p_mount != new->p_mount) - return -EXDEV; - if (IS_RDONLY(new->p_parent)) - return -EROFS; - err = PNOP_LINK(old, new); - if (err) - return err; - PB_SET_ASSOC(new->p_base, old->p_base->pb_ino); - I_REF(new->p_base->pb_ino); - return 0; -} - -/* - * Perform unlink operation on some pnode. - */ -int -_sysio_p_unlink(struct pnode *pno) -{ - int err; - - if (IS_RDONLY(pno)) - return -EROFS; - if (!pno->p_base->pb_ino) - return -ENOENT; /* huh? */ - if (S_ISDIR(pno->p_base->pb_ino->i_stbuf.st_mode)) - return -EISDIR; - /* - * Call the FS implementation. - */ - err = PNOP_UNLINK(pno); - if (err) - return err; - /* - * Clean the namespace graphs to reflect the unlink. - */ - _sysio_i_undead(pno->p_base->pb_ino); - _sysio_pb_disconnect(pno->p_base); - return 0; -} - -/* - * Perform symlink operation; oldpath to new. - */ -int -_sysio_p_symlink(const char *oldpath, struct pnode *new) -{ - - if (new->p_base->pb_ino) - return -EEXIST; - if (IS_RDONLY(new->p_parent)) - return -EROFS; - return PNOP_SYMLINK(new, oldpath); -} - -/* - * Perform remove directory operation on some pnode. - */ -int -_sysio_p_rmdir(struct pnode *pno) -{ - int err; - - if (IS_RDONLY(pno)) - return -EROFS; - if (!pno->p_base->pb_ino) - return -ENOENT; /* huh? */ - if (!S_ISDIR(pno->p_base->pb_ino->i_stbuf.st_mode)) - return -ENOTDIR; - /* - * Don't allow unlink of a root or a mount point. - */ - if (pno->p_cover || pno->p_mount->mnt_root == pno) - return -EBUSY; - /* - * Call the FS implementation. - */ - err = PNOP_RMDIR(pno); - if (err) - return err; - /* - * Clean the namespace graphs to reflect the unlink. - */ - _sysio_i_undead(pno->p_base->pb_ino); - _sysio_pb_disconnect(pno->p_base); - return 0; -} - -/* - * Perform rename operation on some pnode. - */ -int -_sysio_p_rename(struct pnode *old, struct pnode *new) -{ - struct pnode_base *nxtpb, *pb; - int err; - - /* - * Check for rename to self. - */ - if (old == new) - return 0; - - /* - * No xdev renames please. - */ - if (old->p_mount->mnt_fs != new->p_mount->mnt_fs) - return -EXDEV; - - /* - * Must not be a read-only mount. - * - * NB: Invariant old->p_mount->mnt_fs == new->p_mount->mnt_fs. - */ - if (IS_RDONLY(new)) - return -EROFS; - - /* - * Don't allow mount points to move. - */ - if (old->p_mount->mnt_root == old || - old->p_cover || - new->p_mount->mnt_root == new) - return -EBUSY; - - /* - * Make sure the old pnode can't be found in the ancestor chain - * for the new. If it can, they are trying to move into a subdirectory - * of the old. - */ - nxtpb = new->p_base; - do { - pb = nxtpb; - nxtpb = pb->pb_key.pbk_parent; - if (pb == old->p_base) - return -EINVAL; - } while (nxtpb); - - if (new->p_base->pb_ino) { - /* - * Existing entry. We're replacing the new. Make sure that's - * ok. - */ - if (S_ISDIR(new->p_base->pb_ino->i_stbuf.st_mode)) { - if (!S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)) - return -EISDIR; - } else if (S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)) - return -ENOTDIR; - } - - /* - * Give the op a try. - */ - err = PNOP_RENAME(old, new); - if (err) - return err; - /* - * Disconnect the old. - */ - _sysio_pb_disconnect(old->p_base); - /* - * Disconnect the new if positive. We want new lookups - * to find the just renamed entity. - */ - if (new->p_base->pb_ino) - _sysio_pb_disconnect(new->p_base); - return 0; -} - -/* * Do nothing. */ void Index: link.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/link.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -w -b -B -p -r1.16 -r1.17 --- link.c 17 Jun 2008 17:18:57 -0000 1.16 +++ link.c 28 Jan 2009 16:13:19 -0000 1.17 @@ -54,6 +54,193 @@ #include "inode.h" #include "sysio-symbols.h" +/* + * Perform link operation; old to new. + */ +int +_sysio_p_link(struct pnode *old, struct pnode *new) +{ + int err; + + if (S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)) + return -EPERM; + if (new->p_base->pb_ino) + return -EEXIST; + /* + * Make sure they aren't trying to link across a mount-point. + * + * NB: Arguably, should check that the root pnodes are the same. + * However, that would allow linking across bound mounts. I'm thinking + * we don't want to allow that. Though, I don't really know why not. + * I'm a pedant? + */ + if (old->p_mount != new->p_mount) + return -EXDEV; + if (IS_RDONLY(new->p_parent)) + return -EROFS; + err = PNOP_LINK(old, new); + if (err) + return err; + PB_SET_ASSOC(new->p_base, old->p_base->pb_ino); + I_REF(new->p_base->pb_ino); + return 0; +} + +/* + * Perform unlink operation on some pnode. + */ +int +_sysio_p_unlink(struct pnode *pno) +{ + int err; + + if (IS_RDONLY(pno)) + return -EROFS; + if (!pno->p_base->pb_ino) + return -ENOENT; /* huh? */ + if (S_ISDIR(pno->p_base->pb_ino->i_stbuf.st_mode)) + return -EISDIR; + /* + * Call the FS implementation. + */ + err = PNOP_UNLINK(pno); + if (err) + return err; + /* + * Clean the namespace graphs to reflect the unlink. + */ + _sysio_i_undead(pno->p_base->pb_ino); + _sysio_pb_disconnect(pno->p_base); + return 0; +} + +/* + * Perform symlink operation; oldpath to new. + */ +int +_sysio_p_symlink(const char *oldpath, struct pnode *new) +{ + + if (new->p_base->pb_ino) + return -EEXIST; + if (IS_RDONLY(new->p_parent)) + return -EROFS; + return PNOP_SYMLINK(new, oldpath); +} + +/* + * Perform remove directory operation on some pnode. + */ +int +_sysio_p_rmdir(struct pnode *pno) +{ + int err; + + if (IS_RDONLY(pno)) + return -EROFS; + if (!pno->p_base->pb_ino) + return -ENOENT; /* huh? */ + if (!S_ISDIR(pno->p_base->pb_ino->i_stbuf.st_mode)) + return -ENOTDIR; + /* + * Don't allow unlink of a root or a mount point. + */ + if (pno->p_cover || pno->p_mount->mnt_root == pno) + return -EBUSY; + /* + * Call the FS implementation. + */ + err = PNOP_RMDIR(pno); + if (err) + return err; + /* + * Clean the namespace graphs to reflect the unlink. + */ + _sysio_i_undead(pno->p_base->pb_ino); + _sysio_pb_disconnect(pno->p_base); + return 0; +} + +/* + * Perform rename operation on some pnode. + */ +int +_sysio_p_rename(struct pnode *old, struct pnode *new) +{ + struct pnode_base *nxtpb, *pb; + int err; + + /* + * Check for rename to self. + */ + if (old == new) + return 0; + + /* + * No xdev renames please. + */ + if (old->p_mount->mnt_fs != new->p_mount->mnt_fs) + return -EXDEV; + + /* + * Must not be a read-only mount. + * + * NB: Invariant old->p_mount->mnt_fs == new->p_mount->mnt_fs. + */ + if (IS_RDONLY(new)) + return -EROFS; + + /* + * Don't allow mount points to move. + */ + if (old->p_mount->mnt_root == old || + old->p_cover || + new->p_mount->mnt_root == new) + return -EBUSY; + + /* + * Make sure the old pnode can't be found in the ancestor chain + * for the new. If it can, they are trying to move into a subdirectory + * of the old. + */ + nxtpb = new->p_base; + do { + pb = nxtpb; + nxtpb = pb->pb_key.pbk_parent; + if (pb == old->p_base) + return -EINVAL; + } while (nxtpb); + + if (new->p_base->pb_ino) { + /* + * Existing entry. We're replacing the new. Make sure that's + * ok. + */ + if (S_ISDIR(new->p_base->pb_ino->i_stbuf.st_mode)) { + if (!S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)) + return -EISDIR; + } else if (S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)) + return -ENOTDIR; + } + + /* + * Give the op a try. + */ + err = PNOP_RENAME(old, new); + if (err) + return err; + /* + * Disconnect the old. + */ + _sysio_pb_disconnect(old->p_base); + /* + * Disconnect the new if positive. We want new lookups + * to find the just renamed entity. + */ + if (new->p_base->pb_ino) + _sysio_pb_disconnect(new->p_base); + return 0; +} int SYSIO_INTERFACE_NAME(link)(const char *oldpath, const char *newpath) { Index: readlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/readlink.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -b -B -p -r1.11 -r1.12 --- readlink.c 17 Jun 2008 17:18:57 -0000 1.11 +++ readlink.c 28 Jan 2009 16:13:19 -0000 1.12 @@ -52,6 +52,20 @@ #include "inode.h" #include "sysio-symbols.h" +/* + * Read symbolic link content from passed path-node. + */ +ssize_t +_sysio_p_readlink(struct pnode *pno, char *buf, size_t bufsiz) +{ + + if (!pno->p_base->pb_ino) + return -ESTALE; + if (!S_ISLNK(pno->p_base->pb_ino->i_stbuf.st_mode)) + return -EINVAL; + return (ssize_t )PNOP_READLINK(pno, buf, bufsiz); +} + #ifdef HAVE_POSIX_1003_READLINK ssize_t #else @@ -61,30 +75,32 @@ SYSIO_INTERFACE_NAME(readlink)(const cha { struct intent intent; int err; + ssize_t cc; struct pnode *pno; SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER(readlink, "%s%zd", path, bufsiz); - INTENT_INIT(&intent, INT_GETATTR, NULL, NULL); + INTENT_INIT(&intent, 0, NULL, NULL); err = _sysio_namei(_sysio_cwd, path, ND_NOFOLLOW, &intent, &pno); - if (err) + if (err) { + cc = err; goto out; - if (!S_ISLNK(pno->p_base->pb_ino->i_stbuf.st_mode)) { - err = -EINVAL; - goto error; } - err = PNOP_READLINK(pno, buf, bufsiz); -error: + cc = _sysio_p_readlink(pno, buf, bufsiz); P_PUT(pno); out: #ifdef HAVE_POSIX_1003_READLINK +#define _ty ssize_t #define _rtnfmt "%zd" #else +#define _ty int #define _rtnfmt "%d" #endif - SYSIO_INTERFACE_RETURN(err < 0 ? -1 : err, err >= 0 ? 0 : err, - readlink, _rtnfmt "%*s", err, buf); + SYSIO_INTERFACE_RETURN((_ty )(cc < 0 ? -1 : cc), + cc >= 0 ? 0 : (int )cc, + readlink, _rtnfmt "%*s", cc, buf); #undef _rtnfmt +#undef _ty } #ifdef REDSTORM Index: rename.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rename.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -b -B -p -r1.15 -r1.16 --- rename.c 17 Jun 2008 17:18:57 -0000 1.15 +++ rename.c 28 Jan 2009 16:13:19 -0000 1.16 @@ -54,6 +54,87 @@ #include "mount.h" #include "inode.h" +/* + * Perform rename operation on some pnode. + */ +int +_sysio_p_rename(struct pnode *old, struct pnode *new) +{ + struct pnode_base *nxtpb, *pb; + int err; + + /* + * Check for rename to self. + */ + if (old == new) + return 0; + + /* + * No xdev renames please. + */ + if (old->p_mount->mnt_fs != new->p_mount->mnt_fs) + return -EXDEV; + + /* + * Must not be a read-only mount. + * + * NB: Invariant old->p_mount->mnt_fs == new->p_mount->mnt_fs. + */ + if (IS_RDONLY(new)) + return -EROFS; + + /* + * Don't allow mount points to move. + */ + if (old->p_mount->mnt_root == old || + old->p_cover || + new->p_mount->mnt_root == new) + return -EBUSY; + + /* + * Make sure the old pnode can't be found in the ancestor chain + * for the new. If it can, they are trying to move into a subdirectory + * of the old. + */ + nxtpb = new->p_base; + do { + pb = nxtpb; + nxtpb = pb->pb_key.pbk_parent; + if (pb == old->p_base) + return -EINVAL; + } while (nxtpb); + + if (new->p_base->pb_ino) { + /* + * Existing entry. We're replacing the new. Make sure that's + * ok. + */ + if (S_ISDIR(new->p_base->pb_ino->i_stbuf.st_mode)) { + if (!S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)) + return -EISDIR; + } else if (S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)) + return -ENOTDIR; + } + + /* + * Give the op a try. + */ + err = PNOP_RENAME(old, new); + if (err) + return err; + /* + * Disconnect the old. + */ + _sysio_pb_disconnect(old->p_base); + /* + * Disconnect the new if positive. We want new lookups + * to find the just renamed entity. + */ + if (new->p_base->pb_ino) + _sysio_pb_disconnect(new->p_base); + return 0; +} + int SYSIO_INTERFACE_NAME(rename)(const char *oldpath, const char *newpath) { Index: rmdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rmdir.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -w -b -B -p -r1.23 -r1.24 --- rmdir.c 17 Jun 2008 17:18:57 -0000 1.23 +++ rmdir.c 28 Jan 2009 16:13:19 -0000 1.24 @@ -54,6 +54,39 @@ #include "mount.h" #include "sysio-symbols.h" +/* + * Perform remove directory operation on some pnode. + */ +int +_sysio_p_rmdir(struct pnode *pno) +{ + int err; + + if (IS_RDONLY(pno)) + return -EROFS; + if (!pno->p_base->pb_ino) + return -ENOENT; /* huh? */ + if (!S_ISDIR(pno->p_base->pb_ino->i_stbuf.st_mode)) + return -ENOTDIR; + /* + * Don't allow unlink of a root or a mount point. + */ + if (pno->p_cover || pno->p_mount->mnt_root == pno) + return -EBUSY; + /* + * Call the FS implementation. + */ + err = PNOP_RMDIR(pno); + if (err) + return err; + /* + * Clean the namespace graphs to reflect the unlink. + */ + _sysio_i_undead(pno->p_base->pb_ino); + _sysio_pb_disconnect(pno->p_base); + return 0; +} + int SYSIO_INTERFACE_NAME(rmdir)(const char *path) { Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -w -b -B -p -r1.30 -r1.31 --- rw.c 11 Jul 2008 18:23:57 -0000 1.30 +++ rw.c 28 Jan 2009 16:13:19 -0000 1.31 @@ -201,36 +201,34 @@ _sysio_p_awrite(struct pnode *pno, } /* - * Post asynch IO operation using file handle. + * Post asynch IO operation using path-node. */ -static int -_sysio_iiox(int writing, - struct file *fil, +int +_sysio_p_iiox(int (*f)(struct ioctx *), + struct pnode *pno, + _SYSIO_OFF_T limit, const struct iovec *iov, size_t iov_count, void (*release_iov)(struct ioctx *, void *), const struct intnl_xtvec *xtv, size_t xtv_count, void (*release_xtv)(struct ioctx *, void *), void (*completio)(struct ioctx *, void *), + void *data, struct ioctx **ioctxp) { int err; ssize_t cc; - int (*f)(struct ioctx *); err = 0; do { - /* - * Opened for proper access? - */ - if (!FIL_CHKRW(fil, writing ? 'w' : 'r')) { - err = -EBADF; + if (f == NULL) { + err = -ENOTSUP; break; } /* * Is it live? */ - if (!fil->f_pno->p_base->pb_ino) { + if (!pno->p_base->pb_ino) { err = -EBADF; break; } @@ -239,37 +237,61 @@ _sysio_iiox(int writing, * Valid maps? */ cc = - _sysio_validx(xtv, xtv_count, iov, iov_count, -#if defined(_LARGEFILE64_SOURCE) && defined(O_LARGEFILE) - (fil->f_flags & O_LARGEFILE) - ? LONG_MAX - : -#endif - _SYSIO_OFF_T_MAX); + _sysio_validx(xtv, xtv_count, iov, iov_count, limit); if (cc < 0) { err = cc; break; } - f = - writing - ? PNOP_FUNC(fil->f_pno, write) - : PNOP_FUNC(fil->f_pno, read); - if (f == NULL) { - err = -ENOTSUP; - break; - } - /* * Post the operation. */ err = _sysio_post_io(f, + pno, + iov, iov_count, release_iov, + xtv, xtv_count, release_xtv, + completio, data, + ioctxp); + } while (0); + return err; +} + +/* + * Post asynch IO operation using file handle. + */ +static int +_sysio_iiox(direction writing, + struct file *fil, + const struct iovec *iov, size_t iov_count, + void (*release_iov)(struct ioctx *, void *), + const struct intnl_xtvec *xtv, size_t xtv_count, + void (*release_xtv)(struct ioctx *, void *), + void (*completio)(struct ioctx *, void *), + struct ioctx **ioctxp) +{ + int err; + + /* + * Opened for proper access? + */ + if (!FIL_CHKRW(fil, writing ? 'w' : 'r')) + return -EBADF; + err = + _sysio_p_iiox((writing + ? PNOP_FUNC(fil->f_pno, write) + : PNOP_FUNC(fil->f_pno, read)), fil->f_pno, + ( +#if defined(_LARGEFILE64_SOURCE) && defined(O_LARGEFILE) + (fil->f_flags & O_LARGEFILE) + ? LONG_MAX + : +#endif + _SYSIO_OFF_T_MAX), iov, iov_count, release_iov, xtv, xtv_count, release_xtv, completio, fil, ioctxp); - } while (0); return err; } @@ -317,10 +339,6 @@ _do_ireadx(int fd, err = -EBADF; break; } - if (fil->f_pno->p_base->pb_ino == NULL) { - err = -ESTALE; - break; - } err = _sysio_iiox(READ, fil, @@ -375,10 +393,6 @@ _do_iwritex(int fd, err = -EBADF; break; } - if (fil->f_pno->p_base->pb_ino == NULL) { - err = -ESTALE; - break; - } err = _sysio_iiox(WRITE, fil, @@ -916,10 +930,6 @@ _do_iiov(direction dir, } xtv->xtv_off = fil->f_pos; xtv->xtv_len = cc; - if (fil->f_pno->p_base->pb_ino == NULL) { - err = -ESTALE; - break; - } err = _sysio_iiox(dir, fil, Index: symlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/symlink.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -w -b -B -p -r1.20 -r1.21 --- symlink.c 17 Jun 2008 17:18:57 -0000 1.20 +++ symlink.c 28 Jan 2009 16:13:19 -0000 1.21 @@ -50,8 +50,24 @@ #include "sysio.h" #include "inode.h" +#include "mount.h" + #include "sysio-symbols.h" +/* + * Perform symlink operation; oldpath to new. + */ +int +_sysio_p_symlink(const char *oldpath, struct pnode *new) +{ + + if (new->p_base->pb_ino) + return -EEXIST; + if (IS_RDONLY(new->p_parent)) + return -EROFS; + return PNOP_SYMLINK(new, oldpath); +} + int SYSIO_INTERFACE_NAME(symlink)(const char *oldpath, const char *newpath) { Index: unlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/unlink.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -w -b -B -p -r1.21 -r1.22 --- unlink.c 17 Jun 2008 17:18:57 -0000 1.21 +++ unlink.c 28 Jan 2009 16:13:19 -0000 1.22 @@ -54,6 +54,34 @@ #include "mount.h" #include "sysio-symbols.h" +/* + * Perform unlink operation on some pnode. + */ +int +_sysio_p_unlink(struct pnode *pno) +{ + int err; + + if (IS_RDONLY(pno)) + return -EROFS; + if (!pno->p_base->pb_ino) + return -ENOENT; /* huh? */ + if (S_ISDIR(pno->p_base->pb_ino->i_stbuf.st_mode)) + return -EISDIR; + /* + * Call the FS implementation. + */ + err = PNOP_UNLINK(pno); + if (err) + return err; + /* + * Clean the namespace graphs to reflect the unlink. + */ + _sysio_i_undead(pno->p_base->pb_ino); + _sysio_pb_disconnect(pno->p_base); + return 0; +} + int SYSIO_INTERFACE_NAME(unlink)(const char *path) { |
From: Lee W. <lw...@us...> - 2009-01-28 16:13:26
|
Update of /cvsroot/libsysio/libsysio/include In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31818/include Modified Files: inode.h Log Message: Big code refactor to pave the way folr the handles-based API. No, real, functional change. Index: inode.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/inode.h,v retrieving revision 1.50 retrieving revision 1.51 diff -u -w -b -B -p -r1.50 -r1.51 --- inode.h 22 Jan 2009 19:12:19 -0000 1.50 +++ inode.h 28 Jan 2009 16:13:19 -0000 1.51 @@ -766,6 +766,7 @@ extern struct pnode_base *_sysio_pb_new( struct pnode_base *parent, struct inode *ino); extern void _sysio_pb_gone(struct pnode_base *pb); +extern void _sysio_pb_disconnect(struct pnode_base *pb); extern int _sysio_p_path(struct pnode *pno, char **bufp, size_t size); #ifdef P_DEBUG extern void _sysio_p_show(const char *pre, struct pnode *pno); @@ -786,6 +787,10 @@ extern int _sysio_pb_pathof(struct pnode char separator, char **pathp); extern char *_sysio_pb_path(struct pnode_base *pb, char separator); +extern ssize_t _sysio_p_filldirentries(struct pnode *pno, + char *buf, + size_t nbytes, + _SYSIO_OFF_T *__restrict basep); extern int _sysio_p_setattr(struct pnode *pno, unsigned mask, struct intnl_stat *stbuf); @@ -793,7 +798,18 @@ extern int _sysio_p_link(struct pnode *o extern int _sysio_p_unlink(struct pnode *pno); extern int _sysio_p_symlink(const char *oldpath, struct pnode *new); extern int _sysio_p_rmdir(struct pnode *pno); +extern ssize_t _sysio_p_readlink(struct pnode *pno, char *buf, size_t bufsiz); extern int _sysio_p_rename(struct pnode *old, struct pnode *new); +extern int _sysio_p_iiox(int (*f)(struct ioctx *), + struct pnode *pno, + _SYSIO_OFF_T limit, + const struct iovec *iov, size_t iov_count, + void (*release_iov)(struct ioctx *, void *), + const struct intnl_xtvec *xtv, size_t xtv_count, + void (*release_xtv)(struct ioctx *, void *), + void (*completio)(struct ioctx *, void *), + void *data, + struct ioctx **ioctxp); extern void _sysio_do_noop(void); extern void _sysio_do_illop(void); extern int _sysio_do_ebadf(void); |
From: Lee W. <lw...@us...> - 2009-01-28 16:10:38
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31433 Modified Files: fs_native.c Log Message: This driver was doing raw associations when a file was created. That must no longer be done; Instead PB_SET_ASSOC must be used. To just divorce us from the issue, I've changed things so that the inode is created/cached but do no association here. Something outside must look the path up, again. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.68 retrieving revision 1.69 diff -u -w -b -B -p -r1.68 -r1.69 --- fs_native.c 15 Oct 2008 22:01:01 -0000 1.68 +++ fs_native.c 28 Jan 2009 16:10:32 -0000 1.69 @@ -904,13 +904,15 @@ native_pos(int fd, _SYSIO_OFF_T *offset, return -errno; } #else + { off = - syscall(SYSIO_SYS_lseek, + syscall(SYS_lseek, fd, off, whence); - if (off == -1) + if (off < 0) return -errno; + } #endif *offset = off; @@ -969,6 +971,7 @@ native_ifilldirentries(struct native_ino * Stream-oriented access requires that we discover where we are * after the call. */ + nino->ni_fpos = 0; if ((err = native_pos(nino->ni_fd, &nino->ni_fpos, SEEK_CUR)) != 0) { /* * Leave the position at the old I suppose. @@ -1133,6 +1136,7 @@ native_inop_open(struct pnode *pno, int { struct native_inode *nino; char *path; + struct inode *ino; int fd; path = _sysio_pb_path(pno->p_base, '/'); @@ -1154,8 +1158,9 @@ native_inop_open(struct pnode *pno, int #ifdef O_LARGEFILE flags |= O_LARGEFILE; #endif + ino = pno->p_base->pb_ino; fd = syscall(SYSIO_SYS_open, path, flags, mode); - if (!pno->p_base->pb_ino && fd >= 0) { + if (!ino && fd >= 0) { struct filesys *fs; int err; @@ -1167,14 +1172,15 @@ native_inop_open(struct pnode *pno, int native_ibind(fs, path, _SYSIO_LOCAL_TIME() + FS2NFS(fs)->nfs_atimo, - &pno->p_base->pb_ino); + &ino); if (err) { (void )syscall(SYSIO_SYS_close, fd); if (err == -EEXIST) abort(); fd = err; } - } + } else + I_GET(ino); free(path); if (fd < 0) return -errno; @@ -1182,10 +1188,10 @@ native_inop_open(struct pnode *pno, int /* * Remember this new open. */ - nino = I2NI(pno->p_base->pb_ino); + nino = I2NI(ino); nino->ni_nopens++; assert(nino->ni_nopens); - + do { if (nino->ni_fd >= 0) { if ((nino->ni_oflags & O_RDWR) || (flags & (O_RDONLY|O_WRONLY|O_RDWR)) == O_RDONLY) { @@ -1193,7 +1199,7 @@ native_inop_open(struct pnode *pno, int * Keep existing. */ (void )syscall(SYSIO_SYS_close, fd); - return 0; + break; } (void )syscall(SYSIO_SYS_close, nino->ni_fd); } @@ -1208,7 +1214,11 @@ native_inop_open(struct pnode *pno, int * descriptor. */ nino->ni_seekok = - native_pos(nino->ni_fd, &nino->ni_fpos, SEEK_CUR) != 0 ? 0 : 1; + native_pos(nino->ni_fd, &nino->ni_fpos, SEEK_CUR) != 0 + ? 0 + : 1; + } while (0); + I_PUT(ino); return 0; } |
From: Lee W. <lw...@us...> - 2009-01-28 16:00:18
|
Update of /cvsroot/libsysio/libsysio/include In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30251 Modified Files: native.h Log Message: There is no lseek64 system call. It's implemented using llseek. Index: native.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/native.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- native.h 15 Oct 2008 22:01:01 -0000 1.5 +++ native.h 28 Jan 2009 16:00:09 -0000 1.6 @@ -123,9 +123,7 @@ do { #if defined(SYS_close) #define SYSIO_SYS_close SYS_close #endif -#if defined(_LARGEFILE64_SOURCE) && defined(SYS_lseek64) -#define SYSIO_SYS_lseek SYS_lseek64 -#elif defined(SYS_lseek) +#if defined(SYS_lseek) #define SYSIO_SYS_lseek SYS_lseek #endif #if defined(SYS__llseek) |
From: Lee W. <lw...@us...> - 2009-01-28 15:54:45
|
Update of /cvsroot/libsysio/libsysio/tests In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29853 Modified Files: Makefile.am module.mk Log Message: Wasn't building test_stddir but had the test. Fixed now. Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Makefile.am,v retrieving revision 1.31 retrieving revision 1.32 diff -u -w -b -B -p -r1.31 -r1.32 --- Makefile.am 15 Oct 2008 22:01:01 -0000 1.31 +++ Makefile.am 28 Jan 2009 15:54:36 -0000 1.32 @@ -5,9 +5,9 @@ STATVFS_PROG= endif noinst_PROGRAMS = test_copy test_stats test_path test_list \ - test_getcwd test_link test_unlink test_symlink test_rename \ - test_regions test_stddir test_fcntl_lock test_mknod test_mkdir \ - test_chown $(STATVFS_PROG) + test_getcwd test_link test_unlink test_symlink test_stddir \ + test_rename test_regions test_stddir test_fcntl_lock test_mknod \ + test_mkdir test_chown $(STATVFS_PROG) CLEANFILES=drv_data.c @@ -71,6 +71,10 @@ test_symlink_SOURCES=test_symlink.c $(CM test_symlink_CFLAGS=$(CFL) test_symlink_DEPENDENCIES=$(LIBS) +test_stddir_SOURCES=test_stddir.c $(CMNSRC) +test_stddir_CFLAGS=$(CFL) +test_stddir_DEPENDENCIES=$(LIBS) + test_rename_SOURCES=test_rename.c $(CMNSRC) test_rename_CFLAGS=$(CFL) test_rename_DEPENDENCIES=$(LIBS) Index: module.mk =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/module.mk,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -b -B -p -r1.3 -r1.4 --- module.mk 17 Jun 2008 17:26:53 -0000 1.3 +++ module.mk 28 Jan 2009 15:54:36 -0000 1.4 @@ -12,6 +12,7 @@ TESTS_EXTRA = \ tests/test_mkdir.c \ tests/test_mknod.c \ tests/test_path.c \ + tests/test_stddir.c \ tests/test_regions.c \ tests/test_rename.c \ tests/test_stats.c \ |
From: Lee W. <lw...@us...> - 2009-01-22 19:12:30
|
Update of /cvsroot/libsysio/libsysio/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16097/src Modified Files: inode.c Log Message: Updated copyright. Sorry, should have done this with last check-in. Index: inode.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/inode.c,v retrieving revision 1.53 retrieving revision 1.54 diff -u -w -b -B -p -r1.53 -r1.54 --- inode.c 22 Jan 2009 19:07:42 -0000 1.53 +++ inode.c 22 Jan 2009 19:12:19 -0000 1.54 @@ -9,7 +9,7 @@ * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * - * Cplant(TM) Copyright 1998-2006 Sandia Corporation. + * Cplant(TM) Copyright 1998-2009 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States @@ -36,7 +36,7 @@ * Lee Ward * Sandia National Laboratories, New Mexico * P.O. Box 5800 - * Albuquerque, NM 87185-1110 + * Albuquerque, NM 87185-1319 * * le...@sa... */ |