libsysio-commit Mailing List for libsysio (Page 29)
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-04-16 20:38:43
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30430/src Modified Files: dev.c inode.c lseek.c Log Message: New operation for the drivers to implement -- take note! The drivers now need to implement inop_pos which takes an inode and a _SYSIO_OFF_T and should return the resulting position as though it were lseek(FD2INO(fd), off, SEEK_SET). As usual a negative return value is the negated errno. Lseek is altered to use this. Changes in fs_native.c to utilize pread/pwrite whenever positioning is required instead of an lseek/io-op pair of calls. This addresses a race to yod. Index: dev.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/dev.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -b -B -p -r1.6 -r1.7 --- dev.c 6 Feb 2004 20:07:30 -0000 1.6 +++ dev.c 16 Apr 2004 20:38:34 -0000 1.7 @@ -68,6 +68,7 @@ const struct inode_ops _sysio_nodev_ops _sysio_nodev_inop_rename, _sysio_nodev_inop_read, _sysio_nodev_inop_write, + _sysio_nodev_inop_pos, _sysio_nodev_inop_iodone, _sysio_nodev_inop_fcntl, _sysio_nodev_inop_sync, @@ -169,17 +170,3 @@ _sysio_dev_lookup(mode_t mode, dev_t dev return &devtbl[major].dev_ops; } - -int -_sysio_dev_illop() -{ - - abort(); -} - -void -_sysio_dev_noop() -{ - - return; -} Index: inode.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/inode.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -b -B -p -r1.14 -r1.15 --- inode.c 24 Feb 2004 14:58:26 -0000 1.14 +++ inode.c 16 Apr 2004 20:38:34 -0000 1.15 @@ -875,3 +875,83 @@ _sysio_setattr(struct pnode *pno, ino = pno->p_base->pb_ino; return (*ino->i_ops.inop_setattr)(pno, ino, mask, stbuf); } + +/* + * Do nothing. + */ +void +_sysio_do_noop() +{ + + return; +} + +/* + * Abort. + */ +void +_sysio_do_illop() +{ + + abort(); +} + +/* + * Return -EBADF + */ +int +_sysio_do_ebadf() +{ + + return -EBADF; +} + +/* + * Return -EINVAL + */ +int +_sysio_do_einval() +{ + + return -EINVAL; +} + +/* + * Return -ENOENT + */ +int +_sysio_do_enoent() +{ + + return -ENOENT; +} + +/* + * Return -ESPIPE + */ +int +_sysio_do_espipe() +{ + + return -ESPIPE; +} + +/* + * Return -EISDIR + */ +int +_sysio_do_eisdir() +{ + + return -EISDIR; +} + +/* + * Return -ENOSYS + */ +int +_sysio_do_enosys() +{ + + return -ENOSYS; +} Index: lseek.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/lseek.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -b -B -p -r1.14 -r1.15 --- lseek.c 18 Mar 2004 14:34:18 -0000 1.14 +++ lseek.c 16 Apr 2004 20:38:34 -0000 1.15 @@ -101,6 +101,10 @@ _sysio_lseek(int fd, _SYSIO_OFF_T offset if (pos >= _SYSIO_OFF_T_MAX) return -EOVERFLOW; #endif + pos = (fil->f_ino->i_ops.inop_pos)(fil->f_ino, pos); + if (pos < 0) + return pos; + return fil->f_pos = pos; } |
From: Lee W. <lw...@us...> - 2004-04-16 20:38:43
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30430/include Modified Files: dev.h inode.h Log Message: New operation for the drivers to implement -- take note! The drivers now need to implement inop_pos which takes an inode and a _SYSIO_OFF_T and should return the resulting position as though it were lseek(FD2INO(fd), off, SEEK_SET). As usual a negative return value is the negated errno. Lseek is altered to use this. Changes in fs_native.c to utilize pread/pwrite whenever positioning is required instead of an lseek/io-op pair of calls. This addresses a race to yod. Index: dev.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/dev.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -b -B -p -r1.6 -r1.7 --- dev.h 6 Feb 2004 20:07:29 -0000 1.6 +++ dev.h 16 Apr 2004 20:38:34 -0000 1.7 @@ -70,77 +70,79 @@ extern const struct inode_ops _sysio_nod (int (*)(struct pnode *, \ struct inode **, \ struct intent *, \ - const char *))_sysio_dev_illop + const char *))_sysio_do_illop #define _sysio_nodev_inop_getattr \ (int (*)(struct pnode *, \ struct inode *, \ - struct intnl_stat *))_sysio_dev_illop + struct intnl_stat *))_sysio_do_ebadf #define _sysio_nodev_inop_setattr \ (int (*)(struct pnode *, \ struct inode *, \ unsigned , \ - struct intnl_stat *))_sysio_dev_illop + struct intnl_stat *))_sysio_do_ebadf #define _sysio_nodev_getdirentries \ (ssize_t (*)(struct inode *, \ char *, \ size_t , \ - _SYSIO_OFF_T *))_sysio_dev_illop + _SYSIO_OFF_T *))_sysio_do_illop #define _sysio_nodev_inop_mkdir \ (int (*)(struct pnode *, \ - mode_t))_sysio_dev_illop + mode_t))_sysio_do_illop #define _sysio_nodev_inop_rmdir \ - (int (*)(struct pnode *))_sysio_dev_illop + (int (*)(struct pnode *))_sysio_do_illop #define _sysio_nodev_inop_symlink \ (int (*)(struct pnode *, \ - const char *))_sysio_dev_illop + const char *))_sysio_do_illop #define _sysio_nodev_inop_readlink \ (int (*)(struct pnode *, \ char *, \ - size_t))_sysio_dev_illop + size_t))_sysio_do_illop #define _sysio_nodev_inop_open \ (int (*)(struct pnode *, \ int, \ - mode_t))_sysio_dev_illop + mode_t))_sysio_do_enoent #define _sysio_nodev_inop_close \ - (int (*)(struct inode *))_sysio_dev_illop + (int (*)(struct inode *))_sysio_do_ebadf #define _sysio_nodev_inop_link \ - (int (*)(struct pnode *, struct pnode *))_sysio_dev_illop + (int (*)(struct pnode *, struct pnode *))_sysio_do_illop #define _sysio_nodev_inop_unlink \ - (int (*)(struct pnode *))_sysio_dev_illop + (int (*)(struct pnode *))_sysio_do_illop #define _sysio_nodev_inop_rename \ - (int (*)(struct pnode *, struct pnode *))_sysio_dev_illop + (int (*)(struct pnode *, struct pnode *))_sysio_do_illop #define _sysio_nodev_inop_read \ (int (*)(struct inode *, \ - struct ioctx *))_sysio_dev_illop + struct ioctx *))_sysio_do_ebadf #define _sysio_nodev_inop_write \ (int (*)(struct inode *, \ - struct ioctx *))_sysio_dev_illop + struct ioctx *))_sysio_do_ebadf +#define _sysio_nodev_inop_pos \ + (_SYSIO_OFF_T (*)(struct inode *, _SYSIO_OFF_T))_sysio_do_ebadf #define _sysio_nodev_inop_iodone \ - (int (*)(struct ioctx *))_sysio_dev_illop + (int (*)(struct ioctx *))_sysio_do_einval #define _sysio_nodev_inop_fcntl \ (int (*)(struct inode *, \ int, \ - va_list))_sysio_dev_illop + va_list))_sysio_do_ebadf #define _sysio_nodev_inop_sync \ - (int (*)(struct inode *))_sysio_dev_illop + (int (*)(struct inode *))_sysio_do_ebadf #define _sysio_nodev_inop_datasync \ - (int (*)(struct inode *))_sysio_dev_illop + (int (*)(struct inode *))_sysio_do_ebadf #define _sysio_nodev_inop_ioctl \ (int (*)(struct inode *, \ unsigned long int, \ - va_list))_sysio_dev_illop + va_list))_sysio_do_ebadf #define _sysio_nodev_inop_mknod \ (int (*)(struct pnode *, \ mode_t, \ - dev_t))_sysio_dev_illop + dev_t))_sysio_do_illop #ifdef _HAVE_STATVFS #define _sysio_nodev_inop_statvfs \ (int (*)(struct pnode *, \ struct inode *, \ - struct intnl_statvfs *))_sysio_dev_illop + struct intnl_statvfs *))_sysio_do_illop #endif #define _sysio_nodev_inop_gone \ - (void (*)(struct inode *ino))_sysio_dev_noop + (void (*)(struct inode *ino))_sysio_do_noop extern int _sysio_dev_init(void); extern dev_t _sysio_dev_alloc(void); @@ -148,5 +150,3 @@ extern struct inode_ops *_sysio_dev_look extern int _sysio_char_dev_register(int major, const char *name, struct inode_ops *ops); -extern int _sysio_dev_illop(void); -extern void _sysio_dev_noop(void); Index: inode.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/inode.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -b -B -p -r1.15 -r1.16 --- inode.h 14 Feb 2004 19:42:58 -0000 1.15 +++ inode.h 16 Apr 2004 20:38:34 -0000 1.16 @@ -101,6 +101,7 @@ struct inode_ops { int (*inop_rename)(struct pnode *old, struct pnode *new); int (*inop_read)(struct inode *ino, struct ioctx *ioctx); int (*inop_write)(struct inode *ino, struct ioctx *ioctx); + _SYSIO_OFF_T (*inop_pos)(struct inode *ino, _SYSIO_OFF_T off); int (*inop_iodone)(struct ioctx *iocp); int (*inop_fcntl)(struct inode *ino, int cmd, va_list ap); int (*inop_sync)(struct inode *ino); @@ -453,6 +454,14 @@ extern int _sysio_setattr(struct pnode * struct inode *ino, unsigned mask, struct intnl_stat *stbuf); +extern void _sysio_do_noop(void); +extern void _sysio_do_illop(void); +extern int _sysio_do_ebadf(void); +extern int _sysio_do_einval(void); +extern int _sysio_do_enoent(void); +extern int _sysio_do_espipe(void); +extern int _sysio_do_eisdir(void); +extern int _sysio_do_enosys(void); extern int _sysio_path_walk(struct pnode *parent, struct nameidata *nd); #ifdef AUTOMOUNT_FILE_NAME extern void _sysio_next_component(const char *path, struct qstr *name); |
From: Lee W. <lw...@us...> - 2004-04-16 20:38:42
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30430/drivers/native Modified Files: fs_native.c Log Message: New operation for the drivers to implement -- take note! The drivers now need to implement inop_pos which takes an inode and a _SYSIO_OFF_T and should return the resulting position as though it were lseek(FD2INO(fd), off, SEEK_SET). As usual a negative return value is the negated errno. Lseek is altered to use this. Changes in fs_native.c to utilize pread/pwrite whenever positioning is required instead of an lseek/io-op pair of calls. This addresses a race to yod. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -w -b -B -p -r1.34 -r1.35 --- fs_native.c 14 Apr 2004 17:25:43 -0000 1.34 +++ fs_native.c 16 Apr 2004 20:38:34 -0000 1.35 @@ -247,6 +247,7 @@ static int native_inop_unlink(struct pno static int native_inop_rename(struct pnode *old, struct pnode *new); static int native_inop_read(struct inode *ino, struct ioctx *ioctx); static int native_inop_write(struct inode *ino, struct ioctx *ioctx); +static _SYSIO_OFF_T native_inop_pos(struct inode *ino, _SYSIO_OFF_T off); static int native_inop_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); @@ -278,6 +279,7 @@ static struct inode_ops native_i_ops = { native_inop_rename, native_inop_read, native_inop_write, + native_inop_pos, native_inop_iodone, native_inop_fcntl, native_inop_sync, @@ -1293,24 +1295,47 @@ out: static ssize_t dopio(void *buf, size_t count, _SYSIO_OFF_T off, struct native_io *nio) { +#ifdef _LARGEFILE64_SOURCE +#define _NATIVE_SYSCALL_PREAD SYS_pread64 +#define _NATIVE_SYSCALL_PWRITE SYS_pwrite64 +#else +#define _NATIVE_SYSCALL_PREAD SYS_pread +#define _NATIVE_SYSCALL_PWRITE SYS_pwrite +#endif + ssize_t cc; + + if (!(off == nio->nio_nino->ni_fpos || nio->nio_nino->ni_seekok)) + return -ESPIPE; + if (!nio->nio_nino->ni_seekok) { + if (off != nio->nio_nino->ni_fpos) { /* - * Avoid the reposition call if we're already at the right place. - * Allows us to access pipes and fifos. + * They've done a p{read,write} or somesuch. Can't + * seek on this descriptor so we err out now. */ - if (off != nio->nio_nino->ni_fpos) { - int err; - - err = native_pos(nio->nio_nino->ni_fd, &off, SEEK_SET); - if (err) - return err; - nio->nio_nino->ni_fpos = off; + errno = ESPIPE; + return -1; } - - return syscall(nio->nio_op == 'r' ? SYS_read : SYS_write, + cc = + syscall(nio->nio_op == 'r' ? SYS_read : SYS_write, nio->nio_nino->ni_fd, buf, count); + if (cc > 0) + nio->nio_nino->ni_fpos += cc; + } else + cc = + syscall((nio->nio_op == 'r' + ? _NATIVE_SYSCALL_PREAD + : _NATIVE_SYSCALL_PWRITE), + nio->nio_nino->ni_fd, + buf, + count, + off); + + return cc; +#undef _NATIVE_SYSCALL_PREAD +#undef _NATIVE_SYSCALL_PWRITE } static ssize_t @@ -1515,6 +1540,16 @@ native_inop_write(struct inode *ino __IS return doio('w', ioctx); } +static _SYSIO_OFF_T +native_inop_pos(struct inode *ino, _SYSIO_OFF_T off) +{ + struct native_inode *nino = I2NI(ino); + int err; + + err = native_pos(nino->ni_fd, &off, SEEK_SET); + return err < 0 ? err : off; +} + static int native_inop_iodone(struct ioctx *ioctxp __IS_UNUSED) { |
From: Lee W. <lw...@us...> - 2004-04-16 20:38:42
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30430/drivers/yod Modified Files: fs_yod.c Log Message: New operation for the drivers to implement -- take note! The drivers now need to implement inop_pos which takes an inode and a _SYSIO_OFF_T and should return the resulting position as though it were lseek(FD2INO(fd), off, SEEK_SET). As usual a negative return value is the negated errno. Lseek is altered to use this. Changes in fs_native.c to utilize pread/pwrite whenever positioning is required instead of an lseek/io-op pair of calls. This addresses a race to yod. Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -b -B -p -r1.11 -r1.12 --- fs_yod.c 25 Feb 2004 16:23:59 -0000 1.11 +++ fs_yod.c 16 Apr 2004 20:38:34 -0000 1.12 @@ -176,6 +176,8 @@ static int yod_inop_ipreadv(struct inode struct ioctx *ioctx); static int yod_inop_ipwritev(struct inode *ino, struct ioctx *ioctx); +#define yod_inop_pos(ino, off) \ + (_SYSIO_OFF_T (*)(struct inode *, _SYSIO_OFF_T))_sysio_do_espipe static int yod_inop_iodone(struct ioctx *ioctx); static int yod_inop_fcntl(struct inode *ino, int cmd, va_list ap); static int yod_inop_sync(struct inode *ino); @@ -207,6 +209,7 @@ static struct inode_ops yod_i_ops = { yod_inop_rename, yod_inop_ipreadv, yod_inop_ipwritev, + yod_inop_pos, yod_inop_iodone, yod_inop_fcntl, yod_inop_sync, |
From: Lee W. <lw...@us...> - 2004-04-16 20:38:42
|
Update of /cvsroot/libsysio/libsysio/drivers/incore In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30430/drivers/incore Modified Files: fs_incore.c Log Message: New operation for the drivers to implement -- take note! The drivers now need to implement inop_pos which takes an inode and a _SYSIO_OFF_T and should return the resulting position as though it were lseek(FD2INO(fd), off, SEEK_SET). As usual a negative return value is the negated errno. Lseek is altered to use this. Changes in fs_native.c to utilize pread/pwrite whenever positioning is required instead of an lseek/io-op pair of calls. This addresses a race to yod. Index: fs_incore.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/incore/fs_incore.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -w -b -B -p -r1.16 -r1.17 --- fs_incore.c 25 Feb 2004 16:23:58 -0000 1.16 +++ fs_incore.c 16 Apr 2004 20:38:33 -0000 1.17 @@ -144,6 +144,8 @@ static int _sysio_incore_dirop_unlink(st static int _sysio_incore_dirop_rename(struct pnode *old, struct pnode *new); 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 _SYSIO_OFF_T _sysio_incore_filop_pos(struct inode *ino, + _SYSIO_OFF_T off); 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); @@ -157,29 +159,28 @@ static int _sysio_incore_inop_statvfs(st struct intnl_statvfs *buf); #endif static void _sysio_incore_inop_gone(struct inode *ino); -static int _sysio_incore_e_isdir(void); -static int _sysio_incore_e_inval(void); -static int _sysio_incore_e_nosys(void); -static void _sysio_incore_illop(void); #define _sysio_incore_dirop_symlink \ - (int (*)(struct pnode *, const char *))_sysio_incore_e_nosys + (int (*)(struct pnode *, const char *))_sysio_do_enosys #define _sysio_incore_dirop_readlink \ - (int (*)(struct pnode *, char *, size_t))_sysio_incore_e_inval + (int (*)(struct pnode *, char *, size_t))_sysio_do_einval #define _sysio_incore_dirop_read \ (int (*)(struct inode *, \ - struct ioctx *))_sysio_incore_e_isdir + struct ioctx *))_sysio_do_eisdir #define _sysio_incore_dirop_write \ (int (*)(struct inode *, \ - struct ioctx *))_sysio_incore_e_isdir + struct ioctx *))_sysio_do_eisdir +#define _sysio_incore_dirop_pos \ + (_SYSIO_OFF_T (*)(struct inode *, \ + _SYSIO_OFF_T))_sysio_do_eisdir #define _sysio_incore_dirop_iodone \ - (int (*)(struct ioctx *))_sysio_incore_illop + (int (*)(struct ioctx *))_sysio_do_illop #define _sysio_incore_dirop_fcntl \ - (int (*)(struct inode *, int, va_list))_sysio_incore_e_isdir + (int (*)(struct inode *, int, va_list))_sysio_do_eisdir #define _sysio_incore_dirop_ioctl \ (int (*)(struct inode *, \ unsigned long int, \ - va_list))_sysio_incore_e_isdir + va_list))_sysio_do_eisdir static struct inode_ops _sysio_incore_dir_ops = { _sysio_incore_dirop_lookup, @@ -197,6 +198,7 @@ static struct inode_ops _sysio_incore_di _sysio_incore_dirop_rename, _sysio_incore_dirop_read, _sysio_incore_dirop_write, + _sysio_incore_dirop_pos, _sysio_incore_dirop_iodone, _sysio_incore_dirop_fcntl, _sysio_incore_inop_sync, @@ -213,28 +215,28 @@ static struct inode_ops _sysio_incore_di (int (*)(struct pnode *, \ struct inode **, \ struct intent *, \ - const char *))_sysio_incore_illop + const char *))_sysio_do_illop #define _sysio_incore_filop_getdirentries \ (ssize_t (*)(struct inode *, \ char *, \ size_t, \ - _SYSIO_OFF_T *))_sysio_incore_illop + _SYSIO_OFF_T *))_sysio_do_illop #define _sysio_incore_filop_mkdir \ - (int (*)(struct pnode *, mode_t))_sysio_incore_illop + (int (*)(struct pnode *, mode_t))_sysio_do_illop #define _sysio_incore_filop_rmdir \ - (int (*)(struct pnode *))_sysio_incore_illop + (int (*)(struct pnode *))_sysio_do_illop #define _sysio_incore_filop_symlink \ - (int (*)(struct pnode *, const char *))_sysio_incore_illop + (int (*)(struct pnode *, const char *))_sysio_do_illop #define _sysio_incore_symlinkop_readlink \ - (int (*)(struct pnode *, char *, size_t))_sysio_incore_illop + (int (*)(struct pnode *, char *, size_t))_sysio_do_illop #define _sysio_incore_filop_link \ - (int (*)(struct pnode *old, struct pnode *new))_sysio_incore_illop + (int (*)(struct pnode *old, struct pnode *new))_sysio_do_illop #define _sysio_incore_filop_unlink \ - (int (*)(struct pnode *pno))_sysio_incore_illop + (int (*)(struct pnode *pno))_sysio_do_illop #define _sysio_incore_filop_rename \ - (int (*)(struct pnode *old, struct pnode *new))_sysio_incore_illop + (int (*)(struct pnode *old, struct pnode *new))_sysio_do_illop #define _sysio_incore_filop_mknod \ - (int (*)(struct pnode *pno, mode_t, dev_t))_sysio_incore_illop + (int (*)(struct pnode *pno, mode_t, dev_t))_sysio_do_illop static struct inode_ops _sysio_incore_file_ops = { _sysio_incore_filop_lookup, @@ -252,6 +254,7 @@ static struct inode_ops _sysio_incore_fi _sysio_incore_filop_rename, _sysio_incore_filop_read, _sysio_incore_filop_write, + _sysio_incore_filop_pos, _sysio_incore_filop_iodone, _sysio_incore_filop_fcntl, _sysio_incore_inop_sync, @@ -280,6 +283,7 @@ static struct inode_ops _sysio_incore_de _sysio_incore_filop_rename, _sysio_nodev_inop_read, _sysio_nodev_inop_write, + _sysio_nodev_inop_pos, _sysio_nodev_inop_iodone, _sysio_incore_filop_fcntl, _sysio_incore_inop_sync, @@ -1549,6 +1553,13 @@ _sysio_incore_filop_write(struct inode * ioctx); } +static _SYSIO_OFF_T +_sysio_incore_filop_pos(struct inode *ino __IS_UNUSED, _SYSIO_OFF_T off) +{ + + return off; +} + static int _sysio_incore_filop_iodone(struct ioctx *iocp __IS_UNUSED) { @@ -1680,34 +1691,3 @@ _sysio_incore_inop_gone(struct inode *in incore_i_destroy(icino); } - -static int -_sysio_incore_e_isdir(void) -{ - - return -EISDIR; -} - -static int -_sysio_incore_e_inval(void) -{ - - return -EINVAL; -} - -static int -_sysio_incore_e_nosys(void) -{ - - return -ENOSYS; -} - -static void -_sysio_incore_illop(void) -{ - - /* - * Uh-oh! Goodbye Bruce. - */ - abort(); -} |
From: Sonja T. <so...@us...> - 2004-04-16 17:04:27
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14624/tests Modified Files: drv_init_all.c Log Message: Yet another attempt at fixing test link problems. Added "link_these_in_now_please" to drv_init_all. This may break certain build (RedStorm, Cplant). Probably should add some form of #ifdefs around the link-in. Index: drv_init_all.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/drv_init_all.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -b -B -p -r1.2 -r1.3 --- drv_init_all.c 20 Oct 2003 16:32:29 -0000 1.2 +++ drv_init_all.c 16 Apr 2004 17:04:16 -0000 1.3 @@ -1,4 +1,15 @@ #include <stdio.h> +#include <sys/stat.h> + +typedef void (*fncptr)(void); + +fncptr link_these_in_now_please[3] = +{ +(void(*)(void))__fxstat64, +(void(*)(void))__xstat64, +}; + + extern int (*drvinits[])(void); |
From: Lee W. <lw...@us...> - 2004-04-15 13:03:36
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10851 Modified Files: stat.c stat64.c Log Message: From Kevin Pedretti; Red Storm does not need the internal Glibc routines for the stat family. Index: stat.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/stat.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -b -B -p -r1.10 -r1.11 --- stat.c 31 Mar 2004 17:43:18 -0000 1.10 +++ stat.c 15 Apr 2004 13:03:27 -0000 1.11 @@ -54,9 +54,11 @@ #include "sysio-symbols.h" +#ifndef REDSTORM #undef fstat #undef stat #undef lstat +#endif #undef __fxstat #undef __xstat @@ -131,6 +133,7 @@ out: sysio_sym_weak_alias(__fxstat, _fxstat) #endif +#ifndef REDSTORM static int __fstat(int fd, struct stat *buf) { @@ -149,6 +152,7 @@ sysio_sym_weak_alias(__fstat, fstat) #undef _fstat sysio_sym_weak_alias(__fstat, _fstat) #endif +#endif int __xstat(int __ver, const char *__filename, struct stat *__stat_buf) @@ -199,6 +203,7 @@ out: sysio_sym_weak_alias(__xstat, _xstat) #endif +#ifndef REDSTORM static int __stat(const char *filename, struct stat *buf) { @@ -217,6 +222,7 @@ sysio_sym_weak_alias(__stat, stat) #undef _stat sysio_sym_weak_alias(__stat, _stat) #endif +#endif int __lxstat(int __ver, const char *__filename, struct stat *__stat_buf) @@ -267,6 +273,7 @@ out: sysio_sym_weak_alias(__lxstat, _lxstat) #endif +#ifndef REDSTORM static int __lstat(const char *filename, struct stat *buf) { @@ -285,3 +292,4 @@ sysio_sym_weak_alias(__lstat, lstat) #undef _lstat sysio_sym_weak_alias(__lstat, _lstat) #endif +#endif Index: stat64.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/stat64.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -b -B -p -r1.6 -r1.7 --- stat64.c 21 Jan 2004 14:44:53 -0000 1.6 +++ stat64.c 15 Apr 2004 13:03:27 -0000 1.7 @@ -54,9 +54,11 @@ #include "inode.h" #include "file.h" +#ifndef REDSTORM #undef fstat64 #undef stat64 #undef lstat64 +#endif #undef __fxstat64 #undef __xstat64 @@ -88,6 +90,7 @@ out: return err; } +#ifndef REDSTORM int fstat64(int fd, struct stat64 *buf) { @@ -99,6 +102,7 @@ fstat64(int fd, struct stat64 *buf) SYSIO_LEAVE; return rc; } +#endif int __xstat64(int __ver, const char *__filename, struct stat64 *__stat_buf) @@ -129,6 +133,7 @@ out: return err; } +#ifndef REDSTORM int stat64(const char *filename, struct stat64 *buf) { @@ -140,6 +145,7 @@ stat64(const char *filename, struct stat SYSIO_LEAVE; return rc; } +#endif int __lxstat64(int __ver, const char *__filename, struct stat64 *__stat_buf) @@ -170,6 +176,7 @@ out: return err; } +#ifndef REDSTORM int lstat64(const char *filename, struct stat64 *buf) { @@ -181,4 +188,5 @@ lstat64(const char *filename, struct sta SYSIO_LEAVE; return rc; } +#endif #endif /* !_LARGEFILE64_SOURCE */ |
From: Sonja T. <so...@us...> - 2004-04-14 18:46:35
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5468/tests Modified Files: sysio_tests.c Log Message: Fixing up warnings Removed getgrgid , getgrnam, getpwnam, and getpwuid from sysio_tests. This means that chown ran from test_driver will now require numeric ids. Index: sysio_tests.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/sysio_tests.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- sysio_tests.c 12 Apr 2004 19:31:36 -0000 1.8 +++ sysio_tests.c 14 Apr 2004 18:46:25 -0000 1.9 @@ -13,9 +13,6 @@ #include <sys/queue.h> #include <dirent.h> -#include <pwd.h> -#include <grp.h> - #include "sysio.h" #include "mount.h" #include "test.h" @@ -31,7 +28,6 @@ */ int initilize_sysio() { - int err; char *wd; /* @@ -438,8 +434,6 @@ int sysio_chown(char *new_id, char *file { char *owner = NULL; char *group = NULL; - struct group *g_ent = NULL; - struct passwd *o_ent = NULL; uid_t o_id=-1, g_id=-1; int len, j, i=0; int state = 0; /* Correspond to getting owner name */ @@ -479,19 +473,12 @@ int sysio_chown(char *new_id, char *file /* Numeric -- just convert */ o_id = (uid_t) atoi(owner); - /* Make sure it is valid */ - if ((o_ent = getpwuid(o_id)) == NULL) { - DBG(2, sprintf(output, "Error: uid %d not found \n", o_id)); - return INVALID_ARGS; - } } else { - /* Get the id from the passwd file */ - if ((o_ent = getpwnam(owner)) == NULL) { - DBG(2, sprintf(output, "Error: name %s not found\n", owner)); + /* No longer support non-numeric ids */ + + DBG(2, sprintf(output, "Error: non-numeric ids unsupported\n")); return INVALID_ARGS; } - o_id = o_ent->pw_uid; - } } @@ -500,20 +487,11 @@ int sysio_chown(char *new_id, char *file if (isdigit(group[0])) { /* Numeric -- just convert */ g_id = (uid_t) atoi(group); - - /* Make sure it is valid */ - if ((g_ent = getgrgid(g_id)) == NULL) { - DBG(2, sprintf(output, "Error: gid %d not found \n", g_id)); - return INVALID_ARGS; - } } else { - /* Find group in group file */ - if ((g_ent = getgrnam(group)) == NULL) { - DBG(2, sprintf(output, "Error: group %s not found \n", group)); + /* Don't support group names either */ + DBG(2, sprintf(output, "Error: non-numeric ids unsupported\n")); return INVALID_ARGS; } - g_id = g_ent->gr_gid; - } } /* Now issue the syscall */ |
From: Lee W. <lw...@us...> - 2004-04-14 17:26:00
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18582/drivers/native Modified Files: fs_native.c Log Message: Fixed the missing first letter of entry names returned by native_getdirentries. The x86_64 service node does not support getdents64. Only getdents. We had assumed, wrongly, that getdents == getdents64 on this platform (and ia64 too it seems) but the kernel structure used by getdents does not include a type field. Must convert now. The resulting type field in the internals structure, and that passed back to the user too of course, will be set to DT_UNKNOWN. There must be a Cray SPR filed for this but I'll be duurned if I can find a reference. Oh well, no association then. Just an out of the blue fix. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -w -b -B -p -r1.33 -r1.34 --- fs_native.c 25 Feb 2004 16:23:58 -0000 1.33 +++ fs_native.c 14 Apr 2004 17:25:43 -0000 1.34 @@ -82,6 +82,33 @@ #include <sys/uio.h> #endif +#if defined(SYS_getdirentries) +#define DIR_STREAMED 0 +#define DIR_CVT_64 0 +#elif defined(SYS_getdents64) +#define DIR_STREAMED 0 +#define DIR_CVT_64 0 +#elif defined(SYS_getdents) +#define DIR_STREAMED 0 +#if defined(_LARGEFILE64_SOURCE) +#define DIR_CVT_64 1 +/* + * Kernel version of directory entry. + */ +struct linux_dirent { + unsigned long ld_ino; + unsigned long ld_off; + unsigned short ld_reclen; + char ld_name[1]; +}; +#include <dirent.h> +#else /* !defined(_LARGEFILE64_SOURCE) */ +#define DIR_CVT_64 0 +#endif /* defined(_LARGEFILE64_SOURCE) */ +#else /* catch-none */ +#error No usable directory fill entries interface available +#endif + /* * Local host file system driver. */ @@ -883,34 +910,34 @@ native_pos(int fd, _SYSIO_OFF_T *offset, } static ssize_t -native_getdirentries(struct inode *ino, +native_filldirentries(struct native_inode *nino, char *buf, size_t nbytes, _SYSIO_OFF_T *basep) { - struct native_inode *nino = I2NI(ino); - int err; -#ifndef SYS_getdirentries +#if !DIR_STREAMED _SYSIO_OFF_T result; #endif ssize_t cc; - assert(nino->ni_fd >= 0); + if (*basep < 0) + return -EINVAL; -#ifndef SYS_getdirentries +#if !DIR_STREAMED + /* + * Stream-oriented access requires that we reposition prior to the + * fill call. + */ result = *basep; - if (*basep != nino->ni_fpos) { - err = native_pos(nino->ni_fd, &result, SEEK_SET); - if (err) - return err; - } + if (*basep != nino->ni_fpos && + (cc = native_pos(nino->ni_fd, &result, SEEK_SET)) != 0) + return cc; nino->ni_fpos = result; -#ifdef SYS_getdents64 - cc = syscall(SYS_getdents64, nino->ni_fd, buf, nbytes); #else - cc = syscall(SYS_getdents, nino->ni_fd, buf, nbytes); + nino->ni_fpos = *basep; #endif -#else /* defined(SYS_getdirentries) */ + +#if defined(SYS_getdirentries) cc = syscall(SYS_getdirentries, nino->ni_fd, @@ -918,11 +945,87 @@ native_getdirentries(struct inode *ino, nbytes, basep, &nino->ni_fpos); -#endif /* !defined(SYS_getdirentries) */ +#elif defined(SYS_getdents64) + cc = syscall(SYS_getdents64, nino->ni_fd, buf, nbytes); +#elif defined(SYS_getdents) + cc = syscall(SYS_getdents, nino->ni_fd, buf, nbytes); +#endif + if (cc < 0) return -errno; -#ifndef SYS_getdirentries nino->ni_fpos += cc; + return cc; +} + +static ssize_t +native_getdirentries(struct inode *ino, + char *buf, + size_t nbytes, + _SYSIO_OFF_T *basep) +{ + struct native_inode *nino = I2NI(ino); +#if DIR_CVT_64 + char *bp; + size_t count; + struct linux_dirent *ldp; + struct dirent64 *d64p; + size_t namlen; + size_t reclen; +#else +#define bp buf +#define count nbytes +#endif + ssize_t cc; + + assert(nino->ni_fd >= 0); + +#if DIR_CVT_64 + count = nbytes; + while (!(bp = malloc(count))) { + count /= 2; + if (count < sizeof(struct dirent)) + return -ENOMEM; + } +#endif + cc = native_filldirentries(nino, bp, count, basep); + if (cc < 0) { +#if DIR_CVT_64 + free(bp); +#endif + return cc; + } +#if DIR_CVT_64 + ldp = (struct linux_dirent *)bp; + d64p = (struct dirent64 *)buf; + for (;;) { + if (cc < 0 || (size_t )cc <= sizeof(*ldp)) + break; + namlen = strlen(ldp->ld_name); + reclen = sizeof(*d64p) - sizeof(d64p->d_name) + namlen + 1; + if (nbytes < reclen) + break; + d64p->d_ino = ldp->ld_ino; + d64p->d_off = ldp->ld_off; + d64p->d_reclen = + (((reclen + sizeof(long) - 1)) / sizeof(long)) * + sizeof(long); + if (nbytes < d64p->d_reclen) + d64p->d_reclen = reclen; + d64p->d_type = DT_UNKNOWN; /* you lose -- sorry. */ + (void )strncpy(d64p->d_name, ldp->ld_name, namlen); + *(d64p->d_name + namlen) = '\0'; + cc -= ldp->ld_reclen; + ldp = (struct linux_dirent *)((char *)ldp + ldp->ld_reclen); + nbytes -= d64p->d_reclen; + d64p = (struct dirent64 *)((char *)d64p + d64p->d_reclen); + } + free(bp); + if (d64p == (struct dirent64 *)buf && cc) + cc = -EINVAL; /* buf too small */ + cc = (char *)d64p - buf; +#else +#undef bp +#undef count #endif return cc; } |
From: Lee W. <lw...@us...> - 2004-04-14 16:25:55
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6276 Modified Files: mknod.c Log Message: Fixed comment; We support FIFO type now too. Fixed test for type; Use the S_IS macros instead of a direct test for the mode bits. Fixed return value for unsupported types. Was EPERM, now EINVAL. Index: mknod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mknod.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- mknod.c 31 Mar 2004 17:43:18 -0000 1.8 +++ mknod.c 14 Apr 2004 16:25:40 -0000 1.9 @@ -79,11 +79,10 @@ __xmknod(int __ver, const char *path, mo } /* - * Support only character-special right now. + * Support only character-special and fifos right now. */ - if (((mode & S_IFMT) != S_IFIFO) && - ((mode & S_IFMT) != S_IFCHR)) { - err = -EPERM; + if (!(S_ISDIR(mode) || S_ISFIFO(mode))) { + err = -EINVAL; goto out; } |
From: Lee W. <lw...@us...> - 2004-04-14 16:05:44
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2485 Modified Files: getdirentries.c Log Message: Added copyright headers. Must have forgotten them in the original deposit. Index: getdirentries.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/getdirentries.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -b -B -p -r1.10 -r1.11 --- getdirentries.c 14 Apr 2004 16:03:48 -0000 1.10 +++ getdirentries.c 14 Apr 2004 16:05:36 -0000 1.11 @@ -1,3 +1,68 @@ +/* + * This Cplant(TM) source code is the property of Sandia National + * Laboratories. + * + * This Cplant(TM) source code is copyrighted by Sandia National + * Laboratories. + * + * The redistribution of this Cplant(TM) source code is subject to the + * terms of the GNU Lesser General Public License + * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) + * + * Cplant(TM) Copyright 1998-2004 Sandia Corporation. + * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive + * license for use of this work by or on behalf of the US Government. + * Export of this program may require a license from the United States + * Government. + */ + +/* + * ############################################################################# + * # + * # This Cplant(TM) source code is the property of Sandia National + * # Laboratories. + * # + * # This Cplant(TM) source code is copyrighted by Sandia National + * # Laboratories. + * # + * # The redistribution of this Cplant(TM) source code is subject to the + * # terms of the GNU Lesser General Public License + * # (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) + * # + * # Cplant(TM) Copyright 1998-2004 Sandia Corporation. + * # Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive + * # license for use of this work by or on behalf of the US Government. + * # Export of this program may require a license from the United States + * # Government. + * # + * ############################################################################# + */ + +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Questions or comments about this library should be sent to: + * + * Lee Ward + * Sandia National Laboratories, New Mexico + * P.O. Box 5800 + * Albuquerque, NM 87185-1110 + * + * le...@sa... + */ + #include <unistd.h> #include <stdlib.h> #ifdef __GLIBC__ |
From: Lee W. <lw...@us...> - 2004-04-14 16:03:56
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2080 Modified Files: getdirentries.c Log Message: Shouldn't call getdirentries inode operation on anything but directories. The default device operation behavior is to abort (it's an illegal op). Index: getdirentries.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/getdirentries.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -b -B -p -r1.9 -r1.10 --- getdirentries.c 31 Mar 2004 17:43:18 -0000 1.9 +++ getdirentries.c 14 Apr 2004 16:03:48 -0000 1.10 @@ -1,3 +1,4 @@ +#include <unistd.h> #include <stdlib.h> #ifdef __GLIBC__ #include <alloca.h> @@ -5,6 +6,7 @@ #include <string.h> #include <errno.h> #include <sys/types.h> +#include <sys/stat.h> #include <dirent.h> #include <sys/queue.h> @@ -32,6 +34,11 @@ _getdirentries64(int fd, return -1; } + if (!S_ISDIR(fil->f_ino->i_mode)) { + errno = ENOTDIR; + return -1; + } + cc = (*fil->f_ino->i_ops.inop_getdirentries)(fil->f_ino, buf, |
From: Lee W. <lw...@us...> - 2004-04-14 15:51:55
|
Update of /cvsroot/libsysio/libsysio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31921 Modified Files: autogen.sh Log Message: Copy installable files instead of simple symlink. The tarballs were problematic if the user didn't have automake or the right version of automake. Index: autogen.sh =================================================================== RCS file: /cvsroot/libsysio/libsysio/autogen.sh,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1.1.1 -r1.2 --- autogen.sh 22 Feb 2003 16:33:05 -0000 1.1.1.1 +++ autogen.sh 14 Apr 2004 15:51:47 -0000 1.2 @@ -1,5 +1,5 @@ #!/bin/sh aclocal && -automake --add-missing && +automake --add-missing --copy && ${AUTOCONF:-autoconf} |
From: Sonja T. <so...@us...> - 2004-04-12 19:45:28
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32176/tests Modified Files: Makefile.am sysio_tests.c test_copy.pl test_driver.c Log Message: Fixing tests so that they work with glibc 2.2 and 2.3. Added -static flag to Makefile.am so that it correctly links in libsysio. Note that I added it to ALL the tests, not just test_driver (I couldn't figure out how to add it just to test_driver and make it still work). The change in test_driver.c where I open /dev/stdin, /dev/stdout, and /dev/stderr is a hack put in temporarily so that the tests will work until the opens get added to the namespace assembly (which will take me longer to do). Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Makefile.am,v retrieving revision 1.19 retrieving revision 1.20 diff -u -w -b -B -p -r1.19 -r1.20 --- Makefile.am 14 Feb 2004 19:42:59 -0000 1.19 +++ Makefile.am 12 Apr 2004 19:31:36 -0000 1.20 @@ -110,5 +110,5 @@ drv_data.c: $(CONFIG_DEPENDENCIES) $(top test -z "drv_data.c" && rm -f drv_data.c; \ $(SHELL) $(top_srcdir)/tests/gendrvdata.sh $(DRIVERS) > drv_data.c -AM_CFLAGS = -L$(LIBBUILD_DIR) +AM_CFLAGS = -static -L$(LIBBUILD_DIR) include $(top_srcdir)/Rules.make Index: sysio_tests.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/sysio_tests.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- sysio_tests.c 12 Mar 2004 20:42:41 -0000 1.7 +++ sysio_tests.c 12 Apr 2004 19:31:36 -0000 1.8 @@ -33,19 +33,6 @@ int initilize_sysio() { int err; char *wd; - extern int _test_sysio_startup(void); - - /* - * Init sysio lib. - */ - err = _test_sysio_startup(); - DBG(5, sprintf(output, "%s_test_sysio_startup: err %d\n", output, err)); - if (err) { - my_errno = err; - my_perror("sysio startup"); - last_ret_val = errno; - return SUCCESS; - } /* * Attempt to set the cwd by getting it out of the Index: test_copy.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_copy.pl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- test_copy.pl 14 Feb 2004 19:43:00 -0000 1.5 +++ test_copy.pl 12 Apr 2004 19:31:36 -0000 1.6 @@ -68,12 +68,14 @@ sub process_cmd $bufsize = $size; } - + my $cmdstr; # Open src - my $cmdstr = '$src = CALL open '."$src O_RDONLY\n"; + if ($src ne "/dev/stdin") { + $cmdstr = '$src = CALL open '."$src O_RDONLY\n"; helper::send_cmd($cmdfh, $outfh, "open", $cmdstr); helper::verify_cmd($cmdfh, $outfh, "open $src"); - + } + if ($dest ne "/dev/stdout") { # Open dest my $flags = "O_WRONLY|O_CREAT"; if ($overwrite == 0) { @@ -82,6 +84,7 @@ sub process_cmd $cmdstr = '$dest = CALL open '."$dest $flags 0666\n"; helper::send_cmd($cmdfh, $outfh, "open", $cmdstr); my $destfile = helper::verify_cmd($cmdfh, $outfh, "open $dest"); + } # Allocate buffer $cmdstr = '$buf = ALLOC '."$bufsize\n"; @@ -96,7 +99,7 @@ sub process_cmd if ($src eq "/dev/stdin") { # Send "delay" option to read which will give us time to # put something in stdin (since we can't send an eof) - my $cmdstr = "CALL read ".'$src $buf '."$bytes delay\n"; + my $cmdstr = "CALL read ".'0 $buf '."$bytes delay\n"; print $cmdfh $cmdstr; # Give time to process command sleep 1; @@ -119,7 +122,11 @@ sub process_cmd helper::print_and_exit($cmdfh, $outfh, 0, "Short read\n"); } + if ($dest eq "/dev/stdout") { + $cmdstr = "CALL write ".'1 $buf '."$readb\n"; + } else { $cmdstr = "CALL write ".'$dest $buf '."$readb\n"; + } print $cmdfh $cmdstr; # Suck up the stdout... @@ -156,11 +163,14 @@ sub process_cmd } # Clean up + if ($src ne "/dev/stdin") { $cmdstr = 'CALL close $src'."\n"; helper::send_cmd($cmdfh, $outfh, "close", $cmdstr); + } + if ($dest ne "/dev/stdout") { $cmdstr = 'CALL close $dest'."\n"; helper::send_cmd($cmdfh, $outfh, "close", $cmdstr); - + } if ($src ne "/dev/stdin") { my $cmpres = system("cmp -s $src $dest"); if ($cmpres != 0) { Index: test_driver.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_driver.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- test_driver.c 24 Feb 2004 15:46:34 -0000 1.8 +++ test_driver.c 12 Apr 2004 19:31:36 -0000 1.9 @@ -961,6 +961,17 @@ int main(int argc, char *argv[]) char *input, *name; char **cmd; cmd_tree *tree; + extern int _test_sysio_startup(void); + + /* + * Init sysio lib. + */ + err = _test_sysio_startup(); + + /* Temp. hack until I do the right thing to fix this...*/ + open("/dev/stdin",O_RDONLY); + open("/dev/stdout",O_WRONLY); + open("/dev/stderr",O_WRONLY); infp = stdin; outfp = stdout; |
From: Lee W. <lw...@us...> - 2004-04-12 15:54:49
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13890/src Modified Files: rw.c Log Message: From Kevin Pedretti: Various rw routines returned a negated errno on errors. The _sysio_sum_iovec returns a count or negated errno. The internal helper routines were inverting this on error but indicating error themselves. The public interface routines would then invert the error number again before setting errno. The result; -1 * -1 * -n. Changed the helper routines to pass the error number untouched. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- rw.c 12 Apr 2004 15:36:06 -0000 1.4 +++ rw.c 12 Apr 2004 15:40:58 -0000 1.5 @@ -210,7 +210,7 @@ _sysio_iiov(int (*f)(struct inode *, str cc = _sysio_sum_iovec(iov, count); if (cc < 0) - return (int )-cc; + return (int )cc; xtv->xtv_off = fil->f_pos; xtv->xtv_len = cc; off = xtv->xtv_off + xtv->xtv_len; @@ -442,7 +442,7 @@ _sysio_ipiov(int (*f)(struct inode *, st cc = _sysio_sum_iovec(iov, count); if (cc < 0) { SYSIO_LEAVE; - return (int )-cc; + return (int )cc; } xtv->xtv_off = off, xtv->xtv_len = cc; |
From: Lee W. <lw...@us...> - 2004-04-12 15:50:16
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13297/src Modified Files: rw.c Log Message: Bug fix for Cray SPR 728620. In _sysio_sum_iovec a zero length iovec entry was not accounted for. This caused the routine to believe an overflow had occurred since the count didn't move after adding the xfer length. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -b -B -p -r1.3 -r1.4 --- rw.c 14 Feb 2004 19:42:59 -0000 1.3 +++ rw.c 12 Apr 2004 15:36:06 -0000 1.4 @@ -184,7 +184,7 @@ _sysio_sum_iovec(const struct iovec *iov while (count--) { tmp = cc; cc += iov->iov_len; - if (tmp && cc <= tmp) + if (tmp && iov->iov_len && cc <= tmp) return -EINVAL; iov++; } |
From: Lee W. <lw...@us...> - 2004-04-02 14:39:56
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30251 Modified Files: open.c Log Message: Cray Red Storm requires support for the O_NOFOLLOW flag to open. Added it for everyone. Index: open.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/open.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -b -B -p -r1.15 -r1.16 --- open.c 1 Apr 2004 15:26:20 -0000 1.15 +++ open.c 2 Apr 2004 14:27:46 -0000 1.16 @@ -41,6 +41,11 @@ * le...@sa... */ +/* + * Incorporate the GNU flags for open if we can. + */ +#define _GNU_SOURCE + #include <stdlib.h> #include <string.h> #include <errno.h> @@ -157,7 +162,7 @@ open(const char *path, int flags, ...) va_arg(ap, int); #endif va_end(ap); - mode &= ~(_sysio_umask & 0777); /* apply umask */ + mode &= ~(_sysio_umask & 0777) | 07000; /* apply umask */ if (flags & O_EXCL) { /* @@ -166,6 +171,10 @@ open(const char *path, int flags, ...) intent.int_opmask |= INT_CREAT; } } +#ifdef O_NOFOLLOW + if (flags & O_NOFOLLOW) + ndflags |= ND_NOFOLLOW; +#endif /* * Find the file. |
From: Lee W. <lw...@us...> - 2004-04-01 15:38:19
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6680 Modified Files: open.c Log Message: Fix application of umask in open. From Kevin Pedretti. Index: open.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/open.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -b -B -p -r1.14 -r1.15 --- open.c 25 Feb 2004 16:24:00 -0000 1.14 +++ open.c 1 Apr 2004 15:26:20 -0000 1.15 @@ -157,7 +157,7 @@ open(const char *path, int flags, ...) va_arg(ap, int); #endif va_end(ap); - mode &= ~_sysio_umask & 0777; /* apply umask */ + mode &= ~(_sysio_umask & 0777); /* apply umask */ if (flags & O_EXCL) { /* |
From: Lee W. <lw...@us...> - 2004-03-31 17:55:11
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26294/include Modified Files: sysio.h Log Message: Kevin Pedretti's changes for RedStorm based on glibc. Index: sysio.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -w -b -B -p -r1.18 -r1.19 --- sysio.h 24 Feb 2004 14:03:55 -0000 1.18 +++ sysio.h 31 Mar 2004 17:43:17 -0000 1.19 @@ -188,7 +188,7 @@ extern off_t lseek(int fd, off_t offset, extern off64_t lseek64(int fd, off64_t offset, int whence); #endif extern int lstat(const char *path, struct stat *buf); -#if defined(BSD) || defined(REDSTORM) +#ifdef BSD extern int getdirentries(int fd, char *buf, int nbytes , long *basep); #else extern ssize_t getdirentries(int fd, char *buf, size_t nbytes, off_t *basep); |
From: Lee W. <lw...@us...> - 2004-03-31 17:55:10
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26294/src Modified Files: chdir.c chown.c getdirentries.c mknod.c stat.c Log Message: Kevin Pedretti's changes for RedStorm based on glibc. Index: chdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chdir.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -b -B -p -r1.13 -r1.14 --- chdir.c 8 Feb 2004 21:37:26 -0000 1.13 +++ chdir.c 31 Mar 2004 17:43:18 -0000 1.14 @@ -139,16 +139,17 @@ chdir(const char *path) return err; } +#ifdef REDSTORM +#undef __chdir +sysio_sym_weak_alias(chdir, __chdir) +#endif + /* * Return path tracked by the path ancestor chain. * * 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) Index: chown.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chown.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -b -B -p -r1.6 -r1.7 --- chown.c 26 Jan 2004 16:34:54 -0000 1.6 +++ chown.c 31 Mar 2004 17:43:18 -0000 1.7 @@ -95,13 +95,13 @@ out: } SYSIO_LEAVE; return err; +} + #ifdef REDSTORM #undef __chown sysio_sym_weak_alias(chown, __chown) #endif -} - int fchown(int fd, uid_t owner, gid_t group) { @@ -122,9 +122,11 @@ out: err = -1; } + return err; +} + #ifdef REDSTORM #undef __fchown sysio_sym_weak_alias(fchown, __fchown) #endif - return err; -} + Index: getdirentries.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/getdirentries.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- getdirentries.c 24 Feb 2004 14:58:26 -0000 1.8 +++ getdirentries.c 31 Mar 2004 17:43:18 -0000 1.9 @@ -69,7 +69,7 @@ sysio_sym_strong_alias(_getdirentries64, ((((n) + (boundary) - 1 ) / (boundary)) * (boundary)) #endif -#if !(defined(BSD) || defined(REDSTORM)) +#ifndef BSD ssize_t getdirentries(int fd, char *buf, Index: mknod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mknod.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 Index: stat.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/stat.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -b -B -p -r1.9 -r1.10 --- stat.c 26 Jan 2004 16:34:54 -0000 1.9 +++ stat.c 31 Mar 2004 17:43:18 -0000 1.10 @@ -99,11 +99,6 @@ __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; } @@ -131,6 +126,11 @@ out: return err; } +#ifdef REDSTORM +#undef _fxstat +sysio_sym_weak_alias(__fxstat, _fxstat) +#endif + static int __fstat(int fd, struct stat *buf) { @@ -181,10 +181,6 @@ __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 @@ -198,6 +194,11 @@ out: return err; } +#ifdef REDSTORM +#undef _xstat +sysio_sym_weak_alias(__xstat, _xstat) +#endif + static int __stat(const char *filename, struct stat *buf) { @@ -248,10 +249,6 @@ __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 @@ -265,6 +262,11 @@ out: return err; } +#ifdef REDSTORM +#undef _lxstat +sysio_sym_weak_alias(__lxstat, _lxstat) +#endif + static int __lstat(const char *filename, struct stat *buf) { |
From: Lee W. <lw...@us...> - 2004-03-18 14:43:56
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13944 Modified Files: lseek.c Log Message: Lseek backwards was broken -- from Ruth Klundt and the Sandia CTH team. Fixed now. Index: lseek.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/lseek.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -b -B -p -r1.13 -r1.14 --- lseek.c 14 Feb 2004 19:42:59 -0000 1.13 +++ lseek.c 18 Mar 2004 14:34:18 -0000 1.14 @@ -91,8 +91,8 @@ _sysio_lseek(int fd, _SYSIO_OFF_T offset return -EINVAL; } pos = off + offset; - if ((offset < 0 && -offset > off) || - (off && offset && pos <= off)) + if ((offset < 0 && -offset >= off) || + (offset > 0 && pos <= off)) return -EINVAL; #ifdef O_LARGEFILE if (pos >= ((fil->f_flags & O_LARGEFILE) ? _SYSIO_OFF_T_MAX : LONG_MAX)) |
From: Sonja T. <so...@us...> - 2004-03-12 21:46:00
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22126/tests Modified Files: test_getcwd.pl Log Message: Fix bug in test_getcwd.pl that caused a failure when the cwd had a symlink somewhere along its path. Index: test_getcwd.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_getcwd.pl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- test_getcwd.pl 21 Jan 2004 15:13:56 -0000 1.5 +++ test_getcwd.pl 12 Mar 2004 21:18:18 -0000 1.6 @@ -6,6 +6,8 @@ use strict; use FindBin; use lib "$FindBin::Bin"; use helper; +use Fcntl ':mode'; + sub usage { @@ -35,9 +37,15 @@ sub check_wkdir my $iodir = <$outfh>; chop($iodir); - if ($wdir ne $iodir) { - helper::print_and_exit($cmdfh, $outfh, 0, - "ERROR! wdir ($wdir) does not match sysio's cwd ($iodir)\n"); + # Only compare the last portion of the working directory + my @iodirs = split(/\//, $iodir); + my @wdirs = split(/\//, $wdir); + + if ($iodirs[-1] ne $wdirs[-1]) { + helper::print_and_exit + ($cmdfh, + $outfh, 0, + "ERROR! topmost wdir ($wdirs[-1]) does not match sysio's ($iodirs[-1])\n"); } } @@ -75,7 +83,7 @@ sub process_cmd # Get current working directory from environment my $cwd = $ENV{PWD}; - check_wkdir($cwd, $outfh, $cmdfh); + } # Now change to dir |
From: Sonja T. <so...@us...> - 2004-03-12 21:10:23
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14676/tests Modified Files: sysio_stubs.c sysio_tests.c test_path.pl test_stats.pl Log Message: Make tests work on x86_64 platform. Index: sysio_stubs.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/sysio_stubs.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -b -B -p -r1.11 -r1.12 --- sysio_stubs.c 1 Mar 2004 22:46:39 -0000 1.11 +++ sysio_stubs.c 12 Mar 2004 20:42:41 -0000 1.12 @@ -144,14 +144,14 @@ int test_do_fillbuff(int argc, char **ar size, buf, (char *)valptr)); memcpy(buf, valptr, size); } else if (!strcmp(typestr, "PTR")) { - unsigned int val; + unsigned long val; int index = get_obj(argv[0]); if (index < 0) { DBG(2, fprintf(outfp, "Unable to find buffer at %s\n", argv[0])); return INVALID_VAR; } - val = (unsigned int)buflist[index]->buf; + val = (unsigned long)buflist[index]->buf; valptr = &val; DBG(4, fprintf(outfp, "Copying %d bytes from %p. Val is %p\n", size, buf, valptr)); @@ -220,7 +220,7 @@ int test_do_printbuf(int argc, char **ar if (argv[0][0] == '$') { if (argv[0][1] == '$') { - sprintf(output, "\n%#010x", last_ret_val); + sprintf(output, "\n%#010x", (unsigned int)last_ret_val); return SUCCESS; } else if (!strcmp("errno", &argv[0][1])) { sprintf(output, "\n%#010x", my_errno); @@ -847,7 +847,7 @@ int test_do_fcntl(int argc, char **argv) last_ret_val = sysio_fcntl(fd, cmd, argv[2]); else last_ret_val = sysio_fcntl(fd, cmd, NULL); - DBG(4, fprintf(outfp, "Got return value of %d\n", last_ret_val)); + DBG(4, fprintf(outfp, "Got return value of %d\n", (int)last_ret_val)); my_errno = errno; last_type = SINT; @@ -1019,7 +1019,9 @@ int test_do_getcwd(int argc, char **argv DBG(4, fprintf(outfp, "Getting cwd with buffer size of %d\n", size)); - if (!(last_ret_val = (int)getcwd(buf, size))) { + last_ret_val = 0; + if (!getcwd(buf, size)) { + last_ret_val = -1; if (errno == ERANGE) { DBG(2, fprintf(outfp, "Need a bigger buffer!\n")); } @@ -1027,6 +1029,7 @@ int test_do_getcwd(int argc, char **argv my_errno = errno; + DBG(3, fprintf(outfp, "cwd: %s\n", buf)); last_type = SINT; @@ -1400,7 +1403,7 @@ int test_do_umask(int argc, char **argv) int test_do_iowait(int argc, char **argv) { - int err; + long err; ioid_t ioid; if (argc != 1) { @@ -1428,7 +1431,7 @@ int test_do_iowait(int argc, char **argv int test_do_iodone(int argc, char **argv) { - int err; + long err; ioid_t ioid; if (argc != 1) { @@ -1490,7 +1493,7 @@ int test_do_ipread(int argc, char **argv return INVALID_ARGS; } - last_ret_val = (int) ipread(fd, buf, count, offset); + last_ret_val = (long)ipread(fd, buf, count, offset); if (last_ret_val < 0) { my_perror("ipread"); } @@ -1530,7 +1533,7 @@ int test_do_iread(int argc, char **argv) return INVALID_ARGS; } - last_ret_val = (int) iread(fd, buf, count); + last_ret_val = (long) iread(fd, buf, count); if (last_ret_val < 0) { my_perror("iread"); } @@ -1584,9 +1587,9 @@ int test_do_ipreadv(int argc, char **arg } DBG(3, fprintf(outfp, "ipreadv(fd: %d vector:{iov_base: %p iov_len %d} count: %d offset: %d\n", - fd, iov->iov_base, iov->iov_len, count, (int) offset)); + fd, iov->iov_base, (int)iov->iov_len, count, (int) offset)); - last_ret_val = (int) ipreadv(fd, iov, count, offset); + last_ret_val = (long) ipreadv(fd, iov, count, offset); if (last_ret_val < 0) my_perror("ipreadv"); my_errno = errno; @@ -1639,7 +1642,7 @@ int test_do_preadv(int argc, char **argv } DBG(3, fprintf(outfp, "preadv(fd: %d vector:{iov_base: %p iov_len %d} count: %d offset: %d\n", - fd, iov->iov_base, iov->iov_len, count, (int) offset)); + fd, iov->iov_base, (int) iov->iov_len, count, (int) offset)); last_ret_val = preadv(fd, iov, count, offset); my_errno = errno; @@ -1740,9 +1743,9 @@ int test_do_ireadv(int argc, char **argv } DBG(3, fprintf(outfp, "ireadv (fd: %d, vector:{ iov_base: %p iov_len %d }, count: %d\n", - fd, iov->iov_base, iov->iov_len, count)); + fd, iov->iov_base, (int)iov->iov_len, count)); - last_ret_val = (int) ireadv(fd, iov, count); + last_ret_val = (long) ireadv(fd, iov, count); if (last_ret_val < 0) my_perror("ireadv"); my_errno = errno; @@ -1787,7 +1790,7 @@ int test_do_readv(int argc, char **argv) } DBG(3, fprintf(outfp, "ireadv (fd: %d, vector:{ iov_base: %p iov_len %d }, count: %d\n", - fd, iov->iov_base, iov->iov_len, count)); + fd, iov->iov_base, (int)iov->iov_len, count)); last_ret_val = readv(fd, iov, count); if (last_ret_val < 0) @@ -1894,9 +1897,9 @@ int test_do_ipwritev(int argc, char **ar DBG(3, fprintf(outfp, "ipwritev(fd: %d, vector: { iov_base: %p iov_len %d }, count: %d, offset: %d\n", - fd, iov->iov_base, iov->iov_len, count, offset)); + fd, iov->iov_base, (int)iov->iov_len, count, offset)); - last_ret_val = (int) ipwritev(fd, iov, count, offset); + last_ret_val = (long) ipwritev(fd, iov, count, offset); my_errno = errno; if (last_ret_val < 0) my_perror("ipwritev"); @@ -1943,7 +1946,7 @@ int test_do_ipwrite(int argc, char **arg return INVALID_ARGS; } - last_ret_val = (int) ipwrite(fd, buf, count, offset); + last_ret_val = (long) ipwrite(fd, buf, count, offset); if (last_ret_val < 0) my_perror("ipwrite"); my_errno = errno; @@ -1996,9 +1999,9 @@ int test_do_pwritev(int argc, char **arg DBG(3, fprintf(outfp, "pwritev(fd: %d, vector: { iov_base: %p iov_len %d }, count: %d, offset: %d\n", - fd, iov->iov_base, iov->iov_len, count, offset)); + fd, iov->iov_base, (int)iov->iov_len, count, offset)); - last_ret_val = pwritev(fd, iov, count, offset); + last_ret_val = (long) pwritev(fd, iov, count, offset); if (last_ret_val < 0) my_perror("ipwritev"); my_errno = errno; @@ -2091,9 +2094,9 @@ int test_do_iwritev(int argc, char **arg } DBG(3, fprintf(outfp, "iwritev(fd: %d, vector: { iov_base: %p iov_len %d }, count: %d\n", - fd, iov->iov_base, iov->iov_len, count)); + fd, iov->iov_base, (int)iov->iov_len, count)); - last_ret_val = (int) iwritev(fd, iov, count); + last_ret_val = (long) iwritev(fd, iov, count); my_errno = errno; if (last_ret_val < 0) my_perror("iwritev"); @@ -2134,7 +2137,7 @@ int test_do_iwrite(int argc, char **argv return INVALID_ARGS; } - last_ret_val = (int) iwrite(fd, buf, count); + last_ret_val = (long) iwrite(fd, buf, count); my_errno = errno; if (last_ret_val < 0) my_perror("iwrite"); @@ -2226,7 +2229,7 @@ int test_do_writev(int argc, char **argv } DBG(3, fprintf(outfp, "writev(fd: %d, vector: { iov_base: %p iov_len %d }, count: %d\n", - fd, iov->iov_base, iov->iov_len, count)); + fd, iov->iov_base, (int)iov->iov_len, count)); last_ret_val = writev(fd, iov, count); if (last_ret_val < 0) @@ -2320,7 +2323,7 @@ int test_do_init_iovec(int argc, char ** iov_ptr[pos].iov_base = (void *)(base_ptr + 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)); + (int)iov_ptr[pos].iov_len, iov_ptr[pos].iov_base)); my_errno = errno; last_type = PTR; @@ -2364,7 +2367,7 @@ int test_do_init_xtvec(int argc, char ** 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)); + (int)xtv_ptr[pos].xtv_len, (int)xtv_ptr[pos].xtv_off)); my_errno = errno; last_type = PTR; @@ -2494,7 +2497,7 @@ int test_do_iwritex(int argc, char **arg DBG(3, fprintf(outfp, "iwritex(fd: %d, iov: %p iov_cnt: %d, xtv: %p, xtv_cnt: %d\n", fd, (void *)iov, iov_count, (void *)xtv, xtv_count)); - last_ret_val = (int) iwritex(fd, iov, iov_count, xtv, xtv_count); + last_ret_val = (long) iwritex(fd, iov, iov_count, xtv, xtv_count); if (last_ret_val < 0) my_perror("iwritex"); my_errno = errno; @@ -2626,7 +2629,7 @@ int test_do_ireadx(int argc, char **argv DBG(3, fprintf(outfp, "ireadx(fd: %d, iov: %p iov_cnt: %d, xtv: %p, xtv_cnt: %d\n", fd, (void *)iov, iov_count, (void *)xtv, xtv_count)); - last_ret_val = (int) ireadx(fd, iov, iov_count, xtv, xtv_count); + last_ret_val = (long) ireadx(fd, iov, iov_count, xtv, xtv_count); if (last_ret_val < 0) my_perror("ireadx"); my_errno = errno; Index: sysio_tests.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/sysio_tests.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -b -B -p -r1.6 -r1.7 --- sysio_tests.c 24 Feb 2004 15:46:33 -0000 1.6 +++ sysio_tests.c 12 Mar 2004 20:42:41 -0000 1.7 @@ -543,7 +543,7 @@ int sysio_open(char *path, int flags) last_ret_val = open(path, flags); my_errno = errno; DBG(3, sprintf(output, "Returning with errno set to %s (ret val is %d)\n", - strerror(my_errno), last_ret_val)); + strerror(my_errno), (int)last_ret_val)); return SUCCESS; } @@ -650,7 +650,7 @@ void print_stat(struct stat *st) DBG(3, sprintf(output, "%s st_dev: %#16x\n", output, (unsigned int)st->st_dev)); DBG(3, sprintf(output, "%s st_ino: %#16x\n", output, (unsigned int) st->st_ino)); DBG(3, sprintf(output, "%s st_mode: %#16x\n", output, st->st_mode)); - DBG(3, sprintf(output, "%s st_nlink: %#16x\n", output, st->st_nlink)); + DBG(3, sprintf(output, "%s st_nlink: %#16x\n", output, (int)st->st_nlink)); DBG(3, sprintf(output, "%s st_uid: %#16x\n", output, st->st_uid)); DBG(3, sprintf(output, "%s st_gid: %#16x\n", output, st->st_gid)); DBG(3, sprintf(output, "%s st_rdev: %#16x\n", output, (int)st->st_rdev)); Index: test_path.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_path.pl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- test_path.pl 21 Jan 2004 15:13:56 -0000 1.4 +++ test_path.pl 12 Mar 2004 20:42:41 -0000 1.5 @@ -12,10 +12,11 @@ use FindBin; use lib "$FindBin::Bin"; use helper; use POSIX; +use Fcntl ':mode'; sub usage { - print "Usage ./test_path.pl path1 [path2] [path3...] : Print each path listed and its type\n"; + print "Usage ./test_path.pl [path1 path2...] : Print each path listed and its type\n"; print " : If no paths are given, stdin is read\n"; exit(-1); } @@ -54,7 +55,7 @@ sub print_path sub process_path { - my ($cmdfh, $outfh, $path) = @_; + my ($cmdfh, $outfh, $bits, $path) = @_; # Issue the stat command my $cmdstr = 'CALL stat "'; @@ -64,7 +65,11 @@ sub process_path helper::verify_cmd($cmdfh, $outfh, "stat"); # Print out the stat buffer + if ($bits == 32) { $cmdstr = 'PRINT $buf 0 8 LONG 12 24 INT 44 8 LONG 52 8 INT 64 24 LONG'; + } else { + $cmdstr = 'PRINT $buf 0 24 LONG 24 16 INT 48 32 LONG 88 8 LONG 104 8 LONG'; + } $cmdstr .= "\n"; helper::send_cmd($cmdfh, $outfh, "PRINT", $cmdstr); @@ -73,7 +78,11 @@ sub process_path my ( $iodev, $ioino, $iomode, $ionlink, $iouid, $iogid, $iordev, $iosize, $ioblksize, $ioblks, $ioatime, $iomtime, $ioctime ) = split(' ', $res); - + if ($bits == 64) { + ( $iodev, $ioino, $ionlink, $iomode, $iouid, $iogid, $iordev, + $iosize, $ioblksize, $ioblks, $ioatime, $iomtime, $ioctime ) + = split(' ', $res); + } $iomode = oct($iomode); # Print out the path @@ -118,6 +127,17 @@ sub process_cmd $cmdstr .= "\n"; helper::send_cmd($cmdfh, $outfh, "alloc", $cmdstr); + # Attempt to determine type + $cmdstr = 'PRINT $size'."\n"; + helper::send_cmd($cmdfh, $outfh, "print", $cmdstr); + my $statsize = <$outfh>; + chop($statsize); + $statsize = oct($statsize); + my $bits = 32; + if ($statsize == 144) { + $bits = 64; + } + my $i=0; if ($usestdin) { $path = <STDIN>; @@ -132,7 +152,7 @@ sub process_cmd # phase of loop. while (defined($path)) { - process_path($cmdfh, $outfh, $path); + process_path($cmdfh, $outfh, $bits, $path); if ($usestdin) { $path = <STDIN>; Index: test_stats.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_stats.pl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- test_stats.pl 6 Feb 2004 20:07:31 -0000 1.7 +++ test_stats.pl 12 Mar 2004 20:42:41 -0000 1.8 @@ -30,7 +30,7 @@ sub usage sub cmp_stats { - my ( $cmdfh, $outfh, $is_alpha, @stats) = @_; + my ( $cmdfh, $outfh, $is_alpha, $bits, @stats) = @_; my ($iodev, $ioino, $iomode, $ionlink, $iouid, $iogid, $iordev, @@ -42,6 +42,11 @@ sub cmp_stats $iosize, $ioatime, $iomtime, $ioctime, $ioblks, $ioblksize, @pstats) = @stats; } + if ($bits == 64) { + ($iodev, $ioino, $ionlink, $iomode, $iouid, $iogid, $iordev, + $iosize, $ioblksize, $ioblks, $ioatime, $iomtime, $ioctime,@pstats) = + @stats; + } my ($pdev, $pino, $pmode, $pnlink, $puid, $pgid, $prdev, $psize, $patime, $pmtime, $pctime, $pblksize, $pblks) = @pstats; @@ -65,16 +70,19 @@ sub cmp_stats # Perl's output sub verify_stat { - my ($cmdfh, $outfh, $cmd, $is_alpha, @stats) = @_; + my ($cmdfh, $outfh, $cmd, $is_alpha, $bits, @stats) = @_; my $i=0; my $cmdstr; # Print out the stat buffer - if ($is_alpha == 0) { + if ($is_alpha == 1) { + $cmdstr = 'PRINT $buf 0 16 LONG 16 16 INT 32 8 LONG 40 4 INT 48 40 LONG'."\n"; + } elsif ($bits == 32) { $cmdstr = 'PRINT $buf 0 8 LONG 12 24 INT 44 8 LONG 48 8 INT 56 24 LONG'."\n"; } else { - $cmdstr = 'PRINT $buf 0 16 LONG 16 16 INT 32 8 LONG 40 4 INT 48 40 LONG'."\n"; + $cmdstr = 'PRINT $buf 0 24 LONG 24 16 INT 48 32 LONG 88 8 LONG 104 8 LONG'."\n"; } + helper::send_cmd($cmdfh, $outfh, "PRINT", $cmdstr); my $res = <$outfh>; @@ -86,7 +94,7 @@ sub verify_stat $i++; } - cmp_stats($cmdfh, $outfh, $is_alpha, @iostats, @stats); + cmp_stats($cmdfh, $outfh, $is_alpha, $bits, @iostats, @stats); } @@ -138,10 +146,21 @@ sub process_cmd helper::send_cmd($cmdfh, $outfh, "stat", $cmdstr); helper::verify_cmd($cmdfh, $outfh, "stat"); + # Attempt to determine type + $cmdstr = 'PRINT $size'."\n"; + helper::send_cmd($cmdfh, $outfh, "print", $cmdstr); + my $statsize = <$outfh>; + chop($statsize); + $statsize = oct($statsize); + my $bits = 32; + if ($statsize == 144) { + $bits = 64; + } + if ($use_system == 1) { # Now print the buffer out and verify that it matches # what Perl has - verify_stat($cmdfh, $outfh, "stat", $is_alpha, @stats); + verify_stat($cmdfh, $outfh, "stat", $is_alpha, $bits, @stats); } # Open the file @@ -156,7 +175,7 @@ sub process_cmd helper::verify_cmd($cmdfh, $outfh, "fstat"); if ($use_system == 1) { - verify_stat($cmdfh, $outfh, "fstat", $is_alpha, @stats); + verify_stat($cmdfh, $outfh, "fstat", $is_alpha, $bits, @stats); } # Test lstat @@ -169,7 +188,7 @@ sub process_cmd helper::verify_cmd($cmdfh, $outfh, "lstat"); if ($use_system == 1) { - verify_stat($cmdfh, $outfh, "lstat", $is_alpha, @stats); + verify_stat($cmdfh, $outfh, "lstat", $is_alpha, $bits, @stats); } if (0) { |
From: Sonja T. <so...@us...> - 2004-03-11 15:11:25
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8394/tests Added Files: test_strided.pl Log Message: Oops. I should really add the strided I/O test when including it in test_all.pl --- NEW FILE --- #!/usr/bin/perl -w # # strided IO test: Perform a series of different reads/writes # using readx and writex with different buffer # configurations # 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"; system("killall test_driver"); 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) { print STDOUT "Error! $cmdstr returned $res\n"; } } } # Initilize the iovec number $vecnum # in the iovec buffer $vecname with buffer # pos $buf and using len $veclen sub set_iovec { my ($cmdfh, $outfh, $vecname, $vecnum, $buf, $veclen) = @_; my $cmdstr = 'CALL init_iovec $'.$buf." 0 $veclen "; $cmdstr .= "$vecnum ".'$'."$vecname\n"; helper::send_cmd($cmdfh, $outfh, "init_iovec", $cmdstr); helper::verify_cmd($cmdfh, $outfh, "init_iovec"); } sub setup_xtvecs { my ($cmdfh, $outfh) = @_; # 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 = '$xtvbuf'." = ALLOC $size\n"; helper::send_cmd($cmdfh, $outfh, "alloc", $cmdstr); # Now initilize xtvbuf $cmdstr = "CALL init_xtvec 0 100 0 ". '$xtvbuf'."\n"; helper::send_cmd($cmdfh, $outfh, "init_xtvec", $cmdstr); helper::verify_cmd($cmdfh, $outfh, "init_xtvec"); $cmdstr = "CALL init_xtvec 1000 100 1 ". '$xtvbuf'."\n"; helper::send_cmd($cmdfh, $outfh, "init_xtvec", $cmdstr); helper::verify_cmd($cmdfh, $outfh, "init_xtvec"); } sub check_buf { my ($cmdfh, $outfh, $bufsize, $bufname, $readcmd, $digit, $offset) = @_; my $cmdstr = 'CALL checkbuf $'. "$bufname $bufsize $digit $offset\n"; helper::send_cmd($cmdfh, $outfh, "checkbuf", $cmdstr); my $res = helper::verify_cmd($cmdfh, $outfh, "checkbuf"); $res = oct($res); if ($res != 0) { print STDOUT "$readcmd did not return all $digit 's\n"; } } # Fill given buffer with $digit up to $size # starting at $offset sub fill_buf { my ($cmdfh, $outfh, $buf, $digit, $size, $off) = @_; my $cmdstr = "CALL setbuf $digit $size ".'$'."$buf $off\n"; helper::send_cmd($cmdfh, $outfh, "setbuf", $cmdstr); } sub alloc_iovbuf { my ($cmdfh, $outfh, $numbufs, $num) = @_; # 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 * $numbufs; # Allocate iovec buffer $cmdstr = '$iovbuf'."$num = ALLOC $size\n"; helper::send_cmd($cmdfh, $outfh, "alloc", $cmdstr); my $retstr = "iovbuf".$num; return $retstr; } sub do_rwcalls { my ($cmdfh, $outfh, $fh) = @_; # Allocate and initilize xtvecs setup_xtvecs($cmdfh, $outfh); # Allocate 2 different iovecs, one for cases # (a) and (d) and one for cases (b) and (c) my $iovbuf1 = alloc_iovbuf($cmdfh, $outfh, 3, 0); my $iovbuf2 = alloc_iovbuf($cmdfh, $outfh, 1, 1); # Allocate four buffers, each 200 bytes long my $cmdstr = '$buf1 '. "= ALLOC 200\n"; helper::send_cmd($cmdfh, $outfh, "alloc", $cmdstr); $cmdstr = '$buf2 '. "= ALLOC 200\n"; helper::send_cmd($cmdfh, $outfh, "alloc", $cmdstr); $cmdstr = '$buf3 '. "= ALLOC 200\n"; helper::send_cmd($cmdfh, $outfh, "alloc", $cmdstr); $cmdstr = '$buf4 '. "= ALLOC 200\n"; helper::send_cmd($cmdfh, $outfh, "alloc", $cmdstr); # Case (a): # xtvec[] = { { 0, 100 }, {1000, 100} } # iovec[] = { { buf1, 50}, {buf2, 50}, {buf3, 100} # Fill each of the 3 buffers of. They will be filled # as follows: # buf1 --> 0- 49: 1 # --> 49-200: 2 # buf2 --> 0- 49: 3 # --> 49-200: 4 # buf3 --> 0-100: 5 # --> 100-200: 6 fill_buf($cmdfh, $outfh, "buf1", 1, 50, 0); fill_buf($cmdfh, $outfh, "buf1", 2, 150, 50); fill_buf($cmdfh, $outfh, "buf2", 3, 50, 0); fill_buf($cmdfh, $outfh, "buf2", 4, 150, 50); fill_buf($cmdfh, $outfh, "buf3", 5, 100, 0); fill_buf($cmdfh, $outfh, "buf3", 6, 100, 100); # Initiize iovecs set_iovec($cmdfh, $outfh, $iovbuf1, 0, "buf1", 50); set_iovec($cmdfh, $outfh, $iovbuf1, 1, "buf2", 50); set_iovec($cmdfh, $outfh, $iovbuf1, 2, "buf3", 100); # Write out to $fh $cmdstr = 'CALL writex $'."$fh $iovbuf1 3 ".'$xtvbuf '."2\n"; helper::send_cmd($cmdfh, $outfh, "writex", $cmdstr); verify_result($cmdfh, $outfh, "writex (case a)", 200, "!="); # Clear out the buffers fill_buf($cmdfh, $outfh, "buf1", 0, 200, 0); fill_buf($cmdfh, $outfh, "buf2", 0, 200, 0); fill_buf($cmdfh, $outfh, "buf3", 0, 200, 0); # Read it back $cmdstr = 'CALL readx $'."$fh $iovbuf1 3 ".'$xtvbuf '."2\n"; helper::send_cmd($cmdfh, $outfh, "readx", $cmdstr); verify_result($cmdfh, $outfh, "readx (case a)", 200, "!="); # Make sure we got what we expected... check_buf($cmdfh, $outfh, 50, "buf1", "readx (case a)", 1, 0); check_buf($cmdfh, $outfh, 50, "buf2", "readx (case a)", 3, 0); check_buf($cmdfh, $outfh, 100, "buf3", "readx (case a)", 5, 0); # Case (b): # xtvec[] = { { 0, 100 }, {1000, 100} } # iovec[] = { { buf4, 200} } # Fill buf4 with 7's... fill_buf($cmdfh, $outfh, "buf4", 7, 200, 0); # Initiize iovecs set_iovec($cmdfh, $outfh, $iovbuf2, 0, "buf4", 200); # Write out to $fh $cmdstr = 'CALL writex $'."$fh ".'$'."$iovbuf2 1 ".'$xtvbuf '."2\n"; helper::send_cmd($cmdfh, $outfh, "writex", $cmdstr); verify_result($cmdfh, $outfh, "writex (case b)", 200, "!="); # Clear out the buffer fill_buf($cmdfh, $outfh, "buf4", 0, 200, 0); # Read it back $cmdstr = 'CALL readx $'."$fh $iovbuf2 1 ".'$xtvbuf '."2\n"; helper::send_cmd($cmdfh, $outfh, "readx", $cmdstr); verify_result($cmdfh, $outfh, "readx (case b)", 200, "!="); # Make sure we got what we expected... check_buf($cmdfh, $outfh, 200, "buf4", "readx (case b)", 7, 0); # Case (c): # xtvec[] = { { 0, 100 }, {1000, 100} } # iovec[] = { { buf4, 40} } # Fill buf4 with 8's... fill_buf($cmdfh, $outfh, "buf4", 8, 200, 0); # Initiize iovecs set_iovec($cmdfh, $outfh, $iovbuf2, 0, "buf4", 40); # Write out to $fh $cmdstr = 'CALL writex $'."$fh $iovbuf2 1 ".'$xtvbuf '."2\n"; helper::send_cmd($cmdfh, $outfh, "writex", $cmdstr); verify_result($cmdfh, $outfh, "writex (case c)", 40, "!="); # Clear out the buffer fill_buf($cmdfh, $outfh, "buf4", 0, 200, 0); # Read it back $cmdstr = 'CALL readx $'."$fh $iovbuf2 1 ".'$xtvbuf '."2\n"; helper::send_cmd($cmdfh, $outfh, "readx", $cmdstr); verify_result($cmdfh, $outfh, "readx (case c)", 40, "!="); # Make sure we got what we expected... check_buf($cmdfh, $outfh, 40, "buf4", "readx (case c)", 8, 0); # Case (d): # xtvec[] = { { 0, 100 }, {1000, 100} } # iovec[] = { { buf1, 40}, {buf2, 150}, {buf3, 200} } # Fill each of the 3 buffers of. They will be filled # as follows: # buf1 --> 0- 39: 1 # --> 39-200: 2 # buf2 --> 0-150: 3 # --> 150-200: 4 # buf3 --> 0- 9: 5 # --> 10-200: 6 fill_buf($cmdfh, $outfh, "buf1", 1, 40, 0); fill_buf($cmdfh, $outfh, "buf1", 2, 160, 40); fill_buf($cmdfh, $outfh, "buf2", 3, 150, 0); fill_buf($cmdfh, $outfh, "buf2", 4, 50, 150); fill_buf($cmdfh, $outfh, "buf3", 5, 10, 0); fill_buf($cmdfh, $outfh, "buf3", 6, 190, 10); # Initiize iovecs set_iovec($cmdfh, $outfh, $iovbuf1, 0, "buf1", 40); set_iovec($cmdfh, $outfh, $iovbuf1, 1, "buf2", 150); set_iovec($cmdfh, $outfh, $iovbuf1, 2, "buf3", 200); # Write out to $fh $cmdstr = 'CALL writex $'."$fh $iovbuf1 3 ".'$xtvbuf '."2\n"; helper::send_cmd($cmdfh, $outfh, "writex", $cmdstr); verify_result($cmdfh, $outfh, "writex (case d)", 200, "!="); # Clear out the buffers fill_buf($cmdfh, $outfh, "buf1", 0, 200, 0); fill_buf($cmdfh, $outfh, "buf2", 0, 200, 0); fill_buf($cmdfh, $outfh, "buf3", 0, 200, 0); # Read it back $cmdstr = 'CALL readx $'."$fh $iovbuf1 3 ".'$xtvbuf '."2\n"; helper::send_cmd($cmdfh, $outfh, "readx", $cmdstr); verify_result($cmdfh, $outfh, "readx (case d)", 200, "!="); # Make sure we got what we expected... check_buf($cmdfh, $outfh, 40, "buf1", "readx (case d)", 1, 0); check_buf($cmdfh, $outfh, 150, "buf2", "readx (case d)", 3, 0); check_buf($cmdfh, $outfh, 10, "buf3", "readx (case d)", 5, 0); # Case (e): # xtvec[] = { { 0, 100 }, {1000, 100} } # iovec[] = { { buf1, 30}, {buf2, 30}, {buf3, 30} } # Fill each of the 3 buffers as follows: # buf1 --> 0- 30: 1 # --> 30-200: 2 # buf2 --> 0- 30: 3 # --> 30-200: 4 # buf3 --> 0- 30: 5 # --> 30-200: 6 fill_buf($cmdfh, $outfh, "buf1", 1, 30, 0); fill_buf($cmdfh, $outfh, "buf1", 2, 170, 30); fill_buf($cmdfh, $outfh, "buf2", 3, 30, 0); fill_buf($cmdfh, $outfh, "buf2", 4, 170, 30); fill_buf($cmdfh, $outfh, "buf3", 5, 30, 0); fill_buf($cmdfh, $outfh, "buf3", 6, 170, 30); # Initiize iovecs set_iovec($cmdfh, $outfh, $iovbuf1, 0, "buf1", 30); set_iovec($cmdfh, $outfh, $iovbuf1, 1, "buf2", 30); set_iovec($cmdfh, $outfh, $iovbuf1, 2, "buf3", 30); # Write out to $fh $cmdstr = 'CALL writex $'."$fh $iovbuf1 3 ".'$xtvbuf '."2\n"; helper::send_cmd($cmdfh, $outfh, "writex", $cmdstr); verify_result($cmdfh, $outfh, "writex (case e)", 90, "!="); # Clear out the buffers fill_buf($cmdfh, $outfh, "buf1", 0, 200, 0); fill_buf($cmdfh, $outfh, "buf2", 0, 200, 0); fill_buf($cmdfh, $outfh, "buf3", 0, 200, 0); # Read it back $cmdstr = 'CALL readx $'."$fh $iovbuf1 3 ".'$xtvbuf '."2\n"; helper::send_cmd($cmdfh, $outfh, "readx", $cmdstr); verify_result($cmdfh, $outfh, "readx (case e)", 90, "!="); # Make sure we got what we expected... check_buf($cmdfh, $outfh, 30, "buf1", "readx (case e)", 1, 0); check_buf($cmdfh, $outfh, 30, "buf2", "readx (case e)", 3, 0); check_buf($cmdfh, $outfh, 30, "buf3", "readx (case e)", 5, 0); # Case (f): # xtvec[] = { { 0, 100 }, {1000, 100} } # iovec[] = { { buf1, 30}, {buf2, 90}, {buf3, 200} } # Fill each of the 3 buffers as follows: # buf1 --> 0- 30: 1 # --> 30-200: 2 # buf2 --> 0- 70: 3 # --> 70- 90: 4 # --> 90-200: 5 # buf3 --> 0-200: 6 fill_buf($cmdfh, $outfh, "buf1", 1, 30, 0); fill_buf($cmdfh, $outfh, "buf1", 2, 170, 30); fill_buf($cmdfh, $outfh, "buf2", 3, 70, 0); fill_buf($cmdfh, $outfh, "buf2", 4, 90, 70); fill_buf($cmdfh, $outfh, "buf2", 5, 110, 90); fill_buf($cmdfh, $outfh, "buf3", 6, 200, 0); # Initiize iovecs set_iovec($cmdfh, $outfh, $iovbuf1, 0, "buf1", 30); set_iovec($cmdfh, $outfh, $iovbuf1, 1, "buf2", 90); set_iovec($cmdfh, $outfh, $iovbuf1, 2, "buf3", 200); # Write out to $fh $cmdstr = 'CALL writex $'."$fh $iovbuf1 3 ".'$xtvbuf '."2\n"; helper::send_cmd($cmdfh, $outfh, "writex", $cmdstr); verify_result($cmdfh, $outfh, "writex (case f)", 200, "!="); # Clear out the buffers fill_buf($cmdfh, $outfh, "buf1", 0, 200, 0); fill_buf($cmdfh, $outfh, "buf2", 0, 200, 0); fill_buf($cmdfh, $outfh, "buf3", 0, 200, 0); # Read it back $cmdstr = 'CALL readx $'."$fh $iovbuf1 3 ".'$xtvbuf '."2\n"; helper::send_cmd($cmdfh, $outfh, "readx", $cmdstr); verify_result($cmdfh, $outfh, "readx (case f)", 200, "!="); # Make sure we got what we expected... check_buf($cmdfh, $outfh, 30, "buf1", "readx (case f)", 1, 0); check_buf($cmdfh, $outfh, 70, "buf2", "readx (case f)", 3, 0); check_buf($cmdfh, $outfh, 20, "buf2", "readx (case f)", 4, 70); check_buf($cmdfh, $outfh, 70, "buf3", "readx (case f)", 6, 0); } sub process_cmd { my ($file, $is_alpha) = @_; # Get tests directory my $testdir = $FindBin::Bin; 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|O_TRUNC S_IRWXU\n"; helper::send_cmd($cmdfh, $outfh, "open", $cmdstr); helper::verify_cmd($cmdfh, $outfh, $cmdstr); do_rwcalls($cmdfh, $outfh, "fd"); # 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, "strided IO 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; |
From: Sonja T. <so...@us...> - 2004-03-11 15:07:35
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7290/src Modified Files: ioctx.c Log Message: Fixing buf in enumerate_extents. Added a somewhat less trivial test for strided I/O to test suite. Index: ioctx.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/ioctx.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -b -B -p -r1.11 -r1.12 --- ioctx.c 1 Mar 2004 19:03:46 -0000 1.11 +++ ioctx.c 11 Mar 2004 14:40:52 -0000 1.12 @@ -372,6 +372,10 @@ _sysio_enumerate_extents(const struct in } while (xtvec.xtv_len) { if (iovec.iov_len) { + tmp = iovec.iov_len; + if (iovec.iov_len > xtvec.xtv_len) { + iovec.iov_len = xtvec.xtv_len; + } cc = (*f)(&iovec, 1, xtvec.xtv_off, @@ -383,7 +387,7 @@ _sysio_enumerate_extents(const struct in return cc; } iovec.iov_base = (char *)iovec.iov_base + cc; - iovec.iov_len -= cc; + iovec.iov_len = tmp - cc; tmp = cc + acc; if (acc && tmp <= acc) abort(); /* paranoia */ @@ -403,8 +407,11 @@ _sysio_enumerate_extents(const struct in } while (--iovlen); if (iov == start) { iovec = *iov++; - if (iovec.iov_len > n) +#if 0 + if (iovec.iov_len > n) { iovec.iov_len = n; + } +#endif continue; } remain = xtvec.xtv_len - n; @@ -418,11 +425,16 @@ _sysio_enumerate_extents(const struct in return acc; return cc; } - remain -= cc; + tmp = cc + acc; if (acc && tmp <= acc) abort(); /* paranoia */ acc = tmp; + + if (remain && !iovlen) + return acc; + + remain -= cc; if (remain) return acc; /* short */ } |