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>
22 #define SM_LOCAL_MODE_BITS 0600
23 #define SM_LOCAL_DIR_MODE_BITS 0700
28 * Server will try to set uid/gid.
29 * On failure ignore the error.
33 * uid/gid set on fileserver files
37 * uid/gid part of xattr
50 typedef struct FsContext
57 extern void cred_init(FsCred
*);
59 typedef struct FileOperations
61 int (*lstat
)(FsContext
*, const char *, struct stat
*);
62 ssize_t (*readlink
)(FsContext
*, const char *, char *, size_t);
63 int (*chmod
)(FsContext
*, const char *, FsCred
*);
64 int (*chown
)(FsContext
*, const char *, FsCred
*);
65 int (*mknod
)(FsContext
*, const char *, FsCred
*);
66 int (*utimensat
)(FsContext
*, const char *, const struct timespec
*);
67 int (*remove
)(FsContext
*, const char *);
68 int (*symlink
)(FsContext
*, const char *, const char *, FsCred
*);
69 int (*link
)(FsContext
*, const char *, const char *);
70 int (*setuid
)(FsContext
*, uid_t
);
71 int (*close
)(FsContext
*, int);
72 int (*closedir
)(FsContext
*, DIR *);
73 DIR *(*opendir
)(FsContext
*, const char *);
74 int (*open
)(FsContext
*, const char *, int);
75 int (*open2
)(FsContext
*, const char *, int, FsCred
*);
76 void (*rewinddir
)(FsContext
*, DIR *);
77 off_t (*telldir
)(FsContext
*, DIR *);
78 struct dirent
*(*readdir
)(FsContext
*, DIR *);
79 void (*seekdir
)(FsContext
*, DIR *, off_t
);
80 ssize_t (*readv
)(FsContext
*, int, const struct iovec
*, int);
81 ssize_t (*writev
)(FsContext
*, int, const struct iovec
*, int);
82 off_t (*lseek
)(FsContext
*, int, off_t
, int);
83 int (*mkdir
)(FsContext
*, const char *, FsCred
*);
84 int (*fstat
)(FsContext
*, int, struct stat
*);
85 int (*rename
)(FsContext
*, const char *, const char *);
86 int (*truncate
)(FsContext
*, const char *, off_t
);
87 int (*fsync
)(FsContext
*, int);
88 int (*statfs
)(FsContext
*s
, const char *path
, struct statfs
*stbuf
);
89 ssize_t (*lgetxattr
)(FsContext
*, const char *,
90 const char *, void *, size_t);
91 ssize_t (*llistxattr
)(FsContext
*, const char *, void *, size_t);
92 int (*lsetxattr
)(FsContext
*, const char *,
93 const char *, void *, size_t, int);
94 int (*lremovexattr
)(FsContext
*, const char *, const char *);