aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2007-09-14 01:22:37 -0400
committerTim Shimmin <tes@chook.melbourne.sgi.com>2007-10-19 04:02:55 -0400
commitc6143911a7e0f8abef0319c801eb36718f57dfde (patch)
tree86138962b153b617b5c117797394e23337f979c7
parentc8fcfac5a257f8a04f7ba3d397dedccffef19be2 (diff)
[XFS] cleanup fid types mess
Currently XFs has three different fid types: struct fid, struct xfs_fid and struct xfs_fid2 with hte latter two beeing identicaly and the first one beeing the same size but an unstructured array with the same size. This patch consolidates all this to alway uuse struct xfs_fid. This patch is required for an upcoming patch series from me that revamps the nfs exporting code and introduces a Linux-wide struct fid. SGI-PV: 970336 SGI-Modid: xfs-linux-melb:xfs-kern:29651a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com> Signed-off-by: Tim Shimmin <tes@sgi.com>
-rw-r--r--fs/xfs/linux-2.6/xfs_export.c6
-rw-r--r--fs/xfs/linux-2.6/xfs_export.h6
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c24
-rw-r--r--fs/xfs/xfs_fs.h29
-rw-r--r--fs/xfs/xfs_vfsops.c9
-rw-r--r--fs/xfs/xfs_vfsops.h4
-rw-r--r--fs/xfs/xfs_vnodeops.c13
-rw-r--r--fs/xfs/xfs_vnodeops.h2
8 files changed, 33 insertions, 60 deletions
diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c
index 726449d4fd22..3586c7a28d2c 100644
--- a/fs/xfs/linux-2.6/xfs_export.c
+++ b/fs/xfs/linux-2.6/xfs_export.c
@@ -54,8 +54,8 @@ xfs_fs_decode_fh(
54 struct dentry *de), 54 struct dentry *de),
55 void *context) 55 void *context)
56{ 56{
57 xfs_fid2_t ifid; 57 xfs_fid_t ifid;
58 xfs_fid2_t pfid; 58 xfs_fid_t pfid;
59 void *parent = NULL; 59 void *parent = NULL;
60 int is64 = 0; 60 int is64 = 0;
61 __u32 *p = fh; 61 __u32 *p = fh;
@@ -144,7 +144,7 @@ xfs_fs_get_dentry(
144 struct dentry *result; 144 struct dentry *result;
145 int error; 145 int error;
146 146
147 error = xfs_vget(XFS_M(sb), &vp, (fid_t *)data); 147 error = xfs_vget(XFS_M(sb), &vp, data);
148 if (error || vp == NULL) 148 if (error || vp == NULL)
149 return ERR_PTR(-ESTALE) ; 149 return ERR_PTR(-ESTALE) ;
150 150
diff --git a/fs/xfs/linux-2.6/xfs_export.h b/fs/xfs/linux-2.6/xfs_export.h
index e794ca4efc76..2f36071a86f7 100644
--- a/fs/xfs/linux-2.6/xfs_export.h
+++ b/fs/xfs/linux-2.6/xfs_export.h
@@ -71,13 +71,13 @@ xfs_fileid_length(int hasparent, int is64)
71 71
72/* 72/*
73 * Decode encoded inode information (either for the inode itself 73 * Decode encoded inode information (either for the inode itself
74 * or the parent) into an xfs_fid2_t structure. Advances and 74 * or the parent) into an xfs_fid_t structure. Advances and
75 * returns the new data pointer 75 * returns the new data pointer
76 */ 76 */
77static inline __u32 * 77static inline __u32 *
78xfs_fileid_decode_fid2(__u32 *p, xfs_fid2_t *fid, int is64) 78xfs_fileid_decode_fid2(__u32 *p, xfs_fid_t *fid, int is64)
79{ 79{
80 fid->fid_len = sizeof(xfs_fid2_t) - sizeof(fid->fid_len); 80 fid->fid_len = sizeof(xfs_fid_t) - sizeof(fid->fid_len);
81 fid->fid_pad = 0; 81 fid->fid_pad = 0;
82 fid->fid_ino = *p++; 82 fid->fid_ino = *p++;
83#if XFS_BIG_INUMS 83#if XFS_BIG_INUMS
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index ffec630e7db7..2b34bad48b07 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -152,11 +152,11 @@ xfs_find_handle(
152 lock_mode = xfs_ilock_map_shared(ip); 152 lock_mode = xfs_ilock_map_shared(ip);
153 153
154 /* fill in fid section of handle from inode */ 154 /* fill in fid section of handle from inode */
155 handle.ha_fid.xfs_fid_len = sizeof(xfs_fid_t) - 155 handle.ha_fid.fid_len = sizeof(xfs_fid_t) -
156 sizeof(handle.ha_fid.xfs_fid_len); 156 sizeof(handle.ha_fid.fid_len);
157 handle.ha_fid.xfs_fid_pad = 0; 157 handle.ha_fid.fid_pad = 0;
158 handle.ha_fid.xfs_fid_gen = ip->i_d.di_gen; 158 handle.ha_fid.fid_gen = ip->i_d.di_gen;
159 handle.ha_fid.xfs_fid_ino = ip->i_ino; 159 handle.ha_fid.fid_ino = ip->i_ino;
160 160
161 xfs_iunlock_map_shared(ip, lock_mode); 161 xfs_iunlock_map_shared(ip, lock_mode);
162 162
@@ -222,10 +222,10 @@ xfs_vget_fsop_handlereq(
222 if (hlen < sizeof(*handlep)) 222 if (hlen < sizeof(*handlep))
223 memset(((char *)handlep) + hlen, 0, sizeof(*handlep) - hlen); 223 memset(((char *)handlep) + hlen, 0, sizeof(*handlep) - hlen);
224 if (hlen > sizeof(handlep->ha_fsid)) { 224 if (hlen > sizeof(handlep->ha_fsid)) {
225 if (handlep->ha_fid.xfs_fid_len != 225 if (handlep->ha_fid.fid_len !=
226 (hlen - sizeof(handlep->ha_fsid) 226 (hlen - sizeof(handlep->ha_fsid) -
227 - sizeof(handlep->ha_fid.xfs_fid_len)) 227 sizeof(handlep->ha_fid.fid_len)) ||
228 || handlep->ha_fid.xfs_fid_pad) 228 handlep->ha_fid.fid_pad)
229 return XFS_ERROR(EINVAL); 229 return XFS_ERROR(EINVAL);
230 } 230 }
231 231
@@ -233,9 +233,9 @@ xfs_vget_fsop_handlereq(
233 * Crack the handle, obtain the inode # & generation # 233 * Crack the handle, obtain the inode # & generation #
234 */ 234 */
235 xfid = (struct xfs_fid *)&handlep->ha_fid; 235 xfid = (struct xfs_fid *)&handlep->ha_fid;
236 if (xfid->xfs_fid_len == sizeof(*xfid) - sizeof(xfid->xfs_fid_len)) { 236 if (xfid->fid_len == sizeof(*xfid) - sizeof(xfid->fid_len)) {
237 ino = xfid->xfs_fid_ino; 237 ino = xfid->fid_ino;
238 igen = xfid->xfs_fid_gen; 238 igen = xfid->fid_gen;
239 } else { 239 } else {
240 return XFS_ERROR(EINVAL); 240 return XFS_ERROR(EINVAL);
241 } 241 }
diff --git a/fs/xfs/xfs_fs.h b/fs/xfs/xfs_fs.h
index ec3c9c27e0de..aab966276517 100644
--- a/fs/xfs/xfs_fs.h
+++ b/fs/xfs/xfs_fs.h
@@ -389,30 +389,13 @@ typedef struct xfs_fsop_attrmulti_handlereq {
389 */ 389 */
390typedef struct { __u32 val[2]; } xfs_fsid_t; /* file system id type */ 390typedef struct { __u32 val[2]; } xfs_fsid_t; /* file system id type */
391 391
392
393#ifndef HAVE_FID
394#define MAXFIDSZ 46
395
396typedef struct fid {
397 __u16 fid_len; /* length of data in bytes */
398 unsigned char fid_data[MAXFIDSZ]; /* data (fid_len worth) */
399} fid_t;
400#endif
401
402typedef struct xfs_fid { 392typedef struct xfs_fid {
403 __u16 xfs_fid_len; /* length of remainder */ 393 __u16 fid_len; /* length of remainder */
404 __u16 xfs_fid_pad; 394 __u16 fid_pad;
405 __u32 xfs_fid_gen; /* generation number */ 395 __u32 fid_gen; /* generation number */
406 __u64 xfs_fid_ino; /* 64 bits inode number */ 396 __u64 fid_ino; /* 64 bits inode number */
407} xfs_fid_t; 397} xfs_fid_t;
408 398
409typedef struct xfs_fid2 {
410 __u16 fid_len; /* length of remainder */
411 __u16 fid_pad; /* padding, must be zero */
412 __u32 fid_gen; /* generation number */
413 __u64 fid_ino; /* inode number */
414} xfs_fid2_t;
415
416typedef struct xfs_handle { 399typedef struct xfs_handle {
417 union { 400 union {
418 __s64 align; /* force alignment of ha_fid */ 401 __s64 align; /* force alignment of ha_fid */
@@ -422,9 +405,9 @@ typedef struct xfs_handle {
422} xfs_handle_t; 405} xfs_handle_t;
423#define ha_fsid ha_u._ha_fsid 406#define ha_fsid ha_u._ha_fsid
424 407
425#define XFS_HSIZE(handle) (((char *) &(handle).ha_fid.xfs_fid_pad \ 408#define XFS_HSIZE(handle) (((char *) &(handle).ha_fid.fid_pad \
426 - (char *) &(handle)) \ 409 - (char *) &(handle)) \
427 + (handle).ha_fid.xfs_fid_len) 410 + (handle).ha_fid.fid_len)
428 411
429/* 412/*
430 * Flags for going down operation 413 * Flags for going down operation
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c
index a5a8454f2a63..a1544597bcd3 100644
--- a/fs/xfs/xfs_vfsops.c
+++ b/fs/xfs/xfs_vfsops.c
@@ -1635,9 +1635,8 @@ int
1635xfs_vget( 1635xfs_vget(
1636 xfs_mount_t *mp, 1636 xfs_mount_t *mp,
1637 bhv_vnode_t **vpp, 1637 bhv_vnode_t **vpp,
1638 fid_t *fidp) 1638 xfs_fid_t *xfid)
1639{ 1639{
1640 xfs_fid_t *xfid = (struct xfs_fid *)fidp;
1641 xfs_inode_t *ip; 1640 xfs_inode_t *ip;
1642 int error; 1641 int error;
1643 xfs_ino_t ino; 1642 xfs_ino_t ino;
@@ -1647,11 +1646,11 @@ xfs_vget(
1647 * Invalid. Since handles can be created in user space and passed in 1646 * Invalid. Since handles can be created in user space and passed in
1648 * via gethandle(), this is not cause for a panic. 1647 * via gethandle(), this is not cause for a panic.
1649 */ 1648 */
1650 if (xfid->xfs_fid_len != sizeof(*xfid) - sizeof(xfid->xfs_fid_len)) 1649 if (xfid->fid_len != sizeof(*xfid) - sizeof(xfid->fid_len))
1651 return XFS_ERROR(EINVAL); 1650 return XFS_ERROR(EINVAL);
1652 1651
1653 ino = xfid->xfs_fid_ino; 1652 ino = xfid->fid_ino;
1654 igen = xfid->xfs_fid_gen; 1653 igen = xfid->fid_gen;
1655 1654
1656 /* 1655 /*
1657 * NFS can sometimes send requests for ino 0. Fail them gracefully. 1656 * NFS can sometimes send requests for ino 0. Fail them gracefully.
diff --git a/fs/xfs/xfs_vfsops.h b/fs/xfs/xfs_vfsops.h
index bc99e3eb7dbb..a592fe02a339 100644
--- a/fs/xfs/xfs_vfsops.h
+++ b/fs/xfs/xfs_vfsops.h
@@ -2,7 +2,7 @@
2#define _XFS_VFSOPS_H 1 2#define _XFS_VFSOPS_H 1
3 3
4struct cred; 4struct cred;
5struct fid; 5struct xfs_fid;
6struct inode; 6struct inode;
7struct kstatfs; 7struct kstatfs;
8struct xfs_mount; 8struct xfs_mount;
@@ -17,7 +17,7 @@ int xfs_root(struct xfs_mount *mp, bhv_vnode_t **vpp);
17int xfs_statvfs(struct xfs_mount *mp, struct kstatfs *statp, 17int xfs_statvfs(struct xfs_mount *mp, struct kstatfs *statp,
18 bhv_vnode_t *vp); 18 bhv_vnode_t *vp);
19int xfs_sync(struct xfs_mount *mp, int flags); 19int xfs_sync(struct xfs_mount *mp, int flags);
20int xfs_vget(struct xfs_mount *mp, bhv_vnode_t **vpp, struct fid *fidp); 20int xfs_vget(struct xfs_mount *mp, bhv_vnode_t **vpp, struct xfs_fid *xfid);
21int xfs_parseargs(struct xfs_mount *mp, char *options, 21int xfs_parseargs(struct xfs_mount *mp, char *options,
22 struct xfs_mount_args *args, int update); 22 struct xfs_mount_args *args, int update);
23int xfs_showargs(struct xfs_mount *mp, struct seq_file *m); 23int xfs_showargs(struct xfs_mount *mp, struct seq_file *m);
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 5e3c57ca9981..efd5aff9eaf6 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -3466,23 +3466,14 @@ std_return:
3466} 3466}
3467 3467
3468 3468
3469/*
3470 * xfs_fid2
3471 *
3472 * A fid routine that takes a pointer to a previously allocated
3473 * fid structure (like xfs_fast_fid) but uses a 64 bit inode number.
3474 */
3475int 3469int
3476xfs_fid2( 3470xfs_fid2(
3477 xfs_inode_t *ip, 3471 xfs_inode_t *ip,
3478 fid_t *fidp) 3472 xfs_fid_t *xfid)
3479{ 3473{
3480 xfs_fid2_t *xfid = (xfs_fid2_t *)fidp;
3481
3482 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address); 3474 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
3483 ASSERT(sizeof(fid_t) >= sizeof(xfs_fid2_t));
3484 3475
3485 xfid->fid_len = sizeof(xfs_fid2_t) - sizeof(xfid->fid_len); 3476 xfid->fid_len = sizeof(xfs_fid_t) - sizeof(xfid->fid_len);
3486 xfid->fid_pad = 0; 3477 xfid->fid_pad = 0;
3487 /* 3478 /*
3488 * use memcpy because the inode is a long long and there's no 3479 * use memcpy because the inode is a long long and there's no
diff --git a/fs/xfs/xfs_vnodeops.h b/fs/xfs/xfs_vnodeops.h
index f36e74f2f0c2..b7e461c40cfb 100644
--- a/fs/xfs/xfs_vnodeops.h
+++ b/fs/xfs/xfs_vnodeops.h
@@ -39,7 +39,7 @@ int xfs_readdir(struct xfs_inode *dp, void *dirent, size_t bufsize,
39int xfs_symlink(struct xfs_inode *dp, bhv_vname_t *dentry, 39int xfs_symlink(struct xfs_inode *dp, bhv_vname_t *dentry,
40 char *target_path, mode_t mode, bhv_vnode_t **vpp, 40 char *target_path, mode_t mode, bhv_vnode_t **vpp,
41 struct cred *credp); 41 struct cred *credp);
42int xfs_fid2(struct xfs_inode *ip, fid_t *fidp); 42int xfs_fid2(struct xfs_inode *ip, struct xfs_fid *xfid);
43int xfs_rwlock(struct xfs_inode *ip, bhv_vrwlock_t locktype); 43int xfs_rwlock(struct xfs_inode *ip, bhv_vrwlock_t locktype);
44void xfs_rwunlock(struct xfs_inode *ip, bhv_vrwlock_t locktype); 44void xfs_rwunlock(struct xfs_inode *ip, bhv_vrwlock_t locktype);
45int xfs_inode_flush(struct xfs_inode *ip, int flags); 45int xfs_inode_flush(struct xfs_inode *ip, int flags);