aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h38
1 files changed, 29 insertions, 9 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index cdf9495df204..b5b979247863 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -23,7 +23,8 @@
23 23
24/* Fixed constants first: */ 24/* Fixed constants first: */
25#undef NR_OPEN 25#undef NR_OPEN
26#define INR_OPEN 1024 /* Initial setting for nfile rlimits */ 26#define INR_OPEN_CUR 1024 /* Initial setting for nfile rlimits */
27#define INR_OPEN_MAX 4096 /* Hard limit for nfile rlimits */
27 28
28#define BLOCK_SIZE_BITS 10 29#define BLOCK_SIZE_BITS 10
29#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS) 30#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
@@ -207,6 +208,7 @@ struct inodes_stat_t {
207#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ 208#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
208#define MS_I_VERSION (1<<23) /* Update inode I_version field */ 209#define MS_I_VERSION (1<<23) /* Update inode I_version field */
209#define MS_STRICTATIME (1<<24) /* Always perform atime updates */ 210#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
211#define MS_NOSEC (1<<28)
210#define MS_BORN (1<<29) 212#define MS_BORN (1<<29)
211#define MS_ACTIVE (1<<30) 213#define MS_ACTIVE (1<<30)
212#define MS_NOUSER (1<<31) 214#define MS_NOUSER (1<<31)
@@ -236,6 +238,7 @@ struct inodes_stat_t {
236#define S_PRIVATE 512 /* Inode is fs-internal */ 238#define S_PRIVATE 512 /* Inode is fs-internal */
237#define S_IMA 1024 /* Inode has an associated IMA struct */ 239#define S_IMA 1024 /* Inode has an associated IMA struct */
238#define S_AUTOMOUNT 2048 /* Automount/referral quasi-directory */ 240#define S_AUTOMOUNT 2048 /* Automount/referral quasi-directory */
241#define S_NOSEC 4096 /* no suid or xattr security attributes */
239 242
240/* 243/*
241 * Note that nosuid etc flags are inode-specific: setting some file-system 244 * Note that nosuid etc flags are inode-specific: setting some file-system
@@ -272,6 +275,7 @@ struct inodes_stat_t {
272#define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE) 275#define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE)
273#define IS_IMA(inode) ((inode)->i_flags & S_IMA) 276#define IS_IMA(inode) ((inode)->i_flags & S_IMA)
274#define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT) 277#define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT)
278#define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC)
275 279
276/* the read-only stuff doesn't really belong here, but any other place is 280/* the read-only stuff doesn't really belong here, but any other place is
277 probably as bad and I don't want to create yet another include file. */ 281 probably as bad and I don't want to create yet another include file. */
@@ -634,8 +638,8 @@ struct address_space {
634 unsigned int i_mmap_writable;/* count VM_SHARED mappings */ 638 unsigned int i_mmap_writable;/* count VM_SHARED mappings */
635 struct prio_tree_root i_mmap; /* tree of private and shared mappings */ 639 struct prio_tree_root i_mmap; /* tree of private and shared mappings */
636 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ 640 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
637 spinlock_t i_mmap_lock; /* protect tree, count, list */ 641 struct mutex i_mmap_mutex; /* protect tree, count, list */
638 unsigned int truncate_count; /* Cover race condition with truncate */ 642 /* Protected by tree_lock together with the radix tree */
639 unsigned long nrpages; /* number of total pages */ 643 unsigned long nrpages; /* number of total pages */
640 pgoff_t writeback_index;/* writeback starts here */ 644 pgoff_t writeback_index;/* writeback starts here */
641 const struct address_space_operations *a_ops; /* methods */ 645 const struct address_space_operations *a_ops; /* methods */
@@ -644,7 +648,6 @@ struct address_space {
644 spinlock_t private_lock; /* for use by the address_space */ 648 spinlock_t private_lock; /* for use by the address_space */
645 struct list_head private_list; /* ditto */ 649 struct list_head private_list; /* ditto */
646 struct address_space *assoc_mapping; /* ditto */ 650 struct address_space *assoc_mapping; /* ditto */
647 struct mutex unmap_mutex; /* to protect unmapping */
648} __attribute__((aligned(sizeof(long)))); 651} __attribute__((aligned(sizeof(long))));
649 /* 652 /*
650 * On most architectures that alignment is already the case; but 653 * On most architectures that alignment is already the case; but
@@ -742,9 +745,13 @@ struct inode {
742 745
743 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ 746 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
744 unsigned int i_flags; 747 unsigned int i_flags;
748 unsigned long i_state;
749#ifdef CONFIG_SECURITY
750 void *i_security;
751#endif
745 struct mutex i_mutex; 752 struct mutex i_mutex;
746 753
747 unsigned long i_state; 754
748 unsigned long dirtied_when; /* jiffies of first dirtying */ 755 unsigned long dirtied_when; /* jiffies of first dirtying */
749 756
750 struct hlist_node i_hash; 757 struct hlist_node i_hash;
@@ -796,9 +803,6 @@ struct inode {
796 atomic_t i_readcount; /* struct files open RO */ 803 atomic_t i_readcount; /* struct files open RO */
797#endif 804#endif
798 atomic_t i_writecount; 805 atomic_t i_writecount;
799#ifdef CONFIG_SECURITY
800 void *i_security;
801#endif
802#ifdef CONFIG_FS_POSIX_ACL 806#ifdef CONFIG_FS_POSIX_ACL
803 struct posix_acl *i_acl; 807 struct posix_acl *i_acl;
804 struct posix_acl *i_default_acl; 808 struct posix_acl *i_default_acl;
@@ -1429,6 +1433,11 @@ struct super_block {
1429 */ 1433 */
1430 char __rcu *s_options; 1434 char __rcu *s_options;
1431 const struct dentry_operations *s_d_op; /* default d_op for dentries */ 1435 const struct dentry_operations *s_d_op; /* default d_op for dentries */
1436
1437 /*
1438 * Saved pool identifier for cleancache (-1 means none)
1439 */
1440 int cleancache_poolid;
1432}; 1441};
1433 1442
1434extern struct timespec current_fs_time(struct super_block *sb); 1443extern struct timespec current_fs_time(struct super_block *sb);
@@ -1614,7 +1623,7 @@ struct super_operations {
1614 struct inode *(*alloc_inode)(struct super_block *sb); 1623 struct inode *(*alloc_inode)(struct super_block *sb);
1615 void (*destroy_inode)(struct inode *); 1624 void (*destroy_inode)(struct inode *);
1616 1625
1617 void (*dirty_inode) (struct inode *); 1626 void (*dirty_inode) (struct inode *, int flags);
1618 int (*write_inode) (struct inode *, struct writeback_control *wbc); 1627 int (*write_inode) (struct inode *, struct writeback_control *wbc);
1619 int (*drop_inode) (struct inode *); 1628 int (*drop_inode) (struct inode *);
1620 void (*evict_inode) (struct inode *); 1629 void (*evict_inode) (struct inode *);
@@ -2578,5 +2587,16 @@ int __init get_filesystem_list(char *buf);
2578#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \ 2587#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \
2579 (flag & __FMODE_NONOTIFY))) 2588 (flag & __FMODE_NONOTIFY)))
2580 2589
2590static inline int is_sxid(mode_t mode)
2591{
2592 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP));
2593}
2594
2595static inline void inode_has_no_xattr(struct inode *inode)
2596{
2597 if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC))
2598 inode->i_flags |= S_NOSEC;
2599}
2600
2581#endif /* __KERNEL__ */ 2601#endif /* __KERNEL__ */
2582#endif /* _LINUX_FS_H */ 2602#endif /* _LINUX_FS_H */