Skip to content
This repository was archived by the owner on Aug 10, 2021. It is now read-only.

Commit 5d5d568

Browse files
author
Al Viro
committed
make new_sync_{read,write}() static
All places outside of core VFS that checked ->read and ->write for being NULL or called the methods directly are gone now, so NULL {read,write} with non-NULL {read,write}_iter will do the right thing in all cases. Signed-off-by: Al Viro <[email protected]>
1 parent 86cc058 commit 5d5d568

File tree

59 files changed

+11
-153
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+11
-153
lines changed

Documentation/filesystems/porting

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,3 +471,12 @@ in your dentry operations instead.
471471
[mandatory]
472472
f_dentry is gone; use f_path.dentry, or, better yet, see if you can avoid
473473
it entirely.
474+
--
475+
[mandatory]
476+
never call ->read() and ->write() directly; use __vfs_{read,write} or
477+
wrappers; instead of checking for ->write or ->read being NULL, look for
478+
FMODE_CAN_{WRITE,READ} in file->f_mode.
479+
--
480+
[mandatory]
481+
do _not_ use new_sync_{read,write} for ->read/->write; leave it NULL
482+
instead.

arch/s390/hypfs/inode.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,6 @@ struct dentry *hypfs_create_str(struct dentry *dir,
437437
static const struct file_operations hypfs_file_ops = {
438438
.open = hypfs_open,
439439
.release = hypfs_release,
440-
.read = new_sync_read,
441-
.write = new_sync_write,
442440
.read_iter = hypfs_read_iter,
443441
.write_iter = hypfs_write_iter,
444442
.llseek = no_llseek,

drivers/char/mem.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,6 @@ static const struct file_operations __maybe_unused port_fops = {
764764

765765
static const struct file_operations zero_fops = {
766766
.llseek = zero_lseek,
767-
.read = new_sync_read,
768767
.write = write_zero,
769768
.read_iter = read_iter_zero,
770769
.aio_write = aio_write_zero,
@@ -776,7 +775,6 @@ static const struct file_operations zero_fops = {
776775

777776
static const struct file_operations full_fops = {
778777
.llseek = full_lseek,
779-
.read = new_sync_read,
780778
.read_iter = read_iter_zero,
781779
.write = write_full,
782780
};

drivers/char/raw.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,7 @@ static long raw_ctl_compat_ioctl(struct file *file, unsigned int cmd,
282282
#endif
283283

284284
static const struct file_operations raw_fops = {
285-
.read = new_sync_read,
286285
.read_iter = blkdev_read_iter,
287-
.write = new_sync_write,
288286
.write_iter = blkdev_write_iter,
289287
.fsync = blkdev_fsync,
290288
.open = raw_open,

drivers/net/macvtap.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,8 +1118,6 @@ static const struct file_operations macvtap_fops = {
11181118
.owner = THIS_MODULE,
11191119
.open = macvtap_open,
11201120
.release = macvtap_release,
1121-
.read = new_sync_read,
1122-
.write = new_sync_write,
11231121
.read_iter = macvtap_read_iter,
11241122
.write_iter = macvtap_write_iter,
11251123
.poll = macvtap_poll,

drivers/net/tun.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,8 +2223,6 @@ static void tun_chr_show_fdinfo(struct seq_file *m, struct file *f)
22232223
static const struct file_operations tun_fops = {
22242224
.owner = THIS_MODULE,
22252225
.llseek = no_llseek,
2226-
.read = new_sync_read,
2227-
.write = new_sync_write,
22282226
.read_iter = tun_chr_read_iter,
22292227
.write_iter = tun_chr_write_iter,
22302228
.poll = tun_chr_poll,

drivers/staging/lustre/lustre/llite/file.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3128,9 +3128,7 @@ int ll_inode_permission(struct inode *inode, int mask)
31283128

31293129
/* -o localflock - only provides locally consistent flock locks */
31303130
struct file_operations ll_file_operations = {
3131-
.read = new_sync_read,
31323131
.read_iter = ll_file_read_iter,
3133-
.write = new_sync_write,
31343132
.write_iter = ll_file_write_iter,
31353133
.unlocked_ioctl = ll_file_ioctl,
31363134
.open = ll_file_open,
@@ -3143,9 +3141,7 @@ struct file_operations ll_file_operations = {
31433141
};
31443142

31453143
struct file_operations ll_file_operations_flock = {
3146-
.read = new_sync_read,
31473144
.read_iter = ll_file_read_iter,
3148-
.write = new_sync_write,
31493145
.write_iter = ll_file_write_iter,
31503146
.unlocked_ioctl = ll_file_ioctl,
31513147
.open = ll_file_open,
@@ -3161,9 +3157,7 @@ struct file_operations ll_file_operations_flock = {
31613157

31623158
/* These are for -o noflock - to return ENOSYS on flock calls */
31633159
struct file_operations ll_file_operations_noflock = {
3164-
.read = new_sync_read,
31653160
.read_iter = ll_file_read_iter,
3166-
.write = new_sync_write,
31673161
.write_iter = ll_file_write_iter,
31683162
.unlocked_ioctl = ll_file_ioctl,
31693163
.open = ll_file_open,

drivers/usb/gadget/function/f_fs.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,8 +1061,6 @@ static const struct file_operations ffs_epfile_operations = {
10611061
.llseek = no_llseek,
10621062

10631063
.open = ffs_epfile_open,
1064-
.write = new_sync_write,
1065-
.read = new_sync_read,
10661064
.write_iter = ffs_epfile_write_iter,
10671065
.read_iter = ffs_epfile_read_iter,
10681066
.release = ffs_epfile_release,

drivers/usb/gadget/legacy/inode.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,8 +699,6 @@ static const struct file_operations ep_io_operations = {
699699
.open = ep_open,
700700
.release = ep_release,
701701
.llseek = no_llseek,
702-
.read = new_sync_read,
703-
.write = new_sync_write,
704702
.unlocked_ioctl = ep_ioctl,
705703
.read_iter = ep_read_iter,
706704
.write_iter = ep_write_iter,

fs/9p/vfs_file.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -641,8 +641,6 @@ static const struct vm_operations_struct v9fs_mmap_file_vm_ops = {
641641

642642
const struct file_operations v9fs_cached_file_operations = {
643643
.llseek = generic_file_llseek,
644-
.read = new_sync_read,
645-
.write = new_sync_write,
646644
.read_iter = generic_file_read_iter,
647645
.write_iter = generic_file_write_iter,
648646
.open = v9fs_file_open,
@@ -654,8 +652,6 @@ const struct file_operations v9fs_cached_file_operations = {
654652

655653
const struct file_operations v9fs_cached_file_operations_dotl = {
656654
.llseek = generic_file_llseek,
657-
.read = new_sync_read,
658-
.write = new_sync_write,
659655
.read_iter = generic_file_read_iter,
660656
.write_iter = generic_file_write_iter,
661657
.open = v9fs_file_open,
@@ -668,8 +664,6 @@ const struct file_operations v9fs_cached_file_operations_dotl = {
668664

669665
const struct file_operations v9fs_file_operations = {
670666
.llseek = generic_file_llseek,
671-
.read = new_sync_read,
672-
.write = new_sync_write,
673667
.read_iter = v9fs_file_read_iter,
674668
.write_iter = v9fs_file_write_iter,
675669
.open = v9fs_file_open,
@@ -681,8 +675,6 @@ const struct file_operations v9fs_file_operations = {
681675

682676
const struct file_operations v9fs_file_operations_dotl = {
683677
.llseek = generic_file_llseek,
684-
.read = new_sync_read,
685-
.write = new_sync_write,
686678
.read_iter = v9fs_file_read_iter,
687679
.write_iter = v9fs_file_write_iter,
688680
.open = v9fs_file_open,
@@ -695,8 +687,6 @@ const struct file_operations v9fs_file_operations_dotl = {
695687

696688
const struct file_operations v9fs_mmap_file_operations = {
697689
.llseek = generic_file_llseek,
698-
.read = new_sync_read,
699-
.write = new_sync_write,
700690
.read_iter = v9fs_mmap_file_read_iter,
701691
.write_iter = v9fs_mmap_file_write_iter,
702692
.open = v9fs_file_open,
@@ -708,8 +698,6 @@ const struct file_operations v9fs_mmap_file_operations = {
708698

709699
const struct file_operations v9fs_mmap_file_operations_dotl = {
710700
.llseek = generic_file_llseek,
711-
.read = new_sync_read,
712-
.write = new_sync_write,
713701
.read_iter = v9fs_mmap_file_read_iter,
714702
.write_iter = v9fs_mmap_file_write_iter,
715703
.open = v9fs_file_open,

0 commit comments

Comments
 (0)