mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-19 02:54:00 +08:00
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>
This commit is contained in:
parent
6f0c0580b7
commit
216b6cbdcb
@ -322,10 +322,10 @@ static int export_encode_fh(struct inode *inode, struct fid *fid,
|
|||||||
|
|
||||||
if (parent && (len < 4)) {
|
if (parent && (len < 4)) {
|
||||||
*max_len = 4;
|
*max_len = 4;
|
||||||
return 255;
|
return FILEID_INVALID;
|
||||||
} else if (len < 2) {
|
} else if (len < 2) {
|
||||||
*max_len = 2;
|
*max_len = 2;
|
||||||
return 255;
|
return FILEID_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = 2;
|
len = 2;
|
||||||
|
@ -52,7 +52,7 @@ static long do_sys_name_to_handle(struct path *path,
|
|||||||
handle_bytes = handle_dwords * sizeof(u32);
|
handle_bytes = handle_dwords * sizeof(u32);
|
||||||
handle->handle_bytes = handle_bytes;
|
handle->handle_bytes = handle_bytes;
|
||||||
if ((handle->handle_bytes > f_handle.handle_bytes) ||
|
if ((handle->handle_bytes > f_handle.handle_bytes) ||
|
||||||
(retval == 255) || (retval == -ENOSPC)) {
|
(retval == FILEID_INVALID) || (retval == -ENOSPC)) {
|
||||||
/* As per old exportfs_encode_fh documentation
|
/* As per old exportfs_encode_fh documentation
|
||||||
* we could return ENOSPC to indicate overflow
|
* we could return ENOSPC to indicate overflow
|
||||||
* But file system returned 255 always. So handle
|
* But file system returned 255 always. So handle
|
||||||
|
@ -572,7 +572,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
|
|||||||
|
|
||||||
if (inode)
|
if (inode)
|
||||||
_fh_update(fhp, exp, dentry);
|
_fh_update(fhp, exp, dentry);
|
||||||
if (fhp->fh_handle.fh_fileid_type == 255) {
|
if (fhp->fh_handle.fh_fileid_type == FILEID_INVALID) {
|
||||||
fh_put(fhp);
|
fh_put(fhp);
|
||||||
return nfserr_opnotsupp;
|
return nfserr_opnotsupp;
|
||||||
}
|
}
|
||||||
@ -603,7 +603,7 @@ fh_update(struct svc_fh *fhp)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
_fh_update(fhp, fhp->fh_export, dentry);
|
_fh_update(fhp, fhp->fh_export, dentry);
|
||||||
if (fhp->fh_handle.fh_fileid_type == 255)
|
if (fhp->fh_handle.fh_fileid_type == FILEID_INVALID)
|
||||||
return nfserr_opnotsupp;
|
return nfserr_opnotsupp;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
|
@ -83,6 +83,11 @@ enum fid_type {
|
|||||||
* 64 bit parent inode number.
|
* 64 bit parent inode number.
|
||||||
*/
|
*/
|
||||||
FILEID_NILFS_WITH_PARENT = 0x62,
|
FILEID_NILFS_WITH_PARENT = 0x62,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Filesystems must not use 0xff file ID.
|
||||||
|
*/
|
||||||
|
FILEID_INVALID = 0xff,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct fid {
|
struct fid {
|
||||||
|
Loading…
Reference in New Issue
Block a user