rcu: Allow calling rcu_(un)register_thread() during synchronize_rcu()
[qemu/ar7.git] / fsdev / file-op-9p.h
blob956fda091968b34326246209109b4b05697fcf31
1 /*
2 * Virtio 9p
4 * Copyright IBM, Corp. 2010
6 * Authors:
7 * Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
13 #ifndef _FILEOP_H
14 #define _FILEOP_H
15 #include <sys/types.h>
16 #include <dirent.h>
17 #include <sys/time.h>
18 #include <utime.h>
19 #include <sys/stat.h>
20 #include <sys/uio.h>
21 #include <sys/vfs.h>
23 #define SM_LOCAL_MODE_BITS 0600
24 #define SM_LOCAL_DIR_MODE_BITS 0700
26 typedef struct FsCred
28 uid_t fc_uid;
29 gid_t fc_gid;
30 mode_t fc_mode;
31 dev_t fc_rdev;
32 } FsCred;
34 struct xattr_operations;
35 struct FsContext;
36 struct V9fsPath;
38 typedef struct extended_ops {
39 int (*get_st_gen)(struct FsContext *, struct V9fsPath *,
40 mode_t, uint64_t *);
41 } extended_ops;
43 /* export flags */
44 #define V9FS_IMMEDIATE_WRITEOUT 0x00000001
45 #define V9FS_PATHNAME_FSCONTEXT 0x00000002
47 * uid/gid set on fileserver files
49 #define V9FS_SM_PASSTHROUGH 0x00000004
51 * uid/gid part of xattr
53 #define V9FS_SM_MAPPED 0x00000008
55 * Server will try to set uid/gid.
56 * On failure ignore the error.
58 #define V9FS_SM_NONE 0x00000010
60 * uid/gid part of .virtfs_meatadata namespace
62 #define V9FS_SM_MAPPED_FILE 0x00000020
63 #define V9FS_RDONLY 0x00000040
64 #define V9FS_PROXY_SOCK_FD 0x00000080
65 #define V9FS_PROXY_SOCK_NAME 0x00000100
67 #define V9FS_SEC_MASK 0x0000003C
70 typedef struct FileOperations FileOperations;
72 * Structure to store the various fsdev's passed through command line.
74 typedef struct FsDriverEntry {
75 char *fsdev_id;
76 char *path;
77 int export_flags;
78 FileOperations *ops;
79 } FsDriverEntry;
81 typedef struct FsContext
83 uid_t uid;
84 char *fs_root;
85 int export_flags;
86 struct xattr_operations **xops;
87 struct extended_ops exops;
88 /* fs driver specific data */
89 void *private;
90 } FsContext;
92 typedef struct V9fsPath {
93 uint16_t size;
94 char *data;
95 } V9fsPath;
97 typedef union V9fsFidOpenState V9fsFidOpenState;
99 void cred_init(FsCred *);
101 struct FileOperations
103 int (*parse_opts)(QemuOpts *, struct FsDriverEntry *);
104 int (*init)(struct FsContext *);
105 int (*lstat)(FsContext *, V9fsPath *, struct stat *);
106 ssize_t (*readlink)(FsContext *, V9fsPath *, char *, size_t);
107 int (*chmod)(FsContext *, V9fsPath *, FsCred *);
108 int (*chown)(FsContext *, V9fsPath *, FsCred *);
109 int (*mknod)(FsContext *, V9fsPath *, const char *, FsCred *);
110 int (*utimensat)(FsContext *, V9fsPath *, const struct timespec *);
111 int (*remove)(FsContext *, const char *);
112 int (*symlink)(FsContext *, const char *, V9fsPath *,
113 const char *, FsCred *);
114 int (*link)(FsContext *, V9fsPath *, V9fsPath *, const char *);
115 int (*setuid)(FsContext *, uid_t);
116 int (*close)(FsContext *, V9fsFidOpenState *);
117 int (*closedir)(FsContext *, V9fsFidOpenState *);
118 int (*opendir)(FsContext *, V9fsPath *, V9fsFidOpenState *);
119 int (*open)(FsContext *, V9fsPath *, int, V9fsFidOpenState *);
120 int (*open2)(FsContext *, V9fsPath *, const char *,
121 int, FsCred *, V9fsFidOpenState *);
122 void (*rewinddir)(FsContext *, V9fsFidOpenState *);
123 off_t (*telldir)(FsContext *, V9fsFidOpenState *);
124 int (*readdir_r)(FsContext *, V9fsFidOpenState *,
125 struct dirent *, struct dirent **);
126 void (*seekdir)(FsContext *, V9fsFidOpenState *, off_t);
127 ssize_t (*preadv)(FsContext *, V9fsFidOpenState *,
128 const struct iovec *, int, off_t);
129 ssize_t (*pwritev)(FsContext *, V9fsFidOpenState *,
130 const struct iovec *, int, off_t);
131 int (*mkdir)(FsContext *, V9fsPath *, const char *, FsCred *);
132 int (*fstat)(FsContext *, int, V9fsFidOpenState *, struct stat *);
133 int (*rename)(FsContext *, const char *, const char *);
134 int (*truncate)(FsContext *, V9fsPath *, off_t);
135 int (*fsync)(FsContext *, int, V9fsFidOpenState *, int);
136 int (*statfs)(FsContext *s, V9fsPath *path, struct statfs *stbuf);
137 ssize_t (*lgetxattr)(FsContext *, V9fsPath *,
138 const char *, void *, size_t);
139 ssize_t (*llistxattr)(FsContext *, V9fsPath *, void *, size_t);
140 int (*lsetxattr)(FsContext *, V9fsPath *,
141 const char *, void *, size_t, int);
142 int (*lremovexattr)(FsContext *, V9fsPath *, const char *);
143 int (*name_to_path)(FsContext *, V9fsPath *, const char *, V9fsPath *);
144 int (*renameat)(FsContext *ctx, V9fsPath *olddir, const char *old_name,
145 V9fsPath *newdir, const char *new_name);
146 int (*unlinkat)(FsContext *ctx, V9fsPath *dir, const char *name, int flags);
147 void *opaque;
150 #endif