Thread: [Libsysio-commit] HEAD: libsysio/drivers/native fs_native.c (Page 3)
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2007-04-30 23:24:16
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2987/drivers/native Modified Files: fs_native.c Log Message: Restore support of statvfs{,64}. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.59 retrieving revision 1.60 diff -u -w -b -B -p -r1.59 -r1.60 --- fs_native.c 10 Apr 2006 23:21:24 -0000 1.59 +++ fs_native.c 30 Apr 2007 23:24:12 -0000 1.60 @@ -61,13 +61,8 @@ #include <sys/types.h> #include <sys/stat.h> #include <sys/fcntl.h> -#if 0 -#include <sys/vfs.h> -#endif -#ifdef _HAVE_STATVFS -#include <sys/statvfs.h> #include <sys/statfs.h> -#endif +#include <sys/statvfs.h> #include <utime.h> #include <sys/uio.h> #include <sys/queue.h> @@ -200,11 +195,9 @@ static int native_inop_ioctl(struct inod unsigned long int request, va_list ap); static int native_inop_mknod(struct pnode *pno, mode_t mode, dev_t dev); -#ifdef _HAVE_STATVFS static int native_inop_statvfs(struct pnode *pno, struct inode *ino, struct intnl_statvfs *buf); -#endif static void native_inop_gone(struct inode *ino); static struct inode_ops native_i_ops = { @@ -230,9 +223,7 @@ static struct inode_ops native_i_ops = { native_inop_datasync, native_inop_ioctl, native_inop_mknod, -#ifdef _HAVE_STATVFS native_inop_statvfs, -#endif native_inop_gone }; @@ -1662,7 +1653,6 @@ native_inop_mknod(struct pnode *pno __IS return -ENOSYS; } -#ifdef _HAVE_STATVFS static int native_inop_statvfs(struct pnode *pno, struct inode *ino, @@ -1702,13 +1692,14 @@ native_inop_statvfs(struct pnode *pno, buf->f_bavail = fs.f_bavail; buf->f_files = fs.f_files; /* Total number serial numbers */ buf->f_ffree = fs.f_ffree; /* Number free serial numbers */ - buf->f_favail = fs.f_ffree; /* Number free ser num for non-privileged*/ - buf->f_fsid = fs.f_fsid.__val[1]; - buf->f_flag = 0; /* No equiv in statfs; maybe use type? */ + buf->f_favail = fs.f_ffree; /* Ditto, for non-privileged though */ + buf->f_fsid = ino->i_fs->fs_id; + buf->f_flag = 0; + if (pno) + buf->f_flag = pno->p_mount->mnt_flags; buf->f_namemax = fs.f_namelen; return 0; } -#endif static int native_inop_sync(struct inode *ino) |
From: Lee W. <lw...@us...> - 2007-05-01 16:34:00
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv24463/drivers/native Modified Files: fs_native.c Log Message: The `C' preprocessor tests now look for definition of a symbol rather than a value. This enables some builds I'm told. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.60 retrieving revision 1.61 diff -u -w -b -B -p -r1.60 -r1.61 --- fs_native.c 30 Apr 2007 23:24:12 -0000 1.60 +++ fs_native.c 1 May 2007 16:33:52 -0000 1.61 @@ -80,13 +80,12 @@ #include <sys/uio.h> #endif +#undef DIR_CVT_64 #if defined(SYSIO_SYS_getdirentries) -#define DIR_CVT_64 0 #elif defined(SYSIO_SYS_getdents64) -#define DIR_CVT_64 0 #elif defined(SYSIO_SYS_getdents) #if defined(_LARGEFILE64_SOURCE) -#define DIR_CVT_64 1 +#define DIR_CVT_64 /* * Kernel version of directory entry. */ @@ -97,8 +96,6 @@ struct linux_dirent { char ld_name[1]; }; #include <dirent.h> -#else /* !defined(_LARGEFILE64_SOURCE) */ -#define DIR_CVT_64 0 #endif /* defined(_LARGEFILE64_SOURCE) */ #else /* catch-none */ #error No usable directory fill entries interface available @@ -917,7 +914,7 @@ native_pos(int fd, _SYSIO_OFF_T *offset, assert(*offset >= 0); off = *offset; -#if _LARGEFILE64_SOURCE && defined(SYSIO_SYS__llseek) +#if defined(_LARGEFILE64_SOURCE) && defined(SYSIO_SYS__llseek) { int err; err = @@ -1011,7 +1008,7 @@ native_filldirentries(struct inode *ino, size_t nbytes) { struct native_inode *nino = I2NI(ino); -#if DIR_CVT_64 +#ifdef DIR_CVT_64 char *bp; size_t count; struct linux_dirent *ldp; @@ -1026,7 +1023,7 @@ native_filldirentries(struct inode *ino, assert(nino->ni_fd >= 0); -#if DIR_CVT_64 +#ifdef DIR_CVT_64 count = nbytes; while (!(bp = malloc(count))) { count /= 2; @@ -1036,12 +1033,12 @@ native_filldirentries(struct inode *ino, #endif cc = native_ifilldirentries(nino, posp, bp, count); if (cc < 0) { -#if DIR_CVT_64 +#ifdef DIR_CVT_64 free(bp); #endif return cc; } -#if DIR_CVT_64 +#ifdef DIR_CVT_64 ldp = (struct linux_dirent *)bp; d64p = (struct dirent64 *)buf; while (cc) { |
From: Lee W. <lw...@us...> - 2007-05-01 17:27:38
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15499 Modified Files: fs_native.c Log Message: >From Bob Glossman at Cray; Modified so as not to capture/reset umask on Red Storm. It's done in cstart on that machine. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.61 retrieving revision 1.62 diff -u -w -b -B -p -r1.61 -r1.62 --- fs_native.c 1 May 2007 16:33:52 -0000 1.61 +++ fs_native.c 1 May 2007 17:27:34 -0000 1.62 @@ -348,7 +348,13 @@ _sysio_native_init() * zero. All permission bits to open/creat/setattr are absolute -- * They've already had a umask applied, when appropriate. */ +#ifndef REDSTORM + /* + * This is done is cstart on Red Storm. Saves a syscall from + * every node... + */ _sysio_umask = syscall(SYSIO_SYS_umask, 0); +#endif return _sysio_fssw_register("native", &native_fssw_ops); } |
From: Ruth K. <rk...@us...> - 2007-05-09 23:16:25
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv5699/drivers/native Modified Files: fs_native.c Log Message: add ifdef _HAVE_STATVFS Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.62 retrieving revision 1.63 diff -u -w -b -B -p -r1.62 -r1.63 --- fs_native.c 1 May 2007 17:27:34 -0000 1.62 +++ fs_native.c 9 May 2007 23:16:20 -0000 1.63 @@ -62,7 +62,9 @@ #include <sys/stat.h> #include <sys/fcntl.h> #include <sys/statfs.h> +#ifdef _HAVE_STATVFS #include <sys/statvfs.h> +#endif #include <utime.h> #include <sys/uio.h> #include <sys/queue.h> @@ -192,9 +194,11 @@ static int native_inop_ioctl(struct inod unsigned long int request, va_list ap); static int native_inop_mknod(struct pnode *pno, mode_t mode, dev_t dev); +#ifdef _HAVE_STATVFS static int native_inop_statvfs(struct pnode *pno, struct inode *ino, struct intnl_statvfs *buf); +#endif static void native_inop_gone(struct inode *ino); static struct inode_ops native_i_ops = { @@ -220,7 +224,9 @@ static struct inode_ops native_i_ops = { native_inop_datasync, native_inop_ioctl, native_inop_mknod, +#ifdef _HAVE_STATVFS native_inop_statvfs, +#endif native_inop_gone }; @@ -1656,6 +1662,7 @@ native_inop_mknod(struct pnode *pno __IS return -ENOSYS; } +#ifdef _HAVE_STATVFS static int native_inop_statvfs(struct pnode *pno, struct inode *ino, @@ -1703,6 +1710,7 @@ native_inop_statvfs(struct pnode *pno, buf->f_namemax = fs.f_namelen; return 0; } +#endif static int native_inop_sync(struct inode *ino) |
From: Lee W. <lw...@us...> - 2007-08-20 19:37:09
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv25496 Modified Files: fs_native.c Log Message: Bugfix, from Cray, for CFS bug 11512 (getdirentries can prematurely signal EOF from native driver). Initialized the waste variable when using getdirentries. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -w -b -B -p -r1.63 -r1.64 --- fs_native.c 9 May 2007 23:16:20 -0000 1.63 +++ fs_native.c 20 Aug 2007 19:37:05 -0000 1.64 @@ -983,6 +983,9 @@ native_ifilldirentries(struct native_ino nino->ni_resetfpos = 0; } +#if defined(SYSIO_SYS_getdirentries) + waste = *posp; +#endif cc = #if defined(SYSIO_SYS_getdirentries) syscall(SYSIO_SYS_getdirentries, |
From: Lee W. <lw...@us...> - 2007-09-24 19:00:19
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10952/drivers/native Modified Files: fs_native.c Log Message: All the drivers, in their mount routines, do something like: rootpb = _sysio_pb_new(&noname, NULL, rootino); err = _sysio_do_mount(..., rootpb, ...); This is clumsy. Crafted a convenience function called _sysio_mounti to do this for them. This simplifies the whole process a bit. Don't have to clean up the root pb node on error, for instance. The function is called exactly like _sysio_do_mount but with a ptr to the root inode instead of a ptr to the root pb node. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.64 retrieving revision 1.65 diff -u -w -b -B -p -r1.64 -r1.65 --- fs_native.c 20 Aug 2007 19:37:05 -0000 1.64 +++ fs_native.c 24 Sep 2007 19:00:03 -0000 1.65 @@ -378,8 +378,6 @@ create_internal_namespace(const void *da int err; struct mount *mnt; struct inode *rootino; - struct pnode_base *rootpb; - static struct qstr noname = { NULL, 0, 0 }; struct filesys *fs; time_t t; struct intnl_stat stbuf; @@ -424,7 +422,6 @@ create_internal_namespace(const void *da fs = NULL; mnt = NULL; rootino = NULL; - rootpb = NULL; /* * This really should be per-mount. Hmm, but that's best done * as proper sub-mounts in the core and not this driver. We reconcile @@ -463,19 +460,10 @@ create_internal_namespace(const void *da } /* - * Generate base path-node for root. - */ - rootpb = _sysio_pb_new(&noname, NULL, rootino); - if (!rootpb) { - err = -ENOMEM; - goto error; - } - - /* * Mount it. This name space is disconnected from the * rest of the system -- Only available within this driver. */ - err = _sysio_do_mount(fs, rootpb, 0, NULL, &mnt); + err = _sysio_mounti(fs, rootino, 0, NULL, &mnt); if (err) goto error; @@ -487,11 +475,8 @@ error: abort(); nfs = NULL; fs = NULL; - rootpb = NULL; rootino = NULL; } - if (rootpb) - _sysio_pb_gone(rootpb); if (fs) { FS_RELE(fs); nfs = NULL; |
From: Lee W. <lw...@us...> - 2008-06-17 17:19:10
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12543/drivers/native Modified Files: fs_native.c Log Message: Begin adding support for thread-safe operation. In detail: 1) Add smp.h and smp_posix.c 2) Add a big lock, wrapping the user API with appropriate mutex_lock and mutex_unlock calls. NB; initialization is *not* thread safe. 3) Add support for P_{GET,LOCK}, PB_LOCK, I_{GET,LOCK}, FIL_{GET,LOCK} and alter all related ref/de-ref usage to use get/put or lock/unlock as appropriate. 4) Remedial (no-op) support for MNT_GET. By default, POSIX threads supoprt is not enabled. To enable, use --with-threads, or --with-threads=yes, or --with-threads=posix. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.65 retrieving revision 1.66 diff -u -w -b -B -p -r1.65 -r1.66 --- fs_native.c 24 Sep 2007 19:00:03 -0000 1.65 +++ fs_native.c 17 Jun 2008 17:18:57 -0000 1.66 @@ -466,17 +466,19 @@ create_internal_namespace(const void *da err = _sysio_mounti(fs, rootino, 0, NULL, &mnt); if (err) goto error; - + I_PUT(rootino); /* drop ours */ native_internal_mount = mnt; return 0; error: if (mnt) { if (_sysio_do_unmount(mnt) != 0) abort(); - nfs = NULL; - fs = NULL; rootino = NULL; + fs = NULL; + nfs = NULL; } + if (rootino) + I_RELE(rootino); if (fs) { FS_RELE(fs); nfs = NULL; @@ -537,7 +539,7 @@ native_fsswop_mount(const char *source, * aliases we might have generated. We really don't need to cache them * as they are only used at mount time.. */ - P_RELE(nameidata.nd_pno); + P_PUT(nameidata.nd_pno); (void )_sysio_p_prune(native_internal_mount->mnt_root); if (!err) { |
From: Lee W. <lw...@us...> - 2008-07-11 18:24:02
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14678/drivers/native Modified Files: fs_native.c Log Message: Complete, finally, the change to use pnodes everywhere. Not ported to the new scheme were; sockets, yod, and incore driver. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.66 retrieving revision 1.67 diff -u -w -b -B -p -r1.66 -r1.67 --- fs_native.c 17 Jun 2008 17:18:57 -0000 1.66 +++ fs_native.c 11 Jul 2008 18:23:57 -0000 1.67 @@ -164,13 +164,11 @@ static int native_inop_lookup(struct pno struct intent *intnt, const char *path); static int native_inop_getattr(struct pnode *pno, - struct inode *ino, struct intnl_stat *stbuf); static int native_inop_setattr(struct pnode *pno, - struct inode *ino, unsigned mask, struct intnl_stat *stbuf); -static ssize_t native_filldirentries(struct inode *ino, +static ssize_t native_filldirentries(struct pnode *pno, _SYSIO_OFF_T *posp, char *buf, size_t nbytes); @@ -179,25 +177,23 @@ static int native_inop_rmdir(struct pnod static int native_inop_symlink(struct pnode *pno, const char *data); static int native_inop_readlink(struct pnode *pno, char *buf, size_t bufsiz); static int native_inop_open(struct pnode *pno, int flags, mode_t mode); -static int native_inop_close(struct inode *ino); +static int native_inop_close(struct pnode *pno); static int native_inop_link(struct pnode *old, struct pnode *new); static int native_inop_unlink(struct pnode *pno); static int native_inop_rename(struct pnode *old, struct pnode *new); -static int native_inop_read(struct inode *ino, struct ioctx *ioctx); -static int native_inop_write(struct inode *ino, struct ioctx *ioctx); -static _SYSIO_OFF_T native_inop_pos(struct inode *ino, _SYSIO_OFF_T off); +static int native_inop_read(struct ioctx *ioctx); +static int native_inop_write(struct ioctx *ioctx); +static _SYSIO_OFF_T native_inop_pos(struct pnode *pno, _SYSIO_OFF_T off); static int native_inop_iodone(struct ioctx *ioctx); -static int native_inop_fcntl(struct inode *ino, int cmd, va_list ap, int *rtn); -static int native_inop_sync(struct inode *ino); -static int native_inop_datasync(struct inode *ino); -static int native_inop_ioctl(struct inode *ino, +static int native_inop_fcntl(struct pnode *pno, int cmd, va_list ap, int *rtn); +static int native_inop_sync(struct pnode *pno); +static int native_inop_datasync(struct pnode *pno); +static int native_inop_ioctl(struct pnode *pno, unsigned long int request, va_list ap); static int native_inop_mknod(struct pnode *pno, mode_t mode, dev_t dev); #ifdef _HAVE_STATVFS -static int native_inop_statvfs(struct pnode *pno, - struct inode *ino, - struct intnl_statvfs *buf); +static int native_inop_statvfs(struct pnode *pno, struct intnl_statvfs *buf); #endif static void native_inop_gone(struct inode *ino); @@ -686,12 +682,13 @@ native_inop_lookup(struct pnode *pno, } static int -native_inop_getattr(struct pnode *pno, - struct inode *ino, - struct intnl_stat *stat) +native_inop_getattr(struct pnode *pno, struct intnl_stat *stat) { - struct native_inode *nino; int err; + char *path; + struct inode *ino; + struct filesys *fs; + time_t t; /* * We just cannot use the cached attributes when getattr is @@ -702,35 +699,16 @@ native_inop_getattr(struct pnode *pno, * pretty volatile anyway. */ err = 0; /* compiler cookie */ - if (pno) { - char *path; - struct filesys *fs; - time_t t; path = _sysio_pb_path(pno->p_base, '/'); if (!path) return -ENOMEM; + ino = pno->p_base->pb_ino; + assert(ino); fs = pno->p_mount->mnt_fs; t = _SYSIO_LOCAL_TIME(); err = native_stat(path, ino, t + FS2NFS(fs)->nfs_atimo, stat); free(path); - } else if ((nino = I2NI(ino))->ni_fd >= 0) - /* - * Don't have access to the fs record anymore. Just - * refresh but keep the current timeout. - */ - err = native_stat(NULL, ino, nino->ni_attrtim, stat); - else { - /* - * Dev inodes don't open in this driver. We won't have - * a file descriptor with which to do the deed then. Satisfy - * the request from the cached copy of the attributes. - */ - (void )memcpy(stat, - &ino->i_stbuf, - sizeof(struct intnl_stat)); - err = 0; - } return err; } @@ -761,23 +739,22 @@ _ut(const char *path, time_t actime, tim static int native_inop_setattr(struct pnode *pno, - struct inode *ino, unsigned mask, struct intnl_stat *stat) { char *path; + struct inode *ino; struct native_inode *nino; int fd; int err; path = NULL; + ino = pno->p_base->pb_ino; nino = ino ? I2NI(ino) : NULL; fd = -1; if (nino) fd = nino->ni_fd; if (fd < 0 || mask & (SETATTR_MTIME|SETATTR_ATIME)) { - if (!pno) - return -EEXIST; path = _sysio_pb_path(pno->p_base, '/'); if (!path) return -ENOMEM; @@ -1004,12 +981,13 @@ native_ifilldirentries(struct native_ino } static ssize_t -native_filldirentries(struct inode *ino, +native_filldirentries(struct pnode *pno, _SYSIO_OFF_T *posp, char *buf, size_t nbytes) { - struct native_inode *nino = I2NI(ino); + struct inode *ino; + struct native_inode *nino; #ifdef DIR_CVT_64 char *bp; size_t count; @@ -1023,6 +1001,9 @@ native_filldirentries(struct inode *ino, #endif ssize_t cc; + ino = pno->p_base->pb_ino; + assert(ino); + nino = I2NI(ino); assert(nino->ni_fd >= 0); #ifdef DIR_CVT_64 @@ -1233,11 +1214,15 @@ native_inop_open(struct pnode *pno, int } static int -native_inop_close(struct inode *ino) +native_inop_close(struct pnode *pno) { - struct native_inode *nino = I2NI(ino); + struct inode *ino; + struct native_inode *nino; int err; + ino = pno->p_base->pb_ino; + assert(ino); + nino = I2NI(ino); if (nino->ni_fd < 0) abort(); @@ -1489,6 +1474,7 @@ order_xtv(const struct intnl_xtvec *xtv1 static int doio(char op, struct ioctx *ioctx) { + struct inode *ino; struct native_inode *nino; #if 0 int dolocks; @@ -1501,7 +1487,9 @@ doio(char op, struct ioctx *ioctx) struct intnl_xtvec *front, *rear, tmp; #endif - nino = I2NI(ioctx->ioctx_ino); + ino = ioctx->ioctx_pno->p_base->pb_ino; + assert(ino); + nino = I2NI(ino); #if 0 dolocks = ioctx->ioctx_xtvlen > 1 && nino->ni_seekok; if (dolocks) { @@ -1565,25 +1553,29 @@ doio(char op, struct ioctx *ioctx) } static int -native_inop_read(struct inode *ino __IS_UNUSED, struct ioctx *ioctx) +native_inop_read(struct ioctx *ioctx) { return doio('r', ioctx); } static int -native_inop_write(struct inode *ino __IS_UNUSED, struct ioctx *ioctx) +native_inop_write(struct ioctx *ioctx) { return doio('w', ioctx); } static _SYSIO_OFF_T -native_inop_pos(struct inode *ino, _SYSIO_OFF_T off) +native_inop_pos(struct pnode *pno, _SYSIO_OFF_T off) { - struct native_inode *nino = I2NI(ino); + struct inode *ino; + struct native_inode *nino; int err; + ino = pno->p_base->pb_ino; + assert(ino); + nino = I2NI(ino); err = native_pos(nino->ni_fd, &off, SEEK_SET); return err < 0 ? err : off; } @@ -1599,15 +1591,19 @@ native_inop_iodone(struct ioctx *ioctxp } static int -native_inop_fcntl(struct inode *ino, +native_inop_fcntl(struct pnode *pno, int cmd, va_list ap, int *rtn) { - struct native_inode *nino = I2NI(ino); + struct inode *ino; + struct native_inode *nino; long arg; int err; + ino = pno->p_base->pb_ino; + assert(ino); + nino = I2NI(ino); if (nino->ni_fd < 0) abort(); @@ -1655,14 +1651,15 @@ native_inop_mknod(struct pnode *pno __IS #ifdef _HAVE_STATVFS static int native_inop_statvfs(struct pnode *pno, - struct inode *ino, struct intnl_statvfs *buf) { char *path; + struct inode *ino; int rc; struct statfs fs; path = NULL; + ino = pno->p_base->pb_ino; if (!ino || I2NI(ino)->ni_fd < 0) { path = _sysio_pb_path(pno->p_base, '/'); if (!path) @@ -1703,10 +1700,13 @@ native_inop_statvfs(struct pnode *pno, #endif static int -native_inop_sync(struct inode *ino) +native_inop_sync(struct pnode *pno) { + struct inode *ino; int err; + ino = pno->p_base->pb_ino; + assert(ino); assert(I2NI(ino)->ni_fd >= 0); err = syscall(SYSIO_SYS_fsync, I2NI(ino)->ni_fd); @@ -1716,11 +1716,14 @@ native_inop_sync(struct inode *ino) } static int -native_inop_datasync(struct inode *ino) +native_inop_datasync(struct pnode *pno) { + struct inode *ino; struct native_inode *nino; int err; + ino = pno->p_base->pb_ino; + assert(ino); nino = I2NI(ino); assert(nino->ni_fd >= 0); @@ -1739,14 +1742,17 @@ native_inop_datasync(struct inode *ino) #ifdef HAVE_LUSTRE_HACK static int -native_inop_ioctl(struct inode *ino, +native_inop_ioctl(struct pnode *pno, unsigned long int request, va_list ap) { + struct inode *ino; struct native_inode *nino; long arg1, arg2, arg3, arg4; int rtn; + ino = pno->p_base->pb_ino; + assert(ino); nino = I2NI(ino); assert(nino->ni_fd >= 0); arg1 = va_arg(ap, long); @@ -1763,7 +1769,7 @@ native_inop_ioctl(struct inode *ino, } #else static int -native_inop_ioctl(struct inode *ino __IS_UNUSED, +native_inop_ioctl(struct pnode *pno __IS_UNUSED, unsigned long int request __IS_UNUSED, va_list ap __IS_UNUSED) { |
From: Ruth K. <rk...@us...> - 2008-10-15 22:01:09
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25646/drivers/native Modified Files: fs_native.c Log Message: Removing obsolete code related to cplant yod, lustre hack, and sockets driver. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.67 retrieving revision 1.68 diff -u -w -b -B -p -r1.67 -r1.68 --- fs_native.c 11 Jul 2008 18:23:57 -0000 1.67 +++ fs_native.c 15 Oct 2008 22:01:01 -0000 1.68 @@ -1740,34 +1740,6 @@ native_inop_datasync(struct pnode *pno) return err; } -#ifdef HAVE_LUSTRE_HACK -static int -native_inop_ioctl(struct pnode *pno, - unsigned long int request, - va_list ap) -{ - struct inode *ino; - struct native_inode *nino; - long arg1, arg2, arg3, arg4; - int rtn; - - ino = pno->p_base->pb_ino; - assert(ino); - nino = I2NI(ino); - assert(nino->ni_fd >= 0); - arg1 = va_arg(ap, long); - arg2 = va_arg(ap, long); - arg3 = va_arg(ap, long); - arg4 = va_arg(ap, long); - - rtn = - syscall(SYSIO_SYS_ioctl, I2NI(ino)->ni_fd, request, - arg1, arg2, arg3, arg4); - if (rtn < 0) - rtn = -errno; - return rtn; -} -#else static int native_inop_ioctl(struct pnode *pno __IS_UNUSED, unsigned long int request __IS_UNUSED, @@ -1779,7 +1751,6 @@ native_inop_ioctl(struct pnode *pno __IS */ return -ENOTTY; } -#endif static void native_inop_gone(struct inode *ino) |
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-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-04-10 21:34:02
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20883/drivers/native Modified Files: fs_native.c Log Message: Reflect new filldirentries2 operation. Does not yet make use of it, relying on compatibility with old filldirentries. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.70 retrieving revision 1.71 diff -u -w -b -B -p -r1.70 -r1.71 --- fs_native.c 26 Feb 2009 14:57:03 -0000 1.70 +++ fs_native.c 10 Apr 2009 21:33:55 -0000 1.71 @@ -202,6 +202,7 @@ static struct inode_ops native_i_ops = { native_inop_getattr, native_inop_setattr, native_filldirentries, + NULL, native_inop_mkdir, native_inop_rmdir, native_inop_symlink, |
From: Lee W. <lw...@us...> - 2009-05-05 16:35:34
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30476/drivers/native Modified Files: fs_native.c Log Message: Modified to reflect the new, required, perms_check operation. The generic dev returns -EBADF, of course. The incore and native drivers just use the default core policy routine. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.71 retrieving revision 1.72 diff -u -w -b -B -p -r1.71 -r1.72 --- fs_native.c 10 Apr 2009 21:33:55 -0000 1.71 +++ fs_native.c 5 May 2009 16:35:29 -0000 1.72 @@ -224,6 +224,7 @@ static struct inode_ops native_i_ops = { #ifdef _HAVE_STATVFS native_inop_statvfs, #endif + _sysio_p_generic_perms_check, native_inop_gone }; |
From: Lee W. <lw...@us...> - 2009-09-21 18:29:48
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17853/drivers/native Modified Files: fs_native.c Log Message: Split native_stat into two functions. One works as before. The other, native_simple_stat just does a stat and returns the result in the passed buffer, updating no existing records. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.72 retrieving revision 1.73 diff -u -w -b -B -p -r1.72 -r1.73 --- fs_native.c 5 May 2009 16:35:29 -0000 1.72 +++ fs_native.c 21 Sep 2009 18:29:38 -0000 1.73 @@ -262,41 +262,48 @@ static struct mount *native_internal_mou #define I2NI(ino) ((struct native_inode *)((ino)->i_private)) /* - * stat -- by path. + * Simple stat of path or file. */ static int -native_stat(const char *path, - struct inode *ino, - time_t t, - struct intnl_stat *buf) +native_simple_stat(const char *path, struct inode *ino, struct intnl_stat *buf) { - struct native_inode *nino; int err; + struct native_inode *nino; struct _sysio_native_stat stbuf; - nino = ino ? I2NI(ino) : NULL; - if (path) err = syscall(SYSIO_SYS_stat, path, &stbuf); - else if (nino && nino->ni_fd >= 0) + else if ((nino = ino ? I2NI(ino) : NULL) && nino->ni_fd >= 0) err = syscall(SYSIO_SYS_fstat, nino->ni_fd, &stbuf); else abort(); - if (err) { - if (nino) - nino->ni_attrtim = 0; + if (err) return -errno; - } - if (nino) { - nino->ni_attrtim = t; - SYSIO_COPY_STAT(&stbuf, &ino->i_stbuf); - if (buf) - *buf = ino->i_stbuf; + SYSIO_COPY_STAT(&stbuf, buf); return 0; } + +/* + * stat -- by path. + */ +static int +native_stat(const char *path, + struct inode *ino, + time_t t, + struct intnl_stat *buf) +{ + struct intnl_stat mybuf; + int err; + if (!buf) - return 0; - SYSIO_COPY_STAT(&stbuf, buf); + buf = &mybuf; + err = native_simple_stat(path, ino, buf); + if (err) + t = 0; + else if (ino) + ino->i_stbuf = *buf; + if (ino) + I2NI(ino)->ni_attrtim = t; return 0; } @@ -607,33 +614,28 @@ native_ibind(struct filesys *fs, time_t t, struct inode **inop) { - struct intnl_stat ostbuf, stbuf; + struct intnl_stat buf; int err; struct inode *ino; - if (*inop) - ostbuf = (*inop)->i_stbuf; - - err = native_stat(path, *inop, t, &stbuf); + err = native_simple_stat(path, *inop, &buf); if (err) return err; - - /* - * Validate? - */ + t += FS2NFS(fs)->nfs_atimo; if (*inop) { - if (!native_i_invalid(*inop, &ostbuf)) - return 0; /* - * Invalidate. + * Revalidate. */ + if (!native_i_invalid(*inop, &buf)) { + (*inop)->i_stbuf = buf; + I2NI(*inop)->ni_attrtim = t; + return 0; + } _sysio_i_undead(*inop); *inop = NULL; } - - if (!(ino = native_iget(fs, t + FS2NFS(fs)->nfs_atimo, &stbuf))) + if (!(ino = native_iget(fs, t, &buf))) return -ENOMEM; - *inop = ino; return 0; } @@ -876,7 +878,11 @@ out: /* * We must refresh the cached attributes. */ - if (!err && native_stat(path, ino, _SYSIO_LOCAL_TIME(), NULL) != 0) + if (!err && + native_stat(path, + ino, + _SYSIO_LOCAL_TIME() + FS2NFS(ino->i_fs)->nfs_atimo, + NULL) != 0) abort(); if (path) free(path); |
From: Lee W. <lw...@us...> - 2009-12-07 22:00:38
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv2260/drivers/native Modified Files: fs_native.c Log Message: Added ifsync and ifdatasync. These are asynchronous versions of the standard calls. In fact, the core has been reworked so that the async versions are the core implementation. For backward compatibility, if your driver has old versions you may set the new inop_isync ad inop_idatasync fields to NULL and retain the old interface and, synchronous, semantics. The existing fields were renamed to inop_old_sync and inop_old_datasync and will be deprecated in the future. One important, related, change is that the ioctx record has a new field, called ioctx_args, which is a void * type. It's only used to pass the real function to call aby the code that is faking the async API but using the old fsync and fdatasync. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.73 retrieving revision 1.74 diff -u -w -b -B -p -r1.73 -r1.74 --- fs_native.c 21 Sep 2009 18:29:38 -0000 1.73 +++ fs_native.c 7 Dec 2009 22:00:23 -0000 1.74 @@ -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-2004 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... */ @@ -217,7 +217,9 @@ static struct inode_ops native_i_ops = { native_inop_pos, native_inop_iodone, native_inop_fcntl, + NULL, native_inop_sync, + NULL, native_inop_datasync, native_inop_ioctl, native_inop_mknod, |