Skip to content

Commit 41bc10c

Browse files
committed
Merge tag 'stream_open-5.2' of https://lab.nexedi.com/kirr/linux
Pull stream_open conversion from Kirill Smelkov: - remove unnecessary double nonseekable_open from drivers/char/dtlk.c as noticed by Pavel Machek while reviewing nonseekable_open -> stream_open mass conversion. - the mass conversion patch promised in commit 10dce8a ("fs: stream_open - opener for stream-like files so that read and write can run simultaneously without deadlock") and is automatically generated by running $ make coccicheck MODE=patch COCCI=scripts/coccinelle/api/stream_open.cocci I've verified each generated change manually - that it is correct to convert - and each other nonseekable_open instance left - that it is either not correct to convert there, or that it is not converted due to current stream_open.cocci limitations. More details on this in the patch. - finally, change VFS to pass ppos=NULL into .read/.write for files that declare themselves streams. It was suggested by Rasmus Villemoes and makes sure that if ppos starts to be erroneously used in a stream file, such bug won't go unnoticed and will produce an oops instead of creating illusion of position change being taken into account. Note: this patch does not conflict with "fuse: Add FOPEN_STREAM to use stream_open()" that will be hopefully coming via FUSE tree, because fs/fuse/ uses new-style .read_iter/.write_iter, and for these accessors position is still passed as non-pointer kiocb.ki_pos . * tag 'stream_open-5.2' of https://lab.nexedi.com/kirr/linux: vfs: pass ppos=NULL to .read()/.write() of FMODE_STREAM files *: convert stream-like files from nonseekable_open -> stream_open dtlk: remove double call to nonseekable_open
2 parents aa26690 + 438ab72 commit 41bc10c

105 files changed

Lines changed: 179 additions & 158 deletions

Some content is hidden

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

‎arch/powerpc/platforms/52xx/mpc52xx_gpt.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ static int mpc52xx_wdt_open(struct inode *inode, struct file *file)
628628
}
629629

630630
file->private_data = mpc52xx_gpt_wdt;
631-
return nonseekable_open(inode, file);
631+
return stream_open(inode, file);
632632
}
633633

634634
static int mpc52xx_wdt_release(struct inode *inode, struct file *file)

‎arch/powerpc/platforms/cell/spufs/file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ static int spufs_pipe_open(struct inode *inode, struct file *file)
588588
struct spufs_inode_info *i = SPUFS_I(inode);
589589
file->private_data = i->i_ctx;
590590

591-
return nonseekable_open(inode, file);
591+
return stream_open(inode, file);
592592
}
593593

594594
/*

‎arch/um/drivers/harddog_kern.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static int harddog_open(struct inode *inode, struct file *file)
8585
timer_alive = 1;
8686
spin_unlock(&lock);
8787
mutex_unlock(&harddog_mutex);
88-
return nonseekable_open(inode, file);
88+
return stream_open(inode, file);
8989
err:
9090
spin_unlock(&lock);
9191
mutex_unlock(&harddog_mutex);

‎arch/x86/kernel/cpu/microcode/core.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ static int do_microcode_update(const void __user *buf, size_t size)
428428

429429
static int microcode_open(struct inode *inode, struct file *file)
430430
{
431-
return capable(CAP_SYS_RAWIO) ? nonseekable_open(inode, file) : -EPERM;
431+
return capable(CAP_SYS_RAWIO) ? stream_open(inode, file) : -EPERM;
432432
}
433433

434434
static ssize_t microcode_write(struct file *file, const char __user *buf,

‎drivers/char/ds1620.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static void ds1620_read_state(struct therm *therm)
212212

213213
static int ds1620_open(struct inode *inode, struct file *file)
214214
{
215-
return nonseekable_open(inode, file);
215+
return stream_open(inode, file);
216216
}
217217

218218
static ssize_t

‎drivers/char/dtlk.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,11 @@ static int dtlk_open(struct inode *inode, struct file *file)
298298
{
299299
TRACE_TEXT("(dtlk_open");
300300

301-
nonseekable_open(inode, file);
302301
switch (iminor(inode)) {
303302
case DTLK_MINOR:
304303
if (dtlk_busy)
305304
return -EBUSY;
306-
return nonseekable_open(inode, file);
305+
return stream_open(inode, file);
307306

308307
default:
309308
return -ENXIO;

‎drivers/char/ipmi/ipmi_watchdog.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ static int ipmi_open(struct inode *ino, struct file *filep)
837837
* first heartbeat.
838838
*/
839839
ipmi_start_timer_on_heartbeat = 1;
840-
return nonseekable_open(ino, filep);
840+
return stream_open(ino, filep);
841841

842842
default:
843843
return (-ENODEV);

‎drivers/char/pcmcia/cm4000_cs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1682,7 +1682,7 @@ static int cmm_open(struct inode *inode, struct file *filp)
16821682
link->open = 1; /* only one open per device */
16831683

16841684
DEBUGP(2, dev, "<- cmm_open\n");
1685-
ret = nonseekable_open(inode, filp);
1685+
ret = stream_open(inode, filp);
16861686
out:
16871687
mutex_unlock(&cmm_mutex);
16881688
return ret;

‎drivers/char/pcmcia/scr24x_cs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static int scr24x_open(struct inode *inode, struct file *filp)
9292
kref_get(&dev->refcnt);
9393
filp->private_data = dev;
9494

95-
return nonseekable_open(inode, filp);
95+
return stream_open(inode, filp);
9696
}
9797

9898
static int scr24x_release(struct inode *inode, struct file *filp)

‎drivers/char/tb0219.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ static int tanbac_tb0219_open(struct inode *inode, struct file *file)
243243
case 16 ... 23:
244244
case 32 ... 39:
245245
case 48 ... 55:
246-
return nonseekable_open(inode, file);
246+
return stream_open(inode, file);
247247
default:
248248
break;
249249
}

0 commit comments

Comments
 (0)