aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamjae Jeon <linkinjeon@gmail.com>2012-08-29 10:10:10 -0400
committerJ. Bruce Fields <bfields@redhat.com>2012-11-07 19:22:30 -0500
commit216b6cbdcbd86b1db0754d58886b466ae31f5a63 (patch)
tree409ef2bc2fcc5a8336453d29f8a5eac9dd45ec10
parent6f0c0580b70c89094b3422ba81118c7b959c7556 (diff)
exportfs: add FILEID_INVALID to indicate invalid fid_type
This commit adds FILEID_INVALID = 0xff in fid_type to indicate invalid fid_type It avoids using magic number 255 Signed-off-by: Namjae Jeon <linkinjeon@gmail.com> Signed-off-by: Vivek Trivedi <vtrivedi018@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r--fs/exportfs/expfs.c4
-rw-r--r--fs/fhandle.c2
-rw-r--r--fs/nfsd/nfsfh.c4
-rw-r--r--include/linux/exportfs.h5
4 files changed, 10 insertions, 5 deletions
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
index 29ab099e3e08..f1f1c59c2966 100644
--- a/fs/exportfs/expfs.c
+++ b/fs/exportfs/expfs.c
@@ -322,10 +322,10 @@ static int export_encode_fh(struct inode *inode, struct fid *fid,
322 322
323 if (parent && (len < 4)) { 323 if (parent && (len < 4)) {
324 *max_len = 4; 324 *max_len = 4;
325 return 255; 325 return FILEID_INVALID;
326 } else if (len < 2) { 326 } else if (len < 2) {
327 *max_len = 2; 327 *max_len = 2;
328 return 255; 328 return FILEID_INVALID;
329 } 329 }
330 330
331 len = 2; 331 len = 2;
diff --git a/fs/fhandle.c b/fs/fhandle.c
index f775bfdd6e4a..26f12b95702a 100644
--- a/fs/fhandle.c
+++ b/fs/fhandle.c
@@ -52,7 +52,7 @@ static long do_sys_name_to_handle(struct path *path,
52 handle_bytes = handle_dwords * sizeof(u32); 52 handle_bytes = handle_dwords * sizeof(u32);
53 handle->handle_bytes = handle_bytes; 53 handle->handle_bytes = handle_bytes;
54 if ((handle->handle_bytes > f_handle.handle_bytes) || 54 if ((handle->handle_bytes > f_handle.handle_bytes) ||
55 (retval == 255) || (retval == -ENOSPC)) { 55 (retval == FILEID_INVALID) || (retval == -ENOSPC)) {
56 /* As per old exportfs_encode_fh documentation 56 /* As per old exportfs_encode_fh documentation
57 * we could return ENOSPC to indicate overflow 57 * we could return ENOSPC to indicate overflow
58 * But file system returned 255 always. So handle 58 * But file system returned 255 always. So handle
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index 032af381b3aa..814afaa4458a 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -572,7 +572,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
572 572
573 if (inode) 573 if (inode)
574 _fh_update(fhp, exp, dentry); 574 _fh_update(fhp, exp, dentry);
575 if (fhp->fh_handle.fh_fileid_type == 255) { 575 if (fhp->fh_handle.fh_fileid_type == FILEID_INVALID) {
576 fh_put(fhp); 576 fh_put(fhp);
577 return nfserr_opnotsupp; 577 return nfserr_opnotsupp;
578 } 578 }
@@ -603,7 +603,7 @@ fh_update(struct svc_fh *fhp)
603 goto out; 603 goto out;
604 604
605 _fh_update(fhp, fhp->fh_export, dentry); 605 _fh_update(fhp, fhp->fh_export, dentry);
606 if (fhp->fh_handle.fh_fileid_type == 255) 606 if (fhp->fh_handle.fh_fileid_type == FILEID_INVALID)
607 return nfserr_opnotsupp; 607 return nfserr_opnotsupp;
608 } 608 }
609out: 609out:
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
index 12291a7ee275..0e1452546300 100644
--- a/include/linux/exportfs.h
+++ b/include/linux/exportfs.h
@@ -83,6 +83,11 @@ enum fid_type {
83 * 64 bit parent inode number. 83 * 64 bit parent inode number.
84 */ 84 */
85 FILEID_NILFS_WITH_PARENT = 0x62, 85 FILEID_NILFS_WITH_PARENT = 0x62,
86
87 /*
88 * Filesystems must not use 0xff file ID.
89 */
90 FILEID_INVALID = 0xff,
86}; 91};
87 92
88struct fid { 93struct fid {