diff options
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 57 |
1 files changed, 39 insertions, 18 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 8de675523e46..038076b27ea4 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -402,6 +402,7 @@ struct inodes_stat_t { | |||
402 | #include <linux/atomic.h> | 402 | #include <linux/atomic.h> |
403 | #include <linux/shrinker.h> | 403 | #include <linux/shrinker.h> |
404 | #include <linux/migrate_mode.h> | 404 | #include <linux/migrate_mode.h> |
405 | #include <linux/uidgid.h> | ||
405 | 406 | ||
406 | #include <asm/byteorder.h> | 407 | #include <asm/byteorder.h> |
407 | 408 | ||
@@ -469,8 +470,8 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, | |||
469 | struct iattr { | 470 | struct iattr { |
470 | unsigned int ia_valid; | 471 | unsigned int ia_valid; |
471 | umode_t ia_mode; | 472 | umode_t ia_mode; |
472 | uid_t ia_uid; | 473 | kuid_t ia_uid; |
473 | gid_t ia_gid; | 474 | kgid_t ia_gid; |
474 | loff_t ia_size; | 475 | loff_t ia_size; |
475 | struct timespec ia_atime; | 476 | struct timespec ia_atime; |
476 | struct timespec ia_mtime; | 477 | struct timespec ia_mtime; |
@@ -761,8 +762,8 @@ struct posix_acl; | |||
761 | struct inode { | 762 | struct inode { |
762 | umode_t i_mode; | 763 | umode_t i_mode; |
763 | unsigned short i_opflags; | 764 | unsigned short i_opflags; |
764 | uid_t i_uid; | 765 | kuid_t i_uid; |
765 | gid_t i_gid; | 766 | kgid_t i_gid; |
766 | unsigned int i_flags; | 767 | unsigned int i_flags; |
767 | 768 | ||
768 | #ifdef CONFIG_FS_POSIX_ACL | 769 | #ifdef CONFIG_FS_POSIX_ACL |
@@ -927,6 +928,31 @@ static inline void i_size_write(struct inode *inode, loff_t i_size) | |||
927 | #endif | 928 | #endif |
928 | } | 929 | } |
929 | 930 | ||
931 | /* Helper functions so that in most cases filesystems will | ||
932 | * not need to deal directly with kuid_t and kgid_t and can | ||
933 | * instead deal with the raw numeric values that are stored | ||
934 | * in the filesystem. | ||
935 | */ | ||
936 | static inline uid_t i_uid_read(const struct inode *inode) | ||
937 | { | ||
938 | return from_kuid(&init_user_ns, inode->i_uid); | ||
939 | } | ||
940 | |||
941 | static inline gid_t i_gid_read(const struct inode *inode) | ||
942 | { | ||
943 | return from_kgid(&init_user_ns, inode->i_gid); | ||
944 | } | ||
945 | |||
946 | static inline void i_uid_write(struct inode *inode, uid_t uid) | ||
947 | { | ||
948 | inode->i_uid = make_kuid(&init_user_ns, uid); | ||
949 | } | ||
950 | |||
951 | static inline void i_gid_write(struct inode *inode, gid_t gid) | ||
952 | { | ||
953 | inode->i_gid = make_kgid(&init_user_ns, gid); | ||
954 | } | ||
955 | |||
930 | static inline unsigned iminor(const struct inode *inode) | 956 | static inline unsigned iminor(const struct inode *inode) |
931 | { | 957 | { |
932 | return MINOR(inode->i_rdev); | 958 | return MINOR(inode->i_rdev); |
@@ -943,7 +969,7 @@ struct fown_struct { | |||
943 | rwlock_t lock; /* protects pid, uid, euid fields */ | 969 | rwlock_t lock; /* protects pid, uid, euid fields */ |
944 | struct pid *pid; /* pid or -pgrp where SIGIO should be sent */ | 970 | struct pid *pid; /* pid or -pgrp where SIGIO should be sent */ |
945 | enum pid_type pid_type; /* Kind of process group SIGIO should be sent to */ | 971 | enum pid_type pid_type; /* Kind of process group SIGIO should be sent to */ |
946 | uid_t uid, euid; /* uid/euid of process setting the owner */ | 972 | kuid_t uid, euid; /* uid/euid of process setting the owner */ |
947 | int signum; /* posix.1b rt signal to be delivered on IO */ | 973 | int signum; /* posix.1b rt signal to be delivered on IO */ |
948 | }; | 974 | }; |
949 | 975 | ||
@@ -1527,12 +1553,6 @@ enum { | |||
1527 | #define vfs_check_frozen(sb, level) \ | 1553 | #define vfs_check_frozen(sb, level) \ |
1528 | wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level))) | 1554 | wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level))) |
1529 | 1555 | ||
1530 | /* | ||
1531 | * until VFS tracks user namespaces for inodes, just make all files | ||
1532 | * belong to init_user_ns | ||
1533 | */ | ||
1534 | extern struct user_namespace init_user_ns; | ||
1535 | #define inode_userns(inode) (&init_user_ns) | ||
1536 | extern bool inode_owner_or_capable(const struct inode *inode); | 1556 | extern bool inode_owner_or_capable(const struct inode *inode); |
1537 | 1557 | ||
1538 | /* not quite ready to be deprecated, but... */ | 1558 | /* not quite ready to be deprecated, but... */ |
@@ -1661,7 +1681,6 @@ struct inode_operations { | |||
1661 | ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); | 1681 | ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); |
1662 | ssize_t (*listxattr) (struct dentry *, char *, size_t); | 1682 | ssize_t (*listxattr) (struct dentry *, char *, size_t); |
1663 | int (*removexattr) (struct dentry *, const char *); | 1683 | int (*removexattr) (struct dentry *, const char *); |
1664 | void (*truncate_range)(struct inode *, loff_t, loff_t); | ||
1665 | int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, | 1684 | int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, |
1666 | u64 len); | 1685 | u64 len); |
1667 | } ____cacheline_aligned; | 1686 | } ____cacheline_aligned; |
@@ -1744,8 +1763,8 @@ struct super_operations { | |||
1744 | * I_FREEING Set when inode is about to be freed but still has dirty | 1763 | * I_FREEING Set when inode is about to be freed but still has dirty |
1745 | * pages or buffers attached or the inode itself is still | 1764 | * pages or buffers attached or the inode itself is still |
1746 | * dirty. | 1765 | * dirty. |
1747 | * I_CLEAR Added by end_writeback(). In this state the inode is clean | 1766 | * I_CLEAR Added by clear_inode(). In this state the inode is |
1748 | * and can be destroyed. Inode keeps I_FREEING. | 1767 | * clean and can be destroyed. Inode keeps I_FREEING. |
1749 | * | 1768 | * |
1750 | * Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are | 1769 | * Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are |
1751 | * prohibited for many purposes. iget() must wait for | 1770 | * prohibited for many purposes. iget() must wait for |
@@ -1753,9 +1772,10 @@ struct super_operations { | |||
1753 | * anew. Other functions will just ignore such inodes, | 1772 | * anew. Other functions will just ignore such inodes, |
1754 | * if appropriate. I_NEW is used for waiting. | 1773 | * if appropriate. I_NEW is used for waiting. |
1755 | * | 1774 | * |
1756 | * I_SYNC Synchonized write of dirty inode data. The bits is | 1775 | * I_SYNC Writeback of inode is running. The bit is set during |
1757 | * set during data writeback, and cleared with a wakeup | 1776 | * data writeback, and cleared with a wakeup on the bit |
1758 | * on the bit address once it is done. | 1777 | * address once it is done. The bit is also used to pin |
1778 | * the inode in memory for flusher thread. | ||
1759 | * | 1779 | * |
1760 | * I_REFERENCED Marks the inode as recently references on the LRU list. | 1780 | * I_REFERENCED Marks the inode as recently references on the LRU list. |
1761 | * | 1781 | * |
@@ -2051,6 +2071,7 @@ extern void unregister_blkdev(unsigned int, const char *); | |||
2051 | extern struct block_device *bdget(dev_t); | 2071 | extern struct block_device *bdget(dev_t); |
2052 | extern struct block_device *bdgrab(struct block_device *bdev); | 2072 | extern struct block_device *bdgrab(struct block_device *bdev); |
2053 | extern void bd_set_size(struct block_device *, loff_t size); | 2073 | extern void bd_set_size(struct block_device *, loff_t size); |
2074 | extern sector_t blkdev_max_block(struct block_device *bdev); | ||
2054 | extern void bd_forget(struct inode *inode); | 2075 | extern void bd_forget(struct inode *inode); |
2055 | extern void bdput(struct block_device *); | 2076 | extern void bdput(struct block_device *); |
2056 | extern void invalidate_bdev(struct block_device *); | 2077 | extern void invalidate_bdev(struct block_device *); |
@@ -2328,7 +2349,7 @@ extern unsigned int get_next_ino(void); | |||
2328 | 2349 | ||
2329 | extern void __iget(struct inode * inode); | 2350 | extern void __iget(struct inode * inode); |
2330 | extern void iget_failed(struct inode *); | 2351 | extern void iget_failed(struct inode *); |
2331 | extern void end_writeback(struct inode *); | 2352 | extern void clear_inode(struct inode *); |
2332 | extern void __destroy_inode(struct inode *); | 2353 | extern void __destroy_inode(struct inode *); |
2333 | extern struct inode *new_inode_pseudo(struct super_block *sb); | 2354 | extern struct inode *new_inode_pseudo(struct super_block *sb); |
2334 | extern struct inode *new_inode(struct super_block *sb); | 2355 | extern struct inode *new_inode(struct super_block *sb); |