aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2010-03-05 15:43:43 -0500
committerEric Van Hensbergen <ericvh@gmail.com>2010-03-05 16:04:42 -0500
commit5717144a01d701614cfdb15f09ed562d720cf3db (patch)
treead9e54c39587483b0f680d3dbf4f8dd606f1f9c0 /fs/9p
parentc5a7697da9775f7a0e122fa23180becc311772d1 (diff)
fs/9p: Add hardlink support to .u extension
For regular file and directories we put the link count in th extension field in a tagged string format. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p')
-rw-r--r--fs/9p/vfs_inode.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index d3d3c3c20001..5fe45d692c9f 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -887,6 +887,8 @@ v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
887 struct super_block *sb) 887 struct super_block *sb)
888{ 888{
889 char ext[32]; 889 char ext[32];
890 char tag_name[14];
891 unsigned int i_nlink;
890 struct v9fs_session_info *v9ses = sb->s_fs_info; 892 struct v9fs_session_info *v9ses = sb->s_fs_info;
891 893
892 inode->i_nlink = 1; 894 inode->i_nlink = 1;
@@ -902,7 +904,22 @@ v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
902 inode->i_uid = stat->n_uid; 904 inode->i_uid = stat->n_uid;
903 inode->i_gid = stat->n_gid; 905 inode->i_gid = stat->n_gid;
904 } 906 }
905 907 if ((S_ISREG(inode->i_mode)) || (S_ISDIR(inode->i_mode))) {
908 if (v9fs_proto_dotu(v9ses) && (stat->extension[0] != '\0')) {
909 /*
910 * Hadlink support got added later to
911 * to the .u extension. So there can be
912 * server out there that doesn't support
913 * this even with .u extension. So check
914 * for non NULL stat->extension
915 */
916 strncpy(ext, stat->extension, sizeof(ext));
917 /* HARDLINKCOUNT %u */
918 sscanf(ext, "%13s %u", tag_name, &i_nlink);
919 if (!strncmp(tag_name, "HARDLINKCOUNT", 13))
920 inode->i_nlink = i_nlink;
921 }
922 }
906 inode->i_mode = p9mode2unixmode(v9ses, stat->mode); 923 inode->i_mode = p9mode2unixmode(v9ses, stat->mode);
907 if ((S_ISBLK(inode->i_mode)) || (S_ISCHR(inode->i_mode))) { 924 if ((S_ISBLK(inode->i_mode)) || (S_ISCHR(inode->i_mode))) {
908 char type = 0; 925 char type = 0;