Thread: [Libsysio-commit] strided-io: libsysio/drivers/native fs_native.c
Brought to you by:
lward
|
From: Lee W. <lw...@us...> - 2004-01-26 16:28:44
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9381/drivers/native Modified Files: Tag: strided-io fs_native.c Log Message: Merged in changes from HEAD. Added a little note in ChangeLog about the internal interface change. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.25.6.3 retrieving revision 1.25.6.4 diff -u -w -b -B -p -r1.25.6.3 -r1.25.6.4 --- fs_native.c 26 Jan 2004 07:24:29 -0000 1.25.6.3 +++ fs_native.c 26 Jan 2004 16:27:47 -0000 1.25.6.4 @@ -130,11 +130,6 @@ 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 @@ -1400,15 +1395,33 @@ native_inop_iodone(struct ioctx *ioctxp } static int -native_inop_fcntl(struct inode *ino __IS_UNUSED, - int cmd __IS_UNUSED, - va_list ap __IS_UNUSED) +native_inop_fcntl(struct inode *ino, + int cmd, + va_list ap) { + struct native_inode *nino = I2NI(ino); + long arg; - /* - * I'm lazy. Maybe implemented later. - */ - errno = ENOTTY; + if (nino->ni_fd < 0) + abort(); + + switch (cmd) { + case F_GETFD: + case F_GETFL: + case F_GETOWN: + 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: + arg = va_arg(ap, long); + return syscall(SYS_fcntl, nino->ni_fd, cmd, arg); + default: + abort(); + } return -1; } |
|
From: Lee W. <lw...@us...> - 2004-01-26 17:22:59
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26398/drivers/native Modified Files: Tag: strided-io fs_native.c Log Message: Merged with head, again, after adding Kevin Pedretti's patches. This did not go cleanly. Some remedial testing indicates no problem but... Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.25.6.4 retrieving revision 1.25.6.5 diff -u -w -b -B -p -r1.25.6.4 -r1.25.6.5 --- fs_native.c 26 Jan 2004 16:27:47 -0000 1.25.6.4 +++ fs_native.c 26 Jan 2004 17:21:51 -0000 1.25.6.5 @@ -80,7 +80,6 @@ #ifdef REDSTORM #include <sys/uio.h> -#include <catamount/syscall.h> /* ! in sys include? */ #endif /* @@ -1420,9 +1419,9 @@ native_inop_fcntl(struct inode *ino, arg = va_arg(ap, long); return syscall(SYS_fcntl, nino->ni_fd, cmd, arg); default: - abort(); + break; } - return -1; + return -EINVAL; } static int |
|
From: Lee W. <lw...@us...> - 2004-01-27 02:28:57
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4182/drivers/native Modified Files: Tag: strided-io fs_native.c Log Message: Gratuitous name change (sorry) from inop_ip{read,write}v to inop_{read,write}. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.25.6.2 retrieving revision 1.25.6.3 diff -u -w -b -B -p -r1.25.6.2 -r1.25.6.3 --- fs_native.c 26 Jan 2004 07:10:56 -0000 1.25.6.2 +++ fs_native.c 26 Jan 2004 07:24:29 -0000 1.25.6.3 @@ -224,10 +224,8 @@ static int native_inop_close(struct inod static int native_inop_link(struct pnode *old, struct pnode *new); static int native_inop_unlink(struct pnode *pno); static int native_inop_rename(struct pnode *old, struct pnode *new); -static int native_inop_ipreadv(struct inode *ino, - struct ioctx *ioctx); -static int native_inop_ipwritev(struct inode *ino, - struct ioctx *ioctx); +static int native_inop_read(struct inode *ino, struct ioctx *ioctx); +static int native_inop_write(struct inode *ino, struct ioctx *ioctx); static int native_inop_iodone(struct ioctx *ioctx); static int native_inop_fcntl(struct inode *ino, int cmd, va_list ap); static int native_inop_sync(struct inode *ino); @@ -257,8 +255,8 @@ static struct inode_ops native_i_ops = { native_inop_link, native_inop_unlink, native_inop_rename, - native_inop_ipreadv, - native_inop_ipwritev, + native_inop_read, + native_inop_write, native_inop_iodone, native_inop_fcntl, native_inop_sync, @@ -1378,16 +1376,14 @@ doio(char op, struct ioctx *ioctx) } static int -native_inop_ipreadv(struct inode *ino __IS_UNUSED, - struct ioctx *ioctx) +native_inop_read(struct inode *ino __IS_UNUSED, struct ioctx *ioctx) { return doio('r', ioctx); } static int -native_inop_ipwritev(struct inode *ino __IS_UNUSED, - struct ioctx *ioctx) +native_inop_write(struct inode *ino __IS_UNUSED, struct ioctx *ioctx) { return doio('w', ioctx); |
|
From: Lee W. <lw...@us...> - 2004-01-27 00:21:53
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1014/drivers/native Modified Files: Tag: strided-io fs_native.c Log Message: Use O_LARGEFILE or we don't get 64-bit file address space. Fix lots of seek/position checks. Add artificial limit check to _sysio_validx and remove the test for overflow of INT_MAX there. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.25.6.1 retrieving revision 1.25.6.2 diff -u -w -b -B -p -r1.25.6.1 -r1.25.6.2 --- fs_native.c 23 Jan 2004 15:19:37 -0000 1.25.6.1 +++ fs_native.c 26 Jan 2004 07:10:56 -0000 1.25.6.2 @@ -1014,6 +1014,9 @@ native_inop_open(struct pnode *pno, int flags &= ~O_WRONLY; flags |= O_RDWR; } +#ifdef O_LARGEFILE + flags |= O_LARGEFILE; +#endif fd = syscall(SYS_open, path, flags, mode); if (!pno->p_base->pb_ino && fd >= 0) { int err; |
|
From: Sonja T. <so...@us...> - 2004-01-28 13:55:06
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23056/drivers/native Modified Files: Tag: strided-io fs_native.c Log Message: Fixing memory bug in doio Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.25.6.5 retrieving revision 1.25.6.6 diff -u -w -b -B -p -r1.25.6.5 -r1.25.6.6 --- fs_native.c 26 Jan 2004 17:21:51 -0000 1.25.6.5 +++ fs_native.c 28 Jan 2004 13:53:53 -0000 1.25.6.6 @@ -1319,10 +1319,11 @@ doio(char op, struct ioctx *ioctx) * Must lock the regions (in order!) since we can't do * strided-IO as a single atomic operation. */ - oxtv = malloc(sizeof(struct intnl_xtvec)); + oxtv = malloc(sizeof(struct intnl_xtvec)*ioctx->ioctx_xtvlen); if (!oxtv) return -ENOMEM; - (void )memcpy(oxtv, ioctx->ioctx_xtv, ioctx->ioctx_xtvlen); + (void )memcpy(oxtv, ioctx->ioctx_xtv, + (ioctx->ioctx_xtvlen*sizeof(struct intnl_xtvec))); qsort(oxtv, ioctx->ioctx_xtvlen, sizeof(struct intnl_xtvec), |
|
From: Sonja T. <so...@us...> - 2004-01-30 19:57:19
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19342/drivers/native Modified Files: Tag: strided-io fs_native.c Log Message: Fixed bug in lockop_all that sent in the wrong command to fcntl. Added more calls to the test driver Added a rw test to the test suite. This calls all of the write/read combos: write, iwrite, writev, iwritev, pwrite, ipwrite, ipwritev, writex, iwritex. Ensures that what they wrote out and what they read back matches. Removed for now the statvfs test. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.25.6.7 retrieving revision 1.25.6.8 diff -u -w -b -B -p -r1.25.6.7 -r1.25.6.8 --- fs_native.c 29 Jan 2004 20:41:33 -0000 1.25.6.7 +++ fs_native.c 30 Jan 2004 19:55:33 -0000 1.25.6.8 @@ -1282,7 +1282,7 @@ lockop_all(struct native_inode *nino, #endif , nino->ni_fd, - op, + F_SETLK, &flock); if (err != 0) return -errno; |
|
From: Lee W. <lw...@us...> - 2004-01-30 20:49:10
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6492 Modified Files: Tag: strided-io fs_native.c Log Message: Sonja didn't actually compile the previous revision. It contained syntax errors. Sonja's editor autowraps long lines? Added a new line. Consistency is the hobgoblin of small minds. I have a *very* small mind :-) So, changed to reflect the style of the file; + spaces around binary operators + indenting now consistent with other multiline arg passing + a * b, then b * a fixed to have the same sub-expression in the same order on two lines. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.25.6.6 retrieving revision 1.25.6.7 diff -u -w -b -B -p -r1.25.6.6 -r1.25.6.7 --- fs_native.c 28 Jan 2004 13:53:53 -0000 1.25.6.6 +++ fs_native.c 29 Jan 2004 20:41:33 -0000 1.25.6.7 @@ -1319,11 +1319,12 @@ doio(char op, struct ioctx *ioctx) * Must lock the regions (in order!) since we can't do * strided-IO as a single atomic operation. */ - oxtv = malloc(sizeof(struct intnl_xtvec)*ioctx->ioctx_xtvlen); + oxtv = malloc(ioctx->ioctx_xtvlen * sizeof(struct intnl_xtvec)); if (!oxtv) return -ENOMEM; - (void )memcpy(oxtv, ioctx->ioctx_xtv, - (ioctx->ioctx_xtvlen*sizeof(struct intnl_xtvec))); + (void )memcpy(oxtv, + ioctx->ioctx_xtv, + ioctx->ioctx_xtvlen * sizeof(struct intnl_xtvec)); qsort(oxtv, ioctx->ioctx_xtvlen, sizeof(struct intnl_xtvec), |
|
From: Lee W. <lw...@us...> - 2004-02-04 02:57:32
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2483 Modified Files: Tag: strided-io fs_native.c Log Message: Ifdef'd out the locking code. It's inapprorpiate and problematic. Good riidance. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.25.6.8 retrieving revision 1.25.6.9 diff -u -w -b -B -p -r1.25.6.8 -r1.25.6.9 --- fs_native.c 30 Jan 2004 19:55:33 -0000 1.25.6.8 +++ fs_native.c 3 Feb 2004 18:32:49 -0000 1.25.6.9 @@ -1256,6 +1256,7 @@ doiov(const struct iovec *iov, #endif } +#if 0 static int lockop_all(struct native_inode *nino, struct intnl_xtvec *xtv, @@ -1300,19 +1301,25 @@ order_xtv(const struct intnl_xtvec *xtv1 return 1; return 0; } +#endif static int doio(char op, struct ioctx *ioctx) { struct native_inode *nino; +#if 0 int dolocks; struct intnl_xtvec *oxtv; int err; +#endif struct native_io arguments; ssize_t cc; +#if 0 struct intnl_xtvec *front, *rear, tmp; +#endif nino = I2NI(ioctx->ioctx_ino); +#if 0 dolocks = ioctx->ioctx_xtvlen > 1 && nino->ni_seekok; if (dolocks) { /* @@ -1338,6 +1345,7 @@ doio(char op, struct ioctx *ioctx) return err; } } +#endif arguments.nio_op = op; arguments.nio_nino = nino; cc = @@ -1349,6 +1357,7 @@ doio(char op, struct ioctx *ioctx) ssize_t, void *))doiov, &arguments); +#if 0 if (dolocks) { /* * Must unlock in reverse order. @@ -1364,6 +1373,7 @@ doio(char op, struct ioctx *ioctx) abort(); free(oxtv); } +#endif if ((ioctx->ioctx_cc = cc) < 0) { ioctx->ioctx_errno = -ioctx->ioctx_cc; ioctx->ioctx_cc = -1; |