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
29 * Server will try to set uid/gid.
30 * On failure ignore the error.
34 * uid/gid set on fileserver files
38 * uid/gid part of xattr
51 struct xattr_operations
;
53 /* FsContext flag values */
54 #define PATHNAME_FSCONTEXT 0x1
56 typedef struct FsContext
62 struct xattr_operations
**xops
;
63 /* fs driver specific data */
67 typedef struct V9fsPath
{
72 void cred_init(FsCred
*);
74 typedef struct FileOperations
76 int (*init
)(struct FsContext
*);
77 int (*lstat
)(FsContext
*, V9fsPath
*, struct stat
*);
78 ssize_t (*readlink
)(FsContext
*, V9fsPath
*, char *, size_t);
79 int (*chmod
)(FsContext
*, V9fsPath
*, FsCred
*);
80 int (*chown
)(FsContext
*, V9fsPath
*, FsCred
*);
81 int (*mknod
)(FsContext
*, V9fsPath
*, const char *, FsCred
*);
82 int (*utimensat
)(FsContext
*, V9fsPath
*, const struct timespec
*);
83 int (*remove
)(FsContext
*, const char *);
84 int (*symlink
)(FsContext
*, const char *, V9fsPath
*,
85 const char *, FsCred
*);
86 int (*link
)(FsContext
*, V9fsPath
*, V9fsPath
*, const char *);
87 int (*setuid
)(FsContext
*, uid_t
);
88 int (*close
)(FsContext
*, int);
89 int (*closedir
)(FsContext
*, DIR *);
90 DIR *(*opendir
)(FsContext
*, V9fsPath
*);
91 int (*open
)(FsContext
*, V9fsPath
*, int);
92 int (*open2
)(FsContext
*, V9fsPath
*, const char *, int, FsCred
*);
93 void (*rewinddir
)(FsContext
*, DIR *);
94 off_t (*telldir
)(FsContext
*, DIR *);
95 int (*readdir_r
)(FsContext
*, DIR *, struct dirent
*, struct dirent
**);
96 void (*seekdir
)(FsContext
*, DIR *, off_t
);
97 ssize_t (*preadv
)(FsContext
*, int, const struct iovec
*, int, off_t
);
98 ssize_t (*pwritev
)(FsContext
*, int, const struct iovec
*, int, off_t
);
99 int (*mkdir
)(FsContext
*, V9fsPath
*, const char *, FsCred
*);
100 int (*fstat
)(FsContext
*, int, struct stat
*);
101 int (*rename
)(FsContext
*, const char *, const char *);
102 int (*truncate
)(FsContext
*, V9fsPath
*, off_t
);
103 int (*fsync
)(FsContext
*, int, int);
104 int (*statfs
)(FsContext
*s
, V9fsPath
*path
, struct statfs
*stbuf
);
105 ssize_t (*lgetxattr
)(FsContext
*, V9fsPath
*,
106 const char *, void *, size_t);
107 ssize_t (*llistxattr
)(FsContext
*, V9fsPath
*, void *, size_t);
108 int (*lsetxattr
)(FsContext
*, V9fsPath
*,
109 const char *, void *, size_t, int);
110 int (*lremovexattr
)(FsContext
*, V9fsPath
*, const char *);
111 int (*name_to_path
)(FsContext
*, V9fsPath
*, const char *, V9fsPath
*);
112 int (*renameat
)(FsContext
*ctx
, V9fsPath
*olddir
, const char *old_name
,
113 V9fsPath
*newdir
, const char *new_name
);
114 int (*unlinkat
)(FsContext
*ctx
, V9fsPath
*dir
, const char *name
, int flags
);