libsysio-commit Mailing List for libsysio (Page 48)
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: Mei <me...@us...> - 2003-06-19 12:24:35
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1:/tmp/cvs-serv29421/drivers/native Modified Files: Tag: b_lustre fs_native.c Log Message: - fcntl on native driver - typo fix Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.11.2.1 retrieving revision 1.11.2.2 diff -u -w -b -B -p -r1.11.2.1 -r1.11.2.2 --- fs_native.c 30 Apr 2003 14:32:16 -0000 1.11.2.1 +++ fs_native.c 19 Jun 2003 12:24:30 -0000 1.11.2.2 @@ -1112,11 +1112,35 @@ native_inop_fcntl(struct inode *ino, va_list ap) { struct native_inode *nino = I2NI(ino); + long arg; if (nino->ni_fd < 0) abort(); - return syscall(SYS_fcntl, nino->ni_fd, cmd, ap); + switch (cmd) { + case F_GETFD: + case F_GETFL: + case F_GETOWN: +// case F_GETSIG: +// case F_GETLEASE: + return syscall(SYS_fcntl, nino->ni_fd, cmd); + case F_DUPFD: + case F_SETFD: + case F_SETFL: + case F_GETLK: + case F_SETLK: + case F_SETLKW: + case F_SETOWN: +// case F_SETSIG: +// case F_SETLEASE: +// case F_NOTIFY: + arg = va_arg(ap, long); + return syscall(SYS_fcntl, nino->ni_fd, cmd, arg); + default: + printf("uncatched cmd %d\n", cmd); + abort(); + } + return -1; } static int |
From: Mei <me...@us...> - 2003-06-19 12:24:35
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv29421/src Modified Files: Tag: b_lustre bypass.c Log Message: - fcntl on native driver - typo fix Index: bypass.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/Attic/bypass.c,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 --- bypass.c 19 Jun 2003 12:18:29 -0000 1.1.2.1 +++ bypass.c 19 Jun 2003 12:24:30 -0000 1.1.2.2 @@ -118,7 +118,7 @@ int __bypass_fcntl(int fd, int cmd, va_l arg = va_arg(ap, long); return syscall(SYS_fcntl, fd, cmd, arg); default: - ERROR("uncached cmd %d\n", cmd); + ERROR("uncatched cmd %d\n", cmd); } return -1; } |
From: Mei <me...@us...> - 2003-06-19 12:18:32
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1:/tmp/cvs-serv28176/include Added Files: Tag: b_lustre bypass.h Log Message: initially add bypass mechanism, only for fcntl, read, write --- NEW FILE --- #ifndef __LIBSYSIO_BYPASS_H_ #define __LIBSYSIO_BYPASS_H_ //#define __LIBSYSIO_DEBUG__ #define ERROR(fmt, arg...) \ do { \ printf("sysio error: (%s:%d):", __FILE__, __LINE__); \ printf(fmt, ##arg); \ } while(0) #ifdef __LIBSYSIO_DEBUG__ #define DEBUG(fmt, arg...) \ do { \ printf("sysio: (%s:%d):", __FILE__, __LINE__); \ printf(fmt, ##arg); \ } while(0) #else #define DEBUG(fmt, arg...) do{}while(0) #endif /* __LIBSYSIO_DEBUG__ */ ioid_t __bypass_ireadv(int fd, const struct iovec *iov, int count); ioid_t __bypass_preadv(int fd, const struct iovec *iov, int count, off_t offset); ioid_t __bypass_iwritev(int fd, const struct iovec *iov, int count); ioid_t __bypass_pwritev(int fd, const struct iovec *iov, int count, off_t offset); int __bypass_fcntl(int fd, int cmd, va_list ap); #endif /* __LIBSYSIO_BYPASS_H_ */ |
From: Mei <me...@us...> - 2003-06-19 12:18:32
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv28176/src Modified Files: Tag: b_lustre Makefile.am fcntl.c iowait.c read.c write.c Added Files: Tag: b_lustre bypass.c Log Message: initially add bypass mechanism, only for fcntl, read, write --- NEW FILE --- /* * bypass.c Added by Cluster File Systems * Note it's only a temporary workaround and far from complete. */ #include <unistd.h> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/uio.h> #include <sys/queue.h> #include <syscall.h> #include "sysio.h" #include "file.h" #include "inode.h" #include "bypass.h" ioid_t __bypass_ireadv(int fd, const struct iovec *iov, int count) { struct ioctx *ioctx; ssize_t ret; DEBUG("iread on unknown fd %d\n", fd); ret = syscall(SYS_readv, fd, iov, count); if (ret >= 0) { ioctx = (struct ioctx *)malloc(sizeof(*ioctx)); if (!ioctx) { ERROR("failed to alloc ioctx\n"); return IOID_FAIL; } ioctx->ioctx_id = 0; ioctx->ioctx_cc = ret; return ioctx; } DEBUG("readv error %d, errno %d\n", ret, errno); return IOID_FAIL; } ioid_t __bypass_preadv(int fd, const struct iovec *iov, int count, off_t offset) { struct ioctx *ioctx; ssize_t ret; DEBUG("pread on unknown fd %d\n", fd); if (syscall(SYS_lseek, fd, offset, SEEK_SET) < 0) { DEBUG("lseek err\n"); return IOID_FAIL; } return __bypass_ireadv(fd, iov, count); } ioid_t __bypass_iwritev(int fd, const struct iovec *iov, int count) { struct ioctx *ioctx; ssize_t ret; DEBUG("iwrite on unknown fd %d\n", fd); ret = syscall(SYS_writev, fd, iov, count); if (ret >= 0) { ioctx = (struct ioctx *)malloc(sizeof(*ioctx)); if (!ioctx) { ERROR("failed to alloc ioctx\n"); return IOID_FAIL; } ioctx->ioctx_id = 0; ioctx->ioctx_cc = ret; return ioctx; } DEBUG("writev error %d, errno %d\n", ret, errno); return IOID_FAIL; } ioid_t __bypass_pwritev(int fd, const struct iovec *iov, int count, off_t offset) { struct ioctx *ioctx; ssize_t ret; DEBUG("pwrite on unknown fd %d\n", fd); if (syscall(SYS_lseek, fd, offset, SEEK_SET) < 0) { DEBUG("lseek err\n"); return IOID_FAIL; } return __bypass_iwritev(fd, iov, count); } int __bypass_fcntl(int fd, int cmd, va_list ap) { int err; long arg; DEBUG("fcntl on unknown fd %d, cmd %d\n", fd, cmd); switch (cmd) { case F_GETFD: case F_GETFL: case F_GETOWN: // case F_GETSIG: // case F_GETLEASE: return syscall(SYS_fcntl, fd, cmd); case F_DUPFD: case F_SETFD: case F_SETFL: case F_GETLK: case F_SETLK: case F_SETLKW: case F_SETOWN: // case F_SETSIG: // case F_SETLEASE: // case F_NOTIFY: arg = va_arg(ap, long); return syscall(SYS_fcntl, fd, cmd, arg); default: ERROR("uncached cmd %d\n", cmd); } return -1; } Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/Makefile.am,v retrieving revision 1.5 retrieving revision 1.5.4.1 diff -u -w -b -B -p -r1.5 -r1.5.4.1 --- Makefile.am 24 Mar 2003 22:09:06 -0000 1.5 +++ Makefile.am 19 Jun 2003 12:18:28 -0000 1.5.4.1 @@ -3,6 +3,6 @@ lib_LIBRARIES = libsysio.a libsysio_a_SOURCES = chdir.c chmod.c chown.c dev.c dup.c fcntl.c file.c fs.c \ fsync.c getdirentries.c init.c inode.c ioctl.c ioctx.c iowait.c \ lseek.c mkdir.c mknod.c mount.c namei.c open.c read.c rmdir.c stat.c \ - stat64.c statvfs.c symlink.c truncate.c unlink.c write.c + stat64.c statvfs.c symlink.c truncate.c unlink.c write.c bypass.c include $(top_srcdir)/Rules.make Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.3.2.2 retrieving revision 1.3.2.3 diff -u -w -b -B -p -r1.3.2.2 -r1.3.2.3 --- fcntl.c 17 Jun 2003 03:38:31 -0000 1.3.2.2 +++ fcntl.c 19 Jun 2003 12:18:29 -0000 1.3.2.3 @@ -51,6 +51,7 @@ #include "sysio.h" #include "inode.h" #include "file.h" +#include "bypass.h" int fcntl(int fd, int cmd, ...) @@ -62,18 +63,10 @@ fcntl(int fd, int cmd, ...) err = 0; fil = _sysio_fd_find(fd); if (!fil) { -#if 1 - /* FIXME temorary solution to get IOR2 run. cleanup this - * later */ - printf("libsysio: fcntl on unknown fd %d\n", fd); va_start(ap, cmd); - err = syscall(SYS_fcntl, fd, cmd, ap); + err = __bypass_fcntl(fd, cmd, ap); va_end(ap); return err; -#else - err = -EBADF; - goto out; -#endif } switch (cmd) { Index: iowait.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/iowait.c,v retrieving revision 1.3 retrieving revision 1.3.8.1 diff -u -w -b -B -p -r1.3 -r1.3.8.1 --- iowait.c 9 Mar 2003 06:25:45 -0000 1.3 +++ iowait.c 19 Jun 2003 12:18:29 -0000 1.3.8.1 @@ -90,9 +90,18 @@ iowait(ioid_t ioid) struct ioctx *ioctx; ssize_t cc; + /* check if it's a bypassed ioctx */ + ioctx = (struct ioctx *)ioid; + if (ioctx->ioctx_id == 0) { + cc = ioctx->ioctx_cc; + free(ioctx); + return cc; + } + ioctx = lookup_ioid(ioid); - if (!ioctx) + if (!ioctx) { return -1; + } cc = _sysio_ioctx_wait(ioctx); if (cc < 0) { Index: read.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/read.c,v retrieving revision 1.2.8.1 retrieving revision 1.2.8.2 diff -u -w -b -B -p -r1.2.8.1 -r1.2.8.2 --- read.c 17 Jun 2003 03:38:31 -0000 1.2.8.1 +++ read.c 19 Jun 2003 12:18:29 -0000 1.2.8.2 @@ -53,6 +53,7 @@ #include "sysio.h" #include "file.h" #include "inode.h" +#include "bypass.h" /* * Schedule asynchronous read of iovec at some file extent. @@ -100,12 +101,11 @@ ipreadv(int fd, const struct iovec *iov, { struct file *fil; struct ioctx *ioctxp; + int i; fil = _sysio_fd_find(fd); - if (!fil) { - errno = -EBADF; - return IOID_FAIL; - } + if (!fil) + return __bypass_preadv(fd, iov, count, offset); ioctxp = do_ipreadv(fil, iov, count, offset); return ioctxp ? ioctxp->ioctx_id : IOID_FAIL; @@ -164,21 +164,8 @@ ireadv(int fd, const struct iovec *iov, struct ioctx *ioctxp; fil = _sysio_fd_find(fd); - if (!fil) { -#if 1 - /* XXX for MPI */ - printf("libsysio: read on unknown fd %d\n", fd); - if (syscall(SYS_readv, fd, iov, count) < 0) - return IOID_FAIL; - else { - /* XXX */ - return (ioid_t)IOID_NATIVE_DIRECT; - } -#else - errno = -EBADF; - return IOID_FAIL; -#endif - } + if (!fil) + return __bypass_ireadv(fd, iov, count); ioctxp = do_ipreadv(fil, iov, count, fil->f_pos); if (!ioctxp) @@ -208,14 +195,6 @@ readv(int fd, const struct iovec *iov, i ioid = ireadv(fd, iov, count); if (ioid == IOID_FAIL) return -1; - /* XXX for MPI. suppose we'v got all the data we want */ - if (ioid == (ioid_t)IOID_NATIVE_DIRECT) { - ssize_t ret = 0; - int i; - for (i=0; i<count; i++) - ret += iov[i].iov_len; - return ret; - } return iowait(ioid); } @@ -227,9 +206,6 @@ read(int fd, void *buf, size_t count) ioid = iread(fd, buf, count); if (ioid == IOID_FAIL) return -1; - /* XXX for MPI. suppose we'v got all the data we want */ - if (ioid == (ioid_t)IOID_NATIVE_DIRECT) - return count; return iowait(ioid); } Index: write.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/write.c,v retrieving revision 1.2.10.1 retrieving revision 1.2.10.2 diff -u -w -b -B -p -r1.2.10.1 -r1.2.10.2 --- write.c 17 Jun 2003 03:38:31 -0000 1.2.10.1 +++ write.c 19 Jun 2003 12:18:29 -0000 1.2.10.2 @@ -55,6 +55,7 @@ #include "inode.h" #include "fs.h" #include "mount.h" +#include "bypass.h" /* * Schedule asynchronous write of iovec at some file extent. @@ -108,10 +109,8 @@ ipwritev(int fd, const struct iovec *iov struct ioctx *ioctxp; fil = _sysio_fd_find(fd); - if (!fil) { - errno = -EBADF; - return IOID_FAIL; - } + if (!fil) + return __bypass_pwritev(fd, iov, count, offset); ioctxp = do_ipwritev(fil, iov, count, offset); return ioctxp ? ioctxp->ioctx_id : IOID_FAIL; @@ -170,21 +168,8 @@ iwritev(int fd, const struct iovec *iov, struct ioctx *ioctxp; fil = _sysio_fd_find(fd); - if (!fil) { -#if 1 - /* XXX for MPI */ - printf("libsysio: write on unknown fd %d\n", fd); - if (syscall(SYS_writev, fd, iov, count) < 0) - return IOID_FAIL; - else { - /* XXX */ - return (ioid_t)IOID_NATIVE_DIRECT; - } -#else - errno = -EBADF; - return IOID_FAIL; -#endif - } + if (!fil) + return __bypass_iwritev(fd, iov, count); ioctxp = do_ipwritev(fil, iov, count, fil->f_pos); if (!ioctxp) @@ -214,14 +199,6 @@ writev(int fd, const struct iovec *iov, ioid = iwritev(fd, iov, count); if (ioid == IOID_FAIL) return -1; - /* XXX for MPI. suppose all data we want has been written out */ - if (ioid == (ioid_t)IOID_NATIVE_DIRECT) { - ssize_t ret = 0; - int i; - for (i=0; i<count; i++) - ret += iov[i].iov_len; - return ret; - } return iowait(ioid); } @@ -233,9 +210,6 @@ write(int fd, const void *buf, size_t co ioid = iwrite(fd, buf, count); if (ioid == IOID_FAIL) return -1; - /* XXX for MPI. suppose all data we want has been written out */ - if (ioid == (ioid_t)IOID_NATIVE_DIRECT) - return count; return iowait(ioid); } |
From: Mei <me...@us...> - 2003-06-17 05:47:00
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv1751 Modified Files: Tag: b_lustre chdir.c Log Message: getcwd might return trash buffers since the pnode name length could be 0, fixed by moving buf pointer 1 bytes backwards at any cases. Index: chdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chdir.c,v retrieving revision 1.3 retrieving revision 1.3.8.1 diff -u -w -b -B -p -r1.3 -r1.3.8.1 --- chdir.c 9 Mar 2003 16:57:47 -0000 1.3 +++ chdir.c 17 Jun 2003 05:46:57 -0000 1.3.8.1 @@ -226,11 +226,10 @@ _sysio_p_path(struct pnode *pno, char ** * Add component and separator. */ cp -= pno->p_base->pb_name.len; - if (pno->p_base->pb_name.len) - (void )memcpy(cp--, - pno->p_base->pb_name.name, + (void )memcpy(cp, pno->p_base->pb_name.name, pno->p_base->pb_name.len); - *cp = PATH_SEPARATOR; + + *--cp = PATH_SEPARATOR; pno = pno->p_parent; } while (pno != pno->p_parent); |
From: Mei <me...@us...> - 2003-06-17 03:38:34
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv21111 Modified Files: Tag: b_lustre chmod.c fcntl.c inode.c read.c write.c Log Message: some ugly workaround in order to make it run with liblustre intent handling and MPI. Index: chmod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chmod.c,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -u -w -b -B -p -r1.3 -r1.3.4.1 --- chmod.c 24 Mar 2003 22:09:06 -0000 1.3 +++ chmod.c 17 Jun 2003 03:38:31 -0000 1.3.4.1 @@ -55,14 +55,12 @@ int chmod(const char *path, mode_t mode) { - struct intent intent; int err; struct pnode *pno; struct intnl_stat stbuf; unsigned mask; - 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; (void )memset(&stbuf, 0, sizeof(struct intnl_stat)); Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -u -w -b -B -p -r1.3.2.1 -r1.3.2.2 --- fcntl.c 30 Apr 2003 14:38:11 -0000 1.3.2.1 +++ fcntl.c 17 Jun 2003 03:38:31 -0000 1.3.2.2 @@ -62,13 +62,15 @@ fcntl(int fd, int cmd, ...) err = 0; fil = _sysio_fd_find(fd); if (!fil) { +#if 1 /* FIXME temorary solution to get IOR2 run. cleanup this * later */ + printf("libsysio: fcntl on unknown fd %d\n", fd); va_start(ap, cmd); err = syscall(SYS_fcntl, fd, cmd, ap); va_end(ap); return err; -#if 0 +#else err = -EBADF; goto out; #endif Index: inode.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/inode.c,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -u -w -b -B -p -r1.7 -r1.7.2.1 --- inode.c 23 Apr 2003 19:45:52 -0000 1.7 +++ inode.c 17 Jun 2003 03:38:31 -0000 1.7.2.1 @@ -263,8 +263,14 @@ void _sysio_i_gone(struct inode *ino) { +#if 0 if (ino->i_ref) abort(); +#else + if (ino->i_ref) + printf("_sysio_i_gone: inode(%lu, 0%o) still have ref %d\n", + ino->i_num, ino->i_mode, ino->i_ref); +#endif LIST_REMOVE(ino, i_link); TAILQ_REMOVE(&_sysio_inodes, ino, i_nodes); (*ino->i_ops.inop_gone)(ino); Index: read.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/read.c,v retrieving revision 1.2 retrieving revision 1.2.8.1 diff -u -w -b -B -p -r1.2 -r1.2.8.1 --- read.c 9 Mar 2003 06:36:37 -0000 1.2 +++ read.c 17 Jun 2003 03:38:31 -0000 1.2.8.1 @@ -48,6 +48,7 @@ #include <fcntl.h> #include <sys/uio.h> #include <sys/queue.h> +#include <syscall.h> #include "sysio.h" #include "file.h" @@ -164,8 +165,19 @@ ireadv(int fd, const struct iovec *iov, fil = _sysio_fd_find(fd); if (!fil) { +#if 1 + /* XXX for MPI */ + printf("libsysio: read on unknown fd %d\n", fd); + if (syscall(SYS_readv, fd, iov, count) < 0) + return IOID_FAIL; + else { + /* XXX */ + return (ioid_t)IOID_NATIVE_DIRECT; + } +#else errno = -EBADF; return IOID_FAIL; +#endif } ioctxp = do_ipreadv(fil, iov, count, fil->f_pos); @@ -196,6 +208,14 @@ readv(int fd, const struct iovec *iov, i ioid = ireadv(fd, iov, count); if (ioid == IOID_FAIL) return -1; + /* XXX for MPI. suppose we'v got all the data we want */ + if (ioid == (ioid_t)IOID_NATIVE_DIRECT) { + ssize_t ret = 0; + int i; + for (i=0; i<count; i++) + ret += iov[i].iov_len; + return ret; + } return iowait(ioid); } @@ -207,6 +227,9 @@ read(int fd, void *buf, size_t count) ioid = iread(fd, buf, count); if (ioid == IOID_FAIL) return -1; + /* XXX for MPI. suppose we'v got all the data we want */ + if (ioid == (ioid_t)IOID_NATIVE_DIRECT) + return count; return iowait(ioid); } Index: write.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/write.c,v retrieving revision 1.2 retrieving revision 1.2.10.1 diff -u -w -b -B -p -r1.2 -r1.2.10.1 --- write.c 7 Mar 2003 03:31:36 -0000 1.2 +++ write.c 17 Jun 2003 03:38:31 -0000 1.2.10.1 @@ -48,6 +48,7 @@ #include <fcntl.h> #include <sys/uio.h> #include <sys/queue.h> +#include <syscall.h> #include "sysio.h" #include "file.h" @@ -170,8 +171,19 @@ iwritev(int fd, const struct iovec *iov, fil = _sysio_fd_find(fd); if (!fil) { +#if 1 + /* XXX for MPI */ + printf("libsysio: write on unknown fd %d\n", fd); + if (syscall(SYS_writev, fd, iov, count) < 0) + return IOID_FAIL; + else { + /* XXX */ + return (ioid_t)IOID_NATIVE_DIRECT; + } +#else errno = -EBADF; return IOID_FAIL; +#endif } ioctxp = do_ipwritev(fil, iov, count, fil->f_pos); @@ -202,6 +214,14 @@ writev(int fd, const struct iovec *iov, ioid = iwritev(fd, iov, count); if (ioid == IOID_FAIL) return -1; + /* XXX for MPI. suppose all data we want has been written out */ + if (ioid == (ioid_t)IOID_NATIVE_DIRECT) { + ssize_t ret = 0; + int i; + for (i=0; i<count; i++) + ret += iov[i].iov_len; + return ret; + } return iowait(ioid); } @@ -213,6 +233,9 @@ write(int fd, const void *buf, size_t co ioid = iwrite(fd, buf, count); if (ioid == IOID_FAIL) return -1; + /* XXX for MPI. suppose all data we want has been written out */ + if (ioid == (ioid_t)IOID_NATIVE_DIRECT) + return count; return iowait(ioid); } |
From: Ruth K. <rk...@us...> - 2003-06-13 01:02:25
|
Update of /cvsroot/libsysio/libsysio In directory sc8-pr-cvs1:/tmp/cvs-serv4991 Modified Files: Tag: cplant configure.in Log Message: alternate build for tests on cplant platform Index: configure.in =================================================================== RCS file: /cvsroot/libsysio/libsysio/configure.in,v retrieving revision 1.5.2.3 retrieving revision 1.5.2.4 diff -u -w -b -B -p -r1.5.2.3 -r1.5.2.4 --- configure.in 1 May 2003 22:46:09 -0000 1.5.2.3 +++ configure.in 13 Jun 2003 01:02:22 -0000 1.5.2.4 @@ -79,6 +79,25 @@ AC_ARG_WITH(cplant_yod, [with_cplant_yod=no]) AM_CONDITIONAL(WITH_CPLANT_YOD, test x$with_cplant_yod = xyes) +AC_ARG_WITH(cplant_tests, + [ --with-cplant-tests=[cplant build path] build libsysio tests for cplant platform], + [ case "${withval}" in + yes) AC_MSG_ERROR(need path to compiler for --with-cplant-tests);; + no) with_cplant_tests=no;; + *) CPLANT_PATH=${withval} + CC=${CPLANT_PATH}/bin/cc + CCDEPMODE=${CC} + CPP="${CC} -E" + AC_CHECK_FILE(${CC}, + [ if test x${with_cplant_yod} != xyes; then + with_cplant_yod=yes + AM_CONDITIONAL(WITH_CPLANT_YOD, test x$with_cplant_yod = xyes) + fi], + [ AC_MSG_ERROR(path not found ${CC} for --with-cplant-tests) ]);; + esac], + [with_cplant_tests=no]) +AM_CONDITIONAL(WITH_CPLANT_TESTS, test x$with_cplant_tests != xno) + # We keep the original values in `$config_*' and never modify them, so we # can write them unchanged into config.make. Everything else uses # $machine, $vendor, and $os, and changes them whenever convenient. |
From: Ruth K. <rk...@us...> - 2003-06-13 00:01:24
|
Update of /cvsroot/libsysio/libsysio In directory sc8-pr-cvs1:/tmp/cvs-serv17157 Modified Files: Tag: cplant Makefile.am Log Message: skip test dir if configuring libs with cplant yod Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/Makefile.am,v retrieving revision 1.7.2.1 retrieving revision 1.7.2.2 diff -u -w -b -B -p -r1.7.2.1 -r1.7.2.2 --- Makefile.am 28 Apr 2003 20:17:19 -0000 1.7.2.1 +++ Makefile.am 13 Jun 2003 00:01:10 -0000 1.7.2.2 @@ -1,15 +1,19 @@ if WITH_TESTS -if WITH_CPLANT_YOD -TESTS = -else TESTS = tests -endif else TESTS = endif +if WITH_CPLANT_TESTS +SUBDIRS = $(TESTS) +else +if WITH_CPLANT_YOD +SUBDIRS = src drivers dev +else SUBDIRS = src drivers dev $(TESTS) +endif +endif EXTRA_DIST = Rules.make \ include/dev.h include/file.h include/fs.h include/inode.h \ |
From: Ruth K. <rk...@us...> - 2003-06-12 23:58:47
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1:/tmp/cvs-serv16317 Modified Files: Tag: cplant cplant-yod.h Log Message: no portals include - specify these here Index: cplant-yod.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/Attic/cplant-yod.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -w -b -B -p -r1.1.2.1 -r1.1.2.2 --- cplant-yod.h 1 May 2003 22:53:52 -0000 1.1.2.1 +++ cplant-yod.h 12 Jun 2003 23:58:44 -0000 1.1.2.2 @@ -44,25 +44,23 @@ /* * cplant yod I/O functions */ - -int chmod_yod(const char* path, mode_t); -int chown_yod(const char* path, uid_t, gid_t); -int stat_yod(const char *path, struct stat *sbuf); -int fstat_yod(int fd, struct stat *buf); -int statfs_yod(const char *path, struct statfs *sbuf); -int fstatfs_yod(int fd, struct statfs *buf); -int mkdir_yod(const char *path, mode_t mode); -int rmdir_yod(const char *path); -int getdirentries_yod(int fd, char *buf, size_t nbytes, loff_t *basep); -int link_yod(const char *path1, const char *path2); -int unlink_yod(const char *path); -int symlink_yod(const char *path1, const char *path2 ); - -int open_yod(const char *fname, int flags, mode_t mode); -int close_yod(int); -ssize_t write_yod(int fd, const void *buff, size_t nbytes); -ssize_t read_yod(int fd, void *buff, size_t nbytes); -int fsync_yod(int fd); -int truncate_yod(const char *path, off_t length); -int ftruncate_yod(int fd, long length); -off_t lseek_yod(int fd, off_t offset, int whence); +extern int chmod_yod(const char* path, mode_t); +extern int chown_yod(const char* path, uid_t, gid_t); +extern int stat_yod(const char *path, struct stat *sbuf); +extern int fstat_yod(int fd, struct stat *buf); +extern int statfs_yod(const char *path, struct statfs *sbuf); +extern int fstatfs_yod(int fd, struct statfs *buf); +extern int mkdir_yod(const char *path, mode_t mode); +extern int rmdir_yod(const char *path); +extern int getdirentries_yod(int fd, char *buf, size_t nbytes, loff_t *basep); +extern int link_yod(const char *path1, const char *path2); +extern int unlink_yod(const char *path); +extern int symlink_yod(const char *path1, const char *path2 ); +extern int open_yod(const char *fname, int flags, mode_t mode); +extern int close_yod(int); +extern ssize_t write_yod(int fd, const void *buff, size_t nbytes); +extern ssize_t read_yod(int fd, void *buff, size_t nbytes); +extern int fsync_yod(int fd); +extern int truncate_yod(const char *path, off_t length); +extern int ftruncate_yod(int fd, long length); +extern off_t lseek_yod(int fd, off_t offset, int whence); |
From: Ruth K. <rk...@us...> - 2003-06-12 23:54:59
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv15195 Modified Files: Tag: cplant chdir.c fcntl.c ioctl.c lseek.c open.c read.c write.c Log Message: extra wrappers for glibc on alpha Index: chdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chdir.c,v retrieving revision 1.3 retrieving revision 1.3.6.1 diff -u -w -b -B -p -r1.3 -r1.3.6.1 --- chdir.c 9 Mar 2003 16:57:47 -0000 1.3 +++ chdir.c 12 Jun 2003 23:54:54 -0000 1.3.6.1 @@ -249,3 +249,12 @@ getcwd(char *buf, size_t size) } return buf; } + +#if defined(__GLIBC__) && defined(ALPHA_LINUX) +char * +__getcwd(char *buf, size_t size) +{ + return getcwd(buf, size); +} +#endif + Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.2.6.1 retrieving revision 1.2.6.2 diff -u -w -b -B -p -r1.2.6.1 -r1.2.6.2 --- fcntl.c 28 Apr 2003 20:55:54 -0000 1.2.6.1 +++ fcntl.c 12 Jun 2003 23:54:54 -0000 1.2.6.2 @@ -95,3 +95,18 @@ out: } return err; } + +#if defined(__GLIBC__) && defined(ALPHA_LINUX) +int +__fcntl(int fd, int cmd, ...) +{ + int rc; + va_list ap; + + va_start(ap, cmd); + rc = fcntl(fd, cmd, ap); + va_end(ap); + + return rc; +} +#endif Index: ioctl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/ioctl.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.10.1 diff -u -w -b -B -p -r1.1.1.1 -r1.1.1.1.10.1 --- ioctl.c 22 Feb 2003 16:33:07 -0000 1.1.1.1 +++ ioctl.c 12 Jun 2003 23:54:54 -0000 1.1.1.1.10.1 @@ -75,3 +75,19 @@ out: } return err; } + + +#if defined(__GLIBC__) && defined(ALPHA_LINUX) +int +__ioctl(int fd, unsigned long request, ...) +{ + va_list ap; + int rc; + + va_start(ap, request); + rc = ioctl(fd, request, ap); + va_end(ap); + + return rc; +} +#endif Index: lseek.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/lseek.c,v retrieving revision 1.3.6.1 retrieving revision 1.3.6.2 diff -u -w -b -B -p -r1.3.6.1 -r1.3.6.2 --- lseek.c 28 Apr 2003 18:20:03 -0000 1.3.6.1 +++ lseek.c 12 Jun 2003 23:54:54 -0000 1.3.6.2 @@ -113,3 +113,31 @@ lseek(int fd, off_t offset, int whence) return (off_t )_sysio_lseek(fd, offset, whence); } + +#if defined(__GLIBC__) && defined(ALPHA_LINUX) + +off_t +__lseek(int fd, off_t offset, int whence) +{ + return lseek(fd, offset, whence); +} + +loff_t +__lseek64( int fd, loff_t offset, int whence) +{ + return lseek( fd, offset, whence ); +} + +loff_t +__llseek( int fd, loff_t offset, int whence) +{ + return __lseek64(fd, offset, whence); +} + +loff_t +__llseek64( int fd, loff_t offset, int whence) +{ + return __lseek64(fd, offset, whence); +} + +#endif Index: open.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/open.c,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.2 diff -u -w -b -B -p -r1.6.2.1 -r1.6.2.2 --- open.c 28 Apr 2003 18:19:58 -0000 1.6.2.1 +++ open.c 12 Jun 2003 23:54:54 -0000 1.6.2.2 @@ -49,6 +49,7 @@ #include <sys/stat.h> #include <fcntl.h> #include <sys/queue.h> +#include <features.h> #include "sysio.h" #include "inode.h" @@ -56,6 +57,13 @@ #include "fs.h" #include "mount.h" +#ifdef __GLIBC__ +#undef open +#undef __open +#undef open64 +#undef __open64 +#endif + /* * Open file support. */ @@ -225,3 +233,49 @@ umask(mode_t mask) _sysio_umask = mask & 0777; return omask; } + +#if defined(__GLIBC__) && defined(ALPHA_LINUX) +int +open64(const char *fname, int flags, ...) +{ + va_list ap; + mode_t mode; + + va_start(ap, flags); + mode = va_arg(ap, mode_t); + va_end(ap); + + return open(fname, flags, mode); +} + +int +__open64(const char *fname, int flags, ...) +{ + va_list ap; + mode_t mode; + + va_start(ap, flags); + mode = va_arg(ap, mode_t); + va_end(ap); + + return open(fname, flags, mode); +} +int +__open(const char *fname, int flags, ...) +{ + va_list ap; + mode_t mode; + + va_start(ap, flags); + mode = va_arg(ap, mode_t); + va_end(ap); + + return open(fname, flags, mode); +} + +int +__close(int fd) { + + return close(fd); +} +#endif Index: read.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/read.c,v retrieving revision 1.2 retrieving revision 1.2.6.1 diff -u -w -b -B -p -r1.2 -r1.2.6.1 --- read.c 9 Mar 2003 06:36:37 -0000 1.2 +++ read.c 12 Jun 2003 23:54:54 -0000 1.2.6.1 @@ -224,3 +224,11 @@ read_list(int fd, return -1; } #endif + +#if defined(__GLIBC__) && defined(ALPHA_LINUX) +ssize_t +__read(int fd, void *buf, size_t count) +{ + return read(fd, buf, count); +} +#endif Index: write.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/write.c,v retrieving revision 1.2.8.2 retrieving revision 1.2.8.3 diff -u -w -b -B -p -r1.2.8.2 -r1.2.8.3 --- write.c 29 Apr 2003 18:52:33 -0000 1.2.8.2 +++ write.c 12 Jun 2003 23:54:54 -0000 1.2.8.3 @@ -231,11 +231,17 @@ write_list(int fd, } #endif -#if defined(ALPHA_LINUX) && defined(__GLIBC__) +#if defined(__GLIBC__) && defined(ALPHA_LINUX) ssize_t __write(int fd, const void *buf, size_t count) { return write(fd, buf, count); +} + +ssize_t +__writev(int fd, const struct iovec *iov, int count) +{ + return writev(fd, iov, count); } #endif |
From: Ruth K. <rk...@us...> - 2003-06-12 23:48:56
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv13130 Modified Files: Tag: cplant namei.c Log Message: merged from head Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -u -w -b -B -p -r1.5 -r1.5.2.1 --- namei.c 24 Mar 2003 22:09:06 -0000 1.5 +++ namei.c 12 Jun 2003 23:48:48 -0000 1.5.2.1 @@ -293,8 +293,7 @@ _sysio_path_walk(struct pnode *parent, s * Must send the intent-path again. */ path = nd->nd_path; - } else if (err == -ENOENT) - err = 0; + } if (!err) { P_RELE(pno); nd->nd_amcnt++; |
From: Ruth K. <rk...@us...> - 2003-06-12 23:47:08
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1:/tmp/cvs-serv12349 Modified Files: Tag: cplant fs_native.c Log Message: typo Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.8.2.3 retrieving revision 1.8.2.4 diff -u -w -b -B -p -r1.8.2.3 -r1.8.2.4 --- fs_native.c 12 Jun 2003 23:35:24 -0000 1.8.2.3 +++ fs_native.c 12 Jun 2003 23:47:04 -0000 1.8.2.4 @@ -127,7 +127,7 @@ do { #define COPY_STAT(src, dest) *(dest) = *(src) #define CALL_LSEEK(fd, off, rc, wh) \ - (syscall(SYS_lseek, fd, off, &result, wh)) + (syscall(SYS_lseek, fd, off, &rc, wh)) #endif |
From: Ruth K. <rk...@us...> - 2003-06-12 23:40:31
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1:/tmp/cvs-serv9843 Modified Files: Tag: cplant Makefile.am Log Message: portals include not needed Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/Makefile.am,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -w -b -B -p -r1.2.2.1 -r1.2.2.2 --- Makefile.am 28 Apr 2003 20:18:53 -0000 1.2.2.1 +++ Makefile.am 12 Jun 2003 23:40:28 -0000 1.2.2.2 @@ -7,7 +7,7 @@ libsysio_stdfd_a_SOURCES = stdfd.c include $(top_srcdir)/Rules.make if WITH_CPLANT_YOD -YOD_DRIVER_FLAGS = -DCPLANT_YOD $(PORTALS_INCLUDE) $(YOD_DRIVER_INCLUDE) +YOD_DRIVER_FLAGS = -DCPLANT_YOD $(YOD_DRIVER_INCLUDE) else YOD_DRIVER_FLAGS = endif |
From: Ruth K. <rk...@us...> - 2003-06-12 23:35:26
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1:/tmp/cvs-serv7886 Modified Files: Tag: cplant fs_native.c Log Message: SYS_lseek has a different interface on alpha Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.8.2.2 retrieving revision 1.8.2.3 diff -u -w -b -B -p -r1.8.2.2 -r1.8.2.3 --- fs_native.c 12 Jun 2003 19:59:49 -0000 1.8.2.2 +++ fs_native.c 12 Jun 2003 23:35:24 -0000 1.8.2.3 @@ -116,9 +116,19 @@ do { (dest)->st_gen = (src)->st_gen; \ } while (0); +/* SYS_lseek has a different interface on alpha + */ +#define CALL_LSEEK(fd, off, rc, wh) \ + (rc = syscall(SYS_lseek, fd, off, wh)) + #else + #define __native_stat intnl_stat #define COPY_STAT(src, dest) *(dest) = *(src) + +#define CALL_LSEEK(fd, off, rc, wh) \ + (syscall(SYS_lseek, fd, off, &result, wh)) + #endif #if defined(USE_NATIVE_STAT) @@ -790,10 +800,9 @@ native_getdirentries(struct inode *ino, result = *basep; if (*basep != nino->ni_fpos && - syscall(SYS_lseek, - nino->ni_fd, + CALL_LSEEK(nino->ni_fd, *basep, - &result, + result, SEEK_SET) == -1) return -errno; nino->ni_fpos = result; @@ -1035,10 +1044,9 @@ doio(ssize_t (*f)(int, const struct iove !(S_ISCHR(ino->i_mode) || S_ISSOCK(ino->i_mode) || S_ISFIFO(ino->i_mode)) && - syscall(SYS_lseek, - nino->ni_fd, + CALL_LSEEK(nino->ni_fd, ioctx->ioctx_offset, - &result, + result, SEEK_SET) == -1) { ioctx->ioctx_cc = -1; ioctx->ioctx_errno = errno; |
From: Ruth K. <rk...@us...> - 2003-06-12 19:59:55
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1:/tmp/cvs-serv7577 Modified Files: Tag: cplant fs_native.c Log Message: do stat struct copy for fstat too Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.8.2.1 retrieving revision 1.8.2.2 diff -u -w -b -B -p -r1.8.2.1 -r1.8.2.2 --- fs_native.c 28 Apr 2003 20:41:34 -0000 1.8.2.1 +++ fs_native.c 12 Jun 2003 19:59:49 -0000 1.8.2.2 @@ -290,10 +290,12 @@ static int native_fstat(int fd, struct intnl_stat *buf) { int err; + struct __native_stat stbuf; - err = syscall(__SYS_FSTAT, fd, buf); + err = syscall(__SYS_FSTAT, fd, &stbuf); if (err) err = -errno; + COPY_STAT(&stbuf, buf); return err; } |
From: Ruth K. <rk...@us...> - 2003-06-12 19:48:44
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1:/tmp/cvs-serv1643 Modified Files: Tag: cplant fs_yod.c Log Message: cplant yod has no utime fn; write/read mods/fixes Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/Attic/fs_yod.c,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -w -b -B -p -r1.1.2.4 -r1.1.2.5 --- fs_yod.c 1 May 2003 22:52:46 -0000 1.1.2.4 +++ fs_yod.c 12 Jun 2003 19:48:37 -0000 1.1.2.5 @@ -650,24 +650,7 @@ yod_inop_setattr(struct pnode *pno, } if (err) mask &= ~SETATTR_MODE; -#if 0 - else if (mask & (SETATTR_MTIME|SETATTR_ATIME)) { - struct utimbuf ut; - /* - * Alter access and/or modify time attributes. - */ - ut.actime = st.st_atime; - ut.modtime = st.st_mtime; - if (mask & SETATTR_MTIME) - ut.modtime = stbuf->st_mtime; - if (mask & SETATTR_ATIME) - ut.actime = stbuf->st_atime; - err = utime_yod(path, &ut); - } - if (err) - mask &= ~(SETATTR_MTIME|SETATTR_ATIME); - else -#endif + if (mask & (SETATTR_UID|SETATTR_GID)) { /* @@ -1000,16 +983,11 @@ doio(ssize_t (*f)(int, const struct iove * Helper function passed to doio(), above, to accomplish a real readv. */ static ssize_t -_readv(int fd, const struct iovec *vector, int count) +_readv(int fd, const struct iovec *vector, int count __IS_UNUSED) { - int i; - ssize_t total; - - for (i = 0; i < count; i++) - total += read_yod(fd, - vector[i].iov_base, - vector[i].iov_len); - return total; + return read_yod(fd, + vector[0].iov_base, + vector[0].iov_len); } static int @@ -1028,7 +1006,7 @@ static ssize_t _writev(int fd, const struct iovec *vector, int count) { int i; - ssize_t total; + ssize_t total = 0; for (i = 0; i < count; i++) total += write_yod(fd, |
From: Ruth K. <rk...@us...> - 2003-06-12 19:41:22
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1:/tmp/cvs-serv30304 Modified Files: Tag: cplant Makefile.am test_copy.c test_getcwd.c test_list.c test_mounts.c test_path.c test_stats.c test_stdfd.c Log Message: mods for running tests under cplant yod Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Makefile.am,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -u -w -b -B -p -r1.8 -r1.8.2.1 --- Makefile.am 24 Mar 2003 22:09:49 -0000 1.8 +++ Makefile.am 12 Jun 2003 19:41:09 -0000 1.8.2.1 @@ -33,7 +33,15 @@ STDFD_DEV_CFLAGS= STDFD_DEV_LIB= endif -DRIVERS=$(NATIVE_DRIVER_NAME) $(INCORE_DRIVER_NAME) $(STFD_DEV_NAME) +if WITH_CPLANT_YOD +YOD_DRIVER_NAME=yod +YOD_DRIVER_CFLAGS= -DCPLANT_YOD +else +YOD_DRIVER_NAME= +YOD_DRIVER_CFLAGS= +endif + +DRIVERS=$(NATIVE_DRIVER_NAME) $(INCORE_DRIVER_NAME) $(YOD_DRIVER_NAME) $(STFD_DEV_NAME) CMNSRC=drv_init_all.c drv_data.c @@ -41,10 +49,10 @@ BUILT_SOURCES=drv_data.c CFL=$(AM_CFLAGS) $(AM_CPPFLAGS) \ $(NATIVE_DRIVER_CFLAGS) $(INCORE_DRIVER_CFLAGS) \ - $(STDFD_DEV_CFLAGS) + $(STDFD_DEV_CFLAGS) $(YOD_DRIVER_CFLAGS) LIBS=$(NATIVE_DRIVER_LIB) $(INCORE_DRIVER_LIB) \ - $(STDFD_DEV_LIB) \ + $(STDFD_DEV_LIB) $(YOD_DRIVER_LIB) \ $(top_builddir)/src/libsysio.a test_copy_SOURCES=test_copy.c $(CMNSRC) Index: test_copy.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_copy.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_copy.c 24 Mar 2003 22:09:49 -0000 1.5 +++ test_copy.c 12 Jun 2003 19:41:10 -0000 1.5.2.1 @@ -110,6 +110,7 @@ main(int argc, char * const argv[]) if (!(argc - optind)) usage(); +#ifndef CPLANT_YOD if (_sysio_init() != 0) { perror("init sysio"); exit(1); @@ -125,7 +127,7 @@ main(int argc, char * const argv[]) perror(root_driver); exit(1); } - +#endif (void )umask(022); /* @@ -143,7 +145,9 @@ main(int argc, char * const argv[]) err = copy_file(spath, dpath); +#ifndef CPLANT_YOD _sysio_shutdown(); +#endif return err; } Index: test_getcwd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_getcwd.c,v retrieving revision 1.1 retrieving revision 1.1.6.1 diff -u -w -b -B -p -r1.1 -r1.1.6.1 --- test_getcwd.c 9 Mar 2003 16:58:41 -0000 1.1 +++ test_getcwd.c 12 Jun 2003 19:41:10 -0000 1.1.6.1 @@ -108,7 +108,7 @@ main(int argc, char *const argv[]) default: usage(); } - +#ifndef CPLANT_YOD /* * Init sysio lib. */ @@ -130,6 +130,7 @@ main(int argc, char *const argv[]) perror("_sysio_mount_root"); exit(1); } +#endif n = argc - optind; @@ -165,10 +166,12 @@ main(int argc, char *const argv[]) } } +#ifndef CPLANT_YOD /* * Clean up. */ _sysio_shutdown(); +#endif return 0; } Index: test_list.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_list.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_list.c 24 Mar 2003 22:09:49 -0000 1.4 +++ test_list.c 12 Jun 2003 19:41:11 -0000 1.4.2.1 @@ -109,6 +109,7 @@ main(int argc, char *const argv[]) usage(); } +#ifndef CPLANT_YOD /* * Init sysio lib. */ @@ -130,7 +131,7 @@ main(int argc, char *const argv[]) perror("_sysio_mount_root"); exit(1); } - +#endif n = argc - optind; /* @@ -165,10 +166,12 @@ main(int argc, char *const argv[]) } } +#ifndef CPLANT_YOD /* * Clean up. */ _sysio_shutdown(); +#endif return 0; } Index: test_mounts.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_mounts.c,v retrieving revision 1.3 retrieving revision 1.3.6.1 diff -u -w -b -B -p -r1.3 -r1.3.6.1 --- test_mounts.c 9 Mar 2003 16:57:47 -0000 1.3 +++ test_mounts.c 12 Jun 2003 19:41:11 -0000 1.3.6.1 @@ -103,6 +103,7 @@ main(int argc, char *const argv[]) usage(); } +#ifndef CPLANT_YOD /* * Init sysio lib. */ @@ -124,7 +125,7 @@ main(int argc, char *const argv[]) perror("_sysio_mount_root"); exit(1); } - +#endif n = argc - optind; @@ -160,10 +161,12 @@ main(int argc, char *const argv[]) } } +#ifndef CPLANT_YOD /* * Clean up. */ _sysio_shutdown(); +#endif return 0; } @@ -429,7 +432,7 @@ mountit(const char *arg) /* * Eat leading white. */ - while (*s && *s == ' ' && *s == '\t') + while (*s && *s == ' ' || *s == '\t') s++; /* * Get opts. @@ -438,7 +441,7 @@ mountit(const char *arg) while (*cp && *cp != ' ' && *cp != '\t') cp++; if (opts == cp) { - (void )fprintf(stderr, "%s: Missing target\n", arg); + (void )fprintf(stderr, "%s: Missing opts\n", arg); err = -1; goto out; } @@ -449,7 +452,7 @@ mountit(const char *arg) /* * Eat leading white. */ - while (*s && *s == ' ' && *s == '\t') + while (*s && *s == ' ' || *s == '\t') s++; /* * Get target @@ -464,6 +467,9 @@ mountit(const char *arg) if (*cp) *cp++ = '\0'; + err = mkdir(target, "0777"); + if (err) + perror(target); err = mount(source, target, fstype, 0, opts); if (err) perror(arg); Index: test_path.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_path.c,v retrieving revision 1.3 retrieving revision 1.3.6.1 diff -u -w -b -B -p -r1.3 -r1.3.6.1 --- test_path.c 9 Mar 2003 16:57:47 -0000 1.3 +++ test_path.c 12 Jun 2003 19:41:11 -0000 1.3.6.1 @@ -109,6 +109,7 @@ main(int argc, char *const argv[]) usage(); } +#ifndef CPLANT_YOD /* * Init sysio lib. */ @@ -130,7 +131,7 @@ main(int argc, char *const argv[]) perror("_sysio_mount_root"); exit(1); } - +#endif n = argc - optind; @@ -166,10 +167,12 @@ main(int argc, char *const argv[]) } } +#ifndef CPLANT_YOD /* * Clean up. */ _sysio_shutdown(); +#endif return 0; } Index: test_stats.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_stats.c,v retrieving revision 1.3 retrieving revision 1.3.6.1 diff -u -w -b -B -p -r1.3 -r1.3.6.1 --- test_stats.c 9 Mar 2003 16:57:47 -0000 1.3 +++ test_stats.c 12 Jun 2003 19:41:11 -0000 1.3.6.1 @@ -99,6 +99,7 @@ main(int argc, char * const argv[]) usage(); } +#ifndef CPLANT_YOD if (_sysio_init() != 0) { perror("init sysio"); exit(1); @@ -114,16 +115,18 @@ main(int argc, char * const argv[]) perror(root_driver); exit(1); } - +#endif (void )umask(022); while (optind < argc) do_stats(argv[optind++]); +#ifndef CPLANT_YOD /* * Clean up. */ _sysio_shutdown(); +#endif return 0; } Index: test_stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_stdfd.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -w -b -B -p -r1.2 -r1.2.2.1 --- test_stdfd.c 24 Mar 2003 22:09:49 -0000 1.2 +++ test_stdfd.c 12 Jun 2003 19:41:11 -0000 1.2.2.1 @@ -119,6 +119,7 @@ main(int argc, char *const argv[]) if (argc - optind != 1) usage(); +#ifndef CPLANT_YOD /* * Init sysio lib. */ @@ -200,6 +201,7 @@ main(int argc, char *const argv[]) goto out; } +#endif /* * Read from stdin, write to stdout and stderr. */ @@ -226,8 +228,9 @@ main(int argc, char *const argv[]) * Clean up. */ out: +#ifndef CPLANT_YOD _sysio_shutdown(); - +#endif return 0; } |
From: Lee W. <lw...@us...> - 2003-06-11 23:14:53
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv5668 Modified Files: namei.c Log Message: When built with automounts enabled, if a directory has the sticky- bit set but there is no .mount file, namei loops until the automount limit count is exceeded. Once that has happened, no further automounts were allowed in the path. Removed the else block that reset the error code, when the lookup on .mount failed, so that namei will begin processing the next component. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- namei.c 24 Mar 2003 22:09:06 -0000 1.5 +++ namei.c 11 Jun 2003 20:43:34 -0000 1.6 @@ -293,8 +293,7 @@ _sysio_path_walk(struct pnode *parent, s * Must send the intent-path again. */ path = nd->nd_path; - } else if (err == -ENOENT) - err = 0; + } if (!err) { P_RELE(pno); nd->nd_amcnt++; |
From: Sonja T. <so...@us...> - 2003-05-30 18:26:54
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1:/tmp/cvs-serv16479/tests Modified Files: Tag: libsysio_tests Makefile.am Log Message: added new tests Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Makefile.am,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -u -w -b -B -p -r1.9 -r1.9.2.1 --- Makefile.am 10 May 2003 14:43:58 -0000 1.9 +++ Makefile.am 30 May 2003 18:12:02 -0000 1.9.2.1 @@ -1,5 +1,5 @@ noinst_PROGRAMS = test_copy test_stats test_path test_mounts test_list \ - test_getcwd test_stdfd + test_getcwd test_stdfd test_driver CLEANFILES=drv_data.c @@ -82,7 +82,12 @@ test_stdfd_CFLAGS=$(CFL) test_stdfd_LDADD=$(LIBS) test_stdfd_DEPENDENCIES=$(LIBS) -EXTRA_DIST=gendrvdata.sh test.h +test_driver_SOURCES=test_driver.c sysio_tests.c sysio_stubs.c help.c $(CMNSRC) +test_driver_CFLAGS=$(CFL) +test_driver_LDADD=$(LIBS) +test_driver_DEPENDENCIES=$(LIBS) + +EXTRA_DIST=gendrvdata.sh test.h test_driver.h drv_data.c: $(CONFIG_DEPENDENCIES) $(top_srcdir)/tests/gendrvdata.sh test -z "drv_data.c" && rm -f drv_data.c; \ |
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1:/tmp/cvs-serv17460/tests Added Files: Tag: libsysio_tests README help.c helper.pm sysio_stubs.c sysio_tests.c test_all.pl test_copy.pl test_driver.c test_driver.h test_getcwd.pl test_list.pl test_path.pl test_stats.pl Log Message: added new tests --- NEW FILE --- To run the tests, just do ./test_all.pl (at some point I will integrate that into the build environment). There are 6 basic commands for the test driver, CALL, PRINT, ALLOC, FREE, HELP, and exit (EXIT, quit, or QUIT will also work). CALL is the main command for running libsysio calls. The format will depend on the particular libsysio command being ran. Basically, the format is CALL cmd args. The available commands used with CALL are (in no particular order): fstat iwrite read chdir fstatvfs iwritev readv chmod fsync list rmdir chown ftruncate lseek sizeof close getcwd lstat stat cmpstr getdirentries mkdir statvfs creat init mknod symlink debug ioctl mount truncate dup iodone open umask dup2 iowait umount endian ipread printline unlink ipreadv pread write fcntl ipwrite preadv writev fdatasync ipwritev pwritev fill iread pwrite ireadv The specifics of the commands are explained later. The return value from a command can be saved and referenced later by using a syntax similar to $foo = x. Commands can be combined, such as: CALL fstat ( $fd = CALL open foo ) ( $buf = ALLOC 128 ), with some cautionary notes. First, everything needs to be seperated by a space. File names with spaces in them need to be quoted, as in: $fd = CALL open "file with spaces" O_RDONLY Second, any value that is used needs to be identified with an identifier. In other words, the command: $buf = ALLOC ( CALL sizeof stat ) will not work, but the command $buf = ALLOC ( $size = CALL sizeof stat ) will. All commands return a 4 digit status code. The codes are: 0000 : Success. This does NOT necessarily mean that the libsysio : command returned success, only that there were no errors : in issuing the command to libsysio. To get the result of : the libsysio command, use PRINT $$ . PRINT $errno will return : the last error code. 0x001 : Invalid arguments given to command 0x002 : Invalid command issued 0x004 : Invalid variable identifier given ALLOC takes a size argument and an optional alignment argument. FREE takes the variable to free as an argument. HELP without any arguments displays the list of commands. HELP <cmd> will give information on the specific command PRINT take several forms. To just print out a variable, type PRINT $var-name. If the variable is an integer, it will return the integer. If it is a string, it will print out the string. If it is a buffer, it will print out the buffer as a series of hex digits. Note for most buffers, the test driver will not know what it contains--just because it should contain a string does not mean that the driver will know that. The other form of PRINT is: PRINT $var_name <offset> <length> <type> which will print out length units of the given type starting at the given offset. The length is the total length in bytes, so for an integer, a length of 4 would only print out one integer. The length argument is ignored for strings. Allowable types are INT SHORT CHAR and LONG. For most of the CALL commands, their format is similar to the related sysio call. The ones that do not have a corresponding sysio call are listed below: init: This MUST be called prior to any sysio calls. It initilizes : libsysio printline: If debugging is turned on, this will print a line number : with any debug lines fill <val> <type> <size> <offset> <buf>: Fills buffer buf with size : bytes of val starting at : buf+offset. The type of val : can be UINT. STR, or PTR and : is given by the type arg list <dir>: Lists contents of dir. If no dir is given, uses cwd debug <num>: Sets debug level to num sizeof <obj>: Gives the size of the obj. Valid objs are char, int, : long, flock, stat, and statvfs endian: returns 0 if the machine is little endian, one otherwise cmpstr <buf1> <buf2>: Issues a strcmp call on the two buffers to : see if they are the same. Returns 0 for a : match --- NEW FILE --- #include <stdio.h> #include "test_driver.h" void do_help() { int i, d, count = 0; fprintf(outfp, "libsysio test harness\n"); fprintf(outfp, "To get help on a specific command, use help <cmd>\n"); fprintf(outfp, "To exit, type exit or quit\n"); fprintf(outfp, "\nTo save the result from a function, use \"$res = command\"\n"); fprintf(outfp, "To later use that res, do \"comm $res\"\n"); fprintf(outfp, "\n\nAvailable commands are:\n\n"); /* Get total number of commands */ while (cmd_list[count].cmd) count++; d = count/4; if (count %4) d++; for (i=0; i < d; i++) { if (cmd_list[i+d].cmd) { if (cmd_list[i+2*d].cmd) { if (cmd_list[i+3*d].cmd) fprintf(outfp, "%-15s %-15s %-15s %-15s\n", cmd_list[i].cmd, cmd_list[i+d].cmd, cmd_list[i+2*d].cmd, cmd_list[i+3*d].cmd); else fprintf(outfp, "%-15s %-15s %-15s\n", cmd_list[i].cmd, cmd_list[i+d].cmd, cmd_list[i+2*d].cmd); } else fprintf(outfp, "%-15s %-15s\n", cmd_list[i].cmd, cmd_list[i+d].cmd); } else fprintf(outfp, "%-15s\n", cmd_list[i].cmd); } fprintf(outfp, "\n"); } void usage_setdebug() { fprintf(outfp, "setdebug [level]: Set debugging level to level\n"); } void usage_printline() { fprintf(outfp, "printline [0|1]: Turn off (0) or on (1) the printing of line number\n"); fprintf(outfp, " : and file name with debug output\n"); } void usage_endian() { fprintf(outfp, "endian: returns 1 for bigendian machines and 0 for little endian machines\n"); } void usage_sizeof() { fprintf(outfp, "sizeof [type]: returns the size of the data type. Currently \n"); fprintf(outfp, " : supported types are char, int, long, flock, stat and \n"); fprintf(outfp, " : statvfs\n"); } void usage_get_buffer() { fprintf(outfp, "alloc [size] <align>: allocates a buffer of size bytes aligned to align\n"); fprintf(outfp, " : align is optional. If not there, buffer will be aligned on\n"); fprintf(outfp, " : a one-byte boundary. returns an index into an array that \n"); fprintf(outfp, " : holds the buffer\n"); } void usage_free_buffer() { fprintf(outfp, "free [bufidx]: frees buffer at bufidx. Returns 0 on success, -1 on failure\n"); } void usage_do_fillbuff() { fprintf(outfp, "fill [val] [type] [size] [offset] [buf] : Fills the buffer buf with size \n"); fprintf(outfp, " : bytes of val starting at buf+offset\n"); fprintf(outfp, " : The type of val is specified by type,\n"); fprintf(outfp, " : which can be UINT, STR, or PTR\n"); } void usage_do_printbuf() { fprintf(outfp, "printbuf [buf] : print out contents of the buffer stored in buf\n"); fprintf(outfp, " : Always returns 0\n"); } void usage_cmpbufs() { fprintf(outfp, "cmpstr [buf1] [buf2]: Compare the contents of buf1 with buf2 by issuing a \n"); fprintf(outfp, " strcmp call. Returns 0 if the buffers match\n"); } void usage_init() { fprintf(outfp, "init: initilizes libsysio to default values for root directory and \n"); fprintf(outfp, " : current directory. Must be called before any other libsysio calls\n"); fprintf(outfp, " : Returns 0 on success, -1 on failure\n"); } void usage_list() { fprintf(outfp, "list <dir>: lists contents of dir. If dir is ommitted, will list contents\n"); fprintf(outfp, " : of the current working directory\n"); fprintf(outfp, " : Returns 0 on success, -1 on failure\n"); } void usage_chdir() { fprintf(outfp, "chdir [dir]: change the current working directory to dir\n"); fprintf(outfp, " : Returns 0 on success, -1 on failure\n"); } void usage_chmod() { fprintf(outfp, "chmod [newmode] [file]: change mode of file to newmode. newmode can be \n"); fprintf(outfp, " : specifed symbolically (eg, a+x), numerically \n"); fprintf(outfp, " : (eg, 0777), or using system defines \n"); fprintf(outfp, " : (eg S_IRUSR|S_IWUSR|S_IRGRP)\n"); fprintf(outfp, " : Returns 0 on success, -1 on failure\n"); } void usage_chown() { fprintf(outfp, "chown [newown[:newgrp]] [file]: change the owner of file to newown, the group\n"); fprintf(outfp, " : of file to newgrp, or both\n"); fprintf(outfp, " : Returns 0 on success, -1 on failure\n"); } void usage_open() { fprintf(outfp, "open [file] [flags] <mode>: open file with given flags. The mode is optional\n"); fprintf(outfp, " : can use defines for open, (eg, open foo O_RDONLY)\n"); fprintf(outfp, " : If flags are 0, file will be opened with O_RDWR\n"); fprintf(outfp, " : Returns the file descriptor for the opened file\n"); } void usage_close() { fprintf(outfp, "close [file]: closes the file. Returns 0 on success, -1 on failure\n"); } void usage_mount() { fprintf(outfp, "mount [fstype:source] [target]: mount source (which has fstype as its file\n"); fprintf(outfp, " : system type) onto target.\n"); fprintf(outfp, " : Returns 0 on success, -1 on failure\n"); } void usage_dup() { fprintf(outfp, "dup [oldfd]: Duplicate oldfd. Returns the duplicated file descriptor\n"); fprintf(outfp, " : Returns -1 on failure\n"); } void usage_dup2() { fprintf(outfp, "dup2 [oldfd] [newfd]: Make newfd be a copy of oldfd. Returns newfd on \n"); fprintf(outfp, " : success and -1 on failure\n"); } void usage_fcntl() { fprintf(outfp, "fcntl [fd] [cmd] <args> : execute fcntl cmd on file with file descriptor fd\n"); fprintf(outfp, " : using (optional) args. Accepted (but not \n"); fprintf(outfp, " : necesarily working) commands are F_DUPFD, \n"); fprintf(outfp, " : F_GETFD, F_GETFL, F_GETOWN, F_SETFD, F_SETFL,\n"); fprintf(outfp, " : F_SETOWN, F_SETLK, F_SETLKW, and F_GETLK. \n"); } void usage_fstat() { fprintf(outfp, "fstat [fd] [buf]: Get the stat structure for file descriptor fd and place it\n"); fprintf(outfp, " : in buf. Returns 0 on success, -1 on failure\n"); } void usage_fsync() { fprintf(outfp, "fsync [fd]: ensure all parts of file with file descriptor fd are output to\n"); fprintf(outfp, " : stable storage. Returns 0 on success, -1 on failure\n"); } void usage_fdatasync() { fprintf(outfp, "fdatasync [fd]: ensure all parts of file with file descriptor fd except the \n"); fprintf(outfp, " : metadata are output to stable storage. Returns 0 on \n"); fprintf(outfp, " : success, -1 on failure\n"); } void usage_ftruncate() { fprintf(outfp, "ftruncate [fd] [len]: truncate file with file descriptor fd to have be \n"); fprintf(outfp, " : len bytes in length. Returns 0 on success, -1 on \n"); fprintf(outfp, " : failure\n"); } void usage_getcwd() { fprintf(outfp, "getcwd [buf] [size]: get the current working directory and store it in buf\n"); fprintf(outfp, " : buf is size bytes in length. If buf is too short, an \n"); fprintf(outfp, " : error of ERANGE is returned. Returns 0 on success, -1\n"); fprintf(outfp, " : on failure\n"); } void usage_lseek() { fprintf(outfp, "lseek [fd] [offset] [whence]: Sets the offset of the file descriptor fd to\n"); fprintf(outfp, " : either offset if whence is SEEK_SET or offset\n"); fprintf(outfp, " : plus the current location if whence is SEEK_CUR\n"); fprintf(outfp, " : or offset plus the size of the file if whence\n"); fprintf(outfp, " : is SEEK_END. Returns 0 on success and -1 on \n"); fprintf(outfp, " : failure\n"); } void usage_lstat() { fprintf(outfp, "lstat [filename] [buf]: Get the stat structure for filename and return it in\n"); fprintf(outfp, " : buf. Returns 0 on success and -1 on failure\n"); } void usage_getdirentries() { fprintf(outfp, "getdirentries [fd] [buf] [nbytes] [basep]: Read dir entries from directory\n"); fprintf(outfp, " : with file descriptor fd into buf\n"); fprintf(outfp, " : At most nbytes are read. Reading\n"); fprintf(outfp, " : starts at basep, and basep is set\n"); fprintf(outfp, " : to new pos. Returns the number of \n"); fprintf(outfp, " : bytes read on success or 0 on\n"); fprintf(outfp, " : failure\n"); fprintf(outfp, "Note that basep does not have to be pre-allocated. Executing cmd: \n"); fprintf(outfp, "\"getdirentries $fd $buf 4096 $basep\", where $fd is the result of an open\n"); fprintf(outfp, "and $buf is the result of an alloc (but $basep is totally new) will work\n"); fprintf(outfp, "After the execution of the command, $basep holds the new offset and can be\n"); fprintf(outfp, "used again for any further getdirentries calls\n"); } void usage_mkdir() { fprintf(outfp, "mkdir [newdir] [mode]: make a new directory, newdir, with the permissions \n"); fprintf(outfp, " : specified in mode. Permissions can be symbolic \n"); fprintf(outfp, " : (eg, a+x), numeric (eg, 0777), or can use defines\n"); fprintf(outfp, " : (eg S_IRUSR|S_IWUSR|S_IRGRP). Returns 0 on success \n"); fprintf(outfp, " : -1 on failure.\n"); } void usage_creat() { fprintf(outfp, "creat [newfile] [mode]: create a new file, newfile, with the permissions \n"); fprintf(outfp, " : specified in mode. Permissions can be symbolic \n"); fprintf(outfp, " : (eg, a+x), numeric (eg, 0777), or can use defines\n"); fprintf(outfp, " : (eg S_IRUSR|S_IWUSR|S_IRGRP). Returns 0 on success \n"); fprintf(outfp, " : -1 on failure.\n"); } void usage_stat() { fprintf(outfp, "stat [filename] [buf]: Get the stat structure for filename and return it in\n"); fprintf(outfp, " : buf. Returns 0 on success and -1 on failure\n"); } void usage_statvfs() { fprintf(outfp, "statvfs [filename] [buf]: Get the statvfs structure for filename and return\n"); fprintf(outfp, " : it in buf. Returns 0 on success and -1 on failure\n"); } void usage_fstatvfs() { fprintf(outfp, "fstatvfs [fd] [buf]: Get the stat structure for file with file descriptor fd\n"); fprintf(outfp, " : and return it in buf. Returns 0 on success and -1 on\n"); fprintf(outfp, " : failure\n"); } void usage_truncate() { fprintf(outfp, "truncate [fname] [len]: truncate file with name fname to be exactly \n"); fprintf(outfp, " : len bytes in length. Returns 0 on success, -1 on \n"); fprintf(outfp, " : failure\n"); } void usage_rmdir() { fprintf(outfp, "rmdir [dirname]: Remove directory at dirname. Returns 0 on success, -1 on\n"); fprintf(outfp, " : failure.\n"); } void usage_symlink() { fprintf(outfp, "symlink [path1] [path2]: Make a symbolic link from path1 to path2. Returns\n"); fprintf(outfp, " : 0 on success, -1 on failure\n"); } void usage_unlink() { fprintf(outfp, "unlink [path]: Unlink path. If path is the last name to a file, the file is \n"); fprintf(outfp, " : is removed. If it was a symbolic link, the link is removed. \n"); fprintf(outfp, " : Returns 0 on success, -1 on failure\n"); } void usage_ioctl() { fprintf(outfp, "ioctl [fd] [cmd] <args> : Issue the ioctl command cmd on the file with file\n"); fprintf(outfp, " : descriptor fd. Any arguments are placed in args\n"); fprintf(outfp, " : At the moment, the only commands understand are the \n"); fprintf(outfp, " : ioctl commands found in /usr/include/linux/fs.h\n"); } void usage_umask() { fprintf(outfp, "ioctl [mask] : Sets the umask used by open to set initial file permissions on\n"); fprintf(outfp, " : a newly created file. Returnds the previous value of the mask\n"); } void usage_iodone() { fprintf(outfp, "iodone [ioid] : Poll for completion of the asynchronous request identifed by\n"); fprintf(outfp, " : ioid. Returns 1 if request finished\n"); } void usage_iowait() { fprintf(outfp, "iowait [ioid] : Wait for completion of the asynchronous request identifed by\n"); fprintf(outfp, " : ioid. Returns result of asynchronous request \n"); } void usage_ipreadv() { fprintf(outfp, "ipreadv [fd] [buf] [count] [off]: Reads data asynchrously to file descriptor fd \n"); fprintf(outfp, " : starting at offset off. Data comes from \n"); fprintf(outfp, " : buffer described by buf, which is a pointer to\n"); fprintf(outfp, " : an iovec strucutre. Number of buffers is \n"); fprintf(outfp, " : specified by count. Returns an iod_t on \n"); fprintf(outfp, " : success and -1 on failure\n"); } void usage_ipread() { fprintf(outfp, "ipread [fd] [buf] [count] [off]: Read asynchrously up to count bytes from file\n"); fprintf(outfp, " : with file descriptor fd starting at offset off\n"); fprintf(outfp, " : Read into buffer pointed at by buf. Returns\n"); fprintf(outfp, " : an iod_t on success and -1 on failure\n"); } void usage_preadv() { fprintf(outfp, "preadv [fd] [buf] [count] [off]: Reads data from file descriptor fd starting at\n"); fprintf(outfp, " : offset off. Data goes into buffer described\n"); fprintf(outfp, " : by buf, which is a pointer to an iovec \n"); fprintf(outfp, " : structure. Number of buffers is specified by\n"); fprintf(outfp, " : count. Returns the number of bytes read\n"); } void usage_pread() { fprintf(outfp, "preadv [fd] [buf] [count] [off]: Reads count bytes of data from file descriptor\n"); fprintf(outfp, " : fd starting at offset off. Data goes into buf.\n"); fprintf(outfp, " : Returns number of bytes read or -1 on failure\n"); } void usage_ireadv() { fprintf(outfp, "ireadv [fd] [buf] [count] : Reads data asynchrously to file descriptor fd \n"); fprintf(outfp, " : Data comes from buffer described by buf, which is \n"); fprintf(outfp, " : an pointer to an iovec structure. Number of\n"); fprintf(outfp, " : buffers is specified by count. Returns an iod_t\n"); fprintf(outfp, " : on success and -1 on failure\n"); } void usage_iread() { fprintf(outfp, "iread [fd] [buf] [count]: Read asynchrously up to count bytes from file with\n"); fprintf(outfp, " : file descriptor fd into buffer pointed at by buf\n"); fprintf(outfp, " : Returns an iod_t on success and -1 on failure\n"); } void usage_readv() { fprintf(outfp, "readv [fd] [buf] [count] : Reads data from file descriptor fd. Data comes from\n"); fprintf(outfp, " : the buffer described by buf, which is a pointer to an\n"); fprintf(outfp, " : an iovec structure. Number of buffers is specified\n"); fprintf(outfp, " : by count. Returns the number of bytes read on \n"); fprintf(outfp, " : on success and -1 on failure\n"); } void usage_read() { fprintf(outfp, "read [fd] [buf] [count]: Read up to count bytes from file with file \n"); fprintf(outfp, " : descriptor fd into buffer pointed at by buf\n"); fprintf(outfp, " : Returns number of bytes read on success or 0 on \n"); fprintf(outfp, " : on failure\n"); } void usage_ipwritev() { fprintf(outfp, "ipwritev [fd] [buf] [count] [off]: writes data asynchronously to file with file\n"); fprintf(outfp, " : descriptor fd starting at offset off. Data \n"); fprintf(outfp, " : comes from buffers described by buf, which\n"); fprintf(outfp, " : is a pointer to an iovec structure. Number \n"); fprintf(outfp, " : of buffers is specified by count. Returns\n"); fprintf(outfp, " : an iod_t on success and -1 on failure\n"); } void usage_ipwrite() { fprintf(outfp, "ipwrite [fd] [buf] [count] [off]: writes count bytes of data asynchronously to\n"); fprintf(outfp, " : file with file descriptor fd starting at \n"); fprintf(outfp, " : offset off. Data comes from buf. Returns an\n"); fprintf(outfp, " : iod_t on success and -1 on failure\n"); } void usage_pwritev() { fprintf(outfp, "pwritev [fd] [buf] [count] [off]: writes data to file with file descriptor fd\n"); fprintf(outfp, " : starting at offset off. Data comes from \n"); fprintf(outfp, " : buffers described by buf, which is a pointer\n"); fprintf(outfp, " : to an iovec structure. Number of buffers is\n"); fprintf(outfp, " : by count. Returns number of bytes read on \n"); fprintf(outfp, " : success and -1 on failure\n"); } void usage_pwrite() { fprintf(outfp, "pwrite [fd] [buf] [count] [off]: writes count bytes of data to file with file \n"); fprintf(outfp, " : descriptor fd starting at offset off. Data\n"); fprintf(outfp, " : Data comes from buf. Returns number of bytes\n"); fprintf(outfp, " : written on success and -1 on failure\n"); } void usage_iwritev() { fprintf(outfp, "iwritev [fd] [buf] [count] : writes data asynchronously to file with file\n"); fprintf(outfp, " : descriptor fd. Data comes from buffers described\n"); fprintf(outfp, " : by buf, which is a pointer to an iovec structure.\n"); fprintf(outfp, " : Number of buffers is specified by count. Returns\n"); fprintf(outfp, " : an iod_t on success and -1 on failure\n"); } void usage_iwrite() { fprintf(outfp, "iwrite [fd] [buf] [count] : writes count bytes of data asynchronously to\n"); fprintf(outfp, " : file with file descriptor fd. Data comes from buf.\n"); fprintf(outfp, " : Returns an iod_t on success and -1 on failure.\n"); } void usage_writev() { fprintf(outfp, "writev [fd] [buf] [count]: writes data to file descriptor fd. Data comes from\n"); fprintf(outfp, " : buffers described by buf, which is a pointer to a \n"); fprintf(outfp, " : iovec strucutre. Number of buffers is specified by \n"); fprintf(outfp, " : count \n"); } void usage_write() { fprintf(outfp, "write [fd] [buf] [count] : writes count bytes of data to file with file \n"); fprintf(outfp, " : descriptor fd. Data comes from buf. Returns number\n"); fprintf(outfp, " : of bytes written on success and -1 on failure.\n"); } void usage_mknod() { fprintf(outfp, "mknod [path] [mode] [dev] : creates a filesystem node named path with \n"); fprintf(outfp, " : specified mode using device special file dev\n"); fprintf(outfp, " : Returns 0 on sucess and -1 on failure\n"); } void usage_umount() { fprintf(outfp, "umount [path] : Umount file at path. Returns 0 on success and -1 on failure\n"); } void usage_exit() { } --- NEW FILE --- #!/usr/bin/perl -w # # Provides a set of helper routines for use in the Perl # test scripts # package helper; use strict; BEGIN{} # Print out a given error message, close the command file # and exit sub print_and_exit { my ($cmdfh, $outfh, $exit_num, $exit_str) = @_; print STDOUT "$exit_str"; # Clean up my $cmdstr = 'FREE $buf'; $cmdstr = $cmdstr."\n"; send_cmd($cmdfh, $outfh, "FREE", $cmdstr); print $cmdfh "exit\n"; close $outfh; # Give test_driver time to finish sleep 0.000001; exit $exit_num; } # Output the given command and make sure that the exit # code for the command was valid sub send_cmd { my ($cmdfh, $outfh, $cmd, $cmdstr) = @_; print $cmdfh $cmdstr; my $res = <$outfh>; chop($res); if ($res ne "0000 ") { print_and_exit($cmdfh, $outfh, 1, "ERROR! Command $cmd failed with code $res\n"); } } # Check the return value from the last libsysio call sub verify_cmd { my ($cmdfh, $outfh, $cmd) = @_; # Verify the system call's output my $cmdstr = 'PRINT $$'; $cmdstr .= "\n"; send_cmd($cmdfh, $outfh, "PRINT", $cmdstr); my $res = <$outfh>; chop($res); if ($res eq "0xffffffff") { # Get the errno $cmdstr = 'PRINT $errno'; $cmdstr .= "\n"; send_cmd($cmdfh, $outfh, "PRINT", $cmdstr); my $err = <$outfh>; chop($err); print_and_exit($cmdfh, $outfh, 1, "ERROR! $cmd returned $res\n"); } return $res; } # Compares two numbers. Output error message and exit if # they differ sub cmp_nums { my ($cmdfh, $outfh, $ionum, $pnum, $desc) = @_; my $str; if ($ionum != $pnum) { my $str = sprintf("ERROR! Sysio's number %x does not match Perl's (%x)\n", $ionum, $pnum); $str = sprintf("%s Numbers were %s\n", $str, $desc); print_and_exit(1, $str); } } END{} 1; --- NEW FILE --- #define _BSD_SOURCE #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <fcntl.h> #include <unistd.h> #include <sys/uio.h> #include <linux/fs.h> #include <sys/stat.h> #include <sys/statvfs.h> #include "test_driver.h" #include "sysio.h" /* * ################################################ * # Function stubs # [...2110 lines suppressed...] int do_umount(int argc, char **argv) { int err; if (argc != 1) { DBG(2, fprintf(outfp, "Invalid number (%d) of args for umount\n", argc)); return INVALID_ARGS; } err = umount(argv[0]); if (err) my_perror("umount"); my_errno = errno; last_ret_val = err; last_type = SINT; return SUCCESS; } --- NEW FILE --- #define _BSD_SOURCE #include <stdio.h> #include <stdlib.h> #include <string.h> #include <getopt.h> #include <errno.h> #include <ctype.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/statvfs.h> #include <fcntl.h> #include <sys/queue.h> #include <dirent.h> #include <pwd.h> #include <grp.h> #include "sysio.h" #include "mount.h" #include "test.h" #include "test_driver.h" /* * ################################################### * # Test functions # * # These functions are used to test libsysio. # * # Eventually, there should be one of these for # * # every function document in sysio.h # * ################################################### */ int initilize_sysio(char *root_driver, char *root_path, int mntflgs) { int err; char *wd; /* * Init sysio lib. */ _sysio_init(); /* * Init native file system driver and request mount of specified * source directory. */ err = drv_init_all(); if (err) { my_errno = err; my_perror("drv_init_all"); last_ret_val = errno; return SUCCESS; } err = _sysio_mount_root(root_path, root_driver, mntflgs, NULL); if (err) { my_errno = err; my_perror("_sysio_mount_root"); last_ret_val = errno; return SUCCESS; } /* * Attempt to set the cwd by getting it out of the * user's environment. If that does not work, set * it to / */ wd = getenv("PWD"); if (wd == NULL) { wd = malloc(5); strcpy(wd, "/"); } if (chdir(wd) != 0) { my_perror(wd); my_errno = errno; last_ret_val = errno; return SUCCESS; } DBG(3, sprintf(output, "Your current working directory is %s\n", wd)); last_ret_val = 0; return SUCCESS; } int sysio_list(char *path) { int fd; size_t n; struct dirent *buf, *dp; __off_t base; ssize_t cc; int numfiles = 0; fd = open(path, O_RDONLY); if (fd < 0) { my_errno = errno; last_ret_val = fd; my_perror(path); return SUCCESS; } n = 16 * 1024; buf = malloc(n); if (!buf) { my_perror(path); cc = -1; goto out; } base = 0; DBG(5, sprintf(output, "About to call getdirentries\n")); while ((cc = getdirentries(fd, (char *)buf, n, &base)) > 0) { dp = buf; while (cc > 0) { DBG(4, fprintf(outfp, "\t%s: ino %#08x off %#08x type %#08x\n", dp->d_name, (unsigned int)dp->d_ino, (unsigned int)dp->d_off, (int )dp->d_type)); sprintf(output, "%s\n", dp->d_name); cc -= dp->d_reclen; dp = (void *)dp + dp->d_reclen; numfiles++; } printf("Out of inner loop\n"); if (!base) break; } out: if (cc < 0) { DBG(2, sprintf(output, "cc barfed\n")); my_perror(path); } free(buf); { int oerrno = errno; if (close(fd) != 0) { DBG(2,sprintf(output, "close barfed\n")); my_perror(path); if (cc < 0) errno = oerrno; else cc = -1; } } last_ret_val = numfiles; my_errno = errno; return SUCCESS; } int sysio_mount(char *from, char *to) { int err; char *s; char *buf; char *cp; char *fstype, *source, *opts, *target; err = 0; /* * Copy everything to a buffer we can modify. */ s = buf = malloc(strlen(from) + 1); if (!buf) { my_perror(from); last_ret_val = -1; my_errno = errno; return SUCCESS; } (void )strcpy(s, from); /* * Eat leading white. */ while (*s && *s == ' ' && *s == '\t') s++; /* * Get fstype. */ fstype = cp = s; while (*cp && *cp != ':' && *cp != ' ' && *cp != '\t') cp++; if (fstype == cp || *cp != ':') { DBG(1, sprintf(output, "%s: Missing FS type\n", from)); err = -1; goto out; } *cp++ = '\0'; s = cp; /* * Eat leading white. */ while (*s && *s == ' ' && *s == '\t') s++; /* * Get source. */ source = cp = s; while (*cp && *cp != ' ' && *cp != '\t') cp++; if (source == cp) { DBG(1, sprintf(output, "%s: Missing source\n", from)); err = -1; goto out; } if (*cp) *cp++ = '\0'; s = to; /* * Eat leading white. */ while (*s && *s == ' ' && *s == '\t') s++; /* * Get opts. */ opts = cp = s; while (*cp && *cp != ' ' && *cp != '\t') cp++; if (opts == cp) { DBG(1,sprintf(output, "%s: Missing target\n", to)); err = -1; goto out; } if (*cp) *cp++ = '\0'; s = cp; /* * Eat leading white. */ while (*s && *s == ' ' && *s == '\t') s++; /* * Get target */ target = cp = s; while (*cp && *cp != ' ' && *cp != '\t') cp++; if (target == cp) { target = opts; opts = NULL; } if (*cp) *cp++ = '\0'; err = mount(source, target, fstype, 0, opts); if (err) my_perror(from); out: free(buf); last_ret_val = err; my_errno = errno; return SUCCESS; } int sysio_chdir(char *newdir) { char *buf; if (chdir(newdir) != 0) { my_perror(newdir); return -1; } buf = getcwd(NULL, 0); if (!buf) { my_perror(newdir); last_ret_val = -1; my_errno = errno; return SUCCESS; } DBG(4, sprintf(output, "New dir is %s\n", buf)); free(buf); return SUCCESS; } static mode_t get_mode(char *arg, int type, int start_mode); #define SYMBOLIC 0 #define DEFINED 1 #define NUMERIC 2 /* * Change the permissions on a given file * * sysio_chmod <filename> <permissions> * */ int sysio_chmod(char *mode_arg, const char *path) { int err; mode_t mode; struct stat st; /* Get the current mode */ err = stat(path, &st); /* Is the new mode symbolic? */ if (isalpha(mode_arg[0])) { /* Could be specifying defines */ if (mode_arg[0] == 'S') mode = get_mode(mode_arg, DEFINED, st.st_mode); else mode = get_mode(mode_arg, SYMBOLIC, st.st_mode); } else mode = get_mode(mode_arg, NUMERIC, st.st_mode); DBG(3,sprintf(output, "Using a mode of %o and a file of %s\n", mode, path)); if (mode == 0) { DBG(2,sprintf(output, "Invalid mode\n")); return INVALID_ARGS; } last_ret_val = chmod(path, mode); my_errno = errno; return SUCCESS; } #define USER_STATE 0 /* Specifies that the users are still being listed */ #define MODE_STATE_ADD 1 #define MODE_STATE_REMOVE 2 #define READ 00444 #define WRITE 00222 #define EXECUTE 00111 #define OWNER 00700 #define GROUP 00070 #define OTHER 00007 mode_t get_mode(char *arg, int type, int start_mode) { int i, j,digit, total; char c; int state = USER_STATE; int len = strlen(arg); unsigned int users = 0; unsigned int modes = 0; if (type == DEFINED) { char curr_word[10]; total = digit = 0; j = 0; DBG(4, sprintf(output, "len is %d\n", len)); for (i=0; i < len; i++) { if (arg[i] == '|') { curr_word[j] = '\0'; DBG(3, sprintf(output, "Got mode word %s\n", curr_word)); digit = get_obj(curr_word); if (digit < 0 ) { DBG(2, sprintf(output, "Unable to understand mode arg %s\n", curr_word)); return -1; } total |= digit; j = 0; } else curr_word[j++] = arg[i]; } curr_word[j] = '\0'; DBG(3, sprintf(output, "Got mode word %s\n", curr_word)); digit = get_obj(curr_word); if (digit < 0 ) { DBG(3, sprintf(output, "Unable to understand mode arg %s\n", curr_word)); return -1; } total |= digit; return total; } if (type == SYMBOLIC) { for (i=0; i < len; i++) { c = arg[i]; if (state == USER_STATE) { switch(c){ case 'u': users |= OWNER; break; case 'g': users |= GROUP; break; case 'o': users |= OTHER; break; case 'a': users |= (OWNER|GROUP|OTHER); break; case '+': state = MODE_STATE_ADD; break; case '-': state = MODE_STATE_REMOVE; break; default: return 0; } } else { switch(c){ case 'r': modes |= READ; break; case 'w': modes |= WRITE; break; case 'x': modes |= EXECUTE; break; default: return 0; } } } if (state == MODE_STATE_ADD) { return (start_mode | (users & modes)); } else { return (start_mode & ~(users & modes)); } } else { /* Digits should be octal digits, so should convert */ total = 0; for (i=0; i < len; i++) { c = arg[i]; digit = atoi(&c); if (digit > 7) return 0; for (j=len-i-1; j >0; j--) digit *= 8; total += digit; } return total; } } /* * Changes the ownership of the file. The new_id * is of the format owner:group. Either the owner * or the group may be omitted, but, in order to * change the group, the : must preced the group. */ 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 */ len = strlen(new_id); for (i=0; i < len; i++) { if (new_id[i] == ':') { /* Group name */ if (!group) group = malloc(strlen(new_id) -i +2); state = 1; /* Now getting group name */ j = 0; if (owner) owner[i] = '\0'; } if (!state) { /* Getting owner name */ if (!owner) owner = malloc(strlen(new_id) +1 ); owner[i] = new_id[i]; } else { /* Group name */ group[j] = new_id[i]; j++; } } if (group) group[i] = '\0'; else owner[i] = '\0'; /* Are the owner and/or group symbolic or numeric? */ if (owner) { if (isdigit(owner[0])) { /* 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)); return INVALID_ARGS; } o_id = o_ent->pw_uid; } } if (group) { 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)); return INVALID_ARGS; } g_id = g_ent->gr_gid; } } /* Now issue the syscall */ DBG(4, sprintf(output, "Changing owner of file %s to %d (group %d)\n", file, o_id, g_id)); last_ret_val = chown(file, o_id, g_id); my_errno = errno; return SUCCESS; } int sysio_open(char *path, int flags) { DBG(4, sprintf(output, "Opening file %s with flags %x\n", path, flags)); last_ret_val = open(path, flags); my_errno = errno; return SUCCESS; } int sysio_open3(char *path, int flags, char *mode_arg) { mode_t mode; /* Is the new mode symbolic? */ if (isalpha(mode_arg[0])) { /* Could be specifying defines */ if (mode_arg[0] == 'S') mode = get_mode(mode_arg, DEFINED, 0); else mode = get_mode(mode_arg, SYMBOLIC, 0); } else mode = get_mode(mode_arg, NUMERIC, 0); last_ret_val = open(path, flags, mode); my_errno = errno; return SUCCESS; } int sysio_close(int fd) { last_ret_val = close(fd); my_errno = errno; return SUCCESS; } int sysio_fcntl(int fd, struct cmd_map* cmdptr, char *arg) { int fd_new, index, cmd, flag; char *cmdname; void *buf; cmd = cmdptr->cmd; cmdname = cmdptr->cmd_name; switch(cmd) { case F_DUPFD: fd_new = get_obj(arg); last_ret_val = fcntl(fd, F_DUPFD, fd_new); my_errno = errno; return SUCCESS; break; case F_GETFD: case F_GETFL: case F_GETOWN: /* case F_GETSIG: case F_GETLEASE: */ last_ret_val= fcntl(fd, cmd); my_errno = errno; return SUCCESS; break; case F_SETFD: case F_SETFL: case F_SETOWN: /*case F_SETSIG: case F_SETLEASE: case F_NOTIFY: */ flag = atoi(arg); last_ret_val = fcntl(fd, cmd, flag); my_errno = errno; return SUCCESS; break; case F_SETLK: case F_SETLKW: case F_GETLK: /* Get the buffer to hold the lock structure */ index = get_obj(arg); if (index < 0) { sprintf(output, "Unable to find buffer %s\n", arg+1); return INVALID_VAR; } buf = buflist[index]; if (!buf) { sprintf(output, "Buffer at index %d (mapped by %s) is null\n", index, arg); return INVALID_VAR; } last_ret_val = fcntl(fd, cmd, (struct flock *)buf); my_errno = errno; return SUCCESS; default: /* THis should be impossible */ return INVALID_ARGS; } return INVALID_ARGS; } void print_stat(struct stat *st) { DBG(3, sprintf(output, "%sstruct stat: \n", output)); DBG(3, sprintf(output, "%s st_dev: %#10x\n", output, (unsigned int)st->st_dev)); DBG(3, sprintf(output, "%s st_ino: %#10x\n", output, (unsigned int) st->st_ino)); DBG(3, sprintf(output, "%s st_mode: %o\n", output, st->st_mode)); DBG(3, sprintf(output, "%s st_nlink: %d\n", output, st->st_nlink)); DBG(3, sprintf(output, "%s st_uid: %d\n", output, st->st_uid)); DBG(3, sprintf(output, "%s st_gid: %d\n", output, st->st_gid)); DBG(3, sprintf(output, "%s st_rdev: %d\n", output, (int)st->st_rdev)); DBG(3, sprintf(output, "%s st_size: %d\n", output, (int) st->st_size)); DBG(3, sprintf(output, "%s st_blksize: %d\n", output, (int) st->st_blksize)); DBG(3, sprintf(output, "%s st_blocks: %d\n", output, (int) st->st_blocks)); DBG(3, sprintf(output, "%s st_atime: %#10x\n", output, (unsigned int) st->st_atime)); DBG(3, sprintf(output, "%s st_mtime: %#10x\n", output, (unsigned int) st->st_mtime)); DBG(3, sprintf(output, "%s st_ctime: %#10x", output, (unsigned int) st->st_ctime)); } int sysio_fstat(int fd, void *buf) { int err; struct stat *st = (struct stat *)buf; err = fstat(fd, st); if (err < 0) { my_perror("fstat"); } my_errno = errno; last_ret_val = err; print_stat(st); return SUCCESS; } int sysio_lstat(char *filename, void *buf) { int err; struct stat *st = (struct stat *)buf; err = lstat(filename, st); if (err < 0) { my_perror("lstat"); } my_errno = errno; last_ret_val = err; print_stat(st); return SUCCESS; } int sysio_stat(char *filename, void *buf) { int err; struct stat *st = (struct stat *)buf; err = stat(filename, st); if (err < 0) { my_perror("stat"); } my_errno = errno; last_ret_val = err; print_stat(st); return SUCCESS; } int sysio_getdirentries(int fd, char *buf, size_t nbytes, off_t *basep) { int err; struct dirent *dp; err = getdirentries(fd, buf, nbytes, basep); last_ret_val = err; DBG(4, sprintf(output, "Read %d bytes\n", err)); dp = (struct dirent *)buf; while (err > 0) { DBG(3, sprintf(output, "\t%s: ino %llu off %llu len %x type %c\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; } my_errno = errno; return last_ret_val; } int sysio_mkdir(char *path, char *mode_arg) { int err; mode_t mode; struct stat st; /* Is the new mode symbolic? */ if (isalpha(mode_arg[0])) { /* Could be specifying defines */ if (mode_arg[0] == 'S') mode = get_mode(mode_arg, DEFINED, st.st_mode); else mode = get_mode(mode_arg, SYMBOLIC, st.st_mode); } else mode = get_mode(mode_arg, NUMERIC, st.st_mode); DBG(3, sprintf(output, "Using a mode of %o and a file of %s\n", mode, path)); if (mode == 0) { DBG(2, sprintf(output, "Invalid mode\n")); return INVALID_ARGS; } err = mkdir(path, mode); my_errno = errno; last_ret_val = err; return SUCCESS; } int sysio_creat(char *path, char *mode_arg) { mode_t mode; int err; /* Is the new mode symbolic? */ if (isalpha(mode_arg[0])) { /* Could be specifying defines */ if (mode_arg[0] == 'S') mode = get_mode(mode_arg, DEFINED, 0); else mode = get_mode(mode_arg, SYMBOLIC, 0); } else mode = get_mode(mode_arg, NUMERIC, 0); DBG(3, sprintf(output, "Using a mode of %o and a file of %s\n", mode, path)); if (mode == 0) { DBG(2, sprintf(output, "Invalid mode\n")); return INVALID_ARGS; } err = creat(path, mode); my_errno = errno; last_ret_val = err; return SUCCESS; } void print_statvfs(struct statvfs *st) { DBG(3, sprintf(output, "%sstruct statvfs: \n", output)); DBG(3, sprintf(output, "%s f_bsize: %x\n", output, (unsigned int) st->f_bsize)); DBG(3, sprintf(output, "%s f_frsize: %x\n", output, (unsigned int) st->f_frsize)); DBG(3, sprintf(output, "%s f_blocks: %x\n", output, (unsigned int) st->f_blocks)); DBG(3, sprintf(output, "%s f_bfree: %x\n", output, (unsigned int) st->f_bfree)); DBG(3, sprintf(output, "%s f_bavail: %x\n", output, (unsigned int) st->f_bavail)); DBG(3, sprintf(output, "%s f_files: %x\n", output, (unsigned int) st->f_files)); DBG(3, sprintf(output, "%s f_ffree: %x\n", output, (unsigned int) st->f_ffree)); DBG(3, sprintf(output, "%s f_favail: %x\n", output, (unsigned int) st->f_favail)); DBG(3, sprintf(output, "%s f_files: %x\n", output, (unsigned int) st->f_files)); DBG(3, sprintf(output, "%s f_fsid: %x\n", output, (unsigned int) st->f_fsid)); DBG(3, sprintf(output, "%s f_flag: %x\n", output, (unsigned int) st->f_flag)); DBG(3, sprintf(output, "%s f_fnamemax: %x\n", output, (unsigned int) st->f_namemax)); } int sysio_statvfs(char *filename, void *buf) { int err; struct statvfs *st = (struct statvfs *)buf; err = statvfs(filename, st); if ( err == -1) { my_perror("statvfs"); } my_errno = errno; last_ret_val = err; print_statvfs(st); return SUCCESS; } int sysio_fstatvfs(int fd, void *buf) { int err; struct statvfs *st = (struct statvfs *)buf; err = fstatvfs(fd, st); if (err == -1) { my_perror("fstatvfs"); } my_errno = errno; last_ret_val = err; print_statvfs(st); return SUCCESS; } int sysio_umask(char *mode_arg) { mode_t mode; /* Is the new mode symbolic? */ if (isalpha(mode_arg[0])) { /* Could be specifying defines */ if (mode_arg[0] == 'S') mode = get_mode(mode_arg, DEFINED, 0); else mode = get_mode(mode_arg, SYMBOLIC, 0); } else mode = get_mode(mode_arg, NUMERIC, 0); last_ret_val = umask(mode); my_errno = errno; return SUCCESS; } int sysio_mknod(char *path, char *mode_arg, dev_t dev) { int err; int mode; /* Is the new mode symbolic? */ if (isalpha(mode_arg[0])) { /* Could be specifying defines */ if (mode_arg[0] == 'S') mode = get_mode(mode_arg, DEFINED, 0); else mode = get_mode(mode_arg, SYMBOLIC, 0); } else mode = get_mode(mode_arg, NUMERIC, 0); if (mode < 0) { DBG(2,sprintf(output, "Cant get mode from %s\n", mode_arg)); return INVALID_VAR; } err = mknod(path, (mode_t) mode, dev); if (err < 0) my_perror("mknod"); last_ret_val = err; my_errno = errno; return SUCCESS; } --- NEW FILE --- #!/usr/bin/perl -w # # VERY basic functionality test for sysio. To run, just type ./test_all.pl # use strict; # Will use this directory... system("mkdir tmp_dir"); my $failures = 0; my $success = 0; # Get cwd.. my $cwd = $ENV{PWD}; # Get the sysio dir my $sysdir = $cwd; $sysdir =~ s/\/\w+$//; # Test getdirentries my $res = `./test_list.pl ../`; chop($res); if ($res ne "list test successful") { print "Basic getdirentries test failed with message: $res\n"; $failures++; } else { $success++; } # Test mount $res = `./test_list.pl -m native:$sysdir $cwd/tmp_dir`; chop($res); if ($res ne "list test successful") { print "Mount test failed with message: $res\n"; $failures++; } else { $success++; } # Test getcwd $res = `./test_getcwd.pl $sysdir`; chop($res); if ($res ne "getcwd test successful") { print "getcwd test failed with message: $res\n"; $failures++; } else { $success++; } # Test copy $res = `./test_copy.pl ../README tmp_dir/README`; chop($res); if ($res ne "copy test successful") { print "copy test failed with message: $res\n"; $failures++; } else { $success++; } # Test stats $res = `./test_stats.pl tmp_dir/README`; chop($res); if ($res ne "stat test successful") { print "stat test failed with message: $res\n"; $failures++; } else { $success++; } print "$failures tests failed and $success tests succeeded\n"; # cleanup system(`rm -rf tmp_dir`); --- NEW FILE --- #!/usr/bin/perl -w # # getdirentries test: Tests the equivalent of a ls. Note that this is not # the most robust test in the world; it simply verifies # that libsysio returns all the entries in the directory # # use IPC::Open2; use strict; use helper; sub usage { print "Usage: ./test_copy.pl <src> <dest>: Copy a file from src to dest\n"; exit(-1); } sub process_cmd { my ($src, $dest) = @_; eval { open2(\*OUTFILE, \*CMDFILE, "./test_driver --np"); }; if ($@) { if ($@ =~ /^open2/) { warn "open2 failed: $!\n$@\n"; return; } die; } my $outfh = \*OUTFILE; my $cmdfh = \*CMDFILE; helper::send_cmd($cmdfh, $outfh, "init", "CALL init\n"); # Get the filesize of src my $size = -s $src; my $bufsize; if ( $size > 1024) { # Arbitrary limit $bufsize = 1024; } else { $bufsize = $size; } # Open src my $cmdstr = '$src = CALL open '."$src O_RDONLY\n"; helper::send_cmd($cmdfh, $outfh, "open", $cmdstr); # Open dest $cmdstr = '$dest = CALL open '."$dest O_RDWR|O_CREAT 7777\n"; helper::send_cmd($cmdfh, $outfh, "open", $cmdstr); # Allocate buffer $cmdstr = '$buf = ALLOC '."$bufsize\n"; helper::send_cmd($cmdfh, $outfh, "ALLOC", $cmdstr); # Read size bytes from src and write them out to dest my $bytes = $size; while ($bytes > 0) { $cmdstr = 'CALL read $src $buf '."$bufsize\n"; helper::send_cmd($cmdfh, $outfh, "read", $cmdstr); my $res = helper::verify_cmd($cmdfh, $outfh, "read"); my $readb = oct($res); # Now write $readb back out to dest $cmdstr = 'CALL write $dest $buf '."$readb\n"; helper::send_cmd($cmdfh, $outfh, "write", $cmdstr); $res = helper::verify_cmd($cmdfh, $outfh, "write"); if ($readb != oct($res)) { print STDOUT "ERROR! Read $readb bytes but got back $res bytes\n"; exit 1; } $bytes -= $readb; } # Clean up $cmdstr = 'CALL close $src'."\n"; helper::send_cmd($cmdfh, $outfh, "close", $cmdstr); $cmdstr = 'CALL close $dest'."\n"; helper::send_cmd($cmdfh, $outfh, "close", $cmdstr); my $cmpres = system("cmp -s $src $dest"); if ($cmpres != 0) { print STDOUT "ERROR! File $src differs from $dest\n"; exit 1; } helper::print_and_exit($cmdfh, $outfh, 0, "copy test successful\n"); } if (@ARGV != 2) { usage; } my $src = $ARGV[0]; my $dest = $ARGV[1]; process_cmd($src, $dest); exit 0; --- NEW FILE --- #define _BSD_SOURCE #define _XOPEN_SOURCE 600 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <getopt.h> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/uio.h> #include <sys/statvfs.h> #include <fcntl.h> #include <sys/queue.h> #include <dirent.h> #include <unistd.h> #include <ctype.h> #include "sysio.h" #include "mount.h" #include "test.h" #include "test_driver.h" struct queue_t; typedef struct cmd_tree_t { char *res_name; char *val; int arg_count; struct queue_t *children; } cmd_tree; struct queue_t { char *val; cmd_tree *cmd; struct queue_t *next; }; struct cmd_t cmd_list[] = { {"alloc", get_buffer, usage_get_buffer}, {"chdir", do_chdir, usage_chdir}, {"chmod", do_chmod, usage_chmod}, {"chown", do_chown, usage_chown}, {"close", do_close, usage_close}, {"cmpstr", cmp_bufs, usage_cmpbufs}, {"creat", do_creat, usage_creat}, {"debug", do_setdebug, usage_setdebug}, {"dup", do_dup, usage_dup}, {"dup2", do_dup2, usage_dup2}, {"endian", get_endian, usage_endian}, {"exit", do_exit, usage_exit}, {"fcntl", do_fcntl, usage_fcntl}, {"fdatasync", do_fdatasync, usage_fdatasync}, {"fill", do_fillbuff, usage_do_fillbuff}, {"free", free_buffer, usage_free_buffer}, {"fstat", do_fstat, usage_fstat}, {"fstatvfs", do_fstatvfs, usage_fstatvfs}, {"fsync", do_fsync, usage_fsync}, {"ftruncate", do_ftruncate, usage_ftruncate}, {"getcwd", do_getcwd, usage_getcwd}, {"getdirentries", do_getdirentries, usage_getdirentries}, {"init", do_init, usage_init}, {"ioctl", do_ioctl, usage_ioctl}, {"iodone", do_iodone, usage_iodone}, {"iowait", do_iowait, usage_iowait}, {"ipread", do_ipread, usage_ipread}, {"ipreadv", do_ipreadv, usage_ipreadv}, {"ipwrite", do_ipwrite, usage_ipwrite}, {"ipwritev", do_ipwritev, usage_ipwritev}, {"iread", do_iread, usage_iread}, {"ireadv", do_ireadv, usage_ireadv}, {"iwrite", do_iwrite, usage_iwrite}, {"iwritev", do_iwritev, usage_iwritev}, {"list", do_list, usage_list}, {"lseek", do_lseek, usage_lseek}, {"lstat", do_lstat, usage_lstat}, {"mkdir", do_mkdir, usage_mkdir}, {"mknod", do_mknod, usage_mknod}, {"mount", do_mount, usage_mount}, {"open", do_open, usage_open}, {"printbuf", do_printbuf, usage_do_printbuf}, {"printline", do_printline, usage_printline}, {"pread", do_pread, usage_pread}, {"preadv", do_preadv, usage_preadv}, {"pwritev", do_pwritev, usage_pwritev}, {"pwrite", do_pwrite, usage_pwrite}, {"quit", do_exit, usage_exit}, {"read", do_read, usage_read}, {"readv", do_readv, usage_readv}, {"rmdir", do_rmdir, usage_rmdir}, {"sizeof", get_sizeof, usage_sizeof}, /* {"setoutput", do_setoutput, usage_setoutput}, */ {"stat", do_stat, usage_stat}, {"statvfs", do_statvfs, usage_statvfs}, {"symlink", do_symlink, usage_symlink}, {"truncate", do_truncate, usage_truncate}, {"umask", do_umask, usage_umask}, {"umount", do_umount, usage_umount}, {"unlink", do_unlink, usage_unlink}, {"write", do_write, usage_write}, {"writev", do_writev, usage_writev}, {NULL, NULL, NULL} }; int run_cmd(cmd_tree *cmd_arg); cmd_tree* build_tree(char **cmd, int *length, int total); /* * ################################################## * # Memory functions # * # Intended to allow users to gain access to # * # buffers of memory to be manipulated later # * ################################################## */ void * alloc_buff32(unsigned int size, int align) { void* buf; if (posix_memalign(&buf, align, size)) return 0; return buf; } void free_buf32(void * ptr) { free(ptr); } long alloc_buff64(unsigned int size, int align) { char * buf; long ret_value; if (posix_memalign((void **)&buf, align, size)) return 0; ret_value = (long)buf; return ret_value; } void free_buf64(long ptr) { free((char *)ptr); } /* * Hash function for variables. Shamelessly stolen * from the ext3 code */ unsigned int dx_hack_hash (const char *name, int len) { unsigned int hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9; while (len--) { unsigned int hash = hash1 + (hash0 ^ (*name++ * 7152373)); if (hash & 0x80000000) hash -= 0x7fffffff; hash1 = hash0; hash0 = hash; } return hash0; } struct var_mapping *get_map(char *var_name) { int index; struct var_mapping_list *curr; if (var_name[0] == '$') { /* It is a name--chop off the initial and get the mapping $ */ var_name++; } index = dx_hack_hash(var_name, strlen(var_name)); index %= MAX_VARS -1; DBG(5, fprintf(outfp, "Got index of %d\n", index)); curr = &map[index]; while ((curr) && (curr->map.obj != -1) ) { if (strcmp(curr->map.name, var_name)) curr = curr->next; else return &curr->map; } return NULL; } char *get_str(char *var_name) { /* See if it is a quoted string */ if (var_name[0] == '"') { /* Chop off the beginning and end quotes and return the string */ int len = strlen(var_name); var_name[len-1] = '\0'; var_name++; } return var_name; } int get_obj(char *var_name) { struct var_mapping *var_map; int i; /* If var_name is a digit, we assume it is a literal */ if (isdigit(var_name[0])) return atoi(var_name); /* * Check for '|', indicates that one or more values are or'd * together */ for (i=0; i < strlen(var_name); i++) { if (var_name[i] == '|') { char *str1 = malloc(i+1); char *str2 = malloc(strlen(var_name)-i+1); int obj; struct var_mapping *tmp_map; memcpy(str1, var_name, i); memcpy(str2, (char *)&var_name[i+1], strlen(var_name)-i); tmp_map = get_map(str1); if (!tmp_map) { free(str1); free(str2); return -1; } obj = tmp_map->obj; tmp_map = get_map(str2); if (!tmp_map) { free(str1); free(str2); return -1; } obj |= tmp_map->obj; free(str1); free(str2); return obj; } } var_map = get_map(var_name); if (!var_map) return -1; else return var_map->obj; } void store_result(char *var_name, int result) { int index = dx_hack_hash(var_name, strlen(var_name)); struct var_mapping_list *map_obj; struct var_mapping_list *new_map; index %= MAX_VARS -1 ; if (map[index].map.obj >= 0) { /* Got a collision --just chain it*/ new_map = malloc(sizeof(struct var_mapping_list)); map_obj = &map[index]; while (map_obj->next != NULL) map_obj = map_obj->next; map_obj->next = new_map; } else new_map = &map[index]; new_map->map.name = malloc(sizeof(var_name) + 1); strcpy(new_map->map.name, var_name); new_map->map.obj = result; new_map->map.type = last_type; new_map->next = NULL; DBG(3, fprintf(outfp, "Stored %d in index %d hashed with %s\n", result, index, var_name)); } void free_obj(char *obj_name) { int index; struct var_mapping_list *prev, *curr; /* See if it is a variable name */ if (obj_name[0] == '$') { /* It is a name--chop off the initial $ */ obj_name++; } index = dx_hack_hash(obj_name, strlen(obj_name)); index %= MAX_VARS -1; DBG(5, fprintf(outfp, "Got index of %d\n", index)); curr = &map[index]; prev = NULL; while ((curr) && (curr->map.obj != -1) ) { if (strcmp(curr->map.name, obj_name)) { prev = curr; curr = curr->next; } else break; } /* Remove the object from the chain */ if (prev) prev->next = curr->next; curr->map.obj = -1; free(curr->map.name); if (prev) free(curr); } /* * Given a long string, returns the string divided into * whitespace seperated words in list. Returns the number * of words */ int parser(char *str, char** list) { int len, i=0, j=0, counter=-1; int in_quotes = 0; char *new_str; len = strlen(str); DBG(5, fprintf(outfp, "str is %s len is %d\n", str, len)); while (i < len) { if ((i==0) || ((str[i] == ' ') && (in_quotes == 0)) ) { if (i != 0) { new_str[j] = '\0'; DBG(5, fprintf(outfp, "Got word %s\n", list[counter])); i++; } while ((str[i] == ' ') && (in_quotes == 0)) i++; counter++; new_str = list[counter] = malloc(MAX_WORD); j = 0; } new_str[j] = str[i]; if (str[i] == '"') { if (in_quotes) in_quotes = 0; else in_quotes = 1; } if ((str[i] == ' ') && (in_quotes==0)){ while (str[i+1] == ' ') i++; new_str[j] = '\0'; } i++; j++; } new_str[j] = '\0'; DBG(5, fprintf(outfp, "Got word %s\n", list[counter])); return counter +1; } int execute_cmd(char *cmd, char **args, int arg_count) { int i = 0; if (!strcmp(cmd, "help")) { if (arg_c... [truncated message content] |
From: Lee W. <lw...@us...> - 2003-05-27 13:44:34
|
Update of /cvsroot/libsysio/libsysio In directory sc8-pr-cvs1:/tmp/cvs-serv30332 Modified Files: Tag: RedStorm README Log Message: Tests supported now. Found getopt() decl. Index: README =================================================================== RCS file: /cvsroot/libsysio/libsysio/README,v retrieving revision 1.2.12.1 retrieving revision 1.2.12.2 diff -u -w -b -B -p -r1.2.12.1 -r1.2.12.2 --- README 19 May 2003 13:51:20 -0000 1.2.12.1 +++ README 27 May 2003 13:44:30 -0000 1.2.12.2 @@ -63,8 +63,4 @@ The following works for me: export CFLAGS="-DREDSTORM -nostdinc -isystem /home/lee/REDSTORM/catamount/computeincs/i386 -isystem /home/lee/REDSTORM/catamount/include -g -W -Wall -ansi" -# No tests until the compute libraries include support for getopt! -sh configure --with-autmount=".mount" --with-native=yes --with-incore-yes --with-stdfd=yes --with-tests=no - -Support for getopt is supposed to be coming soon. The tests can be reenabled -when that happens, I hope. +sh configure --with-autmount=".mount" --with-native=yes --with-incore-yes --with-stdfd=yes --with-tests=yes |
From: Lee W. <lw...@us...> - 2003-05-27 12:58:50
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1:/tmp/cvs-serv9677 Modified Files: Tag: RedStorm test_copy.c test_getcwd.c test_list.c test_mounts.c test_path.c test_stats.c test_stdfd.c Log Message: RedStorm (BSD-based) declares getopt in unistd.h. There is no separate getopt.h include. Index: test_copy.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_copy.c,v retrieving revision 1.5 retrieving revision 1.5.6.1 diff -u -w -b -B -p -r1.5 -r1.5.6.1 --- test_copy.c 24 Mar 2003 22:09:49 -0000 1.5 +++ test_copy.c 27 May 2003 12:58:47 -0000 1.5.6.1 @@ -46,7 +46,9 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#ifndef REDSTORM #include <getopt.h> +#endif #include <errno.h> #include <sys/types.h> #include <sys/stat.h> Index: test_getcwd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_getcwd.c,v retrieving revision 1.1 retrieving revision 1.1.10.1 diff -u -w -b -B -p -r1.1 -r1.1.10.1 --- test_getcwd.c 9 Mar 2003 16:58:41 -0000 1.1 +++ test_getcwd.c 27 May 2003 12:58:47 -0000 1.1.10.1 @@ -44,7 +44,11 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#ifndef REDSTORM #include <getopt.h> +#else +#include <unistd.h> +#endif #include <errno.h> #include <sys/types.h> #include <sys/stat.h> Index: test_list.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_list.c,v retrieving revision 1.4 retrieving revision 1.4.6.1 diff -u -w -b -B -p -r1.4 -r1.4.6.1 --- test_list.c 24 Mar 2003 22:09:49 -0000 1.4 +++ test_list.c 27 May 2003 12:58:47 -0000 1.4.6.1 @@ -44,7 +44,11 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#ifndef REDSTORM #include <getopt.h> +#else +#include <unistd.h> +#endif #include <errno.h> #include <sys/types.h> #include <sys/stat.h> @@ -200,10 +204,9 @@ listit(const char *path) while ((cc = getdirentries(fd, (char *)buf, n, &base)) > 0) { dp = buf; while (cc > 0) { - (void )printf("\t%s: ino %llu off %llu type %u\n", + (void )printf("\t%s: ino %llu type %u\n", dp->d_name, (unsigned long long )dp->d_ino, - (unsigned long long )dp->d_off, (int )dp->d_type); cc -= dp->d_reclen; dp = (void *)dp + dp->d_reclen; Index: test_mounts.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_mounts.c,v retrieving revision 1.3 retrieving revision 1.3.10.1 diff -u -w -b -B -p -r1.3 -r1.3.10.1 --- test_mounts.c 9 Mar 2003 16:57:47 -0000 1.3 +++ test_mounts.c 27 May 2003 12:58:47 -0000 1.3.10.1 @@ -44,7 +44,11 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#ifndef REDSTORM #include <getopt.h> +#else +#include <unistd.h> +#endif #include <errno.h> #include <assert.h> Index: test_path.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_path.c,v retrieving revision 1.3 retrieving revision 1.3.10.1 diff -u -w -b -B -p -r1.3 -r1.3.10.1 --- test_path.c 9 Mar 2003 16:57:47 -0000 1.3 +++ test_path.c 27 May 2003 12:58:47 -0000 1.3.10.1 @@ -44,7 +44,11 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#ifndef REDSTORM #include <getopt.h> +#else +#include <unistd.h> +#endif #include <errno.h> #include <assert.h> Index: test_stats.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_stats.c,v retrieving revision 1.3.10.1 retrieving revision 1.3.10.2 diff -u -w -b -B -p -r1.3.10.1 -r1.3.10.2 --- test_stats.c 27 May 2003 12:37:53 -0000 1.3.10.1 +++ test_stats.c 27 May 2003 12:58:47 -0000 1.3.10.2 @@ -46,13 +46,17 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#ifndef REDSTORM #include <getopt.h> +#endif #include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/queue.h> +#ifdef notdef #include <sys/statvfs.h> +#endif #include "sysio.h" #include "mount.h" @@ -152,7 +156,9 @@ do_stats(const char *path) int fd; int err; struct stat stbuf1, stbuf2; +#ifdef notdef struct statvfs stvfsbuf1, stvfsbuf2; +#endif fd = open(path, O_RDONLY); if (fd < 0) { @@ -162,10 +168,12 @@ do_stats(const char *path) err = fstat(fd, &stbuf1); if (!err) err = stat(path, &stbuf2); +#ifdef notdef if (!err) err = fstatvfs(fd, &stvfsbuf1); if (!err) err = statvfs(path, &stvfsbuf1); +#endif if (err) { perror(path); goto out; @@ -175,9 +183,11 @@ do_stats(const char *path) (void )fprintf(stderr, "%s: [f]stat info mismatch\n", path); goto out; } +#ifdef notdef if (stvfsbuf1.f_fsid != stvfsbuf2.f_fsid) { (void )fprintf(stderr, "%s: [f]statvfs info mismatch\n", path); } +#endif printf("%s:" " dev %lu," " ino %lu," Index: test_stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_stdfd.c,v retrieving revision 1.2 retrieving revision 1.2.6.1 diff -u -w -b -B -p -r1.2 -r1.2.6.1 --- test_stdfd.c 24 Mar 2003 22:09:49 -0000 1.2 +++ test_stdfd.c 27 May 2003 12:58:47 -0000 1.2.6.1 @@ -49,7 +49,9 @@ #include <stdlib.h> #include <unistd.h> #include <string.h> +#ifndef REDSTORM #include <getopt.h> +#endif #include <errno.h> #include <assert.h> #include <sys/queue.h> |
From: Lee W. <lw...@us...> - 2003-05-27 12:37:56
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1:/tmp/cvs-serv550/tests Modified Files: Tag: RedStorm test_stats.c Log Message: Support automount option, fully. Don't just *say* it's supported. Index: test_stats.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_stats.c,v retrieving revision 1.3 retrieving revision 1.3.10.1 diff -u -w -b -B -p -r1.3 -r1.3.10.1 --- test_stats.c 9 Mar 2003 16:57:47 -0000 1.3 +++ test_stats.c 27 May 2003 12:37:53 -0000 1.3.10.1 @@ -72,6 +72,14 @@ unsigned mntflgs = 0; void usage(void); void do_stats(const char *path); +#ifdef AUTOMOUNT_FILE_NAME +#define EXTRA_AUTOMOUNT_OPT "a" +#else +#define EXTRA_AUTOMOUNT_OPT +#endif + +const char *opts = EXTRA_AUTOMOUNT_OPT "m:r:"; + int main(int argc, char * const argv[]) { @@ -81,7 +89,7 @@ main(int argc, char * const argv[]) /* * Parse command-line args. */ - while ((i = getopt(argc, argv, "i:m:")) != -1) + while ((i = getopt(argc, argv, opts)) != -1) switch (i) { #ifdef AUTOMOUNT_FILE_NAME |
From: Lee W. <lw...@us...> - 2003-05-27 12:37:03
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1:/tmp/cvs-serv32714/tests Modified Files: Tag: RedStorm Makefile.am Log Message: Merge from main branch... Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Makefile.am,v retrieving revision 1.8 retrieving revision 1.8.6.1 diff -u -w -b -B -p -r1.8 -r1.8.6.1 --- Makefile.am 24 Mar 2003 22:09:49 -0000 1.8 +++ Makefile.am 27 May 2003 12:37:00 -0000 1.8.6.1 @@ -84,8 +84,8 @@ test_stdfd_DEPENDENCIES=$(LIBS) EXTRA_DIST=gendrvdata.sh test.h -drv_data.c: $(CONFIG_DEPENDENCIES) gendrvdata.sh +drv_data.c: $(CONFIG_DEPENDENCIES) $(top_srcdir)/tests/gendrvdata.sh test -z "drv_data.c" && rm -f drv_data.c; \ - $(SHELL) gendrvdata.sh $(DRIVERS) > drv_data.c + $(SHELL) $(top_srcdir)/tests/gendrvdata.sh $(DRIVERS) > drv_data.c include $(top_srcdir)/Rules.make |
From: Lee W. <lw...@us...> - 2003-05-27 12:36:04
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1:/tmp/cvs-serv32136/drivers/native Modified Files: Tag: RedStorm fs_native.c Log Message: IO into a regular file is permissible. How *did* this happen? Geez! Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.11.4.3 retrieving revision 1.11.4.4 diff -u -w -b -B -p -r1.11.4.3 -r1.11.4.4 --- fs_native.c 19 May 2003 14:26:31 -0000 1.11.4.3 +++ fs_native.c 27 May 2003 12:35:55 -0000 1.11.4.4 @@ -1067,7 +1067,8 @@ doio(ssize_t (*f)(int, const struct iove return -ENOMEM; if ((ioargs->ioarg_iovlen && (int )ioargs->ioarg_iovlen < 0) || - !(S_ISCHR(ino->i_mode) || + !(S_ISREG(ino->i_mode) || + S_ISCHR(ino->i_mode) || S_ISSOCK(ino->i_mode) || S_ISFIFO(ino->i_mode))) return -EINVAL; |