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
27 SM_PASSTHROUGH
= 1, /* uid/gid set on fileserver files */
28 SM_MAPPED
, /* uid/gid part of xattr */
39 typedef struct FsContext
46 extern void cred_init(FsCred
*);
48 typedef struct FileOperations
50 int (*lstat
)(FsContext
*, const char *, struct stat
*);
51 ssize_t (*readlink
)(FsContext
*, const char *, char *, size_t);
52 int (*chmod
)(FsContext
*, const char *, FsCred
*);
53 int (*chown
)(FsContext
*, const char *, FsCred
*);
54 int (*mknod
)(FsContext
*, const char *, FsCred
*);
55 int (*utime
)(FsContext
*, const char *, const struct utimbuf
*);
56 int (*remove
)(FsContext
*, const char *);
57 int (*symlink
)(FsContext
*, const char *, const char *, FsCred
*);
58 int (*link
)(FsContext
*, const char *, const char *);
59 int (*setuid
)(FsContext
*, uid_t
);
60 int (*close
)(FsContext
*, int);
61 int (*closedir
)(FsContext
*, DIR *);
62 DIR *(*opendir
)(FsContext
*, const char *);
63 int (*open
)(FsContext
*, const char *, int);
64 int (*open2
)(FsContext
*, const char *, int, FsCred
*);
65 void (*rewinddir
)(FsContext
*, DIR *);
66 off_t (*telldir
)(FsContext
*, DIR *);
67 struct dirent
*(*readdir
)(FsContext
*, DIR *);
68 void (*seekdir
)(FsContext
*, DIR *, off_t
);
69 ssize_t (*readv
)(FsContext
*, int, const struct iovec
*, int);
70 ssize_t (*writev
)(FsContext
*, int, const struct iovec
*, int);
71 off_t (*lseek
)(FsContext
*, int, off_t
, int);
72 int (*mkdir
)(FsContext
*, const char *, FsCred
*);
73 int (*fstat
)(FsContext
*, int, struct stat
*);
74 int (*rename
)(FsContext
*, const char *, const char *);
75 int (*truncate
)(FsContext
*, const char *, off_t
);
76 int (*fsync
)(FsContext
*, int);