]> git.pld-linux.org Git - packages/kernel.git/blob - linux-2.4.20-irixnfs.patch
- added description of djurban's branch
[packages/kernel.git] / linux-2.4.20-irixnfs.patch
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
4 @@ -34,6 +34,7 @@
5  #define NFS_PARANOIA 1
6  /* #define NFS_DEBUG_VERBOSE 1 */
7  
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);
12 @@ -48,6 +49,7 @@
13  static int nfs_fsync_dir(struct file *, struct dentry *, int);
14  
15  struct file_operations nfs_dir_operations = {
16 +       llseek:         nfs_dir_llseek,
17         read:           generic_read_dir,
18         readdir:        nfs_readdir,
19         open:           nfs_open,
20 @@ -74,6 +76,25 @@
21         removexattr:    nfs_removexattr,
22  };
23  
24 +static loff_t nfs_dir_llseek(struct file *file, loff_t offset, int origin)
25 +{
26 +       switch (origin) {
27 +               case 1:
28 +                       if (offset == 0) {
29 +                               offset = file->f_pos;
30 +                               break;
31 +                       }
32 +               case 2:
33 +                       return -EINVAL;
34 +       }
35 +       if (offset != file->f_pos) {
36 +               file->f_pos = offset;
37 +               file->f_reada = 0;
38 +               file->f_version = ++event;
39 +       }
40 +       return (offset <= 0) ? 0 : offset;
41 +}
42 +
43  typedef u32 * (*decode_dirent_t)(u32 *, struct nfs_entry *, int);
44  typedef struct {
45         struct file     *file;
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
49 @@ -369,7 +369,7 @@
50                 count = count >> 2;
51  
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);
57  
58 @@ -466,7 +466,7 @@
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];
65  
66         return p;
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
70 @@ -471,6 +471,13 @@
71         return 0;
72  }
73  
74 +/* Hack to sign-extending 32-bit cookies */
75 +static inline
76 +u64 nfs_transform_cookie64(u64 cookie)
77 +{
78 +       return (cookie & 0x80000000) ? (cookie ^ 0xFFFFFFFF00000000) : cookie;
79 +}
80 +
81  /*
82   * Encode arguments to readdir call
83   */
84 @@ -482,7 +489,7 @@
85         u32 count = args->count;
86  
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));
90         *p++ = args->verf[0];
91         *p++ = args->verf[1];
92         if (args->plus) {
93 @@ -605,6 +612,8 @@
94  u32 *
95  nfs3_decode_dirent(u32 *p, struct nfs_entry *entry, int plus)
96  {
97 +       u64 cookie;
98 +
99         if (!*p++) {
100                 if (!*p)
101                         return ERR_PTR(-EAGAIN);
102 @@ -617,7 +626,8 @@
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);
109  
110         if (plus) {
111                 struct nfs_fattr fattr;
This page took 0.732365 seconds and 3 git commands to generate.