Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
aeb5d727
K
Kernel
项目概览
openeuler
/
Kernel
接近 2 年 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
aeb5d727
编写于
9月 02, 2008
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[PATCH] introduce fmode_t, do annotations
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
2515ddc6
变更
41
隐藏空白更改
内联
并排
Showing
41 changed file
with
96 addition
and
98 deletion
+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
未找到文件。
block/bsg.c
浏览文件 @
aeb5d727
...
@@ -173,7 +173,7 @@ static int bsg_io_schedule(struct bsg_device *bd)
...
@@ -173,7 +173,7 @@ static int bsg_io_schedule(struct bsg_device *bd)
static
int
blk_fill_sgv4_hdr_rq
(
struct
request_queue
*
q
,
struct
request
*
rq
,
static
int
blk_fill_sgv4_hdr_rq
(
struct
request_queue
*
q
,
struct
request
*
rq
,
struct
sg_io_v4
*
hdr
,
struct
bsg_device
*
bd
,
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
)
{
if
(
hdr
->
request_len
>
BLK_MAX_CDB
)
{
rq
->
cmd
=
kzalloc
(
hdr
->
request_len
,
GFP_KERNEL
);
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)
...
@@ -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.
* map sg_io_v4 to a request.
*/
*/
static
struct
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_queue
*
q
=
bd
->
queue
;
struct
request
*
rq
,
*
next_rq
=
NULL
;
struct
request
*
rq
,
*
next_rq
=
NULL
;
...
@@ -601,7 +601,8 @@ bsg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
...
@@ -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
,
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
bsg_command
*
bc
;
struct
request
*
rq
;
struct
request
*
rq
;
...
...
block/cmd-filter.c
浏览文件 @
aeb5d727
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
#include <linux/cdrom.h>
#include <linux/cdrom.h>
int
blk_verify_command
(
struct
blk_cmd_filter
*
filter
,
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. */
/* root can do any command. */
if
(
capable
(
CAP_SYS_RAWIO
))
if
(
capable
(
CAP_SYS_RAWIO
))
...
...
block/scsi_ioctl.c
浏览文件 @
aeb5d727
...
@@ -384,7 +384,8 @@ int sg_scsi_ioctl(struct file *file, struct request_queue *q,
...
@@ -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
gendisk
*
disk
,
struct
scsi_ioctl_command
__user
*
sic
)
{
{
struct
request
*
rq
;
struct
request
*
rq
;
int
err
,
write_perm
=
0
;
int
err
;
fmode_t
write_perm
=
0
;
unsigned
int
in_len
,
out_len
,
bytes
,
opcode
,
cmdlen
;
unsigned
int
in_len
,
out_len
,
bytes
,
opcode
,
cmdlen
;
char
*
buffer
=
NULL
,
sense
[
SCSI_SENSE_BUFFERSIZE
];
char
*
buffer
=
NULL
,
sense
[
SCSI_SENSE_BUFFERSIZE
];
...
@@ -428,7 +429,7 @@ int sg_scsi_ioctl(struct file *file, struct request_queue *q,
...
@@ -428,7 +429,7 @@ int sg_scsi_ioctl(struct file *file, struct request_queue *q,
/* scsi_ioctl passes NULL */
/* scsi_ioctl passes NULL */
if
(
file
&&
(
file
->
f_mode
&
FMODE_WRITE
))
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
);
err
=
blk_verify_command
(
&
q
->
cmd_filter
,
rq
->
cmd
,
write_perm
);
if
(
err
)
if
(
err
)
...
...
drivers/block/amiflop.c
浏览文件 @
aeb5d727
...
@@ -1560,9 +1560,9 @@ static int floppy_open(struct inode *inode, struct file *filp)
...
@@ -1560,9 +1560,9 @@ static int floppy_open(struct inode *inode, struct file *filp)
if
(
fd_ref
[
drive
]
&&
old_dev
!=
system
)
if
(
fd_ref
[
drive
]
&&
old_dev
!=
system
)
return
-
EBUSY
;
return
-
EBUSY
;
if
(
filp
&&
filp
->
f_mode
&
3
)
{
if
(
filp
&&
filp
->
f_mode
&
(
FMODE_READ
|
FMODE_WRITE
)
)
{
check_disk_change
(
inode
->
i_bdev
);
check_disk_change
(
inode
->
i_bdev
);
if
(
filp
->
f_mode
&
2
)
{
if
(
filp
->
f_mode
&
FMODE_WRITE
)
{
int
wrprot
;
int
wrprot
;
get_fdc
(
drive
);
get_fdc
(
drive
);
...
...
drivers/block/ataflop.c
浏览文件 @
aeb5d727
...
@@ -1826,9 +1826,9 @@ static int floppy_open( struct inode *inode, struct file *filp )
...
@@ -1826,9 +1826,9 @@ static int floppy_open( struct inode *inode, struct file *filp )
if
(
filp
->
f_flags
&
O_NDELAY
)
if
(
filp
->
f_flags
&
O_NDELAY
)
return
0
;
return
0
;
if
(
filp
->
f_mode
&
3
)
{
if
(
filp
->
f_mode
&
(
FMODE_READ
|
FMODE_WRITE
)
)
{
check_disk_change
(
inode
->
i_bdev
);
check_disk_change
(
inode
->
i_bdev
);
if
(
filp
->
f_mode
&
2
)
{
if
(
filp
->
f_mode
&
FMODE_WRITE
)
{
if
(
p
->
wpstat
)
{
if
(
p
->
wpstat
)
{
if
(
p
->
ref
<
0
)
if
(
p
->
ref
<
0
)
p
->
ref
=
0
;
p
->
ref
=
0
;
...
...
drivers/block/floppy.c
浏览文件 @
aeb5d727
...
@@ -3761,14 +3761,14 @@ static int floppy_open(struct inode *inode, struct file *filp)
...
@@ -3761,14 +3761,14 @@ static int floppy_open(struct inode *inode, struct file *filp)
UFDCS
->
rawcmd
=
2
;
UFDCS
->
rawcmd
=
2
;
if
(
!
(
filp
->
f_flags
&
O_NDELAY
))
{
if
(
!
(
filp
->
f_flags
&
O_NDELAY
))
{
if
(
filp
->
f_mode
&
3
)
{
if
(
filp
->
f_mode
&
(
FMODE_READ
|
FMODE_WRITE
)
)
{
UDRS
->
last_checked
=
0
;
UDRS
->
last_checked
=
0
;
check_disk_change
(
inode
->
i_bdev
);
check_disk_change
(
inode
->
i_bdev
);
if
(
UTESTF
(
FD_DISK_CHANGED
))
if
(
UTESTF
(
FD_DISK_CHANGED
))
goto
out
;
goto
out
;
}
}
res
=
-
EROFS
;
res
=
-
EROFS
;
if
((
filp
->
f_mode
&
2
)
&&
!
(
UTESTF
(
FD_DISK_WRITABLE
)))
if
((
filp
->
f_mode
&
FMODE_WRITE
)
&&
!
(
UTESTF
(
FD_DISK_WRITABLE
)))
goto
out
;
goto
out
;
}
}
mutex_unlock
(
&
open_lock
);
mutex_unlock
(
&
open_lock
);
...
...
drivers/block/paride/pf.c
浏览文件 @
aeb5d727
...
@@ -305,7 +305,7 @@ static int pf_open(struct inode *inode, struct file *file)
...
@@ -305,7 +305,7 @@ static int pf_open(struct inode *inode, struct file *file)
if
(
pf
->
media_status
==
PF_NM
)
if
(
pf
->
media_status
==
PF_NM
)
return
-
ENODEV
;
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
;
return
-
EROFS
;
pf
->
access
++
;
pf
->
access
++
;
...
...
drivers/block/paride/pt.c
浏览文件 @
aeb5d727
...
@@ -667,7 +667,7 @@ static int pt_open(struct inode *inode, struct file *file)
...
@@ -667,7 +667,7 @@ static int pt_open(struct inode *inode, struct file *file)
goto
out
;
goto
out
;
err
=
-
EROFS
;
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
;
goto
out
;
if
(
!
(
iminor
(
inode
)
&
128
))
if
(
!
(
iminor
(
inode
)
&
128
))
...
...
drivers/block/pktcdvd.c
浏览文件 @
aeb5d727
...
@@ -2320,7 +2320,7 @@ static int pkt_open_write(struct pktcdvd_device *pd)
...
@@ -2320,7 +2320,7 @@ static int pkt_open_write(struct pktcdvd_device *pd)
/*
/*
* called at open time.
* 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
;
int
ret
;
long
lba
;
long
lba
;
...
...
drivers/block/swim3.c
浏览文件 @
aeb5d727
...
@@ -908,13 +908,13 @@ static int floppy_open(struct inode *inode, struct file *filp)
...
@@ -908,13 +908,13 @@ static int floppy_open(struct inode *inode, struct file *filp)
return
-
EBUSY
;
return
-
EBUSY
;
if
(
err
==
0
&&
(
filp
->
f_flags
&
O_NDELAY
)
==
0
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
);
check_disk_change
(
inode
->
i_bdev
);
if
(
fs
->
ejected
)
if
(
fs
->
ejected
)
err
=
-
ENXIO
;
err
=
-
ENXIO
;
}
}
if
(
err
==
0
&&
(
filp
->
f_mode
&
2
))
{
if
(
err
==
0
&&
(
filp
->
f_mode
&
FMODE_WRITE
))
{
if
(
fs
->
write_prot
<
0
)
if
(
fs
->
write_prot
<
0
)
fs
->
write_prot
=
swim3_readbit
(
fs
,
WRITE_PROT
);
fs
->
write_prot
=
swim3_readbit
(
fs
,
WRITE_PROT
);
if
(
fs
->
write_prot
)
if
(
fs
->
write_prot
)
...
...
drivers/char/nvram.c
浏览文件 @
aeb5d727
...
@@ -338,7 +338,7 @@ nvram_open(struct inode *inode, struct file *file)
...
@@ -338,7 +338,7 @@ nvram_open(struct inode *inode, struct file *file)
if
((
nvram_open_cnt
&&
(
file
->
f_flags
&
O_EXCL
))
||
if
((
nvram_open_cnt
&&
(
file
->
f_flags
&
O_EXCL
))
||
(
nvram_open_mode
&
NVRAM_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
);
spin_unlock
(
&
nvram_state_lock
);
unlock_kernel
();
unlock_kernel
();
return
-
EBUSY
;
return
-
EBUSY
;
...
@@ -346,7 +346,7 @@ nvram_open(struct inode *inode, struct file *file)
...
@@ -346,7 +346,7 @@ nvram_open(struct inode *inode, struct file *file)
if
(
file
->
f_flags
&
O_EXCL
)
if
(
file
->
f_flags
&
O_EXCL
)
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
;
nvram_open_mode
|=
NVRAM_WRITE
;
nvram_open_cnt
++
;
nvram_open_cnt
++
;
...
@@ -366,7 +366,7 @@ nvram_release(struct inode *inode, struct file *file)
...
@@ -366,7 +366,7 @@ nvram_release(struct inode *inode, struct file *file)
/* if only one instance is open, clear the EXCL bit */
/* if only one instance is open, clear the EXCL bit */
if
(
nvram_open_mode
&
NVRAM_EXCL
)
if
(
nvram_open_mode
&
NVRAM_EXCL
)
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
;
nvram_open_mode
&=
~
NVRAM_WRITE
;
spin_unlock
(
&
nvram_state_lock
);
spin_unlock
(
&
nvram_state_lock
);
...
...
drivers/ide/ide-floppy_ioctl.c
浏览文件 @
aeb5d727
...
@@ -250,7 +250,7 @@ static int ide_floppy_format_ioctl(ide_drive_t *drive, struct file *file,
...
@@ -250,7 +250,7 @@ static int ide_floppy_format_ioctl(ide_drive_t *drive, struct file *file,
case
IDEFLOPPY_IOCTL_FORMAT_GET_CAPACITY
:
case
IDEFLOPPY_IOCTL_FORMAT_GET_CAPACITY
:
return
ide_floppy_get_format_capacities
(
drive
,
argp
);
return
ide_floppy_get_format_capacities
(
drive
,
argp
);
case
IDEFLOPPY_IOCTL_FORMAT_START
:
case
IDEFLOPPY_IOCTL_FORMAT_START
:
if
(
!
(
file
->
f_mode
&
2
))
if
(
!
(
file
->
f_mode
&
FMODE_WRITE
))
return
-
EPERM
;
return
-
EPERM
;
return
ide_floppy_format_unit
(
drive
,
(
int
__user
*
)
argp
);
return
ide_floppy_format_unit
(
drive
,
(
int
__user
*
)
argp
);
case
IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS
:
case
IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS
:
...
...
drivers/ide/ide-gd.c
浏览文件 @
aeb5d727
...
@@ -202,7 +202,7 @@ static int ide_gd_open(struct inode *inode, struct file *filp)
...
@@ -202,7 +202,7 @@ static int ide_gd_open(struct inode *inode, struct file *filp)
goto
out_put_idkp
;
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
;
ret
=
-
EROFS
;
goto
out_put_idkp
;
goto
out_put_idkp
;
}
}
...
...
drivers/md/dm-ioctl.c
浏览文件 @
aeb5d727
...
@@ -988,9 +988,9 @@ static int dev_wait(struct dm_ioctl *param, size_t param_size)
...
@@ -988,9 +988,9 @@ static int dev_wait(struct dm_ioctl *param, size_t param_size)
return
r
;
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
)
if
(
param
->
flags
&
DM_READONLY_FLAG
)
mode
=
FMODE_READ
;
mode
=
FMODE_READ
;
...
...
drivers/md/dm-table.c
浏览文件 @
aeb5d727
...
@@ -43,7 +43,7 @@ struct dm_table {
...
@@ -43,7 +43,7 @@ struct dm_table {
* device. This should be a combination of FMODE_READ
* device. This should be a combination of FMODE_READ
* and FMODE_WRITE.
* and FMODE_WRITE.
*/
*/
in
t
mode
;
fmode_
t
mode
;
/* a list of devices used by this table */
/* a list of devices used by this table */
struct
list_head
devices
;
struct
list_head
devices
;
...
@@ -217,7 +217,7 @@ static int alloc_targets(struct dm_table *t, unsigned int num)
...
@@ -217,7 +217,7 @@ static int alloc_targets(struct dm_table *t, unsigned int num)
return
0
;
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
)
unsigned
num_targets
,
struct
mapped_device
*
md
)
{
{
struct
dm_table
*
t
=
kzalloc
(
sizeof
(
*
t
),
GFP_KERNEL
);
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,
...
@@ -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
* careful to leave things as they were if we fail to reopen the
* device.
* 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
)
struct
mapped_device
*
md
)
{
{
int
r
;
int
r
;
...
@@ -421,7 +421,7 @@ static int upgrade_mode(struct dm_dev_internal *dd, int new_mode,
...
@@ -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
,
static
int
__table_get_device
(
struct
dm_table
*
t
,
struct
dm_target
*
ti
,
const
char
*
path
,
sector_t
start
,
sector_t
len
,
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
;
int
r
;
dev_t
uninitialized_var
(
dev
);
dev_t
uninitialized_var
(
dev
);
...
@@ -537,7 +537,7 @@ void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev)
...
@@ -537,7 +537,7 @@ void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev)
EXPORT_SYMBOL_GPL
(
dm_set_device_limits
);
EXPORT_SYMBOL_GPL
(
dm_set_device_limits
);
int
dm_get_device
(
struct
dm_target
*
ti
,
const
char
*
path
,
sector_t
start
,
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
,
int
r
=
__table_get_device
(
ti
->
table
,
ti
,
path
,
start
,
len
,
mode
,
result
);
start
,
len
,
mode
,
result
);
...
@@ -887,7 +887,7 @@ struct list_head *dm_table_get_devices(struct dm_table *t)
...
@@ -887,7 +887,7 @@ struct list_head *dm_table_get_devices(struct dm_table *t)
return
&
t
->
devices
;
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
;
return
t
->
mode
;
}
}
...
...
drivers/mtd/mtdchar.c
浏览文件 @
aeb5d727
...
@@ -96,7 +96,7 @@ static int mtd_open(struct inode *inode, struct file *file)
...
@@ -96,7 +96,7 @@ static int mtd_open(struct inode *inode, struct file *file)
return
-
ENODEV
;
return
-
ENODEV
;
/* You can't open the RO devices RW */
/* 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
;
return
-
EACCES
;
lock_kernel
();
lock_kernel
();
...
@@ -114,7 +114,7 @@ static int mtd_open(struct inode *inode, struct file *file)
...
@@ -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 */
/* 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
);
put_mtd_device
(
mtd
);
ret
=
-
EACCES
;
ret
=
-
EACCES
;
goto
out
;
goto
out
;
...
@@ -144,7 +144,7 @@ static int mtd_close(struct inode *inode, struct file *file)
...
@@ -144,7 +144,7 @@ static int mtd_close(struct inode *inode, struct file *file)
DEBUG
(
MTD_DEBUG_LEVEL0
,
"MTD_close
\n
"
);
DEBUG
(
MTD_DEBUG_LEVEL0
,
"MTD_close
\n
"
);
/* Only sync if opened RW */
/* Only sync if opened RW */
if
((
file
->
f_mode
&
2
)
&&
mtd
->
sync
)
if
((
file
->
f_mode
&
FMODE_WRITE
)
&&
mtd
->
sync
)
mtd
->
sync
(
mtd
);
mtd
->
sync
(
mtd
);
put_mtd_device
(
mtd
);
put_mtd_device
(
mtd
);
...
@@ -443,7 +443,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
...
@@ -443,7 +443,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
{
{
struct
erase_info
*
erase
;
struct
erase_info
*
erase
;
if
(
!
(
file
->
f_mode
&
2
))
if
(
!
(
file
->
f_mode
&
FMODE_WRITE
))
return
-
EPERM
;
return
-
EPERM
;
erase
=
kzalloc
(
sizeof
(
struct
erase_info
),
GFP_KERNEL
);
erase
=
kzalloc
(
sizeof
(
struct
erase_info
),
GFP_KERNEL
);
...
@@ -497,7 +497,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
...
@@ -497,7 +497,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
struct
mtd_oob_buf
__user
*
user_buf
=
argp
;
struct
mtd_oob_buf
__user
*
user_buf
=
argp
;
uint32_t
retlen
;
uint32_t
retlen
;
if
(
!
(
file
->
f_mode
&
2
))
if
(
!
(
file
->
f_mode
&
FMODE_WRITE
))
return
-
EPERM
;
return
-
EPERM
;
if
(
copy_from_user
(
&
buf
,
argp
,
sizeof
(
struct
mtd_oob_buf
)))
if
(
copy_from_user
(
&
buf
,
argp
,
sizeof
(
struct
mtd_oob_buf
)))
...
...
drivers/parisc/eisa_eeprom.c
浏览文件 @
aeb5d727
...
@@ -86,7 +86,7 @@ static int eisa_eeprom_open(struct inode *inode, struct file *file)
...
@@ -86,7 +86,7 @@ static int eisa_eeprom_open(struct inode *inode, struct file *file)
{
{
cycle_kernel_lock
();
cycle_kernel_lock
();
if
(
file
->
f_mode
&
2
)
if
(
file
->
f_mode
&
FMODE_WRITE
)
return
-
EINVAL
;
return
-
EINVAL
;
return
0
;
return
0
;
...
...
fs/block_dev.c
浏览文件 @
aeb5d727
...
@@ -840,7 +840,7 @@ EXPORT_SYMBOL_GPL(bd_release_from_disk);
...
@@ -840,7 +840,7 @@ EXPORT_SYMBOL_GPL(bd_release_from_disk);
* to be used for internal purposes. If you ever need it - reconsider
* to be used for internal purposes. If you ever need it - reconsider
* your API.
* 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
);
struct
block_device
*
bdev
=
bdget
(
dev
);
int
err
=
-
ENOMEM
;
int
err
=
-
ENOMEM
;
...
@@ -975,7 +975,7 @@ void bd_set_size(struct block_device *bdev, loff_t size)
...
@@ -975,7 +975,7 @@ void bd_set_size(struct block_device *bdev, loff_t size)
}
}
EXPORT_SYMBOL
(
bd_set_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
);
int
for_part
);
static
int
__blkdev_put
(
struct
block_device
*
bdev
,
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)
...
@@ -1104,7 +1104,7 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part)
return
ret
;
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
)
int
for_part
)
{
{
/*
/*
...
@@ -1123,7 +1123,7 @@ static int __blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags,
...
@@ -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
);
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
);
return
__blkdev_get
(
bdev
,
mode
,
flags
,
0
);
}
}
...
@@ -1315,7 +1315,7 @@ EXPORT_SYMBOL(lookup_bdev);
...
@@ -1315,7 +1315,7 @@ EXPORT_SYMBOL(lookup_bdev);
struct
block_device
*
open_bdev_excl
(
const
char
*
path
,
int
flags
,
void
*
holder
)
struct
block_device
*
open_bdev_excl
(
const
char
*
path
,
int
flags
,
void
*
holder
)
{
{
struct
block_device
*
bdev
;
struct
block_device
*
bdev
;
mode_t
mode
=
FMODE_READ
;
f
mode_t
mode
=
FMODE_READ
;
int
error
=
0
;
int
error
=
0
;
bdev
=
lookup_bdev
(
path
);
bdev
=
lookup_bdev
(
path
);
...
...
fs/fifo.c
浏览文件 @
aeb5d727
...
@@ -51,7 +51,7 @@ static int fifo_open(struct inode *inode, struct file *filp)
...
@@ -51,7 +51,7 @@ static int fifo_open(struct inode *inode, struct file *filp)
filp
->
f_mode
&=
(
FMODE_READ
|
FMODE_WRITE
);
filp
->
f_mode
&=
(
FMODE_READ
|
FMODE_WRITE
);
switch
(
filp
->
f_mode
)
{
switch
(
filp
->
f_mode
)
{
case
1
:
case
FMODE_READ
:
/*
/*
* O_RDONLY
* O_RDONLY
* POSIX.1 says that O_NONBLOCK means return with the FIFO
* 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)
...
@@ -76,7 +76,7 @@ static int fifo_open(struct inode *inode, struct file *filp)
}
}
break
;
break
;
case
2
:
case
FMODE_WRITE
:
/*
/*
* O_WRONLY
* O_WRONLY
* POSIX.1 says that O_NONBLOCK means return -1 with
* POSIX.1 says that O_NONBLOCK means return -1 with
...
@@ -98,7 +98,7 @@ static int fifo_open(struct inode *inode, struct file *filp)
...
@@ -98,7 +98,7 @@ static int fifo_open(struct inode *inode, struct file *filp)
}
}
break
;
break
;
case
3
:
case
FMODE_READ
|
FMODE_WRITE
:
/*
/*
* O_RDWR
* O_RDWR
* POSIX.1 leaves this case "undefined" when O_NONBLOCK is set.
* POSIX.1 leaves this case "undefined" when O_NONBLOCK is set.
...
...
fs/file_table.c
浏览文件 @
aeb5d727
...
@@ -161,7 +161,7 @@ EXPORT_SYMBOL(get_empty_filp);
...
@@ -161,7 +161,7 @@ EXPORT_SYMBOL(get_empty_filp);
* code should be moved into this function.
* code should be moved into this function.
*/
*/
struct
file
*
alloc_file
(
struct
vfsmount
*
mnt
,
struct
dentry
*
dentry
,
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
file
*
file
;
struct
path
;
struct
path
;
...
@@ -193,7 +193,7 @@ EXPORT_SYMBOL(alloc_file);
...
@@ -193,7 +193,7 @@ EXPORT_SYMBOL(alloc_file);
* of this should be moving to alloc_file().
* of this should be moving to alloc_file().
*/
*/
int
init_file
(
struct
file
*
file
,
struct
vfsmount
*
mnt
,
struct
dentry
*
dentry
,
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
;
int
error
=
0
;
file
->
f_path
.
dentry
=
dentry
;
file
->
f_path
.
dentry
=
dentry
;
...
...
fs/hostfs/hostfs_kern.c
浏览文件 @
aeb5d727
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
struct
hostfs_inode_info
{
struct
hostfs_inode_info
{
char
*
host_filename
;
char
*
host_filename
;
int
fd
;
int
fd
;
in
t
mode
;
fmode_
t
mode
;
struct
inode
vfs_inode
;
struct
inode
vfs_inode
;
};
};
...
@@ -373,7 +373,8 @@ int hostfs_readdir(struct file *file, void *ent, filldir_t filldir)
...
@@ -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
)
int
hostfs_file_open
(
struct
inode
*
ino
,
struct
file
*
file
)
{
{
char
*
name
;
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
);
mode
=
file
->
f_mode
&
(
FMODE_READ
|
FMODE_WRITE
);
if
((
mode
&
HOSTFS_I
(
ino
)
->
mode
)
==
mode
)
if
((
mode
&
HOSTFS_I
(
ino
)
->
mode
)
==
mode
)
...
...
fs/locks.c
浏览文件 @
aeb5d727
...
@@ -1580,7 +1580,8 @@ asmlinkage long sys_flock(unsigned int fd, unsigned int cmd)
...
@@ -1580,7 +1580,8 @@ asmlinkage long sys_flock(unsigned int fd, unsigned int cmd)
cmd
&=
~
LOCK_NB
;
cmd
&=
~
LOCK_NB
;
unlock
=
(
cmd
==
LOCK_UN
);
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
;
goto
out_putf
;
error
=
flock_make_lock
(
filp
,
&
lock
,
cmd
);
error
=
flock_make_lock
(
filp
,
&
lock
,
cmd
);
...
...
fs/open.c
浏览文件 @
aeb5d727
...
@@ -798,7 +798,7 @@ static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt,
...
@@ -798,7 +798,7 @@ static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt,
int
error
;
int
error
;
f
->
f_flags
=
flags
;
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
;
FMODE_PREAD
|
FMODE_PWRITE
;
inode
=
dentry
->
d_inode
;
inode
=
dentry
->
d_inode
;
if
(
f
->
f_mode
&
FMODE_WRITE
)
{
if
(
f
->
f_mode
&
FMODE_WRITE
)
{
...
...
fs/proc/base.c
浏览文件 @
aeb5d727
...
@@ -1712,9 +1712,9 @@ static struct dentry *proc_fd_instantiate(struct inode *dir,
...
@@ -1712,9 +1712,9 @@ static struct dentry *proc_fd_instantiate(struct inode *dir,
file
=
fcheck_files
(
files
,
fd
);
file
=
fcheck_files
(
files
,
fd
);
if
(
!
file
)
if
(
!
file
)
goto
out_unlock
;
goto
out_unlock
;
if
(
file
->
f_mode
&
1
)
if
(
file
->
f_mode
&
FMODE_READ
)
inode
->
i_mode
|=
S_IRUSR
|
S_IXUSR
;
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
;
inode
->
i_mode
|=
S_IWUSR
|
S_IXUSR
;
spin_unlock
(
&
files
->
file_lock
);
spin_unlock
(
&
files
->
file_lock
);
put_files_struct
(
files
);
put_files_struct
(
files
);
...
...
fs/reiserfs/journal.c
浏览文件 @
aeb5d727
...
@@ -2593,7 +2593,7 @@ static int journal_init_dev(struct super_block *super,
...
@@ -2593,7 +2593,7 @@ static int journal_init_dev(struct super_block *super,
{
{
int
result
;
int
result
;
dev_t
jdev
;
dev_t
jdev
;
in
t
blkdev_mode
=
FMODE_READ
|
FMODE_WRITE
;
fmode_
t
blkdev_mode
=
FMODE_READ
|
FMODE_WRITE
;
char
b
[
BDEVNAME_SIZE
];
char
b
[
BDEVNAME_SIZE
];
result
=
0
;
result
=
0
;
...
...
include/linux/blkdev.h
浏览文件 @
aeb5d727
...
@@ -910,7 +910,8 @@ static inline int sb_issue_discard(struct super_block *sb,
...
@@ -910,7 +910,8 @@ static inline int sb_issue_discard(struct super_block *sb,
* command filter functions
* command filter functions
*/
*/
extern
int
blk_verify_command
(
struct
blk_cmd_filter
*
filter
,
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
);
extern
void
blk_set_cmd_filter_defaults
(
struct
blk_cmd_filter
*
filter
);
#define MAX_PHYS_SEGMENTS 128
#define MAX_PHYS_SEGMENTS 128
...
...
include/linux/device-mapper.h
浏览文件 @
aeb5d727
...
@@ -85,7 +85,7 @@ void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev);
...
@@ -85,7 +85,7 @@ void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev);
struct
dm_dev
{
struct
dm_dev
{
struct
block_device
*
bdev
;
struct
block_device
*
bdev
;
in
t
mode
;
fmode_
t
mode
;
char
name
[
16
];
char
name
[
16
];
};
};
...
@@ -95,7 +95,7 @@ struct dm_dev {
...
@@ -95,7 +95,7 @@ struct dm_dev {
* FIXME: too many arguments.
* FIXME: too many arguments.
*/
*/
int
dm_get_device
(
struct
dm_target
*
ti
,
const
char
*
path
,
sector_t
start
,
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
);
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);
...
@@ -223,7 +223,7 @@ int dm_set_geometry(struct mapped_device *md, struct hd_geometry *geo);
/*
/*
* First create an empty table.
* 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
);
unsigned
num_targets
,
struct
mapped_device
*
md
);
/*
/*
...
@@ -254,7 +254,7 @@ void dm_table_put(struct dm_table *t);
...
@@ -254,7 +254,7 @@ void dm_table_put(struct dm_table *t);
*/
*/
sector_t
dm_table_get_size
(
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
);
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
);
struct
mapped_device
*
dm_table_get_md
(
struct
dm_table
*
t
);
/*
/*
...
...
include/linux/file.h
浏览文件 @
aeb5d727
...
@@ -19,10 +19,10 @@ struct file_operations;
...
@@ -19,10 +19,10 @@ struct file_operations;
struct
vfsmount
;
struct
vfsmount
;
struct
dentry
;
struct
dentry
;
extern
int
init_file
(
struct
file
*
,
struct
vfsmount
*
mnt
,
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
);
const
struct
file_operations
*
fop
);
extern
struct
file
*
alloc_file
(
struct
vfsmount
*
,
struct
dentry
*
dentry
,
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
)
static
inline
void
fput_light
(
struct
file
*
file
,
int
fput_needed
)
{
{
...
...
include/linux/fs.h
浏览文件 @
aeb5d727
...
@@ -63,18 +63,18 @@ extern int dir_notify_enable;
...
@@ -63,18 +63,18 @@ extern int dir_notify_enable;
#define MAY_ACCESS 16
#define MAY_ACCESS 16
#define MAY_OPEN 32
#define MAY_OPEN 32
#define FMODE_READ
1
#define FMODE_READ
((__force fmode_t)1)
#define FMODE_WRITE
2
#define FMODE_WRITE
((__force fmode_t)2)
/* Internal kernel extensions */
/* Internal kernel extensions */
#define FMODE_LSEEK
4
#define FMODE_LSEEK
((__force fmode_t)4)
#define FMODE_PREAD
8
#define FMODE_PREAD
((__force fmode_t)8)
#define FMODE_PWRITE FMODE_PREAD
/* These go hand in hand */
#define FMODE_PWRITE FMODE_PREAD
/* These go hand in hand */
/* File is being opened for execution. Primary users of this flag are
/* File is being opened for execution. Primary users of this flag are
distributed filesystems that can use it to achieve correct ETXTBUSY
distributed filesystems that can use it to achieve correct ETXTBUSY
behavior for cross-node execution/opening_for_writing of files */
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 RW_MASK 1
#define RWA_MASK 2
#define RWA_MASK 2
...
@@ -825,7 +825,7 @@ struct file {
...
@@ -825,7 +825,7 @@ struct file {
const
struct
file_operations
*
f_op
;
const
struct
file_operations
*
f_op
;
atomic_long_t
f_count
;
atomic_long_t
f_count
;
unsigned
int
f_flags
;
unsigned
int
f_flags
;
mode_t
f_mode
;
f
mode_t
f_mode
;
loff_t
f_pos
;
loff_t
f_pos
;
struct
fown_struct
f_owner
;
struct
fown_struct
f_owner
;
unsigned
int
f_uid
,
f_gid
;
unsigned
int
f_uid
,
f_gid
;
...
@@ -1714,7 +1714,7 @@ extern struct block_device *bdget(dev_t);
...
@@ -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_set_size
(
struct
block_device
*
,
loff_t
size
);
extern
void
bd_forget
(
struct
inode
*
inode
);
extern
void
bd_forget
(
struct
inode
*
inode
);
extern
void
bdput
(
struct
block_device
*
);
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
#else
static
inline
void
bd_forget
(
struct
inode
*
inode
)
{}
static
inline
void
bd_forget
(
struct
inode
*
inode
)
{}
#endif
#endif
...
@@ -1729,7 +1729,7 @@ extern int blkdev_driver_ioctl(struct inode *inode, struct file *file,
...
@@ -1729,7 +1729,7 @@ extern int blkdev_driver_ioctl(struct inode *inode, struct file *file,
struct
gendisk
*
disk
,
unsigned
cmd
,
struct
gendisk
*
disk
,
unsigned
cmd
,
unsigned
long
arg
);
unsigned
long
arg
);
extern
long
compat_blkdev_ioctl
(
struct
file
*
,
unsigned
,
unsigned
long
);
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
blkdev_put
(
struct
block_device
*
);
extern
int
bd_claim
(
struct
block_device
*
,
void
*
);
extern
int
bd_claim
(
struct
block_device
*
,
void
*
);
extern
void
bd_release
(
struct
block_device
*
);
extern
void
bd_release
(
struct
block_device
*
);
...
...
include/linux/fsnotify.h
浏览文件 @
aeb5d727
...
@@ -188,7 +188,7 @@ static inline void fsnotify_close(struct file *file)
...
@@ -188,7 +188,7 @@ static inline void fsnotify_close(struct file *file)
struct
dentry
*
dentry
=
file
->
f_path
.
dentry
;
struct
dentry
*
dentry
=
file
->
f_path
.
dentry
;
struct
inode
*
inode
=
dentry
->
d_inode
;
struct
inode
*
inode
=
dentry
->
d_inode
;
const
char
*
name
=
dentry
->
d_name
.
name
;
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
;
u32
mask
=
(
mode
&
FMODE_WRITE
)
?
IN_CLOSE_WRITE
:
IN_CLOSE_NOWRITE
;
if
(
S_ISDIR
(
inode
->
i_mode
))
if
(
S_ISDIR
(
inode
->
i_mode
))
...
...
include/linux/types.h
浏览文件 @
aeb5d727
...
@@ -190,6 +190,7 @@ typedef __u32 __bitwise __wsum;
...
@@ -190,6 +190,7 @@ typedef __u32 __bitwise __wsum;
#ifdef __KERNEL__
#ifdef __KERNEL__
typedef
unsigned
__bitwise__
gfp_t
;
typedef
unsigned
__bitwise__
gfp_t
;
typedef
unsigned
__bitwise__
fmode_t
;
#ifdef CONFIG_PHYS_ADDR_T_64BIT
#ifdef CONFIG_PHYS_ADDR_T_64BIT
typedef
u64
phys_addr_t
;
typedef
u64
phys_addr_t
;
...
...
ipc/shm.c
浏览文件 @
aeb5d727
...
@@ -817,7 +817,7 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
...
@@ -817,7 +817,7 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
struct
ipc_namespace
*
ns
;
struct
ipc_namespace
*
ns
;
struct
shm_file_data
*
sfd
;
struct
shm_file_data
*
sfd
;
struct
path
path
;
struct
path
path
;
mode_t
f_mode
;
f
mode_t
f_mode
;
err
=
-
EINVAL
;
err
=
-
EINVAL
;
if
(
shmid
<
0
)
if
(
shmid
<
0
)
...
...
sound/core/oss/pcm_oss.c
浏览文件 @
aeb5d727
...
@@ -2283,7 +2283,7 @@ static int snd_pcm_oss_open_file(struct file *file,
...
@@ -2283,7 +2283,7 @@ static int snd_pcm_oss_open_file(struct file *file,
int
idx
,
err
;
int
idx
,
err
;
struct
snd_pcm_oss_file
*
pcm_oss_file
;
struct
snd_pcm_oss_file
*
pcm_oss_file
;
struct
snd_pcm_substream
*
substream
;
struct
snd_pcm_substream
*
substream
;
unsigned
in
t
f_mode
=
file
->
f_mode
;
fmode_
t
f_mode
=
file
->
f_mode
;
if
(
rpcm_oss_file
)
if
(
rpcm_oss_file
)
*
rpcm_oss_file
=
NULL
;
*
rpcm_oss_file
=
NULL
;
...
...
sound/oss/au1550_ac97.c
浏览文件 @
aeb5d727
...
@@ -93,7 +93,7 @@ static struct au1550_state {
...
@@ -93,7 +93,7 @@ static struct au1550_state {
spinlock_t
lock
;
spinlock_t
lock
;
struct
mutex
open_mutex
;
struct
mutex
open_mutex
;
struct
mutex
sem
;
struct
mutex
sem
;
mode_t
open_mode
;
f
mode_t
open_mode
;
wait_queue_head_t
open_wait
;
wait_queue_head_t
open_wait
;
struct
dmabuf
{
struct
dmabuf
{
...
...
sound/oss/dmasound/dmasound.h
浏览文件 @
aeb5d727
...
@@ -129,7 +129,7 @@ typedef struct {
...
@@ -129,7 +129,7 @@ typedef struct {
int
(
*
mixer_ioctl
)(
u_int
,
u_long
);
/* optional */
int
(
*
mixer_ioctl
)(
u_int
,
u_long
);
/* optional */
int
(
*
write_sq_setup
)(
void
);
/* optional */
int
(
*
write_sq_setup
)(
void
);
/* optional */
int
(
*
read_sq_setup
)(
void
);
/* optional */
int
(
*
read_sq_setup
)(
void
);
/* optional */
int
(
*
sq_open
)(
mode_t
);
/* optional */
int
(
*
sq_open
)(
f
mode_t
);
/* optional */
int
(
*
state_info
)(
char
*
,
size_t
);
/* optional */
int
(
*
state_info
)(
char
*
,
size_t
);
/* optional */
void
(
*
abort_read
)(
void
);
/* optional */
void
(
*
abort_read
)(
void
);
/* optional */
int
min_dsp_speed
;
int
min_dsp_speed
;
...
@@ -235,7 +235,7 @@ struct sound_queue {
...
@@ -235,7 +235,7 @@ struct sound_queue {
*/
*/
int
active
;
int
active
;
wait_queue_head_t
action_queue
,
open_queue
,
sync_queue
;
wait_queue_head_t
action_queue
,
open_queue
,
sync_queue
;
in
t
open_mode
;
fmode_
t
open_mode
;
int
busy
,
syncing
,
xruns
,
died
;
int
busy
,
syncing
,
xruns
,
died
;
};
};
...
...
sound/oss/dmasound/dmasound_atari.c
浏览文件 @
aeb5d727
...
@@ -143,7 +143,7 @@ static int AtaMixerIoctl(u_int cmd, u_long arg);
...
@@ -143,7 +143,7 @@ static int AtaMixerIoctl(u_int cmd, u_long arg);
static
int
TTMixerIoctl
(
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
FalconMixerIoctl
(
u_int
cmd
,
u_long
arg
);
static
int
AtaWriteSqSetup
(
void
);
static
int
AtaWriteSqSetup
(
void
);
static
int
AtaSqOpen
(
mode_t
mode
);
static
int
AtaSqOpen
(
f
mode_t
mode
);
static
int
TTStateInfo
(
char
*
buffer
,
size_t
space
);
static
int
TTStateInfo
(
char
*
buffer
,
size_t
space
);
static
int
FalconStateInfo
(
char
*
buffer
,
size_t
space
);
static
int
FalconStateInfo
(
char
*
buffer
,
size_t
space
);
...
@@ -1461,7 +1461,7 @@ static int AtaWriteSqSetup(void)
...
@@ -1461,7 +1461,7 @@ static int AtaWriteSqSetup(void)
return
0
;
return
0
;
}
}
static
int
AtaSqOpen
(
mode_t
mode
)
static
int
AtaSqOpen
(
f
mode_t
mode
)
{
{
write_sq_ignore_int
=
1
;
write_sq_ignore_int
=
1
;
return
0
;
return
0
;
...
...
sound/oss/dmasound/dmasound_core.c
浏览文件 @
aeb5d727
...
@@ -212,7 +212,7 @@ static int irq_installed;
...
@@ -212,7 +212,7 @@ static int irq_installed;
#endif
/* MODULE */
#endif
/* MODULE */
/* control over who can modify resources shared between play/record */
/* control over who can modify resources shared between play/record */
static
mode_t
shared_resource_owner
;
static
f
mode_t
shared_resource_owner
;
static
int
shared_resources_initialised
;
static
int
shared_resources_initialised
;
/*
/*
...
@@ -668,7 +668,7 @@ static inline void sq_init_waitqueue(struct sound_queue *sq)
...
@@ -668,7 +668,7 @@ static inline void sq_init_waitqueue(struct sound_queue *sq)
#if 0 /* blocking open() */
#if 0 /* blocking open() */
static inline void sq_wake_up(struct sound_queue *sq, struct file *file,
static inline void sq_wake_up(struct sound_queue *sq, struct file *file,
mode_t mode)
f
mode_t mode)
{
{
if (file->f_mode & mode) {
if (file->f_mode & mode) {
sq->busy = 0; /* CHECK: IS THIS OK??? */
sq->busy = 0; /* CHECK: IS THIS OK??? */
...
@@ -677,7 +677,7 @@ static inline void sq_wake_up(struct sound_queue *sq, struct file *file,
...
@@ -677,7 +677,7 @@ static inline void sq_wake_up(struct sound_queue *sq, struct file *file,
}
}
#endif
#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
,
f
mode_t
mode
,
int
numbufs
,
int
bufsize
)
int
numbufs
,
int
bufsize
)
{
{
int
rc
=
0
;
int
rc
=
0
;
...
@@ -891,10 +891,10 @@ static int sq_release(struct inode *inode, struct file *file)
...
@@ -891,10 +891,10 @@ static int sq_release(struct inode *inode, struct file *file)
is the owner - if we have problems.
is the owner - if we have problems.
*/
*/
static
int
shared_resources_are_mine
(
mode_t
md
)
static
int
shared_resources_are_mine
(
f
mode_t
md
)
{
{
if
(
shared_resource_owner
)
if
(
shared_resource_owner
)
return
(
shared_resource_owner
&
md
)
;
return
(
shared_resource_owner
&
md
)
!=
0
;
else
{
else
{
shared_resource_owner
=
md
;
shared_resource_owner
=
md
;
return
1
;
return
1
;
...
...
sound/oss/msnd.h
浏览文件 @
aeb5d727
...
@@ -211,7 +211,7 @@ typedef struct multisound_dev {
...
@@ -211,7 +211,7 @@ typedef struct multisound_dev {
/* State variables */
/* State variables */
enum
{
msndClassic
,
msndPinnacle
}
type
;
enum
{
msndClassic
,
msndPinnacle
}
type
;
mode_t
mode
;
f
mode_t
mode
;
unsigned
long
flags
;
unsigned
long
flags
;
#define F_RESETTING 0
#define F_RESETTING 0
#define F_HAVEDIGITAL 1
#define F_HAVEDIGITAL 1
...
...
sound/oss/sound_config.h
浏览文件 @
aeb5d727
...
@@ -110,24 +110,16 @@ struct channel_info {
...
@@ -110,24 +110,16 @@ struct channel_info {
#define OPEN_WRITE PCM_ENABLE_OUTPUT
#define OPEN_WRITE PCM_ENABLE_OUTPUT
#define OPEN_READWRITE (OPEN_READ|OPEN_WRITE)
#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
;
}
#else
static
inline
int
translate_mode
(
struct
file
*
file
)
static
inline
int
translate_mode
(
struct
file
*
file
)
{
{
return
((
file
->
f_mode
&
FMODE_READ
)
?
OPEN_READ
:
0
)
|
if
(
OPEN_READ
==
(
__force
int
)
FMODE_READ
&&
((
file
->
f_mode
&
FMODE_WRITE
)
?
OPEN_WRITE
:
0
);
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
);
}
}
#endif
#include "sound_calls.h"
#include "sound_calls.h"
#include "dev_table.h"
#include "dev_table.h"
...
...
sound/oss/swarm_cs4297a.c
浏览文件 @
aeb5d727
...
@@ -295,7 +295,7 @@ struct cs4297a_state {
...
@@ -295,7 +295,7 @@ struct cs4297a_state {
struct
mutex
open_mutex
;
struct
mutex
open_mutex
;
struct
mutex
open_sem_adc
;
struct
mutex
open_sem_adc
;
struct
mutex
open_sem_dac
;
struct
mutex
open_sem_dac
;
mode_t
open_mode
;
f
mode_t
open_mode
;
wait_queue_head_t
open_wait
;
wait_queue_head_t
open_wait
;
wait_queue_head_t
open_wait_adc
;
wait_queue_head_t
open_wait_adc
;
wait_queue_head_t
open_wait_dac
;
wait_queue_head_t
open_wait_dac
;
...
...
sound/oss/vwsnd.c
浏览文件 @
aeb5d727
...
@@ -1509,7 +1509,7 @@ typedef struct vwsnd_dev {
...
@@ -1509,7 +1509,7 @@ typedef struct vwsnd_dev {
struct
mutex
open_mutex
;
struct
mutex
open_mutex
;
struct
mutex
io_mutex
;
struct
mutex
io_mutex
;
struct
mutex
mix_mutex
;
struct
mutex
mix_mutex
;
mode_t
open_mode
;
f
mode_t
open_mode
;
wait_queue_head_t
open_wait
;
wait_queue_head_t
open_wait
;
lithium_t
lith
;
lithium_t
lith
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录