[Libsysio-commit] HEAD: libsysio/drivers/native fs_native.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2009-01-28 16:10:38
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31433 Modified Files: fs_native.c Log Message: This driver was doing raw associations when a file was created. That must no longer be done; Instead PB_SET_ASSOC must be used. To just divorce us from the issue, I've changed things so that the inode is created/cached but do no association here. Something outside must look the path up, again. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.68 retrieving revision 1.69 diff -u -w -b -B -p -r1.68 -r1.69 --- fs_native.c 15 Oct 2008 22:01:01 -0000 1.68 +++ fs_native.c 28 Jan 2009 16:10:32 -0000 1.69 @@ -904,13 +904,15 @@ native_pos(int fd, _SYSIO_OFF_T *offset, return -errno; } #else + { off = - syscall(SYSIO_SYS_lseek, + syscall(SYS_lseek, fd, off, whence); - if (off == -1) + if (off < 0) return -errno; + } #endif *offset = off; @@ -969,6 +971,7 @@ native_ifilldirentries(struct native_ino * Stream-oriented access requires that we discover where we are * after the call. */ + nino->ni_fpos = 0; if ((err = native_pos(nino->ni_fd, &nino->ni_fpos, SEEK_CUR)) != 0) { /* * Leave the position at the old I suppose. @@ -1133,6 +1136,7 @@ native_inop_open(struct pnode *pno, int { struct native_inode *nino; char *path; + struct inode *ino; int fd; path = _sysio_pb_path(pno->p_base, '/'); @@ -1154,8 +1158,9 @@ native_inop_open(struct pnode *pno, int #ifdef O_LARGEFILE flags |= O_LARGEFILE; #endif + ino = pno->p_base->pb_ino; fd = syscall(SYSIO_SYS_open, path, flags, mode); - if (!pno->p_base->pb_ino && fd >= 0) { + if (!ino && fd >= 0) { struct filesys *fs; int err; @@ -1167,14 +1172,15 @@ native_inop_open(struct pnode *pno, int native_ibind(fs, path, _SYSIO_LOCAL_TIME() + FS2NFS(fs)->nfs_atimo, - &pno->p_base->pb_ino); + &ino); if (err) { (void )syscall(SYSIO_SYS_close, fd); if (err == -EEXIST) abort(); fd = err; } - } + } else + I_GET(ino); free(path); if (fd < 0) return -errno; @@ -1182,10 +1188,10 @@ native_inop_open(struct pnode *pno, int /* * Remember this new open. */ - nino = I2NI(pno->p_base->pb_ino); + nino = I2NI(ino); nino->ni_nopens++; assert(nino->ni_nopens); - + do { if (nino->ni_fd >= 0) { if ((nino->ni_oflags & O_RDWR) || (flags & (O_RDONLY|O_WRONLY|O_RDWR)) == O_RDONLY) { @@ -1193,7 +1199,7 @@ native_inop_open(struct pnode *pno, int * Keep existing. */ (void )syscall(SYSIO_SYS_close, fd); - return 0; + break; } (void )syscall(SYSIO_SYS_close, nino->ni_fd); } @@ -1208,7 +1214,11 @@ native_inop_open(struct pnode *pno, int * descriptor. */ nino->ni_seekok = - native_pos(nino->ni_fd, &nino->ni_fpos, SEEK_CUR) != 0 ? 0 : 1; + native_pos(nino->ni_fd, &nino->ni_fpos, SEEK_CUR) != 0 + ? 0 + : 1; + } while (0); + I_PUT(ino); return 0; } |