Thread: [Libsysio-commit] HEAD: libsysio/drivers/yod fs_yod.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2003-10-13 01:04:43
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1:/tmp/cvs-serv31768/drivers/yod Modified Files: fs_yod.c Log Message: The IO context record supported one call-back. It now supports a chain. This was changed to accommodate the Sandia-PVFS driver. Also, it's needed for the, coming, {read,write}_strided calls. To add a callback to the chain use: _sysio_ioctx_cb(struct ioctx *ioctx, void (*func)(struct ioctx *, void *), void *data) Callbacks are added to the end of the existing chain. When called, by _sysio_io_complete, they are run in order. So... If you're freeing things using callbacks be careful not to depend on something in a later callback that you previously free'd. Also, _sysio_io_complete no longer waits for the driver. To call this, now, is to signal completion. Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -b -B -p -r1.2 -r1.3 --- fs_yod.c 14 Aug 2003 18:39:33 -0000 1.2 +++ fs_yod.c 13 Oct 2003 01:04:34 -0000 1.3 @@ -169,11 +169,9 @@ static int yod_inop_open(struct pnode *p static int yod_inop_close(struct inode *ino); static int yod_inop_unlink(struct pnode *pno); static int yod_inop_ipreadv(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp); + struct ioctx *ioctx); static int yod_inop_ipwritev(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp); + struct ioctx *ioctx); static int yod_inop_iodone(struct ioctx *ioctx); static int yod_inop_fcntl(struct inode *ino, int cmd, va_list ap); static int yod_inop_sync(struct inode *ino); @@ -958,26 +956,17 @@ yod_inop_unlink(struct pnode *pno) static int doio(ssize_t (*f)(int, const struct iovec *, int), struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp) + struct ioctx *ioctx) { struct yod_inode *nino = I2NI(ino); - struct ioctx *ioctx; loff_t result; assert(nino->ni_fd >= 0); - if (ioargs->ioarg_iovlen && (int )ioargs->ioarg_iovlen < 0) + if (ioctx->ioctx_iovlen && (int )ioctx->ioctx_iovlen < 0) return -EINVAL; /* - * Get a new IO context. - */ - ioctx = _sysio_ioctx_new(ino, ioargs); - if (!ioctx) - return -ENOMEM; - - /* * This implementation first positions the real system descriptor, then * performs the operation. This is silly because it's not atomic. * @@ -1013,7 +1002,6 @@ doio(ssize_t (*f)(int, const struct iove nino->ni_fpos += ioctx->ioctx_cc; } - *ioctxp = ioctx; return 0; } @@ -1030,11 +1018,10 @@ _readv(int fd, const struct iovec *vecto static int yod_inop_ipreadv(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp) + struct ioctx *ioctx) { - return doio(_readv, ino, ioargs, ioctxp); + return doio(_readv, ino, ioctx); } /* @@ -1055,11 +1042,10 @@ _writev(int fd, const struct iovec *vect static int yod_inop_ipwritev(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp) + struct ioctx *ioctx) { - return doio(_writev, ino, ioargs, ioctxp); + return doio(_writev, ino, ioctx); } static int |
From: Lee W. <lw...@us...> - 2003-10-15 18:01:01
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1:/tmp/cvs-serv9577/drivers/yod Modified Files: fs_yod.c Log Message: Eliminated the i-node number field from the inode structure. We already carry the file identifier so it was redundant. Problematic too, in that it can be 32 or 64 bits in size. This forced _sysio_i_new() and _sysio_i_find() to change -- They no longer take the i-node number as an argument. Updated the driver calls to reflect the new usage. The i-node cache is now indexed by hashing the file identifier as opposed to just using the, no longer maintained, i-node number. This caused _sysio_i_find to become 2+ percent more expensive to use. Acceptable for me. Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -b -B -p -r1.3 -r1.4 --- fs_yod.c 13 Oct 2003 01:04:34 -0000 1.3 +++ fs_yod.c 15 Oct 2003 18:00:55 -0000 1.4 @@ -297,7 +297,6 @@ yod_i_new(struct filesys *fs, struct int nino->ni_fpos = 0; ino = _sysio_i_new(fs, - buf->st_ino, &nino->ni_fileid, #ifndef AUTOMOUNT_FILE_NAME buf->st_mode & S_IFMT, @@ -539,7 +538,7 @@ yod_iget(struct filesys *fs, #endif fileid.fid_data = &ident; fileid.fid_len = sizeof(ident); - ino = _sysio_i_find(fs, stbuf.st_ino, &fileid); + ino = _sysio_i_find(fs, &fileid); if (ino && forced) { /* * Insertion was forced but it's already present! |
From: Lee W. <lw...@us...> - 2003-10-17 21:30:33
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1:/tmp/cvs-serv10931/drivers/yod Modified Files: fs_yod.c Log Message: Added a done bit to the IO context record to *positively* signal completion. Also, added a driver private pointer to the dsame record for handy use. Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- fs_yod.c 15 Oct 2003 18:00:55 -0000 1.4 +++ fs_yod.c 17 Oct 2003 21:30:29 -0000 1.5 @@ -1001,6 +1001,7 @@ doio(ssize_t (*f)(int, const struct iove nino->ni_fpos += ioctx->ioctx_cc; } + ioctx->ioctx_done = 1; return 0; } |
From: Lee W. <lw...@us...> - 2003-10-20 17:06:44
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1:/tmp/cvs-serv9788/yod Modified Files: fs_yod.c Log Message: From Ruth Klundt; If a file is opened twice the first close destroys the file descriptor in the low-level driver. Further use by the second, then, will get EBADF or, on close, aborts. Why was the open ref count code ifdef'd out? I did it and can't for the life of me recall why. Anyway, it's back now. Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -b -B -p -r1.6 -r1.7 --- fs_yod.c 20 Oct 2003 16:34:00 -0000 1.6 +++ fs_yod.c 20 Oct 2003 16:44:36 -0000 1.7 @@ -144,9 +144,7 @@ struct yod_inode { struct file_identifier ni_fileid; /* ditto */ int ni_fd; /* host fildes */ int ni_oflags; /* flags, from open */ -#if 0 unsigned ni_nopens; /* soft ref count */ -#endif off_t ni_fpos; /* current pos */ }; @@ -303,9 +301,7 @@ yod_i_new(struct filesys *fs, struct int nino->ni_fileid.fid_len = sizeof(nino->ni_ident); nino->ni_fd = -1; nino->ni_oflags = 0; -#if 0 nino->ni_nopens = 0; -#endif nino->ni_fpos = 0; ino = _sysio_i_new(fs, @@ -876,10 +872,8 @@ yod_inop_open(struct pnode *pno, int fla * Remember this new open. */ nino = I2NI(pno->p_base->pb_ino); -#if 0 nino->ni_nopens++; assert(nino->ni_nopens); -#endif if (nino->ni_fd >= 0) { if ((nino->ni_oflags & O_RDWR) || @@ -910,14 +904,12 @@ yod_inop_close(struct inode *ino) if (nino->ni_fd < 0) abort(); -#if 0 - assert(nino->ni_nopens); - if (--nino->ni_nopens) - return 0; -#endif err = close_yod(nino->ni_fd); if (err) return -errno; + assert(nino->ni_nopens); + if (--nino->ni_nopens) + return 0; nino->ni_fd = -1; nino->ni_fpos = 0; return 0; |
From: Ruth K. <rk...@us...> - 2003-11-12 21:51:44
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1:/tmp/cvs-serv16720 Modified Files: fs_yod.c Log Message: close yod fd once after all refs are gone, duplicate of fix to native driver Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- fs_yod.c 20 Oct 2003 16:44:36 -0000 1.7 +++ fs_yod.c 12 Nov 2003 21:51:40 -0000 1.8 @@ -904,12 +904,14 @@ yod_inop_close(struct inode *ino) if (nino->ni_fd < 0) abort(); - err = close_yod(nino->ni_fd); - if (err) - return -errno; assert(nino->ni_nopens); if (--nino->ni_nopens) return 0; + + err = close_yod(nino->ni_fd); + if (err) + return -errno; + nino->ni_fd = -1; nino->ni_fpos = 0; return 0; |
From: Ruth K. <rk...@us...> - 2004-01-12 18:09:49
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1:/tmp/cvs-serv4997 Modified Files: fs_yod.c Log Message: add native driver changes to yod driver Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- fs_yod.c 12 Nov 2003 21:51:40 -0000 1.8 +++ fs_yod.c 12 Jan 2004 18:09:44 -0000 1.9 @@ -987,7 +987,11 @@ doio(ssize_t (*f)(int, const struct iove assert(nino->ni_fd >= 0); - if (ioctx->ioctx_iovlen && (int )ioctx->ioctx_iovlen < 0) + if ((ioctx->ioctx_iovlen && (int )ioctx->ioctx_iovlen < 0) || + !(S_ISREG(ino->i_mode) || + S_ISCHR(ino->i_mode) || + S_ISSOCK(ino->i_mode) || + S_ISFIFO(ino->i_mode))) return -EINVAL; /* @@ -1002,30 +1006,29 @@ doio(ssize_t (*f)(int, const struct iove * Avoid the reposition call if we're already at the right place. * Allows us to access pipes and fifos. */ - result = nino->ni_fpos; - if (ioctx->ioctx_offset != nino->ni_fpos && - !(S_ISCHR(ino->i_mode) || - S_ISSOCK(ino->i_mode) || - S_ISFIFO(ino->i_mode)) && - (result = lseek_yod(nino->ni_fd, + result = ioctx->ioctx_offset; + if (ioctx->ioctx_offset != nino->ni_fpos) { + result = lseek_yod(nino->ni_fd, ioctx->ioctx_offset, - SEEK_SET) == -1)) { + SEEK_SET); + if (result == -1) { ioctx->ioctx_cc = -1; ioctx->ioctx_errno = errno; - } else { + goto out; + } + nino->ni_fpos = result; + } /* * Call the appropriate (read/write) IO function to * transfer the data now. */ - nino->ni_fpos = result; ioctx->ioctx_cc = (*f)(nino->ni_fd, ioctx->ioctx_iovec, ioctx->ioctx_iovlen); if (ioctx->ioctx_cc < 0) ioctx->ioctx_errno = errno; if (ioctx->ioctx_cc > 0) nino->ni_fpos += ioctx->ioctx_cc; - } - +out: ioctx->ioctx_done = 1; return 0; } |
From: Ruth K. <rk...@us...> - 2004-01-15 20:27:44
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1:/tmp/cvs-serv9456 Modified Files: fs_yod.c Log Message: symlink args order on yod driver was wrong Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -b -B -p -r1.9 -r1.10 --- fs_yod.c 12 Jan 2004 18:09:44 -0000 1.9 +++ fs_yod.c 15 Jan 2004 20:27:40 -0000 1.10 @@ -808,7 +808,7 @@ yod_inop_symlink(struct pnode *pno, cons if (!path) return -ENOMEM; - err = symlink_yod(path, data); + err = symlink_yod(data, path); free(path); return err; } |
From: Lee W. <lw...@us...> - 2004-02-25 16:39:06
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23863/drivers/yod Modified Files: fs_yod.c Log Message: All mode bit masks were incorrect. Need to preserve ISUID, ISGID, ISVTX bits. Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -b -B -p -r1.10 -r1.11 --- fs_yod.c 15 Jan 2004 20:27:40 -0000 1.10 +++ fs_yod.c 25 Feb 2004 16:23:59 -0000 1.11 @@ -689,7 +689,7 @@ yod_inop_setattr(struct pnode *pno, /* * Alter permissions attribute. */ - mode = stbuf->st_mode & 0777; + mode = stbuf->st_mode & 07777; err = chmod_yod(path, mode); } if (err) @@ -734,7 +734,7 @@ yod_inop_setattr(struct pnode *pno, : (gid_t )-1); } if (mask & SETATTR_MODE) { - chmod_yod(path, st.st_mode & 0777); + chmod_yod(path, st.st_mode & 07777); } out: if (path) |
From: Lee W. <lw...@us...> - 2004-04-16 20:38:42
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30430/drivers/yod Modified Files: fs_yod.c Log Message: New operation for the drivers to implement -- take note! The drivers now need to implement inop_pos which takes an inode and a _SYSIO_OFF_T and should return the resulting position as though it were lseek(FD2INO(fd), off, SEEK_SET). As usual a negative return value is the negated errno. Lseek is altered to use this. Changes in fs_native.c to utilize pread/pwrite whenever positioning is required instead of an lseek/io-op pair of calls. This addresses a race to yod. Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -b -B -p -r1.11 -r1.12 --- fs_yod.c 25 Feb 2004 16:23:59 -0000 1.11 +++ fs_yod.c 16 Apr 2004 20:38:34 -0000 1.12 @@ -176,6 +176,8 @@ static int yod_inop_ipreadv(struct inode struct ioctx *ioctx); static int yod_inop_ipwritev(struct inode *ino, struct ioctx *ioctx); +#define yod_inop_pos(ino, off) \ + (_SYSIO_OFF_T (*)(struct inode *, _SYSIO_OFF_T))_sysio_do_espipe static int yod_inop_iodone(struct ioctx *ioctx); static int yod_inop_fcntl(struct inode *ino, int cmd, va_list ap); static int yod_inop_sync(struct inode *ino); @@ -207,6 +209,7 @@ static struct inode_ops yod_i_ops = { yod_inop_rename, yod_inop_ipreadv, yod_inop_ipwritev, + yod_inop_pos, yod_inop_iodone, yod_inop_fcntl, yod_inop_sync, |
From: Ruth K. <rk...@us...> - 2004-04-19 21:43:17
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19173 Modified Files: fs_yod.c Log Message: yod driver changes for strided I/O and inop_pos Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -b -B -p -r1.12 -r1.13 --- fs_yod.c 16 Apr 2004 20:38:34 -0000 1.12 +++ fs_yod.c 19 Apr 2004 21:43:08 -0000 1.13 @@ -140,12 +140,13 @@ struct yod_inode_identifier { * system objects. */ struct yod_inode { + unsigned ni_seekok : 1; /* can seek? */ struct yod_inode_identifier ni_ident; /* unique identifier */ struct file_identifier ni_fileid; /* ditto */ int ni_fd; /* host fildes */ int ni_oflags; /* flags, from open */ unsigned ni_nopens; /* soft ref count */ - off_t ni_fpos; /* current pos */ + _SYSIO_OFF_T ni_fpos; /* current pos */ }; static int yod_inop_lookup(struct pnode *pno, @@ -172,12 +173,9 @@ static int yod_inop_close(struct inode * static int yod_inop_link(struct pnode *old, struct pnode *new); static int yod_inop_unlink(struct pnode *pno); static int yod_inop_rename(struct pnode *old, struct pnode *new); -static int yod_inop_ipreadv(struct inode *ino, - struct ioctx *ioctx); -static int yod_inop_ipwritev(struct inode *ino, - struct ioctx *ioctx); -#define yod_inop_pos(ino, off) \ - (_SYSIO_OFF_T (*)(struct inode *, _SYSIO_OFF_T))_sysio_do_espipe +static _SYSIO_OFF_T yod_inop_pos (struct inode *ino, _SYSIO_OFF_T off); +static int yod_inop_read(struct inode *ino, struct ioctx *ioctx); +static int yod_inop_write(struct inode *ino, struct ioctx *ioctx); static int yod_inop_iodone(struct ioctx *ioctx); static int yod_inop_fcntl(struct inode *ino, int cmd, va_list ap); static int yod_inop_sync(struct inode *ino); @@ -186,6 +184,12 @@ static int yod_inop_ioctl(struct inode * unsigned long int request, va_list ap); static int yod_inop_mknod(struct pnode *pno, mode_t mode, dev_t dev); +static void *yod_inop_mmap(struct inode *ino, + void *start, + size_t length, + int prot, + int flags, + _SYSIO_OFF_T offset); #ifdef _HAVE_STATVFS static int yod_inop_statvfs(struct pnode *pno, struct inode *ino, @@ -207,8 +211,8 @@ static struct inode_ops yod_i_ops = { yod_inop_link, yod_inop_unlink, yod_inop_rename, - yod_inop_ipreadv, - yod_inop_ipwritev, + yod_inop_read, + yod_inop_write, yod_inop_pos, yod_inop_iodone, yod_inop_fcntl, @@ -895,6 +899,13 @@ yod_inop_open(struct pnode *pno, int fla nino->ni_fpos = 0; nino->ni_fd = fd; + /* + * Need to know whether we can seek on this + * descriptor. + */ + nino->ni_seekok = + lseek_yod(nino->ni_fd, 0, SEEK_CUR) != 0 ? 0 : 1; + return 0; } @@ -981,75 +992,55 @@ yod_inop_unlink(struct pnode *pno) * now. */ static int -doio(ssize_t (*f)(int, const struct iovec *, int), - struct inode *ino, +doio(ssize_t (*f)(void *, size_t, _SYSIO_OFF_T, struct yod_inode *), struct ioctx *ioctx) { - struct yod_inode *nino = I2NI(ino); - loff_t result; - - assert(nino->ni_fd >= 0); - - if ((ioctx->ioctx_iovlen && (int )ioctx->ioctx_iovlen < 0) || - !(S_ISREG(ino->i_mode) || - S_ISCHR(ino->i_mode) || - S_ISSOCK(ino->i_mode) || - S_ISFIFO(ino->i_mode))) - return -EINVAL; + struct yod_inode *nino = I2NI(ioctx->ioctx_ino); + if (ioctx->ioctx_xtvlen != 1) { /* - * This implementation first positions the real system descriptor, then - * performs the operation. This is silly because it's not atomic. - * - * An alternative, more complex, less efficient but atomic, - * implementation might consider each entry of the iovec separately. - * Then, the system implementations of the POSIX p{reaad,write} calls - * could be used. - * - * Avoid the reposition call if we're already at the right place. - * Allows us to access pipes and fifos. + * No scatter/gather supported in yod I/O */ - result = ioctx->ioctx_offset; - if (ioctx->ioctx_offset != nino->ni_fpos) { - result = lseek_yod(nino->ni_fd, - ioctx->ioctx_offset, - SEEK_SET); - if (result == -1) { - ioctx->ioctx_cc = -1; - ioctx->ioctx_errno = errno; - goto out; - } - nino->ni_fpos = result; + return -EINVAL; } - /* - * Call the appropriate (read/write) IO function to - * transfer the data now. - */ + ioctx->ioctx_cc = - (*f)(nino->ni_fd, ioctx->ioctx_iovec, ioctx->ioctx_iovlen); - if (ioctx->ioctx_cc < 0) - ioctx->ioctx_errno = errno; - if (ioctx->ioctx_cc > 0) + _sysio_doio(ioctx->ioctx_xtv, ioctx->ioctx_xtvlen, + ioctx->ioctx_iov, ioctx->ioctx_iovlen, + (ssize_t (*)(void *, size_t, _SYSIO_OFF_T, void *))f, + nino); + if (ioctx->ioctx_cc < 0) { + ioctx->ioctx_errno = -ioctx->ioctx_cc; + ioctx->ioctx_cc = -1; + return -1; + } nino->ni_fpos += ioctx->ioctx_cc; -out: ioctx->ioctx_done = 1; return 0; } -/* - * Helper function passed to doio(), above, to accomplish a real readv. - */ static ssize_t -_readv(int fd, const struct iovec *vector, int count) +yod_read_simple(void *buf, + size_t nbytes, + _SYSIO_OFF_T off, + struct yod_inode *nino) { - int i; - ssize_t total = 0; + if (off != nino->ni_fpos) { + _SYSIO_OFF_T rtn; - for (i = 0; i < count; i++) - total += read_yod(fd, - vector[i].iov_base, - vector[i].iov_len); - return total; + rtn = lseek_yod(nino->ni_fd, off, SEEK_SET); + if (rtn < 0) + return -1; + nino->ni_fpos = rtn; + } + return read_yod(nino->ni_fd, buf, nbytes); +} + +static int +yod_inop_read(struct inode *ino __IS_UNUSED, struct ioctx *ioctx) +{ + + return doio(yod_read_simple, ioctx); } static int @@ -1076,36 +1067,39 @@ out: return err; } -static int -yod_inop_ipreadv(struct inode *ino, - struct ioctx *ioctx) +static ssize_t +yod_write_simple(void *buf, + size_t nbytes, + _SYSIO_OFF_T off, + struct yod_inode *nino) { - return doio(_readv, ino, ioctx); + if (off != nino->ni_fpos) { + _SYSIO_OFF_T rtn; + + rtn = lseek_yod(nino->ni_fd, off, SEEK_SET); + if (rtn < 0) + return -1; + nino->ni_fpos = rtn; + } + return write_yod(nino->ni_fd, buf, nbytes); } -/* - * Helper function passed to doio(), above, to accomplish a real writev. - */ -static ssize_t -_writev(int fd, const struct iovec *vector, int count) +static int +yod_inop_write(struct inode *ino __IS_UNUSED, struct ioctx *ioctx) { - int i; - ssize_t total = 0; - for (i = 0; i < count; i++) - total += write_yod(fd, - vector[i].iov_base, - vector[i].iov_len); - return total; + return doio(yod_write_simple, ioctx); } -static int -yod_inop_ipwritev(struct inode *ino, - struct ioctx *ioctx) +static _SYSIO_OFF_T +yod_inop_pos(struct inode *ino, _SYSIO_OFF_T off) { + struct yod_inode *nino = I2NI(ino); + int err; - return doio(_writev, ino, ioctx); + err = lseek_yod(nino->ni_fd, off, SEEK_SET); + return err < 0 ? err : off; } static int @@ -1240,3 +1234,14 @@ yod_fsop_gone(struct filesys *fs __IS_UN * yod file interface. */ } + +static void * +yod_inop_mmap(struct inode *ino __IS_UNUSED, + void *start __IS_UNUSED, + size_t length __IS_UNUSED, + int prot __IS_UNUSED, + int flags __IS_UNUSED, + _SYSIO_OFF_T offset __IS_UNUSED) +{ + return (void *)-ENOSYS; +} |
From: Ruth K. <rk...@us...> - 2004-04-19 21:54:06
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21205 Modified Files: fs_yod.c Log Message: yod driver changes for strided I/O and inop_pos Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -b -B -p -r1.12 -r1.13 --- fs_yod.c 16 Apr 2004 20:38:34 -0000 1.12 +++ fs_yod.c 19 Apr 2004 21:53:57 -0000 1.13 @@ -140,12 +140,13 @@ struct yod_inode_identifier { * system objects. */ struct yod_inode { + unsigned ni_seekok : 1; /* can seek? */ struct yod_inode_identifier ni_ident; /* unique identifier */ struct file_identifier ni_fileid; /* ditto */ int ni_fd; /* host fildes */ int ni_oflags; /* flags, from open */ unsigned ni_nopens; /* soft ref count */ - off_t ni_fpos; /* current pos */ + _SYSIO_OFF_T ni_fpos; /* current pos */ }; static int yod_inop_lookup(struct pnode *pno, @@ -172,12 +173,9 @@ static int yod_inop_close(struct inode * static int yod_inop_link(struct pnode *old, struct pnode *new); static int yod_inop_unlink(struct pnode *pno); static int yod_inop_rename(struct pnode *old, struct pnode *new); -static int yod_inop_ipreadv(struct inode *ino, - struct ioctx *ioctx); -static int yod_inop_ipwritev(struct inode *ino, - struct ioctx *ioctx); -#define yod_inop_pos(ino, off) \ - (_SYSIO_OFF_T (*)(struct inode *, _SYSIO_OFF_T))_sysio_do_espipe +static _SYSIO_OFF_T yod_inop_pos (struct inode *ino, _SYSIO_OFF_T off); +static int yod_inop_read(struct inode *ino, struct ioctx *ioctx); +static int yod_inop_write(struct inode *ino, struct ioctx *ioctx); static int yod_inop_iodone(struct ioctx *ioctx); static int yod_inop_fcntl(struct inode *ino, int cmd, va_list ap); static int yod_inop_sync(struct inode *ino); @@ -207,8 +205,8 @@ static struct inode_ops yod_i_ops = { yod_inop_link, yod_inop_unlink, yod_inop_rename, - yod_inop_ipreadv, - yod_inop_ipwritev, + yod_inop_read, + yod_inop_write, yod_inop_pos, yod_inop_iodone, yod_inop_fcntl, @@ -895,6 +893,13 @@ yod_inop_open(struct pnode *pno, int fla nino->ni_fpos = 0; nino->ni_fd = fd; + /* + * Need to know whether we can seek on this + * descriptor. + */ + nino->ni_seekok = + lseek_yod(nino->ni_fd, 0, SEEK_CUR) != 0 ? 0 : 1; + return 0; } @@ -981,75 +986,55 @@ yod_inop_unlink(struct pnode *pno) * now. */ static int -doio(ssize_t (*f)(int, const struct iovec *, int), - struct inode *ino, +doio(ssize_t (*f)(void *, size_t, _SYSIO_OFF_T, struct yod_inode *), struct ioctx *ioctx) { - struct yod_inode *nino = I2NI(ino); - loff_t result; - - assert(nino->ni_fd >= 0); - - if ((ioctx->ioctx_iovlen && (int )ioctx->ioctx_iovlen < 0) || - !(S_ISREG(ino->i_mode) || - S_ISCHR(ino->i_mode) || - S_ISSOCK(ino->i_mode) || - S_ISFIFO(ino->i_mode))) - return -EINVAL; + struct yod_inode *nino = I2NI(ioctx->ioctx_ino); + if (ioctx->ioctx_xtvlen != 1) { /* - * This implementation first positions the real system descriptor, then - * performs the operation. This is silly because it's not atomic. - * - * An alternative, more complex, less efficient but atomic, - * implementation might consider each entry of the iovec separately. - * Then, the system implementations of the POSIX p{reaad,write} calls - * could be used. - * - * Avoid the reposition call if we're already at the right place. - * Allows us to access pipes and fifos. + * No scatter/gather supported in yod I/O */ - result = ioctx->ioctx_offset; - if (ioctx->ioctx_offset != nino->ni_fpos) { - result = lseek_yod(nino->ni_fd, - ioctx->ioctx_offset, - SEEK_SET); - if (result == -1) { - ioctx->ioctx_cc = -1; - ioctx->ioctx_errno = errno; - goto out; - } - nino->ni_fpos = result; + return -EINVAL; } - /* - * Call the appropriate (read/write) IO function to - * transfer the data now. - */ + ioctx->ioctx_cc = - (*f)(nino->ni_fd, ioctx->ioctx_iovec, ioctx->ioctx_iovlen); - if (ioctx->ioctx_cc < 0) - ioctx->ioctx_errno = errno; - if (ioctx->ioctx_cc > 0) + _sysio_doio(ioctx->ioctx_xtv, ioctx->ioctx_xtvlen, + ioctx->ioctx_iov, ioctx->ioctx_iovlen, + (ssize_t (*)(void *, size_t, _SYSIO_OFF_T, void *))f, + nino); + if (ioctx->ioctx_cc < 0) { + ioctx->ioctx_errno = -ioctx->ioctx_cc; + ioctx->ioctx_cc = -1; + return -1; + } nino->ni_fpos += ioctx->ioctx_cc; -out: ioctx->ioctx_done = 1; return 0; } -/* - * Helper function passed to doio(), above, to accomplish a real readv. - */ static ssize_t -_readv(int fd, const struct iovec *vector, int count) +yod_read_simple(void *buf, + size_t nbytes, + _SYSIO_OFF_T off, + struct yod_inode *nino) { - int i; - ssize_t total = 0; + if (off != nino->ni_fpos) { + _SYSIO_OFF_T rtn; - for (i = 0; i < count; i++) - total += read_yod(fd, - vector[i].iov_base, - vector[i].iov_len); - return total; + rtn = lseek_yod(nino->ni_fd, off, SEEK_SET); + if (rtn < 0) + return -1; + nino->ni_fpos = rtn; + } + return read_yod(nino->ni_fd, buf, nbytes); +} + +static int +yod_inop_read(struct inode *ino __IS_UNUSED, struct ioctx *ioctx) +{ + + return doio(yod_read_simple, ioctx); } static int @@ -1076,36 +1061,39 @@ out: return err; } -static int -yod_inop_ipreadv(struct inode *ino, - struct ioctx *ioctx) +static ssize_t +yod_write_simple(void *buf, + size_t nbytes, + _SYSIO_OFF_T off, + struct yod_inode *nino) { - return doio(_readv, ino, ioctx); + if (off != nino->ni_fpos) { + _SYSIO_OFF_T rtn; + + rtn = lseek_yod(nino->ni_fd, off, SEEK_SET); + if (rtn < 0) + return -1; + nino->ni_fpos = rtn; + } + return write_yod(nino->ni_fd, buf, nbytes); } -/* - * Helper function passed to doio(), above, to accomplish a real writev. - */ -static ssize_t -_writev(int fd, const struct iovec *vector, int count) +static int +yod_inop_write(struct inode *ino __IS_UNUSED, struct ioctx *ioctx) { - int i; - ssize_t total = 0; - for (i = 0; i < count; i++) - total += write_yod(fd, - vector[i].iov_base, - vector[i].iov_len); - return total; + return doio(yod_write_simple, ioctx); } -static int -yod_inop_ipwritev(struct inode *ino, - struct ioctx *ioctx) +static _SYSIO_OFF_T +yod_inop_pos(struct inode *ino, _SYSIO_OFF_T off) { + struct yod_inode *nino = I2NI(ino); + int err; - return doio(_writev, ino, ioctx); + err = lseek_yod(nino->ni_fd, off, SEEK_SET); + return err < 0 ? err : off; } static int |
From: Ruth K. <rk...@us...> - 2004-04-22 18:59:15
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29380 Modified Files: fs_yod.c Log Message: yod driver handles strided-io by serializing, don't need to disable it Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -b -B -p -r1.13 -r1.14 --- fs_yod.c 19 Apr 2004 21:53:57 -0000 1.13 +++ fs_yod.c 22 Apr 2004 18:59:04 -0000 1.14 @@ -991,17 +991,11 @@ doio(ssize_t (*f)(void *, size_t, _SYSIO { struct yod_inode *nino = I2NI(ioctx->ioctx_ino); - if (ioctx->ioctx_xtvlen != 1) { - /* - * No scatter/gather supported in yod I/O - */ - return -EINVAL; - } - ioctx->ioctx_cc = _sysio_doio(ioctx->ioctx_xtv, ioctx->ioctx_xtvlen, ioctx->ioctx_iov, ioctx->ioctx_iovlen, - (ssize_t (*)(void *, size_t, _SYSIO_OFF_T, void *))f, + (ssize_t (*)(void *, size_t, + _SYSIO_OFF_T, void *))f, nino); if (ioctx->ioctx_cc < 0) { ioctx->ioctx_errno = -ioctx->ioctx_cc; |
From: Lee W. <lw...@us...> - 2004-07-03 05:47:21
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11075/drivers/yod Modified Files: fs_yod.c Log Message: A new, major change, to .../include/xtio.h. This is intended to be the include file for applications. It prototype all of the extended API available as well as the necessary structures. Other shanges to support this. We now need it most everywhere to build the library as well. Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -b -B -p -r1.14 -r1.15 --- fs_yod.c 22 Apr 2004 18:59:04 -0000 1.14 +++ fs_yod.c 3 Jul 2004 05:47:12 -0000 1.15 @@ -65,8 +65,8 @@ #endif #include <utime.h> #include <sys/queue.h> -#include <sys/uio.h> +#include "xtio.h" #include "sysio.h" #include "fs.h" #include "mount.h" |
From: Ruth K. <rk...@us...> - 2004-07-26 16:38:09
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10551/drivers/yod Modified Files: fs_yod.c Log Message: fcntl fixes: fcntl may return a positive or negative value. Driver function interfaces have been changed to accomodate a returned system call value in the arguments. The return value of the driver functions is 0 for success and -errno for failure. Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -b -B -p -r1.15 -r1.16 --- fs_yod.c 3 Jul 2004 05:47:12 -0000 1.15 +++ fs_yod.c 26 Jul 2004 16:38:00 -0000 1.16 @@ -1101,18 +1101,45 @@ yod_inop_iodone(struct ioctx *ioctxp __I } static int -yod_inop_fcntl(struct inode *ino __IS_UNUSED, int cmd, va_list ap __IS_UNUSED) +yod_inop_fcntl(struct inode *ino, int cmd, va_list ap, int *rtn) { - switch (cmd) - { - case F_DUPFD: /* do something to the ino */ + struct yod_inode *nino = I2NI(ino); + long arg; + int err; + + if (nino->ni_fd < 0) + abort(); + + err = 0; + switch (cmd) { + case F_GETFD: + case F_GETFL: +#ifdef F_GETOWN + case F_GETOWN: +#endif + *rtn = syscall(SYS_fcntl, nino->ni_fd, cmd); + if (*rtn == -1) + err = -errno; + break; + case F_DUPFD: + case F_SETFD: + case F_SETFL: + case F_GETLK: + case F_SETLK: + case F_SETLKW: +#ifdef F_SETOWN + case F_SETOWN: +#endif + arg = va_arg(ap, long); + *rtn = syscall(SYS_fcntl, nino->ni_fd, cmd, arg); + if (*rtn == -1) + err = -errno; break; default: - errno = EINVAL; - return -1; + *rtn = -1; + err = -EINVAL; } - return 0; - + return err; } static int |
From: Lee W. <lw...@us...> - 2004-07-26 17:10:30
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16922 Modified Files: fs_yod.c Log Message: Bad prototype for driver fcntl fixed. Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -w -b -B -p -r1.16 -r1.17 --- fs_yod.c 26 Jul 2004 16:38:00 -0000 1.16 +++ fs_yod.c 26 Jul 2004 17:10:15 -0000 1.17 @@ -177,7 +177,7 @@ static _SYSIO_OFF_T yod_inop_pos (struct static int yod_inop_read(struct inode *ino, struct ioctx *ioctx); static int yod_inop_write(struct inode *ino, struct ioctx *ioctx); static int yod_inop_iodone(struct ioctx *ioctx); -static int yod_inop_fcntl(struct inode *ino, int cmd, va_list ap); +static int yod_inop_fcntl(struct inode *ino, int cmd, va_list ap, int *rtn); static int yod_inop_sync(struct inode *ino); static int yod_inop_datasync(struct inode *ino); static int yod_inop_ioctl(struct inode *ino, |
From: Ruth K. <rk...@us...> - 2004-08-30 15:58:09
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24062/drivers/yod Modified Files: fs_yod.c Log Message: Changes to officially import directory functions into sysio. This is necessitated by the glibc >= 2.3 hidden attribute on getdents. (ifdef'd out for Red Storm build) Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -b -B -p -r1.17 -r1.18 --- fs_yod.c 26 Jul 2004 17:10:15 -0000 1.17 +++ fs_yod.c 30 Aug 2004 15:58:00 -0000 1.18 @@ -747,10 +747,10 @@ static ssize_t yod_getdirentries(struct inode *ino, char *buf, size_t nbytes, - off64_t *basep) + _SYSIO_OFF_T *basep) { struct yod_inode *nino = I2NI(ino); - loff_t result; + _SYSIO_OFF_T result; ssize_t cc; assert(nino->ni_fd >= 0); @@ -762,10 +762,11 @@ yod_getdirentries(struct inode *ino, SEEK_SET) == -1)) return -errno; nino->ni_fpos = result; + memset(buf, 0, nbytes); cc = getdirentries_yod(nino->ni_fd, buf, nbytes, &result); if (cc < 0) return -errno; - nino->ni_fpos += cc; + nino->ni_fpos = *basep = result; return cc; } |
From: Lee W. <lw...@us...> - 2004-09-21 16:18:39
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25715/drivers/yod Modified Files: fs_yod.c Log Message: From Henry Pierce at Cray; A chdir() to a directory without `x' permission should not succeed but does. This required that inodes now carry the full attributes -- Not just the mode bits. That's a bug change. Driver writers; 1) _sysio_i_new is altered. It needs the full intnl_stat structure now. 2) Your lookup function should refresh the inode attributes. 3) We don't keep an inode dirty bit. Hopefully, you've been pushing changes at the time of the operation instead of waiting until the inode was flushed or somesuch. Maybe you keep an internal dirty bit? Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -w -b -B -p -r1.18 -r1.19 --- fs_yod.c 30 Aug 2004 15:58:00 -0000 1.18 +++ fs_yod.c 21 Sep 2004 16:18:14 -0000 1.19 @@ -307,11 +307,7 @@ yod_i_new(struct filesys *fs, struct int ino = _sysio_i_new(fs, &nino->ni_fileid, -#ifndef AUTOMOUNT_FILE_NAME - buf->st_mode & S_IFMT, -#else buf->st_mode, /* all of the bits! */ -#endif 0, 0, &yod_i_ops, |
From: Ruth K. <rk...@us...> - 2004-09-27 20:21:09
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv848 Modified Files: fs_yod.c Log Message: modify yod driver to use new inode struct Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -w -b -B -p -r1.19 -r1.20 --- fs_yod.c 21 Sep 2004 16:18:14 -0000 1.19 +++ fs_yod.c 27 Sep 2004 20:20:58 -0000 1.20 @@ -293,6 +293,7 @@ yod_i_new(struct filesys *fs, struct int if (!nino) return NULL; bzero(&nino->ni_ident, sizeof(nino->ni_ident)); + nino->ni_seekok = 0; nino->ni_ident.dev = buf->st_dev; nino->ni_ident.ino = buf->st_ino; #ifdef HAVE_GENERATION @@ -307,8 +308,7 @@ yod_i_new(struct filesys *fs, struct int ino = _sysio_i_new(fs, &nino->ni_fileid, - buf->st_mode, /* all of the bits! */ - 0, + buf, 0, &yod_i_ops, nino); @@ -476,21 +476,22 @@ yod_fsswop_mount(const char *source, } static int -yod_i_invalid(struct inode *inop, struct intnl_stat stbuf) +yod_i_invalid(struct inode *inop, struct intnl_stat *stat) { /* * Validate passed in inode against stat struct info */ struct yod_inode *nino = I2NI(inop); - if ((nino->ni_ident.dev != stbuf.st_dev || - nino->ni_ident.ino != stbuf.st_ino || + if ((nino->ni_ident.dev != stat->st_dev || + nino->ni_ident.ino != stat->st_ino || #ifdef HAVE_GENERATION - nino->ni_ident.gen != stbuf.st_gen || + nino->ni_ident.gen != stat->st_gen || #endif - ((inop)->i_mode & S_IFMT) != (stbuf.st_mode & S_IFMT)) || - (((inop)->i_rdev != stbuf.st_rdev) && - (S_ISCHR((inop)->i_mode) || S_ISBLK((inop)->i_mode)))) + ((inop)->i_stbuf.st_mode & S_IFMT) != (stat->st_mode & S_IFMT)) || + (((inop)->i_stbuf.st_rdev != stat->st_rdev) && + (S_ISCHR((inop)->i_stbuf.st_mode) || + S_ISBLK((inop)->i_stbuf.st_mode)))) return 1; return 0; @@ -525,7 +526,7 @@ yod_iget(struct filesys *fs, * Validate? */ if (*inop) { - if (!yod_i_invalid(*inop, stbuf)) + if (!yod_i_invalid(*inop, &stbuf)) return 0; /* * Invalidate. @@ -549,7 +550,7 @@ yod_iget(struct filesys *fs, /* * Insertion was forced but it's already present! */ - if (yod_i_invalid(ino, stbuf)) { + if (yod_i_invalid(ino, &stbuf)) { /* * Cached inode has stale attrs * make way for the new one |
From: Lee W. <lw...@us...> - 2005-02-04 00:22:02
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9618/yod Modified Files: fs_yod.c Log Message: On a failed mount, an acquired FS was first released, then gone'd. The gone caused a double-free. Removed. Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -w -b -B -p -r1.20 -r1.21 --- fs_yod.c 27 Sep 2004 20:20:58 -0000 1.20 +++ fs_yod.c 4 Feb 2005 00:21:45 -0000 1.21 @@ -412,7 +412,6 @@ error: _sysio_pb_gone(rootpb); if (fs) { FS_RELE(fs); - _sysio_fs_gone(fs); } return err; |
From: Lee W. <lw...@us...> - 2005-08-04 20:17:19
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4518/drivers/yod Modified Files: fs_yod.c Log Message: Removed the internal getdirentries inode operation. The getdirentries function does not return the *next* block in it's basep argument. It simply return the cookie for the current block. We needed one that returns the *next*, so a new interface called filldirentries is present with this change. It takes, as it's second argument, a pointer to a value/result pair. The value should be set to the position to be read. The result is the position of the next block. All the included drivers have been updated. External drivers will require similar updates. Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -w -b -B -p -r1.21 -r1.22 --- fs_yod.c 4 Feb 2005 00:21:45 -0000 1.21 +++ fs_yod.c 4 Aug 2005 20:17:10 -0000 1.22 @@ -160,10 +160,10 @@ static int yod_inop_setattr(struct pnode struct inode *ino, unsigned mask, struct intnl_stat *stbuf); -static ssize_t yod_getdirentries(struct inode *ino, +static ssize_t yod_filldirentries(struct inode *ino, + off64_t *posp, char *buf, - size_t nbytes, - off64_t *basep); + size_t nbytes); static int yod_inop_mkdir(struct pnode *pno, mode_t mode); static int yod_inop_rmdir(struct pnode *pno); static int yod_inop_symlink(struct pnode *pno, const char *data); @@ -195,7 +195,7 @@ static struct inode_ops yod_i_ops = { yod_inop_lookup, yod_inop_getattr, yod_inop_setattr, - yod_getdirentries, + yod_filldirentries, yod_inop_mkdir, yod_inop_rmdir, yod_inop_symlink, @@ -740,10 +740,10 @@ out: } static ssize_t -yod_getdirentries(struct inode *ino, +yod_filldirentries(struct inode *ino, char *buf, - size_t nbytes, - _SYSIO_OFF_T *basep) + _SYSIO_OFF_T *posp, + size_t nbytes) { struct yod_inode *nino = I2NI(ino); _SYSIO_OFF_T result; @@ -754,15 +754,19 @@ yod_getdirentries(struct inode *ino, result = *basep; if (*basep != nino->ni_fpos && (result = lseek_yod(nino->ni_fd, - *basep, + *posp, SEEK_SET) == -1)) return -errno; nino->ni_fpos = result; memset(buf, 0, nbytes); + /* + * This is almost certainly broken. The resulting position parameter + * points to the block just filled, not the next. + */ cc = getdirentries_yod(nino->ni_fd, buf, nbytes, &result); if (cc < 0) return -errno; - nino->ni_fpos = *basep = result; + nino->ni_fpos = *posp = result; return cc; } |
From: Lee W. <lw...@us...> - 2007-09-24 19:00:19
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10952/drivers/yod Modified Files: fs_yod.c Log Message: All the drivers, in their mount routines, do something like: rootpb = _sysio_pb_new(&noname, NULL, rootino); err = _sysio_do_mount(..., rootpb, ...); This is clumsy. Crafted a convenience function called _sysio_mounti to do this for them. This simplifies the whole process a bit. Don't have to clean up the root pb node on error, for instance. The function is called exactly like _sysio_do_mount but with a ptr to the root inode instead of a ptr to the root pb node. Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -w -b -B -p -r1.22 -r1.23 --- fs_yod.c 4 Aug 2005 20:17:10 -0000 1.22 +++ fs_yod.c 24 Sep 2007 19:00:03 -0000 1.23 @@ -343,8 +343,6 @@ create_internal_namespace() int err; struct mount *mnt; struct inode *rootino; - struct pnode_base *rootpb; - static struct qstr noname = { NULL, 0, 0 }; struct filesys *fs; struct intnl_stat stbuf; @@ -362,7 +360,6 @@ create_internal_namespace() */ mnt = NULL; rootino = NULL; - rootpb = NULL; fs = _sysio_fs_new(&yod_inodesys_ops, 0, NULL); if (!fs) { err = -ENOMEM; @@ -382,19 +379,10 @@ create_internal_namespace() } /* - * Generate base path-node for root. - */ - rootpb = _sysio_pb_new(&noname, NULL, rootino); - if (!rootpb) { - err = -ENOMEM; - goto error; - } - - /* * Mount it. This name space is disconnected from the * rest of the system -- Only available within this driver. */ - err = _sysio_do_mount(fs, rootpb, 0, NULL, &mnt); + err = _sysio_mounti(fs, rootino, 0, NULL, &mnt); if (err) goto error; @@ -405,11 +393,8 @@ error: if (_sysio_do_unmount(mnt) != 0) abort(); fs = NULL; - rootpb = NULL; rootino = NULL; } - if (rootpb) - _sysio_pb_gone(rootpb); if (fs) { FS_RELE(fs); } |