4 * Copyright IBM, Corp. 2010
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.
15 #include <sys/types.h>
23 #define SM_LOCAL_MODE_BITS 0600
24 #define SM_LOCAL_DIR_MODE_BITS 0700
34 struct xattr_operations
;
38 typedef struct extended_ops
{
39 int (*get_st_gen
)(struct FsContext
*, struct V9fsPath
*,
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
61 #define V9FS_SEC_MASK 0x0000001C
63 typedef struct FsContext
68 struct xattr_operations
**xops
;
69 struct extended_ops exops
;
70 /* fs driver specific data */
74 typedef struct V9fsPath
{
79 void cred_init(FsCred
*);
81 typedef struct FileOperations
83 int (*init
)(struct FsContext
*);
84 int (*lstat
)(FsContext
*, V9fsPath
*, struct stat
*);
85 ssize_t (*readlink
)(FsContext
*, V9fsPath
*, char *, size_t);
86 int (*chmod
)(FsContext
*, V9fsPath
*, FsCred
*);
87 int (*chown
)(FsContext
*, V9fsPath
*, FsCred
*);
88 int (*mknod
)(FsContext
*, V9fsPath
*, const char *, FsCred
*);
89 int (*utimensat
)(FsContext
*, V9fsPath
*, const struct timespec
*);
90 int (*remove
)(FsContext
*, const char *);
91 int (*symlink
)(FsContext
*, const char *, V9fsPath
*,
92 const char *, FsCred
*);
93 int (*link
)(FsContext
*, V9fsPath
*, V9fsPath
*, const char *);
94 int (*setuid
)(FsContext
*, uid_t
);
95 int (*close
)(FsContext
*, int);
96 int (*closedir
)(FsContext
*, DIR *);
97 DIR *(*opendir
)(FsContext
*, V9fsPath
*);
98 int (*open
)(FsContext
*, V9fsPath
*, int);
99 int (*open2
)(FsContext
*, V9fsPath
*, const char *, int, FsCred
*);
100 void (*rewinddir
)(FsContext
*, DIR *);
101 off_t (*telldir
)(FsContext
*, DIR *);
102 int (*readdir_r
)(FsContext
*, DIR *, struct dirent
*, struct dirent
**);
103 void (*seekdir
)(FsContext
*, DIR *, off_t
);
104 ssize_t (*preadv
)(FsContext
*, int, const struct iovec
*, int, off_t
);
105 ssize_t (*pwritev
)(FsContext
*, int, const struct iovec
*, int, off_t
);
106 int (*mkdir
)(FsContext
*, V9fsPath
*, const char *, FsCred
*);
107 int (*fstat
)(FsContext
*, int, struct stat
*);
108 int (*rename
)(FsContext
*, const char *, const char *);
109 int (*truncate
)(FsContext
*, V9fsPath
*, off_t
);
110 int (*fsync
)(FsContext
*, int, int);
111 int (*statfs
)(FsContext
*s
, V9fsPath
*path
, struct statfs
*stbuf
);
112 ssize_t (*lgetxattr
)(FsContext
*, V9fsPath
*,
113 const char *, void *, size_t);
114 ssize_t (*llistxattr
)(FsContext
*, V9fsPath
*, void *, size_t);
115 int (*lsetxattr
)(FsContext
*, V9fsPath
*,
116 const char *, void *, size_t, int);
117 int (*lremovexattr
)(FsContext
*, V9fsPath
*, const char *);
118 int (*name_to_path
)(FsContext
*, V9fsPath
*, const char *, V9fsPath
*);
119 int (*renameat
)(FsContext
*ctx
, V9fsPath
*olddir
, const char *old_name
,
120 V9fsPath
*newdir
, const char *new_name
);
121 int (*unlinkat
)(FsContext
*ctx
, V9fsPath
*dir
, const char *name
, int flags
);