Commit 216b6cbdcbd86b1db0754d58886b466ae31f5a63

Authored by Namjae Jeon
Committed by J. Bruce Fields
1 parent 6f0c0580b7

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>

Showing 4 changed files with 10 additions and 5 deletions Side-by-side Diff

... ... @@ -322,10 +322,10 @@
322 322  
323 323 if (parent && (len < 4)) {
324 324 *max_len = 4;
325   - return 255;
  325 + return FILEID_INVALID;
326 326 } else if (len < 2) {
327 327 *max_len = 2;
328   - return 255;
  328 + return FILEID_INVALID;
329 329 }
330 330  
331 331 len = 2;
... ... @@ -52,7 +52,7 @@
52 52 handle_bytes = handle_dwords * sizeof(u32);
53 53 handle->handle_bytes = handle_bytes;
54 54 if ((handle->handle_bytes > f_handle.handle_bytes) ||
55   - (retval == 255) || (retval == -ENOSPC)) {
  55 + (retval == FILEID_INVALID) || (retval == -ENOSPC)) {
56 56 /* As per old exportfs_encode_fh documentation
57 57 * we could return ENOSPC to indicate overflow
58 58 * But file system returned 255 always. So handle
... ... @@ -572,7 +572,7 @@
572 572  
573 573 if (inode)
574 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 576 fh_put(fhp);
577 577 return nfserr_opnotsupp;
578 578 }
... ... @@ -603,7 +603,7 @@
603 603 goto out;
604 604  
605 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 607 return nfserr_opnotsupp;
608 608 }
609 609 out:
include/linux/exportfs.h
... ... @@ -83,6 +83,11 @@
83 83 * 64 bit parent inode number.
84 84 */
85 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  
88 93 struct fid {