aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 13:23:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 13:23:07 -0400
commit22484856402bfa1ff3defe47f6029ab0418240d9 (patch)
tree140c67bf59674da350a7b51765d6ff7eb101b597 /include
parent5ed487bc2c44ca4e9668ef9cb54c830e2a9fac47 (diff)
parent56b26add02b4bdea81d5e0ebda60db1fe3311ad4 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/viro/bdev
* git://git.kernel.org/pub/scm/linux/kernel/git/viro/bdev: (66 commits) [PATCH] kill the rest of struct file propagation in block ioctls [PATCH] get rid of struct file use in blkdev_ioctl() BLKBSZSET [PATCH] get rid of blkdev_locked_ioctl() [PATCH] get rid of blkdev_driver_ioctl() [PATCH] sanitize blkdev_get() and friends [PATCH] remember mode of reiserfs journal [PATCH] propagate mode through swsusp_close() [PATCH] propagate mode through open_bdev_excl/close_bdev_excl [PATCH] pass fmode_t to blkdev_put() [PATCH] kill the unused bsize on the send side of /dev/loop [PATCH] trim file propagation in block/compat_ioctl.c [PATCH] end of methods switch: remove the old ones [PATCH] switch sr [PATCH] switch sd [PATCH] switch ide-scsi [PATCH] switch tape_block [PATCH] switch dcssblk [PATCH] switch dasd [PATCH] switch mtd_blkdevs [PATCH] switch mmc ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/blkdev.h27
-rw-r--r--include/linux/cdrom.h10
-rw-r--r--include/linux/device-mapper.h11
-rw-r--r--include/linux/file.h4
-rw-r--r--include/linux/fs.h49
-rw-r--r--include/linux/fsnotify.h2
-rw-r--r--include/linux/ide.h7
-rw-r--r--include/linux/reiserfs_fs_sb.h1
-rw-r--r--include/linux/types.h1
-rw-r--r--include/scsi/scsi_ioctl.h2
10 files changed, 61 insertions, 53 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index b4fe68fe3a57..a135256b272c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -717,10 +717,10 @@ extern void blk_plug_device(struct request_queue *);
717extern void blk_plug_device_unlocked(struct request_queue *); 717extern void blk_plug_device_unlocked(struct request_queue *);
718extern int blk_remove_plug(struct request_queue *); 718extern int blk_remove_plug(struct request_queue *);
719extern void blk_recount_segments(struct request_queue *, struct bio *); 719extern void blk_recount_segments(struct request_queue *, struct bio *);
720extern int scsi_cmd_ioctl(struct file *, struct request_queue *, 720extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t,
721 struct gendisk *, unsigned int, void __user *); 721 unsigned int, void __user *);
722extern int sg_scsi_ioctl(struct file *, struct request_queue *, 722extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,
723 struct gendisk *, struct scsi_ioctl_command __user *); 723 struct scsi_ioctl_command __user *);
724 724
725/* 725/*
726 * Temporary export, until SCSI gets fixed up. 726 * Temporary export, until SCSI gets fixed up.
@@ -910,7 +910,8 @@ static inline int sb_issue_discard(struct super_block *sb,
910* command filter functions 910* command filter functions
911*/ 911*/
912extern int blk_verify_command(struct blk_cmd_filter *filter, 912extern int blk_verify_command(struct blk_cmd_filter *filter,
913 unsigned char *cmd, int has_write_perm); 913 unsigned char *cmd, fmode_t has_write_perm);
914extern void blk_unregister_filter(struct gendisk *disk);
914extern void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter); 915extern void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter);
915 916
916#define MAX_PHYS_SEGMENTS 128 917#define MAX_PHYS_SEGMENTS 128
@@ -1056,6 +1057,22 @@ static inline int blk_integrity_rq(struct request *rq)
1056 1057
1057#endif /* CONFIG_BLK_DEV_INTEGRITY */ 1058#endif /* CONFIG_BLK_DEV_INTEGRITY */
1058 1059
1060struct block_device_operations {
1061 int (*open) (struct block_device *, fmode_t);
1062 int (*release) (struct gendisk *, fmode_t);
1063 int (*locked_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1064 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1065 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1066 int (*direct_access) (struct block_device *, sector_t,
1067 void **, unsigned long *);
1068 int (*media_changed) (struct gendisk *);
1069 int (*revalidate_disk) (struct gendisk *);
1070 int (*getgeo)(struct block_device *, struct hd_geometry *);
1071 struct module *owner;
1072};
1073
1074extern int __blkdev_driver_ioctl(struct block_device *, fmode_t, unsigned int,
1075 unsigned long);
1059#else /* CONFIG_BLOCK */ 1076#else /* CONFIG_BLOCK */
1060/* 1077/*
1061 * stubs for when the block layer is configured out 1078 * stubs for when the block layer is configured out
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index 5db265ea60f6..0b49e08d3cb0 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -987,11 +987,11 @@ struct cdrom_device_ops {
987}; 987};
988 988
989/* the general block_device operations structure: */ 989/* the general block_device operations structure: */
990extern int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip, 990extern int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev,
991 struct file *fp); 991 fmode_t mode);
992extern int cdrom_release(struct cdrom_device_info *cdi, struct file *fp); 992extern void cdrom_release(struct cdrom_device_info *cdi, fmode_t mode);
993extern int cdrom_ioctl(struct file *file, struct cdrom_device_info *cdi, 993extern int cdrom_ioctl(struct cdrom_device_info *cdi, struct block_device *bdev,
994 struct inode *ip, unsigned int cmd, unsigned long arg); 994 fmode_t mode, unsigned int cmd, unsigned long arg);
995extern int cdrom_media_changed(struct cdrom_device_info *); 995extern int cdrom_media_changed(struct cdrom_device_info *);
996 996
997extern int register_cdrom(struct cdrom_device_info *cdi); 997extern int register_cdrom(struct cdrom_device_info *cdi);
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index dfb30db475ed..c17fd334e574 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -69,8 +69,7 @@ typedef int (*dm_status_fn) (struct dm_target *ti, status_type_t status_type,
69 69
70typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv); 70typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv);
71 71
72typedef int (*dm_ioctl_fn) (struct dm_target *ti, struct inode *inode, 72typedef int (*dm_ioctl_fn) (struct dm_target *ti, unsigned int cmd,
73 struct file *filp, unsigned int cmd,
74 unsigned long arg); 73 unsigned long arg);
75 74
76typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm, 75typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm,
@@ -85,7 +84,7 @@ void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev);
85 84
86struct dm_dev { 85struct dm_dev {
87 struct block_device *bdev; 86 struct block_device *bdev;
88 int mode; 87 fmode_t mode;
89 char name[16]; 88 char name[16];
90}; 89};
91 90
@@ -95,7 +94,7 @@ struct dm_dev {
95 * FIXME: too many arguments. 94 * FIXME: too many arguments.
96 */ 95 */
97int dm_get_device(struct dm_target *ti, const char *path, sector_t start, 96int dm_get_device(struct dm_target *ti, const char *path, sector_t start,
98 sector_t len, int mode, struct dm_dev **result); 97 sector_t len, fmode_t mode, struct dm_dev **result);
99void dm_put_device(struct dm_target *ti, struct dm_dev *d); 98void dm_put_device(struct dm_target *ti, struct dm_dev *d);
100 99
101/* 100/*
@@ -223,7 +222,7 @@ int dm_set_geometry(struct mapped_device *md, struct hd_geometry *geo);
223/* 222/*
224 * First create an empty table. 223 * First create an empty table.
225 */ 224 */
226int dm_table_create(struct dm_table **result, int mode, 225int dm_table_create(struct dm_table **result, fmode_t mode,
227 unsigned num_targets, struct mapped_device *md); 226 unsigned num_targets, struct mapped_device *md);
228 227
229/* 228/*
@@ -254,7 +253,7 @@ void dm_table_put(struct dm_table *t);
254 */ 253 */
255sector_t dm_table_get_size(struct dm_table *t); 254sector_t dm_table_get_size(struct dm_table *t);
256unsigned int dm_table_get_num_targets(struct dm_table *t); 255unsigned int dm_table_get_num_targets(struct dm_table *t);
257int dm_table_get_mode(struct dm_table *t); 256fmode_t dm_table_get_mode(struct dm_table *t);
258struct mapped_device *dm_table_get_md(struct dm_table *t); 257struct mapped_device *dm_table_get_md(struct dm_table *t);
259 258
260/* 259/*
diff --git a/include/linux/file.h b/include/linux/file.h
index a20259e248a5..335a0a5c316e 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -19,10 +19,10 @@ struct file_operations;
19struct vfsmount; 19struct vfsmount;
20struct dentry; 20struct dentry;
21extern int init_file(struct file *, struct vfsmount *mnt, 21extern int init_file(struct file *, struct vfsmount *mnt,
22 struct dentry *dentry, mode_t mode, 22 struct dentry *dentry, fmode_t mode,
23 const struct file_operations *fop); 23 const struct file_operations *fop);
24extern struct file *alloc_file(struct vfsmount *, struct dentry *dentry, 24extern struct file *alloc_file(struct vfsmount *, struct dentry *dentry,
25 mode_t mode, const struct file_operations *fop); 25 fmode_t mode, const struct file_operations *fop);
26 26
27static inline void fput_light(struct file *file, int fput_needed) 27static inline void fput_light(struct file *file, int fput_needed)
28{ 28{
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7d719c1a18e3..43659ae52e4d 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
@@ -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;
@@ -1152,6 +1157,7 @@ struct super_block {
1152 char s_id[32]; /* Informational name */ 1157 char s_id[32]; /* Informational name */
1153 1158
1154 void *s_fs_info; /* Filesystem private info */ 1159 void *s_fs_info; /* Filesystem private info */
1160 fmode_t s_mode;
1155 1161
1156 /* 1162 /*
1157 * The next field is for VFS *only*. No filesystems have any business 1163 * The next field is for VFS *only*. No filesystems have any business
@@ -1266,20 +1272,7 @@ int generic_osync_inode(struct inode *, struct address_space *, int);
1266 * to have different dirent layouts depending on the binary type. 1272 * to have different dirent layouts depending on the binary type.
1267 */ 1273 */
1268typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned); 1274typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned);
1269 1275struct block_device_operations;
1270struct block_device_operations {
1271 int (*open) (struct inode *, struct file *);
1272 int (*release) (struct inode *, struct file *);
1273 int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long);
1274 long (*unlocked_ioctl) (struct file *, unsigned, unsigned long);
1275 long (*compat_ioctl) (struct file *, unsigned, unsigned long);
1276 int (*direct_access) (struct block_device *, sector_t,
1277 void **, unsigned long *);
1278 int (*media_changed) (struct gendisk *);
1279 int (*revalidate_disk) (struct gendisk *);
1280 int (*getgeo)(struct block_device *, struct hd_geometry *);
1281 struct module *owner;
1282};
1283 1276
1284/* These macros are for out of kernel modules to test that 1277/* These macros are for out of kernel modules to test that
1285 * the kernel supports the unlocked_ioctl and compat_ioctl 1278 * the kernel supports the unlocked_ioctl and compat_ioctl
@@ -1713,7 +1706,7 @@ extern struct block_device *bdget(dev_t);
1713extern void bd_set_size(struct block_device *, loff_t size); 1706extern void bd_set_size(struct block_device *, loff_t size);
1714extern void bd_forget(struct inode *inode); 1707extern void bd_forget(struct inode *inode);
1715extern void bdput(struct block_device *); 1708extern void bdput(struct block_device *);
1716extern struct block_device *open_by_devnum(dev_t, unsigned); 1709extern struct block_device *open_by_devnum(dev_t, fmode_t);
1717#else 1710#else
1718static inline void bd_forget(struct inode *inode) {} 1711static inline void bd_forget(struct inode *inode) {}
1719#endif 1712#endif
@@ -1723,13 +1716,10 @@ extern const struct file_operations bad_sock_fops;
1723extern const struct file_operations def_fifo_fops; 1716extern const struct file_operations def_fifo_fops;
1724#ifdef CONFIG_BLOCK 1717#ifdef CONFIG_BLOCK
1725extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); 1718extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
1726extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long); 1719extern 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); 1720extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
1731extern int blkdev_get(struct block_device *, mode_t, unsigned); 1721extern int blkdev_get(struct block_device *, fmode_t);
1732extern int blkdev_put(struct block_device *); 1722extern int blkdev_put(struct block_device *, fmode_t);
1733extern int bd_claim(struct block_device *, void *); 1723extern int bd_claim(struct block_device *, void *);
1734extern void bd_release(struct block_device *); 1724extern void bd_release(struct block_device *);
1735#ifdef CONFIG_SYSFS 1725#ifdef CONFIG_SYSFS
@@ -1760,9 +1750,10 @@ extern void chrdev_show(struct seq_file *,off_t);
1760extern const char *__bdevname(dev_t, char *buffer); 1750extern const char *__bdevname(dev_t, char *buffer);
1761extern const char *bdevname(struct block_device *bdev, char *buffer); 1751extern const char *bdevname(struct block_device *bdev, char *buffer);
1762extern struct block_device *lookup_bdev(const char *); 1752extern struct block_device *lookup_bdev(const char *);
1763extern struct block_device *open_bdev_excl(const char *, int, void *); 1753extern struct block_device *open_bdev_exclusive(const char *, fmode_t, void *);
1764extern void close_bdev_excl(struct block_device *); 1754extern void close_bdev_exclusive(struct block_device *, fmode_t);
1765extern void blkdev_show(struct seq_file *,off_t); 1755extern void blkdev_show(struct seq_file *,off_t);
1756
1766#else 1757#else
1767#define BLKDEV_MAJOR_HASH_SIZE 0 1758#define BLKDEV_MAJOR_HASH_SIZE 0
1768#endif 1759#endif
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index a89513188ce7..00fbd5b245c9 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -188,7 +188,7 @@ static inline void fsnotify_close(struct file *file)
188 struct dentry *dentry = file->f_path.dentry; 188 struct dentry *dentry = file->f_path.dentry;
189 struct inode *inode = dentry->d_inode; 189 struct inode *inode = dentry->d_inode;
190 const char *name = dentry->d_name.name; 190 const char *name = dentry->d_name.name;
191 mode_t mode = file->f_mode; 191 fmode_t mode = file->f_mode;
192 u32 mask = (mode & FMODE_WRITE) ? IN_CLOSE_WRITE : IN_CLOSE_NOWRITE; 192 u32 mask = (mode & FMODE_WRITE) ? IN_CLOSE_WRITE : IN_CLOSE_NOWRITE;
193 193
194 if (S_ISDIR(inode->i_mode)) 194 if (S_ISDIR(inode->i_mode))
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 89e53cfbc787..54525be4b5f8 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -474,8 +474,8 @@ struct ide_disk_ops {
474 ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *, 474 ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *,
475 sector_t); 475 sector_t);
476 int (*end_request)(struct ide_drive_s *, int, int); 476 int (*end_request)(struct ide_drive_s *, int, int);
477 int (*ioctl)(struct ide_drive_s *, struct inode *, 477 int (*ioctl)(struct ide_drive_s *, struct block_device *,
478 struct file *, unsigned int, unsigned long); 478 fmode_t, unsigned int, unsigned long);
479}; 479};
480 480
481/* ATAPI device flags */ 481/* ATAPI device flags */
@@ -1158,8 +1158,7 @@ struct ide_ioctl_devset {
1158int ide_setting_ioctl(ide_drive_t *, struct block_device *, unsigned int, 1158int ide_setting_ioctl(ide_drive_t *, struct block_device *, unsigned int,
1159 unsigned long, const struct ide_ioctl_devset *); 1159 unsigned long, const struct ide_ioctl_devset *);
1160 1160
1161int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, 1161int generic_ide_ioctl(ide_drive_t *, struct block_device *, unsigned, unsigned long);
1162 unsigned, unsigned long);
1163 1162
1164extern int ide_vlb_clk; 1163extern int ide_vlb_clk;
1165extern int ide_pci_clk; 1164extern int ide_pci_clk;
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index 315517e8bfa1..bda6b562a1e0 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -178,6 +178,7 @@ struct reiserfs_journal {
178 struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */ 178 struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */
179 179
180 struct block_device *j_dev_bd; 180 struct block_device *j_dev_bd;
181 fmode_t j_dev_mode;
181 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ 182 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */
182 183
183 unsigned long j_state; 184 unsigned long j_state;
diff --git a/include/linux/types.h b/include/linux/types.h
index f24f7beb47df..1d98330b1f2c 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -190,6 +190,7 @@ typedef __u32 __bitwise __wsum;
190 190
191#ifdef __KERNEL__ 191#ifdef __KERNEL__
192typedef unsigned __bitwise__ gfp_t; 192typedef unsigned __bitwise__ gfp_t;
193typedef unsigned __bitwise__ fmode_t;
193 194
194#ifdef CONFIG_PHYS_ADDR_T_64BIT 195#ifdef CONFIG_PHYS_ADDR_T_64BIT
195typedef u64 phys_addr_t; 196typedef u64 phys_addr_t;
diff --git a/include/scsi/scsi_ioctl.h b/include/scsi/scsi_ioctl.h
index edb9525386da..b9006848b813 100644
--- a/include/scsi/scsi_ioctl.h
+++ b/include/scsi/scsi_ioctl.h
@@ -42,7 +42,7 @@ typedef struct scsi_fctargaddress {
42 42
43extern int scsi_ioctl(struct scsi_device *, int, void __user *); 43extern int scsi_ioctl(struct scsi_device *, int, void __user *);
44extern int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd, 44extern int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd,
45 void __user *arg, struct file *filp); 45 void __user *arg, int ndelay);
46 46
47#endif /* __KERNEL__ */ 47#endif /* __KERNEL__ */
48#endif /* _SCSI_IOCTL_H */ 48#endif /* _SCSI_IOCTL_H */