diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-08-24 07:29:52 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-10-23 05:13:10 -0400 |
commit | 53c9c5c0e32c69f9df1822e47671c13e3402c82f (patch) | |
tree | 76aae2cfde109c97451d40b5c6e5063e22690a03 /fs/nfsd | |
parent | a9885444f7ff6e9156adb1adf5558ded9a39ad0a (diff) |
[PATCH] prepare vfs_readdir() callers to returning filldir result
It's not the final state, but it allows moving ->readdir() instances
to passing filldir return value to caller of vfs_readdir().
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/vfs.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 93b22f661d9d..e3e37f7c8477 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -1831,6 +1831,7 @@ struct buffered_dirent { | |||
1831 | struct readdir_data { | 1831 | struct readdir_data { |
1832 | char *dirent; | 1832 | char *dirent; |
1833 | size_t used; | 1833 | size_t used; |
1834 | int full; | ||
1834 | }; | 1835 | }; |
1835 | 1836 | ||
1836 | static int nfsd_buffered_filldir(void *__buf, const char *name, int namlen, | 1837 | static int nfsd_buffered_filldir(void *__buf, const char *name, int namlen, |
@@ -1841,8 +1842,10 @@ static int nfsd_buffered_filldir(void *__buf, const char *name, int namlen, | |||
1841 | unsigned int reclen; | 1842 | unsigned int reclen; |
1842 | 1843 | ||
1843 | reclen = ALIGN(sizeof(struct buffered_dirent) + namlen, sizeof(u64)); | 1844 | reclen = ALIGN(sizeof(struct buffered_dirent) + namlen, sizeof(u64)); |
1844 | if (buf->used + reclen > PAGE_SIZE) | 1845 | if (buf->used + reclen > PAGE_SIZE) { |
1846 | buf->full = 1; | ||
1845 | return -EINVAL; | 1847 | return -EINVAL; |
1848 | } | ||
1846 | 1849 | ||
1847 | de->namlen = namlen; | 1850 | de->namlen = namlen; |
1848 | de->offset = offset; | 1851 | de->offset = offset; |
@@ -1874,9 +1877,13 @@ static int nfsd_buffered_readdir(struct file *file, filldir_t func, | |||
1874 | unsigned int reclen; | 1877 | unsigned int reclen; |
1875 | 1878 | ||
1876 | buf.used = 0; | 1879 | buf.used = 0; |
1880 | buf.full = 0; | ||
1877 | 1881 | ||
1878 | host_err = vfs_readdir(file, nfsd_buffered_filldir, &buf); | 1882 | host_err = vfs_readdir(file, nfsd_buffered_filldir, &buf); |
1879 | if (host_err) | 1883 | if (buf.full) |
1884 | host_err = 0; | ||
1885 | |||
1886 | if (host_err < 0) | ||
1880 | break; | 1887 | break; |
1881 | 1888 | ||
1882 | size = buf.used; | 1889 | size = buf.used; |