1 /* 2 * include/linux/lsm2ccsecurity.h 3 * 4 * Copyright (C) 2005-2012 NTT DATA CORPORATION 5 * 6 * Version: 1.8.11 2024/07/15 7 */ 8 9 #ifndef _LINUX_LSM2CCSECURITY_H 10 #define _LINUX_LSM2CCSECURITY_H 11 12 #include <linux/version.h> 13 #include <linux/uidgid.h> 14 15 #ifdef CONFIG_CCSECURITY 16 17 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) 18 int ccs_settime(const struct timespec64 *ts, const struct timezone *tz); 19 #else 20 int ccs_settime(const struct timespec *ts, const struct timezone *tz); 21 #endif 22 int ccs_sb_umount(struct vfsmount *mnt, int flags); 23 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0) 24 int ccs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); 25 #else 26 int ccs_inode_getattr(const struct path *path); 27 #endif 28 int ccs_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg); 29 int ccs_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg); 30 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) || (defined(RHEL_MAJOR) && RHEL_MAJOR == 8) 31 int ccs_file_open(struct file *file); 32 #else 33 int ccs_file_open(struct file *file, const struct cred *cred); 34 #endif 35 int ccs_socket_create(int family, int type, int protocol, int kern); 36 int ccs_socket_bind(struct socket *sock, struct sockaddr *address, 37 int addrlen); 38 int ccs_socket_connect(struct socket *sock, struct sockaddr *address, 39 int addrlen); 40 int ccs_socket_listen(struct socket *sock, int backlog); 41 int ccs_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size); 42 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) 43 int ccs_path_chmod(const struct path *path, umode_t mode); 44 int ccs_path_chown(const struct path *path, kuid_t uid, kgid_t gid); 45 int ccs_path_chroot(const struct path *path); 46 int ccs_path_link(struct dentry *old_dentry, const struct path *new_dir, 47 struct dentry *new_dentry); 48 int ccs_path_mkdir(const struct path *dir, struct dentry *dentry, 49 umode_t mode); 50 int ccs_path_mknod(const struct path *dir, struct dentry *dentry, umode_t mode, 51 unsigned int dev); 52 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) 53 int ccs_path_rename(const struct path *old_dir, struct dentry *old_dentry, 54 const struct path *new_dir, struct dentry *new_dentry, 55 const unsigned int flags); 56 #else 57 int ccs_path_rename(const struct path *old_dir, struct dentry *old_dentry, 58 const struct path *new_dir, struct dentry *new_dentry); 59 #endif 60 int ccs_path_rmdir(const struct path *dir, struct dentry *dentry); 61 int ccs_path_symlink(const struct path *dir, struct dentry *dentry, 62 const char *old_name); 63 int ccs_path_truncate(const struct path *path); 64 int ccs_path_unlink(const struct path *dir, struct dentry *dentry); 65 int ccs_sb_mount(const char *dev_name, const struct path *path, 66 const char *type, unsigned long flags, void *data); 67 int ccs_sb_pivotroot(const struct path *old_path, const struct path *new_path); 68 #else 69 int ccs_path_chmod(struct path *path, umode_t mode); 70 int ccs_path_chown(struct path *path, kuid_t uid, kgid_t gid); 71 int ccs_path_chroot(struct path *path); 72 int ccs_path_link(struct dentry *old_dentry, struct path *new_dir, 73 struct dentry *new_dentry); 74 int ccs_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode); 75 int ccs_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode, 76 unsigned int dev); 77 int ccs_path_rename(struct path *old_dir, struct dentry *old_dentry, 78 struct path *new_dir, struct dentry *new_dentry); 79 int ccs_path_rmdir(struct path *dir, struct dentry *dentry); 80 int ccs_path_symlink(struct path *dir, struct dentry *dentry, 81 const char *old_name); 82 int ccs_path_truncate(struct path *path); 83 int ccs_path_unlink(struct path *dir, struct dentry *dentry); 84 int ccs_sb_mount(const char *dev_name, struct path *path, const char *type, 85 unsigned long flags, void *data); 86 int ccs_sb_pivotroot(struct path *old_path, struct path *new_path); 87 #endif 88 89 #else 90 91 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) 92 static inline int ccs_settime(const struct timespec64 *ts, 93 const struct timezone *tz) 94 { 95 return 0; 96 } 97 #else 98 static inline int ccs_settime(const struct timespec *ts, 99 const struct timezone *tz) 100 { 101 return 0; 102 } 103 #endif 104 static inline int ccs_sb_mount(const char *dev_name, const struct path *path, 105 const char *type, unsigned long flags, 106 void *data) 107 { 108 return 0; 109 } 110 static inline int ccs_sb_umount(struct vfsmount *mnt, int flags) 111 { 112 return 0; 113 } 114 static inline int ccs_sb_pivotroot(const struct path *old_path, 115 const struct path *new_path) 116 { 117 return 0; 118 } 119 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0) 120 static inline int ccs_inode_getattr(struct vfsmount *mnt, 121 struct dentry *dentry) 122 { 123 return 0; 124 } 125 #else 126 static inline int ccs_inode_getattr(const struct path *path) 127 { 128 return 0; 129 } 130 #endif 131 static inline int ccs_file_ioctl(struct file *file, unsigned int cmd, 132 unsigned long arg) 133 { 134 return 0; 135 } 136 static inline int ccs_file_fcntl(struct file *file, unsigned int cmd, 137 unsigned long arg) 138 { 139 return 0; 140 } 141 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) 142 static inline int ccs_file_open(struct file *file) 143 { 144 return 0; 145 } 146 #else 147 static inline int ccs_file_open(struct file *file, const struct cred *cred) 148 { 149 return 0; 150 } 151 #endif 152 static inline int ccs_socket_create(int family, int type, int protocol, 153 int kern) 154 { 155 return 0; 156 } 157 static inline int ccs_socket_bind(struct socket *sock, 158 struct sockaddr *address, int addrlen) 159 { 160 return 0; 161 } 162 static inline int ccs_socket_connect(struct socket *sock, 163 struct sockaddr *address, int addrlen) 164 { 165 return 0; 166 } 167 static inline int ccs_socket_listen(struct socket *sock, int backlog) 168 { 169 return 0; 170 } 171 static inline int ccs_socket_sendmsg(struct socket *sock, struct msghdr *msg, 172 int size) 173 { 174 return 0; 175 } 176 static inline int ccs_path_unlink(const struct path *dir, 177 struct dentry *dentry) 178 { 179 return 0; 180 } 181 static inline int ccs_path_mkdir(const struct path *dir, struct dentry *dentry, 182 umode_t mode) 183 { 184 return 0; 185 } 186 static inline int ccs_path_rmdir(const struct path *dir, struct dentry *dentry) 187 { 188 return 0; 189 } 190 static inline int ccs_path_mknod(const struct path *dir, struct dentry *dentry, 191 umode_t mode, unsigned int dev) 192 { 193 return 0; 194 } 195 static inline int ccs_path_truncate(const struct path *path) 196 { 197 return 0; 198 } 199 static inline int ccs_path_symlink(const struct path *dir, 200 struct dentry *dentry, const char *old_name) 201 { 202 return 0; 203 } 204 static inline int ccs_path_link(struct dentry *old_dentry, 205 const struct path *new_dir, 206 struct dentry *new_dentry) 207 { 208 return 0; 209 } 210 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) 211 static inline int ccs_path_rename(const struct path *old_dir, 212 struct dentry *old_dentry, 213 const struct path *new_dir, 214 struct dentry *new_dentry, 215 const unsigned int flags) 216 { 217 return 0; 218 } 219 #else 220 static inline int ccs_path_rename(const struct path *old_dir, 221 struct dentry *old_dentry, 222 const struct path *new_dir, 223 struct dentry *new_dentry) 224 { 225 return 0; 226 } 227 #endif 228 static inline int ccs_path_chmod(const struct path *path, umode_t mode) 229 { 230 return 0; 231 } 232 static inline int ccs_path_chown(const struct path *path, kuid_t uid, 233 kgid_t gid) 234 { 235 return 0; 236 } 237 static inline int ccs_path_chroot(const struct path *path) 238 { 239 return 0; 240 } 241 242 #endif /* defined(CONFIG_CCSECURITY) */ 243 244 #endif /* !defined(_LINUX_LSM2CCSECURITY_H) */ 245
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.