libsysio-commit Mailing List for libsysio (Page 21)
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...> - 2004-10-14 14:59:43
|
Update of /cvsroot/libsysio/libsysio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8149 Modified Files: Rules.make configure.in Log Message: Merging in the defer-cwd branch. These changes include: + Carry full stat info in the inode now + Use that stat info (careful with intents!) instead of calling getattr + Cached attributes for the native driver + Abstracted and localized system call defs (see .../include/native.h) + The ability to defer path traversal to the "current working directory" unless and until a relative pathname is specified. This alters _sysio_boot to take an extra parameter (the init cwd) and must be configured with "--with-defer-init-cwd". Index: Rules.make =================================================================== RCS file: /cvsroot/libsysio/libsysio/Rules.make,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- Rules.make 6 Jul 2004 14:01:03 -0000 1.8 +++ Rules.make 14 Oct 2004 14:59:27 -0000 1.9 @@ -16,4 +16,4 @@ DEV_CPPFLAGS = $(STDFD_DEV_CPPFLAGS) AM_CPPFLAGS = \ -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=600 \ $(AUTOMOUNT) $(ZERO_SUM_MEMORY) $(DEV_CPPFLAGS) $(SOCKETS_CPPFLAGS) \ - -I$(top_srcdir)/include + $(DEFER_INIT_CWD) -I$(top_srcdir)/include Index: configure.in =================================================================== RCS file: /cvsroot/libsysio/libsysio/configure.in,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -b -B -p -r1.17 -r1.18 --- configure.in 20 May 2004 19:31:48 -0000 1.17 +++ configure.in 14 Oct 2004 14:59:28 -0000 1.18 @@ -101,6 +101,17 @@ AC_ARG_WITH(zero-sum-memory, [with_zero_sum_memory=no]) AC_SUBST(ZERO_SUM_MEMORY) +AC_ARG_WITH(defer-init-cwd, + AC_HELP_STRING([--with-defer-init-cwd], + [defer initialization of current working directory]), + [ case "${withval}" in + yes) DEFER_INIT_CWD=-DDEFER_INIT_CWD=1 ;; + no) ;; + *) AC_MSG_ERROR(bad value ${withval} for --with-defer-init-cwd) ;; + esac], + [with_defer_init_cwd=no]) +AC_SUBST(DEFER_INIT_CWD) + AC_ARG_WITH(cplant_yod, AC_HELP_STRING([--with-cplant-yod],[build cplant yod I/O driver]), [ case "${withval}" in @@ -235,61 +246,6 @@ fi AC_MSG_RESULT($alpha_linux_env) AM_CONDITIONAL(TEST_ALPHA_ARG, test x$alpha_linux_env = xyes) -# check for 64 bit stat, fstat, truncate, ftruncate syscalls -# -AC_MSG_CHECKING(for 64 bit stat and truncate syscalls) -AC_TRY_COMPILE([ -#include <sys/stat.h> -#include <syscall.h> -extern int syscall();], -[char path[] = "/"; -int fd = 0; -struct stat buf; -syscall(SYS_stat64,path,&buf); -syscall(SYS_fstat64,fd,&buf); -syscall(SYS_truncate64, path, buf.st_size); -syscall(SYS_ftruncate64, fd, buf.st_size); -], - sysstat64_exists=yes, - sysstat64_exists=no) -AC_MSG_RESULT($sysstat64_exists) -if test x$sysstat64_exists = xno; then - AC_DEFINE(USE_NATIVE_STAT) -fi - -# Check for fdatasync syscall -# -AC_MSG_CHECKING(for fdatasync system call) -if test x$alpha_linux_env = xyes; then - _syscallnum=SYS_osf_fdatasync -else - _syscallnum=SYS_fdatasync -fi -AC_TRY_COMPILE([ -#include <syscall.h> -extern int syscall();], -[int fd = 0; -syscall(SYS_fdatasync, fd);], - syscall_fdatasync_exists=yes, - syscall_fdatasync_exists=no) -AC_MSG_RESULT($syscall_fdatasync_exists) -if test x$syscall_fdatasync_exists = xyes; then - AC_DEFINE_UNQUOTED(NATIVE_FDATASYNC, $_syscallnum) -fi - -# Check for SYS_utime -# -AC_MSG_CHECKING(for utime system call) -AC_TRY_COMPILE([ -#include <syscall.h> -extern int syscall();], -[syscall(SYS_utime);], - syscall_utime_exists=yes, - syscall_utime_exists=no) -AC_MSG_RESULT($syscall_utime_exists) -if test x$syscall_utime_exists = xno; then - AC_DEFINE(USE_NATIVE_UTIME) -fi # Check for __st_ino # AC_MSG_CHECKING(for __st_ino) |
From: Lee W. <lw...@us...> - 2004-10-14 14:19:10
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30220/drivers/native Modified Files: Tag: defer-cwd fs_native.c Log Message: Changes from Kevin Pedretti repairing the X86-64 build. I altered things a bit, so all mistakes would be mine. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.48.2.4 retrieving revision 1.48.2.5 diff -u -w -b -B -p -r1.48.2.4 -r1.48.2.5 --- fs_native.c 9 Oct 2004 19:50:06 -0000 1.48.2.4 +++ fs_native.c 14 Oct 2004 14:18:51 -0000 1.48.2.5 @@ -864,6 +864,30 @@ native_inop_getattr(struct pnode *pno, return err; } +#ifdef SYSIO_SYS_utime +static int +_ut(const char *path, time_t actime, time_t modtime) +{ + struct utimbuf ut; + + ut.actime = actime; + ut.modtime = modtime; + return syscall(SYSIO_SYS_utime, path, &ut); +} +#else +static int +_ut(const char *path, time_t actime, time_t modtime) +{ + struct timeval tv[2]; + + tv[0].tv_sec = actime; + tv[0].tv_nsec = 0; + tv[1].tv_sec = modtime; + tv[1].tv_nsec = 0; + return syscall(SYSIO_SYS_utimes, path, &tv); +} +#endif + static int native_inop_setattr(struct pnode *pno, struct inode *ino, @@ -912,20 +936,19 @@ native_inop_setattr(struct pnode *pno, if (err) mask &= ~SETATTR_MODE; else if (mask & (SETATTR_MTIME|SETATTR_ATIME)) { - struct utimbuf ut; + time_t actime, modtime; /* * Alter access and/or modify time attributes. */ - ut.actime = stat->st_atime; - ut.modtime = stat->st_mtime; - if (mask & SETATTR_MTIME) - ut.modtime = stat->st_mtime; + actime = ino->i_stbuf.st_atime; + modtime = ino->i_stbuf.st_mtime; if (mask & SETATTR_ATIME) - ut.actime = stat->st_atime; - err = syscall(SYSIO_SYS_utime, path, &ut); - if (err) - err = -errno; + actime = stat->st_atime; + if (mask & SETATTR_MTIME) + modtime = stat->st_mtime; + if (_ut(path, actime, modtime) != 0) + return -errno; } if (err) mask &= ~(SETATTR_MTIME|SETATTR_ATIME); @@ -990,13 +1013,8 @@ native_inop_setattr(struct pnode *pno, ? ino->i_stbuf.st_gid : (gid_t )-1)); } - if (mask & (SETATTR_MTIME|SETATTR_ATIME)) { - struct utimbuf ut; - - ut.actime = ino->i_stbuf.st_atime; - ut.modtime = ino->i_stbuf.st_mtime; - (void )syscall(SYSIO_SYS_utime, path, &ut); - } + if (mask & (SETATTR_MTIME|SETATTR_ATIME)) + (void )_ut(path, ino->i_stbuf.st_atime, ino->i_stbuf.st_mtime); if (mask & SETATTR_MODE) { fd < 0 ? syscall(SYSIO_SYS_chmod, path, ino->i_stbuf.st_mode & 07777) |
From: Lee W. <lw...@us...> - 2004-10-14 14:19:10
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30220/src Modified Files: Tag: defer-cwd fcntl.c Log Message: Changes from Kevin Pedretti repairing the X86-64 build. I altered things a bit, so all mistakes would be mine. Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.21.2.1 retrieving revision 1.21.2.2 diff -u -w -b -B -p -r1.21.2.1 -r1.21.2.2 --- fcntl.c 23 Sep 2004 16:51:18 -0000 1.21.2.1 +++ fcntl.c 14 Oct 2004 14:18:53 -0000 1.21.2.2 @@ -55,6 +55,7 @@ #ifdef HAVE_LUSTRE_HACK #include <syscall.h> +#include <native.h> static int _sysio_fcntl(int fd, int cmd, va_list ap, int *rtn) |
From: Lee W. <lw...@us...> - 2004-10-14 14:19:10
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30220/include Modified Files: Tag: defer-cwd native.h Log Message: Changes from Kevin Pedretti repairing the X86-64 build. I altered things a bit, so all mistakes would be mine. Index: native.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/Attic/native.h,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -w -b -B -p -r1.1.2.4 -r1.1.2.5 --- native.h 12 Oct 2004 12:42:43 -0000 1.1.2.4 +++ native.h 14 Oct 2004 14:18:53 -0000 1.1.2.5 @@ -128,6 +128,9 @@ do { #elif defined(SYS_lseek) #define SYSIO_SYS_lseek SYS_lseek #endif +#if defined(SYS__llseek) +#define SYSIO_SYS__llseek SYS__llseek +#endif #if defined(SYS_read) #define SYSIO_SYS_read SYS_read #endif @@ -223,3 +226,18 @@ do { #if defined(SYS_socket) #define SYSIO_SYS_socket SYS_socket #endif +#if defined(SYS_accept) +#define SYSIO_SYS_accept SYS_accept +#endif +#if defined(SYS_bind) +#define SYSIO_SYS_bind SYS_bind +#endif +#if defined(SYS_listen) +#define SYSIO_SYS_listen SYS_listen +#endif +#if defined(SYS_connect) +#define SYSIO_SYS_connect SYS_connect +#endif +#if defined(SYS_ioctl) +#define SYSIO_SYS_ioctl SYS_ioctl +#endif |
From: Lee W. <lw...@us...> - 2004-10-14 14:19:10
|
Update of /cvsroot/libsysio/libsysio/drivers/sockets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30220/drivers/sockets Modified Files: Tag: defer-cwd sockets.c Log Message: Changes from Kevin Pedretti repairing the X86-64 build. I altered things a bit, so all mistakes would be mine. Index: sockets.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/sockets/sockets.c,v retrieving revision 1.10.2.3 retrieving revision 1.10.2.4 diff -u -w -b -B -p -r1.10.2.3 -r1.10.2.4 --- sockets.c 23 Sep 2004 17:09:48 -0000 1.10.2.3 +++ sockets.c 14 Oct 2004 14:18:53 -0000 1.10.2.4 @@ -59,7 +59,9 @@ #include <sys/fcntl.h> #include <sys/syscall.h> #include <sys/socket.h> +#ifdef __linux__ #include <linux/net.h> +#endif #include <sys/uio.h> #include <sys/queue.h> @@ -407,7 +409,8 @@ socket(int domain, int type, int protoco #else { unsigned long avec[3] = {domain, type, protocol}; - ski->ski_fd = syscall(SYSIO_SYS_socketcall, SYS_SOCKET, avec); + ski->ski_fd = + syscall(SYSIO_SYS_socketcall, SYS_SOCKET, avec); } #endif if (ski->ski_fd < 0) { @@ -473,15 +476,19 @@ accept(int s, struct sockaddr *addr, soc ski = I2SKI(ino); #ifndef SYSIO_SYS_socketcall - ski->ski_fd = syscall(SYSIO_SYS_accept, I2SKI(ofil->f_ino)->ski_fd, - addr, addrlen); + ski->ski_fd = + syscall(SYSIO_SYS_accept, + I2SKI(ofil->f_ino)->ski_fd, + addr, + addrlen); #else { unsigned long avec[3] = { (unsigned long) I2SKI(ofil->f_ino)->ski_fd, (unsigned long) addr, (unsigned long) addrlen}; - ski->ski_fd = syscall(SYSIO_SYS_socketcall, SYS_ACCEPT, avec); + ski->ski_fd = + syscall(SYSIO_SYS_socketcall, SYS_ACCEPT, avec); } #endif if (ski->ski_fd < 0) { @@ -595,8 +602,10 @@ connect(int sockfd, const struct sockadd } #ifndef SYSIO_SYS_socketcall - if (syscall(SYSIO_SYS_connect, I2SKI(fil->f_ino)->ski_fd, - serv_addr, addrlen) != 0) { + if (syscall(SYSIO_SYS_connect, + I2SKI(fil->f_ino)->ski_fd, + serv_addr, + addrlen) != 0) { #else avec[0] = I2SKI(fil->f_ino)->ski_fd; avec[1] = (unsigned long )serv_addr; |
From: Sonja T. <so...@us...> - 2004-10-12 13:10:24
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26529/tests Modified Files: Tag: defer-cwd test_all.pl Log Message: Add check for existing tmp_dir Index: test_all.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_all.pl,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -u -w -b -B -p -r1.14 -r1.14.2.1 --- test_all.pl 30 Aug 2004 20:28:53 -0000 1.14 +++ test_all.pl 12 Oct 2004 13:09:58 -0000 1.14.2.1 @@ -73,6 +73,15 @@ $ENV{$namespace_env} = "\ my $res; if ($use_system == 1) { + # Test for tmp_dir. If it exists, fail + # The tmp_dir should be removed after a successful + # test run, but is kept if anything fails + if (-e "$cwd/tmp_dir") { + print STDERR "ERROR! tmp_dir already exists.\n"; + print STDERR "Need to remove tmp_dir for test to run properly\n"; + exit 1; + } + # Will use this directory... system("mkdir -p $cwd/tmp_dir"); |
From: Lee W. <lw...@us...> - 2004-10-12 12:45:28
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21748 Added Files: Tag: defer-cwd sysio-run-start.c Log Message: New tests startup does sysio initialization ala crt0 using GCC contructor attribute. --- NEW FILE --- #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <sys/types.h> #include <sys/uio.h> #include <xtio.h> #include "test.h" void _sysio_startup(void) __attribute__ ((constructor)); void _sysio_startup() { int err; err = _test_sysio_startup(); if (err) { errno = -err; perror("sysio startup"); exit(1); } if (atexit(_test_sysio_shutdown) != 0) { perror("atexit"); exit(1); } } |
From: Sonja T. <so...@us...> - 2004-10-12 12:42:52
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21338/include Modified Files: Tag: defer-cwd native.h Log Message: Fix definition of SYSIO_SYS_pwrite Index: native.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/Attic/native.h,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -w -b -B -p -r1.1.2.3 -r1.1.2.4 --- native.h 12 Oct 2004 12:40:03 -0000 1.1.2.3 +++ native.h 12 Oct 2004 12:42:43 -0000 1.1.2.4 @@ -148,7 +148,7 @@ do { #if _LARGEFILE64_SOURCE && defined(SYS_pwrite64) #define SYSIO_SYS_pwrite SYS_pwrite64 #elif defined(SYS_pwrite) -#define SYSIO_SYS_write SYS_pwrite +#define SYSIO_SYS_pwrite SYS_pwrite #endif #if _LARGEFILE64_SOURCE && defined(SYS_fcntl64) #define SYSIO_SYS_fcntl SYS_fcntl64 |
From: Lee W. <lw...@us...> - 2004-10-12 12:40:25
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20838 Modified Files: Tag: defer-cwd native.h Log Message: Messed up the definition of SYSIO_SYS_pwrite. I had it defined to be pread! Oops. Fixed. Index: native.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/Attic/native.h,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -w -b -B -p -r1.1.2.2 -r1.1.2.3 --- native.h 12 Oct 2004 12:29:55 -0000 1.1.2.2 +++ native.h 12 Oct 2004 12:40:03 -0000 1.1.2.3 @@ -148,7 +148,7 @@ do { #if _LARGEFILE64_SOURCE && defined(SYS_pwrite64) #define SYSIO_SYS_pwrite SYS_pwrite64 #elif defined(SYS_pwrite) -#define SYSIO_SYS_pread SYS_pwrite +#define SYSIO_SYS_write SYS_pwrite #endif #if _LARGEFILE64_SOURCE && defined(SYS_fcntl64) #define SYSIO_SYS_fcntl SYS_fcntl64 |
From: Lee W. <lw...@us...> - 2004-10-12 12:30:05
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19076 Modified Files: Tag: defer-cwd native.h Log Message: Want getdents64 exposed directly. The native driver, at least, uses the presence, or lack, to decide whether a 32/64 conversion is required. Index: native.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/Attic/native.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -w -b -B -p -r1.1.2.1 -r1.1.2.2 --- native.h 23 Sep 2004 16:51:17 -0000 1.1.2.1 +++ native.h 12 Oct 2004 12:29:55 -0000 1.1.2.2 @@ -192,7 +192,7 @@ do { #endif #endif #if _LARGEFILE64_SOURCE && defined(SYS_getdents64) -#define SYSIO_SYS_getdents SYS_getdents64 +#define SYSIO_SYS_getdents64 SYS_getdents64 #elif defined(SYS_getdents) #define SYSIO_SYS_getdents SYS_getdents #endif |
From: Lee W. <lw...@us...> - 2004-10-09 19:50:22
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11141/src Modified Files: Tag: defer-cwd lseek.c mount.c readlink.c rename.c stat.c stat64.c Log Message: The inode now has a full copy of the inode attributes maintained. The core expects that the GETATTR intent is honored and that the attributes are known good when that intent flag is present. This should fix problems with stale attributes after file content is read/written/trunc'd. Index: lseek.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/lseek.c,v retrieving revision 1.24.2.1 retrieving revision 1.24.2.2 diff -u -w -b -B -p -r1.24.2.1 -r1.24.2.2 --- lseek.c 15 Sep 2004 14:56:48 -0000 1.24.2.1 +++ lseek.c 9 Oct 2004 19:50:06 -0000 1.24.2.2 @@ -78,6 +78,11 @@ _sysio_lseek(int fd, _SYSIO_OFF_T offset { int err; + /* + * Don't blindly trust the attributes + * in the inode record for this. Give the + * driver a chance to refresh them. + */ err = (*fil->f_ino->i_ops.inop_getattr)(NULL, fil->f_ino, Index: mount.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mount.c,v retrieving revision 1.16.2.2 retrieving revision 1.16.2.3 diff -u -w -b -B -p -r1.16.2.2 -r1.16.2.3 --- mount.c 23 Sep 2004 17:09:51 -0000 1.16.2.2 +++ mount.c 9 Oct 2004 19:50:06 -0000 1.16.2.3 @@ -577,7 +577,6 @@ _sysio_automount(struct pnode *mntpno) { int err; struct inode *ino; - struct intnl_stat stbuf; struct iovec iovec; struct ioctx iocontext; struct intnl_xtvec xtvec; @@ -598,24 +597,21 @@ _sysio_automount(struct pnode *mntpno) * Read file content. */ ino = mntpno->p_base->pb_ino; - err = (*ino->i_ops.inop_getattr)(mntpno, ino, &stbuf); - if (err) - return err; - if (stbuf.st_size > 64 * 1024) { + if (ino->i_stbuf.st_size > 64 * 1024) { /* * Let's be reasonable. */ return -EINVAL; } - iovec.iov_base = malloc(stbuf.st_size + 1); + iovec.iov_base = malloc(ino->i_stbuf.st_size + 1); if (!iovec.iov_base) return -ENOMEM; - iovec.iov_len = stbuf.st_size; + iovec.iov_len = ino->i_stbuf.st_size; err = _sysio_open(mntpno, O_RDONLY, 0); if (err) goto out; xtvec.xtv_off = 0; - xtvec.xtv_len = stbuf.st_size; + xtvec.xtv_len = ino->i_stbuf.st_size; IOCTX_INIT(&iocontext, 1, 0, Index: readlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/readlink.c,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -u -w -b -B -p -r1.5 -r1.5.2.1 --- readlink.c 10 Sep 2004 16:43:37 -0000 1.5 +++ readlink.c 9 Oct 2004 19:50:06 -0000 1.5.2.1 @@ -62,7 +62,6 @@ SYSIO_INTERFACE_NAME(readlink)(const cha int err; struct pnode *pno; struct inode *ino; - struct intnl_stat stbuf; SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; @@ -71,17 +70,11 @@ SYSIO_INTERFACE_NAME(readlink)(const cha if (err) goto out; ino = pno->p_base->pb_ino; - err = (*ino->i_ops.inop_getattr)(pno, ino, &stbuf); - if (err) - goto error; - if (!S_ISLNK(stbuf.st_mode)) { + if (!S_ISLNK(ino->i_stbuf.st_mode)) { err = -EINVAL; goto error; } err = (*ino->i_ops.inop_readlink)(pno, buf, bufsiz); - if (err) - goto error; - error: P_RELE(pno); out: Index: rename.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rename.c,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -u -w -b -B -p -r1.9 -r1.9.2.1 --- rename.c 26 Aug 2004 09:03:03 -0000 1.9 +++ rename.c 9 Oct 2004 19:50:06 -0000 1.9.2.1 @@ -61,7 +61,6 @@ SYSIO_INTERFACE_NAME(rename)(const char int err; struct pnode *old, *new; struct pnode_base *nxtpb, *pb; - struct intnl_stat ostbuf, nstbuf; SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; @@ -92,16 +91,19 @@ SYSIO_INTERFACE_NAME(rename)(const char if (err) goto error2; + /* + * Don't allow mount points to move. + */ if (old->p_mount->mnt_root == old || old->p_cover || new->p_mount->mnt_root == new) { err = -EBUSY; goto error1; } - if (old->p_mount->mnt_fs != new->p_mount->mnt_fs) { /* - * Oops. They're trying to move it across file systems. + * No xdev renames either. */ + if (old->p_mount->mnt_fs != new->p_mount->mnt_fs) { err = -EXDEV; goto error1; } @@ -127,40 +129,24 @@ SYSIO_INTERFACE_NAME(rename)(const char if (old->p_base->pb_ino == new->p_base->pb_ino) goto out; - while (new->p_base->pb_ino) { + if (new->p_base->pb_ino) { /* * Existing entry. We're replacing the new. Make sure that's * ok. */ - err = - old->p_base->pb_ino->i_ops.inop_getattr(old, NULL, &ostbuf); - if (err) - goto error1; - err = - new->p_base->pb_ino->i_ops.inop_getattr(new, NULL, &nstbuf); - if (err) { - if (err != ENOENT) - goto error1; - /* - * Rats! It disappeared beneath us. - */ - (void )_sysio_p_validate(new, NULL, NULL); - continue; - } - if (S_ISDIR(nstbuf.st_mode)) { - if (!S_ISDIR(ostbuf.st_mode)) { + if (S_ISDIR(new->p_base->pb_ino->i_stbuf.st_mode)) { + if (!S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)) { err = -EISDIR; goto error1; } - if (nstbuf.st_nlink > 2) { + if (new->p_base->pb_ino->i_stbuf.st_nlink > 2) { err = -ENOTEMPTY; goto error1; } - } else if (S_ISDIR(ostbuf.st_mode)) { + } else if (S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)) { err = -ENOTDIR; goto error1; } - break; } /* Index: stat.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/stat.c,v retrieving revision 1.16 retrieving revision 1.16.2.1 diff -u -w -b -B -p -r1.16 -r1.16.2.1 --- stat.c 27 Jul 2004 15:00:48 -0000 1.16 +++ stat.c 9 Oct 2004 19:50:06 -0000 1.16.2.1 @@ -119,6 +119,10 @@ PREPEND(__, SYSIO_INTERFACE_NAME(fxstat) #else buf = __stat_buf; #endif + /* + * Never use the attributes cached in the inode record. Give the + * driver a chance to refresh them. + */ err = fil->f_ino->i_ops.inop_getattr(NULL, fil->f_ino, buf); #if _LARGEFILE64_SOURCE @@ -164,10 +168,6 @@ PREPEND(__, SYSIO_INTERFACE_NAME(xstat)) int err; struct pnode *pno; struct inode *ino; - struct intnl_stat *buf; -#if _LARGEFILE64_SOURCE - struct stat64 st64; -#endif SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; @@ -180,22 +180,18 @@ PREPEND(__, SYSIO_INTERFACE_NAME(xstat)) err = _sysio_namei(_sysio_cwd, __filename, 0, &intent, &pno); if (err) goto out; + /* + * Leverage the INT_GETATTR intent above. We are counting + * on the FS driver to either make sure the attributes cached in + * the inode are always correct or refresh them in the lookup, above. + */ ino = pno->p_base->pb_ino; #if _LARGEFILE64_SOURCE - buf = &st64; + convstat(&ino->i_stbuf, __stat_buf); #else - buf = __stat_buf; + (void )memcpy(__stat_buf, &ino->i_stbuf, sizeof(struct intnl_stat)); #endif - err = - ino->i_ops.inop_getattr(pno, - pno->p_base->pb_ino, - buf); - P_RELE(pno); -#if _LARGEFILE64_SOURCE - if (!err) - convstat(buf, __stat_buf); -#endif out: SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); } @@ -236,10 +232,6 @@ PREPEND(__, SYSIO_INTERFACE_NAME(lxstat) int err; struct pnode *pno; struct inode *ino; - struct intnl_stat *buf; -#if _LARGEFILE64_SOURCE - struct stat64 st64; -#endif SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; @@ -252,22 +244,18 @@ PREPEND(__, SYSIO_INTERFACE_NAME(lxstat) err = _sysio_namei(_sysio_cwd, __filename, ND_NOFOLLOW, &intent, &pno); if (err) goto out; + /* + * Leverage the INT_GETATTR intent above. We are counting + * on the FS driver to either make sure the attributes cached in + * the inode are always correct or refresh them in the lookup, above. + */ + ino = pno->p_base->pb_ino; #if _LARGEFILE64_SOURCE - buf = &st64; + convstat(&ino->i_stbuf, __stat_buf); #else - buf = __stat_buf; + (void )memcpy(__stat_buf, &ino->i_stbuf, sizeof(struct intnl_stat)); #endif - ino = pno->p_base->pb_ino; - err = - ino->i_ops.inop_getattr(pno, - pno->p_base->pb_ino, - buf); - P_RELE(pno); -#if _LARGEFILE64_SOURCE - if (!err) - convstat(buf, __stat_buf); -#endif out: SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); } Index: stat64.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/stat64.c,v retrieving revision 1.12 retrieving revision 1.12.2.1 diff -u -w -b -B -p -r1.12 -r1.12.2.1 --- stat64.c 27 Jul 2004 15:00:48 -0000 1.12 +++ stat64.c 9 Oct 2004 19:50:06 -0000 1.12.2.1 @@ -43,6 +43,7 @@ #ifdef _LARGEFILE64_SOURCE +#include <string.h> #include <errno.h> #include <assert.h> #include <sys/types.h> @@ -85,6 +86,10 @@ PREPEND(__, SYSIO_INTERFACE_NAME(fxstat6 err = -EBADF; goto out; } + /* + * Never use the attributes cached in the inode record. Give + * the driver a chance to refresh them. + */ err = fil->f_ino->i_ops.inop_getattr(NULL, fil->f_ino, __stat_buf); out: SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); @@ -107,6 +112,7 @@ PREPEND(__, SYSIO_INTERFACE_NAME(xstat64 struct intent intent; int err; struct pnode *pno; + struct inode *ino; SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; @@ -119,10 +125,13 @@ PREPEND(__, SYSIO_INTERFACE_NAME(xstat64 err = _sysio_namei(_sysio_cwd, __filename, 0, &intent, &pno); if (err) goto out; - err = - pno->p_base->pb_ino->i_ops.inop_getattr(pno, - pno->p_base->pb_ino, - __stat_buf); + /* + * Leverage the INT_GETATTR intent above. We are counting + * on the FS driver to either make sure the attributes cached in + * the inode are always correct or refresh them in the lookup, above. + */ + ino = pno->p_base->pb_ino; + (void )memcpy(__stat_buf, &ino->i_stbuf, sizeof(struct intnl_stat)); P_RELE(pno); out: SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); @@ -147,6 +156,7 @@ PREPEND(__, SYSIO_INTERFACE_NAME(lxstat6 struct intent intent; int err; struct pnode *pno; + struct inode *ino; SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; @@ -159,10 +169,13 @@ PREPEND(__, SYSIO_INTERFACE_NAME(lxstat6 err = _sysio_namei(_sysio_cwd, __filename, ND_NOFOLLOW, &intent, &pno); if (err) goto out; - err = - pno->p_base->pb_ino->i_ops.inop_getattr(pno, - pno->p_base->pb_ino, - __stat_buf); + /* + * Leverage the INT_GETATTR intent above. We are counting + * on the FS driver to either make sure the attributes cached in + * the inode are always correct or refresh them in the lookup, above. + */ + ino = pno->p_base->pb_ino; + (void )memcpy(__stat_buf, &ino->i_stbuf, sizeof(struct intnl_stat)); P_RELE(pno); out: SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); |
From: Lee W. <lw...@us...> - 2004-10-09 19:50:21
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11141/drivers/native Modified Files: Tag: defer-cwd fs_native.c Log Message: The inode now has a full copy of the inode attributes maintained. The core expects that the GETATTR intent is honored and that the attributes are known good when that intent flag is present. This should fix problems with stale attributes after file content is read/written/trunc'd. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.48.2.3 retrieving revision 1.48.2.4 diff -u -w -b -B -p -r1.48.2.3 -r1.48.2.4 --- fs_native.c 23 Sep 2004 17:09:47 -0000 1.48.2.3 +++ fs_native.c 9 Oct 2004 19:50:06 -0000 1.48.2.4 @@ -149,9 +149,16 @@ struct native_inode { int ni_oflags; /* flags, from open */ unsigned ni_nopens; /* soft ref count */ _SYSIO_OFF_T ni_fpos; /* current pos */ + time_t ni_attrtim; /* attrs expire time */ }; /* + * Cached attributes usable? + */ +#define NATIVE_ATTRS_VALID(nino, t) \ + ((nino)->ni_attrtim && (t) < (nino)->ni_attrtim) + +/* * Native IO path arguments. */ struct native_io { @@ -267,7 +274,10 @@ static struct mount *native_internal_mou * stat -- by path. */ static int -native_stat(const char *path, struct inode *ino, struct intnl_stat *buf) +native_stat(const char *path, + struct inode *ino, + time_t t, + struct intnl_stat *buf) { struct native_inode *nino; int err; @@ -281,14 +291,16 @@ native_stat(const char *path, struct ino err = syscall(SYSIO_SYS_fstat, nino->ni_fd, &stbuf); else abort(); - if (err) + if (err) { + if (nino) + nino->ni_attrtim = 0; return -errno; + } if (nino) { + nino->ni_attrtim = t; SYSIO_COPY_STAT(&stbuf, &ino->i_stbuf); if (buf) - (void )memcpy(buf, - &ino->i_stbuf, - sizeof(struct intnl_stat)); + *buf = ino->i_stbuf; return 0; } if (!buf) @@ -301,7 +313,7 @@ native_stat(const char *path, struct ino * Introduce an i-node to the system. */ static struct inode * -native_i_new(struct filesys *fs, struct intnl_stat *buf) +native_i_new(struct filesys *fs, time_t expiration, struct intnl_stat *buf) { struct native_inode *nino; struct inode *ino; @@ -322,6 +334,7 @@ native_i_new(struct filesys *fs, struct nino->ni_oflags = 0; nino->ni_nopens = 0; nino->ni_fpos = 0; + nino->ni_attrtim = expiration; ino = _sysio_i_new(fs, &nino->ni_fileid, @@ -367,6 +380,7 @@ create_internal_namespace(const void *da struct pnode_base *rootpb; static struct qstr noname = { NULL, 0, 0 }; struct filesys *fs; + time_t t; struct intnl_stat stbuf; unsigned long ul; static struct option_value_info v[] = { @@ -437,10 +451,11 @@ create_internal_namespace(const void *da /* * Get root i-node. */ - err = native_stat("/", NULL, &stbuf); + t = _SYSIO_LOCAL_TIME(); + err = native_stat("/", NULL, 0, &stbuf); if (err) goto error; - rootino = native_i_new(fs, &stbuf); + rootino = native_i_new(fs, t + FS2NFS(fs)->nfs_atimo, &stbuf); if (!rootino) { err = -ENOMEM; goto error; @@ -550,12 +565,15 @@ native_fsswop_mount(const char *source, static int native_i_invalid(struct inode *inop, struct intnl_stat *stat) { + struct native_inode *nino; + /* * Validate passed in inode against stat struct info */ - struct native_inode *nino = I2NI(inop); + nino = I2NI(inop); - if ((nino->ni_ident.dev != stat->st_dev || + if (!nino->ni_attrtim || + (nino->ni_ident.dev != stat->st_dev || nino->ni_ident.ino != stat->st_ino || #ifdef HAVE_GENERATION nino->ni_ident.gen != stat->st_gen || @@ -563,34 +581,55 @@ native_i_invalid(struct inode *inop, str ((inop)->i_stbuf.st_mode & S_IFMT) != (stat->st_mode & S_IFMT)) || (((inop)->i_stbuf.st_rdev != stat->st_rdev) && (S_ISCHR((inop)->i_stbuf.st_mode) || - S_ISBLK((inop)->i_stbuf.st_mode)))) + S_ISBLK((inop)->i_stbuf.st_mode)))) { + nino->ni_attrtim = 0; /* invalidate attrs */ return 1; - + } return 0; } +static struct inode * +native_iget(struct filesys *fs, time_t expire, struct intnl_stat *stbp) +{ + struct inode *ino; + struct native_inode_identifier ident; + struct file_identifier fileid; + + bzero(&ident, sizeof(ident)); + ident.dev = stbp->st_dev; + ident.ino = stbp->st_ino; +#ifdef HAVE_GENERATION + ident.gen = stbp->st_gen; +#endif + fileid.fid_data = &ident; + fileid.fid_len = sizeof(ident); + ino = _sysio_i_find(fs, &fileid); + if (ino) { + ino->i_stbuf = *stbp; + I2NI(ino)->ni_attrtim = expire; + return ino; + } + return native_i_new(fs, expire, stbp); +} + /* * Find, and validate, or create i-node by host-relative path. Returned i-node * is referenced. */ static int -native_iget(struct filesys *fs, - const char *path, - struct inode **inop, - int forced) +native_ibind(struct filesys *fs, + char *path, + time_t t, + struct inode **inop) { + struct intnl_stat ostbuf, stbuf; int err; struct inode *ino; - struct intnl_stat ostbuf, stbuf; - struct native_inode_identifier ident; - struct file_identifier fileid; - /* - * Save old attributes and get current file status. - */ if (*inop) ostbuf = (*inop)->i_stbuf; - err = native_stat(path, *inop, &stbuf); + + err = native_stat(path, *inop, t, &stbuf); if (err) return err; @@ -603,89 +642,157 @@ native_iget(struct filesys *fs, /* * Invalidate. */ + _sysio_i_undead(*inop); *inop = NULL; } - /* - * I-node is not already known. Find or create it. - */ - bzero(&ident, sizeof(ident)); - ident.dev = stbuf.st_dev; - ident.ino = stbuf.st_ino; -#ifdef HAVE_GENERATION - ident.gen = stbuf.st_gen; -#endif - fileid.fid_data = &ident; - fileid.fid_len = sizeof(ident); - ino = _sysio_i_find(fs, &fileid); - if (ino && - (forced || - (ino->i_stbuf.st_mode & S_IFMT) != (stbuf.st_mode & S_IFMT))) { - /* - * Insertion was forced or dup inum but it's already present! - */ - if (native_i_invalid(ino, &ostbuf)) { - /* - * Cached inode has stale attrs - * make way for the new one - */ - I_GONE(ino); - ino = NULL; - } else - /* - * OK to reuse cached inode - */ - goto out; - } + if (!(ino = native_iget(fs, t + FS2NFS(fs)->nfs_atimo, &stbuf))) + return -ENOMEM; - if (!ino) { - ino = native_i_new(fs, &stbuf); - if (!ino) - err = -ENOMEM; - } -out: - if (!err) *inop = ino; - return err; + return 0; } -/* - * Look up named object in host's name space by path. - */ -static int -native_path_lookup(struct filesys *fs, const char *path, struct inode **inop) -{ - - return native_iget(fs, path, inop, 0); +#if defined(REDSTORM) && 0 +static size_t +xxx(size_t count, char **v, struct _sysio_native_stat *nstbuf) +{ + size_t n; + char *s, *cp; + size_t len, nlen; + void *p; + int err; + + n = 0; + s = NULL; + len = 0; + while (n < count) { + nlen = strlen(*v); + p = realloc(s, len + nlen + 1 + 1); + if (!p) + break; + s = p; + cp = s + len; + *cp++ = '/'; + (void )strcpy(cp, *v); + len += nlen + 1; + err = syscall(SYSIO_SYS_stat, s, nstbuf); + if (err != 0) + break; + n++; + v++; + nstbuf++; + } + if (s) + free(s); + return n; } +static void +preload(struct pnode *pno, const char *path) +{ + char *s, *cp; + struct qstr next; + char **v; + size_t vsiz, vlen; + void *p; + struct _sysio_native_stat *nstbuf; + size_t n; + time_t expire; + struct inode *ino; + /* - * Look up object by it's path node. + * Need a writable copy of the path. */ -static int -native_i_lookup(struct filesys *fs, struct pnode_base *pb, struct inode **inop) -{ - int err; - char *path; + s = malloc(strlen(path) + 1 + 1); + if (!s) + return; + s[0] = PATH_SEPARATOR; + (void )strcpy(s + 1, path); - path = _sysio_pb_path(pb, '/'); - if (!path) - return -ENOMEM; - err = native_path_lookup(fs, path, inop); - free(path); - return err; + /* + * Partition into a vector of component names. + */ + v = NULL; + vlen = vsiz = 0; + cp = s; + for (;;) { + _sysio_next_component(cp, &next); + if (!next.len) + break; + if (vlen >= vsiz) { + if (!vsiz) { + vsiz = 11; + vlen = 1; + } else + vsiz = vsiz * 2 + 1; + p = realloc(v, vsiz * sizeof(char *)); + if (!p) + break; + v = p; + } + v[vlen++] = (char *)next.name; + *cp = '\0'; + cp = (char *)next.name + next.len; + } + v[0] = "/"; + nstbuf = malloc(vlen * sizeof(struct _sysio_native_stat)); + if (!nstbuf) + goto out; + n = xxx(vlen, v, nstbuf); + if (vlen < n) + n = vlen; + vlen = n; + n = 0; + expire = _SYSIO_LOCAL_TIME() + FS2NFS(pno->p_mount->mnt_fs)->nfs_atimo; + while (n < vlen) { + ino = native_iget(pno->p_mount->mnt_fs, expire, &nstbuf[n]); + if (!ino) + break; + I_RELE(ino); + n++; + } + free(nstbuf); +out: + free(v); + free(s); } +#endif static int native_inop_lookup(struct pnode *pno, struct inode **inop, struct intent *intnt __IS_UNUSED, - const char *path __IS_UNUSED) +#if !defined(REDSTORM) || 1 + const char *path __IS_UNUSED +#else + const char *path +#endif + ) { + time_t t; + char *fqpath; + struct filesys *fs; int err; *inop = pno->p_base->pb_ino; +#if defined(REDSTORM) && 0 + if (path) + preload(pno, path); +#endif + + /* + * Try to use the cached attributes unless the intent + * indicates we are looking up the last component and + * caller wants attributes. In that case, force a refresh. + */ + t = _SYSIO_LOCAL_TIME(); + if (*inop && + (path || !intnt || (intnt->int_opmask & INT_GETATTR) == 0) && + NATIVE_ATTRS_VALID(I2NI(*inop), t)) + return 0; + /* * Don't have an inode yet. Because we translate everything back to * a single name space for the host, we will assume the object the @@ -696,7 +803,12 @@ native_inop_lookup(struct pnode *pno, * The file identifier *will* be unique. It's got to have a different * dev. */ - err = native_i_lookup(pno->p_mount->mnt_fs, pno->p_base, inop); + fqpath = _sysio_pb_path(pno->p_base, '/'); + if (!fqpath) + return -ENOMEM; + fs = pno->p_mount->mnt_fs; + err = native_ibind(fs, fqpath, t + FS2NFS(fs)->nfs_atimo, inop); + free(fqpath); if (err) *inop = NULL; return err; @@ -707,20 +819,36 @@ native_inop_getattr(struct pnode *pno, struct inode *ino, struct intnl_stat *stat) { - char *path; struct native_inode *nino; int err; - nino = ino ? I2NI(ino) : NULL; + /* + * We just cannot use the cached attributes when getattr is + * called. Had the caller felt those were sufficient then + * they could have (would have?) simply used what was cached + * after revalidating. In this case, there's a good chance the + * caller is looking for the current time stamps and/or size. Something + * pretty volatile anyway. + */ err = 0; /* compiler cookie */ - if (!ino) { + if (pno) { + char *path; + struct filesys *fs; + time_t t; + path = _sysio_pb_path(pno->p_base, '/'); if (!path) return -ENOMEM; - err = native_stat(path, ino, stat); + 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->ni_fd >= 0) - err = native_stat(NULL, ino, stat); + } 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 @@ -763,7 +891,7 @@ native_inop_setattr(struct pnode *pno, /* * Get current status for undo. */ - err = native_stat(path, ino, NULL); + err = native_stat(path, ino, 0, NULL); if (err) goto out; @@ -876,9 +1004,9 @@ native_inop_setattr(struct pnode *pno, } out: /* - * We must refresh the cached attributes on success. + * We must refresh the cached attributes. */ - if (!err && native_stat(path, ino, NULL) != 0) + if (!err && native_stat(path, ino, _SYSIO_LOCAL_TIME(), NULL) != 0) abort(); if (path) free(path); @@ -1148,16 +1276,18 @@ native_inop_open(struct pnode *pno, int #endif fd = syscall(SYSIO_SYS_open, path, flags, mode); if (!pno->p_base->pb_ino && fd >= 0) { + struct filesys *fs; int err; /* * Success but we need to return an i-node. */ + fs = pno->p_mount->mnt_fs; err = - native_iget(pno->p_mount->mnt_fs, + native_ibind(fs, path, - &pno->p_base->pb_ino, - 1); + _SYSIO_LOCAL_TIME() + FS2NFS(fs)->nfs_atimo, + &pno->p_base->pb_ino); if (err) { (void )syscall(SYSIO_SYS_close, fd); if (err == -EEXIST) @@ -1687,9 +1815,11 @@ native_inop_sync(struct inode *ino) static int native_inop_datasync(struct inode *ino) { + struct native_inode *nino; int err; - assert(I2NI(ino)->ni_fd >= 0); + nino = I2NI(ino); + assert(nino->ni_fd >= 0); #ifdef SYSIO_SYS_fdatasync err = syscall(SYSIO_SYS_fdatasync, I2NI(ino)->ni_fd); @@ -1710,10 +1840,11 @@ native_inop_ioctl(struct inode *ino, unsigned long int request, va_list ap) { + struct native_inode *nino; long arg1, arg2, arg3, arg4; - assert(I2NI(ino)->ni_fd >= 0); - + nino = I2NI(ino); + assert(nino->ni_fd >= 0); arg1 = va_arg(ap, long); arg2 = va_arg(ap, long); arg3 = va_arg(ap, long); |
From: Ruth K. <rk...@us...> - 2004-09-30 15:32:05
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21570 Modified Files: fs_native.c Log Message: make previous changes explicit in code instead of macros, for clarity Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -w -b -B -p -r1.50 -r1.51 --- fs_native.c 29 Sep 2004 23:17:18 -0000 1.50 +++ fs_native.c 30 Sep 2004 15:31:55 -0000 1.51 @@ -181,18 +181,6 @@ do { #define __SYS_FDATASYNC SYS_fdatasync #endif -#if defined(USE_NATIVE_UTIME) -#define __SYS_UTIME SYS_utimes -#define __TIME_BUF(x) struct timeval x##[2] -#define __SET_AT(x,y) (x)[0].tv_sec = (y) -#define __SET_MT(x,y) (x)[1].tv_sec = (y) -#else -#define __SYS_UTIME SYS_utime -#define __TIME_BUF(x) struct utimbuf x -#define __SET_AT(x,y) (x).actime = (y) -#define __SET_MT(x,y) (x).modtime = (y) -#endif - /* * Native file identifiers format. */ @@ -799,18 +787,30 @@ native_inop_setattr(struct pnode *pno, if (err) mask &= ~SETATTR_MODE; else if (mask & (SETATTR_MTIME|SETATTR_ATIME)) { - __TIME_BUF(ut); - /* * Alter access and/or modify time attributes. */ - __SET_AT(ut, stat->st_atime); - __SET_MT(ut, stat->st_mtime); +#if defined(USE_NATIVE_UTIME) + struct timeval ut[2]; + + ut[0].tv_sec = stat->st_atime; + ut[1].tv_sec = stat->st_mtime; + if (mask & SETATTR_MTIME) + ut[1].tv_sec = stat->st_mtime; + if (mask & SETATTR_ATIME) + ut[0].tv_sec = stat->st_atime; + err = syscall(SYS_utimes, path, &ut); +#else + struct utimbuf ut; + + ut.actime = stat->st_atime; + ut.modtime = stat->st_mtime; if (mask & SETATTR_MTIME) - __SET_MT(ut, stat->st_mtime); + ut.modtime = stat->st_mtime; if (mask & SETATTR_ATIME) - __SET_AT(ut, stat->st_atime); - err = syscall(__SYS_UTIME, path, &ut); + ut.actime = stat->st_atime; + err = syscall(SYS_utime, path, &ut); +#endif if (err) err = -errno; } @@ -878,11 +878,19 @@ native_inop_setattr(struct pnode *pno, : (gid_t )-1)); } if (mask & (SETATTR_MTIME|SETATTR_ATIME)) { - __TIME_BUF(ut); +#if defined(USE_NATIVE_UTIME) + struct timeval ut[2]; + + ut[0].tv_sec = ino->i_stbuf.st_atime; + ut[1].tv_sec = ino->i_stbuf.st_mtime; + (void )syscall(SYS_utimes, path, &ut); +#else + struct utimbuf ut; - __SET_AT(ut, ino->i_stbuf.st_atime); - __SET_MT(ut, ino->i_stbuf.st_mtime); - (void )syscall(__SYS_UTIME, path, &ut); + ut.actime = ino->i_stbuf.st_atime; + ut.modtime = ino->i_stbuf.st_mtime; + (void )syscall(SYS_utime, path, &ut); +#endif } if (mask & SETATTR_MODE) { fd < 0 |
From: Ruth K. <rk...@us...> - 2004-09-29 23:17:46
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29006 Modified Files: fs_native.c Log Message: Fix arguments to SYS_utimes, which takes a struct timeval array instead of a struct utimebuf. Possibly fixes: Cray New_SPR_730100 SN: UTIME() SETS FILES LAST MODIFICATION TIME INTO THE FUTURE Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.49 retrieving revision 1.50 diff -u -w -b -B -p -r1.49 -r1.50 --- fs_native.c 21 Sep 2004 16:26:59 -0000 1.49 +++ fs_native.c 29 Sep 2004 23:17:18 -0000 1.50 @@ -57,6 +57,7 @@ #include <errno.h> #include <assert.h> #include <syscall.h> +#include <sys/time.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/fcntl.h> @@ -182,8 +183,14 @@ do { #if defined(USE_NATIVE_UTIME) #define __SYS_UTIME SYS_utimes +#define __TIME_BUF(x) struct timeval x##[2] +#define __SET_AT(x,y) (x)[0].tv_sec = (y) +#define __SET_MT(x,y) (x)[1].tv_sec = (y) #else #define __SYS_UTIME SYS_utime +#define __TIME_BUF(x) struct utimbuf x +#define __SET_AT(x,y) (x).actime = (y) +#define __SET_MT(x,y) (x).modtime = (y) #endif /* @@ -792,17 +799,17 @@ native_inop_setattr(struct pnode *pno, if (err) mask &= ~SETATTR_MODE; else if (mask & (SETATTR_MTIME|SETATTR_ATIME)) { - struct utimbuf ut; + __TIME_BUF(ut); /* * Alter access and/or modify time attributes. */ - ut.actime = stat->st_atime; - ut.modtime = stat->st_mtime; + __SET_AT(ut, stat->st_atime); + __SET_MT(ut, stat->st_mtime); if (mask & SETATTR_MTIME) - ut.modtime = stat->st_mtime; + __SET_MT(ut, stat->st_mtime); if (mask & SETATTR_ATIME) - ut.actime = stat->st_atime; + __SET_AT(ut, stat->st_atime); err = syscall(__SYS_UTIME, path, &ut); if (err) err = -errno; @@ -871,10 +878,10 @@ native_inop_setattr(struct pnode *pno, : (gid_t )-1)); } if (mask & (SETATTR_MTIME|SETATTR_ATIME)) { - struct utimbuf ut; + __TIME_BUF(ut); - ut.actime = ino->i_stbuf.st_atime; - ut.modtime = ino->i_stbuf.st_mtime; + __SET_AT(ut, ino->i_stbuf.st_atime); + __SET_MT(ut, ino->i_stbuf.st_mtime); (void )syscall(__SYS_UTIME, path, &ut); } if (mask & SETATTR_MODE) { @@ -1026,7 +1033,7 @@ native_getdirentries(struct inode *ino, ldp = (struct linux_dirent *)bp; d64p = (struct dirent64 *)buf; for (;;) { - if (cc < 0 || (size_t )cc <= sizeof(*ldp)) + if (cc < 0 || (size_t )cc < sizeof(*ldp)) break; namlen = strlen(ldp->ld_name); reclen = sizeof(*d64p) - sizeof(d64p->d_name) + namlen + 1; |
From: Ruth K. <rk...@us...> - 2004-09-29 21:18:09
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1275 Modified Files: rw.c Log Message: Cray New_SPR_730113 SN: WRITEX() SETS ERRNO EBADF INSTEAD OF EINVAL Correct the check for 0 xtvecs in writex. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -b -B -p -r1.14 -r1.15 --- rw.c 13 Aug 2004 15:02:50 -0000 1.14 +++ rw.c 29 Sep 2004 21:17:58 -0000 1.15 @@ -1245,9 +1245,13 @@ SYSIO_INTERFACE_NAME(iwritex)(int fd, SYSIO_INTERFACE_ENTER; fil = _sysio_fd_find(fd); - if (!(fil && xtv_count)) + if (!fil) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); + /* Perform a check on the iov_count and xtv_count */ + if ((iov_count == 0) || (xtv_count == 0)) + SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); + ixtv = ixtvent = malloc(xtv_count * sizeof(struct intnl_xtvec)); if (!ixtv) SYSIO_INTERFACE_RETURN(IOID_FAIL, -ENOMEM); |
From: Ruth K. <rk...@us...> - 2004-09-29 15:30:29
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25585 Modified Files: mknod.c Log Message: fix compile warning, from Kevin Pedretti Index: mknod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mknod.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -b -B -p -r1.15 -r1.16 --- mknod.c 27 Jul 2004 15:00:48 -0000 1.15 +++ mknod.c 29 Sep 2004 15:30:20 -0000 1.16 @@ -62,10 +62,6 @@ #undef mknod #undef __xmknod -#if defined(BSD) || defined(REDSTORM) -#define _MKNOD_VER 0 -#endif - int PREPEND(__, SYSIO_INTERFACE_NAME(xmknod))(int __ver, const char *path, |
From: Ruth K. <rk...@us...> - 2004-09-27 20:21:09
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv848 Modified Files: fs_yod.c Log Message: modify yod driver to use new inode struct Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -w -b -B -p -r1.19 -r1.20 --- fs_yod.c 21 Sep 2004 16:18:14 -0000 1.19 +++ fs_yod.c 27 Sep 2004 20:20:58 -0000 1.20 @@ -293,6 +293,7 @@ yod_i_new(struct filesys *fs, struct int if (!nino) return NULL; bzero(&nino->ni_ident, sizeof(nino->ni_ident)); + nino->ni_seekok = 0; nino->ni_ident.dev = buf->st_dev; nino->ni_ident.ino = buf->st_ino; #ifdef HAVE_GENERATION @@ -307,8 +308,7 @@ yod_i_new(struct filesys *fs, struct int ino = _sysio_i_new(fs, &nino->ni_fileid, - buf->st_mode, /* all of the bits! */ - 0, + buf, 0, &yod_i_ops, nino); @@ -476,21 +476,22 @@ yod_fsswop_mount(const char *source, } static int -yod_i_invalid(struct inode *inop, struct intnl_stat stbuf) +yod_i_invalid(struct inode *inop, struct intnl_stat *stat) { /* * Validate passed in inode against stat struct info */ struct yod_inode *nino = I2NI(inop); - if ((nino->ni_ident.dev != stbuf.st_dev || - nino->ni_ident.ino != stbuf.st_ino || + if ((nino->ni_ident.dev != stat->st_dev || + nino->ni_ident.ino != stat->st_ino || #ifdef HAVE_GENERATION - nino->ni_ident.gen != stbuf.st_gen || + nino->ni_ident.gen != stat->st_gen || #endif - ((inop)->i_mode & S_IFMT) != (stbuf.st_mode & S_IFMT)) || - (((inop)->i_rdev != stbuf.st_rdev) && - (S_ISCHR((inop)->i_mode) || S_ISBLK((inop)->i_mode)))) + ((inop)->i_stbuf.st_mode & S_IFMT) != (stat->st_mode & S_IFMT)) || + (((inop)->i_stbuf.st_rdev != stat->st_rdev) && + (S_ISCHR((inop)->i_stbuf.st_mode) || + S_ISBLK((inop)->i_stbuf.st_mode)))) return 1; return 0; @@ -525,7 +526,7 @@ yod_iget(struct filesys *fs, * Validate? */ if (*inop) { - if (!yod_i_invalid(*inop, stbuf)) + if (!yod_i_invalid(*inop, &stbuf)) return 0; /* * Invalidate. @@ -549,7 +550,7 @@ yod_iget(struct filesys *fs, /* * Insertion was forced but it's already present! */ - if (yod_i_invalid(ino, stbuf)) { + if (yod_i_invalid(ino, &stbuf)) { /* * Cached inode has stale attrs * make way for the new one |
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24231/src Modified Files: Tag: defer-cwd access.c chdir.c file.c file_hack.c fs.c fsync.c getdirentries.c inode.c ioctl.c ioctx.c iowait.c link.c mkdir.c mount.c namei.c rmdir.c symlink.c truncate.c unlink.c Log Message: The head brnach had been updated to carry the full attributes around in the inode, directly. Need to change the way we cache in the native driver, then. Merged the head in to get the relevant changes. Index: access.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/access.c,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -u -w -b -B -p -r1.9 -r1.9.2.1 --- access.c 31 Jul 2004 14:28:51 -0000 1.9 +++ access.c 23 Sep 2004 17:09:50 -0000 1.9.2.1 @@ -44,53 +44,35 @@ #include <stdlib.h> #include <errno.h> #include <unistd.h> +#include <assert.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/queue.h> #include "sysio.h" +#include "inode.h" #include "sysio-symbols.h" -int -SYSIO_INTERFACE_NAME(access)(const char *path, int amode) +/* + * Check given access type on given inode. + */ +static int +_sysio_check_permission(struct inode *ino, + uid_t uid, gid_t gid, + gid_t gids[], size_t ngids, + int amode) { - gid_t *list, *entry; - size_t n; - int err = 0; - unsigned mask, mode; - struct stat stbuf; - SYSIO_INTERFACE_DISPLAY_BLOCK; - - SYSIO_INTERFACE_ENTER; - err = 0; + mode_t mask; + struct intnl_stat *stat; /* * Check amode. */ if ((amode & (R_OK|W_OK|X_OK)) != amode) - SYSIO_INTERFACE_RETURN(-1, -EINVAL); - - n = getgroups(0, NULL); - list = NULL; - if (n) { - list = malloc(n * sizeof(gid_t)); - if (!list) { - err = -ENOMEM; - goto out; - } - } - err = getgroups(n, list); - if (err != (int ) n) - goto out; + return -EINVAL; - err = SYSIO_INTERFACE_NAME(stat)(path, &stbuf); - if (err) { - err = -errno; - goto out; - } if (!amode) - SYSIO_INTERFACE_RETURN(0, 0); - + return 0; mask = 0; if (amode & R_OK) @@ -100,29 +82,91 @@ SYSIO_INTERFACE_NAME(access)(const char if (amode & X_OK) mask |= S_IXUSR; - mode = stbuf.st_mode; - if (stbuf.st_uid == getuid() && (mode & mask) == mask) - goto out; + stat = &ino->i_stbuf; + if (stat->st_uid == uid && (stat->st_mode & mask) == mask) + return 0; mask >>= 3; - if (stbuf.st_gid == getgid() && (mode & mask) == mask) - goto out; + if (stat->st_gid == gid && (stat->st_mode & mask) == mask) + return 0; - entry = list; - while (n--) - if (stbuf.st_gid == *entry++ && (mode & mask) == mask) - goto out; + while (ngids) { + ngids--; + if (stat->st_gid == *gids++ && (stat->st_mode & mask) == mask) + return 0; + } mask >>= 3; - if ((mode & mask) == mask) - goto out; + if ((stat->st_mode & mask) == mask) + return 0; - err = -EACCES; + return -EACCES; +} -out: - if (list) - free(list); +/* + * Determine if a given access is permitted to a give file. + */ +int +_sysio_permitted(struct inode *ino, int amode) +{ + int err; + gid_t *gids; + int n; + void *p; + + err = 0; + gids = NULL; + for (;;) { + n = getgroups(0, NULL); + if (!n) + break; + p = realloc(gids, n * sizeof(gid_t)); + if (!p && gids) { + err = -ENOMEM; + break; + } + gids = p; + err = getgroups(n, gids); + if (err < 0) { + if (errno == EINVAL) + continue; + err = -errno; + break; + } + err = + _sysio_check_permission(ino, + geteuid(), getegid(), + gids, (size_t )n, + amode); + break; + } + if (!gids) + return err; + free(gids); + return err; +} + +int +SYSIO_INTERFACE_NAME(access)(const char *path, int amode) +{ + struct intent intent; + int err; + struct pnode *pno; + + SYSIO_INTERFACE_DISPLAY_BLOCK; + + SYSIO_INTERFACE_ENTER; + INTENT_INIT(&intent, INT_GETATTR, NULL, NULL); + err = _sysio_namei(_sysio_cwd, path, 0, &intent, &pno); + if (err) + SYSIO_INTERFACE_RETURN(-1, err); + err = + _sysio_check_permission(pno->p_base->pb_ino, + getuid(), getgid(), + NULL, 0, + amode); + P_RELE(pno); SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); } Index: chdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chdir.c,v retrieving revision 1.20.2.1 retrieving revision 1.20.2.2 diff -u -w -b -B -p -r1.20.2.1 -r1.20.2.2 --- chdir.c 12 Sep 2004 04:41:44 -0000 1.20.2.1 +++ chdir.c 23 Sep 2004 17:09:50 -0000 1.20.2.2 @@ -94,7 +94,7 @@ _sysio_p_chdir(struct pnode *pno) int err; /* - * Revalidate the pnode, and ensure it's a directory + * Revalidate the pnode, and ensure it's an accessable directory */ err = _sysio_p_validate(pno, NULL, NULL); if (err) @@ -99,10 +99,14 @@ _sysio_p_chdir(struct pnode *pno) err = _sysio_p_validate(pno, NULL, NULL); if (err) return err; - if (!(pno->p_base->pb_ino && - S_ISDIR(pno->p_base->pb_ino->i_mode))) - return -ENOTDIR; + S_ISDIR(pno->p_base->pb_ino->i_stbuf.st_mode))) + err = -ENOTDIR; + else + err = _sysio_permitted(pno->p_base->pb_ino, X_OK); + if (err) + return err; + /* * Release old if set. */ @@ -158,7 +162,7 @@ _sysio_p_path(struct pnode *pno, char ** cur = pno; - if (!size) + if (!size && buf && *buf) return -EINVAL; /* Index: file.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/file.c,v retrieving revision 1.16 retrieving revision 1.16.2.1 diff -u -w -b -B -p -r1.16 -r1.16.2.1 --- file.c 28 Jul 2004 14:56:52 -0000 1.16 +++ file.c 23 Sep 2004 17:09:50 -0000 1.16.2.1 @@ -45,6 +45,7 @@ #include <assert.h> #include <errno.h> #include <sys/types.h> +#include <sys/stat.h> #include <sys/queue.h> #include "sysio.h" Index: file_hack.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/file_hack.c,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -u -w -b -B -p -r1.5 -r1.5.2.1 --- file_hack.c 28 Jul 2004 06:39:21 -0000 1.5 +++ file_hack.c 23 Sep 2004 17:09:50 -0000 1.5.2.1 @@ -46,6 +46,7 @@ #include <assert.h> #include <errno.h> #include <sys/types.h> +#include <sys/stat.h> #include <sys/queue.h> #include "sysio.h" Index: fs.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fs.c,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -u -w -b -B -p -r1.13 -r1.13.2.1 --- fs.c 27 Jul 2004 15:00:43 -0000 1.13 +++ fs.c 23 Sep 2004 17:09:51 -0000 1.13.2.1 @@ -46,6 +46,7 @@ #include <errno.h> #include <assert.h> #include <sys/types.h> +#include <sys/stat.h> #include <sys/queue.h> #include "sysio.h" Index: fsync.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fsync.c,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -u -w -b -B -p -r1.7 -r1.7.2.1 --- fsync.c 27 Jul 2004 15:00:43 -0000 1.7 +++ fsync.c 23 Sep 2004 17:09:51 -0000 1.7.2.1 @@ -44,6 +44,7 @@ #include <unistd.h> #include <errno.h> #include <sys/types.h> +#include <sys/stat.h> #include <sys/queue.h> #include "sysio.h" Index: getdirentries.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/getdirentries.c,v retrieving revision 1.17 retrieving revision 1.17.2.1 diff -u -w -b -B -p -r1.17 -r1.17.2.1 --- getdirentries.c 27 Jul 2004 15:00:43 -0000 1.17 +++ getdirentries.c 23 Sep 2004 17:09:51 -0000 1.17.2.1 @@ -101,7 +101,7 @@ PREPEND(_, SYSIO_INTERFACE_NAME(getdiren if (!(fil && fil->f_ino)) SYSIO_INTERFACE_RETURN(-1, -EBADF); - if (!S_ISDIR(fil->f_ino->i_mode)) + if (!S_ISDIR(fil->f_ino->i_stbuf.st_mode)) SYSIO_INTERFACE_RETURN(-1, -ENOTDIR); cc = Index: inode.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/inode.c,v retrieving revision 1.20.2.1 retrieving revision 1.20.2.2 diff -u -w -b -B -p -r1.20.2.1 -r1.20.2.2 --- inode.c 23 Sep 2004 16:46:29 -0000 1.20.2.1 +++ inode.c 23 Sep 2004 17:09:51 -0000 1.20.2.2 @@ -218,8 +218,7 @@ hash(struct file_identifier *fid) struct inode * _sysio_i_new(struct filesys *fs, struct file_identifier *fid, - mode_t type, - dev_t rdev, + struct intnl_stat *stat, unsigned immunity, struct inode_ops *ops, void *private) @@ -240,14 +239,16 @@ _sysio_i_new(struct filesys *fs, return NULL; ino->i_ops = *ops; operations = *ops; - if (S_ISBLK(type) || S_ISCHR(type) || S_ISFIFO(type)) { + if (S_ISBLK(stat->st_mode) || + S_ISCHR(stat->st_mode) || + S_ISFIFO(stat->st_mode)) { struct inode_ops *o; /* * Replace some operations sent with * those from the device table. */ - o = _sysio_dev_lookup(type, rdev); + o = _sysio_dev_lookup(stat->st_mode, stat->st_rdev); operations.inop_open = o->inop_open; operations.inop_close = o->inop_close; operations.inop_read = o->inop_read; @@ -258,7 +259,7 @@ _sysio_i_new(struct filesys *fs, operations.inop_datasync = o->inop_datasync; operations.inop_ioctl = o->inop_ioctl; } - I_INIT(ino, fs, type, rdev, &operations, fid, immunity, private); + I_INIT(ino, fs, stat, &operations, fid, immunity, private); ino->i_ref = 1; TAILQ_INSERT_TAIL(&_sysio_inodes, ino, i_nodes); head = &fs->fs_itbl[hash(fid) % FS_ITBLSIZ]; Index: ioctl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/ioctl.c,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -u -w -b -B -p -r1.11 -r1.11.2.1 --- ioctl.c 27 Jul 2004 15:00:48 -0000 1.11 +++ ioctl.c 23 Sep 2004 17:09:51 -0000 1.11.2.1 @@ -44,6 +44,7 @@ #include <errno.h> #include <sys/ioctl.h> #include <sys/types.h> +#include <sys/stat.h> #include <sys/queue.h> #include "sysio.h" Index: ioctx.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/ioctx.c,v retrieving revision 1.19 retrieving revision 1.19.2.1 diff -u -w -b -B -p -r1.19 -r1.19.2.1 --- ioctx.c 27 Jul 2004 15:00:48 -0000 1.19 +++ ioctx.c 23 Sep 2004 17:09:51 -0000 1.19.2.1 @@ -47,6 +47,7 @@ #include <assert.h> #include <sys/uio.h> #include <sys/types.h> +#include <sys/stat.h> #include <sys/queue.h> #include "xtio.h" Index: iowait.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/iowait.c,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -u -w -b -B -p -r1.9 -r1.9.2.1 --- iowait.c 27 Jul 2004 15:00:48 -0000 1.9 +++ iowait.c 23 Sep 2004 17:09:51 -0000 1.9.2.1 @@ -43,6 +43,7 @@ #include <errno.h> #include <sys/types.h> +#include <sys/stat.h> #include <sys/queue.h> #include "sysio.h" Index: link.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/link.c,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -u -w -b -B -p -r1.10 -r1.10.2.1 --- link.c 27 Jul 2004 15:00:48 -0000 1.10 +++ link.c 23 Sep 2004 17:09:51 -0000 1.10.2.1 @@ -67,7 +67,7 @@ SYSIO_INTERFACE_NAME(link)(const char *o err = _sysio_namei(_sysio_cwd, oldpath, 0, &intent, &old); if (err) goto out; - if (S_ISDIR(old->p_base->pb_ino->i_mode)) { + if (S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)) { err = -EPERM; goto error1; } Index: mkdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mkdir.c,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -u -w -b -B -p -r1.13 -r1.13.2.1 --- mkdir.c 27 Jul 2004 15:00:48 -0000 1.13 +++ mkdir.c 23 Sep 2004 17:09:51 -0000 1.13.2.1 @@ -45,6 +45,7 @@ #include <errno.h> #include <assert.h> #include <sys/types.h> +#include <sys/stat.h> #include <sys/queue.h> #include "sysio.h" Index: mount.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mount.c,v retrieving revision 1.16.2.1 retrieving revision 1.16.2.2 diff -u -w -b -B -p -r1.16.2.1 -r1.16.2.2 --- mount.c 12 Sep 2004 04:41:44 -0000 1.16.2.1 +++ mount.c 23 Sep 2004 17:09:51 -0000 1.16.2.2 @@ -155,7 +155,7 @@ _sysio_do_mount(struct filesys *fs, if (err) goto error; - if (!S_ISDIR(mnt->mnt_root->p_base->pb_ino->i_mode)) { + if (!S_ISDIR(mnt->mnt_root->p_base->pb_ino->i_stbuf.st_mode)) { err = -ENOTDIR; goto error; } Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.14.2.1 retrieving revision 1.14.2.2 diff -u -w -b -B -p -r1.14.2.1 -r1.14.2.2 --- namei.c 12 Sep 2004 04:41:44 -0000 1.14.2.1 +++ namei.c 23 Sep 2004 17:09:51 -0000 1.14.2.2 @@ -49,6 +49,7 @@ #include <string.h> #include <errno.h> #include <assert.h> +#include <unistd.h> #include <sys/param.h> #include <sys/types.h> #include <sys/stat.h> @@ -89,12 +90,16 @@ lookup(struct pnode *parent, struct intent *intnt, const char *path) { - struct pnode *pno; int err; + struct pnode *pno; if (!parent->p_base->pb_ino) return -ENOTDIR; + err = _sysio_permitted(parent->p_base->pb_ino, X_OK); + if (err) + return err; + /* * Short-circuit `.' and `..'; We don't cache those. */ @@ -221,7 +226,7 @@ _sysio_path_walk(struct pnode *parent, s */ for (;;) { ino = nd->nd_pno->p_base->pb_ino; - if (S_ISLNK(ino->i_mode) && + if (S_ISLNK(ino->i_stbuf.st_mode) && (next.len || !(nd->nd_flags & ND_NOFOLLOW))) { char *lpath; ssize_t cc; @@ -270,10 +275,10 @@ _sysio_path_walk(struct pnode *parent, s } #ifdef AUTOMOUNT_FILE_NAME else if (ino && - S_ISDIR(ino->i_mode) && + S_ISDIR(ino->i_stbuf.st_mode) && (nd->nd_pno->p_mount->mnt_flags & MOUNT_F_AUTO) && nd->nd_amcnt < MAX_MOUNT_DEPTH && - ino->i_mode & S_ISUID) { + ino->i_stbuf.st_mode & S_ISUID) { struct pnode *pno; /* @@ -357,7 +362,7 @@ _sysio_path_walk(struct pnode *parent, s /* * Parent must be a directory. */ - if (ino && !S_ISDIR(ino->i_mode)) { + if (ino && !S_ISDIR(ino->i_stbuf.st_mode)) { err = -ENOTDIR; break; } @@ -436,7 +441,8 @@ _sysio_path_walk(struct pnode *parent, s * Make sure the last processed component was a directory. The * trailing slashes are illegal behind anything else. */ - if (!(err || S_ISDIR(nd->nd_pno->p_base->pb_ino->i_mode))) + if (!(err || + S_ISDIR(nd->nd_pno->p_base->pb_ino->i_stbuf.st_mode))) err = -ENOTDIR; } Index: rmdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rmdir.c,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -u -w -b -B -p -r1.15 -r1.15.2.1 --- rmdir.c 27 Jul 2004 15:00:48 -0000 1.15 +++ rmdir.c 23 Sep 2004 17:09:51 -0000 1.15.2.1 @@ -45,6 +45,7 @@ #include <errno.h> #include <assert.h> #include <sys/types.h> +#include <sys/stat.h> #include <sys/queue.h> #include "sysio.h" Index: symlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/symlink.c,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -u -w -b -B -p -r1.11 -r1.11.2.1 --- symlink.c 27 Jul 2004 15:00:48 -0000 1.11 +++ symlink.c 23 Sep 2004 17:09:51 -0000 1.11.2.1 @@ -45,6 +45,7 @@ #include <errno.h> #include <assert.h> #include <sys/types.h> +#include <sys/stat.h> #include <sys/queue.h> #include "sysio.h" Index: truncate.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/truncate.c,v retrieving revision 1.12 retrieving revision 1.12.2.1 diff -u -w -b -B -p -r1.12 -r1.12.2.1 --- truncate.c 27 Jul 2004 15:00:48 -0000 1.12 +++ truncate.c 23 Sep 2004 17:09:51 -0000 1.12.2.1 @@ -71,9 +71,9 @@ do_truncate(struct pnode *pno, struct in ino = pno->p_base->pb_ino; if (!ino) return -EBADF; - if (S_ISDIR(ino->i_mode)) /* for others too? */ + if (S_ISDIR(ino->i_stbuf.st_mode)) /* for others too? */ return -EISDIR; - if (!S_ISREG(ino->i_mode)) + if (!S_ISREG(ino->i_stbuf.st_mode)) return -EINVAL; (void )memset(&stbuf, 0, sizeof(stbuf)); Index: unlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/unlink.c,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -u -w -b -B -p -r1.14 -r1.14.2.1 --- unlink.c 27 Jul 2004 15:00:48 -0000 1.14 +++ unlink.c 23 Sep 2004 17:09:51 -0000 1.14.2.1 @@ -45,6 +45,7 @@ #include <errno.h> #include <assert.h> #include <sys/types.h> +#include <sys/stat.h> #include <sys/queue.h> #include "sysio.h" |
From: Lee W. <lw...@us...> - 2004-09-23 17:10:30
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24231/include Modified Files: Tag: defer-cwd inode.h Log Message: The head brnach had been updated to carry the full attributes around in the inode, directly. Need to change the way we cache in the native driver, then. Merged the head in to get the relevant changes. Index: inode.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/inode.h,v retrieving revision 1.21 retrieving revision 1.21.2.1 diff -u -w -b -B -p -r1.21 -r1.21.2.1 --- inode.h 27 Jul 2004 15:00:41 -0000 1.21 +++ inode.h 23 Sep 2004 17:09:49 -0000 1.21.2.1 @@ -135,9 +135,8 @@ struct inode { i_immune : 1, /* immune from GC */ i_zombie : 1; /* stale inode */ unsigned i_ref; /* soft ref counter */ - mode_t i_mode; /* mode (see stat.h) */ - dev_t i_rdev; /* dev (if device) */ struct inode_ops i_ops; /* operations */ + struct intnl_stat i_stbuf; /* attrs */ struct filesys *i_fs; /* file system ptr */ struct file_identifier *i_fid; /* file ident */ void *i_private; /* driver data */ @@ -147,14 +146,13 @@ struct inode { /* * Init an i-node record. */ -#define I_INIT(ino, fs, mode, rdev, ops, fid, immunity, private) \ +#define I_INIT(ino, fs, stat, ops, fid, immunity, private) \ do { \ (ino)->i_immune = (immunity) ? 1 : 0; \ (ino)->i_zombie = 0; \ (ino)->i_ref = 0; \ - (ino)->i_mode = (mode); \ - (ino)->i_rdev = (rdev); \ (ino)->i_ops = *(ops); \ + (ino)->i_stbuf = *(stat); \ (ino)->i_fs = (fs); \ (ino)->i_fid = (fid); \ (ino)->i_private = (private); \ @@ -423,8 +421,7 @@ extern void _sysio_i_shutdown(void); #endif extern struct inode *_sysio_i_new(struct filesys *fs, struct file_identifier *fid, - mode_t type, - dev_t rdev, + struct intnl_stat *stat, unsigned immunity, struct inode_ops *ops, void *private); @@ -466,6 +463,7 @@ extern int _sysio_path_walk(struct pnode #ifdef AUTOMOUNT_FILE_NAME extern void _sysio_next_component(const char *path, struct qstr *name); #endif +extern int _sysio_permitted(struct inode *ino, int amode); extern int _sysio_namei(struct pnode *pno, const char *path, unsigned flags, |
From: Lee W. <lw...@us...> - 2004-09-23 17:10:30
|
Update of /cvsroot/libsysio/libsysio/drivers/sockets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24231/drivers/sockets Modified Files: Tag: defer-cwd sockets.c Log Message: The head brnach had been updated to carry the full attributes around in the inode, directly. Need to change the way we cache in the native driver, then. Merged the head in to get the relevant changes. Index: sockets.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/sockets/sockets.c,v retrieving revision 1.10.2.2 retrieving revision 1.10.2.3 diff -u -w -b -B -p -r1.10.2.2 -r1.10.2.3 --- sockets.c 23 Sep 2004 16:51:17 -0000 1.10.2.2 +++ sockets.c 23 Sep 2004 17:09:48 -0000 1.10.2.3 @@ -361,6 +361,7 @@ _sysio_sockets_inew() static ino_t inum = 1; struct socket_info *ski; struct inode *ino; + static struct intnl_stat zero_stat; ski = malloc(sizeof(struct socket_info)); if (!ski) @@ -373,8 +374,7 @@ _sysio_sockets_inew() ino = _sysio_i_new(sockets_fs, &ski->ski_fileid, - 0, - 0, + &zero_stat, 0, &sockets_i_ops, ski); |
From: Lee W. <lw...@us...> - 2004-09-23 17:10:30
|
Update of /cvsroot/libsysio/libsysio/drivers/incore In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24231/drivers/incore Modified Files: Tag: defer-cwd fs_incore.c Log Message: The head brnach had been updated to carry the full attributes around in the inode, directly. Need to change the way we cache in the native driver, then. Merged the head in to get the relevant changes. Index: fs_incore.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/incore/fs_incore.c,v retrieving revision 1.21 retrieving revision 1.21.2.1 diff -u -w -b -B -p -r1.21 -r1.21.2.1 --- fs_incore.c 27 Aug 2004 18:11:24 -0000 1.21 +++ fs_incore.c 23 Sep 2004 17:09:46 -0000 1.21.2.1 @@ -85,7 +85,6 @@ */ struct incore_inode { LIST_ENTRY(incore_inode) ici_link; /* i-nodes list link */ - unsigned ici_revalidate : 1; /* synch sys inode? */ struct intnl_stat ici_st; /* attrs */ struct file_identifier ici_fileid; /* file ID */ void *ici_data; /* file data */ @@ -419,7 +418,6 @@ incore_i_alloc(struct incore_filesys *ic icino = malloc(sizeof(struct incore_inode)); if (!icino) return NULL; - icino->ici_revalidate = 0; icino->ici_st = *st; icino->ici_fileid.fid_data = &icino->ici_st.st_ino; icino->ici_fileid.fid_len = sizeof(icino->ici_st.st_ino); @@ -634,8 +632,7 @@ _sysio_incore_fsswop_mount(const char *s rooti = _sysio_i_new(fs, &icino->ici_fileid, - icino->ici_st.st_mode, - 0, + &icino->ici_st, 1, &_sysio_incore_dir_ops, icino); @@ -809,10 +806,7 @@ _sysio_incore_dirop_lookup(struct pnode if (*inop) { icino = I2IC(*inop); assert(icino); - if (icino->ici_revalidate) { - (*inop)->i_mode = icino->ici_st.st_mode; - icino->ici_revalidate = 0; - } + (*inop)->i_stbuf = icino->ici_st; return 0; } @@ -856,8 +850,7 @@ _sysio_incore_dirop_lookup(struct pnode ino = _sysio_i_new(ino->i_fs, &icino->ici_fileid, - icino->ici_st.st_mode, - 0, + &icino->ici_st 1, ops, icino); @@ -911,7 +904,6 @@ _sysio_incore_inop_setattr(struct pnode if (mask & SETATTR_MODE) { icino->ici_st.st_mode = (icino->ici_st.st_mode & S_IFMT) | (stbuf->st_mode & 07777); - icino->ici_revalidate = 1; } if (mask & SETATTR_MTIME) icino->ici_st.st_mtime = stbuf->st_mtime; @@ -923,6 +915,7 @@ _sysio_incore_inop_setattr(struct pnode icino->ici_st.st_gid = stbuf->st_gid; icino->ici_st.st_ctime = time(NULL); + ino->i_stbuf = icino->ici_st; out: return err; } @@ -1167,8 +1160,7 @@ _sysio_incore_dirop_mkdir(struct pnode * ino = _sysio_i_new(pno->p_parent->p_base->pb_ino->i_fs, &icino->ici_fileid, - stat.st_mode, - 0, + &stat, 1, &_sysio_incore_dir_ops, icino); @@ -1274,7 +1266,7 @@ _sysio_incore_dirop_rmdir(struct pnode * } static int -incore_create(struct pnode *pno, struct intnl_stat *st) +incore_create(struct pnode *pno, struct intnl_stat *stat) { struct inode *dino, *ino; struct incore_inode *icino; @@ -1283,7 +1275,7 @@ incore_create(struct pnode *pno, struct dino = pno->p_parent->p_base->pb_ino; assert(dino); - icino = incore_i_alloc(FS2ICFS(dino->i_fs), st); + icino = incore_i_alloc(FS2ICFS(dino->i_fs), stat); if (!icino) return -ENOSPC; @@ -1293,10 +1285,9 @@ incore_create(struct pnode *pno, struct ino = _sysio_i_new(dino->i_fs, &icino->ici_fileid, - st->st_mode, - st->st_rdev, + stat, 1, - S_ISREG(st->st_mode) + S_ISREG(stat->st_mode) ? &_sysio_incore_file_ops : &_sysio_incore_dev_ops, icino); @@ -1311,7 +1302,7 @@ incore_create(struct pnode *pno, struct err = incore_directory_insert(I2IC(dino), &pno->p_base->pb_name, - st->st_ino, + stat->st_ino, INCORE_D_TYPEOF(icino->ici_st.st_mode)); if (err) { I_RELE(ino); @@ -1372,7 +1363,7 @@ _sysio_incore_dirop_link(struct pnode *o int err; assert(!new->p_base->pb_ino); - assert(!S_ISDIR(old->p_base->pb_ino->i_mode)); + assert(!S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)); /* * Can bump the link count? |
From: Lee W. <lw...@us...> - 2004-09-23 17:10:30
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24231/drivers/native Modified Files: Tag: defer-cwd fs_native.c Log Message: The head brnach had been updated to carry the full attributes around in the inode, directly. Need to change the way we cache in the native driver, then. Merged the head in to get the relevant changes. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.48.2.2 retrieving revision 1.48.2.3 diff -u -w -b -B -p -r1.48.2.2 -r1.48.2.3 --- fs_native.c 23 Sep 2004 16:51:17 -0000 1.48.2.2 +++ fs_native.c 23 Sep 2004 17:09:47 -0000 1.48.2.3 @@ -149,8 +149,6 @@ struct native_inode { int ni_oflags; /* flags, from open */ unsigned ni_nopens; /* soft ref count */ _SYSIO_OFF_T ni_fpos; /* current pos */ - struct intnl_stat ni_stat; /* cached attrs */ - time_t ni_attrtim; /* attrs time stamp */ }; /* @@ -272,41 +270,29 @@ static int native_stat(const char *path, struct inode *ino, struct intnl_stat *buf) { struct native_inode *nino; - time_t t; int err; struct _sysio_native_stat stbuf; nino = ino ? I2NI(ino) : NULL; - t = _SYSIO_LOCAL_TIME(); - /* - * Use cached? - */ - if (nino && - nino->ni_attrvalid && - nino->ni_attrtim <= t && - (t - nino->ni_attrtim) < FS2NFS(ino->i_fs)->nfs_atimo) { - (void )memcpy(buf, &nino->ni_stat, sizeof(struct intnl_stat)); - return 0; - } if (path) err = syscall(SYSIO_SYS_stat, path, &stbuf); else if (nino && nino->ni_fd >= 0) err = syscall(SYSIO_SYS_fstat, nino->ni_fd, &stbuf); else abort(); - if (err) { - if (nino) - nino->ni_attrvalid = 0; + if (err) return -errno; - } if (nino) { - nino->ni_attrvalid = 1; - nino->ni_attrtim = t; - SYSIO_COPY_STAT(&stbuf, &nino->ni_stat); - (void )memcpy(buf, &nino->ni_stat, sizeof(struct intnl_stat)); + SYSIO_COPY_STAT(&stbuf, &ino->i_stbuf); + if (buf) + (void )memcpy(buf, + &ino->i_stbuf, + sizeof(struct intnl_stat)); return 0; } + if (!buf) + return 0; SYSIO_COPY_STAT(&stbuf, buf); return 0; } @@ -325,7 +311,6 @@ native_i_new(struct filesys *fs, struct return NULL; bzero(&nino->ni_ident, sizeof(nino->ni_ident)); nino->ni_seekok = 0; - nino->ni_attrvalid = 1; nino->ni_ident.dev = buf->st_dev; nino->ni_ident.ino = buf->st_ino; #ifdef HAVE_GENERATION @@ -337,17 +322,10 @@ native_i_new(struct filesys *fs, struct nino->ni_oflags = 0; nino->ni_nopens = 0; nino->ni_fpos = 0; - (void )memcpy(&nino->ni_stat, buf, sizeof(struct intnl_stat)); - nino->ni_attrtim = _SYSIO_LOCAL_TIME(); ino = _sysio_i_new(fs, &nino->ni_fileid, -#ifndef AUTOMOUNT_FILE_NAME - buf->st_mode & S_IFMT, -#else - buf->st_mode, /* all of the bits! */ -#endif - buf->st_rdev, + buf, 0, &native_i_ops, nino); @@ -570,21 +548,22 @@ native_fsswop_mount(const char *source, } static int -native_i_invalid(struct inode *inop, struct intnl_stat stbuf) +native_i_invalid(struct inode *inop, struct intnl_stat *stat) { /* * Validate passed in inode against stat struct info */ struct native_inode *nino = I2NI(inop); - if ((nino->ni_ident.dev != stbuf.st_dev || - nino->ni_ident.ino != stbuf.st_ino || + if ((nino->ni_ident.dev != stat->st_dev || + nino->ni_ident.ino != stat->st_ino || #ifdef HAVE_GENERATION - nino->ni_ident.gen != stbuf.st_gen || + nino->ni_ident.gen != stat->st_gen || #endif - ((inop)->i_mode & S_IFMT) != (stbuf.st_mode & S_IFMT)) || - (((inop)->i_rdev != stbuf.st_rdev) && - (S_ISCHR((inop)->i_mode) || S_ISBLK((inop)->i_mode)))) + ((inop)->i_stbuf.st_mode & S_IFMT) != (stat->st_mode & S_IFMT)) || + (((inop)->i_stbuf.st_rdev != stat->st_rdev) && + (S_ISCHR((inop)->i_stbuf.st_mode) || + S_ISBLK((inop)->i_stbuf.st_mode)))) return 1; return 0; @@ -602,24 +581,24 @@ native_iget(struct filesys *fs, { int err; struct inode *ino; - struct intnl_stat stbuf; + struct intnl_stat ostbuf, stbuf; struct native_inode_identifier ident; struct file_identifier fileid; /* - * Get file status. + * Save old attributes and get current file status. */ + if (*inop) + ostbuf = (*inop)->i_stbuf; err = native_stat(path, *inop, &stbuf); - if (err) { - *inop = NULL; + if (err) return err; - } /* * Validate? */ if (*inop) { - if (!native_i_invalid(*inop, stbuf)) + if (!native_i_invalid(*inop, &ostbuf)) return 0; /* * Invalidate. @@ -640,11 +619,12 @@ native_iget(struct filesys *fs, fileid.fid_len = sizeof(ident); ino = _sysio_i_find(fs, &fileid); if (ino && - (forced || (ino->i_mode & S_IFMT) != (stbuf.st_mode & S_IFMT))) { + (forced || + (ino->i_stbuf.st_mode & S_IFMT) != (stbuf.st_mode & S_IFMT))) { /* * Insertion was forced or dup inum but it's already present! */ - if (native_i_invalid(ino, stbuf)) { + if (native_i_invalid(ino, &ostbuf)) { /* * Cached inode has stale attrs * make way for the new one @@ -725,7 +705,7 @@ native_inop_lookup(struct pnode *pno, static int native_inop_getattr(struct pnode *pno, struct inode *ino, - struct intnl_stat *stbuf) + struct intnl_stat *stat) { char *path; struct native_inode *nino; @@ -737,18 +717,18 @@ native_inop_getattr(struct pnode *pno, path = _sysio_pb_path(pno->p_base, '/'); if (!path) return -ENOMEM; - err = native_stat(path, ino, stbuf); + err = native_stat(path, ino, stat); free(path); } else if (nino->ni_fd >= 0) - err = native_stat(NULL, ino, stbuf); + err = native_stat(NULL, ino, 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(stbuf, - &nino->ni_stat, + (void )memcpy(stat, + &ino->i_stbuf, sizeof(struct intnl_stat)); err = 0; } @@ -760,22 +740,18 @@ static int native_inop_setattr(struct pnode *pno, struct inode *ino, unsigned mask, - struct intnl_stat *stbuf) + struct intnl_stat *stat) { char *path; struct native_inode *nino; int fd; - struct intnl_stat *stbp, _stbuf; int err; path = NULL; nino = ino ? I2NI(ino) : NULL; fd = -1; - stbp = &_stbuf; - if (nino) { + if (nino) fd = nino->ni_fd; - stbp = &nino->ni_stat; - } if (fd < 0 || mask & (SETATTR_MTIME|SETATTR_ATIME)) { if (!pno) return -EEXIST; @@ -787,7 +763,7 @@ native_inop_setattr(struct pnode *pno, /* * Get current status for undo. */ - err = native_stat(path, ino, stbp); + err = native_stat(path, ino, NULL); if (err) goto out; @@ -797,7 +773,7 @@ native_inop_setattr(struct pnode *pno, /* * Alter permissions attribute. */ - mode = stbuf->st_mode & 07777; + mode = stat->st_mode & 07777; err = fd < 0 ? syscall(SYSIO_SYS_chmod, path, mode) @@ -813,12 +789,12 @@ native_inop_setattr(struct pnode *pno, /* * Alter access and/or modify time attributes. */ - ut.actime = stbuf->st_atime; - ut.modtime = stbuf->st_mtime; + ut.actime = stat->st_atime; + ut.modtime = stat->st_mtime; if (mask & SETATTR_MTIME) - ut.modtime = stbuf->st_mtime; + ut.modtime = stat->st_mtime; if (mask & SETATTR_ATIME) - ut.actime = stbuf->st_atime; + ut.actime = stat->st_atime; err = syscall(SYSIO_SYS_utime, path, &ut); if (err) err = -errno; @@ -835,18 +811,18 @@ native_inop_setattr(struct pnode *pno, ? syscall(SYSIO_SYS_chown, path, mask & SETATTR_UID - ? stbuf->st_uid + ? stat->st_uid : (uid_t )-1, mask & SETATTR_GID - ? stbuf->st_gid + ? stat->st_gid : (gid_t )-1) : syscall(SYSIO_SYS_fchown, fd, mask & SETATTR_UID - ? stbuf->st_uid + ? stat->st_uid : (uid_t )-1, mask & SETATTR_GID - ? stbuf->st_gid + ? stat->st_gid : (gid_t )-1); if (err) err = -errno; @@ -858,8 +834,8 @@ native_inop_setattr(struct pnode *pno, * Do the truncate last. It can't be undone. */ (void )(fd < 0 - ? syscall(SYSIO_SYS_truncate, path, stbuf->st_size) - : syscall(SYSIO_SYS_ftruncate, fd, stbuf->st_size)); + ? syscall(SYSIO_SYS_truncate, path, stat->st_size) + : syscall(SYSIO_SYS_ftruncate, fd, stat->st_size)); } if (!err) goto out; @@ -872,37 +848,37 @@ native_inop_setattr(struct pnode *pno, ? syscall(SYSIO_SYS_chown, path, mask & SETATTR_UID - ? stbp->st_uid + ? ino->i_stbuf.st_uid : (uid_t )-1, mask & SETATTR_GID - ? stbp->st_gid + ? ino->i_stbuf.st_gid : (gid_t )-1) : syscall(SYSIO_SYS_fchown, fd, mask & SETATTR_UID - ? stbp->st_uid + ? ino->i_stbuf.st_uid : (uid_t )-1, mask & SETATTR_GID - ? stbp->st_gid + ? ino->i_stbuf.st_gid : (gid_t )-1)); } if (mask & (SETATTR_MTIME|SETATTR_ATIME)) { struct utimbuf ut; - ut.actime = stbp->st_atime; - ut.modtime = stbp->st_mtime; + ut.actime = ino->i_stbuf.st_atime; + ut.modtime = ino->i_stbuf.st_mtime; (void )syscall(SYSIO_SYS_utime, path, &ut); } if (mask & SETATTR_MODE) { fd < 0 - ? syscall(SYSIO_SYS_chmod, path, stbp->st_mode & 07777) - : syscall(SYSIO_SYS_fchmod, stbp->st_mode & 07777); + ? syscall(SYSIO_SYS_chmod, path, ino->i_stbuf.st_mode & 07777) + : syscall(SYSIO_SYS_fchmod, ino->i_stbuf.st_mode & 07777); } out: /* * We must refresh the cached attributes on success. */ - if (!err && native_stat(path, ino, stbp) != 0) + if (!err && native_stat(path, ino, NULL) != 0) abort(); if (path) free(path); |
From: Lee W. <lw...@us...> - 2004-09-23 17:10:30
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24231/drivers/yod Modified Files: Tag: defer-cwd fs_yod.c Log Message: The head brnach had been updated to carry the full attributes around in the inode, directly. Need to change the way we cache in the native driver, then. Merged the head in to get the relevant changes. Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.18 retrieving revision 1.18.2.1 diff -u -w -b -B -p -r1.18 -r1.18.2.1 --- fs_yod.c 30 Aug 2004 15:58:00 -0000 1.18 +++ fs_yod.c 23 Sep 2004 17:09:48 -0000 1.18.2.1 @@ -307,11 +307,7 @@ yod_i_new(struct filesys *fs, struct int ino = _sysio_i_new(fs, &nino->ni_fileid, -#ifndef AUTOMOUNT_FILE_NAME - buf->st_mode & S_IFMT, -#else buf->st_mode, /* all of the bits! */ -#endif 0, 0, &yod_i_ops, |
From: Lee W. <lw...@us...> - 2004-09-23 17:10:26
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24231/dev/stdfd Modified Files: Tag: defer-cwd stdfd.c Log Message: The head brnach had been updated to carry the full attributes around in the inode, directly. Need to change the way we cache in the native driver, then. Merged the head in to get the relevant changes. Index: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.10.2.1 retrieving revision 1.10.2.2 diff -u -w -b -B -p -r1.10.2.1 -r1.10.2.2 --- stdfd.c 23 Sep 2004 16:51:16 -0000 1.10.2.1 +++ stdfd.c 23 Sep 2004 17:09:46 -0000 1.10.2.2 @@ -46,9 +46,12 @@ #endif #include <errno.h> +#include <stdarg.h> #include <sys/syscall.h> #include <unistd.h> +#include <fcntl.h> #include <sys/types.h> +#include <sys/stat.h> #include <sys/queue.h> #include "xtio.h" @@ -151,10 +154,13 @@ stdfd_read_simple(void *buf, _SYSIO_OFF_T off __IS_UNUSED, struct inode *ino) { + int fd = SYSIO_MINOR_DEV(ino->i_stbuf.st_rdev); + int cc; - int fd = SYSIO_MINOR_DEV(ino->i_rdev); - - return doread(fd, buf, nbytes); + cc = doread(fd, buf, nbytes); + if (cc < 0) + cc = -errno; + return cc; } static int @@ -170,9 +176,13 @@ stdfd_write_simple(const void *buf, _SYSIO_OFF_T off __IS_UNUSED, struct inode *ino) { - int fd = SYSIO_MINOR_DEV(ino->i_rdev); + int fd = SYSIO_MINOR_DEV(ino->i_stbuf.st_rdev); + int cc; - return dowrite(fd, buf, nbytes); + cc = dowrite(fd, buf, nbytes); + if (cc < 0) + cc = -errno; + return cc; } static int @@ -198,14 +208,34 @@ stdfd_iodone(struct ioctx *iocp __IS_UNU } static int -stdfd_fcntl(struct inode *ino __IS_UNUSED, - int cmd __IS_UNUSED, - va_list ap __IS_UNUSED, +stdfd_fcntl(struct inode *ino, + int cmd, + va_list ap, int *rtn) { - + int err; + int fd = SYSIO_MINOR_DEV(ino->i_stbuf.st_rdev); + long arg; + + err = 0; + switch (cmd) { + case F_GETFL: + *rtn = syscall(SYS_fcntl, fd, cmd); + if (*rtn == -1) + err = -errno; + break; + case F_SETFL: + arg = va_arg(ap, long); + *rtn = syscall(SYS_fcntl, fd, cmd, arg); + if (*rtn == -1) + err = -errno; + va_end(ap); + break; + default: *rtn = -1; - return -EINVAL; + err = -EINVAL; + } + return err; } static int |
From: Lee W. <lw...@us...> - 2004-09-23 16:51:45
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19517/include Modified Files: Tag: defer-cwd sysio.h Added Files: Tag: defer-cwd native.h Log Message: Now, wrap all syscalls. Including .../include/native.h will deliver the _sysio_native_stat structure -- used to be __native_stat -- and all syscalls for internals use. These will be the proper calls for a build with or without _LARGEFILE64_SOURCE, Alpha, etc. We were having some problems with inconsitent/incorrect use. --- 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-2004 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... */ /* * Native file system support. */ #if ALPHA_LINUX /* * stat struct from asm/stat.h, as returned * by alpha linux kernel */ struct _sysio_native_stat { unsigned int st_dev; unsigned int st_ino; unsigned int st_mode; unsigned int st_nlink; unsigned int st_uid; unsigned int st_gid; unsigned int st_rdev; long st_size; unsigned long st_atime; unsigned long st_mtime; unsigned long st_ctime; unsigned int st_blksize; int st_blocks; unsigned int st_flags; unsigned int st_gen; }; #define SYSIO_COPY_STAT(src, dest) \ do { \ memset((dest), 0, sizeof((*dest))); \ (dest)->st_dev = (src)->st_dev; \ (dest)->st_ino = (src)->st_ino; \ (dest)->st_mode = (src)->st_mode; \ (dest)->st_nlink = (src)->st_nlink; \ (dest)->st_uid = (src)->st_uid; \ (dest)->st_gid = (src)->st_gid; \ (dest)->st_rdev = (src)->st_rdev; \ (dest)->st_size = (src)->st_size; \ (dest)->st_atime = (src)->st_atime; \ (dest)->st_mtime = (src)->st_mtime; \ (dest)->st_ctime = (src)->st_ctime; \ (dest)->st_blksize = (src)->st_blksize; \ (dest)->st_blocks = (src)->st_blocks; \ (dest)->st_flags = (src)->st_flags; \ (dest)->st_gen = (src)->st_gen; \ } while (0); #else #define _sysio_native_stat intnl_stat #define SYSIO_COPY_STAT(src, dest) *(dest) = *(src) #endif /* * System calls. */ #if _LARGEFILE64_SOURCE && defined(SYS_lstat64) #define SYSIO_SYS_stat SYS_lstat64 #elif defined(SYS_lstat) #define SYSIO_SYS_stat SYS_lstat #endif #if _LARGEFILE64_SOURCE && defined(SYS_fstat64) #define SYSIO_SYS_fstat SYS_fstat64 #elif defined(SYS_fstat) #define SYSIO_SYS_fstat SYS_fstat #endif #if _LARGEFILE64_SOURCE && defined(SYS_truncate64) #define SYSIO_SYS_truncate SYS_truncate64 #elif defined(SYS_truncate) #define SYSIO_SYS_truncate SYS_truncate #endif #if _LARGEFILE64_SOURCE && defined(SYS_ftruncate64) #define SYSIO_SYS_ftruncate SYS_ftruncate64 #elif defined(SYS_ftruncate) #define SYSIO_SYS_ftruncate SYS_ftruncate #endif #if defined(SYS_open) #define SYSIO_SYS_open SYS_open #endif #if defined(SYS_close) #define SYSIO_SYS_close SYS_close #endif #if _LARGEFILE64_SOURCE && defined(SYS_lseek64) #define SYSIO_SYS_lseek SYS_lseek64 #elif defined(SYS_lseek) #define SYSIO_SYS_lseek SYS_lseek #endif #if defined(SYS_read) #define SYSIO_SYS_read SYS_read #endif #if defined(SYS_write) #define SYSIO_SYS_write SYS_write #endif #if defined(SYS_readv) #define SYSIO_SYS_readv SYS_readv #endif #if defined(SYS_writev) #define SYSIO_SYS_writev SYS_writev #endif #if _LARGEFILE64_SOURCE && defined(SYS_pread64) #define SYSIO_SYS_pread SYS_pread64 #elif defined(SYS_pread) #define SYSIO_SYS_pread SYS_pread #endif #if _LARGEFILE64_SOURCE && defined(SYS_pwrite64) #define SYSIO_SYS_pwrite SYS_pwrite64 #elif defined(SYS_pwrite) #define SYSIO_SYS_pread SYS_pwrite #endif #if _LARGEFILE64_SOURCE && defined(SYS_fcntl64) #define SYSIO_SYS_fcntl SYS_fcntl64 #elif defined(SYS_fcntl) #define SYSIO_SYS_fcntl SYS_fcntl #endif #if defined(SYS_fsync) #define SYSIO_SYS_fsync SYS_fsync #endif #if ALPHA_LINUX && defined(SYS_osf_fdatasync) #define SYSIO_SYS_fdatasync SYS_osf_fdatasync #elif defined(SYS_fdatasync) #define SYSIO_SYS_fdatasync SYS_fdatasync #endif #if defined(SYS_chmod) #define SYSIO_SYS_chmod SYS_chmod #endif #if defined(SYS_fchmod) #define SYSIO_SYS_fchmod SYS_fchmod #endif #if defined(SYS_chown) #define SYSIO_SYS_chown SYS_chown #endif #if defined(SYS_fchown) #define SYSIO_SYS_fchown SYS_fchown #endif #if defined(SYS_umask) #define SYSIO_SYS_umask SYS_umask #endif #if defined(SYS_mkdir) #define SYSIO_SYS_mkdir SYS_mkdir #endif #if defined(SYS_rmdir) #define SYSIO_SYS_rmdir SYS_rmdir #endif #if defined(SYS_getdirentries) #if _LARGEFILE64_SOURCE && defined(SYS_getdirentries64) #define SYSIO_SYS_getdirentries SYS_getdirentries64 #elif defined(SYS_getdirentries) #define SYSIO_SYS_getdirentries SYS_getdirentries #endif #endif #if _LARGEFILE64_SOURCE && defined(SYS_getdents64) #define SYSIO_SYS_getdents SYS_getdents64 #elif defined(SYS_getdents) #define SYSIO_SYS_getdents SYS_getdents #endif #if defined(SYS_link) #define SYSIO_SYS_link SYS_link #endif #if defined(SYS_unlink) #define SYSIO_SYS_unlink SYS_unlink #endif #if defined(SYS_symlink) #define SYSIO_SYS_symlink SYS_symlink #endif #if defined(SYS_rename) #define SYSIO_SYS_rename SYS_rename #endif #if defined(SYS_readlink) #define SYSIO_SYS_readlink SYS_readlink #endif #if defined(SYS_utimes) #define SYSIO_SYS_utimes SYS_utimes #endif #if defined(SYS_utime) #define SYSIO_SYS_utime SYS_utime #endif #if defined(SYS_socketcall) #define SYSIO_SYS_socketcall SYS_socketcall #endif #if defined(SYS_socket) #define SYSIO_SYS_socket SYS_socket #endif Index: sysio.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio.h,v retrieving revision 1.26.2.1 retrieving revision 1.26.2.2 diff -u -w -b -B -p -r1.26.2.1 -r1.26.2.2 --- sysio.h 12 Sep 2004 04:41:44 -0000 1.26.2.1 +++ sysio.h 23 Sep 2004 16:51:17 -0000 1.26.2.2 @@ -329,7 +329,7 @@ extern int SYSIO_INTERFACE_NAME(umount)( return (rtn); \ } while(0) -/* syscall enter/leave hook functions */ +/* Interface enter/leave hook functions */ #if 0 extern void _sysio_sysenter(); extern void _sysio_sysleave(); |