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.h57
1 files changed, 26 insertions, 31 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 024049543ae1..5b248d61430c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -63,18 +63,23 @@ extern int dir_notify_enable;
63#define MAY_ACCESS 16 63#define MAY_ACCESS 16
64#define MAY_OPEN 32 64#define MAY_OPEN 32
65 65
66#define FMODE_READ 1 66#define FMODE_READ ((__force fmode_t)1)
67#define FMODE_WRITE 2 67#define FMODE_WRITE ((__force fmode_t)2)
68 68
69/* Internal kernel extensions */ 69/* Internal kernel extensions */
70#define FMODE_LSEEK 4 70#define FMODE_LSEEK ((__force fmode_t)4)
71#define FMODE_PREAD 8 71#define FMODE_PREAD ((__force fmode_t)8)
72#define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */ 72#define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */
73 73
74/* File is being opened for execution. Primary users of this flag are 74/* File is being opened for execution. Primary users of this flag are
75 distributed filesystems that can use it to achieve correct ETXTBUSY 75 distributed filesystems that can use it to achieve correct ETXTBUSY
76 behavior for cross-node execution/opening_for_writing of files */ 76 behavior for cross-node execution/opening_for_writing of files */
77#define FMODE_EXEC 16 77#define FMODE_EXEC ((__force fmode_t)16)
78
79#define FMODE_NDELAY ((__force fmode_t)32)
80#define FMODE_EXCL ((__force fmode_t)64)
81#define FMODE_WRITE_IOCTL ((__force fmode_t)128)
82#define FMODE_NDELAY_NOW ((__force fmode_t)256)
78 83
79#define RW_MASK 1 84#define RW_MASK 1
80#define RWA_MASK 2 85#define RWA_MASK 2
@@ -136,7 +141,7 @@ extern int dir_notify_enable;
136/* 141/*
137 * Superblock flags that can be altered by MS_REMOUNT 142 * Superblock flags that can be altered by MS_REMOUNT
138 */ 143 */
139#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK) 144#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION)
140 145
141/* 146/*
142 * Old magic mount flag and mask 147 * Old magic mount flag and mask
@@ -825,7 +830,7 @@ struct file {
825 const struct file_operations *f_op; 830 const struct file_operations *f_op;
826 atomic_long_t f_count; 831 atomic_long_t f_count;
827 unsigned int f_flags; 832 unsigned int f_flags;
828 mode_t f_mode; 833 fmode_t f_mode;
829 loff_t f_pos; 834 loff_t f_pos;
830 struct fown_struct f_owner; 835 struct fown_struct f_owner;
831 unsigned int f_uid, f_gid; 836 unsigned int f_uid, f_gid;
@@ -1151,6 +1156,7 @@ struct super_block {
1151 char s_id[32]; /* Informational name */ 1156 char s_id[32]; /* Informational name */
1152 1157
1153 void *s_fs_info; /* Filesystem private info */ 1158 void *s_fs_info; /* Filesystem private info */
1159 fmode_t s_mode;
1154 1160
1155 /* 1161 /*
1156 * The next field is for VFS *only*. No filesystems have any business 1162 * The next field is for VFS *only*. No filesystems have any business
@@ -1265,20 +1271,7 @@ int generic_osync_inode(struct inode *, struct address_space *, int);
1265 * to have different dirent layouts depending on the binary type. 1271 * to have different dirent layouts depending on the binary type.
1266 */ 1272 */
1267typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned); 1273typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned);
1268 1274struct block_device_operations;
1269struct block_device_operations {
1270 int (*open) (struct inode *, struct file *);
1271 int (*release) (struct inode *, struct file *);
1272 int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long);
1273 long (*unlocked_ioctl) (struct file *, unsigned, unsigned long);
1274 long (*compat_ioctl) (struct file *, unsigned, unsigned long);
1275 int (*direct_access) (struct block_device *, sector_t,
1276 void **, unsigned long *);
1277 int (*media_changed) (struct gendisk *);
1278 int (*revalidate_disk) (struct gendisk *);
1279 int (*getgeo)(struct block_device *, struct hd_geometry *);
1280 struct module *owner;
1281};
1282 1275
1283/* These macros are for out of kernel modules to test that 1276/* These macros are for out of kernel modules to test that
1284 * the kernel supports the unlocked_ioctl and compat_ioctl 1277 * the kernel supports the unlocked_ioctl and compat_ioctl
@@ -1592,7 +1585,6 @@ extern int get_sb_pseudo(struct file_system_type *, char *,
1592 struct vfsmount *mnt); 1585 struct vfsmount *mnt);
1593extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); 1586extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
1594int __put_super_and_need_restart(struct super_block *sb); 1587int __put_super_and_need_restart(struct super_block *sb);
1595void unnamed_dev_init(void);
1596 1588
1597/* Alas, no aliases. Too much hassle with bringing module.h everywhere */ 1589/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
1598#define fops_get(fops) \ 1590#define fops_get(fops) \
@@ -1713,7 +1705,7 @@ extern struct block_device *bdget(dev_t);
1713extern void bd_set_size(struct block_device *, loff_t size); 1705extern void bd_set_size(struct block_device *, loff_t size);
1714extern void bd_forget(struct inode *inode); 1706extern void bd_forget(struct inode *inode);
1715extern void bdput(struct block_device *); 1707extern void bdput(struct block_device *);
1716extern struct block_device *open_by_devnum(dev_t, unsigned); 1708extern struct block_device *open_by_devnum(dev_t, fmode_t);
1717#else 1709#else
1718static inline void bd_forget(struct inode *inode) {} 1710static inline void bd_forget(struct inode *inode) {}
1719#endif 1711#endif
@@ -1723,13 +1715,10 @@ extern const struct file_operations bad_sock_fops;
1723extern const struct file_operations def_fifo_fops; 1715extern const struct file_operations def_fifo_fops;
1724#ifdef CONFIG_BLOCK 1716#ifdef CONFIG_BLOCK
1725extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); 1717extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
1726extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long); 1718extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long);
1727extern int blkdev_driver_ioctl(struct inode *inode, struct file *file,
1728 struct gendisk *disk, unsigned cmd,
1729 unsigned long arg);
1730extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); 1719extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
1731extern int blkdev_get(struct block_device *, mode_t, unsigned); 1720extern int blkdev_get(struct block_device *, fmode_t);
1732extern int blkdev_put(struct block_device *); 1721extern int blkdev_put(struct block_device *, fmode_t);
1733extern int bd_claim(struct block_device *, void *); 1722extern int bd_claim(struct block_device *, void *);
1734extern void bd_release(struct block_device *); 1723extern void bd_release(struct block_device *);
1735#ifdef CONFIG_SYSFS 1724#ifdef CONFIG_SYSFS
@@ -1760,9 +1749,10 @@ extern void chrdev_show(struct seq_file *,off_t);
1760extern const char *__bdevname(dev_t, char *buffer); 1749extern const char *__bdevname(dev_t, char *buffer);
1761extern const char *bdevname(struct block_device *bdev, char *buffer); 1750extern const char *bdevname(struct block_device *bdev, char *buffer);
1762extern struct block_device *lookup_bdev(const char *); 1751extern struct block_device *lookup_bdev(const char *);
1763extern struct block_device *open_bdev_excl(const char *, int, void *); 1752extern struct block_device *open_bdev_exclusive(const char *, fmode_t, void *);
1764extern void close_bdev_excl(struct block_device *); 1753extern void close_bdev_exclusive(struct block_device *, fmode_t);
1765extern void blkdev_show(struct seq_file *,off_t); 1754extern void blkdev_show(struct seq_file *,off_t);
1755
1766#else 1756#else
1767#define BLKDEV_MAJOR_HASH_SIZE 0 1757#define BLKDEV_MAJOR_HASH_SIZE 0
1768#endif 1758#endif
@@ -1851,6 +1841,11 @@ extern int inode_permission(struct inode *, int);
1851extern int generic_permission(struct inode *, int, 1841extern int generic_permission(struct inode *, int,
1852 int (*check_acl)(struct inode *, int)); 1842 int (*check_acl)(struct inode *, int));
1853 1843
1844static inline bool execute_ok(struct inode *inode)
1845{
1846 return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode);
1847}
1848
1854extern int get_write_access(struct inode *); 1849extern int get_write_access(struct inode *);
1855extern int deny_write_access(struct file *); 1850extern int deny_write_access(struct file *);
1856static inline void put_write_access(struct inode * inode) 1851static inline void put_write_access(struct inode * inode)