Commit | Line | Data |
---|---|---|
53c06f4e AK |
1 | /* |
2 | * linux/fs/9p/vfs_inode_dotl.c | |
3 | * | |
4 | * This file contains vfs inode ops for the 9P2000.L protocol. | |
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 | |
10 | * it under the terms of the GNU General Public License version 2 | |
11 | * as published by the Free Software Foundation. | |
12 | * | |
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> | |
29 | #include <linux/file.h> | |
30 | #include <linux/pagemap.h> | |
31 | #include <linux/stat.h> | |
32 | #include <linux/string.h> | |
33 | #include <linux/inet.h> | |
34 | #include <linux/namei.h> | |
35 | #include <linux/idr.h> | |
36 | #include <linux/sched.h> | |
37 | #include <linux/slab.h> | |
38 | #include <linux/xattr.h> | |
39 | #include <linux/posix_acl.h> | |
40 | #include <net/9p/9p.h> | |
41 | #include <net/9p/client.h> | |
42 | ||
43 | #include "v9fs.h" | |
44 | #include "v9fs_vfs.h" | |
45 | #include "fid.h" | |
46 | #include "cache.h" | |
47 | #include "xattr.h" | |
48 | #include "acl.h" | |
49 | ||
50 | static int | |
1a67aafb | 51 | v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, |
53c06f4e AK |
52 | dev_t rdev); |
53 | ||
54 | /** | |
55 | * v9fs_get_fsgid_for_create - Helper function to get the gid for creating a | |
56 | * new file system object. This checks the S_ISGID to determine the owning | |
57 | * group of the new file system object. | |
58 | */ | |
59 | ||
60 | static gid_t v9fs_get_fsgid_for_create(struct inode *dir_inode) | |
61 | { | |
62 | BUG_ON(dir_inode == NULL); | |
63 | ||
64 | if (dir_inode->i_mode & S_ISGID) { | |
65 | /* set_gid bit is set.*/ | |
66 | return dir_inode->i_gid; | |
67 | } | |
68 | return current_fsgid(); | |
69 | } | |
70 | ||
fd2421f5 AK |
71 | static int v9fs_test_inode_dotl(struct inode *inode, void *data) |
72 | { | |
73 | struct v9fs_inode *v9inode = V9FS_I(inode); | |
74 | struct p9_stat_dotl *st = (struct p9_stat_dotl *)data; | |
75 | ||
76 | /* don't match inode of different type */ | |
77 | if ((inode->i_mode & S_IFMT) != (st->st_mode & S_IFMT)) | |
78 | return 0; | |
79 | ||
80 | if (inode->i_generation != st->st_gen) | |
81 | return 0; | |
82 | ||
83 | /* compare qid details */ | |
84 | if (memcmp(&v9inode->qid.version, | |
85 | &st->qid.version, sizeof(v9inode->qid.version))) | |
86 | return 0; | |
87 | ||
88 | if (v9inode->qid.type != st->qid.type) | |
89 | return 0; | |
90 | return 1; | |
91 | } | |
92 | ||
ed80fcfa AK |
93 | /* Always get a new inode */ |
94 | static int v9fs_test_new_inode_dotl(struct inode *inode, void *data) | |
95 | { | |
96 | return 0; | |
97 | } | |
98 | ||
fd2421f5 AK |
99 | static int v9fs_set_inode_dotl(struct inode *inode, void *data) |
100 | { | |
101 | struct v9fs_inode *v9inode = V9FS_I(inode); | |
102 | struct p9_stat_dotl *st = (struct p9_stat_dotl *)data; | |
103 | ||
104 | memcpy(&v9inode->qid, &st->qid, sizeof(st->qid)); | |
105 | inode->i_generation = st->st_gen; | |
106 | return 0; | |
107 | } | |
108 | ||
5ffc0cb3 AK |
109 | static struct inode *v9fs_qid_iget_dotl(struct super_block *sb, |
110 | struct p9_qid *qid, | |
111 | struct p9_fid *fid, | |
ed80fcfa AK |
112 | struct p9_stat_dotl *st, |
113 | int new) | |
5ffc0cb3 AK |
114 | { |
115 | int retval; | |
116 | unsigned long i_ino; | |
117 | struct inode *inode; | |
118 | struct v9fs_session_info *v9ses = sb->s_fs_info; | |
ed80fcfa AK |
119 | int (*test)(struct inode *, void *); |
120 | ||
121 | if (new) | |
122 | test = v9fs_test_new_inode_dotl; | |
123 | else | |
124 | test = v9fs_test_inode_dotl; | |
5ffc0cb3 AK |
125 | |
126 | i_ino = v9fs_qid2ino(qid); | |
ed80fcfa | 127 | inode = iget5_locked(sb, i_ino, test, v9fs_set_inode_dotl, st); |
5ffc0cb3 AK |
128 | if (!inode) |
129 | return ERR_PTR(-ENOMEM); | |
130 | if (!(inode->i_state & I_NEW)) | |
131 | return inode; | |
132 | /* | |
133 | * initialize the inode with the stat info | |
134 | * FIXME!! we may need support for stale inodes | |
135 | * later. | |
136 | */ | |
fd2421f5 | 137 | inode->i_ino = i_ino; |
45089142 AK |
138 | retval = v9fs_init_inode(v9ses, inode, |
139 | st->st_mode, new_decode_dev(st->st_rdev)); | |
5ffc0cb3 AK |
140 | if (retval) |
141 | goto error; | |
142 | ||
143 | v9fs_stat2inode_dotl(st, inode); | |
144 | #ifdef CONFIG_9P_FSCACHE | |
5ffc0cb3 AK |
145 | v9fs_cache_inode_get_cookie(inode); |
146 | #endif | |
147 | retval = v9fs_get_acl(inode, fid); | |
148 | if (retval) | |
149 | goto error; | |
150 | ||
151 | unlock_new_inode(inode); | |
152 | return inode; | |
153 | error: | |
154 | unlock_new_inode(inode); | |
155 | iput(inode); | |
156 | return ERR_PTR(retval); | |
157 | ||
158 | } | |
159 | ||
53c06f4e | 160 | struct inode * |
a78ce05d | 161 | v9fs_inode_from_fid_dotl(struct v9fs_session_info *v9ses, struct p9_fid *fid, |
ed80fcfa | 162 | struct super_block *sb, int new) |
53c06f4e | 163 | { |
53c06f4e | 164 | struct p9_stat_dotl *st; |
5ffc0cb3 | 165 | struct inode *inode = NULL; |
53c06f4e | 166 | |
fd2421f5 | 167 | st = p9_client_getattr_dotl(fid, P9_STATS_BASIC | P9_STATS_GEN); |
53c06f4e AK |
168 | if (IS_ERR(st)) |
169 | return ERR_CAST(st); | |
170 | ||
ed80fcfa | 171 | inode = v9fs_qid_iget_dotl(sb, &st->qid, fid, st, new); |
53c06f4e | 172 | kfree(st); |
5ffc0cb3 | 173 | return inode; |
53c06f4e AK |
174 | } |
175 | ||
f88657ce AK |
176 | struct dotl_openflag_map { |
177 | int open_flag; | |
178 | int dotl_flag; | |
179 | }; | |
180 | ||
181 | static int v9fs_mapped_dotl_flags(int flags) | |
182 | { | |
183 | int i; | |
184 | int rflags = 0; | |
185 | struct dotl_openflag_map dotl_oflag_map[] = { | |
186 | { O_CREAT, P9_DOTL_CREATE }, | |
187 | { O_EXCL, P9_DOTL_EXCL }, | |
188 | { O_NOCTTY, P9_DOTL_NOCTTY }, | |
189 | { O_TRUNC, P9_DOTL_TRUNC }, | |
190 | { O_APPEND, P9_DOTL_APPEND }, | |
191 | { O_NONBLOCK, P9_DOTL_NONBLOCK }, | |
192 | { O_DSYNC, P9_DOTL_DSYNC }, | |
193 | { FASYNC, P9_DOTL_FASYNC }, | |
194 | { O_DIRECT, P9_DOTL_DIRECT }, | |
195 | { O_LARGEFILE, P9_DOTL_LARGEFILE }, | |
196 | { O_DIRECTORY, P9_DOTL_DIRECTORY }, | |
197 | { O_NOFOLLOW, P9_DOTL_NOFOLLOW }, | |
198 | { O_NOATIME, P9_DOTL_NOATIME }, | |
199 | { O_CLOEXEC, P9_DOTL_CLOEXEC }, | |
200 | { O_SYNC, P9_DOTL_SYNC}, | |
201 | }; | |
202 | for (i = 0; i < ARRAY_SIZE(dotl_oflag_map); i++) { | |
203 | if (flags & dotl_oflag_map[i].open_flag) | |
204 | rflags |= dotl_oflag_map[i].dotl_flag; | |
205 | } | |
206 | return rflags; | |
207 | } | |
208 | ||
209 | /** | |
210 | * v9fs_open_to_dotl_flags- convert Linux specific open flags to | |
211 | * plan 9 open flag. | |
212 | * @flags: flags to convert | |
213 | */ | |
214 | int v9fs_open_to_dotl_flags(int flags) | |
215 | { | |
216 | int rflags = 0; | |
217 | ||
218 | /* | |
219 | * We have same bits for P9_DOTL_READONLY, P9_DOTL_WRONLY | |
220 | * and P9_DOTL_NOACCESS | |
221 | */ | |
222 | rflags |= flags & O_ACCMODE; | |
223 | rflags |= v9fs_mapped_dotl_flags(flags); | |
224 | ||
225 | return rflags; | |
226 | } | |
227 | ||
53c06f4e AK |
228 | /** |
229 | * v9fs_vfs_create_dotl - VFS hook to create files for 9P2000.L protocol. | |
230 | * @dir: directory inode that is being created | |
231 | * @dentry: dentry that is being deleted | |
232 | * @mode: create permissions | |
233 | * @nd: path information | |
234 | * | |
235 | */ | |
236 | ||
237 | static int | |
4acdaf27 | 238 | v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, |
53c06f4e AK |
239 | struct nameidata *nd) |
240 | { | |
241 | int err = 0; | |
53c06f4e AK |
242 | gid_t gid; |
243 | int flags; | |
d3fb6120 | 244 | umode_t mode; |
6b39f6d2 | 245 | char *name = NULL; |
53c06f4e AK |
246 | struct file *filp; |
247 | struct p9_qid qid; | |
248 | struct inode *inode; | |
6b39f6d2 AK |
249 | struct p9_fid *fid = NULL; |
250 | struct v9fs_inode *v9inode; | |
251 | struct p9_fid *dfid, *ofid, *inode_fid; | |
252 | struct v9fs_session_info *v9ses; | |
53c06f4e AK |
253 | struct posix_acl *pacl = NULL, *dacl = NULL; |
254 | ||
255 | v9ses = v9fs_inode2v9ses(dir); | |
dd7dd556 | 256 | if (nd) |
8a5e929d | 257 | flags = nd->intent.open.flags; |
53c06f4e AK |
258 | else { |
259 | /* | |
260 | * create call without LOOKUP_OPEN is due | |
261 | * to mknod of regular files. So use mknod | |
262 | * operation. | |
263 | */ | |
264 | return v9fs_vfs_mknod_dotl(dir, dentry, omode, 0); | |
265 | } | |
266 | ||
267 | name = (char *) dentry->d_name.name; | |
609eac1c | 268 | p9_debug(P9_DEBUG_VFS, "name:%s flags:0x%x mode:0x%hx\n", |
5d385153 | 269 | name, flags, omode); |
53c06f4e AK |
270 | |
271 | dfid = v9fs_fid_lookup(dentry->d_parent); | |
272 | if (IS_ERR(dfid)) { | |
273 | err = PTR_ERR(dfid); | |
5d385153 | 274 | p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err); |
53c06f4e AK |
275 | return err; |
276 | } | |
277 | ||
278 | /* clone a fid to use for creation */ | |
279 | ofid = p9_client_walk(dfid, 0, NULL, 1); | |
280 | if (IS_ERR(ofid)) { | |
281 | err = PTR_ERR(ofid); | |
5d385153 | 282 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); |
53c06f4e AK |
283 | return err; |
284 | } | |
285 | ||
286 | gid = v9fs_get_fsgid_for_create(dir); | |
287 | ||
288 | mode = omode; | |
289 | /* Update mode based on ACL value */ | |
290 | err = v9fs_acl_mode(dir, &mode, &dacl, &pacl); | |
291 | if (err) { | |
5d385153 JP |
292 | p9_debug(P9_DEBUG_VFS, "Failed to get acl values in creat %d\n", |
293 | err); | |
53c06f4e AK |
294 | goto error; |
295 | } | |
f88657ce AK |
296 | err = p9_client_create_dotl(ofid, name, v9fs_open_to_dotl_flags(flags), |
297 | mode, gid, &qid); | |
53c06f4e | 298 | if (err < 0) { |
5d385153 JP |
299 | p9_debug(P9_DEBUG_VFS, "p9_client_open_dotl failed in creat %d\n", |
300 | err); | |
53c06f4e AK |
301 | goto error; |
302 | } | |
d28c61f0 | 303 | v9fs_invalidate_inode_attr(dir); |
53c06f4e | 304 | |
af7542fc AK |
305 | /* instantiate inode and assign the unopened fid to the dentry */ |
306 | fid = p9_client_walk(dfid, 1, &name, 1); | |
307 | if (IS_ERR(fid)) { | |
308 | err = PTR_ERR(fid); | |
5d385153 | 309 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); |
53c06f4e | 310 | fid = NULL; |
af7542fc | 311 | goto error; |
53c06f4e | 312 | } |
ed80fcfa | 313 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); |
af7542fc AK |
314 | if (IS_ERR(inode)) { |
315 | err = PTR_ERR(inode); | |
5d385153 | 316 | p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err); |
af7542fc AK |
317 | goto error; |
318 | } | |
af7542fc AK |
319 | err = v9fs_fid_add(dentry, fid); |
320 | if (err < 0) | |
321 | goto error; | |
5441ae5e | 322 | d_instantiate(dentry, inode); |
af7542fc | 323 | |
53c06f4e | 324 | /* Now set the ACL based on the default value */ |
1ec95bf3 | 325 | v9fs_set_create_acl(dentry, &dacl, &pacl); |
6b39f6d2 AK |
326 | |
327 | v9inode = V9FS_I(inode); | |
5a7e0a8c | 328 | mutex_lock(&v9inode->v_mutex); |
7add697a AK |
329 | if (v9ses->cache && !v9inode->writeback_fid && |
330 | ((flags & O_ACCMODE) != O_RDONLY)) { | |
3cf387d7 | 331 | /* |
6b39f6d2 | 332 | * clone a fid and add it to writeback_fid |
3cf387d7 AK |
333 | * we do it during open time instead of |
334 | * page dirty time via write_begin/page_mkwrite | |
335 | * because we want write after unlink usecase | |
336 | * to work. | |
337 | */ | |
338 | inode_fid = v9fs_writeback_fid(dentry); | |
339 | if (IS_ERR(inode_fid)) { | |
340 | err = PTR_ERR(inode_fid); | |
5a7e0a8c | 341 | mutex_unlock(&v9inode->v_mutex); |
398c4f0e | 342 | goto err_clunk_old_fid; |
3cf387d7 | 343 | } |
6b39f6d2 | 344 | v9inode->writeback_fid = (void *) inode_fid; |
3cf387d7 | 345 | } |
5a7e0a8c | 346 | mutex_unlock(&v9inode->v_mutex); |
af7542fc AK |
347 | /* Since we are opening a file, assign the open fid to the file */ |
348 | filp = lookup_instantiate_filp(nd, dentry, generic_file_open); | |
349 | if (IS_ERR(filp)) { | |
398c4f0e AK |
350 | err = PTR_ERR(filp); |
351 | goto err_clunk_old_fid; | |
af7542fc AK |
352 | } |
353 | filp->private_data = ofid; | |
46848de0 AK |
354 | #ifdef CONFIG_9P_FSCACHE |
355 | if (v9ses->cache) | |
356 | v9fs_cache_inode_set_cookie(inode, filp); | |
357 | #endif | |
53c06f4e AK |
358 | return 0; |
359 | ||
360 | error: | |
53c06f4e AK |
361 | if (fid) |
362 | p9_client_clunk(fid); | |
398c4f0e AK |
363 | err_clunk_old_fid: |
364 | if (ofid) | |
365 | p9_client_clunk(ofid); | |
1ec95bf3 | 366 | v9fs_set_create_acl(NULL, &dacl, &pacl); |
53c06f4e AK |
367 | return err; |
368 | } | |
369 | ||
370 | /** | |
371 | * v9fs_vfs_mkdir_dotl - VFS mkdir hook to create a directory | |
372 | * @dir: inode that is being unlinked | |
373 | * @dentry: dentry that is being unlinked | |
374 | * @mode: mode for new directory | |
375 | * | |
376 | */ | |
377 | ||
378 | static int v9fs_vfs_mkdir_dotl(struct inode *dir, | |
18bb1db3 | 379 | struct dentry *dentry, umode_t omode) |
53c06f4e AK |
380 | { |
381 | int err; | |
382 | struct v9fs_session_info *v9ses; | |
383 | struct p9_fid *fid = NULL, *dfid = NULL; | |
384 | gid_t gid; | |
385 | char *name; | |
d3fb6120 | 386 | umode_t mode; |
53c06f4e AK |
387 | struct inode *inode; |
388 | struct p9_qid qid; | |
389 | struct dentry *dir_dentry; | |
390 | struct posix_acl *dacl = NULL, *pacl = NULL; | |
391 | ||
5d385153 | 392 | p9_debug(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name); |
53c06f4e AK |
393 | err = 0; |
394 | v9ses = v9fs_inode2v9ses(dir); | |
395 | ||
396 | omode |= S_IFDIR; | |
397 | if (dir->i_mode & S_ISGID) | |
398 | omode |= S_ISGID; | |
399 | ||
af569596 | 400 | dir_dentry = dentry->d_parent; |
53c06f4e AK |
401 | dfid = v9fs_fid_lookup(dir_dentry); |
402 | if (IS_ERR(dfid)) { | |
403 | err = PTR_ERR(dfid); | |
5d385153 | 404 | p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err); |
53c06f4e AK |
405 | dfid = NULL; |
406 | goto error; | |
407 | } | |
408 | ||
409 | gid = v9fs_get_fsgid_for_create(dir); | |
410 | mode = omode; | |
411 | /* Update mode based on ACL value */ | |
412 | err = v9fs_acl_mode(dir, &mode, &dacl, &pacl); | |
413 | if (err) { | |
5d385153 JP |
414 | p9_debug(P9_DEBUG_VFS, "Failed to get acl values in mkdir %d\n", |
415 | err); | |
53c06f4e AK |
416 | goto error; |
417 | } | |
418 | name = (char *) dentry->d_name.name; | |
419 | err = p9_client_mkdir_dotl(dfid, name, mode, gid, &qid); | |
420 | if (err < 0) | |
421 | goto error; | |
422 | ||
423 | /* instantiate inode and assign the unopened fid to the dentry */ | |
424 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { | |
425 | fid = p9_client_walk(dfid, 1, &name, 1); | |
426 | if (IS_ERR(fid)) { | |
427 | err = PTR_ERR(fid); | |
5d385153 JP |
428 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", |
429 | err); | |
53c06f4e AK |
430 | fid = NULL; |
431 | goto error; | |
432 | } | |
433 | ||
ed80fcfa | 434 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); |
53c06f4e AK |
435 | if (IS_ERR(inode)) { |
436 | err = PTR_ERR(inode); | |
5d385153 JP |
437 | p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", |
438 | err); | |
53c06f4e AK |
439 | goto error; |
440 | } | |
53c06f4e AK |
441 | err = v9fs_fid_add(dentry, fid); |
442 | if (err < 0) | |
443 | goto error; | |
5441ae5e | 444 | d_instantiate(dentry, inode); |
53c06f4e AK |
445 | fid = NULL; |
446 | } else { | |
447 | /* | |
448 | * Not in cached mode. No need to populate | |
449 | * inode with stat. We need to get an inode | |
450 | * so that we can set the acl with dentry | |
451 | */ | |
45089142 | 452 | inode = v9fs_get_inode(dir->i_sb, mode, 0); |
53c06f4e AK |
453 | if (IS_ERR(inode)) { |
454 | err = PTR_ERR(inode); | |
455 | goto error; | |
456 | } | |
53c06f4e AK |
457 | d_instantiate(dentry, inode); |
458 | } | |
459 | /* Now set the ACL based on the default value */ | |
1ec95bf3 | 460 | v9fs_set_create_acl(dentry, &dacl, &pacl); |
b271ec47 | 461 | inc_nlink(dir); |
d28c61f0 | 462 | v9fs_invalidate_inode_attr(dir); |
53c06f4e AK |
463 | error: |
464 | if (fid) | |
465 | p9_client_clunk(fid); | |
1ec95bf3 | 466 | v9fs_set_create_acl(NULL, &dacl, &pacl); |
53c06f4e AK |
467 | return err; |
468 | } | |
469 | ||
470 | static int | |
471 | v9fs_vfs_getattr_dotl(struct vfsmount *mnt, struct dentry *dentry, | |
472 | struct kstat *stat) | |
473 | { | |
474 | int err; | |
475 | struct v9fs_session_info *v9ses; | |
476 | struct p9_fid *fid; | |
477 | struct p9_stat_dotl *st; | |
478 | ||
5d385153 | 479 | p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry); |
53c06f4e | 480 | err = -EPERM; |
42869c8a | 481 | v9ses = v9fs_dentry2v9ses(dentry); |
a1211908 AK |
482 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { |
483 | generic_fillattr(dentry->d_inode, stat); | |
484 | return 0; | |
485 | } | |
53c06f4e AK |
486 | fid = v9fs_fid_lookup(dentry); |
487 | if (IS_ERR(fid)) | |
488 | return PTR_ERR(fid); | |
489 | ||
490 | /* Ask for all the fields in stat structure. Server will return | |
491 | * whatever it supports | |
492 | */ | |
493 | ||
494 | st = p9_client_getattr_dotl(fid, P9_STATS_ALL); | |
495 | if (IS_ERR(st)) | |
496 | return PTR_ERR(st); | |
497 | ||
498 | v9fs_stat2inode_dotl(st, dentry->d_inode); | |
499 | generic_fillattr(dentry->d_inode, stat); | |
500 | /* Change block size to what the server returned */ | |
501 | stat->blksize = st->st_blksize; | |
502 | ||
503 | kfree(st); | |
504 | return 0; | |
505 | } | |
506 | ||
f766619d AK |
507 | /* |
508 | * Attribute flags. | |
509 | */ | |
510 | #define P9_ATTR_MODE (1 << 0) | |
511 | #define P9_ATTR_UID (1 << 1) | |
512 | #define P9_ATTR_GID (1 << 2) | |
513 | #define P9_ATTR_SIZE (1 << 3) | |
514 | #define P9_ATTR_ATIME (1 << 4) | |
515 | #define P9_ATTR_MTIME (1 << 5) | |
516 | #define P9_ATTR_CTIME (1 << 6) | |
517 | #define P9_ATTR_ATIME_SET (1 << 7) | |
518 | #define P9_ATTR_MTIME_SET (1 << 8) | |
519 | ||
520 | struct dotl_iattr_map { | |
521 | int iattr_valid; | |
522 | int p9_iattr_valid; | |
523 | }; | |
524 | ||
525 | static int v9fs_mapped_iattr_valid(int iattr_valid) | |
526 | { | |
527 | int i; | |
528 | int p9_iattr_valid = 0; | |
529 | struct dotl_iattr_map dotl_iattr_map[] = { | |
530 | { ATTR_MODE, P9_ATTR_MODE }, | |
531 | { ATTR_UID, P9_ATTR_UID }, | |
532 | { ATTR_GID, P9_ATTR_GID }, | |
533 | { ATTR_SIZE, P9_ATTR_SIZE }, | |
534 | { ATTR_ATIME, P9_ATTR_ATIME }, | |
535 | { ATTR_MTIME, P9_ATTR_MTIME }, | |
536 | { ATTR_CTIME, P9_ATTR_CTIME }, | |
537 | { ATTR_ATIME_SET, P9_ATTR_ATIME_SET }, | |
538 | { ATTR_MTIME_SET, P9_ATTR_MTIME_SET }, | |
539 | }; | |
540 | for (i = 0; i < ARRAY_SIZE(dotl_iattr_map); i++) { | |
541 | if (iattr_valid & dotl_iattr_map[i].iattr_valid) | |
542 | p9_iattr_valid |= dotl_iattr_map[i].p9_iattr_valid; | |
543 | } | |
544 | return p9_iattr_valid; | |
545 | } | |
546 | ||
53c06f4e AK |
547 | /** |
548 | * v9fs_vfs_setattr_dotl - set file metadata | |
549 | * @dentry: file whose metadata to set | |
550 | * @iattr: metadata assignment structure | |
551 | * | |
552 | */ | |
553 | ||
554 | int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) | |
555 | { | |
556 | int retval; | |
557 | struct v9fs_session_info *v9ses; | |
558 | struct p9_fid *fid; | |
559 | struct p9_iattr_dotl p9attr; | |
560 | ||
5d385153 | 561 | p9_debug(P9_DEBUG_VFS, "\n"); |
53c06f4e AK |
562 | |
563 | retval = inode_change_ok(dentry->d_inode, iattr); | |
564 | if (retval) | |
565 | return retval; | |
566 | ||
f766619d | 567 | p9attr.valid = v9fs_mapped_iattr_valid(iattr->ia_valid); |
53c06f4e AK |
568 | p9attr.mode = iattr->ia_mode; |
569 | p9attr.uid = iattr->ia_uid; | |
570 | p9attr.gid = iattr->ia_gid; | |
571 | p9attr.size = iattr->ia_size; | |
572 | p9attr.atime_sec = iattr->ia_atime.tv_sec; | |
573 | p9attr.atime_nsec = iattr->ia_atime.tv_nsec; | |
574 | p9attr.mtime_sec = iattr->ia_mtime.tv_sec; | |
575 | p9attr.mtime_nsec = iattr->ia_mtime.tv_nsec; | |
576 | ||
577 | retval = -EPERM; | |
42869c8a | 578 | v9ses = v9fs_dentry2v9ses(dentry); |
53c06f4e AK |
579 | fid = v9fs_fid_lookup(dentry); |
580 | if (IS_ERR(fid)) | |
581 | return PTR_ERR(fid); | |
582 | ||
3dc5436a AK |
583 | /* Write all dirty data */ |
584 | if (S_ISREG(dentry->d_inode->i_mode)) | |
585 | filemap_write_and_wait(dentry->d_inode->i_mapping); | |
586 | ||
f10fc50f AK |
587 | retval = p9_client_setattr(fid, &p9attr); |
588 | if (retval < 0) | |
589 | return retval; | |
53c06f4e | 590 | |
059c138b AK |
591 | if ((iattr->ia_valid & ATTR_SIZE) && |
592 | iattr->ia_size != i_size_read(dentry->d_inode)) | |
593 | truncate_setsize(dentry->d_inode, iattr->ia_size); | |
594 | ||
595 | v9fs_invalidate_inode_attr(dentry->d_inode); | |
53c06f4e AK |
596 | setattr_copy(dentry->d_inode, iattr); |
597 | mark_inode_dirty(dentry->d_inode); | |
598 | if (iattr->ia_valid & ATTR_MODE) { | |
599 | /* We also want to update ACL when we update mode bits */ | |
600 | retval = v9fs_acl_chmod(dentry); | |
601 | if (retval < 0) | |
602 | return retval; | |
603 | } | |
604 | return 0; | |
605 | } | |
606 | ||
607 | /** | |
608 | * v9fs_stat2inode_dotl - populate an inode structure with stat info | |
609 | * @stat: stat structure | |
610 | * @inode: inode to populate | |
611 | * @sb: superblock of filesystem | |
612 | * | |
613 | */ | |
614 | ||
615 | void | |
616 | v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode) | |
617 | { | |
3eda0de6 | 618 | umode_t mode; |
b3cbea03 | 619 | struct v9fs_inode *v9inode = V9FS_I(inode); |
53c06f4e AK |
620 | |
621 | if ((stat->st_result_mask & P9_STATS_BASIC) == P9_STATS_BASIC) { | |
622 | inode->i_atime.tv_sec = stat->st_atime_sec; | |
623 | inode->i_atime.tv_nsec = stat->st_atime_nsec; | |
624 | inode->i_mtime.tv_sec = stat->st_mtime_sec; | |
625 | inode->i_mtime.tv_nsec = stat->st_mtime_nsec; | |
626 | inode->i_ctime.tv_sec = stat->st_ctime_sec; | |
627 | inode->i_ctime.tv_nsec = stat->st_ctime_nsec; | |
628 | inode->i_uid = stat->st_uid; | |
629 | inode->i_gid = stat->st_gid; | |
bfe86848 | 630 | set_nlink(inode, stat->st_nlink); |
53c06f4e | 631 | |
45089142 AK |
632 | mode = stat->st_mode & S_IALLUGO; |
633 | mode |= inode->i_mode & ~S_IALLUGO; | |
634 | inode->i_mode = mode; | |
53c06f4e AK |
635 | |
636 | i_size_write(inode, stat->st_size); | |
637 | inode->i_blocks = stat->st_blocks; | |
638 | } else { | |
639 | if (stat->st_result_mask & P9_STATS_ATIME) { | |
640 | inode->i_atime.tv_sec = stat->st_atime_sec; | |
641 | inode->i_atime.tv_nsec = stat->st_atime_nsec; | |
642 | } | |
643 | if (stat->st_result_mask & P9_STATS_MTIME) { | |
644 | inode->i_mtime.tv_sec = stat->st_mtime_sec; | |
645 | inode->i_mtime.tv_nsec = stat->st_mtime_nsec; | |
646 | } | |
647 | if (stat->st_result_mask & P9_STATS_CTIME) { | |
648 | inode->i_ctime.tv_sec = stat->st_ctime_sec; | |
649 | inode->i_ctime.tv_nsec = stat->st_ctime_nsec; | |
650 | } | |
651 | if (stat->st_result_mask & P9_STATS_UID) | |
652 | inode->i_uid = stat->st_uid; | |
653 | if (stat->st_result_mask & P9_STATS_GID) | |
654 | inode->i_gid = stat->st_gid; | |
655 | if (stat->st_result_mask & P9_STATS_NLINK) | |
bfe86848 | 656 | set_nlink(inode, stat->st_nlink); |
53c06f4e AK |
657 | if (stat->st_result_mask & P9_STATS_MODE) { |
658 | inode->i_mode = stat->st_mode; | |
659 | if ((S_ISBLK(inode->i_mode)) || | |
660 | (S_ISCHR(inode->i_mode))) | |
661 | init_special_inode(inode, inode->i_mode, | |
662 | inode->i_rdev); | |
663 | } | |
664 | if (stat->st_result_mask & P9_STATS_RDEV) | |
665 | inode->i_rdev = new_decode_dev(stat->st_rdev); | |
666 | if (stat->st_result_mask & P9_STATS_SIZE) | |
667 | i_size_write(inode, stat->st_size); | |
668 | if (stat->st_result_mask & P9_STATS_BLOCKS) | |
669 | inode->i_blocks = stat->st_blocks; | |
670 | } | |
671 | if (stat->st_result_mask & P9_STATS_GEN) | |
fd2421f5 | 672 | inode->i_generation = stat->st_gen; |
53c06f4e AK |
673 | |
674 | /* Currently we don't support P9_STATS_BTIME and P9_STATS_DATA_VERSION | |
675 | * because the inode structure does not have fields for them. | |
676 | */ | |
b3cbea03 | 677 | v9inode->cache_validity &= ~V9FS_INO_INVALID_ATTR; |
53c06f4e AK |
678 | } |
679 | ||
680 | static int | |
681 | v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry, | |
682 | const char *symname) | |
683 | { | |
53c06f4e AK |
684 | int err; |
685 | gid_t gid; | |
d28c61f0 AK |
686 | char *name; |
687 | struct p9_qid qid; | |
688 | struct inode *inode; | |
689 | struct p9_fid *dfid; | |
690 | struct p9_fid *fid = NULL; | |
691 | struct v9fs_session_info *v9ses; | |
53c06f4e AK |
692 | |
693 | name = (char *) dentry->d_name.name; | |
5d385153 | 694 | p9_debug(P9_DEBUG_VFS, "%lu,%s,%s\n", dir->i_ino, name, symname); |
53c06f4e AK |
695 | v9ses = v9fs_inode2v9ses(dir); |
696 | ||
697 | dfid = v9fs_fid_lookup(dentry->d_parent); | |
698 | if (IS_ERR(dfid)) { | |
699 | err = PTR_ERR(dfid); | |
5d385153 | 700 | p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err); |
53c06f4e AK |
701 | return err; |
702 | } | |
703 | ||
704 | gid = v9fs_get_fsgid_for_create(dir); | |
705 | ||
706 | /* Server doesn't alter fid on TSYMLINK. Hence no need to clone it. */ | |
707 | err = p9_client_symlink(dfid, name, (char *)symname, gid, &qid); | |
708 | ||
709 | if (err < 0) { | |
5d385153 | 710 | p9_debug(P9_DEBUG_VFS, "p9_client_symlink failed %d\n", err); |
53c06f4e AK |
711 | goto error; |
712 | } | |
713 | ||
d28c61f0 | 714 | v9fs_invalidate_inode_attr(dir); |
53c06f4e AK |
715 | if (v9ses->cache) { |
716 | /* Now walk from the parent so we can get an unopened fid. */ | |
717 | fid = p9_client_walk(dfid, 1, &name, 1); | |
718 | if (IS_ERR(fid)) { | |
719 | err = PTR_ERR(fid); | |
5d385153 JP |
720 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", |
721 | err); | |
53c06f4e AK |
722 | fid = NULL; |
723 | goto error; | |
724 | } | |
725 | ||
726 | /* instantiate inode and assign the unopened fid to dentry */ | |
ed80fcfa | 727 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); |
53c06f4e AK |
728 | if (IS_ERR(inode)) { |
729 | err = PTR_ERR(inode); | |
5d385153 JP |
730 | p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", |
731 | err); | |
53c06f4e AK |
732 | goto error; |
733 | } | |
53c06f4e AK |
734 | err = v9fs_fid_add(dentry, fid); |
735 | if (err < 0) | |
736 | goto error; | |
5441ae5e | 737 | d_instantiate(dentry, inode); |
53c06f4e AK |
738 | fid = NULL; |
739 | } else { | |
740 | /* Not in cached mode. No need to populate inode with stat */ | |
45089142 | 741 | inode = v9fs_get_inode(dir->i_sb, S_IFLNK, 0); |
53c06f4e AK |
742 | if (IS_ERR(inode)) { |
743 | err = PTR_ERR(inode); | |
744 | goto error; | |
745 | } | |
53c06f4e AK |
746 | d_instantiate(dentry, inode); |
747 | } | |
748 | ||
749 | error: | |
750 | if (fid) | |
751 | p9_client_clunk(fid); | |
752 | ||
753 | return err; | |
754 | } | |
755 | ||
756 | /** | |
757 | * v9fs_vfs_link_dotl - create a hardlink for dotl | |
758 | * @old_dentry: dentry for file to link to | |
759 | * @dir: inode destination for new link | |
760 | * @dentry: dentry for link | |
761 | * | |
762 | */ | |
763 | ||
764 | static int | |
765 | v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir, | |
766 | struct dentry *dentry) | |
767 | { | |
768 | int err; | |
53c06f4e | 769 | char *name; |
53c06f4e | 770 | struct dentry *dir_dentry; |
d28c61f0 AK |
771 | struct p9_fid *dfid, *oldfid; |
772 | struct v9fs_session_info *v9ses; | |
53c06f4e | 773 | |
5d385153 JP |
774 | p9_debug(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name: %s\n", |
775 | dir->i_ino, old_dentry->d_name.name, dentry->d_name.name); | |
53c06f4e AK |
776 | |
777 | v9ses = v9fs_inode2v9ses(dir); | |
af569596 | 778 | dir_dentry = dentry->d_parent; |
53c06f4e AK |
779 | dfid = v9fs_fid_lookup(dir_dentry); |
780 | if (IS_ERR(dfid)) | |
781 | return PTR_ERR(dfid); | |
782 | ||
783 | oldfid = v9fs_fid_lookup(old_dentry); | |
784 | if (IS_ERR(oldfid)) | |
785 | return PTR_ERR(oldfid); | |
786 | ||
787 | name = (char *) dentry->d_name.name; | |
788 | ||
789 | err = p9_client_link(dfid, oldfid, (char *)dentry->d_name.name); | |
790 | ||
791 | if (err < 0) { | |
5d385153 | 792 | p9_debug(P9_DEBUG_VFS, "p9_client_link failed %d\n", err); |
53c06f4e AK |
793 | return err; |
794 | } | |
795 | ||
d28c61f0 | 796 | v9fs_invalidate_inode_attr(dir); |
53c06f4e AK |
797 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { |
798 | /* Get the latest stat info from server. */ | |
799 | struct p9_fid *fid; | |
53c06f4e AK |
800 | fid = v9fs_fid_lookup(old_dentry); |
801 | if (IS_ERR(fid)) | |
802 | return PTR_ERR(fid); | |
803 | ||
c06c066a | 804 | v9fs_refresh_inode_dotl(fid, old_dentry->d_inode); |
53c06f4e | 805 | } |
20656a49 | 806 | ihold(old_dentry->d_inode); |
53c06f4e AK |
807 | d_instantiate(dentry, old_dentry->d_inode); |
808 | ||
809 | return err; | |
810 | } | |
811 | ||
812 | /** | |
813 | * v9fs_vfs_mknod_dotl - create a special file | |
814 | * @dir: inode destination for new link | |
815 | * @dentry: dentry for file | |
816 | * @mode: mode for creation | |
817 | * @rdev: device associated with special file | |
818 | * | |
819 | */ | |
820 | static int | |
1a67aafb | 821 | v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, |
53c06f4e AK |
822 | dev_t rdev) |
823 | { | |
824 | int err; | |
d28c61f0 | 825 | gid_t gid; |
53c06f4e | 826 | char *name; |
d3fb6120 | 827 | umode_t mode; |
53c06f4e AK |
828 | struct v9fs_session_info *v9ses; |
829 | struct p9_fid *fid = NULL, *dfid = NULL; | |
830 | struct inode *inode; | |
53c06f4e AK |
831 | struct p9_qid qid; |
832 | struct dentry *dir_dentry; | |
833 | struct posix_acl *dacl = NULL, *pacl = NULL; | |
834 | ||
609eac1c | 835 | p9_debug(P9_DEBUG_VFS, " %lu,%s mode: %hx MAJOR: %u MINOR: %u\n", |
5d385153 JP |
836 | dir->i_ino, dentry->d_name.name, omode, |
837 | MAJOR(rdev), MINOR(rdev)); | |
53c06f4e AK |
838 | |
839 | if (!new_valid_dev(rdev)) | |
840 | return -EINVAL; | |
841 | ||
842 | v9ses = v9fs_inode2v9ses(dir); | |
af569596 | 843 | dir_dentry = dentry->d_parent; |
53c06f4e AK |
844 | dfid = v9fs_fid_lookup(dir_dentry); |
845 | if (IS_ERR(dfid)) { | |
846 | err = PTR_ERR(dfid); | |
5d385153 | 847 | p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err); |
53c06f4e AK |
848 | dfid = NULL; |
849 | goto error; | |
850 | } | |
851 | ||
852 | gid = v9fs_get_fsgid_for_create(dir); | |
853 | mode = omode; | |
854 | /* Update mode based on ACL value */ | |
855 | err = v9fs_acl_mode(dir, &mode, &dacl, &pacl); | |
856 | if (err) { | |
5d385153 JP |
857 | p9_debug(P9_DEBUG_VFS, "Failed to get acl values in mknod %d\n", |
858 | err); | |
53c06f4e AK |
859 | goto error; |
860 | } | |
861 | name = (char *) dentry->d_name.name; | |
862 | ||
863 | err = p9_client_mknod_dotl(dfid, name, mode, rdev, gid, &qid); | |
864 | if (err < 0) | |
865 | goto error; | |
866 | ||
d28c61f0 | 867 | v9fs_invalidate_inode_attr(dir); |
53c06f4e AK |
868 | /* instantiate inode and assign the unopened fid to the dentry */ |
869 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { | |
870 | fid = p9_client_walk(dfid, 1, &name, 1); | |
871 | if (IS_ERR(fid)) { | |
872 | err = PTR_ERR(fid); | |
5d385153 JP |
873 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", |
874 | err); | |
53c06f4e AK |
875 | fid = NULL; |
876 | goto error; | |
877 | } | |
878 | ||
ed80fcfa | 879 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); |
53c06f4e AK |
880 | if (IS_ERR(inode)) { |
881 | err = PTR_ERR(inode); | |
5d385153 JP |
882 | p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", |
883 | err); | |
53c06f4e AK |
884 | goto error; |
885 | } | |
53c06f4e AK |
886 | err = v9fs_fid_add(dentry, fid); |
887 | if (err < 0) | |
888 | goto error; | |
5441ae5e | 889 | d_instantiate(dentry, inode); |
53c06f4e AK |
890 | fid = NULL; |
891 | } else { | |
892 | /* | |
893 | * Not in cached mode. No need to populate inode with stat. | |
894 | * socket syscall returns a fd, so we need instantiate | |
895 | */ | |
45089142 | 896 | inode = v9fs_get_inode(dir->i_sb, mode, rdev); |
53c06f4e AK |
897 | if (IS_ERR(inode)) { |
898 | err = PTR_ERR(inode); | |
899 | goto error; | |
900 | } | |
53c06f4e AK |
901 | d_instantiate(dentry, inode); |
902 | } | |
903 | /* Now set the ACL based on the default value */ | |
1ec95bf3 | 904 | v9fs_set_create_acl(dentry, &dacl, &pacl); |
53c06f4e AK |
905 | error: |
906 | if (fid) | |
907 | p9_client_clunk(fid); | |
1ec95bf3 | 908 | v9fs_set_create_acl(NULL, &dacl, &pacl); |
53c06f4e AK |
909 | return err; |
910 | } | |
911 | ||
53c06f4e AK |
912 | /** |
913 | * v9fs_vfs_follow_link_dotl - follow a symlink path | |
914 | * @dentry: dentry for symlink | |
915 | * @nd: nameidata | |
916 | * | |
917 | */ | |
918 | ||
919 | static void * | |
920 | v9fs_vfs_follow_link_dotl(struct dentry *dentry, struct nameidata *nd) | |
921 | { | |
31b6ceac MK |
922 | int retval; |
923 | struct p9_fid *fid; | |
53c06f4e | 924 | char *link = __getname(); |
31b6ceac | 925 | char *target; |
53c06f4e | 926 | |
5d385153 | 927 | p9_debug(P9_DEBUG_VFS, "%s\n", dentry->d_name.name); |
53c06f4e | 928 | |
31b6ceac | 929 | if (!link) { |
53c06f4e | 930 | link = ERR_PTR(-ENOMEM); |
31b6ceac | 931 | goto ndset; |
53c06f4e | 932 | } |
31b6ceac MK |
933 | fid = v9fs_fid_lookup(dentry); |
934 | if (IS_ERR(fid)) { | |
935 | __putname(link); | |
936bb2d7 | 936 | link = ERR_CAST(fid); |
31b6ceac MK |
937 | goto ndset; |
938 | } | |
939 | retval = p9_client_readlink(fid, &target); | |
940 | if (!retval) { | |
941 | strcpy(link, target); | |
942 | kfree(target); | |
943 | goto ndset; | |
944 | } | |
945 | __putname(link); | |
946 | link = ERR_PTR(retval); | |
947 | ndset: | |
53c06f4e | 948 | nd_set_link(nd, link); |
53c06f4e AK |
949 | return NULL; |
950 | } | |
951 | ||
b3cbea03 AK |
952 | int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode) |
953 | { | |
954 | loff_t i_size; | |
955 | struct p9_stat_dotl *st; | |
956 | struct v9fs_session_info *v9ses; | |
957 | ||
958 | v9ses = v9fs_inode2v9ses(inode); | |
959 | st = p9_client_getattr_dotl(fid, P9_STATS_ALL); | |
960 | if (IS_ERR(st)) | |
961 | return PTR_ERR(st); | |
45089142 AK |
962 | /* |
963 | * Don't update inode if the file type is different | |
964 | */ | |
965 | if ((inode->i_mode & S_IFMT) != (st->st_mode & S_IFMT)) | |
966 | goto out; | |
b3cbea03 AK |
967 | |
968 | spin_lock(&inode->i_lock); | |
969 | /* | |
970 | * We don't want to refresh inode->i_size, | |
971 | * because we may have cached data | |
972 | */ | |
973 | i_size = inode->i_size; | |
974 | v9fs_stat2inode_dotl(st, inode); | |
975 | if (v9ses->cache) | |
976 | inode->i_size = i_size; | |
977 | spin_unlock(&inode->i_lock); | |
45089142 | 978 | out: |
b3cbea03 AK |
979 | kfree(st); |
980 | return 0; | |
981 | } | |
982 | ||
53c06f4e AK |
983 | const struct inode_operations v9fs_dir_inode_operations_dotl = { |
984 | .create = v9fs_vfs_create_dotl, | |
985 | .lookup = v9fs_vfs_lookup, | |
986 | .link = v9fs_vfs_link_dotl, | |
987 | .symlink = v9fs_vfs_symlink_dotl, | |
988 | .unlink = v9fs_vfs_unlink, | |
989 | .mkdir = v9fs_vfs_mkdir_dotl, | |
990 | .rmdir = v9fs_vfs_rmdir, | |
991 | .mknod = v9fs_vfs_mknod_dotl, | |
992 | .rename = v9fs_vfs_rename, | |
993 | .getattr = v9fs_vfs_getattr_dotl, | |
994 | .setattr = v9fs_vfs_setattr_dotl, | |
995 | .setxattr = generic_setxattr, | |
996 | .getxattr = generic_getxattr, | |
997 | .removexattr = generic_removexattr, | |
998 | .listxattr = v9fs_listxattr, | |
4e34e719 | 999 | .get_acl = v9fs_iop_get_acl, |
53c06f4e AK |
1000 | }; |
1001 | ||
1002 | const struct inode_operations v9fs_file_inode_operations_dotl = { | |
1003 | .getattr = v9fs_vfs_getattr_dotl, | |
1004 | .setattr = v9fs_vfs_setattr_dotl, | |
1005 | .setxattr = generic_setxattr, | |
1006 | .getxattr = generic_getxattr, | |
1007 | .removexattr = generic_removexattr, | |
1008 | .listxattr = v9fs_listxattr, | |
4e34e719 | 1009 | .get_acl = v9fs_iop_get_acl, |
53c06f4e AK |
1010 | }; |
1011 | ||
1012 | const struct inode_operations v9fs_symlink_inode_operations_dotl = { | |
31b6ceac | 1013 | .readlink = generic_readlink, |
53c06f4e AK |
1014 | .follow_link = v9fs_vfs_follow_link_dotl, |
1015 | .put_link = v9fs_vfs_put_link, | |
1016 | .getattr = v9fs_vfs_getattr_dotl, | |
1017 | .setattr = v9fs_vfs_setattr_dotl, | |
1018 | .setxattr = generic_setxattr, | |
1019 | .getxattr = generic_getxattr, | |
1020 | .removexattr = generic_removexattr, | |
1021 | .listxattr = v9fs_listxattr, | |
1022 | }; |