diff options
| author | Alexandros Batsakis <batsakis@netapp.com> | 2010-10-20 00:17:56 -0400 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-10-24 18:02:53 -0400 |
| commit | 9449925273933d19235d7d36c1fd970841d055de (patch) | |
| tree | 849b6ef6684e17effa3401fdae698b1af5111050 | |
| parent | c772567d97fa0fca454eea68aeae915ca1bc732b (diff) | |
NFS: change stateid to be a union
In NFSv4.1 the stateid consists of the other and seqid fields. For layout
processing we need to numerically compare the seqid value of layout stateids.
To do so, introduce a union to nfs4_stateid to switch between opaque(16 bytes)
and opaque(12 bytes) / __be32
Signed-off-by: Alexandros Batsakis <batsakis@netapp.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: Fred Isaman <iisaman@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| -rw-r--r-- | fs/nfs/callback_proc.c | 8 | ||||
| -rw-r--r-- | include/linux/nfs4.h | 15 |
2 files changed, 17 insertions, 6 deletions
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index 930d10fecda..2950fca0c61 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c | |||
| @@ -118,11 +118,11 @@ int nfs41_validate_delegation_stateid(struct nfs_delegation *delegation, const n | |||
| 118 | if (delegation == NULL) | 118 | if (delegation == NULL) |
| 119 | return 0; | 119 | return 0; |
| 120 | 120 | ||
| 121 | /* seqid is 4-bytes long */ | 121 | if (stateid->stateid.seqid != 0) |
| 122 | if (((u32 *) &stateid->data)[0] != 0) | ||
| 123 | return 0; | 122 | return 0; |
| 124 | if (memcmp(&delegation->stateid.data[4], &stateid->data[4], | 123 | if (memcmp(&delegation->stateid.stateid.other, |
| 125 | sizeof(stateid->data)-4)) | 124 | &stateid->stateid.other, |
| 125 | NFS4_STATEID_OTHER_SIZE)) | ||
| 126 | return 0; | 126 | return 0; |
| 127 | 127 | ||
| 128 | return 1; | 128 | return 1; |
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index 6c0406e87d5..34da32436ac 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h | |||
| @@ -17,7 +17,9 @@ | |||
| 17 | 17 | ||
| 18 | #define NFS4_BITMAP_SIZE 2 | 18 | #define NFS4_BITMAP_SIZE 2 |
| 19 | #define NFS4_VERIFIER_SIZE 8 | 19 | #define NFS4_VERIFIER_SIZE 8 |
| 20 | #define NFS4_STATEID_SIZE 16 | 20 | #define NFS4_STATEID_SEQID_SIZE 4 |
| 21 | #define NFS4_STATEID_OTHER_SIZE 12 | ||
| 22 | #define NFS4_STATEID_SIZE (NFS4_STATEID_SEQID_SIZE + NFS4_STATEID_OTHER_SIZE) | ||
| 21 | #define NFS4_FHSIZE 128 | 23 | #define NFS4_FHSIZE 128 |
| 22 | #define NFS4_MAXPATHLEN PATH_MAX | 24 | #define NFS4_MAXPATHLEN PATH_MAX |
| 23 | #define NFS4_MAXNAMLEN NAME_MAX | 25 | #define NFS4_MAXNAMLEN NAME_MAX |
| @@ -167,7 +169,16 @@ struct nfs4_acl { | |||
| 167 | }; | 169 | }; |
| 168 | 170 | ||
| 169 | typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier; | 171 | typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier; |
| 170 | typedef struct { char data[NFS4_STATEID_SIZE]; } nfs4_stateid; | 172 | |
| 173 | struct nfs41_stateid { | ||
| 174 | __be32 seqid; | ||
| 175 | char other[NFS4_STATEID_OTHER_SIZE]; | ||
| 176 | } __attribute__ ((packed)); | ||
| 177 | |||
| 178 | typedef union { | ||
| 179 | char data[NFS4_STATEID_SIZE]; | ||
| 180 | struct nfs41_stateid stateid; | ||
| 181 | } nfs4_stateid; | ||
| 171 | 182 | ||
| 172 | enum nfs_opnum4 { | 183 | enum nfs_opnum4 { |
| 173 | OP_ACCESS = 3, | 184 | OP_ACCESS = 3, |
