diff options
author | Eric Van Hensbergen <ericvh@gmail.com> | 2008-10-16 09:30:07 -0400 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2008-10-17 12:04:45 -0400 |
commit | 51a87c552dfd428e304c865e24ecbe091556f226 (patch) | |
tree | 6e9012962e6601b559dcf15ae3228647a8581a31 /fs/9p/vfs_inode.c | |
parent | cb198131b0e7aba755ac164744536d461e86ab82 (diff) |
9p: rework client code to use new protocol support functions
Now that the new protocol functions are in place, this patch switches
the client code to using the new support code.
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p/vfs_inode.c')
-rw-r--r-- | fs/9p/vfs_inode.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index e83aa5ebe861..e96d84aafbe2 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -334,7 +334,7 @@ v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid, | |||
334 | { | 334 | { |
335 | int err, umode; | 335 | int err, umode; |
336 | struct inode *ret; | 336 | struct inode *ret; |
337 | struct p9_stat *st; | 337 | struct p9_wstat *st; |
338 | 338 | ||
339 | ret = NULL; | 339 | ret = NULL; |
340 | st = p9_client_stat(fid); | 340 | st = p9_client_stat(fid); |
@@ -417,6 +417,8 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir, | |||
417 | struct p9_fid *dfid, *ofid, *fid; | 417 | struct p9_fid *dfid, *ofid, *fid; |
418 | struct inode *inode; | 418 | struct inode *inode; |
419 | 419 | ||
420 | P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name); | ||
421 | |||
420 | err = 0; | 422 | err = 0; |
421 | ofid = NULL; | 423 | ofid = NULL; |
422 | fid = NULL; | 424 | fid = NULL; |
@@ -424,6 +426,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir, | |||
424 | dfid = v9fs_fid_clone(dentry->d_parent); | 426 | dfid = v9fs_fid_clone(dentry->d_parent); |
425 | if (IS_ERR(dfid)) { | 427 | if (IS_ERR(dfid)) { |
426 | err = PTR_ERR(dfid); | 428 | err = PTR_ERR(dfid); |
429 | P9_DPRINTK(P9_DEBUG_VFS, "fid clone failed %d\n", err); | ||
427 | dfid = NULL; | 430 | dfid = NULL; |
428 | goto error; | 431 | goto error; |
429 | } | 432 | } |
@@ -432,18 +435,22 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir, | |||
432 | ofid = p9_client_walk(dfid, 0, NULL, 1); | 435 | ofid = p9_client_walk(dfid, 0, NULL, 1); |
433 | if (IS_ERR(ofid)) { | 436 | if (IS_ERR(ofid)) { |
434 | err = PTR_ERR(ofid); | 437 | err = PTR_ERR(ofid); |
438 | P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); | ||
435 | ofid = NULL; | 439 | ofid = NULL; |
436 | goto error; | 440 | goto error; |
437 | } | 441 | } |
438 | 442 | ||
439 | err = p9_client_fcreate(ofid, name, perm, mode, extension); | 443 | err = p9_client_fcreate(ofid, name, perm, mode, extension); |
440 | if (err < 0) | 444 | if (err < 0) { |
445 | P9_DPRINTK(P9_DEBUG_VFS, "p9_client_fcreate failed %d\n", err); | ||
441 | goto error; | 446 | goto error; |
447 | } | ||
442 | 448 | ||
443 | /* now walk from the parent so we can get unopened fid */ | 449 | /* now walk from the parent so we can get unopened fid */ |
444 | fid = p9_client_walk(dfid, 1, &name, 0); | 450 | fid = p9_client_walk(dfid, 1, &name, 0); |
445 | if (IS_ERR(fid)) { | 451 | if (IS_ERR(fid)) { |
446 | err = PTR_ERR(fid); | 452 | err = PTR_ERR(fid); |
453 | P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); | ||
447 | fid = NULL; | 454 | fid = NULL; |
448 | goto error; | 455 | goto error; |
449 | } else | 456 | } else |
@@ -453,6 +460,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir, | |||
453 | inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb); | 460 | inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb); |
454 | if (IS_ERR(inode)) { | 461 | if (IS_ERR(inode)) { |
455 | err = PTR_ERR(inode); | 462 | err = PTR_ERR(inode); |
463 | P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); | ||
456 | goto error; | 464 | goto error; |
457 | } | 465 | } |
458 | 466 | ||
@@ -734,7 +742,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
734 | int err; | 742 | int err; |
735 | struct v9fs_session_info *v9ses; | 743 | struct v9fs_session_info *v9ses; |
736 | struct p9_fid *fid; | 744 | struct p9_fid *fid; |
737 | struct p9_stat *st; | 745 | struct p9_wstat *st; |
738 | 746 | ||
739 | P9_DPRINTK(P9_DEBUG_VFS, "dentry: %p\n", dentry); | 747 | P9_DPRINTK(P9_DEBUG_VFS, "dentry: %p\n", dentry); |
740 | err = -EPERM; | 748 | err = -EPERM; |
@@ -815,10 +823,9 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr) | |||
815 | */ | 823 | */ |
816 | 824 | ||
817 | void | 825 | void |
818 | v9fs_stat2inode(struct p9_stat *stat, struct inode *inode, | 826 | v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode, |
819 | struct super_block *sb) | 827 | struct super_block *sb) |
820 | { | 828 | { |
821 | int n; | ||
822 | char ext[32]; | 829 | char ext[32]; |
823 | struct v9fs_session_info *v9ses = sb->s_fs_info; | 830 | struct v9fs_session_info *v9ses = sb->s_fs_info; |
824 | 831 | ||
@@ -842,11 +849,7 @@ v9fs_stat2inode(struct p9_stat *stat, struct inode *inode, | |||
842 | int major = -1; | 849 | int major = -1; |
843 | int minor = -1; | 850 | int minor = -1; |
844 | 851 | ||
845 | n = stat->extension.len; | 852 | strncpy(ext, stat->extension, sizeof(ext)); |
846 | if (n > sizeof(ext)-1) | ||
847 | n = sizeof(ext)-1; | ||
848 | memmove(ext, stat->extension.str, n); | ||
849 | ext[n] = 0; | ||
850 | sscanf(ext, "%c %u %u", &type, &major, &minor); | 853 | sscanf(ext, "%c %u %u", &type, &major, &minor); |
851 | switch (type) { | 854 | switch (type) { |
852 | case 'c': | 855 | case 'c': |
@@ -857,8 +860,8 @@ v9fs_stat2inode(struct p9_stat *stat, struct inode *inode, | |||
857 | break; | 860 | break; |
858 | default: | 861 | default: |
859 | P9_DPRINTK(P9_DEBUG_ERROR, | 862 | P9_DPRINTK(P9_DEBUG_ERROR, |
860 | "Unknown special type %c (%.*s)\n", type, | 863 | "Unknown special type %c %s\n", type, |
861 | stat->extension.len, stat->extension.str); | 864 | stat->extension); |
862 | }; | 865 | }; |
863 | inode->i_rdev = MKDEV(major, minor); | 866 | inode->i_rdev = MKDEV(major, minor); |
864 | } else | 867 | } else |
@@ -904,7 +907,7 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen) | |||
904 | 907 | ||
905 | struct v9fs_session_info *v9ses; | 908 | struct v9fs_session_info *v9ses; |
906 | struct p9_fid *fid; | 909 | struct p9_fid *fid; |
907 | struct p9_stat *st; | 910 | struct p9_wstat *st; |
908 | 911 | ||
909 | P9_DPRINTK(P9_DEBUG_VFS, " %s\n", dentry->d_name.name); | 912 | P9_DPRINTK(P9_DEBUG_VFS, " %s\n", dentry->d_name.name); |
910 | retval = -EPERM; | 913 | retval = -EPERM; |
@@ -926,15 +929,10 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen) | |||
926 | } | 929 | } |
927 | 930 | ||
928 | /* copy extension buffer into buffer */ | 931 | /* copy extension buffer into buffer */ |
929 | if (st->extension.len < buflen) | 932 | strncpy(buffer, st->extension, buflen); |
930 | buflen = st->extension.len + 1; | ||
931 | |||
932 | memmove(buffer, st->extension.str, buflen - 1); | ||
933 | buffer[buflen-1] = 0; | ||
934 | 933 | ||
935 | P9_DPRINTK(P9_DEBUG_VFS, | 934 | P9_DPRINTK(P9_DEBUG_VFS, |
936 | "%s -> %.*s (%s)\n", dentry->d_name.name, st->extension.len, | 935 | "%s -> %s (%s)\n", dentry->d_name.name, st->extension, buffer); |
937 | st->extension.str, buffer); | ||
938 | 936 | ||
939 | retval = buflen; | 937 | retval = buflen; |
940 | 938 | ||