root / hw / file-op-9p.h @ 758e8e38
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 | c494dd6f | Anthony Liguori | int (*chmod)(FsContext *, const char *, mode_t); |
53 | 8cf89e00 | Anthony Liguori | int (*chown)(FsContext *, const char *, uid_t, gid_t); |
54 | c494dd6f | Anthony Liguori | int (*mknod)(FsContext *, const char *, mode_t, dev_t); |
55 | c494dd6f | Anthony Liguori | int (*mksock)(FsContext *, const char *); |
56 | 8cf89e00 | Anthony Liguori | int (*utime)(FsContext *, const char *, const struct utimbuf *); |
57 | 5bae1900 | Anthony Liguori | int (*remove)(FsContext *, const char *); |
58 | c494dd6f | Anthony Liguori | int (*symlink)(FsContext *, const char *, const char *); |
59 | c494dd6f | Anthony Liguori | int (*link)(FsContext *, const char *, const char *); |
60 | 131dcb25 | Anthony Liguori | int (*setuid)(FsContext *, uid_t);
|
61 | 131dcb25 | Anthony Liguori | int (*close)(FsContext *, int); |
62 | 131dcb25 | Anthony Liguori | int (*closedir)(FsContext *, DIR *);
|
63 | a6568fe2 | Anthony Liguori | DIR *(*opendir)(FsContext *, const char *); |
64 | a6568fe2 | Anthony Liguori | int (*open)(FsContext *, const char *, int); |
65 | c494dd6f | Anthony Liguori | int (*open2)(FsContext *, const char *, int, mode_t); |
66 | a9231555 | Anthony Liguori | void (*rewinddir)(FsContext *, DIR *);
|
67 | a9231555 | Anthony Liguori | off_t (*telldir)(FsContext *, DIR *); |
68 | a9231555 | Anthony Liguori | struct dirent *(*readdir)(FsContext *, DIR *);
|
69 | a9231555 | Anthony Liguori | void (*seekdir)(FsContext *, DIR *, off_t);
|
70 | a9231555 | Anthony Liguori | ssize_t (*readv)(FsContext *, int, const struct iovec *, int); |
71 | 8449360c | Anthony Liguori | ssize_t (*writev)(FsContext *, int, const struct iovec *, int); |
72 | a9231555 | Anthony Liguori | off_t (*lseek)(FsContext *, int, off_t, int); |
73 | c494dd6f | Anthony Liguori | int (*mkdir)(FsContext *, const char *, mode_t); |
74 | c494dd6f | Anthony Liguori | int (*fstat)(FsContext *, int, struct stat *); |
75 | 8cf89e00 | Anthony Liguori | int (*rename)(FsContext *, const char *, const char *); |
76 | 8cf89e00 | Anthony Liguori | int (*truncate)(FsContext *, const char *, off_t); |
77 | 8cf89e00 | Anthony Liguori | int (*fsync)(FsContext *, int); |
78 | 74db920c | Gautham R Shenoy | void *opaque;
|
79 | 74db920c | Gautham R Shenoy | } FileOperations; |
80 | 74db920c | Gautham R Shenoy | #endif |