[PATCH] introduce fmode_t, do annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
2515ddc6db
commit
aeb5d72706
41 changed files with 96 additions and 98 deletions
|
@ -173,7 +173,7 @@ unlock:
|
|||
|
||||
static int blk_fill_sgv4_hdr_rq(struct request_queue *q, struct request *rq,
|
||||
struct sg_io_v4 *hdr, struct bsg_device *bd,
|
||||
int has_write_perm)
|
||||
fmode_t has_write_perm)
|
||||
{
|
||||
if (hdr->request_len > BLK_MAX_CDB) {
|
||||
rq->cmd = kzalloc(hdr->request_len, GFP_KERNEL);
|
||||
|
@ -242,7 +242,7 @@ bsg_validate_sgv4_hdr(struct request_queue *q, struct sg_io_v4 *hdr, int *rw)
|
|||
* map sg_io_v4 to a request.
|
||||
*/
|
||||
static struct request *
|
||||
bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, int has_write_perm)
|
||||
bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm)
|
||||
{
|
||||
struct request_queue *q = bd->queue;
|
||||
struct request *rq, *next_rq = NULL;
|
||||
|
@ -601,7 +601,8 @@ bsg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
|
|||
}
|
||||
|
||||
static int __bsg_write(struct bsg_device *bd, const char __user *buf,
|
||||
size_t count, ssize_t *bytes_written, int has_write_perm)
|
||||
size_t count, ssize_t *bytes_written,
|
||||
fmode_t has_write_perm)
|
||||
{
|
||||
struct bsg_command *bc;
|
||||
struct request *rq;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <linux/cdrom.h>
|
||||
|
||||
int blk_verify_command(struct blk_cmd_filter *filter,
|
||||
unsigned char *cmd, int has_write_perm)
|
||||
unsigned char *cmd, fmode_t has_write_perm)
|
||||
{
|
||||
/* root can do any command. */
|
||||
if (capable(CAP_SYS_RAWIO))
|
||||
|
|
|
@ -384,7 +384,8 @@ int sg_scsi_ioctl(struct file *file, struct request_queue *q,
|
|||
struct gendisk *disk, struct scsi_ioctl_command __user *sic)
|
||||
{
|
||||
struct request *rq;
|
||||
int err, write_perm = 0;
|
||||
int err;
|
||||
fmode_t write_perm = 0;
|
||||
unsigned int in_len, out_len, bytes, opcode, cmdlen;
|
||||
char *buffer = NULL, sense[SCSI_SENSE_BUFFERSIZE];
|
||||
|
||||
|
@ -428,7 +429,7 @@ int sg_scsi_ioctl(struct file *file, struct request_queue *q,
|
|||
|
||||
/* scsi_ioctl passes NULL */
|
||||
if (file && (file->f_mode & FMODE_WRITE))
|
||||
write_perm = 1;
|
||||
write_perm = FMODE_WRITE;
|
||||
|
||||
err = blk_verify_command(&q->cmd_filter, rq->cmd, write_perm);
|
||||
if (err)
|
||||
|
|
|
@ -1560,9 +1560,9 @@ static int floppy_open(struct inode *inode, struct file *filp)
|
|||
if (fd_ref[drive] && old_dev != system)
|
||||
return -EBUSY;
|
||||
|
||||
if (filp && filp->f_mode & 3) {
|
||||
if (filp && filp->f_mode & (FMODE_READ|FMODE_WRITE)) {
|
||||
check_disk_change(inode->i_bdev);
|
||||
if (filp->f_mode & 2 ) {
|
||||
if (filp->f_mode & FMODE_WRITE ) {
|
||||
int wrprot;
|
||||
|
||||
get_fdc(drive);
|
||||
|
|
|
@ -1826,9 +1826,9 @@ static int floppy_open( struct inode *inode, struct file *filp )
|
|||
if (filp->f_flags & O_NDELAY)
|
||||
return 0;
|
||||
|
||||
if (filp->f_mode & 3) {
|
||||
if (filp->f_mode & (FMODE_READ|FMODE_WRITE)) {
|
||||
check_disk_change(inode->i_bdev);
|
||||
if (filp->f_mode & 2) {
|
||||
if (filp->f_mode & FMODE_WRITE) {
|
||||
if (p->wpstat) {
|
||||
if (p->ref < 0)
|
||||
p->ref = 0;
|
||||
|
|
|
@ -3761,14 +3761,14 @@ static int floppy_open(struct inode *inode, struct file *filp)
|
|||
UFDCS->rawcmd = 2;
|
||||
|
||||
if (!(filp->f_flags & O_NDELAY)) {
|
||||
if (filp->f_mode & 3) {
|
||||
if (filp->f_mode & (FMODE_READ|FMODE_WRITE)) {
|
||||
UDRS->last_checked = 0;
|
||||
check_disk_change(inode->i_bdev);
|
||||
if (UTESTF(FD_DISK_CHANGED))
|
||||
goto out;
|
||||
}
|
||||
res = -EROFS;
|
||||
if ((filp->f_mode & 2) && !(UTESTF(FD_DISK_WRITABLE)))
|
||||
if ((filp->f_mode & FMODE_WRITE) && !(UTESTF(FD_DISK_WRITABLE)))
|
||||
goto out;
|
||||
}
|
||||
mutex_unlock(&open_lock);
|
||||
|
|
|
@ -305,7 +305,7 @@ static int pf_open(struct inode *inode, struct file *file)
|
|||
if (pf->media_status == PF_NM)
|
||||
return -ENODEV;
|
||||
|
||||
if ((pf->media_status == PF_RO) && (file->f_mode & 2))
|
||||
if ((pf->media_status == PF_RO) && (file->f_mode & FMODE_WRITE))
|
||||
return -EROFS;
|
||||
|
||||
pf->access++;
|
||||
|
|
|
@ -667,7 +667,7 @@ static int pt_open(struct inode *inode, struct file *file)
|
|||
goto out;
|
||||
|
||||
err = -EROFS;
|
||||
if ((!(tape->flags & PT_WRITE_OK)) && (file->f_mode & 2))
|
||||
if ((!(tape->flags & PT_WRITE_OK)) && (file->f_mode & FMODE_WRITE))
|
||||
goto out;
|
||||
|
||||
if (!(iminor(inode) & 128))
|
||||
|
|
|
@ -2320,7 +2320,7 @@ static int pkt_open_write(struct pktcdvd_device *pd)
|
|||
/*
|
||||
* called at open time.
|
||||
*/
|
||||
static int pkt_open_dev(struct pktcdvd_device *pd, int write)
|
||||
static int pkt_open_dev(struct pktcdvd_device *pd, fmode_t write)
|
||||
{
|
||||
int ret;
|
||||
long lba;
|
||||
|
|
|
@ -908,13 +908,13 @@ static int floppy_open(struct inode *inode, struct file *filp)
|
|||
return -EBUSY;
|
||||
|
||||
if (err == 0 && (filp->f_flags & O_NDELAY) == 0
|
||||
&& (filp->f_mode & 3)) {
|
||||
&& (filp->f_mode & (FMODE_READ|FMODE_WRITE))) {
|
||||
check_disk_change(inode->i_bdev);
|
||||
if (fs->ejected)
|
||||
err = -ENXIO;
|
||||
}
|
||||
|
||||
if (err == 0 && (filp->f_mode & 2)) {
|
||||
if (err == 0 && (filp->f_mode & FMODE_WRITE)) {
|
||||
if (fs->write_prot < 0)
|
||||
fs->write_prot = swim3_readbit(fs, WRITE_PROT);
|
||||
if (fs->write_prot)
|
||||
|
|
|
@ -338,7 +338,7 @@ nvram_open(struct inode *inode, struct file *file)
|
|||
|
||||
if ((nvram_open_cnt && (file->f_flags & O_EXCL)) ||
|
||||
(nvram_open_mode & NVRAM_EXCL) ||
|
||||
((file->f_mode & 2) && (nvram_open_mode & NVRAM_WRITE))) {
|
||||
((file->f_mode & FMODE_WRITE) && (nvram_open_mode & NVRAM_WRITE))) {
|
||||
spin_unlock(&nvram_state_lock);
|
||||
unlock_kernel();
|
||||
return -EBUSY;
|
||||
|
@ -346,7 +346,7 @@ nvram_open(struct inode *inode, struct file *file)
|
|||
|
||||
if (file->f_flags & O_EXCL)
|
||||
nvram_open_mode |= NVRAM_EXCL;
|
||||
if (file->f_mode & 2)
|
||||
if (file->f_mode & FMODE_WRITE)
|
||||
nvram_open_mode |= NVRAM_WRITE;
|
||||
nvram_open_cnt++;
|
||||
|
||||
|
@ -366,7 +366,7 @@ nvram_release(struct inode *inode, struct file *file)
|
|||
/* if only one instance is open, clear the EXCL bit */
|
||||
if (nvram_open_mode & NVRAM_EXCL)
|
||||
nvram_open_mode &= ~NVRAM_EXCL;
|
||||
if (file->f_mode & 2)
|
||||
if (file->f_mode & FMODE_WRITE)
|
||||
nvram_open_mode &= ~NVRAM_WRITE;
|
||||
|
||||
spin_unlock(&nvram_state_lock);
|
||||
|
|
|
@ -250,7 +250,7 @@ static int ide_floppy_format_ioctl(ide_drive_t *drive, struct file *file,
|
|||
case IDEFLOPPY_IOCTL_FORMAT_GET_CAPACITY:
|
||||
return ide_floppy_get_format_capacities(drive, argp);
|
||||
case IDEFLOPPY_IOCTL_FORMAT_START:
|
||||
if (!(file->f_mode & 2))
|
||||
if (!(file->f_mode & FMODE_WRITE))
|
||||
return -EPERM;
|
||||
return ide_floppy_format_unit(drive, (int __user *)argp);
|
||||
case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS:
|
||||
|
|
|
@ -202,7 +202,7 @@ static int ide_gd_open(struct inode *inode, struct file *filp)
|
|||
goto out_put_idkp;
|
||||
}
|
||||
|
||||
if ((drive->dev_flags & IDE_DFLAG_WP) && (filp->f_mode & 2)) {
|
||||
if ((drive->dev_flags & IDE_DFLAG_WP) && (filp->f_mode & FMODE_WRITE)) {
|
||||
ret = -EROFS;
|
||||
goto out_put_idkp;
|
||||
}
|
||||
|
|
|
@ -988,9 +988,9 @@ static int dev_wait(struct dm_ioctl *param, size_t param_size)
|
|||
return r;
|
||||
}
|
||||
|
||||
static inline int get_mode(struct dm_ioctl *param)
|
||||
static inline fmode_t get_mode(struct dm_ioctl *param)
|
||||
{
|
||||
int mode = FMODE_READ | FMODE_WRITE;
|
||||
fmode_t mode = FMODE_READ | FMODE_WRITE;
|
||||
|
||||
if (param->flags & DM_READONLY_FLAG)
|
||||
mode = FMODE_READ;
|
||||
|
|
|
@ -43,7 +43,7 @@ struct dm_table {
|
|||
* device. This should be a combination of FMODE_READ
|
||||
* and FMODE_WRITE.
|
||||
*/
|
||||
int mode;
|
||||
fmode_t mode;
|
||||
|
||||
/* a list of devices used by this table */
|
||||
struct list_head devices;
|
||||
|
@ -217,7 +217,7 @@ static int alloc_targets(struct dm_table *t, unsigned int num)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int dm_table_create(struct dm_table **result, int mode,
|
||||
int dm_table_create(struct dm_table **result, fmode_t mode,
|
||||
unsigned num_targets, struct mapped_device *md)
|
||||
{
|
||||
struct dm_table *t = kzalloc(sizeof(*t), GFP_KERNEL);
|
||||
|
@ -395,7 +395,7 @@ static int check_device_area(struct dm_dev_internal *dd, sector_t start,
|
|||
* careful to leave things as they were if we fail to reopen the
|
||||
* device.
|
||||
*/
|
||||
static int upgrade_mode(struct dm_dev_internal *dd, int new_mode,
|
||||
static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode,
|
||||
struct mapped_device *md)
|
||||
{
|
||||
int r;
|
||||
|
@ -421,7 +421,7 @@ static int upgrade_mode(struct dm_dev_internal *dd, int new_mode,
|
|||
*/
|
||||
static int __table_get_device(struct dm_table *t, struct dm_target *ti,
|
||||
const char *path, sector_t start, sector_t len,
|
||||
int mode, struct dm_dev **result)
|
||||
fmode_t mode, struct dm_dev **result)
|
||||
{
|
||||
int r;
|
||||
dev_t uninitialized_var(dev);
|
||||
|
@ -537,7 +537,7 @@ void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev)
|
|||
EXPORT_SYMBOL_GPL(dm_set_device_limits);
|
||||
|
||||
int dm_get_device(struct dm_target *ti, const char *path, sector_t start,
|
||||
sector_t len, int mode, struct dm_dev **result)
|
||||
sector_t len, fmode_t mode, struct dm_dev **result)
|
||||
{
|
||||
int r = __table_get_device(ti->table, ti, path,
|
||||
start, len, mode, result);
|
||||
|
@ -887,7 +887,7 @@ struct list_head *dm_table_get_devices(struct dm_table *t)
|
|||
return &t->devices;
|
||||
}
|
||||
|
||||
int dm_table_get_mode(struct dm_table *t)
|
||||
fmode_t dm_table_get_mode(struct dm_table *t)
|
||||
{
|
||||
return t->mode;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ static int mtd_open(struct inode *inode, struct file *file)
|
|||
return -ENODEV;
|
||||
|
||||
/* You can't open the RO devices RW */
|
||||
if ((file->f_mode & 2) && (minor & 1))
|
||||
if ((file->f_mode & FMODE_WRITE) && (minor & 1))
|
||||
return -EACCES;
|
||||
|
||||
lock_kernel();
|
||||
|
@ -114,7 +114,7 @@ static int mtd_open(struct inode *inode, struct file *file)
|
|||
}
|
||||
|
||||
/* You can't open it RW if it's not a writeable device */
|
||||
if ((file->f_mode & 2) && !(mtd->flags & MTD_WRITEABLE)) {
|
||||
if ((file->f_mode & FMODE_WRITE) && !(mtd->flags & MTD_WRITEABLE)) {
|
||||
put_mtd_device(mtd);
|
||||
ret = -EACCES;
|
||||
goto out;
|
||||
|
@ -144,7 +144,7 @@ static int mtd_close(struct inode *inode, struct file *file)
|
|||
DEBUG(MTD_DEBUG_LEVEL0, "MTD_close\n");
|
||||
|
||||
/* Only sync if opened RW */
|
||||
if ((file->f_mode & 2) && mtd->sync)
|
||||
if ((file->f_mode & FMODE_WRITE) && mtd->sync)
|
||||
mtd->sync(mtd);
|
||||
|
||||
put_mtd_device(mtd);
|
||||
|
@ -443,7 +443,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
|
|||
{
|
||||
struct erase_info *erase;
|
||||
|
||||
if(!(file->f_mode & 2))
|
||||
if(!(file->f_mode & FMODE_WRITE))
|
||||
return -EPERM;
|
||||
|
||||
erase=kzalloc(sizeof(struct erase_info),GFP_KERNEL);
|
||||
|
@ -497,7 +497,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
|
|||
struct mtd_oob_buf __user *user_buf = argp;
|
||||
uint32_t retlen;
|
||||
|
||||
if(!(file->f_mode & 2))
|
||||
if(!(file->f_mode & FMODE_WRITE))
|
||||
return -EPERM;
|
||||
|
||||
if (copy_from_user(&buf, argp, sizeof(struct mtd_oob_buf)))
|
||||
|
|
|
@ -86,7 +86,7 @@ static int eisa_eeprom_open(struct inode *inode, struct file *file)
|
|||
{
|
||||
cycle_kernel_lock();
|
||||
|
||||
if (file->f_mode & 2)
|
||||
if (file->f_mode & FMODE_WRITE)
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -840,7 +840,7 @@ EXPORT_SYMBOL_GPL(bd_release_from_disk);
|
|||
* to be used for internal purposes. If you ever need it - reconsider
|
||||
* your API.
|
||||
*/
|
||||
struct block_device *open_by_devnum(dev_t dev, unsigned mode)
|
||||
struct block_device *open_by_devnum(dev_t dev, fmode_t mode)
|
||||
{
|
||||
struct block_device *bdev = bdget(dev);
|
||||
int err = -ENOMEM;
|
||||
|
@ -975,7 +975,7 @@ void bd_set_size(struct block_device *bdev, loff_t size)
|
|||
}
|
||||
EXPORT_SYMBOL(bd_set_size);
|
||||
|
||||
static int __blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags,
|
||||
static int __blkdev_get(struct block_device *bdev, fmode_t mode, unsigned flags,
|
||||
int for_part);
|
||||
static int __blkdev_put(struct block_device *bdev, int for_part);
|
||||
|
||||
|
@ -1104,7 +1104,7 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int __blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags,
|
||||
static int __blkdev_get(struct block_device *bdev, fmode_t mode, unsigned flags,
|
||||
int for_part)
|
||||
{
|
||||
/*
|
||||
|
@ -1123,7 +1123,7 @@ static int __blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags,
|
|||
return do_open(bdev, &fake_file, for_part);
|
||||
}
|
||||
|
||||
int blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags)
|
||||
int blkdev_get(struct block_device *bdev, fmode_t mode, unsigned flags)
|
||||
{
|
||||
return __blkdev_get(bdev, mode, flags, 0);
|
||||
}
|
||||
|
@ -1315,7 +1315,7 @@ EXPORT_SYMBOL(lookup_bdev);
|
|||
struct block_device *open_bdev_excl(const char *path, int flags, void *holder)
|
||||
{
|
||||
struct block_device *bdev;
|
||||
mode_t mode = FMODE_READ;
|
||||
fmode_t mode = FMODE_READ;
|
||||
int error = 0;
|
||||
|
||||
bdev = lookup_bdev(path);
|
||||
|
|
|
@ -51,7 +51,7 @@ static int fifo_open(struct inode *inode, struct file *filp)
|
|||
filp->f_mode &= (FMODE_READ | FMODE_WRITE);
|
||||
|
||||
switch (filp->f_mode) {
|
||||
case 1:
|
||||
case FMODE_READ:
|
||||
/*
|
||||
* O_RDONLY
|
||||
* POSIX.1 says that O_NONBLOCK means return with the FIFO
|
||||
|
@ -76,7 +76,7 @@ static int fifo_open(struct inode *inode, struct file *filp)
|
|||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case FMODE_WRITE:
|
||||
/*
|
||||
* O_WRONLY
|
||||
* POSIX.1 says that O_NONBLOCK means return -1 with
|
||||
|
@ -98,7 +98,7 @@ static int fifo_open(struct inode *inode, struct file *filp)
|
|||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
case FMODE_READ | FMODE_WRITE:
|
||||
/*
|
||||
* O_RDWR
|
||||
* POSIX.1 leaves this case "undefined" when O_NONBLOCK is set.
|
||||
|
|
|
@ -161,7 +161,7 @@ EXPORT_SYMBOL(get_empty_filp);
|
|||
* code should be moved into this function.
|
||||
*/
|
||||
struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry,
|
||||
mode_t mode, const struct file_operations *fop)
|
||||
fmode_t mode, const struct file_operations *fop)
|
||||
{
|
||||
struct file *file;
|
||||
struct path;
|
||||
|
@ -193,7 +193,7 @@ EXPORT_SYMBOL(alloc_file);
|
|||
* of this should be moving to alloc_file().
|
||||
*/
|
||||
int init_file(struct file *file, struct vfsmount *mnt, struct dentry *dentry,
|
||||
mode_t mode, const struct file_operations *fop)
|
||||
fmode_t mode, const struct file_operations *fop)
|
||||
{
|
||||
int error = 0;
|
||||
file->f_path.dentry = dentry;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
struct hostfs_inode_info {
|
||||
char *host_filename;
|
||||
int fd;
|
||||
int mode;
|
||||
fmode_t mode;
|
||||
struct inode vfs_inode;
|
||||
};
|
||||
|
||||
|
@ -373,7 +373,8 @@ int hostfs_readdir(struct file *file, void *ent, filldir_t filldir)
|
|||
int hostfs_file_open(struct inode *ino, struct file *file)
|
||||
{
|
||||
char *name;
|
||||
int mode = 0, r = 0, w = 0, fd;
|
||||
fmode_t mode = 0;
|
||||
int r = 0, w = 0, fd;
|
||||
|
||||
mode = file->f_mode & (FMODE_READ | FMODE_WRITE);
|
||||
if ((mode & HOSTFS_I(ino)->mode) == mode)
|
||||
|
|
|
@ -1580,7 +1580,8 @@ asmlinkage long sys_flock(unsigned int fd, unsigned int cmd)
|
|||
cmd &= ~LOCK_NB;
|
||||
unlock = (cmd == LOCK_UN);
|
||||
|
||||
if (!unlock && !(cmd & LOCK_MAND) && !(filp->f_mode & 3))
|
||||
if (!unlock && !(cmd & LOCK_MAND) &&
|
||||
!(filp->f_mode & (FMODE_READ|FMODE_WRITE)))
|
||||
goto out_putf;
|
||||
|
||||
error = flock_make_lock(filp, &lock, cmd);
|
||||
|
|
|
@ -798,7 +798,7 @@ static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt,
|
|||
int error;
|
||||
|
||||
f->f_flags = flags;
|
||||
f->f_mode = ((flags+1) & O_ACCMODE) | FMODE_LSEEK |
|
||||
f->f_mode = (__force fmode_t)((flags+1) & O_ACCMODE) | FMODE_LSEEK |
|
||||
FMODE_PREAD | FMODE_PWRITE;
|
||||
inode = dentry->d_inode;
|
||||
if (f->f_mode & FMODE_WRITE) {
|
||||
|
|
|
@ -1712,9 +1712,9 @@ static struct dentry *proc_fd_instantiate(struct inode *dir,
|
|||
file = fcheck_files(files, fd);
|
||||
if (!file)
|
||||
goto out_unlock;
|
||||
if (file->f_mode & 1)
|
||||
if (file->f_mode & FMODE_READ)
|
||||
inode->i_mode |= S_IRUSR | S_IXUSR;
|
||||
if (file->f_mode & 2)
|
||||
if (file->f_mode & FMODE_WRITE)
|
||||
inode->i_mode |= S_IWUSR | S_IXUSR;
|
||||
spin_unlock(&files->file_lock);
|
||||
put_files_struct(files);
|
||||
|
|
|
@ -2593,7 +2593,7 @@ static int journal_init_dev(struct super_block *super,
|
|||
{
|
||||
int result;
|
||||
dev_t jdev;
|
||||
int blkdev_mode = FMODE_READ | FMODE_WRITE;
|
||||
fmode_t blkdev_mode = FMODE_READ | FMODE_WRITE;
|
||||
char b[BDEVNAME_SIZE];
|
||||
|
||||
result = 0;
|
||||
|
|
|
@ -910,7 +910,8 @@ static inline int sb_issue_discard(struct super_block *sb,
|
|||
* command filter functions
|
||||
*/
|
||||
extern int blk_verify_command(struct blk_cmd_filter *filter,
|
||||
unsigned char *cmd, int has_write_perm);
|
||||
unsigned char *cmd, fmode_t has_write_perm);
|
||||
extern void blk_unregister_filter(struct gendisk *disk);
|
||||
extern void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter);
|
||||
|
||||
#define MAX_PHYS_SEGMENTS 128
|
||||
|
|
|
@ -85,7 +85,7 @@ void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev);
|
|||
|
||||
struct dm_dev {
|
||||
struct block_device *bdev;
|
||||
int mode;
|
||||
fmode_t mode;
|
||||
char name[16];
|
||||
};
|
||||
|
||||
|
@ -95,7 +95,7 @@ struct dm_dev {
|
|||
* FIXME: too many arguments.
|
||||
*/
|
||||
int dm_get_device(struct dm_target *ti, const char *path, sector_t start,
|
||||
sector_t len, int mode, struct dm_dev **result);
|
||||
sector_t len, fmode_t mode, struct dm_dev **result);
|
||||
void dm_put_device(struct dm_target *ti, struct dm_dev *d);
|
||||
|
||||
/*
|
||||
|
@ -223,7 +223,7 @@ int dm_set_geometry(struct mapped_device *md, struct hd_geometry *geo);
|
|||
/*
|
||||
* First create an empty table.
|
||||
*/
|
||||
int dm_table_create(struct dm_table **result, int mode,
|
||||
int dm_table_create(struct dm_table **result, fmode_t mode,
|
||||
unsigned num_targets, struct mapped_device *md);
|
||||
|
||||
/*
|
||||
|
@ -254,7 +254,7 @@ void dm_table_put(struct dm_table *t);
|
|||
*/
|
||||
sector_t dm_table_get_size(struct dm_table *t);
|
||||
unsigned int dm_table_get_num_targets(struct dm_table *t);
|
||||
int dm_table_get_mode(struct dm_table *t);
|
||||
fmode_t dm_table_get_mode(struct dm_table *t);
|
||||
struct mapped_device *dm_table_get_md(struct dm_table *t);
|
||||
|
||||
/*
|
||||
|
|
|
@ -19,10 +19,10 @@ struct file_operations;
|
|||
struct vfsmount;
|
||||
struct dentry;
|
||||
extern int init_file(struct file *, struct vfsmount *mnt,
|
||||
struct dentry *dentry, mode_t mode,
|
||||
struct dentry *dentry, fmode_t mode,
|
||||
const struct file_operations *fop);
|
||||
extern struct file *alloc_file(struct vfsmount *, struct dentry *dentry,
|
||||
mode_t mode, const struct file_operations *fop);
|
||||
fmode_t mode, const struct file_operations *fop);
|
||||
|
||||
static inline void fput_light(struct file *file, int fput_needed)
|
||||
{
|
||||
|
|
|
@ -63,18 +63,18 @@ extern int dir_notify_enable;
|
|||
#define MAY_ACCESS 16
|
||||
#define MAY_OPEN 32
|
||||
|
||||
#define FMODE_READ 1
|
||||
#define FMODE_WRITE 2
|
||||
#define FMODE_READ ((__force fmode_t)1)
|
||||
#define FMODE_WRITE ((__force fmode_t)2)
|
||||
|
||||
/* Internal kernel extensions */
|
||||
#define FMODE_LSEEK 4
|
||||
#define FMODE_PREAD 8
|
||||
#define FMODE_LSEEK ((__force fmode_t)4)
|
||||
#define FMODE_PREAD ((__force fmode_t)8)
|
||||
#define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */
|
||||
|
||||
/* File is being opened for execution. Primary users of this flag are
|
||||
distributed filesystems that can use it to achieve correct ETXTBUSY
|
||||
behavior for cross-node execution/opening_for_writing of files */
|
||||
#define FMODE_EXEC 16
|
||||
#define FMODE_EXEC ((__force fmode_t)16)
|
||||
|
||||
#define RW_MASK 1
|
||||
#define RWA_MASK 2
|
||||
|
@ -825,7 +825,7 @@ struct file {
|
|||
const struct file_operations *f_op;
|
||||
atomic_long_t f_count;
|
||||
unsigned int f_flags;
|
||||
mode_t f_mode;
|
||||
fmode_t f_mode;
|
||||
loff_t f_pos;
|
||||
struct fown_struct f_owner;
|
||||
unsigned int f_uid, f_gid;
|
||||
|
@ -1714,7 +1714,7 @@ extern struct block_device *bdget(dev_t);
|
|||
extern void bd_set_size(struct block_device *, loff_t size);
|
||||
extern void bd_forget(struct inode *inode);
|
||||
extern void bdput(struct block_device *);
|
||||
extern struct block_device *open_by_devnum(dev_t, unsigned);
|
||||
extern struct block_device *open_by_devnum(dev_t, fmode_t);
|
||||
#else
|
||||
static inline void bd_forget(struct inode *inode) {}
|
||||
#endif
|
||||
|
@ -1729,7 +1729,7 @@ extern int blkdev_driver_ioctl(struct inode *inode, struct file *file,
|
|||
struct gendisk *disk, unsigned cmd,
|
||||
unsigned long arg);
|
||||
extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
|
||||
extern int blkdev_get(struct block_device *, mode_t, unsigned);
|
||||
extern int blkdev_get(struct block_device *, fmode_t, unsigned);
|
||||
extern int blkdev_put(struct block_device *);
|
||||
extern int bd_claim(struct block_device *, void *);
|
||||
extern void bd_release(struct block_device *);
|
||||
|
|
|
@ -188,7 +188,7 @@ static inline void fsnotify_close(struct file *file)
|
|||
struct dentry *dentry = file->f_path.dentry;
|
||||
struct inode *inode = dentry->d_inode;
|
||||
const char *name = dentry->d_name.name;
|
||||
mode_t mode = file->f_mode;
|
||||
fmode_t mode = file->f_mode;
|
||||
u32 mask = (mode & FMODE_WRITE) ? IN_CLOSE_WRITE : IN_CLOSE_NOWRITE;
|
||||
|
||||
if (S_ISDIR(inode->i_mode))
|
||||
|
|
|
@ -190,6 +190,7 @@ typedef __u32 __bitwise __wsum;
|
|||
|
||||
#ifdef __KERNEL__
|
||||
typedef unsigned __bitwise__ gfp_t;
|
||||
typedef unsigned __bitwise__ fmode_t;
|
||||
|
||||
#ifdef CONFIG_PHYS_ADDR_T_64BIT
|
||||
typedef u64 phys_addr_t;
|
||||
|
|
|
@ -817,7 +817,7 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
|
|||
struct ipc_namespace *ns;
|
||||
struct shm_file_data *sfd;
|
||||
struct path path;
|
||||
mode_t f_mode;
|
||||
fmode_t f_mode;
|
||||
|
||||
err = -EINVAL;
|
||||
if (shmid < 0)
|
||||
|
|
|
@ -2283,7 +2283,7 @@ static int snd_pcm_oss_open_file(struct file *file,
|
|||
int idx, err;
|
||||
struct snd_pcm_oss_file *pcm_oss_file;
|
||||
struct snd_pcm_substream *substream;
|
||||
unsigned int f_mode = file->f_mode;
|
||||
fmode_t f_mode = file->f_mode;
|
||||
|
||||
if (rpcm_oss_file)
|
||||
*rpcm_oss_file = NULL;
|
||||
|
|
|
@ -93,7 +93,7 @@ static struct au1550_state {
|
|||
spinlock_t lock;
|
||||
struct mutex open_mutex;
|
||||
struct mutex sem;
|
||||
mode_t open_mode;
|
||||
fmode_t open_mode;
|
||||
wait_queue_head_t open_wait;
|
||||
|
||||
struct dmabuf {
|
||||
|
|
|
@ -129,7 +129,7 @@ typedef struct {
|
|||
int (*mixer_ioctl)(u_int, u_long); /* optional */
|
||||
int (*write_sq_setup)(void); /* optional */
|
||||
int (*read_sq_setup)(void); /* optional */
|
||||
int (*sq_open)(mode_t); /* optional */
|
||||
int (*sq_open)(fmode_t); /* optional */
|
||||
int (*state_info)(char *, size_t); /* optional */
|
||||
void (*abort_read)(void); /* optional */
|
||||
int min_dsp_speed;
|
||||
|
@ -235,7 +235,7 @@ struct sound_queue {
|
|||
*/
|
||||
int active;
|
||||
wait_queue_head_t action_queue, open_queue, sync_queue;
|
||||
int open_mode;
|
||||
fmode_t open_mode;
|
||||
int busy, syncing, xruns, died;
|
||||
};
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ static int AtaMixerIoctl(u_int cmd, u_long arg);
|
|||
static int TTMixerIoctl(u_int cmd, u_long arg);
|
||||
static int FalconMixerIoctl(u_int cmd, u_long arg);
|
||||
static int AtaWriteSqSetup(void);
|
||||
static int AtaSqOpen(mode_t mode);
|
||||
static int AtaSqOpen(fmode_t mode);
|
||||
static int TTStateInfo(char *buffer, size_t space);
|
||||
static int FalconStateInfo(char *buffer, size_t space);
|
||||
|
||||
|
@ -1461,7 +1461,7 @@ static int AtaWriteSqSetup(void)
|
|||
return 0 ;
|
||||
}
|
||||
|
||||
static int AtaSqOpen(mode_t mode)
|
||||
static int AtaSqOpen(fmode_t mode)
|
||||
{
|
||||
write_sq_ignore_int = 1;
|
||||
return 0 ;
|
||||
|
|
|
@ -212,7 +212,7 @@ static int irq_installed;
|
|||
#endif /* MODULE */
|
||||
|
||||
/* control over who can modify resources shared between play/record */
|
||||
static mode_t shared_resource_owner;
|
||||
static fmode_t shared_resource_owner;
|
||||
static int shared_resources_initialised;
|
||||
|
||||
/*
|
||||
|
@ -668,7 +668,7 @@ static inline void sq_init_waitqueue(struct sound_queue *sq)
|
|||
|
||||
#if 0 /* blocking open() */
|
||||
static inline void sq_wake_up(struct sound_queue *sq, struct file *file,
|
||||
mode_t mode)
|
||||
fmode_t mode)
|
||||
{
|
||||
if (file->f_mode & mode) {
|
||||
sq->busy = 0; /* CHECK: IS THIS OK??? */
|
||||
|
@ -677,7 +677,7 @@ static inline void sq_wake_up(struct sound_queue *sq, struct file *file,
|
|||
}
|
||||
#endif
|
||||
|
||||
static int sq_open2(struct sound_queue *sq, struct file *file, mode_t mode,
|
||||
static int sq_open2(struct sound_queue *sq, struct file *file, fmode_t mode,
|
||||
int numbufs, int bufsize)
|
||||
{
|
||||
int rc = 0;
|
||||
|
@ -891,10 +891,10 @@ static int sq_release(struct inode *inode, struct file *file)
|
|||
is the owner - if we have problems.
|
||||
*/
|
||||
|
||||
static int shared_resources_are_mine(mode_t md)
|
||||
static int shared_resources_are_mine(fmode_t md)
|
||||
{
|
||||
if (shared_resource_owner)
|
||||
return (shared_resource_owner & md ) ;
|
||||
return (shared_resource_owner & md) != 0;
|
||||
else {
|
||||
shared_resource_owner = md ;
|
||||
return 1 ;
|
||||
|
|
|
@ -211,7 +211,7 @@ typedef struct multisound_dev {
|
|||
|
||||
/* State variables */
|
||||
enum { msndClassic, msndPinnacle } type;
|
||||
mode_t mode;
|
||||
fmode_t mode;
|
||||
unsigned long flags;
|
||||
#define F_RESETTING 0
|
||||
#define F_HAVEDIGITAL 1
|
||||
|
|
|
@ -110,24 +110,16 @@ struct channel_info {
|
|||
#define OPEN_WRITE PCM_ENABLE_OUTPUT
|
||||
#define OPEN_READWRITE (OPEN_READ|OPEN_WRITE)
|
||||
|
||||
#if OPEN_READ == FMODE_READ && OPEN_WRITE == FMODE_WRITE
|
||||
|
||||
static inline int translate_mode(struct file *file)
|
||||
{
|
||||
return file->f_mode;
|
||||
if (OPEN_READ == (__force int)FMODE_READ &&
|
||||
OPEN_WRITE == (__force int)FMODE_WRITE)
|
||||
return (__force int)(file->f_mode & (FMODE_READ | FMODE_WRITE));
|
||||
else
|
||||
return ((file->f_mode & FMODE_READ) ? OPEN_READ : 0) |
|
||||
((file->f_mode & FMODE_WRITE) ? OPEN_WRITE : 0);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline int translate_mode(struct file *file)
|
||||
{
|
||||
return ((file->f_mode & FMODE_READ) ? OPEN_READ : 0) |
|
||||
((file->f_mode & FMODE_WRITE) ? OPEN_WRITE : 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#include "sound_calls.h"
|
||||
#include "dev_table.h"
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ struct cs4297a_state {
|
|||
struct mutex open_mutex;
|
||||
struct mutex open_sem_adc;
|
||||
struct mutex open_sem_dac;
|
||||
mode_t open_mode;
|
||||
fmode_t open_mode;
|
||||
wait_queue_head_t open_wait;
|
||||
wait_queue_head_t open_wait_adc;
|
||||
wait_queue_head_t open_wait_dac;
|
||||
|
|
|
@ -1509,7 +1509,7 @@ typedef struct vwsnd_dev {
|
|||
struct mutex open_mutex;
|
||||
struct mutex io_mutex;
|
||||
struct mutex mix_mutex;
|
||||
mode_t open_mode;
|
||||
fmode_t open_mode;
|
||||
wait_queue_head_t open_wait;
|
||||
|
||||
lithium_t lith;
|
||||
|
|
Loading…
Reference in a new issue