[Libsysio-commit] HEAD: libsysio/drivers/yod fs_yod.c
Brought to you by:
lward
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; } |