diff options
Diffstat (limited to 'fs/9p/vfs_file.c')
-rw-r--r-- | fs/9p/vfs_file.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index de3a129698da..083dcfcd158e 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c | |||
@@ -7,9 +7,8 @@ | |||
7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 12 | * |
14 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -69,29 +68,30 @@ int v9fs_file_open(struct inode *inode, struct file *file) | |||
69 | 68 | ||
70 | fid = v9fs_get_idpool(&v9ses->fidpool); | 69 | fid = v9fs_get_idpool(&v9ses->fidpool); |
71 | if (fid < 0) { | 70 | if (fid < 0) { |
72 | eprintk(KERN_WARNING, "newfid fails!\n"); | 71 | eprintk(KERN_WARNING, "newfid fails!\n"); |
73 | return -ENOSPC; | 72 | return -ENOSPC; |
74 | } | 73 | } |
75 | 74 | ||
76 | err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, NULL); | 75 | err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, NULL); |
77 | if (err < 0) { | 76 | if (err < 0) { |
78 | dprintk(DEBUG_ERROR, "rewalk didn't work\n"); | 77 | dprintk(DEBUG_ERROR, "rewalk didn't work\n"); |
79 | goto put_fid; | 78 | goto put_fid; |
80 | } | 79 | } |
81 | 80 | ||
82 | vfid = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL); | 81 | /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */ |
83 | if (vfid == NULL) { | 82 | /* 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); | 83 | omode = v9fs_uflags2omode(file->f_flags); |
91 | err = v9fs_t_open(v9ses, fid, omode, &fcall); | 84 | err = v9fs_t_open(v9ses, fid, omode, &fcall); |
92 | if (err < 0) { | 85 | if (err < 0) { |
93 | PRINT_FCALL_ERROR("open failed", fcall); | 86 | PRINT_FCALL_ERROR("open failed", fcall); |
94 | goto destroy_vfid; | 87 | goto clunk_fid; |
88 | } | ||
89 | |||
90 | vfid = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL); | ||
91 | if (vfid == NULL) { | ||
92 | dprintk(DEBUG_ERROR, "out of memory\n"); | ||
93 | err = -ENOMEM; | ||
94 | goto clunk_fid; | ||
95 | } | 95 | } |
96 | 96 | ||
97 | file->private_data = vfid; | 97 | file->private_data = vfid; |
@@ -106,15 +106,12 @@ int v9fs_file_open(struct inode *inode, struct file *file) | |||
106 | 106 | ||
107 | return 0; | 107 | return 0; |
108 | 108 | ||
109 | destroy_vfid: | ||
110 | v9fs_fid_destroy(vfid); | ||
111 | |||
112 | clunk_fid: | 109 | clunk_fid: |
113 | v9fs_t_clunk(v9ses, fid); | 110 | v9fs_t_clunk(v9ses, fid); |
114 | 111 | ||
115 | put_fid: | 112 | put_fid: |
116 | v9fs_put_idpool(fid, &v9ses->fidpool); | 113 | v9fs_put_idpool(fid, &v9ses->fidpool); |
117 | kfree(fcall); | 114 | kfree(fcall); |
118 | 115 | ||
119 | return err; | 116 | return err; |
120 | } | 117 | } |
@@ -269,7 +266,7 @@ v9fs_file_write(struct file *filp, const char __user * data, | |||
269 | return total; | 266 | return total; |
270 | } | 267 | } |
271 | 268 | ||
272 | struct file_operations v9fs_file_operations = { | 269 | const struct file_operations v9fs_file_operations = { |
273 | .llseek = generic_file_llseek, | 270 | .llseek = generic_file_llseek, |
274 | .read = v9fs_file_read, | 271 | .read = v9fs_file_read, |
275 | .write = v9fs_file_write, | 272 | .write = v9fs_file_write, |