1 diff -urN linux-2.4.22.org/fs/nfs/dir.c linux-2.4.22/fs/nfs/dir.c
2 --- linux-2.4.22.org/fs/nfs/dir.c 2003-11-21 19:45:07.000000000 +0100
3 +++ linux-2.4.22/fs/nfs/dir.c 2003-11-21 19:52:27.000000000 +0100
6 /* #define NFS_DEBUG_VERBOSE 1 */
8 +static loff_t nfs_dir_llseek(struct file *, loff_t, int);
9 static int nfs_readdir(struct file *, void *, filldir_t);
10 static struct dentry *nfs_lookup(struct inode *, struct dentry *);
11 static int nfs_create(struct inode *, struct dentry *, int);
13 static int nfs_fsync_dir(struct file *, struct dentry *, int);
15 struct file_operations nfs_dir_operations = {
16 + llseek: nfs_dir_llseek,
17 read: generic_read_dir,
21 removexattr: nfs_removexattr,
24 +static loff_t nfs_dir_llseek(struct file *file, loff_t offset, int origin)
29 + offset = file->f_pos;
35 + if (offset != file->f_pos) {
36 + file->f_pos = offset;
38 + file->f_version = ++event;
40 + return (offset <= 0) ? 0 : offset;
43 typedef u32 * (*decode_dirent_t)(u32 *, struct nfs_entry *, int);
46 diff -urN linux-2.4.22.org/fs/nfs/nfs2xdr.c linux-2.4.22/fs/nfs/nfs2xdr.c
47 --- linux-2.4.22.org/fs/nfs/nfs2xdr.c 2003-11-21 19:45:07.000000000 +0100
48 +++ linux-2.4.22/fs/nfs/nfs2xdr.c 2003-11-21 19:52:27.000000000 +0100
52 p = xdr_encode_fhandle(p, args->fh);
53 - *p++ = htonl(args->cookie);
54 + *p++ = htonl(args->cookie & 0xFFFFFFFF);
55 *p++ = htonl(count); /* see above */
56 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
59 entry->name = (const char *) p;
60 p += XDR_QUADLEN(entry->len);
61 entry->prev_cookie = entry->cookie;
62 - entry->cookie = ntohl(*p++);
63 + entry->cookie = (s64)((off_t)ntohl(*p++));
64 entry->eof = !p[0] && p[1];
67 diff -urN linux-2.4.22.org/fs/nfs/nfs3xdr.c linux-2.4.22/fs/nfs/nfs3xdr.c
68 --- linux-2.4.22.org/fs/nfs/nfs3xdr.c 2003-11-21 19:45:07.000000000 +0100
69 +++ linux-2.4.22/fs/nfs/nfs3xdr.c 2003-11-21 19:52:52.000000000 +0100
74 +/* Hack to sign-extending 32-bit cookies */
76 +u64 nfs_transform_cookie64(u64 cookie)
78 + return (cookie & 0x80000000) ? (cookie ^ 0xFFFFFFFF00000000) : cookie;
82 * Encode arguments to readdir call
85 u32 count = args->count;
87 p = xdr_encode_fhandle(p, args->fh);
88 - p = xdr_encode_hyper(p, args->cookie);
89 + p = xdr_encode_hyper(p, nfs_transform_cookie64(args->cookie));
95 nfs3_decode_dirent(u32 *p, struct nfs_entry *entry, int plus)
101 return ERR_PTR(-EAGAIN);
103 entry->name = (const char *) p;
104 p += XDR_QUADLEN(entry->len);
105 entry->prev_cookie = entry->cookie;
106 - p = xdr_decode_hyper(p, &entry->cookie);
107 + p = xdr_decode_hyper(p, &cookie);
108 + entry->cookie = nfs_transform_cookie64(cookie);
111 struct nfs_fattr fattr;