aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_file.c
diff options
context:
space:
mode:
authorLatchesar Ionkov <lucho@ionkov.net>2006-03-25 06:07:26 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-25 11:22:54 -0500
commit16cce6d27ef52e00cc124196046bbae7150024c1 (patch)
treed4494a6a5146fa7314138f674c2928e31c26bcc0 /fs/9p/vfs_file.c
parent5174fdab9f58181249debab6e959ae4fd4abd0ed (diff)
[PATCH] v9fs: add extension field to Tcreate
Implement a new way of creating special files. Instead of Tcreate+Twstat, add one more field to Tcreate that contains special file description. Signed-off-by: Latchesar Ionkov <lucho@ionkov.net> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/9p/vfs_file.c')
-rw-r--r--fs/9p/vfs_file.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index de3a129698da..1144d59d6469 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -69,29 +69,30 @@ int v9fs_file_open(struct inode *inode, struct file *file)
69 69
70 fid = v9fs_get_idpool(&v9ses->fidpool); 70 fid = v9fs_get_idpool(&v9ses->fidpool);
71 if (fid < 0) { 71 if (fid < 0) {
72 eprintk(KERN_WARNING, "newfid fails!\n"); 72 eprintk(KERN_WARNING, "newfid fails!\n");
73 return -ENOSPC; 73 return -ENOSPC;
74 } 74 }
75 75
76 err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, NULL); 76 err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, NULL);
77 if (err < 0) { 77 if (err < 0) {
78 dprintk(DEBUG_ERROR, "rewalk didn't work\n"); 78 dprintk(DEBUG_ERROR, "rewalk didn't work\n");
79 goto put_fid; 79 goto put_fid;
80 } 80 }
81 81
82 vfid = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL); 82 /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */
83 if (vfid == NULL) { 83 /* translate open mode appropriately */
84 dprintk(DEBUG_ERROR, "out of memory\n");
85 goto clunk_fid;
86 }
87
88 /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */
89 /* translate open mode appropriately */
90 omode = v9fs_uflags2omode(file->f_flags); 84 omode = v9fs_uflags2omode(file->f_flags);
91 err = v9fs_t_open(v9ses, fid, omode, &fcall); 85 err = v9fs_t_open(v9ses, fid, omode, &fcall);
92 if (err < 0) { 86 if (err < 0) {
93 PRINT_FCALL_ERROR("open failed", fcall); 87 PRINT_FCALL_ERROR("open failed", fcall);
94 goto destroy_vfid; 88 goto clunk_fid;
89 }
90
91 vfid = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL);
92 if (vfid == NULL) {
93 dprintk(DEBUG_ERROR, "out of memory\n");
94 err = -ENOMEM;
95 goto clunk_fid;
95 } 96 }
96 97
97 file->private_data = vfid; 98 file->private_data = vfid;
@@ -106,15 +107,12 @@ int v9fs_file_open(struct inode *inode, struct file *file)
106 107
107 return 0; 108 return 0;
108 109
109destroy_vfid:
110 v9fs_fid_destroy(vfid);
111
112clunk_fid: 110clunk_fid:
113 v9fs_t_clunk(v9ses, fid); 111 v9fs_t_clunk(v9ses, fid);
114 112
115put_fid: 113put_fid:
116 v9fs_put_idpool(fid, &v9ses->fidpool); 114 v9fs_put_idpool(fid, &v9ses->fidpool);
117 kfree(fcall); 115 kfree(fcall);
118 116
119 return err; 117 return err;
120} 118}