···2727#include <linux/cdrom.h>28282929int blk_verify_command(struct blk_cmd_filter *filter,3030- unsigned char *cmd, int has_write_perm)3030+ unsigned char *cmd, fmode_t has_write_perm)3131{3232 /* root can do any command. */3333 if (capable(CAP_SYS_RAWIO))
···15601560 if (fd_ref[drive] && old_dev != system)15611561 return -EBUSY;1562156215631563- if (filp && filp->f_mode & 3) {15631563+ if (filp && filp->f_mode & (FMODE_READ|FMODE_WRITE)) {15641564 check_disk_change(inode->i_bdev);15651565- if (filp->f_mode & 2 ) {15651565+ if (filp->f_mode & FMODE_WRITE ) {15661566 int wrprot;1567156715681568 get_fdc(drive);
+2-2
drivers/block/ataflop.c
···18261826 if (filp->f_flags & O_NDELAY)18271827 return 0;1828182818291829- if (filp->f_mode & 3) {18291829+ if (filp->f_mode & (FMODE_READ|FMODE_WRITE)) {18301830 check_disk_change(inode->i_bdev);18311831- if (filp->f_mode & 2) {18311831+ if (filp->f_mode & FMODE_WRITE) {18321832 if (p->wpstat) {18331833 if (p->ref < 0)18341834 p->ref = 0;
+2-2
drivers/block/floppy.c
···37613761 UFDCS->rawcmd = 2;3762376237633763 if (!(filp->f_flags & O_NDELAY)) {37643764- if (filp->f_mode & 3) {37643764+ if (filp->f_mode & (FMODE_READ|FMODE_WRITE)) {37653765 UDRS->last_checked = 0;37663766 check_disk_change(inode->i_bdev);37673767 if (UTESTF(FD_DISK_CHANGED))37683768 goto out;37693769 }37703770 res = -EROFS;37713771- if ((filp->f_mode & 2) && !(UTESTF(FD_DISK_WRITABLE)))37713771+ if ((filp->f_mode & FMODE_WRITE) && !(UTESTF(FD_DISK_WRITABLE)))37723772 goto out;37733773 }37743774 mutex_unlock(&open_lock);
+1-1
drivers/block/paride/pf.c
···305305 if (pf->media_status == PF_NM)306306 return -ENODEV;307307308308- if ((pf->media_status == PF_RO) && (file->f_mode & 2))308308+ if ((pf->media_status == PF_RO) && (file->f_mode & FMODE_WRITE))309309 return -EROFS;310310311311 pf->access++;
+1-1
drivers/block/paride/pt.c
···667667 goto out;668668669669 err = -EROFS;670670- if ((!(tape->flags & PT_WRITE_OK)) && (file->f_mode & 2))670670+ if ((!(tape->flags & PT_WRITE_OK)) && (file->f_mode & FMODE_WRITE))671671 goto out;672672673673 if (!(iminor(inode) & 128))
+1-1
drivers/block/pktcdvd.c
···23202320/*23212321 * called at open time.23222322 */23232323-static int pkt_open_dev(struct pktcdvd_device *pd, int write)23232323+static int pkt_open_dev(struct pktcdvd_device *pd, fmode_t write)23242324{23252325 int ret;23262326 long lba;
+2-2
drivers/block/swim3.c
···908908 return -EBUSY;909909910910 if (err == 0 && (filp->f_flags & O_NDELAY) == 0911911- && (filp->f_mode & 3)) {911911+ && (filp->f_mode & (FMODE_READ|FMODE_WRITE))) {912912 check_disk_change(inode->i_bdev);913913 if (fs->ejected)914914 err = -ENXIO;915915 }916916917917- if (err == 0 && (filp->f_mode & 2)) {917917+ if (err == 0 && (filp->f_mode & FMODE_WRITE)) {918918 if (fs->write_prot < 0)919919 fs->write_prot = swim3_readbit(fs, WRITE_PROT);920920 if (fs->write_prot)
+3-3
drivers/char/nvram.c
···338338339339 if ((nvram_open_cnt && (file->f_flags & O_EXCL)) ||340340 (nvram_open_mode & NVRAM_EXCL) ||341341- ((file->f_mode & 2) && (nvram_open_mode & NVRAM_WRITE))) {341341+ ((file->f_mode & FMODE_WRITE) && (nvram_open_mode & NVRAM_WRITE))) {342342 spin_unlock(&nvram_state_lock);343343 unlock_kernel();344344 return -EBUSY;···346346347347 if (file->f_flags & O_EXCL)348348 nvram_open_mode |= NVRAM_EXCL;349349- if (file->f_mode & 2)349349+ if (file->f_mode & FMODE_WRITE)350350 nvram_open_mode |= NVRAM_WRITE;351351 nvram_open_cnt++;352352···366366 /* if only one instance is open, clear the EXCL bit */367367 if (nvram_open_mode & NVRAM_EXCL)368368 nvram_open_mode &= ~NVRAM_EXCL;369369- if (file->f_mode & 2)369369+ if (file->f_mode & FMODE_WRITE)370370 nvram_open_mode &= ~NVRAM_WRITE;371371372372 spin_unlock(&nvram_state_lock);
+1-1
drivers/ide/ide-floppy_ioctl.c
···250250 case IDEFLOPPY_IOCTL_FORMAT_GET_CAPACITY:251251 return ide_floppy_get_format_capacities(drive, argp);252252 case IDEFLOPPY_IOCTL_FORMAT_START:253253- if (!(file->f_mode & 2))253253+ if (!(file->f_mode & FMODE_WRITE))254254 return -EPERM;255255 return ide_floppy_format_unit(drive, (int __user *)argp);256256 case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS:
+1-1
drivers/ide/ide-gd.c
···202202 goto out_put_idkp;203203 }204204205205- if ((drive->dev_flags & IDE_DFLAG_WP) && (filp->f_mode & 2)) {205205+ if ((drive->dev_flags & IDE_DFLAG_WP) && (filp->f_mode & FMODE_WRITE)) {206206 ret = -EROFS;207207 goto out_put_idkp;208208 }
···4343 * device. This should be a combination of FMODE_READ4444 * and FMODE_WRITE.4545 */4646- int mode;4646+ fmode_t mode;47474848 /* a list of devices used by this table */4949 struct list_head devices;···217217 return 0;218218}219219220220-int dm_table_create(struct dm_table **result, int mode,220220+int dm_table_create(struct dm_table **result, fmode_t mode,221221 unsigned num_targets, struct mapped_device *md)222222{223223 struct dm_table *t = kzalloc(sizeof(*t), GFP_KERNEL);···395395 * careful to leave things as they were if we fail to reopen the396396 * device.397397 */398398-static int upgrade_mode(struct dm_dev_internal *dd, int new_mode,398398+static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode,399399 struct mapped_device *md)400400{401401 int r;···421421 */422422static int __table_get_device(struct dm_table *t, struct dm_target *ti,423423 const char *path, sector_t start, sector_t len,424424- int mode, struct dm_dev **result)424424+ fmode_t mode, struct dm_dev **result)425425{426426 int r;427427 dev_t uninitialized_var(dev);···537537EXPORT_SYMBOL_GPL(dm_set_device_limits);538538539539int dm_get_device(struct dm_target *ti, const char *path, sector_t start,540540- sector_t len, int mode, struct dm_dev **result)540540+ sector_t len, fmode_t mode, struct dm_dev **result)541541{542542 int r = __table_get_device(ti->table, ti, path,543543 start, len, mode, result);···887887 return &t->devices;888888}889889890890-int dm_table_get_mode(struct dm_table *t)890890+fmode_t dm_table_get_mode(struct dm_table *t)891891{892892 return t->mode;893893}
+5-5
drivers/mtd/mtdchar.c
···9696 return -ENODEV;97979898 /* You can't open the RO devices RW */9999- if ((file->f_mode & 2) && (minor & 1))9999+ if ((file->f_mode & FMODE_WRITE) && (minor & 1))100100 return -EACCES;101101102102 lock_kernel();···114114 }115115116116 /* You can't open it RW if it's not a writeable device */117117- if ((file->f_mode & 2) && !(mtd->flags & MTD_WRITEABLE)) {117117+ if ((file->f_mode & FMODE_WRITE) && !(mtd->flags & MTD_WRITEABLE)) {118118 put_mtd_device(mtd);119119 ret = -EACCES;120120 goto out;···144144 DEBUG(MTD_DEBUG_LEVEL0, "MTD_close\n");145145146146 /* Only sync if opened RW */147147- if ((file->f_mode & 2) && mtd->sync)147147+ if ((file->f_mode & FMODE_WRITE) && mtd->sync)148148 mtd->sync(mtd);149149150150 put_mtd_device(mtd);···443443 {444444 struct erase_info *erase;445445446446- if(!(file->f_mode & 2))446446+ if(!(file->f_mode & FMODE_WRITE))447447 return -EPERM;448448449449 erase=kzalloc(sizeof(struct erase_info),GFP_KERNEL);···497497 struct mtd_oob_buf __user *user_buf = argp;498498 uint32_t retlen;499499500500- if(!(file->f_mode & 2))500500+ if(!(file->f_mode & FMODE_WRITE))501501 return -EPERM;502502503503 if (copy_from_user(&buf, argp, sizeof(struct mtd_oob_buf)))
+1-1
drivers/parisc/eisa_eeprom.c
···8686{8787 cycle_kernel_lock();88888989- if (file->f_mode & 2)8989+ if (file->f_mode & FMODE_WRITE)9090 return -EINVAL;91919292 return 0;
+5-5
fs/block_dev.c
···840840 * to be used for internal purposes. If you ever need it - reconsider841841 * your API.842842 */843843-struct block_device *open_by_devnum(dev_t dev, unsigned mode)843843+struct block_device *open_by_devnum(dev_t dev, fmode_t mode)844844{845845 struct block_device *bdev = bdget(dev);846846 int err = -ENOMEM;···975975}976976EXPORT_SYMBOL(bd_set_size);977977978978-static int __blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags,978978+static int __blkdev_get(struct block_device *bdev, fmode_t mode, unsigned flags,979979 int for_part);980980static int __blkdev_put(struct block_device *bdev, int for_part);981981···11041104 return ret;11051105}1106110611071107-static int __blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags,11071107+static int __blkdev_get(struct block_device *bdev, fmode_t mode, unsigned flags,11081108 int for_part)11091109{11101110 /*···11231123 return do_open(bdev, &fake_file, for_part);11241124}1125112511261126-int blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags)11261126+int blkdev_get(struct block_device *bdev, fmode_t mode, unsigned flags)11271127{11281128 return __blkdev_get(bdev, mode, flags, 0);11291129}···13151315struct block_device *open_bdev_excl(const char *path, int flags, void *holder)13161316{13171317 struct block_device *bdev;13181318- mode_t mode = FMODE_READ;13181318+ fmode_t mode = FMODE_READ;13191319 int error = 0;1320132013211321 bdev = lookup_bdev(path);
+3-3
fs/fifo.c
···5151 filp->f_mode &= (FMODE_READ | FMODE_WRITE);52525353 switch (filp->f_mode) {5454- case 1:5454+ case FMODE_READ:5555 /*5656 * O_RDONLY5757 * POSIX.1 says that O_NONBLOCK means return with the FIFO···7676 }7777 break;78787979- case 2:7979+ case FMODE_WRITE:8080 /*8181 * O_WRONLY8282 * POSIX.1 says that O_NONBLOCK means return -1 with···9898 }9999 break;100100101101- case 3:101101+ case FMODE_READ | FMODE_WRITE:102102 /*103103 * O_RDWR104104 * POSIX.1 leaves this case "undefined" when O_NONBLOCK is set.
+2-2
fs/file_table.c
···161161 * code should be moved into this function.162162 */163163struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry,164164- mode_t mode, const struct file_operations *fop)164164+ fmode_t mode, const struct file_operations *fop)165165{166166 struct file *file;167167 struct path;···193193 * of this should be moving to alloc_file().194194 */195195int init_file(struct file *file, struct vfsmount *mnt, struct dentry *dentry,196196- mode_t mode, const struct file_operations *fop)196196+ fmode_t mode, const struct file_operations *fop)197197{198198 int error = 0;199199 file->f_path.dentry = dentry;
+3-2
fs/hostfs/hostfs_kern.c
···2020struct hostfs_inode_info {2121 char *host_filename;2222 int fd;2323- int mode;2323+ fmode_t mode;2424 struct inode vfs_inode;2525};2626···373373int hostfs_file_open(struct inode *ino, struct file *file)374374{375375 char *name;376376- int mode = 0, r = 0, w = 0, fd;376376+ fmode_t mode = 0;377377+ int r = 0, w = 0, fd;377378378379 mode = file->f_mode & (FMODE_READ | FMODE_WRITE);379380 if ((mode & HOSTFS_I(ino)->mode) == mode)
···129129 int (*mixer_ioctl)(u_int, u_long); /* optional */130130 int (*write_sq_setup)(void); /* optional */131131 int (*read_sq_setup)(void); /* optional */132132- int (*sq_open)(mode_t); /* optional */132132+ int (*sq_open)(fmode_t); /* optional */133133 int (*state_info)(char *, size_t); /* optional */134134 void (*abort_read)(void); /* optional */135135 int min_dsp_speed;···235235 */236236 int active;237237 wait_queue_head_t action_queue, open_queue, sync_queue;238238- int open_mode;238238+ fmode_t open_mode;239239 int busy, syncing, xruns, died;240240};241241
+2-2
sound/oss/dmasound/dmasound_atari.c
···143143static int TTMixerIoctl(u_int cmd, u_long arg);144144static int FalconMixerIoctl(u_int cmd, u_long arg);145145static int AtaWriteSqSetup(void);146146-static int AtaSqOpen(mode_t mode);146146+static int AtaSqOpen(fmode_t mode);147147static int TTStateInfo(char *buffer, size_t space);148148static int FalconStateInfo(char *buffer, size_t space);149149···14611461 return 0 ;14621462}1463146314641464-static int AtaSqOpen(mode_t mode)14641464+static int AtaSqOpen(fmode_t mode)14651465{14661466 write_sq_ignore_int = 1;14671467 return 0 ;
+5-5
sound/oss/dmasound/dmasound_core.c
···212212#endif /* MODULE */213213214214/* control over who can modify resources shared between play/record */215215-static mode_t shared_resource_owner;215215+static fmode_t shared_resource_owner;216216static int shared_resources_initialised;217217218218 /*···668668669669#if 0 /* blocking open() */670670static inline void sq_wake_up(struct sound_queue *sq, struct file *file,671671- mode_t mode)671671+ fmode_t mode)672672{673673 if (file->f_mode & mode) {674674 sq->busy = 0; /* CHECK: IS THIS OK??? */···677677}678678#endif679679680680-static int sq_open2(struct sound_queue *sq, struct file *file, mode_t mode,680680+static int sq_open2(struct sound_queue *sq, struct file *file, fmode_t mode,681681 int numbufs, int bufsize)682682{683683 int rc = 0;···891891 is the owner - if we have problems.892892*/893893894894-static int shared_resources_are_mine(mode_t md)894894+static int shared_resources_are_mine(fmode_t md)895895{896896 if (shared_resource_owner)897897- return (shared_resource_owner & md ) ;897897+ return (shared_resource_owner & md) != 0;898898 else {899899 shared_resource_owner = md ;900900 return 1 ;