root / hw / file-op-9p.h @ c7b4b0b3
History | View | Annotate | Download (2.4 kB)
1 | 74db920c | Gautham R Shenoy | /*
|
---|---|---|---|
2 | 74db920c | Gautham R Shenoy | * Virtio 9p
|
3 | 74db920c | Gautham R Shenoy | *
|
4 | 74db920c | Gautham R Shenoy | * Copyright IBM, Corp. 2010
|
5 | 74db920c | Gautham R Shenoy | *
|
6 | 74db920c | Gautham R Shenoy | * Authors:
|
7 | 74db920c | Gautham R Shenoy | * Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
|
8 | 74db920c | Gautham R Shenoy | *
|
9 | 74db920c | Gautham R Shenoy | * This work is licensed under the terms of the GNU GPL, version 2. See
|
10 | 74db920c | Gautham R Shenoy | * the COPYING file in the top-level directory.
|
11 | 74db920c | Gautham R Shenoy | *
|
12 | 74db920c | Gautham R Shenoy | */
|
13 | 74db920c | Gautham R Shenoy | #ifndef _FILEOP_H
|
14 | 74db920c | Gautham R Shenoy | #define _FILEOP_H
|
15 | 74db920c | Gautham R Shenoy | #include <sys/types.h> |
16 | 74db920c | Gautham R Shenoy | #include <dirent.h> |
17 | 74db920c | Gautham R Shenoy | #include <sys/time.h> |
18 | 74db920c | Gautham R Shenoy | #include <utime.h> |
19 | 74db920c | Gautham R Shenoy | #include <sys/stat.h> |
20 | 74db920c | Gautham R Shenoy | #include <sys/uio.h> |
21 | 758e8e38 | Venkateswararao Jujjuri (JV) | #include <sys/vfs.h> |
22 | 758e8e38 | Venkateswararao Jujjuri (JV) | #define SM_LOCAL_MODE_BITS 0600 |
23 | 758e8e38 | Venkateswararao Jujjuri (JV) | #define SM_LOCAL_DIR_MODE_BITS 0700 |
24 | 758e8e38 | Venkateswararao Jujjuri (JV) | |
25 | 758e8e38 | Venkateswararao Jujjuri (JV) | typedef enum |
26 | 758e8e38 | Venkateswararao Jujjuri (JV) | { |
27 | 758e8e38 | Venkateswararao Jujjuri (JV) | SM_PASSTHROUGH = 1, /* uid/gid set on fileserver files */ |
28 | 758e8e38 | Venkateswararao Jujjuri (JV) | SM_MAPPED, /* uid/gid part of xattr */
|
29 | 758e8e38 | Venkateswararao Jujjuri (JV) | } SecModel; |
30 | 758e8e38 | Venkateswararao Jujjuri (JV) | |
31 | 758e8e38 | Venkateswararao Jujjuri (JV) | typedef struct FsCred |
32 | 758e8e38 | Venkateswararao Jujjuri (JV) | { |
33 | 758e8e38 | Venkateswararao Jujjuri (JV) | uid_t fc_uid; |
34 | 758e8e38 | Venkateswararao Jujjuri (JV) | gid_t fc_gid; |
35 | 758e8e38 | Venkateswararao Jujjuri (JV) | mode_t fc_mode; |
36 | 758e8e38 | Venkateswararao Jujjuri (JV) | dev_t fc_rdev; |
37 | 758e8e38 | Venkateswararao Jujjuri (JV) | } FsCred; |
38 | 74db920c | Gautham R Shenoy | |
39 | 74db920c | Gautham R Shenoy | typedef struct FsContext |
40 | 74db920c | Gautham R Shenoy | { |
41 | 74db920c | Gautham R Shenoy | char *fs_root;
|
42 | 758e8e38 | Venkateswararao Jujjuri (JV) | SecModel fs_sm; |
43 | 74db920c | Gautham R Shenoy | uid_t uid; |
44 | 74db920c | Gautham R Shenoy | } FsContext; |
45 | 74db920c | Gautham R Shenoy | |
46 | 758e8e38 | Venkateswararao Jujjuri (JV) | extern void cred_init(FsCred *); |
47 | 758e8e38 | Venkateswararao Jujjuri (JV) | |
48 | 74db920c | Gautham R Shenoy | typedef struct FileOperations |
49 | 74db920c | Gautham R Shenoy | { |
50 | 131dcb25 | Anthony Liguori | int (*lstat)(FsContext *, const char *, struct stat *); |
51 | 131dcb25 | Anthony Liguori | ssize_t (*readlink)(FsContext *, const char *, char *, size_t); |
52 | e95ead32 | Venkateswararao Jujjuri (JV) | int (*chmod)(FsContext *, const char *, FsCred *); |
53 | f7613bee | Venkateswararao Jujjuri (JV) | int (*chown)(FsContext *, const char *, FsCred *); |
54 | 1c293312 | Venkateswararao Jujjuri (JV) | int (*mknod)(FsContext *, const char *, FsCred *); |
55 | 74bc02b2 | M. Mohan Kumar | int (*utimensat)(FsContext *, const char *, const struct timespec *); |
56 | 5bae1900 | Anthony Liguori | int (*remove)(FsContext *, const char *); |
57 | 879c2813 | Venkateswararao Jujjuri (JV) | int (*symlink)(FsContext *, const char *, const char *, FsCred *); |
58 | c494dd6f | Anthony Liguori | int (*link)(FsContext *, const char *, const char *); |
59 | 131dcb25 | Anthony Liguori | int (*setuid)(FsContext *, uid_t);
|
60 | 131dcb25 | Anthony Liguori | int (*close)(FsContext *, int); |
61 | 131dcb25 | Anthony Liguori | int (*closedir)(FsContext *, DIR *);
|
62 | a6568fe2 | Anthony Liguori | DIR *(*opendir)(FsContext *, const char *); |
63 | a6568fe2 | Anthony Liguori | int (*open)(FsContext *, const char *, int); |
64 | 4750a96f | Venkateswararao Jujjuri (JV) | int (*open2)(FsContext *, const char *, int, FsCred *); |
65 | a9231555 | Anthony Liguori | void (*rewinddir)(FsContext *, DIR *);
|
66 | a9231555 | Anthony Liguori | off_t (*telldir)(FsContext *, DIR *); |
67 | a9231555 | Anthony Liguori | struct dirent *(*readdir)(FsContext *, DIR *);
|
68 | a9231555 | Anthony Liguori | void (*seekdir)(FsContext *, DIR *, off_t);
|
69 | a9231555 | Anthony Liguori | ssize_t (*readv)(FsContext *, int, const struct iovec *, int); |
70 | 8449360c | Anthony Liguori | ssize_t (*writev)(FsContext *, int, const struct iovec *, int); |
71 | a9231555 | Anthony Liguori | off_t (*lseek)(FsContext *, int, off_t, int); |
72 | 00ec5c37 | Venkateswararao Jujjuri (JV) | int (*mkdir)(FsContext *, const char *, FsCred *); |
73 | c494dd6f | Anthony Liguori | int (*fstat)(FsContext *, int, struct stat *); |
74 | 8cf89e00 | Anthony Liguori | int (*rename)(FsContext *, const char *, const char *); |
75 | 8cf89e00 | Anthony Liguori | int (*truncate)(FsContext *, const char *, off_t); |
76 | 8cf89e00 | Anthony Liguori | int (*fsync)(FsContext *, int); |
77 | be940c87 | M. Mohan Kumar | int (*statfs)(FsContext *s, const char *path, struct statfs *stbuf); |
78 | 74db920c | Gautham R Shenoy | void *opaque;
|
79 | 74db920c | Gautham R Shenoy | } FileOperations; |
80 | 74db920c | Gautham R Shenoy | #endif |