diff -u --recursive --new-file linux-2.4.2-ping/arch/alpha/kernel/osf_sys.c linux-2.4.2-dir/arch/alpha/kernel/osf_sys.c --- linux-2.4.2-ping/arch/alpha/kernel/osf_sys.c Thu Jan 25 00:16:23 2001 +++ linux-2.4.2-dir/arch/alpha/kernel/osf_sys.c Fri Feb 9 17:59:20 2001 @@ -104,7 +104,7 @@ int error; }; -static int osf_filldir(void *__buf, const char *name, int namlen, off_t offset, +static int osf_filldir(void *__buf, const char *name, int namlen, loff_t offset, ino_t ino, unsigned int d_type) { struct osf_dirent *dirent; diff -u --recursive --new-file linux-2.4.2-ping/arch/ia64/ia32/sys_ia32.c linux-2.4.2-dir/arch/ia64/ia32/sys_ia32.c --- linux-2.4.2-ping/arch/ia64/ia32/sys_ia32.c Thu Jan 25 00:22:26 2001 +++ linux-2.4.2-dir/arch/ia64/ia32/sys_ia32.c Fri Feb 9 18:27:53 2001 @@ -724,7 +724,7 @@ }; static int -filldir32 (void *__buf, const char *name, int namlen, off_t offset, ino_t ino, +filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino, unsigned int d_type) { struct linux32_dirent * dirent; @@ -784,7 +784,7 @@ } static int -fillonedir32 (void * __buf, const char * name, int namlen, off_t offset, ino_t ino, +fillonedir32 (void * __buf, const char * name, int namlen, loff_t offset, ino_t ino, unsigned int d_type) { struct readdir32_callback * buf = (struct readdir32_callback *) __buf; diff -u --recursive --new-file linux-2.4.2-ping/arch/mips/kernel/sysirix.c linux-2.4.2-dir/arch/mips/kernel/sysirix.c --- linux-2.4.2-ping/arch/mips/kernel/sysirix.c Sun Aug 13 04:48:04 2000 +++ linux-2.4.2-dir/arch/mips/kernel/sysirix.c Fri Feb 9 18:01:40 2001 @@ -1847,7 +1847,7 @@ #define ROUND_UP32(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1)) static int irix_filldir32(void *__buf, const char *name, int namlen, - off_t offset, ino_t ino, unsigned int d_type) + loff_t offset, ino_t ino, unsigned int d_type) { struct irix_dirent32 *dirent; struct irix_dirent32_callback *buf = @@ -1943,7 +1943,7 @@ #define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1)) static int irix_filldir64(void * __buf, const char * name, int namlen, - off_t offset, ino_t ino, unsigned int d_type) + loff_t offset, ino_t ino, unsigned int d_type) { struct irix_dirent64 *dirent; struct irix_dirent64_callback * buf = diff -u --recursive --new-file linux-2.4.2-ping/arch/parisc/hpux/fs.c linux-2.4.2-dir/arch/parisc/hpux/fs.c --- linux-2.4.2-ping/arch/parisc/hpux/fs.c Tue Dec 5 21:29:39 2000 +++ linux-2.4.2-dir/arch/parisc/hpux/fs.c Fri Feb 9 18:03:56 2001 @@ -52,7 +52,7 @@ #define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de))) #define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1)) -static int filldir(void * __buf, const char * name, int namlen, off_t offset, ino_t ino) +static int filldir(void * __buf, const char * name, int namlen, loff_t offset, ino_t ino) { struct hpux_dirent * dirent; struct getdents_callback * buf = (struct getdents_callback *) __buf; diff -u --recursive --new-file linux-2.4.2-ping/arch/sparc/kernel/sys_sunos.c linux-2.4.2-dir/arch/sparc/kernel/sys_sunos.c --- linux-2.4.2-ping/arch/sparc/kernel/sys_sunos.c Thu Jan 25 00:18:06 2001 +++ linux-2.4.2-dir/arch/sparc/kernel/sys_sunos.c Fri Feb 9 17:54:35 2001 @@ -322,7 +322,7 @@ #define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1)) static int sunos_filldir(void * __buf, const char * name, int namlen, - off_t offset, ino_t ino, unsigned int d_type) + loff_t offset, ino_t ino, unsigned int d_type) { struct sunos_dirent * dirent; struct sunos_dirent_callback * buf = (struct sunos_dirent_callback *) __buf; @@ -403,7 +403,7 @@ }; static int sunos_filldirentry(void * __buf, const char * name, int namlen, - off_t offset, ino_t ino, unsigned int d_type) + loff_t offset, ino_t ino, unsigned int d_type) { struct sunos_direntry * dirent; struct sunos_direntry_callback * buf = (struct sunos_direntry_callback *) __buf; diff -u --recursive --new-file linux-2.4.2-ping/arch/sparc64/kernel/sys_sparc32.c linux-2.4.2-dir/arch/sparc64/kernel/sys_sparc32.c --- linux-2.4.2-ping/arch/sparc64/kernel/sys_sparc32.c Thu Jan 25 00:18:06 2001 +++ linux-2.4.2-dir/arch/sparc64/kernel/sys_sparc32.c Fri Feb 9 18:20:06 2001 @@ -1192,7 +1192,7 @@ }; static int fillonedir(void * __buf, const char * name, int namlen, - off_t offset, ino_t ino, unsigned int d_type) + loff_t offset, ino_t ino, unsigned int d_type) { struct readdir_callback32 * buf = (struct readdir_callback32 *) __buf; struct old_linux_dirent32 * dirent; @@ -1247,7 +1247,7 @@ int error; }; -static int filldir(void * __buf, const char * name, int namlen, off_t offset, ino_t ino, +static int filldir(void * __buf, const char * name, int namlen, loff_t offset, ino_t ino, unsigned int d_type) { struct linux_dirent32 * dirent; diff -u --recursive --new-file linux-2.4.2-ping/arch/sparc64/kernel/sys_sunos32.c linux-2.4.2-dir/arch/sparc64/kernel/sys_sunos32.c --- linux-2.4.2-ping/arch/sparc64/kernel/sys_sunos32.c Mon Jan 22 22:30:20 2001 +++ linux-2.4.2-dir/arch/sparc64/kernel/sys_sunos32.c Fri Feb 9 17:55:09 2001 @@ -277,7 +277,7 @@ #define ROUND_UP(x) (((x)+sizeof(s32)-1) & ~(sizeof(s32)-1)) static int sunos_filldir(void * __buf, const char * name, int namlen, - off_t offset, ino_t ino, unsigned int d_type) + loff_t offset, ino_t ino, unsigned int d_type) { struct sunos_dirent * dirent; struct sunos_dirent_callback * buf = (struct sunos_dirent_callback *) __buf; @@ -359,7 +359,7 @@ }; static int sunos_filldirentry(void * __buf, const char * name, int namlen, - off_t offset, ino_t ino, unsigned int d_type) + loff_t offset, ino_t ino, unsigned int d_type) { struct sunos_direntry * dirent; struct sunos_direntry_callback * buf = (struct sunos_direntry_callback *) __buf; diff -u --recursive --new-file linux-2.4.2-ping/fs/fat/dir.c linux-2.4.2-dir/fs/fat/dir.c --- linux-2.4.2-ping/fs/fat/dir.c Tue Sep 5 23:07:29 2000 +++ linux-2.4.2-dir/fs/fat/dir.c Thu Feb 8 02:10:05 2001 @@ -509,7 +509,7 @@ void * buf, const char * name, int name_len, - off_t offset, + loff_t offset, ino_t ino, unsigned int d_type) { diff -u --recursive --new-file linux-2.4.2-ping/fs/nfs/dir.c linux-2.4.2-dir/fs/nfs/dir.c --- linux-2.4.2-ping/fs/nfs/dir.c Sun Dec 10 18:55:48 2000 +++ linux-2.4.2-dir/fs/nfs/dir.c Fri Feb 9 17:45:05 2001 @@ -35,6 +35,7 @@ /* #define NFS_DEBUG_VERBOSE 1 */ static int nfs_readdir(struct file *, void *, filldir_t); +static loff_t nfs_dir_llseek(struct file *, loff_t, int); static struct dentry *nfs_lookup(struct inode *, struct dentry *); static int nfs_create(struct inode *, struct dentry *, int); static int nfs_mkdir(struct inode *, struct dentry *, int); @@ -47,6 +48,7 @@ struct inode *, struct dentry *); struct file_operations nfs_dir_operations = { + llseek: nfs_dir_llseek, read: generic_read_dir, readdir: nfs_readdir, open: nfs_open, @@ -417,6 +419,28 @@ if (res < 0) return res; return 0; +} + +/* + * nfs_dir_llseek(): cater for the fact that NFS(v2|v3) readdir + * cookies take (32|64)-bit unsigned values. + */ +loff_t nfs_dir_llseek(struct file *file, loff_t offset, int origin) +{ + u64 cookie = offset; + + /* We disallow SEEK_CUR and SEEK_END */ + if (origin != 0) + return -EINVAL; + if (NFS_PROTO(file->f_dentry->d_inode)->version == 2) + cookie &= 0xFFFFFFFF; + if (cookie != file->f_pos) { + file->f_pos = cookie; + file->f_reada = 0; + file->f_version = ++event; + } + + return (offset >= 0) ? offset : 0; } /* diff -u --recursive --new-file linux-2.4.2-ping/fs/nfsd/nfs3xdr.c linux-2.4.2-dir/fs/nfsd/nfs3xdr.c --- linux-2.4.2-ping/fs/nfsd/nfs3xdr.c Fri Dec 29 23:07:23 2000 +++ linux-2.4.2-dir/fs/nfsd/nfs3xdr.c Thu Feb 8 01:29:38 2001 @@ -661,7 +661,7 @@ #define NFS3_ENTRYPLUS_BAGGAGE (1 + 21 + 1 + (NFS3_FHSIZE >> 2)) static int encode_entry(struct readdir_cd *cd, const char *name, - int namlen, off_t offset, ino_t ino, unsigned int d_type, int plus) + int namlen, loff_t offset, ino_t ino, unsigned int d_type, int plus) { u32 *p = cd->buffer; int buflen, slen, elen; @@ -739,14 +739,14 @@ int nfs3svc_encode_entry(struct readdir_cd *cd, const char *name, - int namlen, off_t offset, ino_t ino, unsigned int d_type) + int namlen, loff_t offset, ino_t ino, unsigned int d_type) { return encode_entry(cd, name, namlen, offset, ino, d_type, 0); } int nfs3svc_encode_entry_plus(struct readdir_cd *cd, const char *name, - int namlen, off_t offset, ino_t ino, unsigned int d_type) + int namlen, loff_t offset, ino_t ino, unsigned int d_type) { return encode_entry(cd, name, namlen, offset, ino, d_type, 1); } diff -u --recursive --new-file linux-2.4.2-ping/fs/nfsd/nfsfh.c linux-2.4.2-dir/fs/nfsd/nfsfh.c --- linux-2.4.2-ping/fs/nfsd/nfsfh.c Thu Jan 4 21:50:17 2001 +++ linux-2.4.2-dir/fs/nfsd/nfsfh.c Thu Feb 8 01:24:25 2001 @@ -41,7 +41,7 @@ * the name matching the specified inode number. */ static int filldir_one(void * __buf, const char * name, int len, - off_t pos, ino_t ino, unsigned int d_type) + loff_t pos, ino_t ino, unsigned int d_type) { struct nfsd_getdents_callback *buf = __buf; struct qstr *qs = buf->name; diff -u --recursive --new-file linux-2.4.2-ping/fs/nfsd/nfsxdr.c linux-2.4.2-dir/fs/nfsd/nfsxdr.c --- linux-2.4.2-ping/fs/nfsd/nfsxdr.c Fri Sep 22 23:21:19 2000 +++ linux-2.4.2-dir/fs/nfsd/nfsxdr.c Thu Feb 8 01:32:21 2001 @@ -390,7 +390,7 @@ int nfssvc_encode_entry(struct readdir_cd *cd, const char *name, - int namlen, off_t offset, ino_t ino, unsigned int d_type) + int namlen, loff_t offset, ino_t ino, unsigned int d_type) { u32 *p = cd->buffer; int buflen, slen; @@ -403,7 +403,7 @@ if (offset > ~((u32) 0)) return -EINVAL; if (cd->offset) - *cd->offset = htonl(offset); + *cd->offset = htonl((u32) offset); if (namlen > NFS2_MAXNAMLEN) namlen = NFS2_MAXNAMLEN;/* truncate filename */ diff -u --recursive --new-file linux-2.4.2-ping/fs/readdir.c linux-2.4.2-dir/fs/readdir.c --- linux-2.4.2-ping/fs/readdir.c Mon Dec 11 22:45:42 2000 +++ linux-2.4.2-dir/fs/readdir.c Thu Feb 8 01:18:16 2001 @@ -122,7 +122,7 @@ int count; }; -static int fillonedir(void * __buf, const char * name, int namlen, off_t offset, +static int fillonedir(void * __buf, const char * name, int namlen, loff_t offset, ino_t ino, unsigned int d_type) { struct readdir_callback * buf = (struct readdir_callback *) __buf; @@ -183,7 +183,7 @@ int error; }; -static int filldir(void * __buf, const char * name, int namlen, off_t offset, +static int filldir(void * __buf, const char * name, int namlen, loff_t offset, ino_t ino, unsigned int d_type) { struct linux_dirent * dirent; @@ -261,7 +261,7 @@ int error; }; -static int filldir64(void * __buf, const char * name, int namlen, off_t offset, +static int filldir64(void * __buf, const char * name, int namlen, loff_t offset, ino_t ino, unsigned int d_type) { struct linux_dirent64 * dirent, d; diff -u --recursive --new-file linux-2.4.2-ping/fs/umsdos/dir.c linux-2.4.2-dir/fs/umsdos/dir.c --- linux-2.4.2-ping/fs/umsdos/dir.c Thu Nov 9 04:01:34 2000 +++ linux-2.4.2-dir/fs/umsdos/dir.c Thu Feb 8 02:19:54 2001 @@ -67,7 +67,7 @@ static int umsdos_dir_once ( void *buf, const char *name, int len, - off_t offset, + loff_t offset, ino_t ino, unsigned type) { diff -u --recursive --new-file linux-2.4.2-ping/fs/umsdos/ioctl.c linux-2.4.2-dir/fs/umsdos/ioctl.c --- linux-2.4.2-ping/fs/umsdos/ioctl.c Tue Sep 5 23:05:46 2000 +++ linux-2.4.2-dir/fs/umsdos/ioctl.c Thu Feb 8 02:20:25 2001 @@ -28,7 +28,7 @@ void *buf, const char *name, int name_len, - off_t offset, + loff_t offset, ino_t ino, unsigned type) { diff -u --recursive --new-file linux-2.4.2-ping/fs/umsdos/rdir.c linux-2.4.2-dir/fs/umsdos/rdir.c --- linux-2.4.2-ping/fs/umsdos/rdir.c Fri Aug 11 23:29:01 2000 +++ linux-2.4.2-dir/fs/umsdos/rdir.c Thu Feb 8 02:22:37 2001 @@ -32,7 +32,7 @@ static int rdir_filldir ( void *buf, const char *name, int name_len, - off_t offset, + loff_t offset, ino_t ino, unsigned int d_type) { diff -u --recursive --new-file linux-2.4.2-ping/include/linux/fs.h linux-2.4.2-dir/include/linux/fs.h --- linux-2.4.2-ping/include/linux/fs.h Tue Jan 30 08:24:56 2001 +++ linux-2.4.2-dir/include/linux/fs.h Thu Feb 8 01:21:08 2001 @@ -730,7 +730,7 @@ * This allows the kernel to read directories into kernel space or * to have different dirent layouts depending on the binary type. */ -typedef int (*filldir_t)(void *, const char *, int, off_t, ino_t, unsigned); +typedef int (*filldir_t)(void *, const char *, int, loff_t, ino_t, unsigned); struct block_device_operations { int (*open) (struct inode *, struct file *); diff -u --recursive --new-file linux-2.4.2-ping/include/linux/nfsd/xdr.h linux-2.4.2-dir/include/linux/nfsd/xdr.h --- linux-2.4.2-ping/include/linux/nfsd/xdr.h Tue Jan 30 08:25:20 2001 +++ linux-2.4.2-dir/include/linux/nfsd/xdr.h Thu Feb 8 02:11:42 2001 @@ -151,7 +151,7 @@ int nfssvc_encode_readdirres(struct svc_rqst *, u32 *, struct nfsd_readdirres *); int nfssvc_encode_entry(struct readdir_cd *, const char *name, - int namlen, off_t offset, ino_t ino, unsigned int); + int namlen, loff_t offset, ino_t ino, unsigned int); int nfssvc_release_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *); diff -u --recursive --new-file linux-2.4.2-ping/include/linux/nfsd/xdr3.h linux-2.4.2-dir/include/linux/nfsd/xdr3.h --- linux-2.4.2-ping/include/linux/nfsd/xdr3.h Tue Jan 30 08:25:20 2001 +++ linux-2.4.2-dir/include/linux/nfsd/xdr3.h Thu Feb 8 02:14:39 2001 @@ -292,10 +292,10 @@ int nfs3svc_release_fhandle2(struct svc_rqst *, u32 *, struct nfsd3_fhandle_pair *); int nfs3svc_encode_entry(struct readdir_cd *, const char *name, - int namlen, off_t offset, ino_t ino, + int namlen, loff_t offset, ino_t ino, unsigned int); int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name, - int namlen, off_t offset, ino_t ino, + int namlen, loff_t offset, ino_t ino, unsigned int);