[Libsysio-commit] b_lustre: libsysio/src chmod.c fcntl.c inode.c read.c write.c
Brought to you by:
lward
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); } |