Thread: [Libsysio-commit] HEAD: libsysio/dev/stdfd stdfd.c
Brought to you by:
lward
From: Ruth K. <rk...@us...> - 2003-07-31 22:45:12
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1:/tmp/cvs-serv25526/dev/stdfd Modified Files: stdfd.c Log Message: fix warnings Index: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -b -B -p -r1.2 -r1.3 --- stdfd.c 24 Mar 2003 22:09:02 -0000 1.2 +++ stdfd.c 31 Jul 2003 22:21:36 -0000 1.3 @@ -120,7 +120,7 @@ doio(ssize_t (*f)(int, char *, size_t), struct ioctx *ioctx; const struct iovec *iov; size_t n; - ssize_t cc; + ssize_t cc = 0; ioctx = _sysio_ioctx_new(ino, ioargs); if (!ioctx) |
From: Lee W. <lw...@us...> - 2003-10-10 18:52:01
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1:/tmp/cvs-serv14350/dev/stdfd Modified Files: stdfd.c Log Message: Red Storm branch mega-merge. Please, no more changes to any of the Red Storm branches. We'll keep them for reference for awhile but then, they go away. Finally! Index: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- stdfd.c 14 Aug 2003 18:39:33 -0000 1.4 +++ stdfd.c 10 Oct 2003 18:50:30 -0000 1.5 @@ -58,6 +58,10 @@ #include "stdfd.h" +#ifdef REDSTORM +#include <catamount/syscall.h> /* ! in sys include? */ +#endif + #ifdef CPLANT_YOD #include <sys/statfs.h> #include "cplant-yod.h" |
From: Lee W. <lw...@us...> - 2003-10-13 01:04:43
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1:/tmp/cvs-serv31768/dev/stdfd Modified Files: stdfd.c Log Message: The IO context record supported one call-back. It now supports a chain. This was changed to accommodate the Sandia-PVFS driver. Also, it's needed for the, coming, {read,write}_strided calls. To add a callback to the chain use: _sysio_ioctx_cb(struct ioctx *ioctx, void (*func)(struct ioctx *, void *), void *data) Callbacks are added to the end of the existing chain. When called, by _sysio_io_complete, they are run in order. So... If you're freeing things using callbacks be careful not to depend on something in a later callback that you previously free'd. Also, _sysio_io_complete no longer waits for the driver. To call this, now, is to signal completion. Index: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- stdfd.c 10 Oct 2003 18:50:30 -0000 1.5 +++ stdfd.c 13 Oct 2003 01:04:34 -0000 1.6 @@ -79,11 +79,9 @@ static int stdfd_open(struct pnode *pno, int flags, mode_t mode); static int stdfd_close(struct inode *ino); static int stdfd_ipreadv(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp); + struct ioctx *ioctx); static int stdfd_ipwritev(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp); + struct ioctx *ioctx); static int stdfd_iodone(struct ioctx *ioctx); static int stdfd_datasync(struct inode *ino); static int stdfd_ioctl(struct inode *ino, @@ -128,18 +126,12 @@ stdfd_close(struct inode *ino __IS_UNUSE static int doio(ssize_t (*f)(int, char *, size_t), struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp) + struct ioctx *ioctx) { - struct ioctx *ioctx; const struct iovec *iov; size_t n; ssize_t cc = 0; - ioctx = _sysio_ioctx_new(ino, ioargs); - if (!ioctx) - return -ENOMEM; - iov = ioctx->ioctx_iovec; for (n = ioctx->ioctx_iovlen, iov = ioctx->ioctx_iovec; n--; @@ -159,7 +151,6 @@ doio(ssize_t (*f)(int, char *, size_t), ioctx->ioctx_errno = -cc; } - *ioctxp = ioctx; return 0; } @@ -172,11 +163,10 @@ stdfd_read(int fd, char *buf, size_t nby static int stdfd_ipreadv(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp) + struct ioctx *ioctx) { - return doio(stdfd_read, ino, ioargs, ioctxp); + return doio(stdfd_read, ino, ioctx); } static ssize_t @@ -190,14 +180,12 @@ stdfd_write(int fd, static int stdfd_ipwritev(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp) + struct ioctx *ioctx) { return doio((ssize_t (*)(int, char *, size_t))stdfd_write, ino, - ioargs, - ioctxp); + ioctx); } static int |
From: Lee W. <lw...@us...> - 2004-01-26 16:35:51
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11610/dev/stdfd Modified Files: stdfd.c Log Message: Patches from Kevin Pedretti (kt...@sa...) allowing for the change from a BSD-based libc to glibc-based on Red Storm. Index: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -b -B -p -r1.6 -r1.7 --- stdfd.c 13 Oct 2003 01:04:34 -0000 1.6 +++ stdfd.c 26 Jan 2004 16:34:53 -0000 1.7 @@ -58,10 +58,6 @@ #include "stdfd.h" -#ifdef REDSTORM -#include <catamount/syscall.h> /* ! in sys include? */ -#endif - #ifdef CPLANT_YOD #include <sys/statfs.h> #include "cplant-yod.h" |
From: Lee W. <lw...@us...> - 2004-02-06 20:10:45
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29990/dev/stdfd Modified Files: stdfd.c Log Message: Merging strided-IO branch + Strided-IO infrastructure. Internals altered to move data base don multiple targeted regions in both the file address space and local memory. + Added [i]{read,write}x, calls to perform extent-based or strided-IO directly. + Many bug fixes + Many uocnfig fixes + --with-zero-sum-memory; A config option that causes the shutdown code to carefully release *all* memory acquired from the heap, by the library. Useful for debugging tasks such as leak detection. Index: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- stdfd.c 26 Jan 2004 16:34:53 -0000 1.7 +++ stdfd.c 6 Feb 2004 20:07:28 -0000 1.8 @@ -74,10 +74,8 @@ static int stdfd_open(struct pnode *pno, int flags, mode_t mode); static int stdfd_close(struct inode *ino); -static int stdfd_ipreadv(struct inode *ino, - struct ioctx *ioctx); -static int stdfd_ipwritev(struct inode *ino, - struct ioctx *ioctx); +static int stdfd_read(struct inode *ino, struct ioctx *ioctx); +static int stdfd_write(struct inode *ino, struct ioctx *ioctx); static int stdfd_iodone(struct ioctx *ioctx); static int stdfd_datasync(struct inode *ino); static int stdfd_ioctl(struct inode *ino, @@ -92,8 +90,8 @@ _sysio_stdfd_init() stdfd_operations = _sysio_nodev_ops; stdfd_operations.inop_open = stdfd_open; stdfd_operations.inop_close = stdfd_close; - stdfd_operations.inop_ipreadv = stdfd_ipreadv; - stdfd_operations.inop_ipwritev = stdfd_ipwritev; + stdfd_operations.inop_read = stdfd_read; + stdfd_operations.inop_write = stdfd_write; stdfd_operations.inop_iodone = stdfd_iodone; stdfd_operations.inop_datasync = stdfd_datasync; stdfd_operations.inop_ioctl = stdfd_ioctl; @@ -120,33 +118,27 @@ stdfd_close(struct inode *ino __IS_UNUSE } static int -doio(ssize_t (*f)(int, char *, size_t), +doio(ssize_t (*f)(void *, size_t, _SYSIO_OFF_T, struct inode *), struct inode *ino, struct ioctx *ioctx) { - const struct iovec *iov; - size_t n; - ssize_t cc = 0; - - iov = ioctx->ioctx_iovec; - for (n = ioctx->ioctx_iovlen, iov = ioctx->ioctx_iovec; - n--; - iov++) { - if (!iov->iov_len) - continue; - cc = - (*f)(SYSIO_MINOR_DEV(ino->i_rdev), - iov->iov_base, - iov->iov_len); - if (cc <= 0) - break; - ioctx->ioctx_cc += cc; + + if (ioctx->ioctx_xtvlen != 1) { + /* + * No scatter/gather to "file" address space (we're not + * seekable) and "nowhere" makes no sense. + */ + return -EINVAL; } - if (cc < 0 && !ioctx->ioctx_cc) { + ioctx->ioctx_cc = + _sysio_doio(ioctx->ioctx_xtv, ioctx->ioctx_xtvlen, + ioctx->ioctx_iov, ioctx->ioctx_iovlen, + (ssize_t (*)(void *, size_t, _SYSIO_OFF_T, void *))f, + ino); + if (ioctx->ioctx_cc < 0) { + ioctx->ioctx_errno = -ioctx->ioctx_cc; ioctx->ioctx_cc = -1; - ioctx->ioctx_errno = -cc; } - return 0; } @@ -151,35 +143,43 @@ doio(ssize_t (*f)(int, char *, size_t), } static ssize_t -stdfd_read(int fd, char *buf, size_t nbytes) +stdfd_read_simple(void *buf, + size_t nbytes, + _SYSIO_OFF_T off __IS_UNUSED, + struct inode *ino) { + int fd = SYSIO_MINOR_DEV(ino->i_rdev); + return doread(fd, buf, nbytes); } static int -stdfd_ipreadv(struct inode *ino, - struct ioctx *ioctx) +stdfd_read(struct inode *ino, struct ioctx *ioctx) { - return doio(stdfd_read, ino, ioctx); + return doio(stdfd_read_simple, ino, ioctx); } static ssize_t -stdfd_write(int fd, - const char *buf, - size_t nbytes) +stdfd_write_simple(const void *buf, + size_t nbytes, + _SYSIO_OFF_T off __IS_UNUSED, + struct inode *ino) { + int fd = SYSIO_MINOR_DEV(ino->i_rdev); return dowrite(fd, buf, nbytes); } static int -stdfd_ipwritev(struct inode *ino, - struct ioctx *ioctx) +stdfd_write(struct inode *ino, struct ioctx *ioctx) { - return doio((ssize_t (*)(int, char *, size_t))stdfd_write, + return doio((ssize_t (*)(void *, + size_t, + _SYSIO_OFF_T, + struct inode *))stdfd_write_simple, ino, ioctx); } |
From: Lee W. <lw...@us...> - 2004-07-03 05:47:21
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11075/dev/stdfd Modified Files: stdfd.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: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- stdfd.c 6 Feb 2004 20:07:28 -0000 1.8 +++ stdfd.c 3 Jul 2004 05:47:12 -0000 1.9 @@ -48,10 +48,10 @@ #include <errno.h> #include <sys/syscall.h> #include <unistd.h> -#include <sys/uio.h> #include <sys/types.h> #include <sys/queue.h> +#include "xtio.h" #include "sysio.h" #include "inode.h" #include "dev.h" |
From: Lee W. <lw...@us...> - 2004-08-27 18:10:15
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31039/dev/stdfd Modified Files: stdfd.c Log Message: Added fcntl call. It was, inappropriately, going to the supporting file system driver. Index: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -b -B -p -r1.9 -r1.10 --- stdfd.c 3 Jul 2004 05:47:12 -0000 1.9 +++ stdfd.c 27 Aug 2004 18:10:05 -0000 1.10 @@ -78,6 +78,7 @@ static int stdfd_read(struct inode *ino, static int stdfd_write(struct inode *ino, struct ioctx *ioctx); static int stdfd_iodone(struct ioctx *ioctx); static int stdfd_datasync(struct inode *ino); +static int stdfd_fcntl(struct inode *ino, int cmd, va_list ap, int *rtn); static int stdfd_ioctl(struct inode *ino, unsigned long int request, va_list ap); @@ -93,6 +94,7 @@ _sysio_stdfd_init() stdfd_operations.inop_read = stdfd_read; stdfd_operations.inop_write = stdfd_write; stdfd_operations.inop_iodone = stdfd_iodone; + stdfd_operations.inop_fcntl = stdfd_fcntl; stdfd_operations.inop_datasync = stdfd_datasync; stdfd_operations.inop_ioctl = stdfd_ioctl; @@ -195,6 +197,17 @@ 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, + int *rtn) +{ + + *rtn = -1; + return -EINVAL; +} + +static int stdfd_datasync(struct inode *ino __IS_UNUSED) { |
From: Lee W. <lw...@us...> - 2004-09-21 16:18:52
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25715/dev/stdfd Modified Files: stdfd.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: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -b -B -p -r1.10 -r1.11 --- stdfd.c 27 Aug 2004 18:10:05 -0000 1.10 +++ stdfd.c 21 Sep 2004 16:18:13 -0000 1.11 @@ -49,6 +49,7 @@ #include <sys/syscall.h> #include <unistd.h> #include <sys/types.h> +#include <sys/stat.h> #include <sys/queue.h> #include "xtio.h" @@ -151,7 +152,7 @@ stdfd_read_simple(void *buf, struct inode *ino) { - int fd = SYSIO_MINOR_DEV(ino->i_rdev); + int fd = SYSIO_MINOR_DEV(ino->i_stbuf.st_rdev); return doread(fd, buf, nbytes); } @@ -169,7 +170,7 @@ 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); return dowrite(fd, buf, nbytes); } |
From: Lee W. <lw...@us...> - 2004-09-21 17:37:12
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8982/dev/stdfd Modified Files: stdfd.c Log Message: Michael Levenhagen points out that the stdfd device does not support fcntl. We now support F_SETFL and F_GETFL on this device. Index: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -b -B -p -r1.11 -r1.12 --- stdfd.c 21 Sep 2004 16:18:13 -0000 1.11 +++ stdfd.c 21 Sep 2004 17:36:57 -0000 1.12 @@ -46,8 +46,10 @@ #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> @@ -151,10 +153,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; - return doread(fd, buf, nbytes); + cc = doread(fd, buf, nbytes); + if (cc < 0) + cc = -errno; + return cc; } static int @@ -171,8 +176,12 @@ stdfd_write_simple(const void *buf, struct inode *ino) { 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 +207,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-10-14 14:59:45
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8149/dev/stdfd Modified Files: stdfd.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: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -b -B -p -r1.12 -r1.13 --- stdfd.c 21 Sep 2004 17:36:57 -0000 1.12 +++ stdfd.c 14 Oct 2004 14:59:28 -0000 1.13 @@ -56,6 +56,7 @@ #include "xtio.h" #include "sysio.h" +#include "native.h" #include "inode.h" #include "dev.h" @@ -67,8 +68,8 @@ #define dowrite(f, b, n) write_yod(f, b, n) #define doread(f, b, n) read_yod(f, b, n) #else -#define dowrite(f, b, n) syscall(SYS_write, f, b, n) -#define doread(f, b, n) syscall(SYS_read, f, b, n) +#define dowrite(f, b, n) syscall(SYSIO_SYS_write, f, b, n) +#define doread(f, b, n) syscall(SYSIO_SYS_read, f, b, n) #endif /* |
From: Lee W. <lw...@us...> - 2005-01-25 00:38:08
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22054/dev/stdfd Modified Files: stdfd.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: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -b -B -p -r1.13 -r1.14 --- stdfd.c 14 Oct 2004 14:59:28 -0000 1.13 +++ stdfd.c 25 Jan 2005 00:36:46 -0000 1.14 @@ -54,8 +54,8 @@ #include <sys/stat.h> #include <sys/queue.h> -#include "xtio.h" #include "sysio.h" +#include "xtio.h" #include "native.h" #include "inode.h" #include "dev.h" |
From: Lee W. <lw...@us...> - 2008-06-17 15:10:42
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29665 Modified Files: stdfd.c Log Message: Fixed bug in _sysio_stdfd_init. It was returning the major number. That happened to be zero but could be anything in [0,127]. Any other number is interpreted by the caller as an error. Index: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -b -B -p -r1.14 -r1.15 --- stdfd.c 25 Jan 2005 00:36:46 -0000 1.14 +++ stdfd.c 17 Jun 2008 15:10:39 -0000 1.15 @@ -91,6 +91,7 @@ int _sysio_stdfd_init() { struct inode_ops stdfd_operations; + int mjr; stdfd_operations = _sysio_nodev_ops; stdfd_operations.inop_open = stdfd_open; @@ -102,9 +103,13 @@ _sysio_stdfd_init() stdfd_operations.inop_datasync = stdfd_datasync; stdfd_operations.inop_ioctl = stdfd_ioctl; - return _sysio_char_dev_register(SYSIO_C_STDFD_MAJOR, + mjr = + _sysio_char_dev_register(SYSIO_C_STDFD_MAJOR, "stdfd", &stdfd_operations); + if (mjr >= 0) + mjr = 0; + return mjr; } static int |
From: Lee W. <lw...@us...> - 2008-07-11 18:24:02
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14678/dev/stdfd Modified Files: stdfd.c Log Message: Complete, finally, the change to use pnodes everywhere. Not ported to the new scheme were; sockets, yod, and incore driver. Index: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -b -B -p -r1.15 -r1.16 --- stdfd.c 17 Jun 2008 15:10:39 -0000 1.15 +++ stdfd.c 11 Jul 2008 18:23:56 -0000 1.16 @@ -77,13 +77,13 @@ */ static int stdfd_open(struct pnode *pno, int flags, mode_t mode); -static int stdfd_close(struct inode *ino); -static int stdfd_read(struct inode *ino, struct ioctx *ioctx); -static int stdfd_write(struct inode *ino, struct ioctx *ioctx); +static int stdfd_close(struct pnode *pno); +static int stdfd_read(struct ioctx *ioctx); +static int stdfd_write(struct ioctx *ioctx); static int stdfd_iodone(struct ioctx *ioctx); -static int stdfd_datasync(struct inode *ino); -static int stdfd_fcntl(struct inode *ino, int cmd, va_list ap, int *rtn); -static int stdfd_ioctl(struct inode *ino, +static int stdfd_datasync(struct pnode *pno); +static int stdfd_fcntl(struct pnode *pno, int cmd, va_list ap, int *rtn); +static int stdfd_ioctl(struct pnode *pno, unsigned long int request, va_list ap); @@ -122,7 +122,7 @@ stdfd_open(struct pnode *pno __IS_UNUSED } static int -stdfd_close(struct inode *ino __IS_UNUSED) +stdfd_close(struct pnode *pno __IS_UNUSED) { return 0; @@ -130,9 +130,9 @@ stdfd_close(struct inode *ino __IS_UNUSE static int doio(ssize_t (*f)(void *, size_t, _SYSIO_OFF_T, struct inode *), - struct inode *ino, struct ioctx *ioctx) { + struct inode *ino; if (ioctx->ioctx_xtvlen != 1) { /* @@ -141,6 +141,8 @@ doio(ssize_t (*f)(void *, size_t, _SYSIO */ return -EINVAL; } + ino = ioctx->ioctx_pno->p_base->pb_ino; + assert(ino); ioctx->ioctx_cc = _sysio_doio(ioctx->ioctx_xtv, ioctx->ioctx_xtvlen, ioctx->ioctx_iov, ioctx->ioctx_iovlen, @@ -169,10 +171,10 @@ stdfd_read_simple(void *buf, } static int -stdfd_read(struct inode *ino, struct ioctx *ioctx) +stdfd_read(struct ioctx *ioctx) { - return doio(stdfd_read_simple, ino, ioctx); + return doio(stdfd_read_simple, ioctx); } static ssize_t @@ -191,19 +193,18 @@ stdfd_write_simple(const void *buf, } static int -stdfd_write(struct inode *ino, struct ioctx *ioctx) +stdfd_write(struct ioctx *ioctx) { return doio((ssize_t (*)(void *, size_t, _SYSIO_OFF_T, struct inode *))stdfd_write_simple, - ino, ioctx); } static int -stdfd_iodone(struct ioctx *iocp __IS_UNUSED) +stdfd_iodone(struct ioctx *ioctx __IS_UNUSED) { /* @@ -213,15 +214,19 @@ stdfd_iodone(struct ioctx *iocp __IS_UNU } static int -stdfd_fcntl(struct inode *ino, +stdfd_fcntl(struct pnode *pno, int cmd, va_list ap, int *rtn) { + struct inode *ino; + int fd; int err; - int fd = SYSIO_MINOR_DEV(ino->i_stbuf.st_rdev); long arg; + ino = pno->p_base->pb_ino; + assert(ino); + fd = SYSIO_MINOR_DEV(ino->i_stbuf.st_rdev); err = 0; switch (cmd) { case F_GETFL: @@ -244,7 +249,7 @@ stdfd_fcntl(struct inode *ino, } static int -stdfd_datasync(struct inode *ino __IS_UNUSED) +stdfd_datasync(struct pnode *pno __IS_UNUSED) { /* @@ -254,7 +259,7 @@ stdfd_datasync(struct inode *ino __IS_UN } static int -stdfd_ioctl(struct inode *ino __IS_UNUSED, +stdfd_ioctl(struct pnode *pno __IS_UNUSED, unsigned long int request __IS_UNUSED, va_list ap __IS_UNUSED) { |
From: Ruth K. <rk...@us...> - 2008-10-15 22:01:09
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25646/dev/stdfd Modified Files: stdfd.c Log Message: Removing obsolete code related to cplant yod, lustre hack, and sockets driver. Index: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -w -b -B -p -r1.16 -r1.17 --- stdfd.c 11 Jul 2008 18:23:56 -0000 1.16 +++ stdfd.c 15 Oct 2008 22:01:01 -0000 1.17 @@ -62,15 +62,6 @@ #include "stdfd.h" -#ifdef CPLANT_YOD -#include <sys/statfs.h> -#include "cplant-yod.h" -#define dowrite(f, b, n) write_yod(f, b, n) -#define doread(f, b, n) read_yod(f, b, n) -#else -#define dowrite(f, b, n) syscall(SYSIO_SYS_write, f, b, n) -#define doread(f, b, n) syscall(SYSIO_SYS_read, f, b, n) -#endif /* * Pre-opened standard file descriptors driver. @@ -164,7 +155,7 @@ stdfd_read_simple(void *buf, int fd = SYSIO_MINOR_DEV(ino->i_stbuf.st_rdev); int cc; - cc = doread(fd, buf, nbytes); + cc = syscall(SYSIO_SYS_read, fd, buf, nbytes); if (cc < 0) cc = -errno; return cc; @@ -186,7 +177,7 @@ stdfd_write_simple(const void *buf, int fd = SYSIO_MINOR_DEV(ino->i_stbuf.st_rdev); int cc; - cc = dowrite(fd, buf, nbytes); + cc = syscall(SYSIO_SYS_write, fd, buf, nbytes); if (cc < 0) cc = -errno; return cc; |
From: Lee W. <lw...@us...> - 2009-12-07 22:00:39
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv2260/dev/stdfd Modified Files: stdfd.c Log Message: Added ifsync and ifdatasync. These are asynchronous versions of the standard calls. In fact, the core has been reworked so that the async versions are the core implementation. For backward compatibility, if your driver has old versions you may set the new inop_isync ad inop_idatasync fields to NULL and retain the old interface and, synchronous, semantics. The existing fields were renamed to inop_old_sync and inop_old_datasync and will be deprecated in the future. One important, related, change is that the ioctx record has a new field, called ioctx_args, which is a void * type. It's only used to pass the real function to call aby the code that is faking the async API but using the old fsync and fdatasync. Index: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -b -B -p -r1.17 -r1.18 --- stdfd.c 15 Oct 2008 22:01:01 -0000 1.17 +++ stdfd.c 7 Dec 2009 22:00:23 -0000 1.18 @@ -91,7 +91,7 @@ _sysio_stdfd_init() stdfd_operations.inop_write = stdfd_write; stdfd_operations.inop_iodone = stdfd_iodone; stdfd_operations.inop_fcntl = stdfd_fcntl; - stdfd_operations.inop_datasync = stdfd_datasync; + stdfd_operations.inop_old_datasync = stdfd_datasync; stdfd_operations.inop_ioctl = stdfd_ioctl; mjr = |