Thread: [Libsysio-commit] HEAD: libsysio/drivers/native fs_native.c (Page 2)
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2004-04-27 06:33:31
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16048 Modified Files: fs_native.c Log Message: Fix a bug in getdirentries. Found by inspection after a conversation about a similar bug in glibc. The content of *basep was not updated after a successful call. Also, streamlined native_filldirentries a bit. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -w -b -B -p -r1.36 -r1.37 --- fs_native.c 17 Apr 2004 21:15:03 -0000 1.36 +++ fs_native.c 27 Apr 2004 06:33:22 -0000 1.37 @@ -917,9 +917,7 @@ native_filldirentries(struct native_inod size_t nbytes, _SYSIO_OFF_T *basep) { -#if !DIR_STREAMED - _SYSIO_OFF_T result; -#endif + int err; ssize_t cc; if (*basep < 0) @@ -930,17 +928,13 @@ native_filldirentries(struct native_inod * Stream-oriented access requires that we reposition prior to the * fill call. */ - result = *basep; - if (*basep != nino->ni_fpos && - (cc = native_pos(nino->ni_fd, &result, SEEK_SET)) != 0) - return cc; - nino->ni_fpos = result; -#else - nino->ni_fpos = *basep; + if ((err = native_pos(nino->ni_fd, basep, SEEK_SET)) != 0) + return err; #endif + nino->ni_fpos = *basep; -#if defined(SYS_getdirentries) cc = +#if defined(SYS_getdirentries) syscall(SYS_getdirentries, nino->ni_fd, buf, @@ -948,14 +942,23 @@ native_filldirentries(struct native_inod basep, &nino->ni_fpos); #elif defined(SYS_getdents64) - cc = syscall(SYS_getdents64, nino->ni_fd, buf, nbytes); + syscall(SYS_getdents64, nino->ni_fd, buf, nbytes); #elif defined(SYS_getdents) - cc = syscall(SYS_getdents, nino->ni_fd, buf, nbytes); + syscall(SYS_getdents, nino->ni_fd, buf, nbytes); #endif if (cc < 0) return -errno; - nino->ni_fpos += cc; +#if !DIR_STREAMED + /* + * Stream-oriented access requires that we discover where we are + * after the call. + */ + *basep = 0; + if ((err = native_pos(nino->ni_fd, basep, SEEK_CUR)) != 0) + return err; +#endif + nino->ni_fpos = *basep; return cc; } |
From: Lee W. <lw...@us...> - 2004-05-25 17:53:52
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19311/drivers/native Modified Files: fs_native.c Log Message: +Changes for Red Storm from Kevin Pedretti +Fix in fs_native.c to conditionally compile DIR_STREAMED code properly. We were always including it -- Even when using getdirentries. Oops. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -w -b -B -p -r1.37 -r1.38 --- fs_native.c 27 Apr 2004 06:33:22 -0000 1.37 +++ fs_native.c 25 May 2004 17:53:43 -0000 1.38 @@ -86,10 +86,10 @@ #define DIR_STREAMED 0 #define DIR_CVT_64 0 #elif defined(SYS_getdents64) -#define DIR_STREAMED 0 +#define DIR_STREAMED 1 #define DIR_CVT_64 0 #elif defined(SYS_getdents) -#define DIR_STREAMED 0 +#define DIR_STREAMED 1 #if defined(_LARGEFILE64_SOURCE) #define DIR_CVT_64 1 /* @@ -923,7 +921,7 @@ native_filldirentries(struct native_inod if (*basep < 0) return -EINVAL; -#if !DIR_STREAMED +#if DIR_STREAMED /* * Stream-oriented access requires that we reposition prior to the * fill call. @@ -939,8 +937,7 @@ native_filldirentries(struct native_inod nino->ni_fd, buf, nbytes, - basep, - &nino->ni_fpos); + basep); #elif defined(SYS_getdents64) syscall(SYS_getdents64, nino->ni_fd, buf, nbytes); #elif defined(SYS_getdents) @@ -949,7 +946,7 @@ native_filldirentries(struct native_inod if (cc < 0) return -errno; -#if !DIR_STREAMED +#if DIR_STREAMED /* * Stream-oriented access requires that we discover where we are * after the call. |
From: Lee W. <lw...@us...> - 2004-07-03 05:47:21
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11075/drivers/native Modified Files: fs_native.c Log Message: A new, major change, to .../include/xtio.h. This is intended to be the include file for applications. It prototype all of the extended API available as well as the necessary structures. Other shanges to support this. We now need it most everywhere to build the library as well. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -w -b -B -p -r1.38 -r1.39 --- fs_native.c 25 May 2004 17:53:43 -0000 1.38 +++ fs_native.c 3 Jul 2004 05:47:12 -0000 1.39 @@ -51,6 +51,9 @@ #include <string.h> #endif #include <unistd.h> +#if !(defined(REDSTORM) || defined(MAX_IOVEC)) +#include <limits.h> +#endif #include <errno.h> #include <assert.h> #include <syscall.h> @@ -65,16 +68,14 @@ #include <sys/statfs.h> #endif #include <utime.h> +#include <sys/uio.h> #include <sys/queue.h> -#if !(defined(REDSTORM) || defined(MAX_IOVEC)) -#include <limits.h> -#endif +#include "xtio.h" #include "sysio.h" #include "fs.h" #include "mount.h" #include "inode.h" -#include "xtio.h" #include "fs_native.h" |
From: Ruth K. <rk...@us...> - 2004-07-16 20:10:16
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25589 Modified Files: fs_native.c Log Message: native_inop_fcntl missing breaks in switch Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -w -b -B -p -r1.39 -r1.40 --- fs_native.c 3 Jul 2004 05:47:12 -0000 1.39 +++ fs_native.c 16 Jul 2004 20:10:07 -0000 1.40 @@ -1582,6 +1582,7 @@ native_inop_fcntl(struct inode *ino, err = syscall(SYS_fcntl, nino->ni_fd, cmd); if (err < 0) err = -errno; + break; case F_DUPFD: case F_SETFD: case F_SETFL: @@ -1593,6 +1594,7 @@ native_inop_fcntl(struct inode *ino, err = syscall(SYS_fcntl, nino->ni_fd, cmd, arg); if (err) err = -errno; + break; default: err = -EINVAL; } |
From: Sonja T. <so...@us...> - 2004-07-21 21:22:32
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv514/drivers/native Modified Files: fs_native.c Log Message: Fixing bugs to do with device files. Now, you cant open devices that do not have an associated driver. Also, you can now do an fstat() on a device Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -w -b -B -p -r1.40 -r1.41 --- fs_native.c 16 Jul 2004 20:10:07 -0000 1.40 +++ fs_native.c 21 Jul 2004 21:22:23 -0000 1.41 @@ -210,6 +210,7 @@ struct native_inode { int ni_oflags; /* flags, from open */ unsigned ni_nopens; /* soft ref count */ _SYSIO_OFF_T ni_fpos; /* current pos */ + struct __native_stat *ni_stat; /* cached copy of the stat */ }; /* @@ -328,15 +329,14 @@ static struct mount *native_internal_mou * stat -- by path. */ static int -native_stat(const char *path, struct intnl_stat *buf) +native_stat(const char *path, struct intnl_stat *buf, struct __native_stat *stbuf) { int err; - struct __native_stat stbuf; - err = syscall(__SYS_STAT, path, &stbuf); + err = syscall(__SYS_STAT, path, stbuf); if (err) err = -errno; - COPY_STAT(&stbuf, buf); + COPY_STAT(stbuf, buf); return err; } @@ -345,15 +345,14 @@ native_stat(const char *path, struct int * stat -- by fildes */ static int -native_fstat(int fd, struct intnl_stat *buf) +native_fstat(int fd, struct intnl_stat *buf, struct __native_stat *stbuf) { int err; - struct __native_stat stbuf; - err = syscall(__SYS_FSTAT, fd, &stbuf); + err = syscall(__SYS_FSTAT, fd, stbuf); if (err) err = -errno; - COPY_STAT(&stbuf, buf); + COPY_STAT(stbuf, buf); return err; } @@ -382,6 +381,7 @@ native_i_new(struct filesys *fs, struct nino->ni_oflags = 0; nino->ni_nopens = 0; nino->ni_fpos = 0; + nino->ni_stat = NULL; ino = _sysio_i_new(fs, &nino->ni_fileid, @@ -390,7 +390,7 @@ native_i_new(struct filesys *fs, struct #else buf->st_mode, /* all of the bits! */ #endif - 0, + buf->st_rdev, 0, &native_i_ops, nino); @@ -429,6 +429,8 @@ create_internal_namespace() static struct qstr noname = { NULL, 0, 0 }; struct filesys *fs; struct intnl_stat stbuf; + struct __native_stat *ni_stat; + if (native_internal_mount) { /* @@ -437,6 +439,8 @@ create_internal_namespace() abort(); } + ni_stat = (struct __native_stat *)malloc(sizeof(struct __native_stat)); + /* * We maintain an artificial, internal, name space in order to * have access to fully qualified path names in the various routines. @@ -454,7 +458,7 @@ create_internal_namespace() /* * Get root i-node. */ - err = native_stat("/", &stbuf); + err = native_stat("/", &stbuf, ni_stat); if (err) goto error; rootino = native_i_new(fs, &stbuf); @@ -462,6 +466,7 @@ create_internal_namespace() err = -ENOMEM; goto error; } + I2NI(rootino)->ni_stat = ni_stat; /* * Generate base path-node for root. @@ -593,11 +598,14 @@ native_iget(struct filesys *fs, struct intnl_stat stbuf; struct native_inode_identifier ident; struct file_identifier fileid; + struct __native_stat *ni_stat; + + ni_stat = (struct __native_stat *)malloc(sizeof(struct __native_stat)); /* * Get file status. */ - err = native_stat(path, &stbuf); + err = native_stat(path, &stbuf, ni_stat); if (err) { *inop = NULL; return err; @@ -653,6 +661,7 @@ native_iget(struct filesys *fs, out: if (!err) *inop = ino; + I2NI(ino)->ni_stat = ni_stat; return err; } @@ -714,19 +723,31 @@ native_inop_getattr(struct pnode *pno, s { char *path; int err; + struct __native_stat *ni_stat; path = NULL; + ni_stat = (struct __native_stat *)malloc(sizeof(struct __native_stat)); if (!ino || I2NI(ino)->ni_fd < 0) { + if (pno) path = _sysio_pb_path(pno->p_base, '/'); + else if (ino) { + COPY_STAT(I2NI(ino)->ni_stat, stbuf); + return 0; + } if (!path) return -ENOMEM; + /* if no pno, copy stat and return success */ } err = path - ? native_stat(path, stbuf) - : native_fstat(I2NI(ino)->ni_fd, stbuf); + ? native_stat(path, stbuf, ni_stat) + : native_fstat(I2NI(ino)->ni_fd, stbuf, ni_stat); if (path) free(path); + + /* Cache a copy of the stat */ + I2NI(ino)->ni_stat = ni_stat; + return err; } @@ -739,6 +760,7 @@ native_inop_setattr(struct pnode *pno, char *path; int fd; struct intnl_stat st; + struct __native_stat *ni_stat; int err; path = NULL; @@ -754,10 +776,14 @@ native_inop_setattr(struct pnode *pno, /* * Get current status for undo. */ + ni_stat = (struct __native_stat *)malloc(sizeof(struct __native_stat)); err = fd < 0 - ? native_stat(path, &st) - : native_fstat(fd, &st); + ? native_stat(path, &st, ni_stat) + : native_fstat(fd, &st, ni_stat); + if (ino) + I2NI(ino)->ni_stat = ni_stat; + if (err) goto out; @@ -1711,6 +1737,10 @@ native_inop_gone(struct inode *ino) if (nino->ni_fd >= 0) (void )syscall(SYS_close, nino->ni_fd); + + if (nino->ni_stat) + free(nino->ni_stat); + free(ino->i_private); } |
From: Lee W. <lw...@us...> - 2004-07-23 15:12:11
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26760 Modified Files: fs_native.c Log Message: Previous checkin introduced a memory leak -- Altered the implementation so that an additional malloc was unnecessary. Also, localized the cache refresh so that it was done whenever a stat was done, enpassant. Couldn't convince myself it was always updated before. Just too stupid to see that I suppose. While testing these changes, a new bug appeared. Under SuSE linux 9.1 with a 2.6.5-7.95 kernel, the /proc file system can have different objects with the same i-number! Ouch! The native driver assumed such a thing would *never* happen. It does not make this assumption anymore. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -w -b -B -p -r1.41 -r1.42 --- fs_native.c 21 Jul 2004 21:22:23 -0000 1.41 +++ fs_native.c 23 Jul 2004 15:11:57 -0000 1.42 @@ -210,7 +210,7 @@ struct native_inode { int ni_oflags; /* flags, from open */ unsigned ni_nopens; /* soft ref count */ _SYSIO_OFF_T ni_fpos; /* current pos */ - struct __native_stat *ni_stat; /* cached copy of the stat */ + struct intnl_stat ni_stat; /* cached attrs */ }; /* @@ -329,15 +329,25 @@ static struct mount *native_internal_mou * stat -- by path. */ static int -native_stat(const char *path, struct intnl_stat *buf, struct __native_stat *stbuf) +native_stat(const char *path, struct native_inode *nino, struct intnl_stat *buf) { int err; + struct __native_stat stbuf; - err = syscall(__SYS_STAT, path, stbuf); - if (err) + err = syscall(__SYS_STAT, path, &stbuf); + if (err) { err = -errno; - COPY_STAT(stbuf, buf); + goto out; + } + if (!nino) { + COPY_STAT(&stbuf, buf); + goto out; + } + COPY_STAT(&stbuf, &nino->ni_stat); + if (&nino->ni_stat != buf) + (void )memcpy(buf, &nino->ni_stat, sizeof(struct intnl_stat)); +out: return err; } @@ -345,15 +355,25 @@ native_stat(const char *path, struct int * stat -- by fildes */ static int -native_fstat(int fd, struct intnl_stat *buf, struct __native_stat *stbuf) +native_fstat(int fd, struct native_inode *nino, struct intnl_stat *buf) { int err; + struct __native_stat stbuf; - err = syscall(__SYS_FSTAT, fd, stbuf); - if (err) + err = syscall(__SYS_FSTAT, fd, &stbuf); + if (err) { err = -errno; - COPY_STAT(stbuf, buf); + goto out; + } + if (!nino) { + COPY_STAT(&stbuf, buf); + goto out; + } + COPY_STAT(&stbuf, &nino->ni_stat); + if (&nino->ni_stat != buf) + (void )memcpy(buf, &nino->ni_stat, sizeof(struct intnl_stat)); +out: return err; } @@ -381,7 +401,7 @@ native_i_new(struct filesys *fs, struct nino->ni_oflags = 0; nino->ni_nopens = 0; nino->ni_fpos = 0; - nino->ni_stat = NULL; + (void )memcpy(&nino->ni_stat, buf, sizeof(struct intnl_stat)); ino = _sysio_i_new(fs, &nino->ni_fileid, @@ -429,8 +449,6 @@ create_internal_namespace() static struct qstr noname = { NULL, 0, 0 }; struct filesys *fs; struct intnl_stat stbuf; - struct __native_stat *ni_stat; - if (native_internal_mount) { /* @@ -439,8 +457,6 @@ create_internal_namespace() abort(); } - ni_stat = (struct __native_stat *)malloc(sizeof(struct __native_stat)); - /* * We maintain an artificial, internal, name space in order to * have access to fully qualified path names in the various routines. @@ -458,7 +474,7 @@ create_internal_namespace() /* * Get root i-node. */ - err = native_stat("/", &stbuf, ni_stat); + err = native_stat("/", NULL, &stbuf); if (err) goto error; rootino = native_i_new(fs, &stbuf); @@ -466,7 +482,6 @@ create_internal_namespace() err = -ENOMEM; goto error; } - I2NI(rootino)->ni_stat = ni_stat; /* * Generate base path-node for root. @@ -598,14 +613,11 @@ native_iget(struct filesys *fs, struct intnl_stat stbuf; struct native_inode_identifier ident; struct file_identifier fileid; - struct __native_stat *ni_stat; - - ni_stat = (struct __native_stat *)malloc(sizeof(struct __native_stat)); /* * Get file status. */ - err = native_stat(path, &stbuf, ni_stat); + err = native_stat(path, *inop ? I2NI(*inop) : NULL, &stbuf); if (err) { *inop = NULL; return err; @@ -635,9 +647,10 @@ native_iget(struct filesys *fs, fileid.fid_data = &ident; fileid.fid_len = sizeof(ident); ino = _sysio_i_find(fs, &fileid); - if (ino && forced) { + if (ino && + (forced || (ino->i_mode & S_IFMT) != (stbuf.st_mode & S_IFMT))) { /* - * Insertion was forced but it's already present! + * Insertion was forced or dup inum but it's already present! */ if (native_i_invalid(ino, stbuf)) { /* @@ -661,7 +674,6 @@ native_iget(struct filesys *fs, out: if (!err) *inop = ino; - I2NI(ino)->ni_stat = ni_stat; return err; } @@ -719,34 +731,35 @@ native_inop_lookup(struct pnode *pno, } static int -native_inop_getattr(struct pnode *pno, struct inode *ino, struct intnl_stat *stbuf) +native_inop_getattr(struct pnode *pno, + struct inode *ino, + struct intnl_stat *stbuf) { char *path; + struct native_inode *nino; int err; - struct __native_stat *ni_stat; - path = NULL; - ni_stat = (struct __native_stat *)malloc(sizeof(struct __native_stat)); - if (!ino || I2NI(ino)->ni_fd < 0) { - if (pno) + nino = ino ? I2NI(ino) : NULL; + err = 0; /* compiler cookie */ + if (!ino) { path = _sysio_pb_path(pno->p_base, '/'); - else if (ino) { - COPY_STAT(I2NI(ino)->ni_stat, stbuf); - return 0; - } if (!path) return -ENOMEM; - /* if no pno, copy stat and return success */ - } - err = - path - ? native_stat(path, stbuf, ni_stat) - : native_fstat(I2NI(ino)->ni_fd, stbuf, ni_stat); - if (path) + err = native_stat(path, nino, stbuf); free(path); - - /* Cache a copy of the stat */ - I2NI(ino)->ni_stat = ni_stat; + } else if (nino->ni_fd >= 0) + err = native_fstat(nino->ni_fd, nino, stbuf); + 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, + sizeof(struct intnl_stat)); + err = 0; + } return err; } @@ -758,13 +771,19 @@ native_inop_setattr(struct pnode *pno, struct intnl_stat *stbuf) { char *path; + struct native_inode *nino; int fd; - struct intnl_stat st; - struct __native_stat *ni_stat; + struct intnl_stat *stbp, _stbuf; int err; path = NULL; - fd = ino ? I2NI(ino)->ni_fd : -1; + nino = ino ? I2NI(ino) : NULL; + fd = -1; + stbp = &_stbuf; + if (nino) { + fd = nino->ni_fd; + stbp = &nino->ni_stat; + } if (fd < 0 || mask & (SETATTR_MTIME|SETATTR_ATIME)) { if (!pno) return -EEXIST; @@ -776,14 +795,10 @@ native_inop_setattr(struct pnode *pno, /* * Get current status for undo. */ - ni_stat = (struct __native_stat *)malloc(sizeof(struct __native_stat)); err = fd < 0 - ? native_stat(path, &st, ni_stat) - : native_fstat(fd, &st, ni_stat); - if (ino) - I2NI(ino)->ni_stat = ni_stat; - + ? native_stat(path, nino, stbp) + : native_fstat(fd, nino, stbp); if (err) goto out; @@ -809,8 +824,8 @@ native_inop_setattr(struct pnode *pno, /* * Alter access and/or modify time attributes. */ - ut.actime = st.st_atime; - ut.modtime = st.st_mtime; + ut.actime = stbuf->st_atime; + ut.modtime = stbuf->st_mtime; if (mask & SETATTR_MTIME) ut.modtime = stbuf->st_mtime; if (mask & SETATTR_ATIME) @@ -868,33 +883,40 @@ native_inop_setattr(struct pnode *pno, ? syscall(SYS_chown, path, mask & SETATTR_UID - ? st.st_uid + ? stbp->st_uid : (uid_t )-1, mask & SETATTR_GID - ? st.st_gid + ? stbp->st_gid : (gid_t )-1) : syscall(SYS_fchown, fd, mask & SETATTR_UID - ? st.st_uid + ? stbp->st_uid : (uid_t )-1, mask & SETATTR_GID - ? st.st_gid + ? stbp->st_gid : (gid_t )-1)); } if (mask & (SETATTR_MTIME|SETATTR_ATIME)) { struct utimbuf ut; - ut.actime = st.st_atime; - ut.modtime = st.st_mtime; + ut.actime = stbp->st_atime; + ut.modtime = stbp->st_mtime; (void )syscall(__SYS_UTIME, path, &ut); } if (mask & SETATTR_MODE) { fd < 0 - ? syscall(SYS_chmod, path, st.st_mode & 07777) - : syscall(SYS_fchmod, fd, st.st_mode & 07777); + ? syscall(SYS_chmod, path, stbp->st_mode & 07777) + : syscall(SYS_fchmod, stbp->st_mode & 07777); } out: + /* + * We must refresh the cached attributes on success. + */ + if (!err && (fd < 0 + ? native_stat(path, nino, stbp) + : native_fstat(fd, nino, stbp)) != 0) + abort(); if (path) free(path); return err; @@ -1738,9 +1760,6 @@ native_inop_gone(struct inode *ino) if (nino->ni_fd >= 0) (void )syscall(SYS_close, nino->ni_fd); - if (nino->ni_stat) - free(nino->ni_stat); - free(ino->i_private); } |
From: Ruth K. <rk...@us...> - 2004-07-26 16:38:09
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10551/drivers/native Modified Files: fs_native.c Log Message: fcntl fixes: fcntl may return a positive or negative value. Driver function interfaces have been changed to accomodate a returned system call value in the arguments. The return value of the driver functions is 0 for success and -errno for failure. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -w -b -B -p -r1.42 -r1.43 --- fs_native.c 23 Jul 2004 15:11:57 -0000 1.42 +++ fs_native.c 26 Jul 2004 16:37:59 -0000 1.43 @@ -249,7 +249,7 @@ static int native_inop_read(struct inode 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_iodone(struct ioctx *ioctx); -static int native_inop_fcntl(struct inode *ino, int cmd, va_list ap); +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, @@ -1614,7 +1614,8 @@ native_inop_iodone(struct ioctx *ioctxp static int native_inop_fcntl(struct inode *ino, int cmd, - va_list ap) + va_list ap, + int *rtn) { struct native_inode *nino = I2NI(ino); long arg; @@ -1623,12 +1624,15 @@ native_inop_fcntl(struct inode *ino, if (nino->ni_fd < 0) abort(); + err = 0; switch (cmd) { case F_GETFD: case F_GETFL: +#ifdef F_GETOWN case F_GETOWN: - err = syscall(SYS_fcntl, nino->ni_fd, cmd); - if (err < 0) +#endif + *rtn = syscall(SYS_fcntl, nino->ni_fd, cmd); + if (*rtn == -1) err = -errno; break; case F_DUPFD: @@ -1637,13 +1641,16 @@ native_inop_fcntl(struct inode *ino, case F_GETLK: case F_SETLK: case F_SETLKW: +#ifdef F_SETOWN case F_SETOWN: +#endif arg = va_arg(ap, long); - err = syscall(SYS_fcntl, nino->ni_fd, cmd, arg); - if (err) + *rtn = syscall(SYS_fcntl, nino->ni_fd, cmd, arg); + if (*rtn == -1) err = -errno; break; default: + *rtn = -1; err = -EINVAL; } return err; |
From: MeiJia <me...@us...> - 2004-08-05 18:30:08
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25758/drivers/native Modified Files: fs_native.c Log Message: lustre hacking specific code: add ioctl support in socket/native driver. not clear how to do with stdfd Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -w -b -B -p -r1.43 -r1.44 --- fs_native.c 26 Jul 2004 16:37:59 -0000 1.43 +++ fs_native.c 5 Aug 2004 18:29:57 -0000 1.44 @@ -1746,6 +1746,25 @@ native_inop_datasync(struct inode *ino) return err; } +#ifdef HAVE_LUSTRE_HACK +static int +native_inop_ioctl(struct inode *ino, + unsigned long int request, + va_list ap) +{ + long arg1, arg2, arg3, arg4; + + assert(I2NI(ino)->ni_fd >= 0); + + arg1 = va_arg(ap, long); + arg2 = va_arg(ap, long); + arg3 = va_arg(ap, long); + arg4 = va_arg(ap, long); + + return syscall(SYS_ioctl, I2NI(ino)->ni_fd, request, + arg1, arg2, arg3, arg4); +} +#else static int native_inop_ioctl(struct inode *ino __IS_UNUSED, unsigned long int request __IS_UNUSED, @@ -1758,6 +1777,7 @@ native_inop_ioctl(struct inode *ino __IS errno = ENOTTY; return -1; } +#endif static void native_inop_gone(struct inode *ino) |
From: Sonja T. <so...@us...> - 2004-08-13 14:40:18
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7514/drivers/native Modified Files: fs_native.c Log Message: Removed definition of MAX_IOVEC from fs_native.c Fixed ireadx to verify the iov_counts and xtv_counts are valid Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -w -b -B -p -r1.44 -r1.45 --- fs_native.c 5 Aug 2004 18:29:57 -0000 1.44 +++ fs_native.c 13 Aug 2004 14:40:09 -0000 1.45 @@ -1398,9 +1398,6 @@ doiov(const struct iovec *iov, { ssize_t cc; -#if !(defined(REDSTORM) || defined(MAX_IOVEC)) -#define MAX_IOVEC INT_MAX -#endif if (count <= 0) return -EINVAL; @@ -1425,7 +1422,11 @@ doiov(const struct iovec *iov, */ cc = #ifndef REDSTORM +#ifdef MAX_IOVEC count <= MAX_IOVEC +#else + count <= INT_MAX +#endif ? syscall(nio->nio_op == 'r' ? SYS_readv : SYS_writev, nio->nio_nino->ni_fd, iov, |
From: Lee W. <le...@sa...> - 2004-08-13 14:46:31
|
This doesn't look right. How about just let it fail on the malloc... Should return ENOMEM, right? That's good enuff. As far as I know, there is no limit in libsysio for the count of the iovec or xtvec. --Lee On Fri, 2004-08-13 at 10:40, Sonja Tideman wrote: > Update of /cvsroot/libsysio/libsysio/drivers/native > In directory > sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7514/drivers/native > > Modified Files: > fs_native.c > Log Message: > Removed definition of MAX_IOVEC from fs_native.c > > Fixed ireadx to verify the iov_counts and xtv_counts are valid > > > Index: fs_native.c > =================================================================== > RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v > retrieving revision 1.44 > retrieving revision 1.45 > diff -u -w -b -B -p -r1.44 -r1.45 > --- fs_native.c 5 Aug 2004 18:29:57 -0000 1.44 > +++ fs_native.c 13 Aug 2004 14:40:09 -0000 1.45 > @@ -1398,9 +1398,6 @@ doiov(const struct iovec *iov, > { > ssize_t cc; > > -#if !(defined(REDSTORM) || defined(MAX_IOVEC)) > -#define MAX_IOVEC INT_MAX > -#endif > > if (count <= 0) > return -EINVAL; > @@ -1425,7 +1422,11 @@ doiov(const struct iovec *iov, > */ > cc = > #ifndef REDSTORM > +#ifdef MAX_IOVEC > count <= MAX_IOVEC > +#else > + count <= INT_MAX > +#endif > ? syscall(nio->nio_op == 'r' ? SYS_readv : SYS_writev, > nio->nio_nino->ni_fd, > iov, > > > > ------------------------------------------------------- > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > _______________________________________________ > Libsysio-commit mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libsysio-commit > |
From: Sonja T. <so...@us...> - 2004-08-13 15:02:59
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11990/drivers/native Modified Files: fs_native.c Log Message: Try 2: take out the MAX_IOVEC references, revert fs_native.c back to its original form (which still has the MAX_IOVEC references, but it defines it and undefines it within one routine...although this still means that someone can define MAX_IOVEC and force the call to _sysio_enumerate_iovec instead of the syscall, but that doesn't place any strict limit on the number of iovecs) Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -w -b -B -p -r1.45 -r1.46 --- fs_native.c 13 Aug 2004 14:40:09 -0000 1.45 +++ fs_native.c 13 Aug 2004 15:02:50 -0000 1.46 @@ -1398,6 +1398,10 @@ doiov(const struct iovec *iov, { ssize_t cc; +#if !(defined(REDSTORM) || defined(MAX_IOVEC)) +#define MAX_IOVEC INT_MAX +#endif + if (count <= 0) return -EINVAL; @@ -1422,11 +1426,7 @@ doiov(const struct iovec *iov, */ cc = #ifndef REDSTORM -#ifdef MAX_IOVEC count <= MAX_IOVEC -#else - count <= INT_MAX -#endif ? syscall(nio->nio_op == 'r' ? SYS_readv : SYS_writev, nio->nio_nino->ni_fd, iov, |
From: Lee W. <le...@sa...> - 2004-08-13 15:27:36
|
Let the lower levels fail. Seriously, as I said, there is *nothing* in SYSIO that requires such a check. --Lee On Fri, 2004-08-13 at 11:02, Sonja Tideman wrote: > Update of /cvsroot/libsysio/libsysio/drivers/native > In directory > sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11990/drivers/native > > Modified Files: > fs_native.c > Log Message: > Try 2: take out the MAX_IOVEC references, revert fs_native.c back to > its > original form (which still has the MAX_IOVEC references, but it > defines > it and undefines it within one routine...although this still means > that > someone can define MAX_IOVEC and force the call to > _sysio_enumerate_iovec > instead of the syscall, but that doesn't place any strict limit on the > number of iovecs) > > > Index: fs_native.c > =================================================================== > RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v > retrieving revision 1.45 > retrieving revision 1.46 > diff -u -w -b -B -p -r1.45 -r1.46 > --- fs_native.c 13 Aug 2004 14:40:09 -0000 1.45 > +++ fs_native.c 13 Aug 2004 15:02:50 -0000 1.46 > @@ -1398,6 +1398,10 @@ doiov(const struct iovec *iov, > { > ssize_t cc; > > +#if !(defined(REDSTORM) || defined(MAX_IOVEC)) > +#define MAX_IOVEC INT_MAX > +#endif > + > > if (count <= 0) > return -EINVAL; > @@ -1422,11 +1426,7 @@ doiov(const struct iovec *iov, > */ > cc = > #ifndef REDSTORM > -#ifdef MAX_IOVEC > count <= MAX_IOVEC > -#else > - count <= INT_MAX > -#endif > ? syscall(nio->nio_op == 'r' ? SYS_readv : SYS_writev, > nio->nio_nino->ni_fd, > iov, > > > > ------------------------------------------------------- > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > _______________________________________________ > Libsysio-commit mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libsysio-commit > |
From: Lee W. <lw...@us...> - 2004-08-25 08:07:54
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14222 Modified Files: fs_native.c Log Message: Why do folks keep screwing up the formatting in the source? Fixed here from the last change. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.46 retrieving revision 1.47 diff -u -w -b -B -p -r1.46 -r1.47 |
From: Ruth K. <rk...@us...> - 2004-09-10 16:43:15
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14110 Modified Files: fs_native.c Log Message: work around for basep brokenness Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.47 retrieving revision 1.48 diff -u -w -b -B -p -r1.47 -r1.48 --- fs_native.c 25 Aug 2004 08:07:45 -0000 1.47 +++ fs_native.c 10 Sep 2004 16:42:39 -0000 1.48 @@ -1022,6 +1022,12 @@ native_getdirentries(struct inode *ino, struct dirent64 *d64p; size_t namlen; size_t reclen; + /* + * Work-around for broken 64 bit basep update + * Get value of basep to return from last directory + * entry d_off value + */ + _SYSIO_OFF_T last_offset = *basep; #else #define bp buf #define count nbytes @@ -1068,12 +1074,15 @@ native_getdirentries(struct inode *ino, cc -= ldp->ld_reclen; ldp = (struct linux_dirent *)((char *)ldp + ldp->ld_reclen); nbytes -= d64p->d_reclen; + last_offset = d64p->d_off; d64p = (struct dirent64 *)((char *)d64p + d64p->d_reclen); } + nino->ni_fpos = *basep = last_offset; free(bp); - if (d64p == (struct dirent64 *)buf && cc) - cc = -EINVAL; /* buf too small */ - cc = (char *)d64p - buf; + cc = + (d64p == (struct dirent64 *)buf && cc) + ? -EINVAL + : (char *)d64p - buf; #else #undef bp #undef count |
From: Lee W. <lw...@us...> - 2004-09-21 16:27:11
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27545 Modified Files: fs_native.c Log Message: From Henry Pierce at Cray; A chdir() to a directory without `x' permission should not succeed but does. This required that inodes now carry the full attributes -- Not just the mode bits. That's a bug change. Driver writers; 1) _sysio_i_new is altered. It needs the full intnl_stat structure now. 2) Your lookup function should refresh the inode attributes. 3) We don't keep an inode dirty bit. Hopefully, you've been pushing changes at the time of the operation instead of waiting until the inode was flushed or somesuch. Maybe you keep an internal dirty bit? Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.48 retrieving revision 1.49 diff -u -w -b -B -p -r1.48 -r1.49 --- fs_native.c 10 Sep 2004 16:42:39 -0000 1.48 +++ fs_native.c 21 Sep 2004 16:26:59 -0000 1.49 @@ -210,7 +210,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 */ }; /* @@ -329,52 +328,34 @@ static struct mount *native_internal_mou * stat -- by path. */ static int -native_stat(const char *path, struct native_inode *nino, struct intnl_stat *buf) +native_stat(const char *path, struct inode *ino, struct intnl_stat *buf) { + struct native_inode *nino; int err; struct __native_stat stbuf; - err = syscall(__SYS_STAT, path, &stbuf); - if (err) { - err = -errno; - goto out; - } - if (!nino) { - COPY_STAT(&stbuf, buf); - goto out; - } - COPY_STAT(&stbuf, &nino->ni_stat); - if (&nino->ni_stat != buf) - (void )memcpy(buf, &nino->ni_stat, sizeof(struct intnl_stat)); - -out: - return err; -} - -/* - * stat -- by fildes - */ -static int -native_fstat(int fd, struct native_inode *nino, struct intnl_stat *buf) -{ - int err; - struct __native_stat stbuf; + nino = ino ? I2NI(ino) : NULL; - err = syscall(__SYS_FSTAT, fd, &stbuf); - if (err) { - err = -errno; - goto out; + if (path) + err = syscall(__SYS_STAT, path, &stbuf); + else if (nino && nino->ni_fd >= 0) + err = syscall(__SYS_FSTAT, nino->ni_fd, &stbuf); + else + abort(); + if (err) + return -errno; + if (nino) { + COPY_STAT(&stbuf, &ino->i_stbuf); + if (buf) + (void )memcpy(buf, + &ino->i_stbuf, + sizeof(struct intnl_stat)); + return 0; } - if (!nino) { + if (!buf) + return 0; COPY_STAT(&stbuf, buf); - goto out; - } - COPY_STAT(&stbuf, &nino->ni_stat); - if (&nino->ni_stat != buf) - (void )memcpy(buf, &nino->ni_stat, sizeof(struct intnl_stat)); - -out: - return err; + return 0; } /* @@ -390,6 +371,7 @@ native_i_new(struct filesys *fs, struct 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 @@ -401,16 +383,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)); 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); @@ -440,7 +416,7 @@ _sysio_native_init() * Create private, internal, view of the hosts name space. */ static int -create_internal_namespace() +create_internal_namespace(const void *data __IS_UNUSED) { int err; struct mount *mnt; @@ -462,6 +438,7 @@ create_internal_namespace() * have access to fully qualified path names in the various routines. * Initialize that name space now. */ + fs = NULL; mnt = NULL; rootino = NULL; rootpb = NULL; @@ -523,7 +500,7 @@ error: static int native_fsswop_mount(const char *source, unsigned flags, - const void *data __IS_UNUSED, + const void *data, struct pnode *tocover, struct mount **mntp) { @@ -539,10 +516,11 @@ native_fsswop_mount(const char *source, return -ENOENT; if (!native_internal_mount) { - err = create_internal_namespace(); + err = create_internal_namespace(data); if (err) return err; - } + } else if (data && *(char *)data) + return -EINVAL; /* * Lookup the source in the internally maintained name space. @@ -578,21 +556,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; @@ -610,24 +589,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. */ - err = native_stat(path, *inop ? I2NI(*inop) : NULL, &stbuf); - if (err) { - *inop = NULL; + if (*inop) + ostbuf = (*inop)->i_stbuf; + err = native_stat(path, *inop, &stbuf); + if (err) return err; - } /* * Validate? */ if (*inop) { - if (!native_i_invalid(*inop, stbuf)) + if (!native_i_invalid(*inop, &ostbuf)) return 0; /* * Invalidate. @@ -648,11 +627,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 @@ -733,7 +713,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; @@ -745,18 +725,18 @@ native_inop_getattr(struct pnode *pno, path = _sysio_pb_path(pno->p_base, '/'); if (!path) return -ENOMEM; - err = native_stat(path, nino, stbuf); + err = native_stat(path, ino, stat); free(path); } else if (nino->ni_fd >= 0) - err = native_fstat(nino->ni_fd, nino, 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; } @@ -768,22 +748,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; @@ -795,10 +771,7 @@ native_inop_setattr(struct pnode *pno, /* * Get current status for undo. */ - err = - fd < 0 - ? native_stat(path, nino, stbp) - : native_fstat(fd, nino, stbp); + err = native_stat(path, ino, NULL); if (err) goto out; @@ -808,7 +781,7 @@ native_inop_setattr(struct pnode *pno, /* * Alter permissions attribute. */ - mode = stbuf->st_mode & 07777; + mode = stat->st_mode & 07777; err = fd < 0 ? syscall(SYS_chmod, path, mode) @@ -824,12 +797,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(__SYS_UTIME, path, &ut); if (err) err = -errno; @@ -846,18 +819,18 @@ native_inop_setattr(struct pnode *pno, ? syscall(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(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; @@ -869,8 +842,8 @@ native_inop_setattr(struct pnode *pno, * Do the truncate last. It can't be undone. */ (void )(fd < 0 - ? syscall(__SYS_TRUNCATE, path, stbuf->st_size) - : syscall(__SYS_FTRUNCATE, fd, stbuf->st_size)); + ? syscall(__SYS_TRUNCATE, path, stat->st_size) + : syscall(__SYS_FTRUNCATE, fd, stat->st_size)); } if (!err) goto out; @@ -883,39 +856,37 @@ native_inop_setattr(struct pnode *pno, ? syscall(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(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(__SYS_UTIME, path, &ut); } if (mask & SETATTR_MODE) { fd < 0 - ? syscall(SYS_chmod, path, stbp->st_mode & 07777) - : syscall(SYS_fchmod, stbp->st_mode & 07777); + ? syscall(SYS_chmod, path, ino->i_stbuf.st_mode & 07777) + : syscall(SYS_fchmod, ino->i_stbuf.st_mode & 07777); } out: /* * We must refresh the cached attributes on success. */ - if (!err && (fd < 0 - ? native_stat(path, nino, stbp) - : native_fstat(fd, nino, stbp)) != 0) + if (!err && native_stat(path, ino, NULL) != 0) abort(); if (path) free(path); @@ -1804,6 +1775,7 @@ static void native_fsop_gone(struct filesys *fs __IS_UNUSED) { + free(fs->fs_private); /* * Do nothing. There is no private part maintained for the * native file interface. |
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-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: Lee W. <lw...@us...> - 2004-10-14 14:59:43
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8149/drivers/native Modified Files: fs_native.c 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: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.51 retrieving revision 1.52 diff -u -w -b -B -p -r1.51 -r1.52 --- fs_native.c 30 Sep 2004 15:31:55 -0000 1.51 +++ fs_native.c 14 Oct 2004 14:59:28 -0000 1.52 @@ -74,6 +74,7 @@ #include "xtio.h" #include "sysio.h" +#include "native.h" #include "fs.h" #include "mount.h" #include "inode.h" @@ -84,13 +85,13 @@ #include <sys/uio.h> #endif [...1061 lines suppressed...] + 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); - return syscall(SYS_ioctl, I2NI(ino)->ni_fd, request, + return syscall(SYSIO_SYS_ioctl, I2NI(ino)->ni_fd, request, arg1, arg2, arg3, arg4); } #else @@ -1781,7 +1777,7 @@ native_inop_gone(struct inode *ino) struct native_inode *nino = I2NI(ino); if (nino->ni_fd >= 0) - (void )syscall(SYS_close, nino->ni_fd); + (void )syscall(SYSIO_SYS_close, nino->ni_fd); free(ino->i_private); } |
From: Ruth K. <rk...@us...> - 2004-10-14 16:16:54
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26835 Modified Files: fs_native.c Log Message: fix typo Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -w -b -B -p -r1.52 -r1.53 --- fs_native.c 14 Oct 2004 14:59:28 -0000 1.52 +++ fs_native.c 14 Oct 2004 16:16:45 -0000 1.53 @@ -766,9 +766,9 @@ _ut(const char *path, time_t actime, tim struct timeval tv[2]; tv[0].tv_sec = actime; - tv[0].tv_nsec = 0; + tv[0].tv_usec = 0; tv[1].tv_sec = modtime; - tv[1].tv_nsec = 0; + tv[1].tv_usec = 0; return syscall(SYSIO_SYS_utimes, path, &tv); } #endif |
From: Lee W. <lw...@us...> - 2005-01-25 00:38:07
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22054/drivers/native Modified Files: fs_native.c Log Message: Finish support for compile-time selection of external names. There were many alias directives that had not been modified to use SYSIO_INTERFACE_NAME. There were some calls that needed that macro applied. The include files needed some massaging. Particularly xtio.h. One big gotcha; In libsysio, xtio.h must now be included *after* sysio.h or it will redefine SYSIO_INTERFACE_NAME. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.53 retrieving revision 1.54 diff -u -w -b -B -p -r1.53 -r1.54 --- fs_native.c 14 Oct 2004 16:16:45 -0000 1.53 +++ fs_native.c 25 Jan 2005 00:36:50 -0000 1.54 @@ -72,8 +72,8 @@ #include <sys/uio.h> #include <sys/queue.h> -#include "xtio.h" #include "sysio.h" +#include "xtio.h" #include "native.h" #include "fs.h" #include "mount.h" |
From: Lee W. <lw...@us...> - 2005-02-04 00:22:02
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9618/native Modified Files: fs_native.c Log Message: On a failed mount, an acquired FS was first released, then gone'd. The gone caused a double-free. Removed. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.54 retrieving revision 1.55 diff -u -w -b -B -p -r1.54 -r1.55 --- fs_native.c 25 Jan 2005 00:36:50 -0000 1.54 +++ fs_native.c 4 Feb 2005 00:21:45 -0000 1.55 @@ -494,7 +494,6 @@ error: _sysio_pb_gone(rootpb); if (fs) { FS_RELE(fs); - _sysio_fs_gone(fs); nfs = NULL; } if (nfs) |
From: Lee W. <lw...@us...> - 2005-08-04 20:17:19
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4518/drivers/native Modified Files: fs_native.c Log Message: Removed the internal getdirentries inode operation. The getdirentries function does not return the *next* block in it's basep argument. It simply return the cookie for the current block. We needed one that returns the *next*, so a new interface called filldirentries is present with this change. It takes, as it's second argument, a pointer to a value/result pair. The value should be set to the position to be read. The result is the position of the next block. All the included drivers have been updated. External drivers will require similar updates. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.55 retrieving revision 1.56 diff -u -w -b -B -p -r1.55 -r1.56 --- fs_native.c 4 Feb 2005 00:21:45 -0000 1.55 +++ fs_native.c 4 Aug 2005 20:17:09 -0000 1.56 @@ -86,13 +86,10 @@ #endif #if defined(SYSIO_SYS_getdirentries) -#define DIR_STREAMED 0 #define DIR_CVT_64 0 #elif defined(SYSIO_SYS_getdents64) -#define DIR_STREAMED 1 #define DIR_CVT_64 0 #elif defined(SYSIO_SYS_getdents) -#define DIR_STREAMED 1 #if defined(_LARGEFILE64_SOURCE) #define DIR_CVT_64 1 /* @@ -143,7 +140,8 @@ struct native_inode_identifier { struct native_inode { unsigned ni_seekok : 1, /* can seek? */ - ni_attrvalid : 1; /* cached attrs ok? */ + ni_attrvalid : 1, /* cached attrs ok? */ + ni_resetfpos : 1; /* reset fpos? */ struct native_inode_identifier ni_ident; /* unique identifier */ struct file_identifier ni_fileid; /* ditto */ int ni_fd; /* host fildes */ @@ -178,10 +176,10 @@ static int native_inop_setattr(struct pn struct inode *ino, unsigned mask, struct intnl_stat *stbuf); -static ssize_t native_getdirentries(struct inode *ino, +static ssize_t native_filldirentries(struct inode *ino, + _SYSIO_OFF_T *posp, char *buf, - size_t nbytes, - _SYSIO_OFF_T *basep); + size_t nbytes); static int native_inop_mkdir(struct pnode *pno, mode_t mode); static int native_inop_rmdir(struct pnode *pno); static int native_inop_symlink(struct pnode *pno, const char *data); @@ -213,7 +211,7 @@ static struct inode_ops native_i_ops = { native_inop_lookup, native_inop_getattr, native_inop_setattr, - native_getdirentries, + native_filldirentries, native_inop_mkdir, native_inop_rmdir, native_inop_symlink, @@ -324,6 +322,8 @@ native_i_new(struct filesys *fs, time_t return NULL; bzero(&nino->ni_ident, sizeof(nino->ni_ident)); nino->ni_seekok = 0; + nino->ni_attrvalid = 0; + nino->ni_resetfpos = 0; nino->ni_ident.dev = buf->st_dev; nino->ni_ident.ino = buf->st_ino; #ifdef HAVE_GENERATION @@ -952,26 +952,31 @@ native_pos(int fd, _SYSIO_OFF_T *offset, } static ssize_t -native_filldirentries(struct native_inode *nino, +native_ifilldirentries(struct native_inode *nino, + _SYSIO_OFF_T *posp, char *buf, - size_t nbytes, - _SYSIO_OFF_T *basep) + size_t nbytes) { int err; ssize_t cc; - if (*basep < 0) + if (*posp < 0) return -EINVAL; -#if DIR_STREAMED /* * Stream-oriented access requires that we reposition prior to the * fill call. */ - if ((err = native_pos(nino->ni_fd, basep, SEEK_SET)) != 0) + assert(nino->ni_seekok); + if (*posp != nino->ni_fpos || nino->ni_resetfpos) { + nino->ni_fpos = *posp; + err = native_pos(nino->ni_fd, &nino->ni_fpos, SEEK_SET); + if (err) { + nino->ni_resetfpos = 1; return err; -#endif - nino->ni_fpos = *basep; + } + nino->ni_resetfpos = 0; + } cc = #if defined(SYSIO_SYS_getdirentries) @@ -979,7 +984,7 @@ native_filldirentries(struct native_inod nino->ni_fd, buf, nbytes, - basep); + &waste); #elif defined(SYSIO_SYS_getdents64) syscall(SYSIO_SYS_getdents64, nino->ni_fd, buf, nbytes); #elif defined(SYSIO_SYS_getdents) @@ -988,24 +993,26 @@ native_filldirentries(struct native_inod if (cc < 0) return -errno; -#if DIR_STREAMED /* * Stream-oriented access requires that we discover where we are * after the call. */ - *basep = 0; - if ((err = native_pos(nino->ni_fd, basep, SEEK_CUR)) != 0) + if ((err = native_pos(nino->ni_fd, &nino->ni_fpos, SEEK_CUR)) != 0) { + /* + * Leave the position at the old I suppose. + */ + nino->ni_resetfpos = 1; return err; -#endif - nino->ni_fpos = *basep; + } + *posp = nino->ni_fpos; return cc; } static ssize_t -native_getdirentries(struct inode *ino, +native_filldirentries(struct inode *ino, + _SYSIO_OFF_T *posp, char *buf, - size_t nbytes, - _SYSIO_OFF_T *basep) + size_t nbytes) { struct native_inode *nino = I2NI(ino); #if DIR_CVT_64 @@ -1015,12 +1022,6 @@ native_getdirentries(struct inode *ino, struct dirent64 *d64p; size_t namlen; size_t reclen; - /* - * Work-around for broken 64 bit basep update - * Get value of basep to return from last directory - * entry d_off value - */ - _SYSIO_OFF_T last_offset = *basep; #else #define bp buf #define count nbytes @@ -1037,7 +1038,7 @@ native_getdirentries(struct inode *ino, return -ENOMEM; } #endif - cc = native_filldirentries(nino, bp, count, basep); + cc = native_ifilldirentries(nino, posp, bp, count); if (cc < 0) { #if DIR_CVT_64 free(bp); @@ -1047,30 +1048,31 @@ native_getdirentries(struct inode *ino, #if DIR_CVT_64 ldp = (struct linux_dirent *)bp; d64p = (struct dirent64 *)buf; - for (;;) { - if (cc < 0 || (size_t )cc <= sizeof(*ldp)) - break; + while (cc) { namlen = strlen(ldp->ld_name); - reclen = sizeof(*d64p) - sizeof(d64p->d_name) + namlen + 1; - if (nbytes < reclen) + reclen = sizeof(*d64p) - sizeof(d64p->d_name) + namlen; + if (nbytes <= reclen) break; d64p->d_ino = ldp->ld_ino; - d64p->d_off = ldp->ld_off; + d64p->d_off = nino->ni_fpos = ldp->ld_off; d64p->d_reclen = - (((reclen + sizeof(long) - 1)) / sizeof(long)) * - sizeof(long); + (((reclen + sizeof(long))) / sizeof(long)) * sizeof(long); if (nbytes < d64p->d_reclen) - d64p->d_reclen = reclen; + d64p->d_reclen = reclen + 1; d64p->d_type = DT_UNKNOWN; /* you lose -- sorry. */ - (void )strncpy(d64p->d_name, ldp->ld_name, namlen); - *(d64p->d_name + namlen) = '\0'; + (void )memcpy(d64p->d_name, ldp->ld_name, namlen); + /* + * Zero pad the rest. + */ + for (cp = d64p->d_name + namlen, n = d64p->d_reclen - reclen; + n; + n--) + *cp++ = 0; cc -= ldp->ld_reclen; ldp = (struct linux_dirent *)((char *)ldp + ldp->ld_reclen); nbytes -= d64p->d_reclen; - last_offset = d64p->d_off; d64p = (struct dirent64 *)((char *)d64p + d64p->d_reclen); } - nino->ni_fpos = *basep = last_offset; free(bp); cc = (d64p == (struct dirent64 *)buf && cc) @@ -1222,6 +1224,7 @@ native_inop_open(struct pnode *pno, int /* * Invariant; First open. Must init. */ + nino->ni_resetfpos = 0; nino->ni_fpos = 0; nino->ni_fd = fd; /* @@ -1259,6 +1262,7 @@ native_inop_close(struct inode *ino) return -errno; nino->ni_fd = -1; + nino->ni_resetfpos = 0; nino->ni_fpos = 0; return 0; } @@ -1348,13 +1352,10 @@ dopio(void *buf, size_t count, _SYSIO_OF { ssize_t cc; - if (!(off == nio->nio_nino->ni_fpos || nio->nio_nino->ni_seekok)) - return -ESPIPE; - if (!nio->nio_nino->ni_seekok) { if (off != nio->nio_nino->ni_fpos) { /* - * They've done a p{read,write} or somesuch. Can't + * They're trying to reposition. Can't * seek on this descriptor so we err out now. */ errno = ESPIPE; @@ -1407,8 +1408,11 @@ doiov(const struct iovec *iov, int err; err = native_pos(nio->nio_nino->ni_fd, &off, SEEK_SET); - if (err) + if (err) { + nio->nio_nino->ni_resetfpos = 1; return err; + } + nio->nio_nino->ni_resetfpos = 0; nio->nio_nino->ni_fpos = off; } |
From: Lee W. <lw...@us...> - 2005-10-19 19:25:41
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2498 Modified Files: fs_native.c Log Message: Fix returns from ioctl in both the normal ioctl handler and the one defined when WITH_LUSTRE_HACK set. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.56 retrieving revision 1.57 diff -u -w -b -B -p -r1.56 -r1.57 --- fs_native.c 4 Aug 2005 20:17:09 -0000 1.56 +++ fs_native.c 19 Oct 2005 19:25:33 -0000 1.57 @@ -1748,6 +1748,7 @@ native_inop_ioctl(struct inode *ino, { struct native_inode *nino; long arg1, arg2, arg3, arg4; + int rtn; nino = I2NI(ino); assert(nino->ni_fd >= 0); @@ -1756,8 +1757,12 @@ native_inop_ioctl(struct inode *ino, arg3 = va_arg(ap, long); arg4 = va_arg(ap, long); - return syscall(SYSIO_SYS_ioctl, I2NI(ino)->ni_fd, request, + rtn = + syscall(SYSIO_SYS_ioctl, I2NI(ino)->ni_fd, request, arg1, arg2, arg3, arg4); + if (rtn < 0) + rtn = -errno; + return rtn; } #else static int @@ -1769,8 +1774,7 @@ native_inop_ioctl(struct inode *ino __IS /* * I'm lazy. Maybe implemented later. */ - errno = ENOTTY; - return -1; + return -ENOTTY; } #endif |
From: Ruth K. <rk...@us...> - 2005-10-24 18:21:10
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4516 Modified Files: fs_native.c Log Message: define variable for sys_getdirentries call Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.57 retrieving revision 1.58 diff -u -w -b -B -p -r1.57 -r1.58 --- fs_native.c 19 Oct 2005 19:25:33 -0000 1.57 +++ fs_native.c 24 Oct 2005 18:20:37 -0000 1.58 @@ -959,6 +959,9 @@ native_ifilldirentries(struct native_ino { int err; ssize_t cc; +#if defined(SYSIO_SYS_getdirentries) + _SYSIO_OFF_T waste; +#endif if (*posp < 0) return -EINVAL; |
From: Lee W. <lw...@us...> - 2006-04-10 23:21:30
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5764 Modified Files: fs_native.c Log Message: Fixed a bug in truncate/ftruncate. It was ignoreing the return code; Always returned success. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.58 retrieving revision 1.59 diff -u -w -b -B -p -r1.58 -r1.59 --- fs_native.c 24 Oct 2005 18:20:37 -0000 1.58 +++ fs_native.c 10 Apr 2006 23:21:24 -0000 1.59 @@ -868,9 +868,11 @@ native_inop_setattr(struct pnode *pno, /* * Do the truncate last. It can't be undone. */ - (void )(fd < 0 + err = fd < 0 ? syscall(SYSIO_SYS_truncate, path, stat->st_size) - : syscall(SYSIO_SYS_ftruncate, fd, stat->st_size)); + : syscall(SYSIO_SYS_ftruncate, fd, stat->st_size); + if (err) + err = -errno; } if (!err) goto out; |