X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=libsysio%2Fdrivers%2Fyod%2Ffs_yod.c;h=ea0ce35a155cb5f74b4de5b0bb9d0b120c915cdc;hp=c9bfcf32ca958f58c39ee6676741a6c9607c7eea;hb=7e59fbcc88cc2df4d20c3d5a2c7b45d5d2494918;hpb=567285197e592000b7a713d65b66e27314a11c2f diff --git a/libsysio/drivers/yod/fs_yod.c b/libsysio/drivers/yod/fs_yod.c index c9bfcf3..ea0ce35 100644 --- a/libsysio/drivers/yod/fs_yod.c +++ b/libsysio/drivers/yod/fs_yod.c @@ -53,7 +53,7 @@ #include #include #include -#include +#include #include #include #include @@ -103,7 +103,7 @@ do { \ (dest)->st_blocks = (src)->st_blocks; \ (dest)->st_flags = (src)->st_flags; \ (dest)->st_gen = (src)->st_gen; \ -} while (0); +} while (0) #else #define COPY_STAT(src, dest) \ do { \ @@ -121,7 +121,7 @@ do { \ (dest)->st_ctime = (src)->st_ctime; \ (dest)->st_blksize = (src)->st_blksize; \ (dest)->st_blocks = (src)->st_blocks; \ -} while (0); +} while (0) #endif /* @@ -160,10 +160,10 @@ static int yod_inop_setattr(struct pnode *pno, struct inode *ino, unsigned mask, struct intnl_stat *stbuf); -static ssize_t yod_getdirentries(struct inode *ino, - char *buf, - size_t nbytes, - off64_t *basep); +static ssize_t yod_filldirentries(struct inode *ino, + off64_t *posp, + char *buf, + 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, @@ -412,7 +412,6 @@ error: _sysio_pb_gone(rootpb); if (fs) { FS_RELE(fs); - _sysio_fs_gone(fs); } return err; @@ -741,10 +740,10 @@ out: } static ssize_t -yod_getdirentries(struct inode *ino, - char *buf, - size_t nbytes, - _SYSIO_OFF_T *basep) +yod_filldirentries(struct inode *ino, + char *buf, + _SYSIO_OFF_T *posp, + size_t nbytes) { struct yod_inode *nino = I2NI(ino); _SYSIO_OFF_T result; @@ -755,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; }