diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-12-31 18:57:56 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-12-31 18:57:56 -0500 |
| commit | b58602a4bac012b5f4fc12fe6b46ab237b610d5d (patch) | |
| tree | 38929e210a723f67fe2b945f37264bf3aae3c2c4 /include | |
| parent | db200df0b3530f673d8e9f5bd535e9e10305842a (diff) | |
| parent | 1f3403fa640f9f7b135dee79f2d39d01c8ad4a08 (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (34 commits)
nfsd race fixes: jfs
nfsd race fixes: reiserfs
nfsd race fixes: ext4
nfsd race fixes: ext3
nfsd race fixes: ext2
nfsd/create race fixes, infrastructure
filesystem notification: create fs/notify to contain all fs notification
fs/block_dev.c: __read_mostly improvement and sb_is_blkdev_sb utilization
kill ->dir_notify()
filp_cachep can be static in fs/file_table.c
fix f_count description in Documentation/filesystems/files.txt
make INIT_FS use the __RW_LOCK_UNLOCKED initialization
take init_fs to saner place
kill vfs_permission
pass a struct path * to may_open
kill walk_init_root
remove incorrect comment in inode_permission
expand some comments (d_path / seq_path)
correct wrong function name of d_put in kernel document and source comment
fix switch_names() breakage in short-to-short case
...
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/dcache.h | 21 | ||||
| -rw-r--r-- | include/linux/fdtable.h | 2 | ||||
| -rw-r--r-- | include/linux/fs.h | 24 | ||||
| -rw-r--r-- | include/linux/fs_struct.h | 6 | ||||
| -rw-r--r-- | include/linux/init_task.h | 1 | ||||
| -rw-r--r-- | include/linux/namei.h | 5 | ||||
| -rw-r--r-- | include/linux/security.h | 137 |
7 files changed, 169 insertions, 27 deletions
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index a37359d0bad1..c66d22487bf8 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
| @@ -75,14 +75,22 @@ full_name_hash(const unsigned char *name, unsigned int len) | |||
| 75 | return end_name_hash(hash); | 75 | return end_name_hash(hash); |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | struct dcookie_struct; | 78 | /* |
| 79 | 79 | * Try to keep struct dentry aligned on 64 byte cachelines (this will | |
| 80 | #define DNAME_INLINE_LEN_MIN 36 | 80 | * give reasonable cacheline footprint with larger lines without the |
| 81 | * large memory footprint increase). | ||
| 82 | */ | ||
| 83 | #ifdef CONFIG_64BIT | ||
| 84 | #define DNAME_INLINE_LEN_MIN 32 /* 192 bytes */ | ||
| 85 | #else | ||
| 86 | #define DNAME_INLINE_LEN_MIN 40 /* 128 bytes */ | ||
| 87 | #endif | ||
| 81 | 88 | ||
| 82 | struct dentry { | 89 | struct dentry { |
| 83 | atomic_t d_count; | 90 | atomic_t d_count; |
| 84 | unsigned int d_flags; /* protected by d_lock */ | 91 | unsigned int d_flags; /* protected by d_lock */ |
| 85 | spinlock_t d_lock; /* per dentry lock */ | 92 | spinlock_t d_lock; /* per dentry lock */ |
| 93 | int d_mounted; | ||
| 86 | struct inode *d_inode; /* Where the name belongs to - NULL is | 94 | struct inode *d_inode; /* Where the name belongs to - NULL is |
| 87 | * negative */ | 95 | * negative */ |
| 88 | /* | 96 | /* |
| @@ -107,10 +115,7 @@ struct dentry { | |||
| 107 | struct dentry_operations *d_op; | 115 | struct dentry_operations *d_op; |
| 108 | struct super_block *d_sb; /* The root of the dentry tree */ | 116 | struct super_block *d_sb; /* The root of the dentry tree */ |
| 109 | void *d_fsdata; /* fs-specific data */ | 117 | void *d_fsdata; /* fs-specific data */ |
| 110 | #ifdef CONFIG_PROFILING | 118 | |
| 111 | struct dcookie_struct *d_cookie; /* cookie, if any */ | ||
| 112 | #endif | ||
| 113 | int d_mounted; | ||
| 114 | unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */ | 119 | unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */ |
| 115 | }; | 120 | }; |
| 116 | 121 | ||
| @@ -177,6 +182,8 @@ d_iput: no no no yes | |||
| 177 | 182 | ||
| 178 | #define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 /* Parent inode is watched */ | 183 | #define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 /* Parent inode is watched */ |
| 179 | 184 | ||
| 185 | #define DCACHE_COOKIE 0x0040 /* For use by dcookie subsystem */ | ||
| 186 | |||
| 180 | extern spinlock_t dcache_lock; | 187 | extern spinlock_t dcache_lock; |
| 181 | extern seqlock_t rename_lock; | 188 | extern seqlock_t rename_lock; |
| 182 | 189 | ||
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h index 4aab6f12cfab..09d6c5bbdddd 100644 --- a/include/linux/fdtable.h +++ b/include/linux/fdtable.h | |||
| @@ -57,8 +57,6 @@ struct files_struct { | |||
| 57 | 57 | ||
| 58 | #define files_fdtable(files) (rcu_dereference((files)->fdt)) | 58 | #define files_fdtable(files) (rcu_dereference((files)->fdt)) |
| 59 | 59 | ||
| 60 | extern struct kmem_cache *filp_cachep; | ||
| 61 | |||
| 62 | struct file_operations; | 60 | struct file_operations; |
| 63 | struct vfsmount; | 61 | struct vfsmount; |
| 64 | struct dentry; | 62 | struct dentry; |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 001ded4845b4..e2170ee21e18 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -21,7 +21,6 @@ | |||
| 21 | 21 | ||
| 22 | /* Fixed constants first: */ | 22 | /* Fixed constants first: */ |
| 23 | #undef NR_OPEN | 23 | #undef NR_OPEN |
| 24 | extern int sysctl_nr_open; | ||
| 25 | #define INR_OPEN 1024 /* Initial setting for nfile rlimits */ | 24 | #define INR_OPEN 1024 /* Initial setting for nfile rlimits */ |
| 26 | 25 | ||
| 27 | #define BLOCK_SIZE_BITS 10 | 26 | #define BLOCK_SIZE_BITS 10 |
| @@ -38,21 +37,13 @@ struct files_stat_struct { | |||
| 38 | int nr_free_files; /* read only */ | 37 | int nr_free_files; /* read only */ |
| 39 | int max_files; /* tunable */ | 38 | int max_files; /* tunable */ |
| 40 | }; | 39 | }; |
| 41 | extern struct files_stat_struct files_stat; | ||
| 42 | extern int get_max_files(void); | ||
| 43 | 40 | ||
| 44 | struct inodes_stat_t { | 41 | struct inodes_stat_t { |
| 45 | int nr_inodes; | 42 | int nr_inodes; |
| 46 | int nr_unused; | 43 | int nr_unused; |
| 47 | int dummy[5]; /* padding for sysctl ABI compatibility */ | 44 | int dummy[5]; /* padding for sysctl ABI compatibility */ |
| 48 | }; | 45 | }; |
| 49 | extern struct inodes_stat_t inodes_stat; | ||
| 50 | 46 | ||
| 51 | extern int leases_enable, lease_break_time; | ||
| 52 | |||
| 53 | #ifdef CONFIG_DNOTIFY | ||
| 54 | extern int dir_notify_enable; | ||
| 55 | #endif | ||
| 56 | 47 | ||
| 57 | #define NR_FILE 8192 /* this can well be larger on a larger system */ | 48 | #define NR_FILE 8192 /* this can well be larger on a larger system */ |
| 58 | 49 | ||
| @@ -330,6 +321,15 @@ extern void __init inode_init(void); | |||
| 330 | extern void __init inode_init_early(void); | 321 | extern void __init inode_init_early(void); |
| 331 | extern void __init files_init(unsigned long); | 322 | extern void __init files_init(unsigned long); |
| 332 | 323 | ||
| 324 | extern struct files_stat_struct files_stat; | ||
| 325 | extern int get_max_files(void); | ||
| 326 | extern int sysctl_nr_open; | ||
| 327 | extern struct inodes_stat_t inodes_stat; | ||
| 328 | extern int leases_enable, lease_break_time; | ||
| 329 | #ifdef CONFIG_DNOTIFY | ||
| 330 | extern int dir_notify_enable; | ||
| 331 | #endif | ||
| 332 | |||
| 333 | struct buffer_head; | 333 | struct buffer_head; |
| 334 | typedef int (get_block_t)(struct inode *inode, sector_t iblock, | 334 | typedef int (get_block_t)(struct inode *inode, sector_t iblock, |
| 335 | struct buffer_head *bh_result, int create); | 335 | struct buffer_head *bh_result, int create); |
| @@ -1212,7 +1212,6 @@ extern void unlock_super(struct super_block *); | |||
| 1212 | /* | 1212 | /* |
| 1213 | * VFS helper functions.. | 1213 | * VFS helper functions.. |
| 1214 | */ | 1214 | */ |
| 1215 | extern int vfs_permission(struct nameidata *, int); | ||
| 1216 | extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); | 1215 | extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); |
| 1217 | extern int vfs_mkdir(struct inode *, struct dentry *, int); | 1216 | extern int vfs_mkdir(struct inode *, struct dentry *, int); |
| 1218 | extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); | 1217 | extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); |
| @@ -1310,7 +1309,6 @@ struct file_operations { | |||
| 1310 | ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int); | 1309 | ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int); |
| 1311 | unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); | 1310 | unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); |
| 1312 | int (*check_flags)(int); | 1311 | int (*check_flags)(int); |
| 1313 | int (*dir_notify)(struct file *filp, unsigned long arg); | ||
| 1314 | int (*flock) (struct file *, int, struct file_lock *); | 1312 | int (*flock) (struct file *, int, struct file_lock *); |
| 1315 | ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); | 1313 | ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); |
| 1316 | ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); | 1314 | ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); |
| @@ -1869,7 +1867,7 @@ extern void free_write_pipe(struct file *); | |||
| 1869 | 1867 | ||
| 1870 | extern struct file *do_filp_open(int dfd, const char *pathname, | 1868 | extern struct file *do_filp_open(int dfd, const char *pathname, |
| 1871 | int open_flag, int mode); | 1869 | int open_flag, int mode); |
| 1872 | extern int may_open(struct nameidata *, int, int); | 1870 | extern int may_open(struct path *, int, int); |
| 1873 | 1871 | ||
| 1874 | extern int kernel_read(struct file *, unsigned long, char *, unsigned long); | 1872 | extern int kernel_read(struct file *, unsigned long, char *, unsigned long); |
| 1875 | extern struct file * open_exec(const char *); | 1873 | extern struct file * open_exec(const char *); |
| @@ -1904,6 +1902,8 @@ extern struct inode *ilookup(struct super_block *sb, unsigned long ino); | |||
| 1904 | 1902 | ||
| 1905 | extern struct inode * iget5_locked(struct super_block *, unsigned long, int (*test)(struct inode *, void *), int (*set)(struct inode *, void *), void *); | 1903 | extern struct inode * iget5_locked(struct super_block *, unsigned long, int (*test)(struct inode *, void *), int (*set)(struct inode *, void *), void *); |
| 1906 | extern struct inode * iget_locked(struct super_block *, unsigned long); | 1904 | extern struct inode * iget_locked(struct super_block *, unsigned long); |
| 1905 | extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *); | ||
| 1906 | extern int insert_inode_locked(struct inode *); | ||
| 1907 | extern void unlock_new_inode(struct inode *); | 1907 | extern void unlock_new_inode(struct inode *); |
| 1908 | 1908 | ||
| 1909 | extern void __iget(struct inode * inode); | 1909 | extern void __iget(struct inode * inode); |
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h index 9e5a06e78d02..a97c053d3a9a 100644 --- a/include/linux/fs_struct.h +++ b/include/linux/fs_struct.h | |||
| @@ -10,12 +10,6 @@ struct fs_struct { | |||
| 10 | struct path root, pwd; | 10 | struct path root, pwd; |
| 11 | }; | 11 | }; |
| 12 | 12 | ||
| 13 | #define INIT_FS { \ | ||
| 14 | .count = ATOMIC_INIT(1), \ | ||
| 15 | .lock = RW_LOCK_UNLOCKED, \ | ||
| 16 | .umask = 0022, \ | ||
| 17 | } | ||
| 18 | |||
| 19 | extern struct kmem_cache *fs_cachep; | 13 | extern struct kmem_cache *fs_cachep; |
| 20 | 14 | ||
| 21 | extern void exit_fs(struct task_struct *); | 15 | extern void exit_fs(struct task_struct *); |
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 959f5522d10a..2f3c2d4ef73b 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <net/net_namespace.h> | 12 | #include <net/net_namespace.h> |
| 13 | 13 | ||
| 14 | extern struct files_struct init_files; | 14 | extern struct files_struct init_files; |
| 15 | extern struct fs_struct init_fs; | ||
| 15 | 16 | ||
| 16 | #define INIT_KIOCTX(name, which_mm) \ | 17 | #define INIT_KIOCTX(name, which_mm) \ |
| 17 | { \ | 18 | { \ |
diff --git a/include/linux/namei.h b/include/linux/namei.h index 99eb80306dc5..fc2e03579877 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h | |||
| @@ -94,4 +94,9 @@ static inline char *nd_get_link(struct nameidata *nd) | |||
| 94 | return nd->saved_names[nd->depth]; | 94 | return nd->saved_names[nd->depth]; |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | static inline void nd_terminate_link(void *name, size_t len, size_t maxlen) | ||
| 98 | { | ||
| 99 | ((char *) name)[min(len, maxlen)] = '\0'; | ||
| 100 | } | ||
| 101 | |||
| 97 | #endif /* _LINUX_NAMEI_H */ | 102 | #endif /* _LINUX_NAMEI_H */ |
diff --git a/include/linux/security.h b/include/linux/security.h index 3416cb85e77b..b92b5e453f64 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
| @@ -335,17 +335,37 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 335 | * @dir contains the inode structure of the parent directory of the new link. | 335 | * @dir contains the inode structure of the parent directory of the new link. |
| 336 | * @new_dentry contains the dentry structure for the new link. | 336 | * @new_dentry contains the dentry structure for the new link. |
| 337 | * Return 0 if permission is granted. | 337 | * Return 0 if permission is granted. |
| 338 | * @path_link: | ||
| 339 | * Check permission before creating a new hard link to a file. | ||
| 340 | * @old_dentry contains the dentry structure for an existing link | ||
| 341 | * to the file. | ||
| 342 | * @new_dir contains the path structure of the parent directory of | ||
| 343 | * the new link. | ||
| 344 | * @new_dentry contains the dentry structure for the new link. | ||
| 345 | * Return 0 if permission is granted. | ||
| 338 | * @inode_unlink: | 346 | * @inode_unlink: |
| 339 | * Check the permission to remove a hard link to a file. | 347 | * Check the permission to remove a hard link to a file. |
| 340 | * @dir contains the inode structure of parent directory of the file. | 348 | * @dir contains the inode structure of parent directory of the file. |
| 341 | * @dentry contains the dentry structure for file to be unlinked. | 349 | * @dentry contains the dentry structure for file to be unlinked. |
| 342 | * Return 0 if permission is granted. | 350 | * Return 0 if permission is granted. |
| 351 | * @path_unlink: | ||
| 352 | * Check the permission to remove a hard link to a file. | ||
| 353 | * @dir contains the path structure of parent directory of the file. | ||
| 354 | * @dentry contains the dentry structure for file to be unlinked. | ||
| 355 | * Return 0 if permission is granted. | ||
| 343 | * @inode_symlink: | 356 | * @inode_symlink: |
| 344 | * Check the permission to create a symbolic link to a file. | 357 | * Check the permission to create a symbolic link to a file. |
| 345 | * @dir contains the inode structure of parent directory of the symbolic link. | 358 | * @dir contains the inode structure of parent directory of the symbolic link. |
| 346 | * @dentry contains the dentry structure of the symbolic link. | 359 | * @dentry contains the dentry structure of the symbolic link. |
| 347 | * @old_name contains the pathname of file. | 360 | * @old_name contains the pathname of file. |
| 348 | * Return 0 if permission is granted. | 361 | * Return 0 if permission is granted. |
| 362 | * @path_symlink: | ||
| 363 | * Check the permission to create a symbolic link to a file. | ||
| 364 | * @dir contains the path structure of parent directory of | ||
| 365 | * the symbolic link. | ||
| 366 | * @dentry contains the dentry structure of the symbolic link. | ||
| 367 | * @old_name contains the pathname of file. | ||
| 368 | * Return 0 if permission is granted. | ||
| 349 | * @inode_mkdir: | 369 | * @inode_mkdir: |
| 350 | * Check permissions to create a new directory in the existing directory | 370 | * Check permissions to create a new directory in the existing directory |
| 351 | * associated with inode strcture @dir. | 371 | * associated with inode strcture @dir. |
| @@ -353,11 +373,25 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 353 | * @dentry contains the dentry structure of new directory. | 373 | * @dentry contains the dentry structure of new directory. |
| 354 | * @mode contains the mode of new directory. | 374 | * @mode contains the mode of new directory. |
| 355 | * Return 0 if permission is granted. | 375 | * Return 0 if permission is granted. |
| 376 | * @path_mkdir: | ||
| 377 | * Check permissions to create a new directory in the existing directory | ||
| 378 | * associated with path strcture @path. | ||
| 379 | * @dir containst the path structure of parent of the directory | ||
| 380 | * to be created. | ||
| 381 | * @dentry contains the dentry structure of new directory. | ||
| 382 | * @mode contains the mode of new directory. | ||
| 383 | * Return 0 if permission is granted. | ||
| 356 | * @inode_rmdir: | 384 | * @inode_rmdir: |
| 357 | * Check the permission to remove a directory. | 385 | * Check the permission to remove a directory. |
| 358 | * @dir contains the inode structure of parent of the directory to be removed. | 386 | * @dir contains the inode structure of parent of the directory to be removed. |
| 359 | * @dentry contains the dentry structure of directory to be removed. | 387 | * @dentry contains the dentry structure of directory to be removed. |
| 360 | * Return 0 if permission is granted. | 388 | * Return 0 if permission is granted. |
| 389 | * @path_rmdir: | ||
| 390 | * Check the permission to remove a directory. | ||
| 391 | * @dir contains the path structure of parent of the directory to be | ||
| 392 | * removed. | ||
| 393 | * @dentry contains the dentry structure of directory to be removed. | ||
| 394 | * Return 0 if permission is granted. | ||
| 361 | * @inode_mknod: | 395 | * @inode_mknod: |
| 362 | * Check permissions when creating a special file (or a socket or a fifo | 396 | * Check permissions when creating a special file (or a socket or a fifo |
| 363 | * file created via the mknod system call). Note that if mknod operation | 397 | * file created via the mknod system call). Note that if mknod operation |
| @@ -368,6 +402,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 368 | * @mode contains the mode of the new file. | 402 | * @mode contains the mode of the new file. |
| 369 | * @dev contains the device number. | 403 | * @dev contains the device number. |
| 370 | * Return 0 if permission is granted. | 404 | * Return 0 if permission is granted. |
| 405 | * @path_mknod: | ||
| 406 | * Check permissions when creating a file. Note that this hook is called | ||
| 407 | * even if mknod operation is being done for a regular file. | ||
| 408 | * @dir contains the path structure of parent of the new file. | ||
| 409 | * @dentry contains the dentry structure of the new file. | ||
| 410 | * @mode contains the mode of the new file. | ||
| 411 | * @dev contains the undecoded device number. Use new_decode_dev() to get | ||
| 412 | * the decoded device number. | ||
| 413 | * Return 0 if permission is granted. | ||
| 371 | * @inode_rename: | 414 | * @inode_rename: |
| 372 | * Check for permission to rename a file or directory. | 415 | * Check for permission to rename a file or directory. |
| 373 | * @old_dir contains the inode structure for parent of the old link. | 416 | * @old_dir contains the inode structure for parent of the old link. |
| @@ -375,6 +418,13 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 375 | * @new_dir contains the inode structure for parent of the new link. | 418 | * @new_dir contains the inode structure for parent of the new link. |
| 376 | * @new_dentry contains the dentry structure of the new link. | 419 | * @new_dentry contains the dentry structure of the new link. |
| 377 | * Return 0 if permission is granted. | 420 | * Return 0 if permission is granted. |
| 421 | * @path_rename: | ||
| 422 | * Check for permission to rename a file or directory. | ||
| 423 | * @old_dir contains the path structure for parent of the old link. | ||
| 424 | * @old_dentry contains the dentry structure of the old link. | ||
| 425 | * @new_dir contains the path structure for parent of the new link. | ||
| 426 | * @new_dentry contains the dentry structure of the new link. | ||
| 427 | * Return 0 if permission is granted. | ||
| 378 | * @inode_readlink: | 428 | * @inode_readlink: |
| 379 | * Check the permission to read the symbolic link. | 429 | * Check the permission to read the symbolic link. |
| 380 | * @dentry contains the dentry structure for the file link. | 430 | * @dentry contains the dentry structure for the file link. |
| @@ -403,6 +453,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 403 | * @dentry contains the dentry structure for the file. | 453 | * @dentry contains the dentry structure for the file. |
| 404 | * @attr is the iattr structure containing the new file attributes. | 454 | * @attr is the iattr structure containing the new file attributes. |
| 405 | * Return 0 if permission is granted. | 455 | * Return 0 if permission is granted. |
| 456 | * @path_truncate: | ||
| 457 | * Check permission before truncating a file. | ||
| 458 | * @path contains the path structure for the file. | ||
| 459 | * @length is the new length of the file. | ||
| 460 | * @time_attrs is the flags passed to do_truncate(). | ||
| 461 | * Return 0 if permission is granted. | ||
| 406 | * @inode_getattr: | 462 | * @inode_getattr: |
| 407 | * Check permission before obtaining file attributes. | 463 | * Check permission before obtaining file attributes. |
| 408 | * @mnt is the vfsmount where the dentry was looked up | 464 | * @mnt is the vfsmount where the dentry was looked up |
| @@ -1331,6 +1387,22 @@ struct security_operations { | |||
| 1331 | struct super_block *newsb); | 1387 | struct super_block *newsb); |
| 1332 | int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); | 1388 | int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); |
| 1333 | 1389 | ||
| 1390 | #ifdef CONFIG_SECURITY_PATH | ||
| 1391 | int (*path_unlink) (struct path *dir, struct dentry *dentry); | ||
| 1392 | int (*path_mkdir) (struct path *dir, struct dentry *dentry, int mode); | ||
| 1393 | int (*path_rmdir) (struct path *dir, struct dentry *dentry); | ||
| 1394 | int (*path_mknod) (struct path *dir, struct dentry *dentry, int mode, | ||
| 1395 | unsigned int dev); | ||
| 1396 | int (*path_truncate) (struct path *path, loff_t length, | ||
| 1397 | unsigned int time_attrs); | ||
| 1398 | int (*path_symlink) (struct path *dir, struct dentry *dentry, | ||
| 1399 | const char *old_name); | ||
| 1400 | int (*path_link) (struct dentry *old_dentry, struct path *new_dir, | ||
| 1401 | struct dentry *new_dentry); | ||
| 1402 | int (*path_rename) (struct path *old_dir, struct dentry *old_dentry, | ||
| 1403 | struct path *new_dir, struct dentry *new_dentry); | ||
| 1404 | #endif | ||
| 1405 | |||
| 1334 | int (*inode_alloc_security) (struct inode *inode); | 1406 | int (*inode_alloc_security) (struct inode *inode); |
| 1335 | void (*inode_free_security) (struct inode *inode); | 1407 | void (*inode_free_security) (struct inode *inode); |
| 1336 | int (*inode_init_security) (struct inode *inode, struct inode *dir, | 1408 | int (*inode_init_security) (struct inode *inode, struct inode *dir, |
| @@ -2705,6 +2777,71 @@ static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi | |||
| 2705 | 2777 | ||
| 2706 | #endif /* CONFIG_SECURITY_NETWORK_XFRM */ | 2778 | #endif /* CONFIG_SECURITY_NETWORK_XFRM */ |
| 2707 | 2779 | ||
| 2780 | #ifdef CONFIG_SECURITY_PATH | ||
| 2781 | int security_path_unlink(struct path *dir, struct dentry *dentry); | ||
| 2782 | int security_path_mkdir(struct path *dir, struct dentry *dentry, int mode); | ||
| 2783 | int security_path_rmdir(struct path *dir, struct dentry *dentry); | ||
| 2784 | int security_path_mknod(struct path *dir, struct dentry *dentry, int mode, | ||
| 2785 | unsigned int dev); | ||
| 2786 | int security_path_truncate(struct path *path, loff_t length, | ||
| 2787 | unsigned int time_attrs); | ||
| 2788 | int security_path_symlink(struct path *dir, struct dentry *dentry, | ||
| 2789 | const char *old_name); | ||
| 2790 | int security_path_link(struct dentry *old_dentry, struct path *new_dir, | ||
| 2791 | struct dentry *new_dentry); | ||
| 2792 | int security_path_rename(struct path *old_dir, struct dentry *old_dentry, | ||
| 2793 | struct path *new_dir, struct dentry *new_dentry); | ||
| 2794 | #else /* CONFIG_SECURITY_PATH */ | ||
| 2795 | static inline int security_path_unlink(struct path *dir, struct dentry *dentry) | ||
| 2796 | { | ||
| 2797 | return 0; | ||
| 2798 | } | ||
| 2799 | |||
| 2800 | static inline int security_path_mkdir(struct path *dir, struct dentry *dentry, | ||
| 2801 | int mode) | ||
| 2802 | { | ||
| 2803 | return 0; | ||
| 2804 | } | ||
| 2805 | |||
| 2806 | static inline int security_path_rmdir(struct path *dir, struct dentry *dentry) | ||
| 2807 | { | ||
| 2808 | return 0; | ||
| 2809 | } | ||
| 2810 | |||
| 2811 | static inline int security_path_mknod(struct path *dir, struct dentry *dentry, | ||
| 2812 | int mode, unsigned int dev) | ||
| 2813 | { | ||
| 2814 | return 0; | ||
| 2815 | } | ||
| 2816 | |||
| 2817 | static inline int security_path_truncate(struct path *path, loff_t length, | ||
| 2818 | unsigned int time_attrs) | ||
| 2819 | { | ||
| 2820 | return 0; | ||
| 2821 | } | ||
| 2822 | |||
| 2823 | static inline int security_path_symlink(struct path *dir, struct dentry *dentry, | ||
| 2824 | const char *old_name) | ||
| 2825 | { | ||
| 2826 | return 0; | ||
| 2827 | } | ||
| 2828 | |||
| 2829 | static inline int security_path_link(struct dentry *old_dentry, | ||
| 2830 | struct path *new_dir, | ||
| 2831 | struct dentry *new_dentry) | ||
| 2832 | { | ||
| 2833 | return 0; | ||
| 2834 | } | ||
| 2835 | |||
| 2836 | static inline int security_path_rename(struct path *old_dir, | ||
| 2837 | struct dentry *old_dentry, | ||
| 2838 | struct path *new_dir, | ||
| 2839 | struct dentry *new_dentry) | ||
| 2840 | { | ||
| 2841 | return 0; | ||
| 2842 | } | ||
| 2843 | #endif /* CONFIG_SECURITY_PATH */ | ||
| 2844 | |||
| 2708 | #ifdef CONFIG_KEYS | 2845 | #ifdef CONFIG_KEYS |
| 2709 | #ifdef CONFIG_SECURITY | 2846 | #ifdef CONFIG_SECURITY |
| 2710 | 2847 | ||
