libsysio-commit Mailing List for libsysio (Page 32)
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-02-06 20:10:46
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29990/include Modified Files: dev.h file.h fs.h inode.h module.mk sysio.h Added Files: xtio.h 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: dev.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/dev.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- dev.h 13 Oct 2003 01:04:34 -0000 1.5 +++ dev.h 6 Feb 2004 20:07:29 -0000 1.6 @@ -109,10 +109,10 @@ extern const struct inode_ops _sysio_nod (int (*)(struct pnode *))_sysio_dev_illop #define _sysio_nodev_inop_rename \ (int (*)(struct pnode *, struct pnode *))_sysio_dev_illop -#define _sysio_nodev_inop_ipreadv \ +#define _sysio_nodev_inop_read \ (int (*)(struct inode *, \ struct ioctx *))_sysio_dev_illop -#define _sysio_nodev_inop_ipwritev \ +#define _sysio_nodev_inop_write \ (int (*)(struct inode *, \ struct ioctx *))_sysio_dev_illop #define _sysio_nodev_inop_iodone \ Index: file.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/file.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- file.h 13 Oct 2003 01:04:35 -0000 1.7 +++ file.h 6 Feb 2004 20:07:29 -0000 1.8 @@ -98,3 +98,6 @@ extern struct file *_sysio_fd_find(int f extern int _sysio_fd_set(struct file *fil, int fd); extern int _sysio_fd_dup2(int oldfd, int newfd); extern int _sysio_fd_close_all(void); +#if ZERO_SUM_MEMORY +extern void _sysio_fd_shutdown(void); +#endif Index: fs.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/fs.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- fs.h 24 Mar 2003 22:09:05 -0000 1.4 +++ fs.h 6 Feb 2004 20:07:29 -0000 1.5 @@ -167,3 +167,6 @@ extern struct filesys * _sysio_fs_new(st unsigned mask, void *private); extern void _sysio_fs_gone(struct filesys *fs); +#if ZERO_SUM_MEMORY +extern void _sysio_fssw_shutdown(void); +#endif Index: inode.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/inode.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -b -B -p -r1.13 -r1.14 --- inode.h 17 Oct 2003 21:30:29 -0000 1.13 +++ inode.h 6 Feb 2004 20:07:29 -0000 1.14 @@ -99,8 +99,8 @@ struct inode_ops { int (*inop_link)(struct pnode *old, struct pnode *new); int (*inop_unlink)(struct pnode *pno); int (*inop_rename)(struct pnode *old, struct pnode *new); - int (*inop_ipreadv)(struct inode *ino, struct ioctx *ioctx); - int (*inop_ipwritev)(struct inode *ino, struct ioctx *ioctx); + int (*inop_read)(struct inode *ino, struct ioctx *ioctx); + int (*inop_write)(struct inode *ino, struct ioctx *ioctx); int (*inop_iodone)(struct ioctx *iocp); int (*inop_fcntl)(struct inode *ino, int cmd, va_list ap); int (*inop_sync)(struct inode *ino); @@ -314,8 +314,8 @@ struct nameidata { /* * Values for nameidata flags field. */ -#define ND_NOFOLLOW 0x01 -#define ND_NEGOK 0x02 +#define ND_NOFOLLOW 0x01 /* no follow symlinks */ +#define ND_NEGOK 0x02 /* last missing is ok */ #ifdef AUTOMOUNT_FILE_NAME #define _ND_INIT_AUTOMOUNT(nd) ((nd)->nd_amcnt = 0) @@ -360,9 +360,10 @@ struct ioctx { ioctx_done : 1; /* transfer complete */ ioid_t ioctx_id; /* unique ident */ struct inode *ioctx_ino; /* i-node */ - const struct iovec *ioctx_iovec; /* scatter/gather vec */ + const struct iovec *ioctx_iov; /* scatter/gather vec */ size_t ioctx_iovlen; /* iovec length */ - _SYSIO_OFF_T ioctx_offset; /* file offset */ + const struct intnl_xtvec *ioctx_xtv; /* extents */ + size_t ioctx_xtvlen; /* xtv length */ ssize_t ioctx_cc; /* rtn char count */ int ioctx_errno; /* error number */ TAILQ_HEAD(, ioctx_callback) ioctx_cbq; /* callback queue */ @@ -372,15 +373,16 @@ struct ioctx { /* * Init IO context record. */ -#define IOCTX_INIT(ioctx, fast, id, ino, iov, iovlen, off) \ +#define IOCTX_INIT(ioctx, fast, id, ino, iov, iovlen, xtv, xtvlen) \ do { \ (ioctx)->ioctx_fast = (fast); \ (ioctx)->ioctx_done = 0; \ (ioctx)->ioctx_id = (id); \ (ioctx)->ioctx_ino = (ino); \ - (ioctx)->ioctx_iovec = (iov); \ + (ioctx)->ioctx_iov = (iov); \ (ioctx)->ioctx_iovlen = (iovlen); \ - (ioctx)->ioctx_offset = (off); \ + (ioctx)->ioctx_xtv = (xtv); \ + (ioctx)->ioctx_xtvlen = (xtvlen); \ (ioctx)->ioctx_cc = 0; \ (ioctx)->ioctx_errno = 0; \ TAILQ_INIT(&(ioctx)->ioctx_cbq); \ @@ -405,6 +407,9 @@ extern TAILQ_HEAD(inodes_head, inode) _s extern TAILQ_HEAD(pnodes_head, pnode) _sysio_pnodes; extern int _sysio_i_init(void); +#if ZERO_SUM_MEMORY +extern void _sysio_i_shutdown(void); +#endif extern struct inode *_sysio_i_new(struct filesys *fs, struct file_identifier *fid, mode_t type, @@ -448,14 +453,43 @@ extern int _sysio_namei(struct pnode *pn struct pnode **pnop); extern int _sysio_p_chdir(struct pnode *pno); extern int _sysio_ioctx_init(void); +extern void _sysio_ioctx_enter(struct ioctx *ioctx); extern struct ioctx *_sysio_ioctx_new(struct inode *ino, const struct iovec *iov, size_t iovlen, - _SYSIO_OFF_T offset); + const struct intnl_xtvec *xtv, + size_t xtvlen); extern int _sysio_ioctx_cb(struct ioctx *ioctx, void (*f)(struct ioctx *, void *), void *data); +extern void _sysio_ioctx_cb_free(struct ioctx_callback *cb); extern struct ioctx *_sysio_ioctx_find(ioid_t id); extern ssize_t _sysio_ioctx_wait(struct ioctx *ioctx); extern void _sysio_ioctx_complete(struct ioctx *ioctx); +extern ssize_t _sysio_validx(const struct intnl_xtvec *xtv, size_t xtvlen, + const struct iovec *iov, size_t iovlen, + _SYSIO_OFF_T limit); +extern ssize_t _sysio_enumerate_extents(const struct intnl_xtvec *xtv, + size_t xtvlen, + const struct iovec *iov, + size_t iovlen, + ssize_t (*f)(const struct iovec *, + int, + _SYSIO_OFF_T, + ssize_t, + void *), + void *arg); +extern ssize_t _sysio_enumerate_iovec(const struct iovec *iov, + size_t count, + _SYSIO_OFF_T off, + ssize_t limit, + ssize_t (*f)(void *, + size_t, + _SYSIO_OFF_T, + void *), + void *arg); +extern ssize_t _sysio_doio(const struct intnl_xtvec *xtv, size_t xtvlen, + const struct iovec *iov, size_t iovlen, + ssize_t (*f)(void *, size_t, _SYSIO_OFF_T, void *), + void *arg); extern int _sysio_open(struct pnode *pno, int flags, mode_t mode); Index: module.mk =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/module.mk,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1 -r1.2 --- module.mk 16 Dec 2003 15:43:14 -0000 1.1 +++ module.mk 6 Feb 2004 20:07:29 -0000 1.2 @@ -1,3 +1,4 @@ INCLUDE_EXTRA = include/dev.h include/file.h include/fs.h \ include/inode.h include/mount.h include/sysio.h \ - include/sysio-symbols.h include/cplant-yod.h include/module.mk + include/sysio-symbols.h include/cplant-yod.h \ + include/module.mk include/xtio.h Index: sysio.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -b -B -p -r1.15 -r1.16 --- sysio.h 21 Jan 2004 14:44:53 -0000 1.15 +++ sysio.h 6 Feb 2004 20:07:29 -0000 1.16 @@ -45,6 +45,7 @@ * System IO common information. */ +#include <limits.h> #include <stdarg.h> #ifndef _IOID_T_DEFINED @@ -81,18 +82,27 @@ typedef void *ioid_t; #ifndef _LARGEFILE64_SOURCE /* - * Not glibc. Define this ourselves. + * Not glibc I guess. Define this ourselves. */ #define _LARGEFILE64_SOURCE 0 #endif /* - * Define internal file-offset type. + * Define internal file-offset type and it's maximum value. */ #if _LARGEFILE64_SOURCE #define _SYSIO_OFF_T off64_t +#ifdef LLONG_MAX +#define _SYSIO_OFF_T_MAX (LLONG_MAX) +#else +/* + * Don't have LLONG_MAX before C99. We'll need to define it ourselves. + */ +#define _SYSIO_OFF_T_MAX (9223372036854775807LL) +#endif #else #define _SYSIO_OFF_T off_t +#define _SYSIO_OFF_T_MAX LONG_MAX #endif /* @@ -127,6 +137,18 @@ struct stat; struct statvfs; struct intnl_statvfs; #endif + +/* + * Internally, all file status is carried in the 64-bit capable + * structure. + */ +#if _LARGEFILE64_SOURCE +#define intnl_xtvec xtvec64 +#else +#define intnl_xtvec xtvec +#endif +struct intnl_xtvec; + struct iovec; struct utimbuf; @@ -219,10 +241,21 @@ extern int iodone(ioid_t ioid); extern ssize_t iowait(ioid_t ioid); extern int iodone(ioid_t ioid); extern ioid_t ipreadv(int fd, const struct iovec *iov, size_t count, - _SYSIO_OFF_T offset); -extern ioid_t ipread(int fd, void *buf, size_t count, _SYSIO_OFF_T offset); + off_t offset); +#if _LARGEFILE64_SOURCE +extern ioid_t ipread64v(int fd, const struct iovec *iov, size_t count, + off64_t offset); +#endif +extern ioid_t ipread(int fd, void *buf, size_t count, off_t offset); +#if _LARGEFILE64_SOURCE +extern ioid_t ipread64(int fd, void *buf, size_t count, off64_t offset); +#endif extern ssize_t preadv(int fd, const struct iovec *iov, size_t count, - _SYSIO_OFF_T offset); + off_t offset); +#if _LARGEFILE64_SOURCE +extern ssize_t pread64v(int fd, const struct iovec *iov, size_t count, + off64_t offset); +#endif extern ssize_t pread(int fd, void *buf, size_t count, off_t offset); #if _LARGEFILE64_SOURCE extern ssize_t pread64(int fd, void *buf, size_t count, off64_t offset); @@ -231,15 +264,22 @@ extern ioid_t ireadv(int fd, const struc extern ioid_t iread(int fd, void *buf, size_t count); extern ssize_t readv(int fd, const struct iovec *iov, int count); extern ssize_t read(int fd, void *buf, size_t count); +extern ioid_t ipwritev(int fd, const struct iovec *iov, size_t count, + off_t offset); #if _LARGEFILE64_SOURCE -extern ssize_t read64(int fd, void *buf, size_t count); +extern ioid_t ipwrite64v(int fd, const struct iovec *iov, size_t count, + off64_t offset); +#endif +extern ioid_t ipwrite(int fd, const void *buf, size_t count, off_t offset); +#if _LARGEFILE64_SOURCE +extern ioid_t ipwrite64(int fd, const void *buf, size_t count, off64_t offset); #endif -extern ioid_t ipwritev(int fd, const struct iovec *iov, size_t count, - _SYSIO_OFF_T offset); -extern ioid_t ipwrite(int fd, const void *buf, size_t count, - _SYSIO_OFF_T offset); extern ssize_t pwritev(int fd, const struct iovec *iov, size_t count, - _SYSIO_OFF_T offset); + off_t offset); +#if _LARGEFILE64_SOURCE +extern ssize_t pwrite64v(int fd, const struct iovec *iov, size_t count, + off64_t offset); +#endif extern ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset); #if _LARGEFILE64_SOURCE extern ssize_t pwrite64(int fd, const void *buf, size_t count, off64_t offset); @@ -248,9 +288,6 @@ extern ioid_t iwritev(int fd, const stru extern ioid_t iwrite(int fd, const void *buf, size_t count); extern ssize_t writev(int fd, const struct iovec *iov, int count); extern ssize_t write(int fd, const void *buf, size_t count); -#if _LARGEFILE64_SOURCE -extern ssize_t write64(int fd, const void *buf, size_t count); -#endif extern int mknod(const char *path, mode_t mode, dev_t dev); extern int utime(const char *path, const struct utimbuf *buf); extern int mount(const char *source, const char *target, |
|
From: Lee W. <lw...@us...> - 2004-02-06 20:10:45
|
Update of /cvsroot/libsysio/libsysio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29990 Modified Files: ChangeLog Rules.make configure.in 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: ChangeLog =================================================================== RCS file: /cvsroot/libsysio/libsysio/ChangeLog,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -b -B -p -r1.3 -r1.4 --- ChangeLog 24 Mar 2003 22:06:38 -0000 1.3 +++ ChangeLog 6 Feb 2004 20:07:28 -0000 1.4 @@ -23,3 +23,9 @@ and other annoying little chicken-and-th *Added support for accessing the pre-opened standard file descriptors 0, 1, and 2 via the stdfd device driver (major number 0, minor 0, 1, and 2). + +--- +Lee -- Mon Jan 26 11:26:14 EST 2004 + +*Altered the internal interface to pass the xtvec (see .../include/xtio.h) in +order to support strided-io. Index: Rules.make =================================================================== RCS file: /cvsroot/libsysio/libsysio/Rules.make,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- Rules.make 21 Jan 2004 14:44:53 -0000 1.5 +++ Rules.make 6 Feb 2004 20:07:28 -0000 1.6 @@ -14,5 +14,5 @@ endif DEV_CPPFLAGS = $(STDFD_DEV_CPPFLAGS) AM_CPPFLAGS = \ - $(AUTOMOUNT) $(DEV_CPPFLAGS) $(SOCKETS_CPPFLAGS) \ + $(AUTOMOUNT) $(ZERO_SUM_MEMORY) $(DEV_CPPFLAGS) $(SOCKETS_CPPFLAGS) \ -I$(top_srcdir)/include Index: configure.in =================================================================== RCS file: /cvsroot/libsysio/libsysio/configure.in,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -b -B -p -r1.15 -r1.16 --- configure.in 21 Jan 2004 14:50:52 -0000 1.15 +++ configure.in 6 Feb 2004 20:07:28 -0000 1.16 @@ -90,6 +90,17 @@ AC_ARG_WITH(stdfd-dev, [with_stdfd_dev=yes]) AM_CONDITIONAL(WITH_STDFD_DEV, test x$with_stdfd_dev = xyes) +AC_ARG_WITH(zero-sum-memory, + AC_HELP_STRING([--with-zero-sum-memory], + [free all dynamically allocated memory at the end -- useful for debugging]), + [ case "${withval}" in + yes) ZERO_SUM_MEMORY=-DZERO_SUM_MEMORY=1 ;; + no) ;; + *) AC_MSG_ERROR(bad value ${withval} for --with-zero-sum-memory) ;; + esac], + [with_zero_sum_memory=no]) +AC_SUBST(ZERO_SUM_MEMORY) + AC_ARG_WITH(cplant_yod, AC_HELP_STRING([--with-cplant-yod],[build cplant yod I/O driver]), [ case "${withval}" in |
|
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-02-06 20:10:45
|
Update of /cvsroot/libsysio/libsysio/drivers/incore In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29990/drivers/incore Modified Files: fs_incore.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: fs_incore.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/incore/fs_incore.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -b -B -p -r1.12 -r1.13 --- fs_incore.c 12 Jan 2004 18:06:11 -0000 1.12 +++ fs_incore.c 6 Feb 2004 20:07:29 -0000 1.13 @@ -142,10 +142,8 @@ static int _sysio_incore_inop_close(stru static int _sysio_incore_dirop_link(struct pnode *old, struct pnode *new); static int _sysio_incore_dirop_unlink(struct pnode *pno); static int _sysio_incore_dirop_rename(struct pnode *old, struct pnode *new); -static int _sysio_incore_filop_ipreadv(struct inode *ino, - struct ioctx *ioctx); -static int _sysio_incore_filop_ipwritev(struct inode *ino, - struct ioctx *ioctx); +static int _sysio_incore_filop_read(struct inode *ino, struct ioctx *ioctx); +static int _sysio_incore_filop_write(struct inode *ino, struct ioctx *ioctx); static int _sysio_incore_filop_iodone(struct ioctx *ioctx); static int _sysio_incore_filop_fcntl(struct inode *ino, int cmd, va_list ap); static int _sysio_incore_inop_sync(struct inode *ino); @@ -168,10 +166,10 @@ static void _sysio_incore_illop(void); (int (*)(struct pnode *, const char *))_sysio_incore_e_nosys #define _sysio_incore_dirop_readlink \ (int (*)(struct pnode *, char *, size_t))_sysio_incore_e_inval -#define _sysio_incore_dirop_ipreadv \ +#define _sysio_incore_dirop_read \ (int (*)(struct inode *, \ struct ioctx *))_sysio_incore_e_isdir -#define _sysio_incore_dirop_ipwritev \ +#define _sysio_incore_dirop_write \ (int (*)(struct inode *, \ struct ioctx *))_sysio_incore_e_isdir #define _sysio_incore_dirop_iodone \ @@ -197,8 +195,8 @@ static struct inode_ops _sysio_incore_di _sysio_incore_dirop_link, _sysio_incore_dirop_unlink, _sysio_incore_dirop_rename, - _sysio_incore_dirop_ipreadv, - _sysio_incore_dirop_ipwritev, + _sysio_incore_dirop_read, + _sysio_incore_dirop_write, _sysio_incore_dirop_iodone, _sysio_incore_dirop_fcntl, _sysio_incore_inop_sync, @@ -252,8 +250,8 @@ static struct inode_ops _sysio_incore_fi _sysio_incore_filop_link, _sysio_incore_filop_unlink, _sysio_incore_filop_rename, - _sysio_incore_filop_ipreadv, - _sysio_incore_filop_ipwritev, + _sysio_incore_filop_read, + _sysio_incore_filop_write, _sysio_incore_filop_iodone, _sysio_incore_filop_fcntl, _sysio_incore_inop_sync, @@ -280,8 +278,8 @@ static struct inode_ops _sysio_incore_de _sysio_incore_filop_link, _sysio_incore_filop_unlink, _sysio_incore_filop_rename, - _sysio_nodev_inop_ipreadv, - _sysio_nodev_inop_ipwritev, + _sysio_nodev_inop_read, + _sysio_nodev_inop_write, _sysio_nodev_inop_iodone, _sysio_incore_filop_fcntl, _sysio_incore_inop_sync, @@ -622,6 +620,8 @@ _sysio_incore_fsswop_mount(const char *s /* * Create root for system. + * + * Persistent across remounts because we ask for immunity. */ rooti = _sysio_i_new(fs, @@ -1153,6 +1153,8 @@ _sysio_incore_dirop_mkdir(struct pnode * /* * Tell the system about the new inode. + * + * Persistent across remounts because we ask for immunity. */ ino = _sysio_i_new(pno->p_parent->p_base->pb_ino->i_fs, @@ -1474,34 +1476,20 @@ _sysio_incore_dirop_unlink(struct pnode } static int -incore_doio(ssize_t (*f)(struct incore_inode *, off_t, char *, size_t), +doio(ssize_t (*f)(void *, size_t, _SYSIO_OFF_T, struct incore_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)(I2IC(ino), - ioctx->ioctx_offset, - iov->iov_base, - iov->iov_len); - if (cc <= 0) - break; - ioctx->ioctx_cc += cc; - } - 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, + I2IC(ino)); + if (ioctx->ioctx_cc < 0) { + ioctx->ioctx_errno = -ioctx->ioctx_cc; ioctx->ioctx_cc = -1; - ioctx->ioctx_errno = -cc; } - ioctx->ioctx_done = 1; return 0; @@ -1508,63 +1496,70 @@ incore_doio(ssize_t (*f)(struct incore_i } static ssize_t -incore_read(struct incore_inode *icino, off_t off, char *buf, size_t nbytes) +incore_read(void *buf, size_t nbytes, + _SYSIO_OFF_T off, + struct incore_inode *icino) { - _SYSIO_OFF_T n; + size_t n; + if (off < 0) + return -EINVAL; if (!nbytes || off > icino->ici_st.st_size) return 0; - n = (_SYSIO_OFF_T )nbytes; - if (!(n > 0 && (size_t )n == nbytes)) - return -EINVAL; - if (n > icino->ici_st.st_size - off) - n = icino->ici_st.st_size - off; + n = icino->ici_st.st_size - (size_t )off; + if (n > nbytes) + n = nbytes; (void )memcpy(buf, icino->ici_data + off, (size_t )n); return (ssize_t )n; } static int -_sysio_incore_filop_ipreadv(struct inode *ino, - struct ioctx *ioctx) +_sysio_incore_filop_read(struct inode *ino, struct ioctx *ioctx) { - return incore_doio(incore_read, ino, ioctx); + + return doio(incore_read, ino, ioctx); } static ssize_t -incore_write(struct incore_inode *icino, - off_t off, - const char *buf, - size_t nbytes) +incore_write(const void *buf, size_t nbytes, + _SYSIO_OFF_T off, + struct incore_inode *icino) { - int err; - _SYSIO_OFF_T n; + _SYSIO_OFF_T pos; - if (!nbytes) - return 0; - n = (_SYSIO_OFF_T )nbytes; - if (!(n > 0 && (size_t )n == nbytes)) + if (off < 0) return -EINVAL; - if (off + n > icino->ici_st.st_size) { - err = incore_trunc(icino, (size_t )(off + n), 0); + if (!nbytes || off > icino->ici_st.st_size) + return 0; + pos = off + nbytes; + if (off && pos <= off) { + /* + * It's all or nothing. We won't write just part of + * the buffer. + */ + return -EFBIG; + } + if (pos > icino->ici_st.st_size) { + int err; + + err = incore_trunc(icino, (size_t )pos, 0); if (err) return err; } - (void )memcpy(icino->ici_data + off, buf, (size_t )n); + (void )memcpy(icino->ici_data + off, buf, nbytes); - return (ssize_t )n; + return (ssize_t )nbytes; } static int -_sysio_incore_filop_ipwritev(struct inode *ino, - struct ioctx *ioctx) +_sysio_incore_filop_write(struct inode *ino, struct ioctx *ioctx) { - return incore_doio((ssize_t (*)(struct incore_inode *, - off_t, - char *, - size_t))incore_write, + return doio((ssize_t (*)(void *, size_t, + _SYSIO_OFF_T, + struct incore_inode *))incore_write, ino, ioctx); } |
|
From: Lee W. <lw...@us...> - 2004-02-06 20:10:45
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29990/drivers/native Modified Files: fs_native.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: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -w -b -B -p -r1.29 -r1.30 --- fs_native.c 26 Jan 2004 16:34:53 -0000 1.29 +++ fs_native.c 6 Feb 2004 20:07:29 -0000 1.30 @@ -9,7 +9,7 @@ * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * - * Cplant(TM) Copyright 1998-2003 Sandia Corporation. + * Cplant(TM) Copyright 1998-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 @@ -66,11 +66,15 @@ #endif #include <utime.h> #include <sys/queue.h> +#if !(defined(REDSTORM) || defined(MAX_IOVEC)) +#include <limits.h> +#endif #include "sysio.h" #include "fs.h" #include "mount.h" #include "inode.h" +#include "xtio.h" #include "fs_native.h" @@ -78,17 +82,6 @@ #include <sys/uio.h> #endif -#ifdef REDSTORM -/* - * The cnos IO routines on Red Storm can't do scatter/gather IO. We - * must use a different interface, then. The doio() routine will loop - * over the vector entries. - */ -typedef ssize_t (*iof)(int, void *, size_t, _SYSIO_OFF_T); -#else -typedef ssize_t (*iof)(int, const struct iovec *, int); -#endif - /* * Local host file system driver. */ @@ -183,12 +176,22 @@ struct native_inode_identifier { * system objects. */ struct native_inode { + unsigned + ni_seekok : 1; /* can seek? */ struct native_inode_identifier ni_ident; /* unique identifier */ struct file_identifier ni_fileid; /* ditto */ int ni_fd; /* host fildes */ int ni_oflags; /* flags, from open */ unsigned ni_nopens; /* soft ref count */ - off_t ni_fpos; /* current pos */ + _SYSIO_OFF_T ni_fpos; /* current pos */ +}; + +/* + * Native IO path arguments. + */ +struct native_io { + char nio_op; /* 'r' or 'w' */ + struct native_inode *nio_nino; /* native ino */ }; static int native_inop_lookup(struct pnode *pno, @@ -215,10 +218,8 @@ static int native_inop_close(struct inod static int native_inop_link(struct pnode *old, struct pnode *new); static int native_inop_unlink(struct pnode *pno); static int native_inop_rename(struct pnode *old, struct pnode *new); -static int native_inop_ipreadv(struct inode *ino, - struct ioctx *ioctx); -static int native_inop_ipwritev(struct inode *ino, - struct ioctx *ioctx); +static int native_inop_read(struct inode *ino, struct ioctx *ioctx); +static int native_inop_write(struct inode *ino, struct ioctx *ioctx); 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_sync(struct inode *ino); @@ -248,8 +249,8 @@ static struct inode_ops native_i_ops = { native_inop_link, native_inop_unlink, native_inop_rename, - native_inop_ipreadv, - native_inop_ipwritev, + native_inop_read, + native_inop_write, native_inop_iodone, native_inop_fcntl, native_inop_sync, @@ -841,40 +842,37 @@ out: } static int -native_pos(int fd, -#if _LARGEFILE64_SOURCE - loff_t *offset -#else - _SYSIO_OFF_T *offset -#endif - ) +native_pos(int fd, _SYSIO_OFF_T *offset, int whence) { + _SYSIO_OFF_T off; assert(fd >= 0); assert(*offset >= 0); + off = *offset; #if _LARGEFILE64_SOURCE && defined(SYS__llseek) { int err; err = syscall(SYS__llseek, (unsigned int)fd, - (unsigned int)(*offset >> 32), - (unsigned int)*offset, - offset, - SEEK_SET); + (unsigned int)(off >> 32), + (unsigned int)off, + &off, + whence); if (err == -1) return -errno; } #else - *offset = + off = syscall(SYS_lseek, fd, - *offset, - SEEK_SET); - if (*offset == -1) + off, + whence); + if (off == -1) return -errno; #endif + *offset = off; return 0; } @@ -889,12 +886,8 @@ native_getdirentries(struct inode *ino, struct native_inode *nino = I2NI(ino); int err; #ifndef SYS_getdirentries -#if _LARGEFILE64_SOURCE - loff_t result; -#else _SYSIO_OFF_T result; #endif -#endif ssize_t cc; assert(nino->ni_fd >= 0); @@ -902,7 +895,7 @@ native_getdirentries(struct inode *ino, #ifndef SYS_getdirentries result = *basep; if (*basep != nino->ni_fpos) { - err = native_pos(nino->ni_fd, &result); + err = native_pos(nino->ni_fd, &result, SEEK_SET); if (err) return err; } @@ -1013,6 +1006,9 @@ native_inop_open(struct pnode *pno, int flags &= ~O_WRONLY; flags |= O_RDWR; } +#ifdef O_LARGEFILE + flags |= O_LARGEFILE; +#endif fd = syscall(SYS_open, path, flags, mode); if (!pno->p_base->pb_ino && fd >= 0) { int err; @@ -1059,6 +1055,12 @@ native_inop_open(struct pnode *pno, int */ nino->ni_fpos = 0; nino->ni_fd = fd; + /* + * Need to know whether we can seek on this + * descriptor. + */ + nino->ni_seekok = + native_pos(nino->ni_fd, &nino->ni_fpos, SEEK_CUR) != 0 ? 0 : 1; return 0; } @@ -1146,183 +1148,251 @@ native_inop_unlink(struct pnode *pno) return err; } -/* - * A helper function performing the real IO operation work. - * - * We don't really have async IO. We'll just perform the function - * now. - */ static int -doio(iof f, - struct inode *ino, - struct ioctx *ioctx) +native_inop_rename(struct pnode *old, struct pnode *new) { - struct native_inode *nino = I2NI(ino); -#ifndef REDSTORM -#if _LARGEFILE64_SOURCE - loff_t result; -#else - _SYSIO_OFF_T result; -#endif -#endif + int err; + char *opath, *npath; - assert(nino->ni_fd >= 0); + opath = _sysio_pb_path(old->p_base, '/'); + npath = _sysio_pb_path(new->p_base, '/'); + if (!(opath && npath)) { + err = -ENOMEM; + goto out; + } - if ((ioctx->ioctx_iovlen && (int )ioctx->ioctx_iovlen < 0) || - !(S_ISREG(ino->i_mode) || - S_ISCHR(ino->i_mode) || - S_ISSOCK(ino->i_mode) || - S_ISFIFO(ino->i_mode))) - return -EINVAL; + err = syscall(SYS_rename, opath, npath); + +out: + if (opath) + free(opath); + if (npath) + free(npath); + + return err; +} + +static ssize_t +dopio(void *buf, size_t count, _SYSIO_OFF_T off, struct native_io *nio) +{ -#ifndef REDSTORM /* - * This implementation first positions the real system descriptor, then - * performs the operation. This is not atomic. - * - * An alternative, more complex, less efficient but atomic, - * implementation might consider each entry of the iovec separately. - * Then, the system implementations of the POSIX p{reaad,write} calls - * could be used. - * * Avoid the reposition call if we're already at the right place. * Allows us to access pipes and fifos. */ - result = ioctx->ioctx_offset; - if (ioctx->ioctx_offset != nino->ni_fpos) { + if (off != nio->nio_nino->ni_fpos) { int err; - err = native_pos(nino->ni_fd, &result); - if (err) { - ioctx->ioctx_cc = -1; - ioctx->ioctx_errno = -err; - goto out; + err = native_pos(nio->nio_nino->ni_fd, &off, SEEK_SET); + if (err) + return err; + nio->nio_nino->ni_fpos = off; } - nino->ni_fpos = result; + + return syscall(nio->nio_op == 'r' ? SYS_read : SYS_write, + nio->nio_nino->ni_fd, + buf, + count); } -#endif - /* - * Call the appropriate (read/write) IO function to - * transfer the data now. - */ -#ifdef REDSTORM +static ssize_t +doiov(const struct iovec *iov, + int count, + _SYSIO_OFF_T off, + ssize_t limit, + struct native_io *nio) { - size_t count = ioctx->ioctx_iovlen; - struct iovec *iov = ioctx->ioctx_iovec; ssize_t cc; - nino->ni_fpos = ioctx->ioctx_offset; - while (count) { - cc = - (*f)(nino->ni_fd, - iov->iov_base, - iov->iov_len, - nino->ni_fpos); - if (cc < 0) { - if (ioctx->ioctx_cc) { +#if !(defined(REDSTORM) || defined(MAX_IOVEC)) +#define MAX_IOVEC INT_MAX +#endif + + if (count <= 0) + return -EINVAL; + /* - * No data written at all. Return - * error. + * Avoid the reposition call if we're already at the right place. + * Allows us to access pipes and fifos. */ - ioctx->ioctx_cc = -1; - } - break; - } - ioctx->ioctx_cc += cc; - count--, iov++; - } - } -#else /* !defined(REDSTORM) */ - ioctx->ioctx_cc = - (*f)(nino->ni_fd, ioctx->ioctx_iovec, ioctx->ioctx_iovlen); -#endif /* defined(REDSTORM) */ - if (ioctx->ioctx_cc < 0) - ioctx->ioctx_errno = errno; - if (ioctx->ioctx_cc > 0) - nino->ni_fpos += ioctx->ioctx_cc; + if (off != nio->nio_nino->ni_fpos) { + int err; -out: - ioctx->ioctx_done = 1; - return 0; + err = native_pos(nio->nio_nino->ni_fd, &off, SEEK_SET); + if (err) + return err; + nio->nio_nino->ni_fpos = off; } /* - * Helper function passed to doio(), above, to accomplish a real readv. + * The {read,write}v is safe as this routine is only ever called + * by _sysio_enumerate_extents() and that routine is exact. It never + * passes iovectors including tails. */ -#ifdef REDSTORM -static ssize_t -native_read(int fd, void *buf, size_t count, _SYSIO_OFF_T offset) -{ - - return syscall(SYS_pread, fd, buf, count, offset); -} -#else -static ssize_t -native_read(int fd, const struct iovec *vector, int count) -{ + cc = +#ifndef REDSTORM + count <= MAX_IOVEC + ? syscall(nio->nio_op == 'r' ? SYS_readv : SYS_writev, + nio->nio_nino->ni_fd, + iov, + count) + : +#endif + _sysio_enumerate_iovec(iov, + count, + off, + limit, + (ssize_t (*)(void *, + size_t, + _SYSIO_OFF_T, + void *))dopio, + nio); + if (cc > 0) + nio->nio_nino->ni_fpos += cc; + return cc; - return syscall(SYS_readv, fd, vector, count); -} +#if !(defined(REDSTORM) || defined(MAX_IOVEC)) +#undef MAX_IOVEC #endif +} +#if 0 static int -native_inop_rename(struct pnode *old, struct pnode *new) +lockop_all(struct native_inode *nino, + struct intnl_xtvec *xtv, + size_t count, + short op) { + struct flock flock; int err; - char *opath, *npath; - opath = _sysio_pb_path(old->p_base, '/'); - npath = _sysio_pb_path(new->p_base, '/'); - if (!(opath && npath)) { - err = -ENOMEM; - goto out; + if (!count) + return -EINVAL; + flock.l_type = op; + flock.l_whence = SEEK_SET; + while (count--) { + flock.l_start = xtv->xtv_off; + flock.l_len = xtv->xtv_len; + xtv++; + err = + syscall( +#if !_LARGEFILE64_SOURCE + SYS_fcntl64 +#else + SYS_fcntl +#endif + , + nino->ni_fd, + F_SETLK, + &flock); + if (err != 0) + return -errno; + } + return 0; } - err = syscall(SYS_rename, opath, npath); - -out: - if (opath) - free(opath); - if (npath) - free(npath); +static int +order_xtv(const struct intnl_xtvec *xtv1, const struct intnl_xtvec *xtv2) +{ - return err; + if (xtv1->xtv_off < xtv2->xtv_off) + return -1; + if (xtv1->xtv_off > xtv2->xtv_off) + return 1; + return 0; } +#endif static int -native_inop_ipreadv(struct inode *ino, - struct ioctx *ioctx) +doio(char op, struct ioctx *ioctx) { + struct native_inode *nino; +#if 0 + int dolocks; + struct intnl_xtvec *oxtv; + int err; +#endif + struct native_io arguments; + ssize_t cc; +#if 0 + struct intnl_xtvec *front, *rear, tmp; +#endif - return doio(native_read, ino, ioctx); + nino = I2NI(ioctx->ioctx_ino); +#if 0 + dolocks = ioctx->ioctx_xtvlen > 1 && nino->ni_seekok; + if (dolocks) { + /* + * Must lock the regions (in order!) since we can't do + * strided-IO as a single atomic operation. + */ + oxtv = malloc(ioctx->ioctx_xtvlen * sizeof(struct intnl_xtvec)); + if (!oxtv) + return -ENOMEM; + (void )memcpy(oxtv, + ioctx->ioctx_xtv, + ioctx->ioctx_xtvlen * sizeof(struct intnl_xtvec)); + qsort(oxtv, + ioctx->ioctx_xtvlen, + sizeof(struct intnl_xtvec), + (int (*)(const void *, const void *))order_xtv); + err = + lockop_all(nino, + oxtv, ioctx->ioctx_xtvlen, + op == 'r' ? F_RDLCK : F_WRLCK); + if (err) { + free(oxtv); + return err; } - + } +#endif + arguments.nio_op = op; + arguments.nio_nino = nino; + cc = + _sysio_enumerate_extents(ioctx->ioctx_xtv, ioctx->ioctx_xtvlen, + ioctx->ioctx_iov, ioctx->ioctx_iovlen, + (ssize_t (*)(const struct iovec *, + int, + _SYSIO_OFF_T, + ssize_t, + void *))doiov, + &arguments); +#if 0 + if (dolocks) { /* - * Helper function passed to doio(), above, to accomplish a real writev. + * Must unlock in reverse order. */ -#ifdef REDSTORM -static ssize_t -native_write(int fd, void *buf, size_t count, _SYSIO_OFF_T offset) -{ - - return syscall(SYS_pwrite, fd, buf, count, offset); + front = oxtv; + rear = front + ioctx->ioctx_xtvlen - 1; + while (front < rear) { + tmp = *front; + *front++ = *rear; + *rear-- = tmp; } -#else -static ssize_t -native_write(int fd, const struct iovec *vector, int count) + if (lockop_all(nino, oxtv, ioctx->ioctx_xtvlen, F_UNLCK) != 0) + abort(); + free(oxtv); + } +#endif + if ((ioctx->ioctx_cc = cc) < 0) { + ioctx->ioctx_errno = -ioctx->ioctx_cc; + ioctx->ioctx_cc = -1; + } + return 0; +} + +static int +native_inop_read(struct inode *ino __IS_UNUSED, struct ioctx *ioctx) { - return syscall(SYS_writev, fd, vector, count); + return doio('r', ioctx); } -#endif static int -native_inop_ipwritev(struct inode *ino, - struct ioctx *ioctx) +native_inop_write(struct inode *ino __IS_UNUSED, struct ioctx *ioctx) { - return doio(native_write, ino, ioctx); + return doio('w', ioctx); } static int @@ -1361,9 +1431,9 @@ native_inop_fcntl(struct inode *ino, arg = va_arg(ap, long); return syscall(SYS_fcntl, nino->ni_fd, cmd, arg); default: - abort(); + break; } - return -1; + return -EINVAL; } static int |
|
From: Ruth K. <rk...@us...> - 2004-02-04 17:42:30
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23082 Modified Files: Tag: strided-io rw.c Log Message: type mismatch causing warnings on alpha Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/Attic/rw.c,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -w -b -B -p -r1.1.2.7 -r1.1.2.8 --- rw.c 2 Feb 2004 16:22:32 -0000 1.1.2.7 +++ rw.c 4 Feb 2004 17:40:02 -0000 1.1.2.8 @@ -81,7 +81,7 @@ * passing them in a structure. */ static int -_sysio_iiox(ssize_t (*f)(struct inode *, struct ioctx *), +_sysio_iiox(int (*f)(struct inode *, struct ioctx *), struct file *fil, const struct iovec *iov, size_t iov_count, @@ -195,7 +195,7 @@ _sysio_sum_iovec(const struct iovec *iov * Asynch IO from/to iovec from/to current file offset. */ static int -_sysio_iiov(ssize_t (*f)(struct inode *, struct ioctx *), +_sysio_iiov(int (*f)(struct inode *, struct ioctx *), struct file *fil, const struct iovec *iov, int count, @@ -421,7 +421,7 @@ sysio_sym_weak_alias(read, __libc_read) * Asynch IO between iovec and data at the given offset. */ static int -_sysio_ipiov(ssize_t (*f)(struct inode *, struct ioctx *), +_sysio_ipiov(int (*f)(struct inode *, struct ioctx *), struct file *fil, const struct iovec *iov, int count, |
|
From: Ruth K. <rk...@us...> - 2004-02-04 17:41:26
|
Update of /cvsroot/libsysio/libsysio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22698 Modified Files: Tag: strided-io configure.in Log Message: typo in var name Index: configure.in =================================================================== RCS file: /cvsroot/libsysio/libsysio/configure.in,v retrieving revision 1.12.6.3 retrieving revision 1.12.6.4 diff -u -w -b -B -p -r1.12.6.3 -r1.12.6.4 --- configure.in 27 Jan 2004 21:33:44 -0000 1.12.6.3 +++ configure.in 4 Feb 2004 17:39:01 -0000 1.12.6.4 @@ -98,7 +98,7 @@ AC_ARG_WITH(zero-sum-memory, no) ;; *) AC_MSG_ERROR(bad value ${withval} for --with-zero-sum-memory) ;; esac], - [with_zero-sum-memory=no]) + [with_zero_sum_memory=no]) AC_SUBST(ZERO_SUM_MEMORY) AC_ARG_WITH(cplant_yod, |
|
From: Lee W. <lw...@us...> - 2004-02-04 02:57:32
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2483 Modified Files: Tag: strided-io fs_native.c Log Message: Ifdef'd out the locking code. It's inapprorpiate and problematic. Good riidance. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.25.6.8 retrieving revision 1.25.6.9 diff -u -w -b -B -p -r1.25.6.8 -r1.25.6.9 --- fs_native.c 30 Jan 2004 19:55:33 -0000 1.25.6.8 +++ fs_native.c 3 Feb 2004 18:32:49 -0000 1.25.6.9 @@ -1256,6 +1256,7 @@ doiov(const struct iovec *iov, #endif } +#if 0 static int lockop_all(struct native_inode *nino, struct intnl_xtvec *xtv, @@ -1300,19 +1301,25 @@ order_xtv(const struct intnl_xtvec *xtv1 return 1; return 0; } +#endif static int doio(char op, struct ioctx *ioctx) { struct native_inode *nino; +#if 0 int dolocks; struct intnl_xtvec *oxtv; int err; +#endif struct native_io arguments; ssize_t cc; +#if 0 struct intnl_xtvec *front, *rear, tmp; +#endif nino = I2NI(ioctx->ioctx_ino); +#if 0 dolocks = ioctx->ioctx_xtvlen > 1 && nino->ni_seekok; if (dolocks) { /* @@ -1338,6 +1345,7 @@ doio(char op, struct ioctx *ioctx) return err; } } +#endif arguments.nio_op = op; arguments.nio_nino = nino; cc = @@ -1349,6 +1357,7 @@ doio(char op, struct ioctx *ioctx) ssize_t, void *))doiov, &arguments); +#if 0 if (dolocks) { /* * Must unlock in reverse order. @@ -1364,6 +1373,7 @@ doio(char op, struct ioctx *ioctx) abort(); free(oxtv); } +#endif if ((ioctx->ioctx_cc = cc) < 0) { ioctx->ioctx_errno = -ioctx->ioctx_cc; ioctx->ioctx_cc = -1; |
|
From: Lee W. <le...@sa...> - 2004-02-02 21:34:22
|
All, On Friday, Feb 6 I intend to merge the strided-io branch into the HEAD. This is a disruptive merge so I wanted to give everyone some warning. For a list of changes and how they might affect the drivers, see the cvs log for .../src/rw.c in the strided-io branch. If you are going to have a problem because of this and need some delay, please drop me a note. Thanks. --Lee -- Lee Ward <le...@sa...> Sandia National Laboratories |
|
From: Sonja T. <so...@us...> - 2004-02-02 17:44:34
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30958 Modified Files: Tag: strided-io test_rw.pl Log Message: Removed useless comments Index: test_rw.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Attic/test_rw.pl,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 --- test_rw.pl 2 Feb 2004 17:41:28 -0000 1.1.2.3 +++ test_rw.pl 2 Feb 2004 17:42:30 -0000 1.1.2.4 @@ -191,9 +191,7 @@ sub do_rwcalls verify_result($cmdfh, $outfh, "ipwrite", $IOID_FAIL, "=="); do_iowait($cmdfh, $outfh, '$id3', "ipwrite", $bufsize); - # Set up the buffers again $iovcnt++; - #$iovname = set_iovecs($cmdfh, $outfh, $iovcnt); # pwritev using 8 8K buffers at offset 384 $offset = 384 * 1024; @@ -212,9 +210,7 @@ sub do_rwcalls my $xtvcnt = 0; my $xtvname = set_xtvecs($cmdfh, $outfh, $xtvcnt, 512 * 1024); - # Have to re-setup the iovecs $iovcnt++; - #$iovname = set_iovecs($cmdfh, $outfh, $iovcnt); # Call writex using 8 8k buffers at offset 512 $cmdstr = 'CALL writex $fd $'."$iovname $NUMVECS ".'$'."$xtvname 2\n"; @@ -227,9 +223,7 @@ sub do_rwcalls $xtvcnt++; $xtvname = set_xtvecs($cmdfh, $outfh, $xtvcnt, 576 * 1024); - # And we also need to set up the iovs again $iovcnt++; - #$iovname = set_iovecs($cmdfh, $outfh, $iovcnt); $cmdstr = '$id5 = CALL iwritex $fd $'."$iovname $NUMVECS ".'$'."$xtvname 2\n"; helper::send_cmd($cmdfh, $outfh, "iwritex", $cmdstr); @@ -262,9 +256,7 @@ sub do_rwcalls do_iowait($cmdfh, $outfh, '$id6', "iread", $bufsize); check_buf($cmdfh, $outfh, $bufsize, "iread"); - # Set up the iovecs $iovcnt++; - #$iovname = set_iovecs($cmdfh, $outfh, $iovcnt); # readv 64K bytes using 8 iovecs at pos 128K $cmdstr = 'CALL readv $fd $'."$iovname $NUMVECS\n"; @@ -296,7 +288,6 @@ sub do_rwcalls $iovcnt++; - #$iovname = set_iovecs($cmdfh, $outfh, $iovcnt); # preadv using 8 8K buffers at offset 384 $offset = 384 * 1024; @@ -318,7 +309,6 @@ sub do_rwcalls $xtvname = set_xtvecs($cmdfh, $outfh, $xtvcnt, 512 * 1024); $iovcnt++; - #$iovname = set_iovecs($cmdfh, $outfh, $iovcnt); # Call readx using 8 8k buffers at offset 512 $cmdstr = 'CALL readx $fd $'."$iovname $NUMVECS ".'$'."$xtvname 2\n"; @@ -332,9 +322,7 @@ sub do_rwcalls $xtvcnt++; $xtvname = set_xtvecs($cmdfh, $outfh, $xtvcnt, 576 * 1024); - # And we also need to set up the iovs again $iovcnt++; - #$iovname = set_iovecs($cmdfh, $outfh, $iovcnt); $cmdstr = '$id10 = CALL ireadx $fd $'."$iovname $NUMVECS ".'$'."$xtvname 2\n"; helper::send_cmd($cmdfh, $outfh, "ireadx", $cmdstr); |
|
From: Sonja T. <so...@us...> - 2004-02-02 17:43:35
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29469 Modified Files: Tag: strided-io test_driver.c test_rw.pl Log Message: Fixed bug in test_driver Index: test_driver.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_driver.c,v retrieving revision 1.4.6.2 retrieving revision 1.4.6.3 diff -u -w -b -B -p -r1.4.6.2 -r1.4.6.3 --- test_driver.c 30 Jan 2004 19:55:33 -0000 1.4.6.2 +++ test_driver.c 2 Feb 2004 17:41:28 -0000 1.4.6.3 @@ -318,7 +318,7 @@ void store_result(char *var_name, int re } else new_map = &map[index]; - new_map->map.name = malloc(sizeof(var_name) + 1); + new_map->map.name = malloc(strlen(var_name) + 1); strcpy(new_map->map.name, var_name); new_map->map.obj = result; new_map->map.type = last_type; Index: test_rw.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Attic/test_rw.pl,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 --- test_rw.pl 2 Feb 2004 16:22:52 -0000 1.1.2.2 +++ test_rw.pl 2 Feb 2004 17:41:28 -0000 1.1.2.3 @@ -193,7 +193,7 @@ sub do_rwcalls # Set up the buffers again $iovcnt++; - $iovname = set_iovecs($cmdfh, $outfh, $iovcnt); + #$iovname = set_iovecs($cmdfh, $outfh, $iovcnt); # pwritev using 8 8K buffers at offset 384 $offset = 384 * 1024; @@ -214,7 +214,7 @@ sub do_rwcalls # Have to re-setup the iovecs $iovcnt++; - $iovname = set_iovecs($cmdfh, $outfh, $iovcnt); + #$iovname = set_iovecs($cmdfh, $outfh, $iovcnt); # Call writex using 8 8k buffers at offset 512 $cmdstr = 'CALL writex $fd $'."$iovname $NUMVECS ".'$'."$xtvname 2\n"; @@ -229,7 +229,7 @@ sub do_rwcalls # And we also need to set up the iovs again $iovcnt++; - $iovname = set_iovecs($cmdfh, $outfh, $iovcnt); + #$iovname = set_iovecs($cmdfh, $outfh, $iovcnt); $cmdstr = '$id5 = CALL iwritex $fd $'."$iovname $NUMVECS ".'$'."$xtvname 2\n"; helper::send_cmd($cmdfh, $outfh, "iwritex", $cmdstr); @@ -264,7 +264,7 @@ sub do_rwcalls # Set up the iovecs $iovcnt++; - $iovname = set_iovecs($cmdfh, $outfh, $iovcnt); + #$iovname = set_iovecs($cmdfh, $outfh, $iovcnt); # readv 64K bytes using 8 iovecs at pos 128K $cmdstr = 'CALL readv $fd $'."$iovname $NUMVECS\n"; @@ -296,7 +296,7 @@ sub do_rwcalls $iovcnt++; - $iovname = set_iovecs($cmdfh, $outfh, $iovcnt); + #$iovname = set_iovecs($cmdfh, $outfh, $iovcnt); # preadv using 8 8K buffers at offset 384 $offset = 384 * 1024; @@ -318,7 +318,7 @@ sub do_rwcalls $xtvname = set_xtvecs($cmdfh, $outfh, $xtvcnt, 512 * 1024); $iovcnt++; - $iovname = set_iovecs($cmdfh, $outfh, $iovcnt); + #$iovname = set_iovecs($cmdfh, $outfh, $iovcnt); # Call readx using 8 8k buffers at offset 512 $cmdstr = 'CALL readx $fd $'."$iovname $NUMVECS ".'$'."$xtvname 2\n"; @@ -334,7 +334,7 @@ sub do_rwcalls # And we also need to set up the iovs again $iovcnt++; - $iovname = set_iovecs($cmdfh, $outfh, $iovcnt); + #$iovname = set_iovecs($cmdfh, $outfh, $iovcnt); $cmdstr = '$id10 = CALL ireadx $fd $'."$iovname $NUMVECS ".'$'."$xtvname 2\n"; helper::send_cmd($cmdfh, $outfh, "ireadx", $cmdstr); |
|
From: Sonja T. <so...@us...> - 2004-02-02 16:25:01
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29001/tests Modified Files: Tag: strided-io test_rw.pl Log Message: Fixing comments. Adding check to verify open worked Index: test_rw.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Attic/test_rw.pl,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 --- test_rw.pl 30 Jan 2004 19:55:33 -0000 1.1.2.1 +++ test_rw.pl 2 Feb 2004 16:22:52 -0000 1.1.2.2 @@ -191,8 +191,7 @@ sub do_rwcalls verify_result($cmdfh, $outfh, "ipwrite", $IOID_FAIL, "=="); do_iowait($cmdfh, $outfh, '$id3', "ipwrite", $bufsize); - # Set up the buffers again since iwritev kindly blew them away - # for us... + # Set up the buffers again $iovcnt++; $iovname = set_iovecs($cmdfh, $outfh, $iovcnt); @@ -213,7 +212,7 @@ sub do_rwcalls my $xtvcnt = 0; my $xtvname = set_xtvecs($cmdfh, $outfh, $xtvcnt, 512 * 1024); - # Have to re-setup the iovecs (again..) + # Have to re-setup the iovecs $iovcnt++; $iovname = set_iovecs($cmdfh, $outfh, $iovcnt); @@ -295,8 +294,7 @@ sub do_rwcalls do_iowait($cmdfh, $outfh, '$id8', "ipread", $bufsize); check_buf($cmdfh, $outfh, $bufsize, "ipread"); - # Set up the buffers again since iwritev kindly blew them away - # for us... + $iovcnt++; $iovname = set_iovecs($cmdfh, $outfh, $iovcnt); @@ -319,7 +317,6 @@ sub do_rwcalls $xtvcnt++; $xtvname = set_xtvecs($cmdfh, $outfh, $xtvcnt, 512 * 1024); - # Have to re-setup the iovecs (again..) $iovcnt++; $iovname = set_iovecs($cmdfh, $outfh, $iovcnt); @@ -383,6 +380,7 @@ sub process_cmd # Open file my $cmdstr = '$fd = CALL open '."$file O_RDWR|O_CREAT 0777\n"; helper::send_cmd($cmdfh, $outfh, "open", $cmdstr); + helper::verify_cmd($cmdfh, $outfh, $cmdstr); # Allocate buffer |
|
From: Lee W. <lw...@us...> - 2004-02-02 16:24:36
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28435 Modified Files: Tag: strided-io rw.c Log Message: The free_xtv() routine would free the iovec, instead of the xtvec. From Sonja Tideman. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/Attic/rw.c,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -u -w -b -B -p -r1.1.2.6 -r1.1.2.7 --- rw.c 29 Jan 2004 18:45:49 -0000 1.1.2.6 +++ rw.c 2 Feb 2004 16:22:32 -0000 1.1.2.7 @@ -238,7 +238,7 @@ static void free_xtv(struct ioctx *ioctx) { - free((struct iovec *)ioctx->ioctx_iov); + free((struct iovec *)ioctx->ioctx_xtv); ioctx->ioctx_iov = NULL; } |
|
From: Sonja T. <so...@us...> - 2004-01-31 02:57:00
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3213/src Modified Files: Tag: strided-io rw.c Log Message: Fixed bug in iwrite and iread where the byte count was being passed in as the iovec count Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/Attic/rw.c,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -u -w -b -B -p -r1.1.2.5 -r1.1.2.6 --- rw.c 28 Jan 2004 04:49:35 -0000 1.1.2.5 +++ rw.c 29 Jan 2004 18:45:49 -0000 1.1.2.6 @@ -362,7 +362,7 @@ iread(int fd, void *buf, size_t count) err = _sysio_iiov(fil->f_ino->i_ops.inop_read, fil, - iov, count, free_iov, + iov, 1, free_iov, xtv, free_xtv, &ioctx); if (err) { @@ -915,7 +915,7 @@ iwrite(int fd, const void *buf, size_t c err = _sysio_iiov(fil->f_ino->i_ops.inop_write, fil, - iov, count, free_iov, + iov, 1, free_iov, xtv, free_xtv, &ioctx); if (err) { |
|
From: Sonja T. <so...@us...> - 2004-01-30 21:56:03
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25378/src Modified Files: Tag: namespace_assembly init.c module.mk Removed Files: Tag: namespace_assembly command.c parser.c Log Message: Cleaned up namespace_assembly code. Accepts commands with arbitrary ws in them. Also moved 'put' command to just be a part of the creat command Index: init.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/init.c,v retrieving revision 1.3.12.1 retrieving revision 1.3.12.2 diff -u -w -b -B -p -r1.3.12.1 -r1.3.12.2 --- init.c 28 Jan 2004 13:16:56 -0000 1.3.12.1 +++ init.c 30 Jan 2004 21:54:22 -0000 1.3.12.2 @@ -46,6 +46,9 @@ #include <sys/types.h> #include <sys/queue.h> +#include <sys/stat.h> +#include <fcntl.h> + #include "sysio.h" #include "inode.h" #include "mount.h" @@ -56,6 +59,25 @@ #include "stdfd.h" #endif +struct arg_list; + +struct arg_list { + char arg_name[4]; /* Argument specifier */ + char* arg; /* Arbitray length arg value*/ + struct arg_list *next; +}; + +/* Command structure (well, duh... */ +struct command_t { + char command[6]; + struct arg_list *args; +}; + +struct command_function_t { + char *cmd; + int (*func)(struct arg_list *args); +}; + /* * Sysio library initialization. Must be called before anything else in the * library. @@ -114,3 +136,670 @@ _sysio_shutdown() _sysio_unmount_all() == 0)) abort(); } + + +/* + * Determines if the ch character is in the string + * set. If it is, it returns the pos that it is + * in + */ +static int +in_set(char ch, const char *set) +{ + int i; + + if (set == NULL) + return -1; + + for (i=0; set[i] != '\0'; i++) + if (ch == set[i]) + return i; + + return -1; +} + +static int is_ws(char ch) +{ + if (ch == ' ' || ch == '\n' || ch == '\t') + return 1; + return 0; +} + +/* + * Not sure if I can rely on having strcpy, so just to + * be safe, I implemented my own + */ +static void +cpystr(char *dest, const char *src, int max_size) +{ + int i; + + for (i=0; i < max_size; i++) { + dest[i] = src[i]; + if (src[i] == '\0') + return; + } +} + +/* Returns length of string */ +static int +lenstr(char *str) +{ + int i; + + for (i=0; str[i] != '\0'; i++); + + return i; +} + +/* + * My own strcmp function. Since I am lazy, it returns a 0 if + * they match and a 1 otherwise + */ +static int +cmpstr(char *str1, char *str2) +{ + int i; + + for (i=0; *str1 != '\0' && *str2 != '\0'; i++) { + if (*str1 != *str2) + return 1; + *str1++; + *str2++; + } + /* Make sure they are the same size */ + if (*str1 == *str2) + return 0; + + return 1; +} + + +/* + * (kind of)Duplicates strtok function. + * + * Given a buffer, pulls off the longest string + * that does not contain any delim characters. Will + * remove ws and any characters in the ignore string. + * Returns the token. + * + */ +static char * +get_token(char **buf, const char *delim, const char *ignore) +{ + int i, j, size=0; + int in_quotes = 0; + char *token; + char *buf_ptr = *buf; + + if (buf_ptr == NULL) { + return NULL; + } + + if (*buf_ptr == '\0') + return NULL; + + /* Chop off any initial deliminators */ + while (buf_ptr && (in_set(*buf_ptr, delim)>=0)) + buf_ptr++; + + if (buf_ptr == NULL) + return NULL; + + + /* + * Find the first occurance of delim, recording how many + * characters lead up to it. Ignore ws characters. This + * is really inefficient. A better way to do it would be + * to copy the characters into the token buffer as the buf + * is processed, but there is no way of knowing how big the + * token will be, so the choices are to make some sort of guess + * at the size and clean up later or to make two passes + */ + for (i=0; + (buf_ptr && (buf_ptr[i] != '\0') && + (in_set(buf_ptr[i],delim) < 0)); + i++) { + if ((buf_ptr[i] == '"') && (in_set('"', ignore))<0) { + /* Allow escaping quotes */ + if ((i==0) || (buf_ptr[i-1] != '\\')) + in_quotes ^= 0x1; + } + + if ((in_quotes || !is_ws(buf_ptr[i])) && + (in_set(buf_ptr[i], ignore) < 0)) + size++; + } + + if ((token = malloc(size+1)) == NULL) + return NULL; + + in_quotes = 0; + for (i=0, j=0; + (buf_ptr && (buf_ptr[i] != '\0') && + (in_set(buf_ptr[i],delim) < 0)); + i++) { + if ((buf_ptr[i] == '"') && (in_set('"', ignore)<0)) { + /* Allow escaping quotes */ + if ((i==0) || (buf_ptr[i-1] != '\\')) + in_quotes ^= 0x1; + } + if ((in_quotes || !is_ws(buf_ptr[i])) && + (in_set(buf_ptr[i], ignore)< 0)){ + token[j] = buf_ptr[i]; + j++; + } + } + + token[j] = '\0'; + + if (buf_ptr) { + if ((*buf_ptr == '\0') || (*(buf_ptr+i) == '\0')) + buf_ptr = NULL; + else + buf_ptr += i+1; + } + + *buf = buf_ptr; + return token; +} + +/* + * Create an argument list for use in a command_t structure + */ +static struct arg_list * +get_args(char **buf) +{ + struct arg_list *new_list, *start_list; + struct arg_list *prev_list = NULL; + char *delim=",={"; + char *arg_name, *arg; + int pos,last_tok = 0; + + + if ((start_list = malloc(sizeof(struct arg_list))) == NULL) + return NULL; + + start_list->next = NULL; + new_list = start_list; + while(1) { + arg_name = get_token(buf, delim, "\\"); + + if (arg_name == NULL) { + return start_list; + } + + cpystr(new_list->arg_name, arg_name, 4); + + arg = get_token(buf, delim, "\\"); + if (arg == NULL) { + return NULL; + } + + /* See if we have arrived at the last token */ + if ((pos=in_set('}',arg)) >= 0) { + arg[pos] = '\0'; + last_tok = 1; + } + + new_list->arg = arg; + + if (new_list != start_list) { + prev_list->next = new_list; + } + + if (last_tok) + return start_list; + + prev_list = new_list; + if ((new_list = malloc(sizeof(struct arg_list))) == NULL) + return NULL; + new_list->next = NULL; + } + + return start_list; +} + + +/* + * Get a command. Fills in the cmd structure with a complete command + * Return 0 on successful completion, 1 if unable to get a token (due + * to a parsing error or to end of string), and -1 if some other problem + * occurs + */ +static int +get_command(char **commands_str, struct command_t *cmd) +{ + char *delim = "{},="; + char *cmd_str; + + if (cmd == NULL) { + return -1; + } + + /* Get the command name, removing any quotes */ + cmd_str = get_token(commands_str, delim, "\"\\"); + if (cmd_str == NULL) + return 1; + + /* + * Copy in the command. The command may be shorter + * than 6 chars, but it doesn't really matter since + * it is null-terminated + */ + cpystr(cmd->command, cmd_str, 6); + + /* + * Get all the arguments. If we fail here, we return -1 to indicate + * that this was not simply a matter of finishing processing the + * commands (since, if we have a cmd_str, we should have arguments) + */ + cmd->args = get_args(commands_str); + if (cmd->args == NULL) + return -1; + + return 0; +} + + +/* frees a command structure */ +static void +free_cmd(struct command_t *cmd) +{ + struct arg_list *curr_arg, *next_arg; + + curr_arg = cmd->args; + + while (curr_arg != NULL) { + next_arg = curr_arg->next; + free(curr_arg->arg); + free(curr_arg); + + curr_arg = next_arg; + } + + free(cmd); +} + +/* + * Given an argument name and a list of possible arg names, + * returns an index for the given argument name + */ +static int +get_arg(char *arg, char** prefix) +{ + int i; + + for (i=0; prefix[i] != NULL; i++) + if (!cmpstr(arg, prefix[i]) ) + return i; + + return -1; +} + +/* + * Takes a string with permission bits (in octal + * format) and returns the permission numbers + */ +static int +get_perms(char *perms) +{ + int total, i, j, digit; + char c[2]; + int len = lenstr(perms); + + total = 0; + for (i=0; i < len; i++) { + c[0] = perms[i]; + c[1] = '\0'; + digit = atoi(c); + if (digit > 7) { + return 0; + } + for (j=len-i-1; j >0; j--) + digit *= 8; + total += digit; + } + return total; +} + +/* + * Performs the creat command for the namespace assembly + */ +static int +do_creat(struct arg_list *args) +{ + struct arg_list *curr_arg = args; + char *tmp_str, *type=NULL; + char *prefixs[] = {"ft", "nm", "pm", "ow", "gr", "mm", "str", NULL }; + int argnum, perms=-1; + char *path=NULL, *own=NULL, *group=NULL; + int i, ret, maj_num=-1, min_num=-1; + char *maj_num_str; + char *min_num_str; + char *vals[10]; + int fd, size, num_vals=0; + + /* Needs to be at least one argument */ + if (args == NULL){ + return EINVAL; + } + + while (curr_arg != NULL) { + + if ((argnum =get_arg(curr_arg->arg_name, prefixs)) < 0) + return EINVAL; + + tmp_str = curr_arg->arg; + + if (tmp_str == NULL) { + return EINVAL; + } + switch (argnum) { + case 0: + type = tmp_str; + break; + + case 1: + path = tmp_str; + break; + + case 2: + + perms = get_perms(tmp_str); + break; + + case 3: + own = tmp_str; + break; + + case 4: + group = tmp_str; + break; + + case 5: + maj_num_str = get_token(&tmp_str, "+", NULL); + min_num_str = get_token(&tmp_str, "+", NULL); + + maj_num = atoi(maj_num_str); + min_num = atoi(min_num_str); + + free(maj_num_str); + free(min_num_str); + break; + + case 6: + /* + * Put the given string into the given file + */ + if (num_vals >= 9) { + /* Too many strings */ + return EINVAL; + } + + /* + * Remove the surronding quotes from tmp_str + * It is done here instead of in get_token because + * it is not a behavior wanted for any other + * token + */ + tmp_str++; + size = lenstr(tmp_str); + tmp_str[size-1] = '\0'; + vals[num_vals++] = tmp_str; + break; + + default: + return EINVAL; + + } + curr_arg = curr_arg->next; + } + + if ((type == NULL) || (perms == -1) || (path == NULL)) { + return EINVAL; + } + + ret = 0; + if (cmpstr(type, "dir") == 0) { + ret = mkdir(path, perms); + } else if ((cmpstr(type, "chr") == 0) || (cmpstr(type, "blk") == 0)) { + int mode; + int devnum = SYSIO_MKDEV(maj_num, min_num); + + if (cmpstr(type, "chr") == 0) + mode = perms | S_IFCHR; + else + mode = perms | S_IFBLK; + + if ((maj_num == -1) || (min_num == -1)) { + return EINVAL; + } + ret = mknod(path, mode, devnum); + + } else if (cmpstr(type, "file") == 0) { + fd = creat(path, perms); + + if (fd < 0) + return fd; + + for (i=0; i < num_vals; i++) { + size = lenstr(vals[i]); + if ((ret = write(fd, vals[i], size)) != size) + return -1; + } + ret = close(fd); + + } else { + return EINVAL; + } + return 0; +} + +static int +do_mnt(struct arg_list *args) +{ + int argnum, flags = 0; + int err, is_root =0; /* Are we mounting the root dir? */ + char *src=NULL, *to=NULL; + char *tmp_str, *data=NULL; + char *fstype; + char *prefixs[] = { "dev", "dir", "fl", "da", NULL}; + struct arg_list *curr_arg = args; + + /* Needs to be at least one argument */ + if (args == NULL){ + return EINVAL; + } + + while (curr_arg != NULL) { + + if ((argnum =get_arg(curr_arg->arg_name, prefixs)) < 0) + return EINVAL; + tmp_str = curr_arg->arg; + + if (tmp_str == NULL) { + return EINVAL; + } + + switch (argnum) { + case 0 : + + fstype = get_token(&tmp_str, ":", NULL); + src = get_token(&tmp_str, ":", "\""); + + break; + + case 1: + to = tmp_str; + if (cmpstr(to,"/") == 0) + is_root = 1; + break; + + case 2: + flags = atoi(tmp_str); + break; + + case 3: + data = tmp_str; + break; + } + curr_arg = curr_arg->next; + } + + if ((src == NULL) || (to == NULL)) { + return EINVAL; + } + + if (is_root) { + err = _sysio_mount_root(src, fstype, flags, data); + free(src); + return -err; + } else { + err = mount(src, to, fstype, flags, data); + free(src); + return -err; + } + + return 0; + +} + + +static int +do_cd(struct arg_list *args) +{ + char *path; + + /* Must be exactly one argument */ + if ((args == NULL) || (args->next != NULL)) { + return EINVAL; + } + + if (cmpstr(args->arg_name, "dir") != 0) + return EINVAL; + + path = args->arg; + + if (path == NULL) { + return EINVAL; + } + return chdir(path); +} + + +/* Does a chmod */ +static int +do_chmod(struct arg_list *args) +{ + + char *prefixs[] = {"src", "pm", NULL}; + struct arg_list *curr_arg = args; + char *src; + char *tmp_str = NULL; + int argnum, perms; + + + /* Need both the filename and the permissions */ + if ((args == NULL) || (args->next == NULL)) { + return EINVAL; + } + + + while (curr_arg != NULL) { + + argnum = get_arg(curr_arg->arg_name, prefixs); + if (argnum < 0) + return EINVAL; + + tmp_str = curr_arg->arg; + if (tmp_str == NULL) { + return EINVAL; + } + + switch (argnum) { + case 0 : + src = tmp_str; + break; + + case 1: + perms = get_perms(tmp_str); + break; + + case 2: + + errno = EINVAL; + return EINVAL; + break; + } + curr_arg = curr_arg->next; + } + + + return chmod(src, perms); +} + +struct command_function_t cmd_funcs[] = { + {"creat", do_creat}, + {"mnt", do_mnt}, + {"cd", do_cd}, + {"chmd", do_chmod}, + {NULL, NULL} +}; + + +/* Execute the given cmd. Return exit status code */ +static int +do_command(struct command_t *cmd) +{ + int i; + + if (cmd->command == NULL) + return EINVAL; + + for (i=0; cmd_funcs[i].cmd != NULL; i++) { + + if (cmpstr(cmd_funcs[i].cmd, cmd->command) == 0) + return (cmd_funcs[i].func)(cmd->args); + } + + return EINVAL; +} + +/* + * Given a command sequence buffer, parse it and run the given + * commands + */ + +int +run_cmds(char *buf) +{ + struct command_t *cmd; + int err; + + while (1) { + + if ((cmd = (struct command_t *)malloc(sizeof(struct command_t))) + == NULL) + return ENOMEM; + + cmd->args = NULL; + + err= get_command(&buf, cmd); + if ((cmd == NULL) || (err < 0)) + return EINVAL; + + if (err == 1) + return 0; + + if ((err = do_command(cmd)) < 0) { + free_cmd(cmd); + /* Something screwed up, bail */ + return err; + } + free_cmd(cmd); + } + return 0; +} + + Index: module.mk =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/module.mk,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 --- module.mk 18 Dec 2003 18:44:02 -0000 1.1.2.1 +++ module.mk 30 Jan 2004 21:54:22 -0000 1.1.2.2 @@ -9,5 +9,5 @@ SRCDIR_SRCS = src/access.c src/chdir.c s src/rmdir.c src/stat64.c src/stat.c \ src/statvfs64.c src/statvfs.c src/symlink.c \ src/truncate.c src/unlink.c src/utime.c \ - src/write.c src/parser.c src/command.c + src/write.c SRCDIR_EXTRA = src/module.mk --- command.c DELETED --- --- parser.c DELETED --- |
|
From: Sonja T. <so...@us...> - 2004-01-30 21:56:03
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25378/tests Modified Files: Tag: namespace_assembly test_namespace.c Log Message: Cleaned up namespace_assembly code. Accepts commands with arbitrary ws in them. Also moved 'put' command to just be a part of the creat command Index: test_namespace.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Attic/test_namespace.c,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 --- test_namespace.c 12 Jan 2004 15:50:08 -0000 1.1.2.2 +++ test_namespace.c 30 Jan 2004 21:54:22 -0000 1.1.2.3 @@ -3,6 +3,7 @@ * specification. Ensures that it can then do stuff with * environment */ +#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> @@ -10,6 +11,7 @@ #include <string.h> +#include "test.h" #include "sysio.h" #include "namespace.h" @@ -27,7 +29,7 @@ int usage() */ char *envname = "NAMESPACE"; -char *cmdseq = "{mnt,dev=incore:\"0777+0+0\",dir=/}{creat,ft=dir,nm=/proc,pm=0777}{creat,ft=dir,nm=/proc/self,pm=0777}{creat,ft=dir,nm=/proc/self/fd,pm=0777}{creat,ft=chr,nm=/proc/self/fd/stdin,pm=0400,mm=0+0}{creat,ft=chr,nm=/proc/self/fd/stdout,pm=0200,mm=0+1}{creat,ft=chr,nm=/proc/self/fd/stderr,pm=0200,mm=0+2}{init,dn=native}{creat,ft=dir,nm=/tmp,pm=0777}{mnt,dev=native:/tmp,dir=/tmp}{creat,ft=file,nm=/tmp/.mount,pm=0777}{put,str=\"native:/home\",src=/tmp/.mount}{chmd,src=/tmp/.mount,pm=0400}"; +char *cmdseq = "{mnt, dev=incore:\"0777+0+0\",dir=/ } {creat,\n\nft=dir,nm=/proc,pm=0777}{creat,ft=dir,nm=/proc/self,pm=0777}{creat,ft=dir,nm=/proc/self/fd,pm=0777}{creat,ft=chr, nm=/proc/self/fd/stdin,pm=0400 ,mm=0+0}{creat,ft=chr,nm=/proc/self/fd/stdout,pm=0200, mm=0+1}{creat, ft=chr,nm=/proc/self/fd/stderr,pm=0200,mm=0+2}{init,dn=native}{creat,\nft=dir,nm=/tmp,pm=0777}{mnt,dev=native:/tmp,dir=/tmp}{creat, ft=file,nm=/tmp/.mount,pm=0777, str=\"native:/home\n\", str=\"Put this \n mult-line meaningless trite with random \\\"\\\" quotes in it\"}{chmd,src=/tmp/.mount,pm=0400}"; @@ -115,14 +117,6 @@ int main(int argc, char** argv) exit(1); } - if (usecmdseq) { - /* Cleanup the .mount file */ - if (unlink("/tmp/.mount") != 0) { - printf("Unlink of .mount failed with %s\n", strerror(errno)); - exit(1); - } - } - printf("Namespace tested completed successfully\n"); exit(0); } |
|
From: Lee W. <lw...@us...> - 2004-01-30 20:49:10
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6492 Modified Files: Tag: strided-io fs_native.c Log Message: Sonja didn't actually compile the previous revision. It contained syntax errors. Sonja's editor autowraps long lines? Added a new line. Consistency is the hobgoblin of small minds. I have a *very* small mind :-) So, changed to reflect the style of the file; + spaces around binary operators + indenting now consistent with other multiline arg passing + a * b, then b * a fixed to have the same sub-expression in the same order on two lines. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.25.6.6 retrieving revision 1.25.6.7 diff -u -w -b -B -p -r1.25.6.6 -r1.25.6.7 --- fs_native.c 28 Jan 2004 13:53:53 -0000 1.25.6.6 +++ fs_native.c 29 Jan 2004 20:41:33 -0000 1.25.6.7 @@ -1319,11 +1319,12 @@ doio(char op, struct ioctx *ioctx) * Must lock the regions (in order!) since we can't do * strided-IO as a single atomic operation. */ - oxtv = malloc(sizeof(struct intnl_xtvec)*ioctx->ioctx_xtvlen); + oxtv = malloc(ioctx->ioctx_xtvlen * sizeof(struct intnl_xtvec)); if (!oxtv) return -ENOMEM; - (void )memcpy(oxtv, ioctx->ioctx_xtv, - (ioctx->ioctx_xtvlen*sizeof(struct intnl_xtvec))); + (void )memcpy(oxtv, + ioctx->ioctx_xtv, + ioctx->ioctx_xtvlen * sizeof(struct intnl_xtvec)); qsort(oxtv, ioctx->ioctx_xtvlen, sizeof(struct intnl_xtvec), |
|
From: Sonja T. <so...@us...> - 2004-01-30 19:59:59
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23002/tests Modified Files: Tag: strided-io test_all.pl Log Message: Oops. Forgot to add the test_all.pl changes which add the rw test to the test suite. Index: test_all.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_all.pl,v retrieving revision 1.6.6.1 retrieving revision 1.6.6.2 diff -u -w -b -B -p -r1.6.6.1 -r1.6.6.2 --- test_all.pl 26 Jan 2004 16:27:48 -0000 1.6.6.1 +++ test_all.pl 30 Jan 2004 19:58:24 -0000 1.6.6.2 @@ -161,6 +161,17 @@ if ($res ne "Symlink test successful") { print "test_symlink finished successfully\n"; } +# Test r/w calls +$res = `perl $testdir/test_rw.pl $alpha_arg $cwd/tmp_dir/tmp.foo`; +chop($res); +if ($res ne "rw test successful") { + print "rw test failed with message: $res\n"; + $failures++; +} else { + $success++; + print "rw test finished successfully\n"; +} + print "$failures tests failed and $success tests succeeded\n"; # cleanup |
|
From: Sonja T. <so...@us...> - 2004-01-30 19:57:22
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19342/tests Modified Files: Tag: strided-io help.c sysio_stubs.c test_driver.c test_driver.h test_stats.pl Added Files: Tag: strided-io test_rw.pl Log Message: Fixed bug in lockop_all that sent in the wrong command to fcntl. Added more calls to the test driver Added a rw test to the test suite. This calls all of the write/read combos: write, iwrite, writev, iwritev, pwrite, ipwrite, ipwritev, writex, iwritex. Ensures that what they wrote out and what they read back matches. Removed for now the statvfs test. --- NEW FILE --- #!/usr/bin/perl -w # # rw test: Write a buffer out using all the different writes, read it back # and make sure it matches # # use IPC::Open2; use strict; use FindBin; use lib "$FindBin::Bin"; use helper; sub usage { print "Usage: ./test_rw.pl [-alpha] <file>: Write to/read from file\n"; exit(-1); } sub verify_result { my ($cmdfh, $outfh, $cmdstr, $exp_val, $eq_op) = @_; my $print_err = 0; my $res = helper::verify_cmd($cmdfh, $outfh, $cmdstr); $res = oct($res); if ($eq_op eq "!=") { if ($res != $exp_val) { print STDOUT "Error! $cmdstr returned $res insted of $exp_val\n"; exit 1; } } else { if ($eq_op eq ">") { if ($res > $exp_val) { $print_err = 1; } } elsif ($eq_op eq "<") { if ($res < $exp_val) { $print_err = 1; } } elsif ($eq_op eq "==") { if ($res == $exp_val) { $print_err = 1; } } if ($print_err == 1) { helper::print_and_exit($cmdfh, $outfh, 1, "Error! $cmdstr returned $res\n"); } } } sub do_iowait { my ($cmdfh, $outfh, $id, $rwcmd, $exp_size) = @_; my $cmdstr = "CALL iowait $id\n"; helper::send_cmd($cmdfh, $outfh, "iowait", $cmdstr); my $descstr = "iowait:$rwcmd"; verify_result($cmdfh, $outfh, $descstr, $exp_size, "!="); } sub set_iovecs { my ($cmdfh, $outfh, $callnum) = @_; my $NUMVECS = 8; my $VECLEN = $NUMVECS * 1024; my $varname = "iovbuf$callnum"; # Get size of iovecs my $cmdstr = '$iovsize = CALL sizeof iovec'."\n"; helper::send_cmd($cmdfh, $outfh, "sizeof", $cmdstr); my $size = helper::verify_cmd($cmdfh, $outfh, "sizeof iovec"); $size = oct($size); $size = $size * $NUMVECS; # Allocate iovec buffer $cmdstr = '$'."$varname = ALLOC $size\n"; helper::send_cmd($cmdfh, $outfh, "alloc", $cmdstr); # Now initilize all of them my $off = 0; for (my $i=0; $i < $NUMVECS; $i++) { $cmdstr = 'CALL init_iovec $buf '."$off $VECLEN $i ". '$'."$varname\n"; helper::send_cmd($cmdfh, $outfh, "init_iovec", $cmdstr); helper::verify_cmd($cmdfh, $outfh, "init_iovec"); $off += $VECLEN; } return $varname; } sub set_xtvecs { my ($cmdfh, $outfh, $callnum, $startoff) = @_; my $VECLEN = 4 * 8 * 1024; my $varname = "xtvbuf$callnum"; # Get size of iovecs my $cmdstr = '$xtvsize = CALL sizeof xtvec'."\n"; helper::send_cmd($cmdfh, $outfh, "sizeof", $cmdstr); my $size = helper::verify_cmd($cmdfh, $outfh, "sizeof xtvec"); $size = oct($size); $size = $size * 2; # Allocate iovec buffer $cmdstr = '$'."$varname = ALLOC $size\n"; helper::send_cmd($cmdfh, $outfh, "alloc", $cmdstr); # Now initilize all of them my $off = $startoff; for (my $i=0; $i < 2; $i++) { $cmdstr = "CALL init_xtvec $off $VECLEN $i ". '$'."$varname\n"; helper::send_cmd($cmdfh, $outfh, "init_xtvec", $cmdstr); helper::verify_cmd($cmdfh, $outfh, "init_xtvec"); $off += $VECLEN; } return $varname; } sub check_buf { my ($cmdfh, $outfh, $bufsize, $readcmd) = @_; my $cmdstr = 'CALL checkbuf $buf '. "1 $bufsize\n"; helper::send_cmd($cmdfh, $outfh, "checkbuf", $cmdstr); my $res = helper::verify_cmd($cmdfh, $outfh, "checkbuf"); $res = oct($res); if ($res != 0) { print STDOUT "Checkbuf returned $res\n"; helper::print_and_exit($cmdfh, $outfh, 1, "$readcmd did not return all 1's\n"); } # Now fill the buffer with 0s $cmdstr = '$buf = CALL setbuf 1 '."$bufsize ".'$buf'."\n"; helper::send_cmd($cmdfh, $outfh, "setbuf", $cmdstr); } sub do_rwcalls { my ($cmdfh, $outfh, $bufsize) = @_; my $IOID_FAIL = 0; my $NUMVECS = 8; # write 64K bytes at pos 0 my $cmdstr = 'CALL write $fd $buf '."$bufsize\n"; helper::send_cmd($cmdfh, $outfh, "write", $cmdstr); verify_result($cmdfh, $outfh, "write", $bufsize, "!="); # iwrite 64K bytes at pos 64K $cmdstr = '$id1 = CALL iwrite $fd $buf '."$bufsize\n"; helper::send_cmd($cmdfh, $outfh, "iwrite", $cmdstr); verify_result($cmdfh, $outfh, "iwrite", $IOID_FAIL, "=="); do_iowait($cmdfh, $outfh, '$id1', "iwrite", $bufsize); # Set up the iovecs my $iovcnt = 0; my $iovname = set_iovecs($cmdfh, $outfh, $iovcnt); # writev 64K bytes using 8 iovecs at pos 128K $cmdstr = 'CALL writev $fd $'."$iovname $NUMVECS\n"; helper::send_cmd($cmdfh, $outfh, "writev", $cmdstr); verify_result($cmdfh, $outfh, "writev", $bufsize, "!="); # iwritev 64K bytes using 8 iovecs at pos 192K $cmdstr = '$id2 = CALL iwritev $fd $'."$iovname $NUMVECS\n"; helper::send_cmd($cmdfh, $outfh, "iwritev", $cmdstr); verify_result($cmdfh, $outfh, "iwritev", $IOID_FAIL, "=="); do_iowait($cmdfh, $outfh, '$id2', "iwritev", $bufsize); # pwrite 64K bytes starting at pos 256K my $offset = 256 * 1024; $cmdstr = 'CALL pwrite $fd $buf '."$bufsize $offset\n"; helper::send_cmd($cmdfh, $outfh, "pwrite", $cmdstr); verify_result($cmdfh, $outfh, "pwrite", $bufsize, "!="); # ipwrite 64K bytes starting at pos 320K $offset = 320 * 1024; $cmdstr = '$id3 = CALL ipwrite $fd $buf '."$bufsize $offset\n"; helper::send_cmd($cmdfh, $outfh, "ipwrite", $cmdstr); verify_result($cmdfh, $outfh, "ipwrite", $IOID_FAIL, "=="); do_iowait($cmdfh, $outfh, '$id3', "ipwrite", $bufsize); # Set up the buffers again since iwritev kindly blew them away # for us... $iovcnt++; $iovname = set_iovecs($cmdfh, $outfh, $iovcnt); # pwritev using 8 8K buffers at offset 384 $offset = 384 * 1024; $cmdstr = 'CALL pwritev $fd $'."$iovname $NUMVECS $offset\n"; helper::send_cmd($cmdfh, $outfh, "pwritev", $cmdstr); verify_result($cmdfh, $outfh, "pwritev", $bufsize, "!="); # ipwritev using 8 8k buffers at offset 448 $offset = 448 * 1024; $cmdstr = '$id4 = CALL ipwritev $fd $'."$iovname $NUMVECS $offset\n"; helper::send_cmd($cmdfh, $outfh, "ipwritev", $cmdstr); verify_result($cmdfh, $outfh, "ipwritev", $IOID_FAIL, "=="); do_iowait($cmdfh, $outfh, '$id4', "ipwritev", $bufsize); # Set up the xtvecs. Starting offset is 512K my $xtvcnt = 0; my $xtvname = set_xtvecs($cmdfh, $outfh, $xtvcnt, 512 * 1024); # Have to re-setup the iovecs (again..) $iovcnt++; $iovname = set_iovecs($cmdfh, $outfh, $iovcnt); # Call writex using 8 8k buffers at offset 512 $cmdstr = 'CALL writex $fd $'."$iovname $NUMVECS ".'$'."$xtvname 2\n"; helper::send_cmd($cmdfh, $outfh, "writex", $cmdstr); verify_result($cmdfh, $outfh, "writex", $bufsize, "!="); # Call iwritex using 8 8k buffers starting at offset 576 # Re-setup xtvs since I am lazy. This is leaking memory like # a seive... $xtvcnt++; $xtvname = set_xtvecs($cmdfh, $outfh, $xtvcnt, 576 * 1024); # And we also need to set up the iovs again $iovcnt++; $iovname = set_iovecs($cmdfh, $outfh, $iovcnt); $cmdstr = '$id5 = CALL iwritex $fd $'."$iovname $NUMVECS ".'$'."$xtvname 2\n"; helper::send_cmd($cmdfh, $outfh, "iwritex", $cmdstr); verify_result($cmdfh, $outfh, "iwritex", $IOID_FAIL, "=="); do_iowait($cmdfh, $outfh, '$id5', "iwritex", $bufsize); # Now do the reads # Lseek back to pos 0 $cmdstr = 'CALL lseek $fd 0 SEEK_SET'."\n"; helper::send_cmd($cmdfh, $outfh, "sizeof", $cmdstr); helper::verify_cmd($cmdfh, $outfh, "sizeof xtvec"); # fill the buffer with 0's $cmdstr = '$buf = CALL setbuf 0 '."$bufsize ".'$buf'."\n"; helper::send_cmd($cmdfh, $outfh, "setbuf", $cmdstr); # read 64K bytes from pos 0 $cmdstr = 'CALL read $fd $buf '."$bufsize\n"; helper::send_cmd($cmdfh, $outfh, "read", $cmdstr); verify_result($cmdfh, $outfh, "read", $bufsize, "!="); # Check the buffer to make sure it matches check_buf($cmdfh, $outfh, $bufsize, "read"); # iread 64K bytes at pos 64K $cmdstr = '$id6 = CALL iread $fd $buf '."$bufsize\n"; helper::send_cmd($cmdfh, $outfh, "iread", $cmdstr); verify_result($cmdfh, $outfh, "iread", $IOID_FAIL, "=="); do_iowait($cmdfh, $outfh, '$id6', "iread", $bufsize); check_buf($cmdfh, $outfh, $bufsize, "iread"); # Set up the iovecs $iovcnt++; $iovname = set_iovecs($cmdfh, $outfh, $iovcnt); # readv 64K bytes using 8 iovecs at pos 128K $cmdstr = 'CALL readv $fd $'."$iovname $NUMVECS\n"; helper::send_cmd($cmdfh, $outfh, "readv", $cmdstr); verify_result($cmdfh, $outfh, "readv", $bufsize, "!="); check_buf($cmdfh, $outfh, $bufsize, "readv"); # ireadv 64K bytes using 8 iovecs at pos 192K $cmdstr = '$id7 = CALL ireadv $fd $'."$iovname $NUMVECS\n"; helper::send_cmd($cmdfh, $outfh, "ireadv", $cmdstr); verify_result($cmdfh, $outfh, "ireadv", $IOID_FAIL, "=="); do_iowait($cmdfh, $outfh, '$id7', "ireadv", $bufsize); check_buf($cmdfh, $outfh, $bufsize, "ireadv"); # pread64K bytes starting at pos 256K $offset = 256 * 1024; $cmdstr = 'CALL pread $fd $buf '."$bufsize $offset\n"; helper::send_cmd($cmdfh, $outfh, "pread", $cmdstr); verify_result($cmdfh, $outfh, "pread", $bufsize, "!="); check_buf($cmdfh, $outfh, $bufsize, "pread"); # ipread 64K bytes starting at pos 320K $offset = 320 * 1024; $cmdstr = '$id8 = CALL ipread $fd $buf '."$bufsize $offset\n"; helper::send_cmd($cmdfh, $outfh, "ipread", $cmdstr); verify_result($cmdfh, $outfh, "ipread", $IOID_FAIL, "=="); do_iowait($cmdfh, $outfh, '$id8', "ipread", $bufsize); check_buf($cmdfh, $outfh, $bufsize, "ipread"); # Set up the buffers again since iwritev kindly blew them away # for us... $iovcnt++; $iovname = set_iovecs($cmdfh, $outfh, $iovcnt); # preadv using 8 8K buffers at offset 384 $offset = 384 * 1024; $cmdstr = 'CALL preadv $fd $'."$iovname $NUMVECS $offset\n"; helper::send_cmd($cmdfh, $outfh, "preadv", $cmdstr); verify_result($cmdfh, $outfh, "preadv", $bufsize, "!="); check_buf($cmdfh, $outfh, $bufsize, "preadv"); # ipreadv using 8 8k buffers at offset 448 $offset = 448 * 1024; $cmdstr = '$id9 = CALL ipreadv $fd $'."$iovname $NUMVECS $offset\n"; helper::send_cmd($cmdfh, $outfh, "ipreadv", $cmdstr); verify_result($cmdfh, $outfh, "ipreadv", $IOID_FAIL, "=="); do_iowait($cmdfh, $outfh, '$id9', "ipreadv", $bufsize); check_buf($cmdfh, $outfh, $bufsize, "ipreadv"); # Set up the xtvecs. Starting offset is 512K $xtvcnt++; $xtvname = set_xtvecs($cmdfh, $outfh, $xtvcnt, 512 * 1024); # Have to re-setup the iovecs (again..) $iovcnt++; $iovname = set_iovecs($cmdfh, $outfh, $iovcnt); # Call readx using 8 8k buffers at offset 512 $cmdstr = 'CALL readx $fd $'."$iovname $NUMVECS ".'$'."$xtvname 2\n"; helper::send_cmd($cmdfh, $outfh, "readx", $cmdstr); verify_result($cmdfh, $outfh, "readx", $bufsize, "!="); check_buf($cmdfh, $outfh, $bufsize, "readx"); # Call ireadx using 8 8k buffers starting at offset 576 # Re-setup xtvs since I am lazy. This is leaking memory like # a seive... $xtvcnt++; $xtvname = set_xtvecs($cmdfh, $outfh, $xtvcnt, 576 * 1024); # And we also need to set up the iovs again $iovcnt++; $iovname = set_iovecs($cmdfh, $outfh, $iovcnt); $cmdstr = '$id10 = CALL ireadx $fd $'."$iovname $NUMVECS ".'$'."$xtvname 2\n"; helper::send_cmd($cmdfh, $outfh, "ireadx", $cmdstr); verify_result($cmdfh, $outfh, "ireadx", $IOID_FAIL, "=="); do_iowait($cmdfh, $outfh, '$id10', "ireadx", $bufsize); check_buf($cmdfh, $outfh, $bufsize, "ireadx"); } sub process_cmd { my ($file, $is_alpha) = @_; # Get tests directory my $testdir = $FindBin::Bin; my $bufsize = 65536; eval { if ($is_alpha == 0) { open2(\*OUTFILE, \*CMDFILE, "$testdir/test_driver --np"); } else { open2(\*OUTFILE, \*CMDFILE, "yod -quiet -sz 1 $testdir/test_driver --np"); } }; if ($@) { if ($@ =~ /^open2/) { warn "open2 failed: $!\n$@\n"; return; } die; } my $outfh = \*OUTFILE; my $cmdfh = \*CMDFILE; if ($is_alpha == 0) { helper::send_cmd($cmdfh, $outfh, "init", "CALL init\n"); } # Open file my $cmdstr = '$fd = CALL open '."$file O_RDWR|O_CREAT 0777\n"; helper::send_cmd($cmdfh, $outfh, "open", $cmdstr); # Allocate buffer $cmdstr = '$buf = ALLOC '."$bufsize\n"; helper::send_cmd($cmdfh, $outfh, "ALLOC", $cmdstr); # Fill it with 1's $cmdstr = '$buf = CALL setbuf 1 '."$bufsize ".'$buf'."\n"; helper::send_cmd($cmdfh, $outfh, "setbuf", $cmdstr); do_rwcalls($cmdfh, $outfh, $bufsize); # Do an od and make sure that only 1's are in the file # This is what it should return: my $cmpstr = "0000000 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001\n"; $cmpstr .= "*\n"; $cmpstr .= "2400000"; my $res = `od -c $file`; chop($res); if ($cmpstr ne $res) { helper::print_and_exit($cmdfh, $outfh, 1, "od results indicate a ch other than 1\n"); } # Clean up $cmdstr = 'CALL close $fd'."\n"; helper::send_cmd($cmdfh, $outfh, "close", $cmdstr); system("rm -f $file"); helper::print_and_exit($cmdfh, $outfh, 0, "rw test successful\n"); } my $currarg = 0; my $is_alpha = 0; if (@ARGV < 1) { usage; } elsif (@ARGV > 1 ) { if ($ARGV[$currarg++] eq "-alpha") { $is_alpha = 1; } } my $file = $ARGV[$currarg]; process_cmd($file, $is_alpha); exit 0; Index: help.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/help.c,v retrieving revision 1.2 retrieving revision 1.2.12.1 diff -u -w -b -B -p -r1.2 -r1.2.12.1 --- help.c 14 Aug 2003 21:16:33 -0000 1.2 +++ help.c 30 Jan 2004 19:55:33 -0000 1.2.12.1 @@ -46,6 +46,12 @@ void usage_setdebug() fprintf(outfp, "setdebug [level]: Set debugging level to level\n"); } +void usage_setbuf() +{ + fprintf(outfp, "setbuf val size buf: fill size bytes of buf with byte val\n"); +} + + void usage_clear() { fprintf(outfp, "clear buf: zero out the buffer\n"); @@ -492,6 +498,53 @@ void usage_umount() fprintf(outfp, "umount [path] : Umount file at path. Returns 0 on success and -1 on failure\n"); } +void usage_init_iovec() +{ + fprintf(outfp, "init_iovec buf offset len num iov_buf: Init iovector. iov_uf points to an array of\n"); + fprintf(outfp, " iovecs, num is the number of the iovec, \n"); + fprintf(outfp, " buf is the buffer to be used, offset \n"); + fprintf(outfp, " specifies how far into the buffer the iovec\n"); + fprintf(outfp, " should point and len is the iov length\n"); +} + +void usage_init_xtvec() +{ + fprintf(outfp, "init_xtvec offset len num buf: Init xtvector. Buf points to an array of\n"); + fprintf(outfp, " xtvecs, num is the number of the xtvec, offset\n"); + fprintf(outfp, " is xtv_off and len is the iov lenghth\n"); + fprintf(outfp, " the iov length\n"); +} + +void usage_writex() +{ + fprintf(outfp, "writex fd iovs iov_cnt xtvs xtvcnt: Write iov_cnt iovecs out to file using\n"); + fprintf(outfp, " xtvcnt xtvecs\n"); +} + +void usage_iwritex() +{ + fprintf(outfp, "iwritex fd iovs iov_cnt xtvs xtvcnt: Write iov_cnt iovecs out to file using\n"); + fprintf(outfp, " xtvcnt xtvecs\n"); +} + +void usage_readx() +{ + fprintf(outfp, "readx fd iovs iov_cnt xtvs xtvcnt: Read iov_cnt iovecs out from file using\n"); + fprintf(outfp, " xtvcnt xtvecs\n"); +} + +void usage_ireadx() +{ + fprintf(outfp, "ireadx fd iovs iov_cnt xtvs xtvcnt: Read iov_cnt iovecs out from file using\n"); + fprintf(outfp, " xtvcnt xtvecs\n"); +} + + +void usage_checkbuf() +{ + fprintf(outfp, "checkbuf buf size val: Checks to see if val is in first size bytes of buf\n"); +} + void usage_exit() { } Index: sysio_stubs.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/sysio_stubs.c,v retrieving revision 1.6.6.1 retrieving revision 1.6.6.2 diff -u -w -b -B -p -r1.6.6.1 -r1.6.6.2 --- sysio_stubs.c 26 Jan 2004 16:27:48 -0000 1.6.6.1 +++ sysio_stubs.c 30 Jan 2004 19:55:33 -0000 1.6.6.2 @@ -13,6 +13,7 @@ #include "test_driver.h" #include "sysio.h" +#include "xtio.h" /* * ################################################ @@ -423,6 +424,43 @@ int get_endian(int argc, char **argv) return SUCCESS; } +int do_setbuf(int argc, char **argv) +{ + int val, size, index; + void *buf; + + if (argc != 3) { + DBG(2, fprintf(outfp, "Need val, size, and buffer for setbuf\n")); + return INVALID_ARGS; + } + val = get_obj(argv[0]); + if (val < 0) { + DBG(2, fprintf(outfp, "Unable to understand val of %s\n", + argv[0])); + return INVALID_VAR; + } + + size = get_obj(argv[1]); + if( size <=0 ) { + DBG(2, fprintf(outfp, "Size of %s is invalid\n", argv[1])); + return INVALID_VAR; + } + + index = get_obj(argv[2]); + if (index < 0) { + DBG(2, fprintf(outfp, "Unable to find buffer assocated with %s\n", + argv[2])); + return INVALID_VAR; + } + + buf = buflist[index]->buf; + + memset(buf, val, size); + + return SUCCESS; +} + + int get_sizeof(int argc, char **argv) { char *type; @@ -450,6 +488,8 @@ int get_sizeof(int argc, char **argv) size = sizeof(struct statvfs); else if (!strcmp(type, "iovec")) size = sizeof(struct iovec); + else if (!strcmp(type, "xtvec")) + size = sizeof(struct xtvec); else return INVALID_ARGS; @@ -2229,3 +2269,416 @@ int test_do_umount(int argc, char **argv return SUCCESS; } +int test_do_init_iovec(int argc, char **argv) +{ + int iov_index, buf_index; + int offset, len, pos; + struct iovec *iov_ptr; + char *base_ptr; + + if (argc != 5) { + DBG(2, fprintf(outfp, "Need buffer, offset, len, array pos, and iov pointer\n")); + return INVALID_ARGS; + } + + if ((buf_index = get_obj(argv[0])) < 0) { + DBG(2, fprintf(outfp, "Unable to find object %s\n", argv[0])); + return INVALID_VAR; + } + base_ptr = buflist[buf_index]->buf; + + if ((offset = get_obj(argv[1])) < 0) { + DBG(2, fprintf(outfp, "Cannot understand offset of %s\n", argv[1])); + return INVALID_VAR; + } + + if ((len = get_obj(argv[2])) < 0) { + DBG(2, fprintf(outfp, "Cannot understand len of %s\n", argv[2])); + return INVALID_VAR; + } + + if ((pos = get_obj(argv[3])) < 0) { + DBG(2, fprintf(outfp, "Cannot understand array pos of %s\n", argv[3])); + return INVALID_VAR; + } + + if ((iov_index = get_obj(argv[4])) < 0) { + DBG(2, fprintf(outfp, "Unable to find object %s\n", argv[4])); + return INVALID_VAR; + } + iov_ptr = (struct iovec *)(buflist[iov_index]->buf); + + iov_ptr[pos].iov_len = len; + iov_ptr[pos].iov_base = (void *)(base_ptr + (char)offset); + + DBG(3, fprintf(outfp, "iov_ptr.len is %d and base is %p\n", + iov_ptr[pos].iov_len, iov_ptr[pos].iov_base)); + + my_errno = errno; + last_type = PTR; + + return SUCCESS; +} + + +int test_do_init_xtvec(int argc, char **argv) +{ + int xtv_index; + int offset, len, pos; + struct xtvec *xtv_ptr; + + if (argc != 4) { + DBG(2, fprintf(outfp, "Need offset, len, array pos, and xtv pointer\n")); + return INVALID_ARGS; + } + + if ((offset = get_obj(argv[0])) < 0) { + DBG(2, fprintf(outfp, "Cannot understand offset of %s\n", argv[0])); + return INVALID_VAR; + } + + if ((len = get_obj(argv[1])) < 0) { + DBG(2, fprintf(outfp, "Cannot understand len of %s\n", argv[1])); + return INVALID_VAR; + } + + if ((pos = get_obj(argv[2])) < 0) { + DBG(2, fprintf(outfp, "Cannot understand array pos of %s\n", argv[2])); + return INVALID_VAR; + } + + if ((xtv_index = get_obj(argv[3])) < 0) { + DBG(2, fprintf(outfp, "Unable to find object %s\n", argv[3])); + return INVALID_VAR; + } + xtv_ptr = (struct xtvec *)(buflist[xtv_index]->buf); + + xtv_ptr[pos].xtv_len = len; + xtv_ptr[pos].xtv_off = offset; + + DBG(3, fprintf(outfp, "xtv_ptr.len is %d and offset is %d\n", + xtv_ptr[pos].xtv_len, (int)xtv_ptr[pos].xtv_off)); + + my_errno = errno; + last_type = PTR; + + return SUCCESS; +} + +int test_do_writex(int argc, char **argv) +{ + int fd, iov_count, xtv_count,index; + char *buf; + struct iovec *iov; + struct xtvec *xtv; + + if (argc != 5) { + DBG(2, fprintf(outfp, "Invalid number of arguments (%d) to writex\n", argc)); + return INVALID_ARGS; + } + + fd = get_obj(argv[0]); + + if (fd < 0) { + DBG(2, fprintf(outfp, "Unable to find file described by %s\n", argv[0])); + return INVALID_ARGS; + } + + index = get_obj(argv[1]); + + if (index < 0) { + DBG(2, fprintf(outfp, "Unable to find buffer described by %s\n", argv[1])); + return INVALID_VAR; + } + + buf = buflist[index]->buf; + + iov = (struct iovec *)buf; + iov_count = get_obj(argv[2]); + + if (iov_count < 0) { + DBG(2, fprintf(outfp, "Unable to understand %s\n", argv[2])); + return INVALID_ARGS; + } + + index = get_obj(argv[3]); + + if (index < 0) { + DBG(2, fprintf(outfp, "Unable to find xtvs described by %s\n", argv[3])); + return INVALID_VAR; + } + + buf = buflist[index]->buf; + + xtv = (struct xtvec *)buf; + xtv_count = get_obj(argv[4]); + + if (xtv_count < 0) { + DBG(2, fprintf(outfp, "Unable to understand %s\n", argv[4])); + return INVALID_ARGS; + } + + DBG(3, fprintf(outfp, "writex(fd: %d, iov: %p iov_cnt: %d, xtv: %p, xtv_cnt: %d\n", + fd, iov, iov_count, xtv, xtv_count)); + + last_ret_val = writex(fd, iov, iov_count, xtv, xtv_count); + if (last_ret_val < 0) + my_perror("writex"); + my_errno = errno; + last_type = SINT; + + return SUCCESS; +} + + +int test_do_iwritex(int argc, char **argv) +{ + int fd, iov_count, xtv_count,index; + char *buf; + struct iovec *iov; + struct xtvec *xtv; + + if (argc != 5) { + DBG(2, fprintf(outfp, "Invalid number of arguments (%d) to iwritex\n", argc)); + return INVALID_ARGS; + } + + fd = get_obj(argv[0]); + + if (fd < 0) { + DBG(2, fprintf(outfp, "Unable to find file described by %s\n", argv[0])); + return INVALID_ARGS; + } + + index = get_obj(argv[1]); + + if (index < 0) { + DBG(2, fprintf(outfp, "Unable to find buffer described by %s\n", argv[1])); + return INVALID_VAR; + } + + buf = buflist[index]->buf; + + iov = (struct iovec *)buf; + iov_count = get_obj(argv[2]); + + if (iov_count < 0) { + DBG(2, fprintf(outfp, "Unable to understand %s\n", argv[2])); + return INVALID_ARGS; + } + + index = get_obj(argv[3]); + + if (index < 0) { + DBG(2, fprintf(outfp, "Unable to find xtvs described by %s\n", argv[3])); + return INVALID_VAR; + } + + buf = buflist[index]->buf; + + xtv = (struct xtvec *)buf; + xtv_count = get_obj(argv[4]); + + if (xtv_count < 0) { + DBG(2, fprintf(outfp, "Unable to understand %s\n", argv[4])); + return INVALID_ARGS; + } + + DBG(3, fprintf(outfp, "iwritex(fd: %d, iov: %p iov_cnt: %d, xtv: %p, xtv_cnt: %d\n", + fd, iov, iov_count, xtv, xtv_count)); + + last_ret_val = (int) iwritex(fd, iov, iov_count, xtv, xtv_count); + if (last_ret_val < 0) + my_perror("iwritex"); + my_errno = errno; + last_type = SINT; + + return SUCCESS; +} + + +int test_do_readx(int argc, char **argv) +{ + int fd, iov_count, xtv_count,index; + char *buf; + struct iovec *iov; + struct xtvec *xtv; + + if (argc != 5) { + DBG(2, fprintf(outfp, "Invalid number of arguments (%d) to readx\n", argc)); + return INVALID_ARGS; + } + + fd = get_obj(argv[0]); + + if (fd < 0) { + DBG(2, fprintf(outfp, "Unable to find file described by %s\n", argv[0])); + return INVALID_ARGS; + } + + index = get_obj(argv[1]); + + if (index < 0) { + DBG(2, fprintf(outfp, "Unable to find buffer described by %s\n", argv[1])); + return INVALID_VAR; + } + + buf = buflist[index]->buf; + + iov = (struct iovec *)buf; + iov_count = get_obj(argv[2]); + + if (iov_count < 0) { + DBG(2, fprintf(outfp, "Unable to understand %s\n", argv[2])); + return INVALID_ARGS; + } + + index = get_obj(argv[3]); + + if (index < 0) { + DBG(2, fprintf(outfp, "Unable to find xtvs described by %s\n", argv[3])); + return INVALID_VAR; + } + + buf = buflist[index]->buf; + + xtv = (struct xtvec *)buf; + xtv_count = get_obj(argv[4]); + + if (xtv_count < 0) { + DBG(2, fprintf(outfp, "Unable to understand %s\n", argv[4])); + return INVALID_ARGS; + } + + DBG(3, fprintf(outfp, "readx(fd: %d, iov: %p iov_cnt: %d, xtv: %p, xtv_cnt: %d\n", + fd, iov, iov_count, xtv, xtv_count)); + + last_ret_val = readx(fd, iov, iov_count, xtv, xtv_count); + if (last_ret_val < 0) + my_perror("readx"); + my_errno = errno; + last_type = SINT; + + return SUCCESS; +} + + +int test_do_ireadx(int argc, char **argv) +{ + int fd, iov_count, xtv_count,index; + char *buf; + struct iovec *iov; + struct xtvec *xtv; + + if (argc != 5) { + DBG(2, fprintf(outfp, "Invalid number of arguments (%d) to ireadx\n", argc)); + return INVALID_ARGS; + } + + fd = get_obj(argv[0]); + + if (fd < 0) { + DBG(2, fprintf(outfp, "Unable to find file described by %s\n", argv[0])); + return INVALID_ARGS; + } + + index = get_obj(argv[1]); + + if (index < 0) { + DBG(2, fprintf(outfp, "Unable to find buffer described by %s\n", argv[1])); + return INVALID_VAR; + } + + buf = buflist[index]->buf; + + iov = (struct iovec *)buf; + iov_count = get_obj(argv[2]); + + if (iov_count < 0) { + DBG(2, fprintf(outfp, "Unable to understand %s\n", argv[2])); + return INVALID_ARGS; + } + + index = get_obj(argv[3]); + + if (index < 0) { + DBG(2, fprintf(outfp, "Unable to find xtvs described by %s\n", argv[3])); + return INVALID_VAR; + } + + buf = buflist[index]->buf; + + xtv = (struct xtvec *)buf; + xtv_count = get_obj(argv[4]); + + if (xtv_count < 0) { + DBG(2, fprintf(outfp, "Unable to understand %s\n", argv[4])); + return INVALID_ARGS; + } + + DBG(3, fprintf(outfp, "ireadx(fd: %d, iov: %p iov_cnt: %d, xtv: %p, xtv_cnt: %d\n", + fd, iov, iov_count, xtv, xtv_count)); + + last_ret_val = (int) ireadx(fd, iov, iov_count, xtv, xtv_count); + if (last_ret_val < 0) + my_perror("ireadx"); + my_errno = errno; + last_type = SINT; + + return SUCCESS; +} + + +int do_checkbuf(int argc, char **argv) +{ + int size, val, index, i; + int *ref_buf, *buf; + + if (argc != 3) { + DBG(2, fprintf(outfp, "Need buffer and val for checkbuf\n")); + return INVALID_ARGS; + } + + index = get_obj(argv[0]); + + if (index < 0) { + DBG(2, fprintf(outfp, "Unable to find buf described by %s\n", argv[0])); + return INVALID_VAR; + } + + buf = (int *)buflist[index]->buf; + + val = get_obj(argv[1]); + + if (val < 0) { + DBG(2, fprintf(outfp, "Unable to understand %s\n", argv[1])); + return INVALID_ARGS; + } + + size = get_obj(argv[2]); + + if (size < 0) { + DBG(2, fprintf(outfp, "Unable to understand %s\n", argv[2])); + return INVALID_ARGS; + } + + ref_buf = (int *)malloc(size); + memset((void *)ref_buf, val, size); + + last_ret_val =0; + for (i=0; i < size/sizeof(int); i++) { + if (buf[i] != ref_buf[i]) { + DBG(2, fprintf(stderr, "At pos %d I found a 0x%08x instead of 0x%08x\n", + i, buf[i], ref_buf[i])); + fprintf(stderr, "At pos %d I found a 0x%08x instead of 0x%08x\n", + i, buf[i], ref_buf[i]); + last_ret_val = 1; + break; + } + } + + my_errno = errno; + last_type = SINT; + + return SUCCESS; +} Index: test_driver.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_driver.c,v retrieving revision 1.4.6.1 retrieving revision 1.4.6.2 diff -u -w -b -B -p -r1.4.6.1 -r1.4.6.2 --- test_driver.c 26 Jan 2004 16:27:48 -0000 1.4.6.1 +++ test_driver.c 30 Jan 2004 19:55:33 -0000 1.4.6.2 @@ -40,6 +40,7 @@ struct queue_t { struct cmd_t cmd_list[] = { {"alloc", get_buffer, usage_get_buffer}, {"chdir", test_do_chdir, usage_chdir}, + {"checkbuf", do_checkbuf, usage_checkbuf}, {"chmod", test_do_chmod, usage_chmod}, {"chown", test_do_chown, usage_chown}, {"clear", test_do_clear, usage_clear}, @@ -62,6 +63,8 @@ struct cmd_t cmd_list[] = { {"getcwd", test_do_getcwd, usage_getcwd}, {"getdirentries", test_do_getdirentries, usage_getdirentries}, {"init", test_do_init, usage_init}, + {"init_iovec", test_do_init_iovec, usage_init_iovec}, + {"init_xtvec", test_do_init_xtvec, usage_init_xtvec}, {"ioctl", test_do_ioctl, usage_ioctl}, {"iodone", test_do_iodone, usage_iodone}, {"iowait", test_do_iowait, usage_iowait}, @@ -71,8 +74,10 @@ struct cmd_t cmd_list[] = { {"ipwritev", test_do_ipwritev, usage_ipwritev}, {"iread", test_do_iread, usage_iread}, {"ireadv", test_do_ireadv, usage_ireadv}, + {"ireadx", test_do_ireadx, usage_ireadx}, {"iwrite", test_do_iwrite, usage_iwrite}, {"iwritev", test_do_iwritev, usage_iwritev}, + {"iwritex", test_do_iwritex, usage_iwritex}, {"list", test_do_list, usage_list}, {"lseek", test_do_lseek, usage_lseek}, {"lstat", test_do_lstat, usage_lstat}, @@ -89,7 +94,9 @@ struct cmd_t cmd_list[] = { {"quit", test_do_exit, usage_exit}, {"read", test_do_read, usage_read}, {"readv", test_do_readv, usage_readv}, + {"readx", test_do_readx, usage_readx}, {"rmdir", test_do_rmdir, usage_rmdir}, + {"setbuf", do_setbuf, usage_setbuf}, {"sizeof", get_sizeof, usage_sizeof}, /* {"setoutput", test_do_setoutput, usage_setoutput}, */ {"stat", test_do_stat, usage_stat}, @@ -101,6 +108,7 @@ struct cmd_t cmd_list[] = { {"unlink", test_do_unlink, usage_unlink}, {"write", test_do_write, usage_write}, {"writev", test_do_writev, usage_writev}, + {"writex", test_do_writex, usage_writex}, {NULL, NULL, NULL} }; @@ -415,7 +423,6 @@ int execute_cmd(char *cmd, char **args, if (!strcmp(cmd, "help")) { if (arg_count > 0) { - while(cmd_list[i].cmd != NULL) { if (!strcmp(cmd_list[i].cmd, args[0])) { (cmd_list[i].usage)(); @@ -430,8 +437,9 @@ int execute_cmd(char *cmd, char **args, return -1; } while(cmd_list[i].cmd != NULL) { - if (!strcmp(cmd_list[i].cmd, cmd)) + if (!strcmp(cmd_list[i].cmd, cmd)) { return (cmd_list[i].func)(arg_count, args); + } i++; } DBG(2, fprintf(outfp, "Command %s was invalid\n", cmd)); @@ -729,11 +737,6 @@ char *getline(char *prompt) if ((do_prompt) && (infp == stdin)) printf(prompt); - /* - fprintf(stderr, "getline: errno %x\n", errno); - fseek(infp, 0, SEEK_CUR); - fprintf(stderr, "getline: errno %x\n", errno); - */ do { /* If we get an end of file, just wait */ if (feof(infp)) { @@ -817,6 +820,124 @@ void init_map() } } +int getquotedlen(char *str) +{ + int i; + + if (str[0] != '"' && str[0] != '\'') + return -1; + + for (i=1; str[i] != '\0' && str[i] != '"' && str[i] != '\''; i++); + + return i; +} + +int perform_op(int num1, int num2, char op) +{ + switch(op) { + + case '+': + return num1 + num2; + break; + + case '*': + return num1 * num2; + break; + + case '/': + return num1 / num2; + break; + + case '-': + return num1 - num2; + break; + + case '%': + return num1%num2; + break; + + default: + return num1; + } + return 0; +} + +int get_constant_val(char **str_ptr, int type) +{ + struct buf_t *buf; + char *buf_ptr; + char *str = *str_ptr; + char ch; + int i, j, num1, num2, size; + + printf("Getting constant val from %s\n", str); + switch(type) { + case 1: + size = getquotedlen(str); + buf = (struct buf_t *)malloc(sizeof(struct buf_t)); + buf->buf = alloc_buff32(size, 8); + buf->len = size; + buf_ptr = buf->buf; + buflist[next] = buf; + j=0; + for (i=1; i < size; i++) { + buf_ptr[j] = str[i]; + j++; + } + buf_ptr[j] = '\0'; + + DBG(3, fprintf(outfp, "Your buffer (%p) (%p) is at index %d\n", + buf, buf->buf, next)); + next++; + + last_type = PTR; + last_ret_val = next-1; + return last_ret_val; + break; + + case 2: + if (str[0] == '$') { + num1 = get_obj(str); + } else { + num1 = atoi(str); + } + str = str_ptr[1]; + ch = str_ptr[1][0]; + if ((ch == '+') || (ch == '/') || (ch == '*') || + (ch == '-') || (ch == '%')) { + if (str_ptr[2][0] == '$') + num2 = get_obj(str_ptr[2]); + else + num2 = atoi(str_ptr[2]); + num1 = perform_op(num1, num2, ch); + } + + last_type = UINT; + last_ret_val = num1; + + break; + + default: + DBG(2, fprintf(outfp, "Can't understand type of %d\n", type)); + return INVALID_ARGS; + } + + return last_ret_val; +} + +int is_constant(char *str) +{ + if ((str[0] == '"') || (str[0] == '\'')) + return 1; + + + if ( (str[0] == '$') || + ( ((int)str[0] > 47) && ((int)str[0] < 57) ) ) + return 2; + + return 0; +} + int main(int argc, char *argv[]) { int count, err, i, orig_count; @@ -902,11 +1023,18 @@ int main(int argc, char *argv[]) count--; } i++; + if ((err=is_constant(cmd[i])) != 0) { + store_result((char *)(&cmd[0][1]), get_constant_val(&cmd[i], err)); + tree = NULL; + err = 0; + } else { + tree = build_tree(&cmd[i], &count, 0); if (tree != NULL) { err = run_cmd(tree); store_result((char *)(&cmd[0][1]), last_ret_val); } + } } else { tree = build_tree(cmd, &count, 0); Index: test_driver.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_driver.h,v retrieving revision 1.3 retrieving revision 1.3.6.1 diff -u -w -b -B -p -r1.3 -r1.3.6.1 --- test_driver.h 10 Oct 2003 18:50:31 -0000 1.3 +++ test_driver.h 30 Jan 2004 19:55:33 -0000 1.3.6.1 @@ -145,10 +145,12 @@ extern int test_do_list(int argc, char * extern int test_do_init(int argc, char **args); extern int get_endian(int argc, char **args); extern int get_sizeof(int argc, char **args); +extern int do_setbuf(int argc, char **argv); extern int test_do_exit(int argc, char **args); extern int get_buffer(int argc, char **args); extern int free_buffer(int argc, char **args); extern int test_do_chdir(int argc, char **args); +extern int do_checkbuf(int argc, char **argv); extern int test_do_chmod(int argc, char **args); extern int test_do_chown(int argc, char **args); extern int test_do_open(int argc, char **args); @@ -161,6 +163,8 @@ extern int test_do_fstat(int argc, char extern int test_do_fsync(int argc, char **argv); extern int test_do_ftruncate(int argc, char **argv); extern int test_do_getcwd(int argc, char **argv); +extern int test_do_init_iovec(int argc, char **argv); +extern int test_do_init_xtvec(int argc, char **argv); extern int test_do_lseek(int argc, char **argv); extern int test_do_lstat(int argc, char **argv); extern int test_do_getdirentries(int argc, char **argv); @@ -183,8 +187,10 @@ extern int test_do_ipread(int argc, char extern int test_do_preadv(int argc, char **argv); extern int test_do_pread(int argc, char **argv); extern int test_do_ireadv(int argc, char **argv); +extern int test_do_ireadx(int argc, char **argv); extern int test_do_iread(int argc, char **argv); extern int test_do_readv(int argc, char **argv); +extern int test_do_readx(int argc, char **argv); extern int test_do_read(int argc, char **argv); extern int test_do_ipwritev(int argc, char **argv); extern int test_do_ipwrite(int argc, char **argv); @@ -192,7 +198,9 @@ extern int test_do_pwritev(int argc, cha extern int test_do_pwrite(int argc, char **argv); extern int test_do_iwritev(int argc, char **argv); extern int test_do_iwrite(int argc, char **argv); +extern int test_do_iwritex(int argc, char **argv); extern int test_do_writev(int argc, char **argv); +extern int test_do_writex(int argc, char **argv); extern int test_do_write(int argc, char **argv); extern int test_do_mknod(int argc, char **argv); extern int test_do_umount(int argc, char **argv); @@ -246,12 +254,16 @@ extern void usage_fstat(); extern void usage_fsync(); extern void usage_ftruncate(); extern void usage_getcwd(); +extern void usage_init_iovec(); +extern void usage_init_xtvec(); extern void usage_lseek(); extern void usage_lstat(); extern void usage_getdirentries(); extern void usage_mkdir(); +extern void usage_checkbuf(); extern void usage_cmpbufs(); extern void usage_creat(); +extern void usage_setbuf(); extern void usage_stat(); extern void usage_statvfs(); extern void usage_fstatvfs(); @@ -270,7 +282,9 @@ extern void usage_preadv(); extern void usage_pread(); extern void usage_ireadv(); extern void usage_iread(); +extern void usage_ireadx(); extern void usage_readv(); +extern void usage_readx(); extern void usage_read(); extern void usage_ipwritev(); extern void usage_ipwrite(); @@ -278,8 +292,10 @@ extern void usage_pwritev(); extern void usage_pwrite(); extern void usage_iwritev(); extern void usage_iwrite(); +extern void usage_iwritex(); extern void usage_writev(); extern void usage_write(); +extern void usage_writex(); extern void usage_mknod(); extern void usage_umount(); extern void usage_exit(); Index: test_stats.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_stats.pl,v retrieving revision 1.5.6.1 retrieving revision 1.5.6.2 diff -u -w -b -B -p -r1.5.6.1 -r1.5.6.2 --- test_stats.pl 26 Jan 2004 16:27:48 -0000 1.5.6.1 +++ test_stats.pl 30 Jan 2004 19:55:33 -0000 1.5.6.2 @@ -172,6 +172,7 @@ sub process_cmd verify_stat($cmdfh, $outfh, "lstat", $is_alpha, @stats); } + if (0) { # Now do statvfs functions $cmdstr = '$buf2 = ALLOC ( $size2 = CALL sizeof statvfs )'."\n"; helper::send_cmd($cmdfh, $outfh, "alloc", $cmdstr); @@ -223,6 +224,7 @@ sub process_cmd helper::print_and_exit($cmdfh, $outfh, 1, $str); } } + } helper::print_and_exit($cmdfh, $outfh, 0, "stat test successful\n"); } |
|
From: Sonja T. <so...@us...> - 2004-01-30 19:57:19
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19342/drivers/native Modified Files: Tag: strided-io fs_native.c Log Message: Fixed bug in lockop_all that sent in the wrong command to fcntl. Added more calls to the test driver Added a rw test to the test suite. This calls all of the write/read combos: write, iwrite, writev, iwritev, pwrite, ipwrite, ipwritev, writex, iwritex. Ensures that what they wrote out and what they read back matches. Removed for now the statvfs test. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.25.6.7 retrieving revision 1.25.6.8 diff -u -w -b -B -p -r1.25.6.7 -r1.25.6.8 --- fs_native.c 29 Jan 2004 20:41:33 -0000 1.25.6.7 +++ fs_native.c 30 Jan 2004 19:55:33 -0000 1.25.6.8 @@ -1282,7 +1282,7 @@ lockop_all(struct native_inode *nino, #endif , nino->ni_fd, - op, + F_SETLK, &flock); if (err != 0) return -errno; |
|
From: Lee W. <lw...@us...> - 2004-01-28 21:12:48
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27118 Modified Files: Tag: strided-io inode.h Log Message: Commented the ND flags to help other out a little. These comments aren't very complete but do, at least, hint at the meanings. Index: inode.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/inode.h,v retrieving revision 1.13.6.5 retrieving revision 1.13.6.6 diff -u -w -b -B -p -r1.13.6.5 -r1.13.6.6 --- inode.h 27 Jan 2004 21:33:44 -0000 1.13.6.5 +++ inode.h 28 Jan 2004 21:11:33 -0000 1.13.6.6 @@ -314,8 +314,8 @@ struct nameidata { /* * Values for nameidata flags field. */ -#define ND_NOFOLLOW 0x01 -#define ND_NEGOK 0x02 +#define ND_NOFOLLOW 0x01 /* no follow symlinks */ +#define ND_NEGOK 0x02 /* last missing is ok */ #ifdef AUTOMOUNT_FILE_NAME #define _ND_INIT_AUTOMOUNT(nd) ((nd)->nd_amcnt = 0) |
|
From: Sonja T. <so...@us...> - 2004-01-28 13:55:06
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23056/drivers/native Modified Files: Tag: strided-io fs_native.c Log Message: Fixing memory bug in doio Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.25.6.5 retrieving revision 1.25.6.6 diff -u -w -b -B -p -r1.25.6.5 -r1.25.6.6 --- fs_native.c 26 Jan 2004 17:21:51 -0000 1.25.6.5 +++ fs_native.c 28 Jan 2004 13:53:53 -0000 1.25.6.6 @@ -1319,10 +1319,11 @@ doio(char op, struct ioctx *ioctx) * Must lock the regions (in order!) since we can't do * strided-IO as a single atomic operation. */ - oxtv = malloc(sizeof(struct intnl_xtvec)); + oxtv = malloc(sizeof(struct intnl_xtvec)*ioctx->ioctx_xtvlen); if (!oxtv) return -ENOMEM; - (void )memcpy(oxtv, ioctx->ioctx_xtv, ioctx->ioctx_xtvlen); + (void )memcpy(oxtv, ioctx->ioctx_xtv, + (ioctx->ioctx_xtvlen*sizeof(struct intnl_xtvec))); qsort(oxtv, ioctx->ioctx_xtvlen, sizeof(struct intnl_xtvec), |
|
From: Lee W. <lw...@us...> - 2004-01-28 13:18:10
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15431/src Modified Files: Tag: namespace_assembly access.c chdir.c chmod.c chown.c dev.c dup.c fcntl.c fsync.c getdirentries.c init.c inode.c ioctl.c iowait.c link.c lseek.c mkdir.c mknod.c namei.c open.c read.c rmdir.c stat.c stat64.c statvfs.c statvfs64.c symlink.c truncate.c unlink.c utime.c write.c Log Message: Bring in changes from the HEAD. Index: access.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/access.c,v retrieving revision 1.2 retrieving revision 1.2.6.1 diff -u -w -b -B -p -r1.2 -r1.2.6.1 --- access.c 6 Aug 2003 19:10:26 -0000 1.2 +++ access.c 28 Jan 2004 13:16:56 -0000 1.2.6.1 @@ -47,6 +47,8 @@ #include <sys/stat.h> #include <unistd.h> +#include "sysio-symbols.h" + int access(const char *path, int amode) { @@ -108,3 +110,8 @@ out: return err; } + +#ifdef REDSTORM +#undef __access +sysio_sym_weak_alias(access, __access) +#endif Index: chdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chdir.c,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -u -w -b -B -p -r1.10 -r1.10.2.1 --- chdir.c 27 Oct 2003 23:42:29 -0000 1.10 +++ chdir.c 28 Jan 2004 13:16:56 -0000 1.10.2.1 @@ -119,14 +118,19 @@ chdir(const char *path) { int err; struct pnode *pno; + SYSIO_ENTER; err = _sysio_namei(_sysio_cwd, path, 0, NULL, &pno); if (err) { errno = -err; + SYSIO_LEAVE; return -1; } - return _sysio_p_chdir(pno); + err = _sysio_p_chdir(pno); + + SYSIO_LEAVE; + return err; } /* @@ -135,6 +139,11 @@ chdir(const char *path) * If the buf pointer is NULL, a buffer large enough to hold the path * is allocated from the heap. */ +#ifdef REDSTORM +#undef __chdir +sysio_sym_weak_alias(chdir, __chdir) +#endif + static int _sysio_p_path(struct pnode *pno, char **buf, size_t size) { @@ -219,12 +228,15 @@ char * getcwd(char *buf, size_t size) { int err; + SYSIO_ENTER; err = _sysio_p_path(_sysio_cwd, &buf, buf ? size : 0); if (err) { errno = -err; + SYSIO_LEAVE; return NULL; } + SYSIO_LEAVE; return buf; } @@ -232,7 +244,7 @@ getcwd(char *buf, size_t size) sysio_sym_weak_alias(getcwd, __getcwd) #endif -#ifdef PATH_MAX +#if defined(PATH_MAX) && !(defined(REDSTORM)) char * getwd(char *buf) { Index: chmod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chmod.c,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -w -b -B -p -r1.4 -r1.4.2.1 --- chmod.c 27 Sep 2003 19:42:02 -0000 1.4 +++ chmod.c 28 Jan 2004 13:16:56 -0000 1.4.2.1 @@ -52,6 +52,7 @@ #include "sysio.h" #include "inode.h" #include "file.h" +#include "sysio-symbols.h" static int do_chmod(struct pnode *pno, struct inode *ino, mode_t mode) @@ -70,12 +71,11 @@ do_chmod(struct pnode *pno, struct inode int chmod(const char *path, mode_t mode) { - struct intent intent; int err; struct pnode *pno; + SYSIO_ENTER; - INTENT_INIT(&intent, INT_SETATTR, NULL, NULL); - err = _sysio_namei(_sysio_cwd, path, 0, &intent, &pno); + err = _sysio_namei(_sysio_cwd, path, 0, NULL, &pno); if (err) goto out; err = do_chmod(pno, pno->p_base->pb_ino, mode); @@ -85,9 +85,15 @@ out: errno = -err; err = -1; } + SYSIO_LEAVE; return err; } +#ifdef REDSTORM +#undef __chmod +sysio_sym_weak_alias(chmod, __chmod) +#endif + int fchmod(int fd, mode_t mode) { @@ -109,3 +115,8 @@ out: } return err; } + +#ifdef REDSTORM +#undef __fchmod +sysio_sym_weak_alias(fchmod, __fchmod) +#endif Index: chown.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chown.c,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -w -b -B -p -r1.4 -r1.4.2.1 --- chown.c 27 Sep 2003 19:42:02 -0000 1.4 +++ chown.c 28 Jan 2004 13:16:56 -0000 1.4.2.1 @@ -52,6 +52,7 @@ #include "sysio.h" #include "inode.h" #include "file.h" +#include "sysio-symbols.h" static int _do_chown(struct pnode *pno, struct inode *ino, uid_t owner, gid_t group) @@ -59,6 +60,7 @@ _do_chown(struct pnode *pno, struct inod int err; struct intnl_stat stbuf; unsigned mask; + SYSIO_ENTER; (void )memset(&stbuf, 0, sizeof(struct intnl_stat)); mask = 0; @@ -91,7 +93,13 @@ out: errno = -err; err = -1; } + SYSIO_LEAVE; return err; +#ifdef REDSTORM +#undef __chown +sysio_sym_weak_alias(chown, __chown) +#endif + } int @@ -113,5 +121,10 @@ out: errno = -err; err = -1; } + +#ifdef REDSTORM +#undef __fchown +sysio_sym_weak_alias(fchown, __fchown) +#endif return err; } Index: dev.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/dev.c,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -w -b -B -p -r1.4 -r1.4.2.1 --- dev.c 10 Oct 2003 18:50:31 -0000 1.4 +++ dev.c 28 Jan 2004 13:16:56 -0000 1.4.2.1 @@ -158,7 +158,7 @@ _sysio_dev_lookup(mode_t mode, dev_t dev struct device *devtbl; dev_t major; - if (S_ISCHR(mode)) + if (S_ISCHR(mode) || S_ISFIFO(mode)) devtbl = cdev; else return (struct inode_ops *)&_sysio_nodev_ops; Index: dup.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/dup.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -w -b -B -p -r1.2 -r1.2.2.1 --- dup.c 23 Oct 2003 15:16:05 -0000 1.2 +++ dup.c 28 Jan 2004 13:16:56 -0000 1.2.2.1 @@ -48,29 +48,61 @@ #include "sysio.h" #include "file.h" +#include "sysio-symbols.h" #include "sysio-symbols.h" int dup2(int oldfd, int newfd) { + int rc; + SYSIO_ENTER; if (newfd < 0) { errno = EBADF; + SYSIO_LEAVE; return -1; } - if (oldfd == newfd) + if (oldfd == newfd) { +#ifdef REDSTORM +#undef __dup2 +sysio_sym_weak_alias(dup2, __dup2) +#endif + + SYSIO_LEAVE; return newfd; + } + + rc = _sysio_fd_dup2(oldfd, newfd); + if (rc < 0) { + +#ifdef REDSTORM +#undef __dup +sysio_sym_weak_alias(dup, __dup) +#endif + errno = -rc; + rc = -1; + } - return _sysio_fd_dup2(oldfd, newfd); + SYSIO_LEAVE; + return rc; } int dup(int oldfd) { + int rc; + SYSIO_ENTER; + + rc = _sysio_fd_dup2(oldfd, -1); + if (rc < 0) { + errno = -rc; + rc = -1; + } - return _sysio_fd_dup2(oldfd, -1); + SYSIO_LEAVE; + return rc; } #ifdef __GLIBC__ Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -u -w -b -B -p -r1.6 -r1.6.2.1 --- fcntl.c 14 Oct 2003 18:00:29 -0000 1.6 +++ fcntl.c 28 Jan 2004 13:16:56 -0000 1.6.2.1 @@ -59,6 +59,7 @@ fcntl(int fd, int cmd, ...) int err; struct file *fil; va_list ap; + SYSIO_ENTER; err = 0; fil = _sysio_fd_find(fd); @@ -72,6 +73,7 @@ fcntl(int fd, int cmd, ...) case F_DUPFD: { long newfd; + int rc; va_start(ap, cmd); newfd = va_arg(ap, long); @@ -80,7 +82,10 @@ fcntl(int fd, int cmd, ...) err = -EBADF; goto out; } - return _sysio_fd_dup2(fd, (int )newfd); + rc = _sysio_fd_dup2(fd, (int )newfd); + + SYSIO_LEAVE; + return rc; } break; default: @@ -95,6 +100,7 @@ out: errno = -err; err = -1; } + SYSIO_LEAVE; return err; } @@ -103,7 +109,7 @@ out: sysio_sym_weak_alias(fcntl, __fcntl) #endif -#if defined(BSD) || defined(REDSTORM) +#ifdef BSD #undef _fcntl sysio_sym_weak_alias(fcntl, _fcntl) #endif Index: fsync.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fsync.c,v retrieving revision 1.2 retrieving revision 1.2.16.1 diff -u -w -b -B -p -r1.2 -r1.2.16.1 --- fsync.c 9 Mar 2003 06:22:43 -0000 1.2 +++ fsync.c 28 Jan 2004 13:16:56 -0000 1.2.16.1 @@ -55,17 +55,22 @@ fsync(int fd) { struct file *fil; int err; + SYSIO_ENTER; fil = _sysio_fd_find(fd); if (!(fil && fil->f_ino)) { errno = -EBADF; + SYSIO_LEAVE; return -1; } err = (*fil->f_ino->i_ops.inop_sync)(fil->f_ino); if (err) { errno = -err; + SYSIO_LEAVE; return -1; } + + SYSIO_LEAVE; return 0; } @@ -74,16 +79,21 @@ fdatasync(int fd) { struct file *fil; int err; + SYSIO_ENTER; fil = _sysio_fd_find(fd); if (!(fil && fil->f_ino)) { errno = -EBADF; + SYSIO_LEAVE; return -1; } err = (*fil->f_ino->i_ops.inop_datasync)(fil->f_ino); if (err) { errno = -err; + SYSIO_LEAVE; return -1; } + + SYSIO_LEAVE; return 0; } Index: getdirentries.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/getdirentries.c,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -w -b -B -p -r1.4 -r1.4.2.1 --- getdirentries.c 14 Oct 2003 18:00:29 -0000 1.4 +++ getdirentries.c 28 Jan 2004 13:16:56 -0000 1.4.2.1 @@ -96,8 +95,10 @@ getdirentries(int fd, size_t n; size_t reclen; char *cp; + SYSIO_ENTER; #define _dbaselen ((size_t )&((struct dirent *)0)->d_name[0]) + #ifdef __GLIBC__ #define _dreclen(namlen) \ ((_dbaselen + (namlen) + __alignof__ (struct dirent)) & \ @@ -102,11 +103,15 @@ getdirentries(int fd, #define _dreclen(namlen) \ ((_dbaselen + (namlen) + __alignof__ (struct dirent)) & \ ~(__alignof__ (struct dirent) - 1)) -#define _fast_alloc(n) alloca(n) -#define _fast_free(p) #else /* !defined(__GLIBC__) */ #define _dreclen(namlen) \ _rndup(_dbaselen + (namlen) + 1, sizeof(int)) +#endif + +#if defined(__GLIBC__) && !(defined(REDSTORM)) +#define _fast_alloc(n) alloca(n) +#define _fast_free(p) +#else /* !defined(__GLIBC__) || defined(REDSTORM) */ #define _fast_alloc(n) malloc(n) #define _fast_free(p) free(p) #endif @@ -128,6 +133,7 @@ getdirentries(int fd, ibuf = _fast_alloc(inbytes); if (!ibuf) { errno = ENOMEM; + SYSIO_LEAVE; return -1; } @@ -199,6 +205,7 @@ out: if (dp == (struct dirent *)buf && cc < 0) { errno = (int )-cc; + SYSIO_LEAVE; return -1; } cc = (char *)dp - buf; @@ -209,6 +216,7 @@ out: #else off; #endif + SYSIO_LEAVE; return cc; #ifdef __GLIBC__ @@ -222,6 +230,10 @@ out: sysio_sym_strong_alias(_getdirentries64, getdirentries) #endif +#ifdef REDSTORM +#undef __getdirentries +sysio_sym_weak_alias(getdirentries, __getdirentries) +#endif #if defined(BSD) || defined(REDSTORM) #undef _getdirentries sysio_sym_weak_alias(getdirentries, _getdirentries) Index: init.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/init.c,v retrieving revision 1.3 retrieving revision 1.3.12.1 diff -u -w -b -B -p -r1.3 -r1.3.12.1 --- init.c 24 Mar 2003 22:09:06 -0000 1.3 +++ init.c 28 Jan 2004 13:16:56 -0000 1.3.12.1 @@ -64,6 +64,9 @@ int _sysio_init() { int err; +#ifdef WITH_SOCKETS + int _sysio_sockets_init(void); +#endif err = _sysio_ioctx_init(); if (err) @@ -83,6 +86,11 @@ _sysio_init() if (err) goto error; #endif +#ifdef WITH_SOCKETS + err = _sysio_sockets_init(); + if (err) + goto error; +#endif goto out; error: Index: inode.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/inode.c,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -u -w -b -B -p -r1.11 -r1.11.2.1 --- inode.c 15 Oct 2003 18:00:57 -0000 1.11 +++ inode.c 28 Jan 2004 13:16:56 -0000 1.11.2.1 @@ -217,7 +217,7 @@ _sysio_i_new(struct filesys *fs, if (!ino) return NULL; ino->i_ops = *ops; - if (S_ISBLK(type) || S_ISCHR(type)) { + if (S_ISBLK(type) || S_ISCHR(type) || S_ISFIFO(type)) { struct inode_ops *o; /* Index: ioctl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/ioctl.c,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -w -b -B -p -r1.4 -r1.4.2.1 --- ioctl.c 14 Oct 2003 18:00:30 -0000 1.4 +++ ioctl.c 28 Jan 2004 13:16:56 -0000 1.4.2.1 @@ -58,6 +58,7 @@ ioctl(int fd, unsigned long request, ... int err; struct file *fil; va_list ap; + SYSIO_ENTER; err = 0; fil = _sysio_fd_find(fd); @@ -75,6 +76,7 @@ out: errno = -err; err = -1; } + SYSIO_LEAVE; return err; } @@ -84,7 +86,7 @@ out: sysio_sym_weak_alias(ioctl, __ioctl) #endif -#if defined(BSD) || defined(REDSTORM) +#ifdef BSD #undef _ioctl sysio_sym_weak_alias(ioctl, _ioctl) #endif Index: iowait.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/iowait.c,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -w -b -B -p -r1.4 -r1.4.2.1 --- iowait.c 17 Oct 2003 21:30:29 -0000 1.4 +++ iowait.c 28 Jan 2004 13:16:56 -0000 1.4.2.1 @@ -70,13 +70,19 @@ int iodone(ioid_t ioid) { struct ioctx *ioctx; + int rc; + SYSIO_ENTER; ioctx = lookup_ioid(ioid); - if (!ioctx) + if (!ioctx) { + SYSIO_LEAVE; return -1; + } - return (ioctx->ioctx_done || + rc = (ioctx->ioctx_done || (*ioctx->ioctx_ino->i_ops.inop_iodone)(ioctx)); + SYSIO_LEAVE; + return rc; } /* @@ -90,15 +96,19 @@ iowait(ioid_t ioid) { struct ioctx *ioctx; ssize_t cc; + SYSIO_ENTER; ioctx = lookup_ioid(ioid); - if (!ioctx) + if (!ioctx) { + SYSIO_LEAVE; return -1; + } cc = _sysio_ioctx_wait(ioctx); if (cc < 0) { errno = -(int )cc; cc = -1; } + SYSIO_LEAVE; return cc; } Index: link.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/link.c,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -u -w -b -B -p -r1.2 -r1.2.4.1 --- link.c 20 Oct 2003 16:31:23 -0000 1.2 +++ link.c 28 Jan 2004 13:16:56 -0000 1.2.4.1 @@ -52,6 +52,7 @@ #include "sysio.h" #include "mount.h" #include "inode.h" +#include "sysio-symbols.h" int link(const char *oldpath, const char *newpath) @@ -100,3 +101,8 @@ error2: out: return err; } + +#ifdef REDSTORM +#undef __link +sysio_sym_weak_alias(link, __link) +#endif Index: lseek.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/lseek.c,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -u -w -b -B -p -r1.9 -r1.9.2.1 --- lseek.c 29 Oct 2003 00:10:42 -0000 1.9 +++ lseek.c 28 Jan 2004 13:16:56 -0000 1.9.2.1 @@ -110,6 +110,10 @@ sysio_sym_weak_alias(_sysio_lseek, lseek #undef __lseek64 sysio_sym_weak_alias(_sysio_lseek, __lseek64) #endif +#ifdef REDSTORM +#undef __libc_lseek64 +sysio_sym_weak_alias(_sysio_lseek, __libc_lseek64) +#endif #endif #undef lseek @@ -119,15 +123,20 @@ lseek(int fd, off_t offset, int whence) { _SYSIO_OFF_T off; off_t rtn; + SYSIO_ENTER; off = _sysio_lseek(fd, offset, whence); - if (off < 0) + if (off < 0) { + SYSIO_LEAVE; return -1; + } rtn = (off_t )off; if ((_SYSIO_OFF_T )rtn != off) { errno = EINVAL; + SYSIO_LEAVE; return -1; } + SYSIO_LEAVE; return rtn; } Index: mkdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mkdir.c,v retrieving revision 1.3 retrieving revision 1.3.12.1 diff -u -w -b -B -p -r1.3 -r1.3.12.1 --- mkdir.c 24 Mar 2003 22:09:06 -0000 1.3 +++ mkdir.c 28 Jan 2004 13:16:56 -0000 1.3.12.1 @@ -51,6 +51,7 @@ #include "inode.h" #include "fs.h" #include "mount.h" +#include "sysio-symbols.h" int mkdir(const char *path, mode_t mode) @@ -58,6 +59,7 @@ mkdir(const char *path, mode_t mode) int err; struct intent intent; struct pnode *pno; + SYSIO_ENTER; INTENT_INIT(&intent, INT_CREAT, &mode, NULL); err = _sysio_namei(_sysio_cwd, path, ND_NEGOK, &intent, &pno); @@ -80,5 +82,12 @@ out: errno = -err; err = -1; } + + +#ifdef REDSTORM +#undef __mkdir +sysio_sym_weak_alias(mkdir, __mkdir) +#endif + SYSIO_LEAVE; return err; } Index: mknod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mknod.c,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -w -b -B -p -r1.4 -r1.4.2.1 --- mknod.c 10 Oct 2003 18:50:31 -0000 1.4 +++ mknod.c 28 Jan 2004 13:16:56 -0000 1.4.2.1 @@ -81,7 +81,8 @@ __xmknod(int __ver, const char *path, mo /* * Support only character-special right now. */ - if ((mode & S_IFMT) != S_IFCHR) { + if (((mode & S_IFMT) != S_IFIFO) && + ((mode & S_IFMT) != S_IFCHR)) { err = -EPERM; goto out; } @@ -110,12 +111,22 @@ out: } return err; } +#ifdef REDSTORM +#undef _xmknod +sysio_sym_weak_alias(__xmknod, _xmknod) +#endif + static int __mknod(const char *path, mode_t mode, dev_t dev) { + int rc; + SYSIO_ENTER; + + rc = __xmknod(_MKNOD_VER, path, mode, &dev); - return __xmknod(_MKNOD_VER, path, mode, &dev); + SYSIO_LEAVE; + return rc; } sysio_sym_weak_alias(__mknod, mknod) Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -u -w -b -B -p -r1.8 -r1.8.2.1 --- namei.c 28 Oct 2003 20:59:39 -0000 1.8 +++ namei.c 28 Jan 2004 13:16:56 -0000 1.8.2.1 @@ -435,28 +435,12 @@ _sysio_path_walk(struct pnode *parent, s } #ifdef CPLANT_YOD -static const char * -strip_prefix(const char *path) -{ - /* * for backward compatibility w/protocol switch - * remove 'prefix:' iff first ':' immediately - * precedes first '/' + * remove everything up to the first ':' + * fortran libs prepend cwd to path, so not much choice */ - - char *colon, *slash; - - colon = strchr(path, ':'); - slash = strchr(path, '/'); - - if (slash == colon + 1) - return(slash); - else - return(path); - -} -#define STRIP_PREFIX(p) strip_prefix(p) +#define STRIP_PREFIX(p) strchr(p,':') ? strchr(p,':')+1 : p #else #define STRIP_PREFIX(p) p #endif Index: open.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/open.c,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -u -w -b -B -p -r1.11 -r1.11.2.1 --- open.c 14 Oct 2003 18:00:30 -0000 1.11 +++ open.c 28 Jan 2004 13:16:56 -0000 1.11.2.1 @@ -55,6 +55,7 @@ #include "file.h" #include "fs.h" #include "mount.h" +#include "sysio-symbols.h" #include "sysio-symbols.h" @@ -129,6 +130,7 @@ open(const char *path, int flags, ...) int err; struct pnode *pno; struct file *fil; + SYSIO_ENTER; /* * Get mode argument and determine parameters for namei @@ -169,7 +171,7 @@ open(const char *path, int flags, ...) * Find the file. */ fil = NULL; - INTENT_INIT(&intent, intent.int_opmask, &mode, NULL); + INTENT_INIT(&intent, intent.int_opmask, &mode, &flags); pno = NULL; err = _sysio_namei(_sysio_cwd, path, ndflags, &intent, &pno); if (err) { @@ -196,6 +198,7 @@ open(const char *path, int flags, ...) P_RELE(pno); + SYSIO_LEAVE; return err; error: @@ -204,6 +207,7 @@ error: if (pno) P_RELE(pno); errno = -err; + SYSIO_LEAVE; return -1; } @@ -216,7 +220,12 @@ sysio_sym_weak_alias(open, open64) sysio_sym_weak_alias(open, __open64) #endif -#if defined(BSD) || defined(REDSTORM) +#ifdef REDSTORM +#undef __libc_open64 +sysio_sym_weak_alias(open, __libc_open64) +#endif + +#ifdef BSD #undef _open sysio_sym_weak_alias(open, _open) #endif @@ -225,10 +234,12 @@ int close(int fd) { int err; + SYSIO_ENTER; err = _sysio_fd_close(fd); if (err) errno = -err; + SYSIO_LEAVE; return err ? -1 : 0; } @@ -237,7 +248,7 @@ close(int fd) sysio_sym_weak_alias(close, __close) #endif -#if defined(BSD) || defined(REDSTORM) +#ifdef BSD #undef _close sysio_sym_weak_alias(close, _close) #endif @@ -258,7 +269,12 @@ sysio_sym_weak_alias(creat, creat64) sysio_sym_weak_alias(creat, __creat64) #endif -#if defined(BSD) || defined(REDSTORM) +#ifdef REDSTORM +#undef __libc_creat +sysio_sym_weak_alias(creat, __libc_creat) +#endif + +#ifdef BSD #undef _creat sysio_sym_weak_alias(creat, _creat) #endif @@ -272,3 +288,8 @@ umask(mode_t mask) _sysio_umask = mask & 0777; return omask; } + +#ifdef REDSTORM +#undef __umask +sysio_sym_weak_alias(umask, __umask) +#endif Index: read.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/read.c,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -u -w -b -B -p -r1.9 -r1.9.2.1 --- read.c 14 Oct 2003 18:00:30 -0000 1.9 +++ read.c 28 Jan 2004 13:16:56 -0000 1.9.2.1 @@ -112,14 +111,17 @@ ipreadv(int fd, const struct iovec *iov, { struct file *fil; struct ioctx *ioctxp; + SYSIO_ENTER; fil = _sysio_fd_find(fd); if (!fil) { errno = -EBADF; + SYSIO_LEAVE; return IOID_FAIL; } ioctxp = do_ixreadv(fil, iov, count, offset, NULL); + SYSIO_LEAVE; return ioctxp ? ioctxp->ioctx_id : IOID_FAIL; } @@ -178,6 +180,13 @@ pread(int fd, void *buf, size_t count, o } #else #undef pread +#ifdef REDSTORM +#undef __libc_pread +sysio_sym_weak_alias(pread, __libc_pread) +#undef __libc_pread64 +sysio_sym_weak_alias(pread64, __libc_pread64) +#endif + sysio_sym_weak_alias(_pread, pread) #endif @@ -189,16 +198,21 @@ ireadv(int fd, const struct iovec *iov, { struct file *fil; struct ioctx *ioctxp; + SYSIO_ENTER; fil = _sysio_fd_find(fd); if (!fil) { errno = -EBADF; + SYSIO_LEAVE; return IOID_FAIL; } ioctxp = do_ixreadv(fil, iov, count, fil->f_pos, _sysio_fcompletio); - if (!ioctxp) + if (!ioctxp) { + SYSIO_LEAVE; return IOID_FAIL; + } + SYSIO_LEAVE; return ioctxp->ioctx_id; } @@ -227,11 +241,18 @@ readv(int fd, const struct iovec *iov, i return iowait(ioid); } -#if defined(BSD) || defined(REDSTORM) +#ifdef BSD #undef _readv sysio_sym_weak_alias(readv, _readv) #endif +#ifdef REDSTORM +#undef __libc_readv +sysio_sym_weak_alias(readv, __libc_readv) +#undef __readv +sysio_sym_weak_alias(readv, __readv) +#endif + ssize_t read(int fd, void *buf, size_t count) { @@ -248,7 +269,12 @@ read(int fd, void *buf, size_t count) sysio_sym_weak_alias(read, __read) #endif -#if defined(BSD) || defined(REDSTORM) +#ifdef REDSTORM +#undef __libc_read +sysio_sym_weak_alias(read, __libc_read) +#endif + +#ifdef BSD #undef _read sysio_sym_weak_alias(read, _read) #endif Index: rmdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rmdir.c,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -w -b -B -p -r1.4 -r1.4.2.1 --- rmdir.c 27 Sep 2003 19:42:03 -0000 1.4 +++ rmdir.c 28 Jan 2004 13:16:56 -0000 1.4.2.1 @@ -51,6 +51,7 @@ #include "inode.h" #include "fs.h" #include "mount.h" +#include "sysio-symbols.h" int rmdir(const char *path) @@ -58,6 +59,7 @@ rmdir(const char *path) struct intent intent; int err; struct pnode *pno; + SYSIO_ENTER; INTENT_INIT(&intent, INT_UPDPARENT, NULL, NULL); err = _sysio_namei(_sysio_cwd, path, 0, &intent, &pno); @@ -82,5 +84,11 @@ out: errno = -err; err = -1; } + SYSIO_LEAVE; + +#ifdef REDSTORM +#undef __rmdir +sysio_sym_weak_alias(rmdir, __rmdir) +#endif return err; } Index: stat.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/stat.c,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -u -w -b -B -p -r1.7 -r1.7.2.1 --- stat.c 24 Oct 2003 18:49:24 -0000 1.7 +++ stat.c 28 Jan 2004 13:16:56 -0000 1.7.2.1 @@ -99,6 +99,11 @@ __fxstat(int __ver, int __fildes, struct if (__ver != _STAT_VER) { err = -ENOSYS; +#ifdef REDSTORM +#undef _fxstat +sysio_sym_weak_alias(__fxstat, _fxstat) +#endif + goto out; } @@ -129,13 +134,18 @@ out: static int __fstat(int fd, struct stat *buf) { + int rc; + SYSIO_ENTER; + + rc = __fxstat(_STAT_VER, fd, buf); - return __fxstat(_STAT_VER, fd, buf); + SYSIO_LEAVE; + return rc; } sysio_sym_weak_alias(__fstat, fstat) -#if defined(BSD) || defined(REDSTORM) +#ifdef BSD #undef _fstat sysio_sym_weak_alias(__fstat, _fstat) #endif @@ -171,6 +181,11 @@ __xstat(int __ver, const char *__filenam ino->i_ops.inop_getattr(pno, pno->p_base->pb_ino, buf); +#ifdef REDSTORM +#undef _xstat +sysio_sym_weak_alias(__xstat, _xstat) +#endif + P_RELE(pno); #if _LARGEFILE64_SOURCE convstat(buf, __stat_buf); @@ -186,13 +201,18 @@ out: static int __stat(const char *filename, struct stat *buf) { + int rc; + SYSIO_ENTER; - return __xstat(_STAT_VER, filename, buf); + rc = __xstat(_STAT_VER, filename, buf); + + SYSIO_LEAVE; + return rc; } sysio_sym_weak_alias(__stat, stat) -#if defined(BSD) || defined(REDSTORM) +#ifdef BSD #undef _stat sysio_sym_weak_alias(__stat, _stat) #endif @@ -228,6 +248,11 @@ __lxstat(int __ver, const char *__filena ino->i_ops.inop_getattr(pno, pno->p_base->pb_ino, buf); +#ifdef REDSTORM +#undef _lxstat +sysio_sym_weak_alias(__lxstat, _lxstat) +#endif + P_RELE(pno); #if _LARGEFILE64_SOURCE convstat(buf, __stat_buf); @@ -243,13 +268,18 @@ out: static int __lstat(const char *filename, struct stat *buf) { + int rc; + SYSIO_ENTER; + + rc = __lxstat(_STAT_VER, filename, buf); - return __lxstat(_STAT_VER, filename, buf); + SYSIO_LEAVE; + return rc; } sysio_sym_weak_alias(__lstat, lstat) -#if defined(BSD) || defined(REDSTORM) +#ifdef BSD #undef _lstat sysio_sym_weak_alias(__lstat, _lstat) #endif Index: stat64.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/stat64.c,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -u -w -b -B -p -r1.5 -r1.5.2.1 --- stat64.c 21 Oct 2003 01:13:58 -0000 1.5 +++ stat64.c 28 Jan 2004 13:16:56 -0000 1.5.2.1 @@ -91,8 +91,13 @@ out: int fstat64(int fd, struct stat64 *buf) { + int rc; + SYSIO_ENTER; - return __fxstat64(_STAT_VER, fd, buf); + rc = __fxstat64(_STAT_VER, fd, buf); + + SYSIO_LEAVE; + return rc; } int @@ -127,8 +132,13 @@ out: int stat64(const char *filename, struct stat64 *buf) { + int rc; + SYSIO_ENTER; + + rc = __xstat64(_STAT_VER, filename, buf); - return __xstat64(_STAT_VER, filename, buf); + SYSIO_LEAVE; + return rc; } int @@ -163,7 +173,12 @@ out: int lstat64(const char *filename, struct stat64 *buf) { + int rc; + SYSIO_ENTER; + + rc = __lxstat64(_STAT_VER, filename, buf); - return __lxstat64(_STAT_VER, filename, buf); + SYSIO_LEAVE; + return rc; } #endif /* !_LARGEFILE64_SOURCE */ Index: statvfs.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/statvfs.c,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -w -b -B -p -r1.4 -r1.4.2.1 --- statvfs.c 10 Oct 2003 18:50:31 -0000 1.4 +++ statvfs.c 28 Jan 2004 13:16:56 -0000 1.4.2.1 @@ -43,7 +43,7 @@ #ifdef _HAVE_STATVFS -#if !(defined(BSD) || defined(REDSTORM)) +#ifndef BSD #include <unistd.h> #include <errno.h> @@ -55,6 +55,7 @@ #include "sysio.h" #include "inode.h" #include "file.h" +#include "sysio-symbols.h" #undef statvfs #undef fstatvfs @@ -88,6 +89,7 @@ statvfs(const char *path, struct statvfs struct intnl_statvfs _call_buffer; struct intnl_statvfs *_call_buf = &_call_buffer; #endif + SYSIO_ENTER; err = _sysio_namei(_sysio_cwd, path, 0, NULL, &pno); if (err) @@ -105,7 +107,13 @@ err: errno = -err; err = -1; out: + SYSIO_LEAVE; return err; +#ifdef REDSTORM +#undef __statvfs +sysio_sym_weak_alias(statvfs, __statvfs) +#endif + } int @@ -119,6 +127,7 @@ fstatvfs(int fd, struct statvfs *buf) struct intnl_statvfs _call_buffer; struct intnl_statvfs *_call_buf = &_call_buffer; #endif + SYSIO_ENTER; err = 0; filp = _sysio_fd_find(fd); @@ -138,7 +147,14 @@ err: errno = -err; err = -1; out: + SYSIO_LEAVE; return err; } -#endif /* if !(defined(BSD) || defined(REDSTORM)) */ + +#ifdef REDSTORM +#undef __fstatvfs +sysio_sym_weak_alias(fstatvfs, __fstatvfs) +#endif + +#endif /* ifndef BSD */ #endif /* defined(_HAVE_STATVFS) */ Index: statvfs64.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/statvfs64.c,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -u -w -b -B -p -r1.5 -r1.5.2.1 --- statvfs64.c 21 Oct 2003 13:38:47 -0000 1.5 +++ statvfs64.c 28 Jan 2004 13:16:56 -0000 1.5.2.1 @@ -43,7 +43,7 @@ #ifdef _HAVE_STATVFS -#if !(defined(BSD) || defined(REDSTORM)) +#ifndef BSD #include <unistd.h> #include <errno.h> #include <assert.h> @@ -54,12 +54,14 @@ #include "sysio.h" #include "inode.h" #include "file.h" +#include "sysio-symbols.h" int statvfs64(const char *path, struct statvfs64 *buf) { int err; struct pnode *pno; + SYSIO_ENTER; err = _sysio_namei(_sysio_cwd, path, 0, NULL, &pno); if (err) @@ -72,6 +74,13 @@ out: errno = -err; err = -1; } + + SYSIO_LEAVE; +#ifdef REDSTORM +#undef __statvfs64 +sysio_sym_weak_alias(statvfs64, __statvfs64) +#endif + return err; } @@ -80,6 +89,7 @@ fstatvfs64(int fd, struct statvfs64 *buf { int err; struct file *filp; + SYSIO_ENTER; err = 0; filp = _sysio_fd_find(fd); @@ -94,7 +104,15 @@ out: errno = -err; err = -1; } + + SYSIO_LEAVE; return err; } -#endif /* if !(defined(BSD) || defined(REDSTORM)) */ + +#ifdef REDSTORM +#undef __fstatvfs64 +sysio_sym_weak_alias(fstatvfs64, __fstatvfs64) +#endif + +#endif /* ifndef BSD */ #endif /* define(_HAVE_STATVFS) */ Index: symlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/symlink.c,v retrieving revision 1.3 retrieving revision 1.3.12.1 diff -u -w -b -B -p -r1.3 -r1.3.12.1 --- symlink.c 24 Mar 2003 22:09:07 -0000 1.3 +++ symlink.c 28 Jan 2004 13:16:56 -0000 1.3.12.1 @@ -51,6 +51,7 @@ #include "inode.h" #include "fs.h" #include "mount.h" +#include "sysio-symbols.h" int symlink(const char *oldpath, const char *newpath) @@ -58,6 +59,7 @@ symlink(const char *oldpath, const char int err; struct intent intent; struct pnode *pno; + SYSIO_ENTER; INTENT_INIT(&intent, INT_CREAT, NULL, NULL); err = _sysio_namei(_sysio_cwd, newpath, ND_NEGOK, &intent, &pno); @@ -81,5 +83,11 @@ out: errno = -err; err = -1; } + SYSIO_LEAVE; + +#ifdef REDSTORM +#undef __symlink +sysio_sym_weak_alias(symlink, __symlink) +#endif return err; } Index: truncate.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/truncate.c,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -u -w -b -B -p -r1.5 -r1.5.2.1 --- truncate.c 23 Oct 2003 15:20:31 -0000 1.5 +++ truncate.c 28 Jan 2004 13:16:57 -0000 1.5.2.1 @@ -84,6 +84,7 @@ _truncate(const char *path, _SYSIO_OFF_T { int err; struct pnode *pno; + SYSIO_ENTER; err = _sysio_namei(_sysio_cwd, path, 0, NULL, &pno); if (err) @@ -96,6 +97,7 @@ out: errno = -err; err = -1; } + SYSIO_LEAVE; return err; } @@ -120,6 +122,7 @@ _ftruncate(int fd, _SYSIO_OFF_T length) { int err; struct file *fil; + SYSIO_ENTER; err = 0; fil = _sysio_fd_find(fd); @@ -133,6 +136,7 @@ out: errno = -err; err = -1; } + SYSIO_LEAVE; return err; } Index: unlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/unlink.c,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -u -w -b -B -p -r1.5 -r1.5.2.1 --- unlink.c 30 Oct 2003 15:20:49 -0000 1.5 +++ unlink.c 28 Jan 2004 13:16:57 -0000 1.5.2.1 @@ -51,6 +51,7 @@ #include "inode.h" #include "fs.h" #include "mount.h" +#include "sysio-symbols.h" int unlink(const char *path) @@ -58,6 +59,7 @@ unlink(const char *path) struct intent intent; int err; struct pnode *pno; + SYSIO_ENTER; INTENT_INIT(&intent, INT_UPDPARENT, NULL, NULL); err = _sysio_namei(_sysio_cwd, path, ND_NOFOLLOW, &intent, &pno); @@ -82,5 +84,11 @@ out: errno = -err; err = -1; } + SYSIO_LEAVE; + +#ifdef REDSTORM +#undef __unlink +sysio_sym_weak_alias(unlink, __unlink) +#endif return err; } Index: utime.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/utime.c,v retrieving revision 1.1 retrieving revision 1.1.10.1 diff -u -w -b -B -p -r1.1 -r1.1.10.1 --- utime.c 27 Sep 2003 19:42:03 -0000 1.1 +++ utime.c 28 Jan 2004 13:16:57 -0000 1.1.10.1 @@ -58,14 +58,12 @@ int utime(const char *path, const struct utimbuf *buf) { - struct intent intent; int err; struct pnode *pno; struct utimbuf _utbuffer; struct intnl_stat stbuf; - INTENT_INIT(&intent, INT_SETATTR, NULL, NULL); - err = _sysio_namei(_sysio_cwd, path, 0, &intent, &pno); + err = _sysio_namei(_sysio_cwd, path, 0, NULL, &pno); if (err) goto out; if (!buf) { Index: write.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/write.c,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -u -w -b -B -p -r1.10 -r1.10.2.1 --- write.c 20 Oct 2003 15:51:22 -0000 1.10 +++ write.c 28 Jan 2004 13:16:57 -0000 1.10.2.1 @@ -112,14 +111,17 @@ ipwritev(int fd, const struct iovec *iov { struct file *fil; struct ioctx *ioctxp; + SYSIO_ENTER; fil = _sysio_fd_find(fd); if (!fil) { errno = -EBADF; + SYSIO_LEAVE; return IOID_FAIL; } ioctxp = do_ixwritev(fil, iov, count, offset, NULL); + SYSIO_LEAVE; return ioctxp ? ioctxp->ioctx_id : IOID_FAIL; } @@ -178,6 +180,17 @@ pwrite(int fd, const void *buf, size_t c } #else #undef pwrite +#ifdef REDSTORM +#undef __libc_pwrite +sysio_sym_weak_alias(pwrite, __libc_pwrite) +#undef __libc_pwrite64 +sysio_sym_weak_alias(pwrite, __libc_pwrite64) +#undef __pwrite +sysio_sym_weak_alias(pwrite, __pwrite) +#undef __pwrite64 +sysio_sym_weak_alias(pwrite, __pwrite64) +#endif + sysio_sym_weak_alias(_pwrite, pwrite) #endif @@ -189,16 +202,21 @@ iwritev(int fd, const struct iovec *iov, { struct file *fil; struct ioctx *ioctxp; + SYSIO_ENTER; fil = _sysio_fd_find(fd); if (!fil) { - errno = -EBADF; + errno = EBADF; + SYSIO_LEAVE; return IOID_FAIL; } ioctxp = do_ixwritev(fil, iov, count, fil->f_pos, _sysio_fcompletio); - if (!ioctxp) + if (!ioctxp) { + SYSIO_LEAVE; return IOID_FAIL; + } + SYSIO_LEAVE; return ioctxp->ioctx_id; } @@ -227,11 +245,18 @@ writev(int fd, const struct iovec *iov, return iowait(ioid); } -#if defined(BSD) || defined(REDSTORM) +#ifdef BSD #undef _writev sysio_sym_weak_alias(writev, _writev) #endif +#ifdef REDSTORM +#undef __libc_writev +sysio_sym_weak_alias(writev, __libc_writev) +#undef __writev +sysio_sym_weak_alias(writev, __writev) +#endif + ssize_t write(int fd, const void *buf, size_t count) { @@ -248,7 +273,12 @@ write(int fd, const void *buf, size_t co sysio_sym_weak_alias(write, __write) #endif -#if defined(BSD) || defined(REDSTORM) +#ifdef REDSTORM +#undef __libc_write +sysio_sym_weak_alias(write, __libc_write) +#endif + +#ifdef BSD #undef _write sysio_sym_weak_alias(write, _write) #endif |
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15431/tests Modified Files: Tag: namespace_assembly Makefile.am cleanup.pl setup.pl sysio_stubs.c sysio_tests.c test_all.pl test_copy.pl test_driver.c test_getcwd.pl test_list.pl test_mounts.c test_path.pl test_stats.pl test_symlink.pl Log Message: Bring in changes from the HEAD. Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Makefile.am,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 --- Makefile.am 18 Dec 2003 18:44:02 -0000 1.16.2.1 +++ Makefile.am 28 Jan 2004 13:16:57 -0000 1.16.2.2 @@ -36,7 +36,16 @@ YOD_DRIVER_NAME= YOD_DRIVER_CFLAGS= endif -DRIVERS=$(NATIVE_DRIVER_NAME) $(INCORE_DRIVER_NAME) $(YOD_DRIVER_NAME) $(STFD_DEV_NAME) +if WITH_SOCKETS_DRIVER +SOCKETS_DRIVER_NAME=sockets +SOCKETS_DRIVER_CFLAGS= -I$(top_srcdir)/drivers/sockets +else +SOCKETS_DRIVER_NAME= +SOCKETS_DRIVER_CFLAGS= +endif + +DRIVERS=$(NATIVE_DRIVER_NAME) $(INCORE_DRIVER_NAME) $(YOD_DRIVER_NAME) \ + $(STFD_DEV_NAME) $(SOCKETS_DRIVER_NAME) CMNSRC=drv_init_all.c drv_data.c Index: cleanup.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/cleanup.pl,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -u -w -b -B -p -r1.1 -r1.1.4.1 --- cleanup.pl 30 Oct 2003 15:22:19 -0000 1.1 +++ cleanup.pl 28 Jan 2004 13:16:57 -0000 1.1.4.1 @@ -46,8 +46,7 @@ if ((@ARGV > 1) && ($ARGV[$currarg++] eq my $cwd = $ARGV[$currarg]; # Get tests directory -my $testdir = $0; -$testdir =~ s/\/\w+.pl$//; +my $testdir = $FindBin::Bin; eval { if ($is_alpha == 0) { Index: setup.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/setup.pl,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -u -w -b -B -p -r1.1 -r1.1.4.1 --- setup.pl 30 Oct 2003 15:22:19 -0000 1.1 +++ setup.pl 28 Jan 2004 13:16:57 -0000 1.1.4.1 @@ -40,8 +40,7 @@ if ((@ARGV > 1) && ($ARGV[$currarg++] eq my $cwd = $ARGV[$currarg]; # Get tests directory -my $testdir = $0; -$testdir =~ s/\/\w+.pl$//; +my $testdir = $FindBin::Bin; eval { if ($is_alpha == 0) { Index: sysio_stubs.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/sysio_stubs.c,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -u -w -b -B -p -r1.6 -r1.6.2.1 --- sysio_stubs.c 28 Oct 2003 20:59:39 -0000 1.6 +++ sysio_stubs.c 28 Jan 2004 13:16:57 -0000 1.6.2.1 @@ -241,14 +241,14 @@ int test_do_printbuf(int argc, char **ar index = mobj->obj; buf_st = buflist[index]; - DBG(2, fprintf(outfp, "buf_st is %x:\n", buf_st)); + DBG(2, fprintf(outfp, "buf_st is %p:\n", buf_st)); buf = buf_st->buf; DBG(2, fprintf(outfp, "buf %s:\n", argv[0])); if (mobj->type == STR) { sprintf(output, "\n%s", (char *)buf); } else { sprintf(output,"%s\n", output); - DBG(2, fprintf(outfp, "buf_st->len is %d, buf is %x\n", buf_st->len, buf)); + DBG(2, fprintf(outfp, "buf_st->len is %d, buf is %p\n", buf_st->len, buf)); if (argc == 1) { for (i = 0; i < buf_st->len/4; i++) DBG(2, fprintf(outfp, "%#x ", ((int *)buf)[i])); Index: sysio_tests.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/sysio_tests.c,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -w -b -B -p -r1.3 -r1.3.2.1 --- sysio_tests.c 10 Oct 2003 18:50:31 -0000 1.3 +++ sysio_tests.c 28 Jan 2004 13:16:57 -0000 1.3.2.1 @@ -268,7 +268,6 @@ out: int sysio_chdir(char *newdir) { - char *buf; if (chdir(newdir) != 0) { my_perror(newdir); @@ -744,12 +743,6 @@ int sysio_getdirentries(int fd, char *bu (unsigned long long )dp->d_off, dp->d_reclen, (char )dp->d_type)); - DBG(3, fprintf(outfp, "\t%s: ino %x off %x len %x type %x\n", - dp->d_name, - (unsigned long long )dp->d_ino, - (unsigned long long )dp->d_off, - dp->d_reclen, - (char )dp->d_type)); err -= dp->d_reclen; dp = (void *)dp + dp->d_reclen; } Index: test_all.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_all.pl,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -u -w -b -B -p -r1.6 -r1.6.2.1 --- test_all.pl 30 Oct 2003 15:22:19 -0000 1.6 +++ test_all.pl 28 Jan 2004 13:16:57 -0000 1.6.2.1 @@ -6,6 +6,8 @@ # use strict; +use FindBin; + use Cwd 'abs_path'; my $alpha_arg = ""; @@ -31,8 +33,7 @@ my $success = 0; my $cwd = $ENV{PWD}; # Get tests directory -my $testdir = $0; -$testdir =~ s/\/\w+.pl$//; +my $testdir = $FindBin::Bin; my $res; Index: test_copy.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_copy.pl,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -w -b -B -p -r1.3 -r1.3.2.1 --- test_copy.pl 10 Oct 2003 18:50:31 -0000 1.3 +++ test_copy.pl 28 Jan 2004 13:16:57 -0000 1.3.2.1 @@ -23,8 +23,7 @@ sub process_cmd my ($src, $dest, $is_alpha) = @_; # Get tests directory -my $testdir = $0; -$testdir =~ s/\/\w+.pl$//; + my $testdir = $FindBin::Bin; eval { if ($is_alpha == 0) { Index: test_driver.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_driver.c,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -w -b -B -p -r1.4 -r1.4.2.1 --- test_driver.c 28 Oct 2003 20:59:39 -0000 1.4 +++ test_driver.c 28 Jan 2004 13:16:57 -0000 1.4.2.1 @@ -118,7 +118,7 @@ void * alloc_buff32(unsigned int size, i { void* buf; long buf_ptr; - int err; + /* if ((err = memalign(&buf, align, size)) != 0) { perror("memalign"); @@ -145,10 +145,14 @@ long alloc_buff64(unsigned int size, int char * buf; long ret_value; + /* if (memalign((void **)&buf, align, size)) return 0; - - ret_value = (long)buf; + */ + size += align; + buf = malloc(size); + align--; + ret_value = (long)buf + ((long)buf & align); return ret_value; } @@ -230,7 +234,7 @@ int get_obj(char *var_name) * Check for '|', indicates that one or more values are or'd * together */ - for (i=0; i < strlen(var_name); i++) { + for (i=0; (unsigned int)i < strlen(var_name); i++) { if (var_name[i] == '|') { char *str1 = malloc(i+1); char *str2 = malloc(strlen(var_name)-i+1); Index: test_getcwd.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_getcwd.pl,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -w -b -B -p -r1.4 -r1.4.2.1 --- test_getcwd.pl 30 Oct 2003 15:22:19 -0000 1.4 +++ test_getcwd.pl 28 Jan 2004 13:16:57 -0000 1.4.2.1 @@ -46,8 +46,7 @@ sub process_cmd my ($dir, $is_alpha) = @_; # Get tests directory - my $testdir = $0; - $testdir =~ s/\/\w+.pl$//; + my $testdir = $FindBin::Bin; eval { if ($is_alpha == 0) { Index: test_list.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_list.pl,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -w -b -B -p -r1.3 -r1.3.2.1 --- test_list.pl 10 Oct 2003 18:50:31 -0000 1.3 +++ test_list.pl 28 Jan 2004 13:16:57 -0000 1.3.2.1 @@ -129,8 +129,7 @@ sub process_cmd my $done_files = 0; # Get tests directory -my $testdir = $0; -$testdir =~ s/\/\w+.pl$//; + my $testdir = $FindBin::Bin; eval { if ($is_alpha == 1) { Index: test_mounts.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_mounts.c,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -u -w -b -B -p -r1.5 -r1.5.2.1 --- test_mounts.c 10 Oct 2003 18:50:31 -0000 1.5 +++ test_mounts.c 28 Jan 2004 13:16:57 -0000 1.5.2.1 @@ -436,7 +436,7 @@ mountit(const char *arg) /* * Eat leading white. */ - while (*s && *s == ' ' || *s == '\t') + while (*s && ((*s == ' ') || (*s == '\t'))) s++; /* * Get opts. @@ -456,7 +456,7 @@ mountit(const char *arg) /* * Eat leading white. */ - while (*s && *s == ' ' || *s == '\t') + while (*s && ((*s == ' ') || (*s == '\t'))) s++; /* * Get target @@ -471,7 +471,7 @@ mountit(const char *arg) if (*cp) *cp++ = '\0'; - err = mkdir(target, "0777"); + err = mkdir(target, 0777); if (err && errno != EEXIST) perror(target); err = mount(source, target, fstype, 0, opts); Index: test_path.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_path.pl,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -w -b -B -p -r1.3 -r1.3.2.1 --- test_path.pl 10 Oct 2003 18:50:31 -0000 1.3 +++ test_path.pl 28 Jan 2004 13:16:57 -0000 1.3.2.1 @@ -87,8 +87,7 @@ sub process_cmd my $path; # Get tests directory - my $testdir = $0; - $testdir =~ s/\/\w+.pl$//; + my $testdir = $FindBin::Bin; eval { if ($isalpha == 0) { Index: test_stats.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_stats.pl,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -u -w -b -B -p -r1.5 -r1.5.2.1 --- test_stats.pl 30 Oct 2003 15:22:19 -0000 1.5 +++ test_stats.pl 28 Jan 2004 13:16:57 -0000 1.5.2.1 @@ -95,8 +95,7 @@ sub process_cmd my ($file, $use_system, $is_alpha) = @_; # Get tests directory -my $testdir = $0; -$testdir =~ s/\/\w+.pl$//; + my $testdir = $FindBin::Bin; eval { if ($is_alpha == 0) { Index: test_symlink.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_symlink.pl,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -u -w -b -B -p -r1.3 -r1.3.4.1 --- test_symlink.pl 30 Oct 2003 15:22:19 -0000 1.3 +++ test_symlink.pl 28 Jan 2004 13:16:57 -0000 1.3.4.1 @@ -58,8 +58,7 @@ sub process_cmd my ($src, $dest, $is_alpha) = @_; # Get tests directory - my $testdir = $0; - $testdir =~ s/\/\w+.pl$//; + my $testdir = $FindBin::Bin; eval { if ($is_alpha == 0) { |
|
From: Lee W. <lw...@us...> - 2004-01-28 13:18:09
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15431/dev/stdfd Modified Files: Tag: namespace_assembly stdfd.c Log Message: Bring in changes from the HEAD. Index: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -u -w -b -B -p -r1.6 -r1.6.2.1 --- stdfd.c 13 Oct 2003 01:04:34 -0000 1.6 +++ stdfd.c 28 Jan 2004 13:16:55 -0000 1.6.2.1 @@ -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" |