blob: 6f77abd23184240276dfc4284865ce7b7450c6b1 [file] [log] [blame]
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -07001/*
2 * linux/fs/9p/vfs_file.c
3 *
4 * This file contians vfs file ops for 9P2000.
5 *
6 * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
7 * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
8 *
9 * This program is free software; you can redistribute it and/or modify
Eric Van Hensbergen42e8c502006-03-25 03:07:28 -080010 * it under the terms of the GNU General Public License version 2
11 * as published by the Free Software Foundation.
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -070012 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to:
20 * Free Software Foundation
21 * 51 Franklin Street, Fifth Floor
22 * Boston, MA 02111-1301 USA
23 *
24 */
25
26#include <linux/module.h>
27#include <linux/errno.h>
28#include <linux/fs.h>
Al Viro914e2632006-10-18 13:55:46 -040029#include <linux/sched.h>
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -070030#include <linux/file.h>
31#include <linux/stat.h>
32#include <linux/string.h>
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -070033#include <linux/inet.h>
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -070034#include <linux/list.h>
Abhishek Kulkarni637d0202009-09-22 11:34:05 -050035#include <linux/pagemap.h>
M. Mohan Kumara0990272010-09-27 11:34:24 +053036#include <linux/utsname.h>
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -070037#include <asm/uaccess.h>
38#include <linux/idr.h>
Latchesar Ionkovbd238fb2007-07-10 17:57:28 -050039#include <net/9p/9p.h>
40#include <net/9p/client.h>
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -070041
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -070042#include "v9fs.h"
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -070043#include "v9fs_vfs.h"
44#include "fid.h"
Abhishek Kulkarni60e78d22009-09-23 13:00:27 -050045#include "cache.h"
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -070046
Adrian Bunkd32b6872007-03-05 02:49:48 +010047static const struct file_operations v9fs_cached_file_operations;
Venkateswararao Jujjuri (JV)b04faaf2010-09-22 16:30:52 -070048static const struct file_operations v9fs_cached_file_operations_dotl;
Adrian Bunkd32b6872007-03-05 02:49:48 +010049
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -070050/**
51 * v9fs_file_open - open a file (or directory)
52 * @inode: inode to be opened
53 * @file: file being opened
54 *
55 */
56
57int v9fs_file_open(struct inode *inode, struct file *file)
58{
Latchesar Ionkov6a3124a2006-03-02 02:54:30 -080059 int err;
Latchesar Ionkovbd238fb2007-07-10 17:57:28 -050060 struct v9fs_session_info *v9ses;
61 struct p9_fid *fid;
62 int omode;
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -070063
M. Mohan Kumaref565472010-06-22 19:47:50 +053064 P9_DPRINTK(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, file);
Latchesar Ionkovbd238fb2007-07-10 17:57:28 -050065 v9ses = v9fs_inode2v9ses(inode);
M. Mohan Kumaref565472010-06-22 19:47:50 +053066 if (v9fs_proto_dotl(v9ses))
67 omode = file->f_flags;
68 else
69 omode = v9fs_uflags2omode(file->f_flags,
70 v9fs_proto_dotu(v9ses));
Latchesar Ionkovbd238fb2007-07-10 17:57:28 -050071 fid = file->private_data;
72 if (!fid) {
73 fid = v9fs_fid_clone(file->f_path.dentry);
74 if (IS_ERR(fid))
75 return PTR_ERR(fid);
76
77 err = p9_client_open(fid, omode);
Eric Van Hensbergen9523a842007-07-13 13:01:27 -050078 if (err < 0) {
Latchesar Ionkovbd238fb2007-07-10 17:57:28 -050079 p9_client_clunk(fid);
80 return err;
81 }
M. Mohan Kumaref565472010-06-22 19:47:50 +053082 if (file->f_flags & O_TRUNC) {
Abhishek Kulkarni7549ae32009-09-22 11:34:05 -050083 i_size_write(inode, 0);
Eric Van Hensbergen9523a842007-07-13 13:01:27 -050084 inode->i_blocks = 0;
85 }
M. Mohan Kumaref565472010-06-22 19:47:50 +053086 if ((file->f_flags & O_APPEND) &&
87 (!v9fs_proto_dotu(v9ses) && !v9fs_proto_dotl(v9ses)))
Eric Van Hensbergen2e4bef42008-06-24 17:39:39 -050088 generic_file_llseek(file, 0, SEEK_END);
Latchesar Ionkov6a3124a2006-03-02 02:54:30 -080089 }
90
Latchesar Ionkovbd238fb2007-07-10 17:57:28 -050091 file->private_data = fid;
92 if ((fid->qid.version) && (v9ses->cache)) {
93 P9_DPRINTK(P9_DEBUG_VFS, "cached");
Eric Van Hensbergene03abc02007-02-11 13:21:39 -060094 /* enable cached file options */
95 if(file->f_op == &v9fs_file_operations)
96 file->f_op = &v9fs_cached_file_operations;
Venkateswararao Jujjuri (JV)b04faaf2010-09-22 16:30:52 -070097 else if (file->f_op == &v9fs_file_operations_dotl)
98 file->f_op = &v9fs_cached_file_operations_dotl;
Abhishek Kulkarni60e78d22009-09-23 13:00:27 -050099
100#ifdef CONFIG_9P_FSCACHE
101 v9fs_cache_inode_set_cookie(inode, file);
102#endif
Eric Van Hensbergene03abc02007-02-11 13:21:39 -0600103 }
104
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700105 return 0;
106}
107
108/**
109 * v9fs_file_lock - lock a file (or directory)
Eric Van Hensbergenee443992008-03-05 07:08:09 -0600110 * @filp: file to be locked
111 * @cmd: lock command
112 * @fl: file lock structure
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700113 *
Eric Van Hensbergenee443992008-03-05 07:08:09 -0600114 * Bugs: this looks like a local only lock, we should extend into 9P
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700115 * by using open exclusive
116 */
117
118static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl)
119{
120 int res = 0;
Josef "Jeff" Sipekd6f787b2006-12-08 02:36:45 -0800121 struct inode *inode = filp->f_path.dentry->d_inode;
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700122
Latchesar Ionkovbd238fb2007-07-10 17:57:28 -0500123 P9_DPRINTK(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl);
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700124
125 /* No mandatory locks */
Sachin Prabhuf78233d2010-03-13 09:03:55 -0600126 if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK)
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700127 return -ENOLCK;
128
129 if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) {
OGAWA Hirofumi28fd1292006-01-08 01:02:14 -0800130 filemap_write_and_wait(inode->i_mapping);
Andrew Mortonfc0ecff2007-02-10 01:45:39 -0800131 invalidate_mapping_pages(&inode->i_data, 0, -1);
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700132 }
133
134 return res;
135}
136
M. Mohan Kumara0990272010-09-27 11:34:24 +0530137static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
138{
139 struct p9_flock flock;
140 struct p9_fid *fid;
141 uint8_t status;
142 int res = 0;
143 unsigned char fl_type;
144
145 fid = filp->private_data;
146 BUG_ON(fid == NULL);
147
148 if ((fl->fl_flags & FL_POSIX) != FL_POSIX)
149 BUG();
150
151 res = posix_lock_file_wait(filp, fl);
152 if (res < 0)
153 goto out;
154
155 /* convert posix lock to p9 tlock args */
156 memset(&flock, 0, sizeof(flock));
157 flock.type = fl->fl_type;
158 flock.start = fl->fl_start;
159 if (fl->fl_end == OFFSET_MAX)
160 flock.length = 0;
161 else
162 flock.length = fl->fl_end - fl->fl_start + 1;
163 flock.proc_id = fl->fl_pid;
164 flock.client_id = utsname()->nodename;
165 if (IS_SETLKW(cmd))
166 flock.flags = P9_LOCK_FLAGS_BLOCK;
167
168 /*
169 * if its a blocked request and we get P9_LOCK_BLOCKED as the status
170 * for lock request, keep on trying
171 */
172 for (;;) {
173 res = p9_client_lock_dotl(fid, &flock, &status);
174 if (res < 0)
175 break;
176
177 if (status != P9_LOCK_BLOCKED)
178 break;
179 if (status == P9_LOCK_BLOCKED && !IS_SETLKW(cmd))
180 break;
181 schedule_timeout_interruptible(P9_LOCK_TIMEOUT);
182 }
183
184 /* map 9p status to VFS status */
185 switch (status) {
186 case P9_LOCK_SUCCESS:
187 res = 0;
188 break;
189 case P9_LOCK_BLOCKED:
190 res = -EAGAIN;
191 break;
192 case P9_LOCK_ERROR:
193 case P9_LOCK_GRACE:
194 res = -ENOLCK;
195 break;
196 default:
197 BUG();
198 }
199
200 /*
201 * incase server returned error for lock request, revert
202 * it locally
203 */
204 if (res < 0 && fl->fl_type != F_UNLCK) {
205 fl_type = fl->fl_type;
206 fl->fl_type = F_UNLCK;
207 res = posix_lock_file_wait(filp, fl);
208 fl->fl_type = fl_type;
209 }
210out:
211 return res;
212}
213
214/**
215 * v9fs_file_lock_dotl - lock a file (or directory)
216 * @filp: file to be locked
217 * @cmd: lock command
218 * @fl: file lock structure
219 *
220 */
221
222static int v9fs_file_lock_dotl(struct file *filp, int cmd, struct file_lock *fl)
223{
224 struct inode *inode = filp->f_path.dentry->d_inode;
225 int ret = -ENOLCK;
226
227 P9_DPRINTK(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n", filp,
228 cmd, fl, filp->f_path.dentry->d_name.name);
229
230 /* No mandatory locks */
231 if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK)
232 goto out_err;
233
234 if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) {
235 filemap_write_and_wait(inode->i_mapping);
236 invalidate_mapping_pages(&inode->i_data, 0, -1);
237 }
238
239 if (IS_SETLK(cmd) || IS_SETLKW(cmd))
240 ret = v9fs_file_do_lock(filp, cmd, fl);
241 else
242 ret = -EINVAL;
243out_err:
244 return ret;
245}
246
247/**
248 * v9fs_file_flock_dotl - lock a file
249 * @filp: file to be locked
250 * @cmd: lock command
251 * @fl: file lock structure
252 *
253 */
254
255static int v9fs_file_flock_dotl(struct file *filp, int cmd,
256 struct file_lock *fl)
257{
258 struct inode *inode = filp->f_path.dentry->d_inode;
259 int ret = -ENOLCK;
260
261 P9_DPRINTK(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n", filp,
262 cmd, fl, filp->f_path.dentry->d_name.name);
263
264 /* No mandatory locks */
265 if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK)
266 goto out_err;
267
268 if (!(fl->fl_flags & FL_FLOCK))
269 goto out_err;
270
271 if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) {
272 filemap_write_and_wait(inode->i_mapping);
273 invalidate_mapping_pages(&inode->i_data, 0, -1);
274 }
275 /* Convert flock to posix lock */
276 fl->fl_owner = (fl_owner_t)filp;
277 fl->fl_start = 0;
278 fl->fl_end = OFFSET_MAX;
279 fl->fl_flags |= FL_POSIX;
280 fl->fl_flags ^= FL_FLOCK;
281
282 if (IS_SETLK(cmd) | IS_SETLKW(cmd))
283 ret = v9fs_file_do_lock(filp, cmd, fl);
284 else
285 ret = -EINVAL;
286out_err:
287 return ret;
288}
289
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700290/**
Eric Van Hensbergenfbedadc2008-10-13 20:36:16 -0500291 * v9fs_file_readn - read from a file
Eric Van Hensbergenee443992008-03-05 07:08:09 -0600292 * @filp: file pointer to read
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700293 * @data: data buffer to read data into
Eric Van Hensbergenfbedadc2008-10-13 20:36:16 -0500294 * @udata: user data buffer to read data into
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700295 * @count: size of buffer
296 * @offset: offset at which to read data
297 *
298 */
Eric Van Hensbergenfbedadc2008-10-13 20:36:16 -0500299
300ssize_t
301v9fs_file_readn(struct file *filp, char *data, char __user *udata, u32 count,
302 u64 offset)
303{
M. Mohan Kumar97e84422010-06-04 11:59:07 +0000304 int n, total, size;
Eric Van Hensbergenfbedadc2008-10-13 20:36:16 -0500305 struct p9_fid *fid = filp->private_data;
306
Eric Van Hensbergen51a87c52008-10-16 08:30:07 -0500307 P9_DPRINTK(P9_DEBUG_VFS, "fid %d offset %llu count %d\n", fid->fid,
Eric Van Hensbergenfbedadc2008-10-13 20:36:16 -0500308 (long long unsigned) offset, count);
309
310 n = 0;
311 total = 0;
M. Mohan Kumar97e84422010-06-04 11:59:07 +0000312 size = fid->iounit ? fid->iounit : fid->clnt->msize - P9_IOHDRSZ;
Eric Van Hensbergenfbedadc2008-10-13 20:36:16 -0500313 do {
314 n = p9_client_read(fid, data, udata, offset, count);
315 if (n <= 0)
316 break;
317
318 if (data)
319 data += n;
320 if (udata)
321 udata += n;
322
323 offset += n;
324 count -= n;
325 total += n;
M. Mohan Kumar97e84422010-06-04 11:59:07 +0000326 } while (count > 0 && n == size);
Eric Van Hensbergenfbedadc2008-10-13 20:36:16 -0500327
328 if (n < 0)
329 total = n;
330
331 return total;
332}
333
334/**
335 * v9fs_file_read - read from a file
336 * @filp: file pointer to read
337 * @udata: user data buffer to read data into
338 * @count: size of buffer
339 * @offset: offset at which to read data
340 *
341 */
342
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700343static ssize_t
Eric Van Hensbergenfbedadc2008-10-13 20:36:16 -0500344v9fs_file_read(struct file *filp, char __user *udata, size_t count,
Latchesar Ionkov19cba8a2005-10-11 08:29:03 -0700345 loff_t * offset)
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700346{
Latchesar Ionkovbd238fb2007-07-10 17:57:28 -0500347 int ret;
348 struct p9_fid *fid;
M. Mohan Kumar97e84422010-06-04 11:59:07 +0000349 size_t size;
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700350
Eric Van Hensbergenea2e7992008-10-22 18:48:45 -0500351 P9_DPRINTK(P9_DEBUG_VFS, "count %zu offset %lld\n", count, *offset);
Latchesar Ionkovbd238fb2007-07-10 17:57:28 -0500352 fid = filp->private_data;
Eric Van Hensbergenfbedadc2008-10-13 20:36:16 -0500353
M. Mohan Kumar97e84422010-06-04 11:59:07 +0000354 size = fid->iounit ? fid->iounit : fid->clnt->msize - P9_IOHDRSZ;
355 if (count > size)
Eric Van Hensbergenfbedadc2008-10-13 20:36:16 -0500356 ret = v9fs_file_readn(filp, NULL, udata, count, *offset);
357 else
358 ret = p9_client_read(fid, NULL, udata, *offset, count);
359
Latchesar Ionkovbd238fb2007-07-10 17:57:28 -0500360 if (ret > 0)
361 *offset += ret;
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700362
Latchesar Ionkovbd238fb2007-07-10 17:57:28 -0500363 return ret;
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700364}
365
366/**
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700367 * v9fs_file_write - write to a file
Eric Van Hensbergenee443992008-03-05 07:08:09 -0600368 * @filp: file pointer to write
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700369 * @data: data buffer to write data from
370 * @count: size of buffer
371 * @offset: offset at which to write data
372 *
373 */
374
375static ssize_t
376v9fs_file_write(struct file *filp, const char __user * data,
377 size_t count, loff_t * offset)
378{
Harsh Prateek Bora3834b122010-08-03 11:55:40 +0000379 ssize_t retval;
380 size_t total = 0;
jvrao8d40fa22010-08-30 13:23:20 -0500381 int n;
Latchesar Ionkovbd238fb2007-07-10 17:57:28 -0500382 struct p9_fid *fid;
Eric Van Hensbergendfb0ec22008-10-13 20:36:16 -0500383 struct p9_client *clnt;
Eric Van Hensbergen9523a842007-07-13 13:01:27 -0500384 struct inode *inode = filp->f_path.dentry->d_inode;
jvraofc0f2962010-03-08 22:07:02 +0000385 loff_t origin = *offset;
Abhishek Kulkarni637d0202009-09-22 11:34:05 -0500386 unsigned long pg_start, pg_end;
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700387
Latchesar Ionkovbd238fb2007-07-10 17:57:28 -0500388 P9_DPRINTK(P9_DEBUG_VFS, "data %p count %d offset %x\n", data,
389 (int)count, (int)*offset);
Latchesar Ionkov19cba8a2005-10-11 08:29:03 -0700390
Latchesar Ionkovbd238fb2007-07-10 17:57:28 -0500391 fid = filp->private_data;
Eric Van Hensbergendfb0ec22008-10-13 20:36:16 -0500392 clnt = fid->clnt;
393
Harsh Prateek Bora3834b122010-08-03 11:55:40 +0000394 retval = generic_write_checks(filp, &origin, &count, 0);
395 if (retval)
396 goto out;
397
398 retval = -EINVAL;
399 if ((ssize_t) count < 0)
400 goto out;
401 retval = 0;
402 if (!count)
403 goto out;
404
Eric Van Hensbergendfb0ec22008-10-13 20:36:16 -0500405 do {
jvrao8d40fa22010-08-30 13:23:20 -0500406 n = p9_client_write(fid, NULL, data+total, origin+total, count);
Eric Van Hensbergendfb0ec22008-10-13 20:36:16 -0500407 if (n <= 0)
408 break;
409 count -= n;
410 total += n;
411 } while (count > 0);
412
413 if (total > 0) {
Abhishek Kulkarni637d0202009-09-22 11:34:05 -0500414 pg_start = origin >> PAGE_CACHE_SHIFT;
415 pg_end = (origin + total - 1) >> PAGE_CACHE_SHIFT;
Abhishek Kulkarni60e78d22009-09-23 13:00:27 -0500416 if (inode->i_mapping && inode->i_mapping->nrpages)
417 invalidate_inode_pages2_range(inode->i_mapping,
418 pg_start, pg_end);
Eric Van Hensbergendfb0ec22008-10-13 20:36:16 -0500419 *offset += total;
Abhishek Kulkarni637d0202009-09-22 11:34:05 -0500420 i_size_write(inode, i_size_read(inode) + total);
Abhishek Kulkarni7549ae32009-09-22 11:34:05 -0500421 inode->i_blocks = (i_size_read(inode) + 512 - 1) >> 9;
Eric Van Hensbergen9523a842007-07-13 13:01:27 -0500422 }
423
Eric Van Hensbergendfb0ec22008-10-13 20:36:16 -0500424 if (n < 0)
Harsh Prateek Bora3834b122010-08-03 11:55:40 +0000425 retval = n;
426 else
427 retval = total;
428out:
429 return retval;
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700430}
431
Christoph Hellwig7ea80852010-05-26 17:53:25 +0200432static int v9fs_file_fsync(struct file *filp, int datasync)
M. Mohan Kumar7a4439c2010-02-08 15:36:48 -0600433{
434 struct p9_fid *fid;
435 struct p9_wstat wstat;
436 int retval;
437
Christoph Hellwig7ea80852010-05-26 17:53:25 +0200438 P9_DPRINTK(P9_DEBUG_VFS, "filp %p datasync %x\n", filp, datasync);
M. Mohan Kumar7a4439c2010-02-08 15:36:48 -0600439
440 fid = filp->private_data;
441 v9fs_blank_wstat(&wstat);
442
443 retval = p9_client_wstat(fid, &wstat);
444 return retval;
445}
446
Venkateswararao Jujjuri (JV)920e65d2010-09-22 17:19:19 -0700447static int v9fs_file_fsync_dotl(struct file *filp, int datasync)
448{
449 struct p9_fid *fid;
450 int retval;
451
452 P9_DPRINTK(P9_DEBUG_VFS, "v9fs_file_fsync_dotl: filp %p datasync %x\n",
453 filp, datasync);
454
455 fid = filp->private_data;
456
457 retval = p9_client_fsync(fid);
458 return retval;
459}
460
Adrian Bunkd32b6872007-03-05 02:49:48 +0100461static const struct file_operations v9fs_cached_file_operations = {
Eric Van Hensbergene03abc02007-02-11 13:21:39 -0600462 .llseek = generic_file_llseek,
463 .read = do_sync_read,
464 .aio_read = generic_file_aio_read,
465 .write = v9fs_file_write,
466 .open = v9fs_file_open,
467 .release = v9fs_dir_release,
468 .lock = v9fs_file_lock,
Eric Van Hensbergen14b88692008-02-06 19:25:05 -0600469 .mmap = generic_file_readonly_mmap,
M. Mohan Kumar7a4439c2010-02-08 15:36:48 -0600470 .fsync = v9fs_file_fsync,
Eric Van Hensbergene03abc02007-02-11 13:21:39 -0600471};
472
Venkateswararao Jujjuri (JV)b04faaf2010-09-22 16:30:52 -0700473static const struct file_operations v9fs_cached_file_operations_dotl = {
474 .llseek = generic_file_llseek,
475 .read = do_sync_read,
476 .aio_read = generic_file_aio_read,
477 .write = v9fs_file_write,
478 .open = v9fs_file_open,
479 .release = v9fs_dir_release,
M. Mohan Kumara0990272010-09-27 11:34:24 +0530480 .lock = v9fs_file_lock_dotl,
481 .flock = v9fs_file_flock_dotl,
Venkateswararao Jujjuri (JV)b04faaf2010-09-22 16:30:52 -0700482 .mmap = generic_file_readonly_mmap,
Venkateswararao Jujjuri (JV)920e65d2010-09-22 17:19:19 -0700483 .fsync = v9fs_file_fsync_dotl,
Venkateswararao Jujjuri (JV)b04faaf2010-09-22 16:30:52 -0700484};
485
Arjan van de Ven4b6f5d22006-03-28 01:56:42 -0800486const struct file_operations v9fs_file_operations = {
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700487 .llseek = generic_file_llseek,
488 .read = v9fs_file_read,
489 .write = v9fs_file_write,
490 .open = v9fs_file_open,
491 .release = v9fs_dir_release,
492 .lock = v9fs_file_lock,
Eric Van Hensbergen14b88692008-02-06 19:25:05 -0600493 .mmap = generic_file_readonly_mmap,
M. Mohan Kumar7a4439c2010-02-08 15:36:48 -0600494 .fsync = v9fs_file_fsync,
Eric Van Hensbergene69e7fe2005-09-09 13:04:18 -0700495};
Sripathi Kodi9b6533c2010-03-25 12:41:54 +0000496
497const struct file_operations v9fs_file_operations_dotl = {
498 .llseek = generic_file_llseek,
499 .read = v9fs_file_read,
500 .write = v9fs_file_write,
501 .open = v9fs_file_open,
502 .release = v9fs_dir_release,
M. Mohan Kumara0990272010-09-27 11:34:24 +0530503 .lock = v9fs_file_lock_dotl,
504 .flock = v9fs_file_flock_dotl,
Sripathi Kodi9b6533c2010-03-25 12:41:54 +0000505 .mmap = generic_file_readonly_mmap,
Venkateswararao Jujjuri (JV)920e65d2010-09-22 17:19:19 -0700506 .fsync = v9fs_file_fsync_dotl,
Sripathi Kodi9b6533c2010-03-25 12:41:54 +0000507};