Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
oai
odroid-linux-3.10.y-rt
Commits
aeb5d727
Commit
aeb5d727
authored
Sep 02, 2008
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] introduce fmode_t, do annotations
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
2515ddc6
Changes
41
Hide whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
96 additions
and
98 deletions
+96
-98
block/bsg.c
block/bsg.c
+4
-3
block/cmd-filter.c
block/cmd-filter.c
+1
-1
block/scsi_ioctl.c
block/scsi_ioctl.c
+3
-2
drivers/block/amiflop.c
drivers/block/amiflop.c
+2
-2
drivers/block/ataflop.c
drivers/block/ataflop.c
+2
-2
drivers/block/floppy.c
drivers/block/floppy.c
+2
-2
drivers/block/paride/pf.c
drivers/block/paride/pf.c
+1
-1
drivers/block/paride/pt.c
drivers/block/paride/pt.c
+1
-1
drivers/block/pktcdvd.c
drivers/block/pktcdvd.c
+1
-1
drivers/block/swim3.c
drivers/block/swim3.c
+2
-2
drivers/char/nvram.c
drivers/char/nvram.c
+3
-3
drivers/ide/ide-floppy_ioctl.c
drivers/ide/ide-floppy_ioctl.c
+1
-1
drivers/ide/ide-gd.c
drivers/ide/ide-gd.c
+1
-1
drivers/md/dm-ioctl.c
drivers/md/dm-ioctl.c
+2
-2
drivers/md/dm-table.c
drivers/md/dm-table.c
+6
-6
drivers/mtd/mtdchar.c
drivers/mtd/mtdchar.c
+5
-5
drivers/parisc/eisa_eeprom.c
drivers/parisc/eisa_eeprom.c
+1
-1
fs/block_dev.c
fs/block_dev.c
+5
-5
fs/fifo.c
fs/fifo.c
+3
-3
fs/file_table.c
fs/file_table.c
+2
-2
fs/hostfs/hostfs_kern.c
fs/hostfs/hostfs_kern.c
+3
-2
fs/locks.c
fs/locks.c
+2
-1
fs/open.c
fs/open.c
+1
-1
fs/proc/base.c
fs/proc/base.c
+2
-2
fs/reiserfs/journal.c
fs/reiserfs/journal.c
+1
-1
include/linux/blkdev.h
include/linux/blkdev.h
+2
-1
include/linux/device-mapper.h
include/linux/device-mapper.h
+4
-4
include/linux/file.h
include/linux/file.h
+2
-2
include/linux/fs.h
include/linux/fs.h
+8
-8
include/linux/fsnotify.h
include/linux/fsnotify.h
+1
-1
include/linux/types.h
include/linux/types.h
+1
-0
ipc/shm.c
ipc/shm.c
+1
-1
sound/core/oss/pcm_oss.c
sound/core/oss/pcm_oss.c
+1
-1
sound/oss/au1550_ac97.c
sound/oss/au1550_ac97.c
+1
-1
sound/oss/dmasound/dmasound.h
sound/oss/dmasound/dmasound.h
+2
-2
sound/oss/dmasound/dmasound_atari.c
sound/oss/dmasound/dmasound_atari.c
+2
-2
sound/oss/dmasound/dmasound_core.c
sound/oss/dmasound/dmasound_core.c
+5
-5
sound/oss/msnd.h
sound/oss/msnd.h
+1
-1
sound/oss/sound_config.h
sound/oss/sound_config.h
+6
-14
sound/oss/swarm_cs4297a.c
sound/oss/swarm_cs4297a.c
+1
-1
sound/oss/vwsnd.c
sound/oss/vwsnd.c
+1
-1
No files found.
block/bsg.c
View file @
aeb5d727
...
...
@@ -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
,
in
t
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
,
in
t
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
;
...
...
block/cmd-filter.c
View file @
aeb5d727
...
...
@@ -27,7 +27,7 @@
#include <linux/cdrom.h>
int
blk_verify_command
(
struct
blk_cmd_filter
*
filter
,
unsigned
char
*
cmd
,
in
t
has_write_perm
)
unsigned
char
*
cmd
,
fmode_
t
has_write_perm
)
{
/* root can do any command. */
if
(
capable
(
CAP_SYS_RAWIO
))
...
...
block/scsi_ioctl.c
View file @
aeb5d727
...
...
@@ -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
)
...
...
drivers/block/amiflop.c
View file @
aeb5d727
...
...
@@ -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
);
...
...
drivers/block/ataflop.c
View file @
aeb5d727
...
...
@@ -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
;
...
...
drivers/block/floppy.c
View file @
aeb5d727
...
...
@@ -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
);
...
...
drivers/block/paride/pf.c
View file @
aeb5d727
...
...
@@ -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
++
;
...
...
drivers/block/paride/pt.c
View file @
aeb5d727
...
...
@@ -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
))
...
...
drivers/block/pktcdvd.c
View file @
aeb5d727
...
...
@@ -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
,
in
t
write
)
static
int
pkt_open_dev
(
struct
pktcdvd_device
*
pd
,
fmode_
t
write
)
{
int
ret
;
long
lba
;
...
...
drivers/block/swim3.c
View file @
aeb5d727
...
...
@@ -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
)
...
...
drivers/char/nvram.c
View file @
aeb5d727
...
...
@@ -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
);
...
...
drivers/ide/ide-floppy_ioctl.c
View file @
aeb5d727
...
...
@@ -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
:
...
...
drivers/ide/ide-gd.c
View file @
aeb5d727
...
...
@@ -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
;
}
...
...
drivers/md/dm-ioctl.c
View file @
aeb5d727
...
...
@@ -988,9 +988,9 @@ static int dev_wait(struct dm_ioctl *param, size_t param_size)
return
r
;
}
static
inline
in
t
get_mode
(
struct
dm_ioctl
*
param
)
static
inline
fmode_
t
get_mode
(
struct
dm_ioctl
*
param
)
{
in
t
mode
=
FMODE_READ
|
FMODE_WRITE
;
fmode_
t
mode
=
FMODE_READ
|
FMODE_WRITE
;
if
(
param
->
flags
&
DM_READONLY_FLAG
)
mode
=
FMODE_READ
;
...
...
drivers/md/dm-table.c
View file @
aeb5d727
...
...
@@ -43,7 +43,7 @@ struct dm_table {
* device. This should be a combination of FMODE_READ
* and FMODE_WRITE.
*/
in
t
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
,
in
t
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
,
in
t
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
,
in
t
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
,
in
t
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
;
}
in
t
dm_table_get_mode
(
struct
dm_table
*
t
)
fmode_
t
dm_table_get_mode
(
struct
dm_table
*
t
)
{
return
t
->
mode
;
}
...
...
drivers/mtd/mtdchar.c
View file @
aeb5d727
...
...
@@ -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
)))
...
...
drivers/parisc/eisa_eeprom.c
View file @
aeb5d727
...
...
@@ -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
;
...
...
fs/block_dev.c
View file @
aeb5d727
...
...
@@ -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
,
f
mode_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
,
f
mode_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
,
f
mode_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
;
f
mode_t
mode
=
FMODE_READ
;
int
error
=
0
;
bdev
=
lookup_bdev
(
path
);
...
...
fs/fifo.c
View file @
aeb5d727
...
...
@@ -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.
...
...
fs/file_table.c
View file @
aeb5d727
...
...
@@ -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
)
f
mode_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
)
f
mode_t
mode
,
const
struct
file_operations
*
fop
)
{
int
error
=
0
;
file
->
f_path
.
dentry
=
dentry
;
...
...
fs/hostfs/hostfs_kern.c
View file @
aeb5d727
...
...
@@ -20,7 +20,7 @@
struct
hostfs_inode_info
{
char
*
host_filename
;
int
fd
;
in
t
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
)
...
...
fs/locks.c
View file @
aeb5d727
...
...
@@ -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
);
...
...
fs/open.c
View file @
aeb5d727
...
...
@@ -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
)
{
...
...
fs/proc/base.c
View file @
aeb5d727
...
...
@@ -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
);
...
...
fs/reiserfs/journal.c
View file @
aeb5d727
...
...
@@ -2593,7 +2593,7 @@ static int journal_init_dev(struct super_block *super,
{
int
result
;
dev_t
jdev
;
in
t
blkdev_mode
=
FMODE_READ
|
FMODE_WRITE
;
fmode_
t
blkdev_mode
=
FMODE_READ
|
FMODE_WRITE
;
char
b
[
BDEVNAME_SIZE
];
result
=
0
;
...
...
include/linux/blkdev.h
View file @
aeb5d727
...
...
@@ -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
...
...
include/linux/device-mapper.h
View file @
aeb5d727
...
...
@@ -85,7 +85,7 @@ void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev);
struct
dm_dev
{
struct
block_device
*
bdev
;
in
t
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
,
in
t
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
,
in
t
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
);
in
t
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
);
/*
...
...
include/linux/file.h
View file @
aeb5d727
...
...
@@ -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
,
f
mode_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
);
f
mode_t
mode
,
const
struct
file_operations
*
fop
);
static
inline
void
fput_light
(
struct
file
*
file
,
int
fput_needed
)
{
...
...
include/linux/fs.h
View file @
aeb5d727
...
...
@@ -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
;
f
mode_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
*
,
f
mode_t
,
unsigned
);
extern
int
blkdev_put
(
struct
block_device
*
);
extern
int
bd_claim
(
struct
block_device
*
,
void
*
);
extern
void
bd_release
(
struct
block_device
*
);
...
...
include/linux/fsnotify.h
View file @
aeb5d727
...
...
@@ -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
;
f
mode_t
mode
=
file
->
f_mode
;
u32
mask
=
(
mode
&
FMODE_WRITE
)
?
IN_CLOSE_WRITE
:
IN_CLOSE_NOWRITE
;
if
(
S_ISDIR
(
inode
->
i_mode
))
...
...
include/linux/types.h
View file @
aeb5d727
...
...
@@ -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
;
...
...
ipc/shm.c
View file @
aeb5d727
...
...
@@ -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
;
f
mode_t
f_mode
;
err
=
-
EINVAL
;
if
(
shmid
<
0
)
...
...
sound/core/oss/pcm_oss.c
View file @
aeb5d727
...
...
@@ -2283,7 +2283,7 @@ static int snd_pcm_oss_open_file(struct file *file,
int
idx
,
err
;