Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5fe0c237 authored by Aneesh Kumar K.V's avatar Aneesh Kumar K.V Committed by Al Viro
Browse files

exportfs: Return the minimum required handle size



The exportfs encode handle function should return the minimum required
handle size. This helps user to find out the handle size by passing 0
handle size in the first step and then redoing to the call again with
the returned handle size value.

Acked-by: default avatarSerge Hallyn <serue@us.ibm.com>
Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent c8b91acc
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -21,9 +21,13 @@ static int btrfs_encode_fh(struct dentry *dentry, u32 *fh, int *max_len,
	int len = *max_len;
	int type;

	if ((len < BTRFS_FID_SIZE_NON_CONNECTABLE) ||
	    (connectable && len < BTRFS_FID_SIZE_CONNECTABLE))
	if (connectable && (len < BTRFS_FID_SIZE_CONNECTABLE)) {
		*max_len = BTRFS_FID_SIZE_CONNECTABLE;
		return 255;
	} else if (len < BTRFS_FID_SIZE_NON_CONNECTABLE) {
		*max_len = BTRFS_FID_SIZE_NON_CONNECTABLE;
		return 255;
	}

	len  = BTRFS_FID_SIZE_NON_CONNECTABLE;
	type = FILEID_BTRFS_WITHOUT_PARENT;
+7 −2
Original line number Diff line number Diff line
@@ -321,8 +321,13 @@ static int export_encode_fh(struct dentry *dentry, struct fid *fid,
	int len = *max_len;
	int type = FILEID_INO32_GEN;

	if (len < 2 || (connectable && len < 4))
	if (connectable && (len < 4)) {
		*max_len = 4;
		return 255;
	} else if (len < 2) {
		*max_len = 2;
		return 255;
	}

	len = 2;
	fid->i32.ino = inode->i_ino;
+3 −1
Original line number Diff line number Diff line
@@ -757,8 +757,10 @@ fat_encode_fh(struct dentry *de, __u32 *fh, int *lenp, int connectable)
	struct inode *inode =  de->d_inode;
	u32 ipos_h, ipos_m, ipos_l;

	if (len < 5)
	if (len < 5) {
		*lenp = 5;
		return 255; /* no room */
	}

	ipos_h = MSDOS_I(inode)->i_pos >> 8;
	ipos_m = (MSDOS_I(inode)->i_pos & 0xf0) << 24;
+3 −1
Original line number Diff line number Diff line
@@ -637,8 +637,10 @@ static int fuse_encode_fh(struct dentry *dentry, u32 *fh, int *max_len,
	u64 nodeid;
	u32 generation;

	if (*max_len < len)
	if (*max_len < len) {
		*max_len = len;
		return  255;
	}

	nodeid = get_fuse_inode(inode)->nodeid;
	generation = inode->i_generation;
+6 −2
Original line number Diff line number Diff line
@@ -36,9 +36,13 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *p, int *len,
	struct super_block *sb = inode->i_sb;
	struct gfs2_inode *ip = GFS2_I(inode);

	if (*len < GFS2_SMALL_FH_SIZE ||
	    (connectable && *len < GFS2_LARGE_FH_SIZE))
	if (connectable && (*len < GFS2_LARGE_FH_SIZE)) {
		*len = GFS2_LARGE_FH_SIZE;
		return 255;
	} else if (*len < GFS2_SMALL_FH_SIZE) {
		*len = GFS2_SMALL_FH_SIZE;
		return 255;
	}

	fh[0] = cpu_to_be32(ip->i_no_formal_ino >> 32);
	fh[1] = cpu_to_be32(ip->i_no_formal_ino & 0xFFFFFFFF);
Loading