As I promised to Christoph Hellwig, this series
changes the default action for sys_llseek from
the traditional default_llseek to no_llseek,
disallowing users to seek files without a seek
operation, which is much more logical.
At the same time, this series makes it obvious
that the remaining users of the now explicitly
used default_llseek function do not require
the big kernel lock and we can consequently
replace it with i_mutex.
The bulk of the necessary changes is adding
a .llseek pointer to each and every
file_operation in the kernel using a coccinelle
semantic patch (patch 16 here). The semantic
patch only changes those cases that it can
prove to have an obviously correct replacement
operation, see the patch description for the
detailed rules it uses.
The remaining patches here are for the cases
that the semantic patch did not have an answer
for or that it did not find because it was
hidden in macros or in unexpected coding style.
I am confident that I have covered all users
in the current mainline kernel, but new
file_operations are already part of linux-next,
so the same semantic patch needs to be applied
to those.
The diffstat below intentionally covers only
the changes I did manually, leaving out patch
16.
Arnd
Arnd Bergmann (18):
drm: use noop_llseek
net/wireless: use generic_file_llseek in debugfs
lkdtm: use generic_file_llseek in debugfs
ib/qib: use generic_file_llseek
arm/omap: use generic_file_llseek in iommu_debug
spufs: use llseek in all file operations
staging: use llseek in all file operations
selinux: use generic_file_llseek
tracing: use generic_file_llseek for debugfs
ibmasmfs: use generic_file_llseek
oprofile: make event buffer nonseekable
raw: use explicit llseek file operations
ima: use generic_file_llseek for securityfs
irda/irnet: use noop_llseek
viotape: use noop_llseek
llseek: automatically add .llseek fop
vfs: don't use BKL in default_llseek
vfs: make no_llseek the default
Documentation/DocBook/drm.tmpl | 1
arch/arm/plat-omap/iommu-debug.c | 2
arch/powerpc/platforms/cell/spufs/file.c | 24 ++++++++--
drivers/char/raw.c | 2
drivers/char/viotape.c | 1
drivers/gpu/drm/i810/i810_drv.c | 1
drivers/gpu/drm/i830/i830_drv.c | 1
drivers/gpu/drm/i915/i915_drv.c | 1
drivers/gpu/drm/mga/mga_drv.c | 1
drivers/gpu/drm/nouveau/nouveau_drv.c | 1
drivers/gpu/drm/r128/r128_drv.c | 1
drivers/gpu/drm/radeon/radeon_drv.c | 1
drivers/gpu/drm/savage/savage_drv.c | 1
drivers/gpu/drm/sis/sis_drv.c | 1
drivers/gpu/drm/tdfx/tdfx_drv.c | 1
drivers/gpu/drm/via/via_drv.c | 1
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 1
drivers/infiniband/hw/qib/qib_fs.c | 18 +++----
drivers/misc/ibmasm/ibmasmfs.c | 4 +
drivers/misc/iwmc3200top/debugfs.c | 3 +
drivers/misc/lkdtm.c | 9 +++
drivers/net/wireless/b43/debugfs.c | 1
drivers/net/wireless/b43legacy/debugfs.c | 1
drivers/net/wireless/iwlwifi/iwl-debugfs.c | 3 +
drivers/net/wireless/libertas/debugfs.c | 1
drivers/net/wireless/rt2x00/rt2x00debug.c | 1
drivers/net/wireless/wl12xx/wl1251_debugfs.c | 2
drivers/net/wireless/wl12xx/wl1271_debugfs.c | 2
drivers/oprofile/event_buffer.c | 3 -
drivers/staging/msm/mdp4_debugfs.c | 10 ----
drivers/staging/panel/panel.c | 3 -
fs/read_write.c | 5 --
kernel/trace/trace.c | 15 ++++++
net/irda/irnet/irnet_ppp.h | 1
net/mac80211/debugfs.c | 2
net/mac80211/debugfs_key.c | 2
net/mac80211/debugfs_netdev.c | 1
net/mac80211/debugfs_sta.c | 2
net/wireless/debugfs.c | 1
security/integrity/ima/ima_fs.c | 9 ++-
security/selinux/selinuxfs.c | 16 ++++++
41 files changed, 129 insertions(+), 28 deletions(-)
When the default llseek behavior gets changed to
not allowing seek, all file operations that rely
on the current behaviour need to use an explicit
.llseek operation.
The files that lkdtm uses in debugfs are regular
files and they get read using simple_read_from_buffer,
so generic_file_llseek is the right operation.
Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/misc/lkdtm.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/drivers/misc/lkdtm.c b/drivers/misc/lkdtm.c
index 5bfb2a2..7d7ce0e 100644
--- a/drivers/misc/lkdtm.c
+++ b/drivers/misc/lkdtm.c
@@ -575,30 +575,39 @@ struct crash_entry {
static const struct crash_entry crash_entries[] = {
{"DIRECT", {.read = lkdtm_debugfs_read,
+ .llseek = generic_file_llseek,
.open = lkdtm_debugfs_open,
.write = direct_entry} },
{"INT_HARDWARE_ENTRY", {.read = lkdtm_debugfs_read,
+ .llseek = generic_file_llseek,
.open = lkdtm_debugfs_open,
.write = int_hardware_entry} },
{"INT_HW_IRQ_EN", {.read = lkdtm_debugfs_read,
+ .llseek = generic_file_llseek,
.open = lkdtm_debugfs_open,
.write = int_hw_irq_en} },
{"INT_TASKLET_ENTRY", {.read = lkdtm_debugfs_read,
+ .llseek = generic_file_llseek,
.open = lkdtm_debugfs_open,
.write = int_tasklet_entry} },
{"FS_DEVRW", {.read = lkdtm_debugfs_read,
+ .llseek = generic_file_llseek,
.open = lkdtm_debugfs_open,
.write = fs_devrw_entry} },
{"MEM_SWAPOUT", {.read = lkdtm_debugfs_read,
+ .llseek = generic_file_llseek,
.open = lkdtm_debugfs_open,
.write = mem_swapout_entry} },
{"TIMERADD", {.read = lkdtm_debugfs_read,
+ .llseek = generic_file_llseek,
.open = lkdtm_debugfs_open,
.write = timeradd_entry} },
{"SCSI_DISPATCH_CMD", {.read = lkdtm_debugfs_read,
+ .llseek = generic_file_llseek,
.open = lkdtm_debugfs_open,
.write = scsi_dispatch_cmd_entry} },
{"IDE_CORE_CP", {.read = lkdtm_debugfs_read,
+ .llseek = generic_file_llseek,
.open = lkdtm_debugfs_open,
.write = ide_core_cp_entry} },
};
--
1.7.1
The event buffer cannot deal with seeks, so
we should forbid that outright.
Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Robert Richter <[email protected]>
Cc: [email protected]
---
drivers/oprofile/event_buffer.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c
index 5df60a6..dd87e86 100644
--- a/drivers/oprofile/event_buffer.c
+++ b/drivers/oprofile/event_buffer.c
@@ -135,7 +135,7 @@ static int event_buffer_open(struct inode *inode, struct file *file)
* echo 1 >/dev/oprofile/enable
*/
- return 0;
+ return nonseekable_open(inode, file);
fail:
dcookie_unregister(file->private_data);
@@ -205,4 +205,5 @@ const struct file_operations event_buffer_fops = {
.open = event_buffer_open,
.release = event_buffer_release,
.read = event_buffer_read,
+ .llseek = no_llseek,
};
--
1.7.1
The default for llseek is changing, so we need
explicit operations everywhere.
Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Jeremy Kerr <[email protected]>
Cc: [email protected]
---
arch/powerpc/platforms/cell/spufs/file.c | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 1a40da9..d2980bd 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -154,6 +154,7 @@ static const struct file_operations __fops = { \
.release = spufs_attr_release, \
.read = spufs_attr_read, \
.write = spufs_attr_write, \
+ .llseek = generic_file_llseek, \
};
@@ -521,6 +522,7 @@ static const struct file_operations spufs_cntl_fops = {
.release = spufs_cntl_release,
.read = simple_attr_read,
.write = simple_attr_write,
+ .llseek = generic_file_llseek,
.mmap = spufs_cntl_mmap,
};
@@ -714,6 +716,7 @@ static ssize_t spufs_mbox_read(struct file *file, char __user *buf,
static const struct file_operations spufs_mbox_fops = {
.open = spufs_pipe_open,
.read = spufs_mbox_read,
+ .llseek = no_llseek,
};
static ssize_t spufs_mbox_stat_read(struct file *file, char __user *buf,
@@ -743,6 +746,7 @@ static ssize_t spufs_mbox_stat_read(struct file *file, char __user *buf,
static const struct file_operations spufs_mbox_stat_fops = {
.open = spufs_pipe_open,
.read = spufs_mbox_stat_read,
+ .llseek = no_llseek,
};
/* low-level ibox access function */
@@ -863,6 +867,7 @@ static const struct file_operations spufs_ibox_fops = {
.read = spufs_ibox_read,
.poll = spufs_ibox_poll,
.fasync = spufs_ibox_fasync,
+ .llseek = no_llseek,
};
static ssize_t spufs_ibox_stat_read(struct file *file, char __user *buf,
@@ -890,6 +895,7 @@ static ssize_t spufs_ibox_stat_read(struct file *file, char __user *buf,
static const struct file_operations spufs_ibox_stat_fops = {
.open = spufs_pipe_open,
.read = spufs_ibox_stat_read,
+ .llseek = no_llseek,
};
/* low-level mailbox write */
@@ -1011,6 +1017,7 @@ static const struct file_operations spufs_wbox_fops = {
.write = spufs_wbox_write,
.poll = spufs_wbox_poll,
.fasync = spufs_wbox_fasync,
+ .llseek = no_llseek,
};
static ssize_t spufs_wbox_stat_read(struct file *file, char __user *buf,
@@ -1038,6 +1045,7 @@ static ssize_t spufs_wbox_stat_read(struct file *file, char __user *buf,
static const struct file_operations spufs_wbox_stat_fops = {
.open = spufs_pipe_open,
.read = spufs_wbox_stat_read,
+ .llseek = no_llseek,
};
static int spufs_signal1_open(struct inode *inode, struct file *file)
@@ -1166,6 +1174,7 @@ static const struct file_operations spufs_signal1_fops = {
.read = spufs_signal1_read,
.write = spufs_signal1_write,
.mmap = spufs_signal1_mmap,
+ .llseek = no_llseek,
};
static const struct file_operations spufs_signal1_nosched_fops = {
@@ -1173,6 +1182,7 @@ static const struct file_operations spufs_signal1_nosched_fops = {
.release = spufs_signal1_release,
.write = spufs_signal1_write,
.mmap = spufs_signal1_mmap,
+ .llseek = no_llseek,
};
static int spufs_signal2_open(struct inode *inode, struct file *file)
@@ -1305,6 +1315,7 @@ static const struct file_operations spufs_signal2_fops = {
.read = spufs_signal2_read,
.write = spufs_signal2_write,
.mmap = spufs_signal2_mmap,
+ .llseek = no_llseek,
};
static const struct file_operations spufs_signal2_nosched_fops = {
@@ -1312,6 +1323,7 @@ static const struct file_operations spufs_signal2_nosched_fops = {
.release = spufs_signal2_release,
.write = spufs_signal2_write,
.mmap = spufs_signal2_mmap,
+ .llseek = no_llseek,
};
/*
@@ -1451,6 +1463,7 @@ static const struct file_operations spufs_mss_fops = {
.open = spufs_mss_open,
.release = spufs_mss_release,
.mmap = spufs_mss_mmap,
+ .llseek = no_llseek,
};
static int
@@ -1508,6 +1521,7 @@ static const struct file_operations spufs_psmap_fops = {
.open = spufs_psmap_open,
.release = spufs_psmap_release,
.mmap = spufs_psmap_mmap,
+ .llseek = no_llseek,
};
@@ -1871,6 +1885,7 @@ static const struct file_operations spufs_mfc_fops = {
.fsync = spufs_mfc_fsync,
.fasync = spufs_mfc_fasync,
.mmap = spufs_mfc_mmap,
+ .llseek = no_llseek,
};
static int spufs_npc_set(void *data, u64 val)
@@ -2111,7 +2126,7 @@ static ssize_t spufs_mbox_info_read(struct file *file, char __user *buf,
static const struct file_operations spufs_mbox_info_fops = {
.open = spufs_info_open,
.read = spufs_mbox_info_read,
- .llseek = generic_file_llseek,
+ .llseek = no_llseek,
};
static ssize_t __spufs_ibox_info_read(struct spu_context *ctx,
@@ -2151,7 +2166,7 @@ static ssize_t spufs_ibox_info_read(struct file *file, char __user *buf,
static const struct file_operations spufs_ibox_info_fops = {
.open = spufs_info_open,
.read = spufs_ibox_info_read,
- .llseek = generic_file_llseek,
+ .llseek = no_llseek,
};
static ssize_t __spufs_wbox_info_read(struct spu_context *ctx,
@@ -2194,7 +2209,7 @@ static ssize_t spufs_wbox_info_read(struct file *file, char __user *buf,
static const struct file_operations spufs_wbox_info_fops = {
.open = spufs_info_open,
.read = spufs_wbox_info_read,
- .llseek = generic_file_llseek,
+ .llseek = no_llseek,
};
static ssize_t __spufs_dma_info_read(struct spu_context *ctx,
@@ -2246,6 +2261,7 @@ static ssize_t spufs_dma_info_read(struct file *file, char __user *buf,
static const struct file_operations spufs_dma_info_fops = {
.open = spufs_info_open,
.read = spufs_dma_info_read,
+ .llseek = no_llseek,
};
static ssize_t __spufs_proxydma_info_read(struct spu_context *ctx,
@@ -2299,6 +2315,7 @@ static ssize_t spufs_proxydma_info_read(struct file *file, char __user *buf,
static const struct file_operations spufs_proxydma_info_fops = {
.open = spufs_info_open,
.read = spufs_proxydma_info_read,
+ .llseek = no_llseek,
};
static int spufs_show_tid(struct seq_file *s, void *private)
@@ -2585,6 +2602,7 @@ static const struct file_operations spufs_switch_log_fops = {
.read = spufs_switch_log_read,
.poll = spufs_switch_log_poll,
.release = spufs_switch_log_release,
+ .llseek = no_llseek,
};
/**
--
1.7.1
There may be applications trying to seek
on the irnet character device, so we should
use noop_llseek to avoid returning an error
when the default llseek changes to no_llseek.
Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Samuel Ortiz <[email protected]>
Cc: [email protected]
---
net/irda/irnet/irnet_ppp.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/net/irda/irnet/irnet_ppp.h b/net/irda/irnet/irnet_ppp.h
index b5df241..7b9949e 100644
--- a/net/irda/irnet/irnet_ppp.h
+++ b/net/irda/irnet/irnet_ppp.h
@@ -104,6 +104,7 @@ static const struct file_operations irnet_device_fops =
.unlocked_ioctl = dev_irnet_ioctl,
.open = dev_irnet_open,
.release = dev_irnet_close
+ .llseek = noop_llseek,
/* Also : llseek, readdir, mmap, flush, fsync, fasync, lock, readv, writev */
};
--
1.7.1
The drm device drivers currently allow seeking on the
character device but never care about the actual
file position.
When we change the default llseek operation to be
no_llseek, calling llseek on a drm device would
return an error condition, which is an API change.
Explicitly setting noop_llseek lets us keep the
current API.
Signed-off-by: Arnd Bergmann <[email protected]>
Cc: David Airlie <[email protected]>
Cc: [email protected]
---
Documentation/DocBook/drm.tmpl | 1 +
drivers/gpu/drm/i810/i810_drv.c | 1 +
drivers/gpu/drm/i830/i830_drv.c | 1 +
drivers/gpu/drm/i915/i915_drv.c | 1 +
drivers/gpu/drm/mga/mga_drv.c | 1 +
drivers/gpu/drm/nouveau/nouveau_drv.c | 1 +
drivers/gpu/drm/r128/r128_drv.c | 1 +
drivers/gpu/drm/radeon/radeon_drv.c | 1 +
drivers/gpu/drm/savage/savage_drv.c | 1 +
drivers/gpu/drm/sis/sis_drv.c | 1 +
drivers/gpu/drm/tdfx/tdfx_drv.c | 1 +
drivers/gpu/drm/via/via_drv.c | 1 +
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 1 +
13 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index 910c923..2861055 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -136,6 +136,7 @@
#ifdef CONFIG_COMPAT
.compat_ioctl = i915_compat_ioctl,
#endif
+ .llseek = noop_llseek,
},
.pci_driver = {
.name = DRIVER_NAME,
diff --git a/drivers/gpu/drm/i810/i810_drv.c b/drivers/gpu/drm/i810/i810_drv.c
index c1e0275..199fdfa 100644
--- a/drivers/gpu/drm/i810/i810_drv.c
+++ b/drivers/gpu/drm/i810/i810_drv.c
@@ -63,6 +63,7 @@ static struct drm_driver driver = {
.mmap = drm_mmap,
.poll = drm_poll,
.fasync = drm_fasync,
+ .llseek = noop_llseek,
},
.pci_driver = {
diff --git a/drivers/gpu/drm/i830/i830_drv.c b/drivers/gpu/drm/i830/i830_drv.c
index 44f990b..3be1d7d 100644
--- a/drivers/gpu/drm/i830/i830_drv.c
+++ b/drivers/gpu/drm/i830/i830_drv.c
@@ -74,6 +74,7 @@ static struct drm_driver driver = {
.mmap = drm_mmap,
.poll = drm_poll,
.fasync = drm_fasync,
+ .llseek = noop_llseek,
},
.pci_driver = {
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 423dc90..bd8c139 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -547,6 +547,7 @@ static struct drm_driver driver = {
#ifdef CONFIG_COMPAT
.compat_ioctl = i915_compat_ioctl,
#endif
+ .llseek = noop_llseek,
},
.pci_driver = {
diff --git a/drivers/gpu/drm/mga/mga_drv.c b/drivers/gpu/drm/mga/mga_drv.c
index ddfe161..524185f 100644
--- a/drivers/gpu/drm/mga/mga_drv.c
+++ b/drivers/gpu/drm/mga/mga_drv.c
@@ -75,6 +75,7 @@ static struct drm_driver driver = {
#ifdef CONFIG_COMPAT
.compat_ioctl = mga_compat_ioctl,
#endif
+ .llseek = noop_llseek,
},
.pci_driver = {
.name = DRIVER_NAME,
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c
index 2737704..9505fa6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.c
@@ -400,6 +400,7 @@ static struct drm_driver driver = {
#if defined(CONFIG_COMPAT)
.compat_ioctl = nouveau_compat_ioctl,
#endif
+ .llseek = noop_llseek,
},
.pci_driver = {
.name = DRIVER_NAME,
diff --git a/drivers/gpu/drm/r128/r128_drv.c b/drivers/gpu/drm/r128/r128_drv.c
index b806fdc..dc22c6e 100644
--- a/drivers/gpu/drm/r128/r128_drv.c
+++ b/drivers/gpu/drm/r128/r128_drv.c
@@ -71,6 +71,7 @@ static struct drm_driver driver = {
#ifdef CONFIG_COMPAT
.compat_ioctl = r128_compat_ioctl,
#endif
+ .llseek = noop_llseek,
},
.pci_driver = {
.name = DRIVER_NAME,
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index e166fe4..e79dcf5 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -218,6 +218,7 @@ static struct drm_driver driver_old = {
#ifdef CONFIG_COMPAT
.compat_ioctl = radeon_compat_ioctl,
#endif
+ .llseek = noop_llseek,
},
.pci_driver = {
diff --git a/drivers/gpu/drm/savage/savage_drv.c b/drivers/gpu/drm/savage/savage_drv.c
index 021de44..2a2830f 100644
--- a/drivers/gpu/drm/savage/savage_drv.c
+++ b/drivers/gpu/drm/savage/savage_drv.c
@@ -54,6 +54,7 @@ static struct drm_driver driver = {
.mmap = drm_mmap,
.poll = drm_poll,
.fasync = drm_fasync,
+ .llseek = noop_llseek,
},
.pci_driver = {
diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c
index 4fd1f06..4f7f80f 100644
--- a/drivers/gpu/drm/sis/sis_drv.c
+++ b/drivers/gpu/drm/sis/sis_drv.c
@@ -84,6 +84,7 @@ static struct drm_driver driver = {
.mmap = drm_mmap,
.poll = drm_poll,
.fasync = drm_fasync,
+ .llseek = noop_llseek,
},
.pci_driver = {
.name = DRIVER_NAME,
diff --git a/drivers/gpu/drm/tdfx/tdfx_drv.c b/drivers/gpu/drm/tdfx/tdfx_drv.c
index ec5a43e..640567e 100644
--- a/drivers/gpu/drm/tdfx/tdfx_drv.c
+++ b/drivers/gpu/drm/tdfx/tdfx_drv.c
@@ -52,6 +52,7 @@ static struct drm_driver driver = {
.mmap = drm_mmap,
.poll = drm_poll,
.fasync = drm_fasync,
+ .llseek = noop_llseek,
},
.pci_driver = {
.name = DRIVER_NAME,
diff --git a/drivers/gpu/drm/via/via_drv.c b/drivers/gpu/drm/via/via_drv.c
index 7a1b210..b8984a5 100644
--- a/drivers/gpu/drm/via/via_drv.c
+++ b/drivers/gpu/drm/via/via_drv.c
@@ -62,6 +62,7 @@ static struct drm_driver driver = {
.mmap = drm_mmap,
.poll = drm_poll,
.fasync = drm_fasync,
+ .llseek = noop_llseek,
},
.pci_driver = {
.name = DRIVER_NAME,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index b793c8c..83d2844 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -745,6 +745,7 @@ static struct drm_driver driver = {
#if defined(CONFIG_COMPAT)
.compat_ioctl = drm_compat_ioctl,
#endif
+ .llseek = noop_llseek,
},
.pci_driver = {
.name = VMWGFX_DRIVER_NAME,
--
1.7.1
All file_operations should get a .llseek
operation so we can make nonseekable_open
the default for future file operations
without a .llseek pointer.
The three cases that we can automatically
detect are no_llseek, seq_lseek and
default_llseek. For cases where we can
we can automatically prove that the
file offset is always ignored, we use
noop_llseek, which maintains the current
behavior of not returning an error from
a seek.
New drivers should normally not use
noop_llseek but instead use no_llseek and
call nonseekable_open at open time.
Existing drivers can be converted to do
the same when the maintainer knows for
certain that no user code relies on calling
seek on the device file.
The generated code is often incorrectly
indented and right now contains comments that
clarify for each added line why a specific
variant was chosen. In the version that gets
submitted upstream, the comments will be gone
and I will manually fix the indentation,
because there does not seem to be a way to
do that using coccinelle.
Some amount of new code is currently sitting
in linux-next that should get the same
modifications, which I will do at the end of
the merge window.
This specific posted version of the patch only
covers first few files in order to avoid
spamming everybody's inbox. I think you still
get the point. The diffstat is complete, and
the full patch is available in the 'llseek'
branch of
git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl.git
Many thanks to Julia Lawall for helping me
learn to write a semantic patch that does
all this.
===== begin semantic patch =====
// This adds an llseek= method to all file operations,
// as a preparation for making no_llseek the default.
//
// The rules are
// - use no_llseek explicitly if we do nonseekable_open
// - use seq_lseek for sequential files
// - use default_llseek if we know we access f_pos
// - use noop_llseek if we know we don't access f_pos,
// but we still want to allow users to call lseek
//
@ open1 exists @
identifier nested_open;
@@
nested_open(...)
{
<+...
nonseekable_open(...)
...+>
}
@ open exists@
identifier open_f;
identifier i, f;
identifier open1.nested_open;
@@
int open_f(struct inode *i, struct file *f)
{
<+...
(
nonseekable_open(...)
|
nested_open(...)
)
...+>
}
@ read disable optional_qualifier exists @
identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@
ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
{
<+...
(
*off = E
|
*off += E
|
func(..., off, ...)
|
E = *off
)
...+>
}
@ read_no_fpos disable optional_qualifier exists @
identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@
ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
{
... when != off
}
@ write @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@
ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
{
<+...
(
*off = E
|
*off += E
|
func(..., off, ...)
|
E = *off
)
...+>
}
@ write_no_fpos @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@
ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
{
... when != off
}
@ fops0 @
identifier fops;
@@
struct file_operations fops = {
...
};
@ has_llseek depends on fops0 @
identifier fops0.fops;
identifier llseek_f;
@@
struct file_operations fops = {
...
.llseek = llseek_f,
...
};
@ has_read depends on fops0 @
identifier fops0.fops;
identifier read_f;
@@
struct file_operations fops = {
...
.read = read_f,
...
};
@ has_write depends on fops0 @
identifier fops0.fops;
identifier write_f;
@@
struct file_operations fops = {
...
.write = write_f,
...
};
@ has_open depends on fops0 @
identifier fops0.fops;
identifier open_f;
@@
struct file_operations fops = {
...
.open = open_f,
...
};
// use no_llseek if we call nonseekable_open
////////////////////////////////////////////
@ nonseekable1 depends on !has_llseek && has_open @
identifier fops0.fops;
identifier nso ~= "nonseekable_open";
@@
struct file_operations fops = {
... .open = nso, ...
+.llseek = no_llseek, /* nonseekable */
};
@ nonseekable2 depends on !has_llseek @
identifier fops0.fops;
identifier open.open_f;
@@
struct file_operations fops = {
... .open = open_f, ...
+.llseek = no_llseek, /* open uses nonseekable */
};
// use seq_lseek for sequential files
/////////////////////////////////////
@ seq depends on !has_llseek @
identifier fops0.fops;
identifier sr ~= "seq_read";
@@
struct file_operations fops = {
... .read = sr, ...
+.llseek = seq_lseek, /* we have seq_read */
};
// use default_llseek if there is a readdir
///////////////////////////////////////////
@ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier readdir_e;
@@
// any other fop is used that changes pos
struct file_operations fops = {
... .readdir = readdir_e, ...
+.llseek = default_llseek, /* readdir is present */
};
// use default_llseek if at least one of read/write touches f_pos
/////////////////////////////////////////////////////////////////
@ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier read.read_f;
@@
// read fops use offset
struct file_operations fops = {
... .read = read_f, ...
+.llseek = default_llseek, /* read accesses f_pos */
};
@ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier write.write_f;
@@
// write fops use offset
struct file_operations fops = {
... .write = write_f, ...
+ .llseek = default_llseek, /* write accesses f_pos */
};
// Use noop_llseek if neither read nor write accesses f_pos
///////////////////////////////////////////////////////////
@ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier read_no_fpos.read_f;
identifier write_no_fpos.write_f;
@@
// write fops use offset
struct file_operations fops = {
...
.write = write_f,
.read = read_f,
...
+.llseek = noop_llseek, /* read and write both use no f_pos */
};
@ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier write_no_fpos.write_f;
@@
struct file_operations fops = {
... .write = write_f, ...
+.llseek = noop_llseek, /* write uses no f_pos */
};
@ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier read_no_fpos.read_f;
@@
struct file_operations fops = {
... .read = read_f, ...
+.llseek = noop_llseek, /* read uses no f_pos */
};
@ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
@@
struct file_operations fops = {
...
+.llseek = noop_llseek, /* no read or write fn */
};
===== End semantic patch =====
Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Julia Lawall <[email protected]>
Cc: Christoph Hellwig <[email protected]>
---
arch/arm/kernel/etm.c | 1 +
arch/arm/mach-msm/last_radio_log.c | 3 +-
arch/arm/mach-msm/smd_debug.c | 1 +
arch/arm/plat-mxc/audmux-v2.c | 1 +
arch/avr32/boards/mimc200/fram.c | 1 +
arch/blackfin/kernel/kgdb_test.c | 1 +
arch/blackfin/mach-bf561/coreb.c | 1 +
arch/cris/arch-v10/drivers/ds1302.c | 1 +
arch/cris/arch-v10/drivers/gpio.c | 1 +
arch/cris/arch-v10/drivers/i2c.c | 1 +
arch/cris/arch-v10/drivers/pcf8563.c | 1 +
arch/cris/arch-v10/drivers/sync_serial.c | 3 +-
arch/cris/arch-v32/drivers/cryptocop.c | 3 +-
arch/cris/arch-v32/drivers/i2c.c | 1 +
arch/cris/arch-v32/drivers/mach-a3/gpio.c | 1 +
arch/cris/arch-v32/drivers/mach-fs/gpio.c | 1 +
arch/cris/arch-v32/drivers/pcf8563.c | 1 +
arch/cris/arch-v32/drivers/sync_serial.c | 3 +-
arch/cris/kernel/profile.c | 1 +
arch/ia64/kernel/salinfo.c | 2 +
arch/ia64/sn/kernel/sn2/sn_hwperf.c | 1 +
arch/m68k/bvme6000/rtc.c | 1 +
arch/m68k/mvme16x/rtc.c | 1 +
arch/mips/kernel/rtlx.c | 3 +-
arch/mips/kernel/vpe.c | 3 +-
arch/mips/sibyte/common/sb_tbprof.c | 1 +
arch/powerpc/kernel/lparcfg.c | 1 +
arch/powerpc/kernel/rtas_flash.c | 3 ++
arch/powerpc/kernel/rtasd.c | 1 +
arch/powerpc/platforms/iseries/mf.c | 1 +
arch/powerpc/platforms/pseries/reconfig.c | 3 +-
arch/powerpc/platforms/pseries/scanlog.c | 1 +
arch/s390/crypto/prng.c | 1 +
arch/s390/hypfs/hypfs_diag.c | 1 +
arch/s390/hypfs/hypfs_vm.c | 1 +
arch/s390/hypfs/inode.c | 1 +
arch/s390/kernel/debug.c | 1 +
arch/sh/boards/mach-landisk/gio.c | 1 +
arch/sparc/kernel/apc.c | 1 +
arch/sparc/kernel/mdesc.c | 1 +
arch/um/drivers/harddog_kern.c | 1 +
arch/um/drivers/mconsole_kern.c | 1 +
arch/um/drivers/mmapper_kern.c | 1 +
arch/um/drivers/random.c | 1 +
arch/x86/kernel/apm_32.c | 1 +
arch/x86/kernel/cpu/mcheck/mce-severity.c | 1 +
arch/x86/kernel/cpu/mcheck/mce.c | 1 +
arch/x86/kernel/kdebugfs.c | 1 +
arch/x86/kernel/microcode_core.c | 1 +
arch/x86/xen/debugfs.c | 1 +
block/bsg.c | 1 +
drivers/acpi/debug.c | 1 +
drivers/acpi/event.c | 1 +
drivers/acpi/system.c | 2 +
drivers/block/DAC960.c | 3 +-
drivers/block/aoe/aoechr.c | 1 +
drivers/block/paride/pg.c | 1 +
drivers/block/paride/pt.c | 1 +
drivers/block/pktcdvd.c | 1 +
drivers/bluetooth/btmrvl_debugfs.c | 10 +++++++
drivers/bluetooth/hci_vhci.c | 1 +
drivers/char/apm-emulation.c | 1 +
drivers/char/bfin-otp.c | 1 +
drivers/char/briq_panel.c | 1 +
drivers/char/bsr.c | 1 +
drivers/char/cs5535_gpio.c | 3 +-
drivers/char/ds1302.c | 1 +
drivers/char/ds1620.c | 1 +
drivers/char/dsp56k.c | 1 +
drivers/char/dtlk.c | 1 +
drivers/char/genrtc.c | 1 +
drivers/char/hw_random/core.c | 1 +
drivers/char/ip2/ip2main.c | 1 +
drivers/char/ipmi/ipmi_devintf.c | 1 +
drivers/char/ipmi/ipmi_watchdog.c | 1 +
drivers/char/istallion.c | 1 +
drivers/char/lp.c | 1 +
drivers/char/mem.c | 3 ++
drivers/char/misc.c | 1 +
drivers/char/mmtimer.c | 1 +
drivers/char/mspec.c | 9 ++++--
drivers/char/mwave/mwavedd.c | 3 +-
drivers/char/nwbutton.c | 1 +
drivers/char/pc8736x_gpio.c | 1 +
drivers/char/pcmcia/cm4000_cs.c | 1 +
drivers/char/pcmcia/cm4040_cs.c | 1 +
drivers/char/random.c | 2 +
drivers/char/rio/rio_linux.c | 1 +
drivers/char/scx200_gpio.c | 1 +
drivers/char/snsc.c | 1 +
drivers/char/stallion.c | 1 +
drivers/char/sx.c | 1 +
drivers/char/sysrq.c | 1 +
drivers/char/tb0219.c | 1 +
drivers/char/tlclk.c | 1 +
drivers/char/toshiba.c | 1 +
drivers/char/uv_mmtimer.c | 1 +
drivers/char/virtio_console.c | 3 ++
drivers/char/xilinx_hwicap/xilinx_hwicap.c | 1 +
drivers/dma/coh901318.c | 1 +
drivers/gpu/drm/drm_drv.c | 3 +-
drivers/gpu/drm/i810/i810_dma.c | 1 +
drivers/gpu/drm/i830/i830_dma.c | 1 +
drivers/gpu/drm/i915/i915_debugfs.c | 1 +
drivers/gpu/vga/vgaarb.c | 1 +
drivers/hid/hid-debug.c | 1 +
drivers/hid/hid-roccat.c | 1 +
drivers/hid/hidraw.c | 1 +
drivers/hid/usbhid/hiddev.c | 1 +
drivers/hwmon/asus_atk0110.c | 1 +
drivers/ide/ide-tape.c | 1 +
drivers/idle/i7300_idle.c | 1 +
drivers/infiniband/hw/cxgb4/device.c | 1 +
drivers/infiniband/hw/ipath/ipath_diag.c | 4 ++-
drivers/infiniband/hw/ipath/ipath_file_ops.c | 3 +-
drivers/infiniband/hw/ipath/ipath_fs.c | 3 ++
drivers/infiniband/hw/qib/qib_diag.c | 4 ++-
drivers/infiniband/hw/qib/qib_file_ops.c | 3 +-
drivers/infiniband/hw/qib/qib_fs.c | 1 +
drivers/input/evdev.c | 3 +-
drivers/input/input.c | 1 +
drivers/input/joydev.c | 1 +
drivers/input/misc/uinput.c | 1 +
drivers/input/mousedev.c | 1 +
drivers/input/serio/serio_raw.c | 1 +
drivers/isdn/mISDN/timerdev.c | 1 +
drivers/lguest/lguest_user.c | 1 +
drivers/macintosh/ans-lcd.c | 1 +
drivers/macintosh/via-pmu.c | 1 +
drivers/md/dm-ioctl.c | 1 +
drivers/media/IR/imon.c | 6 +++-
drivers/media/dvb/bt8xx/dst_ca.c | 3 +-
drivers/media/dvb/dvb-core/dmxdev.c | 2 +
drivers/media/dvb/dvb-core/dvb_ca_en50221.c | 1 +
drivers/media/dvb/dvb-core/dvb_frontend.c | 3 +-
drivers/media/dvb/dvb-core/dvb_net.c | 1 +
drivers/media/dvb/dvb-core/dvbdev.c | 1 +
drivers/media/dvb/firewire/firedtv-ci.c | 1 +
drivers/media/dvb/ttpci/av7110.c | 1 +
drivers/media/dvb/ttpci/av7110_av.c | 2 +
drivers/media/dvb/ttpci/av7110_ca.c | 1 +
drivers/media/dvb/ttpci/av7110_ir.c | 1 +
drivers/mfd/ab3100-core.c | 1 +
drivers/misc/hpilo.c | 1 +
drivers/misc/phantom.c | 1 +
drivers/misc/sgi-gru/grufile.c | 1 +
drivers/mmc/core/debugfs.c | 1 +
drivers/mtd/ubi/cdev.c | 1 +
drivers/net/cxgb4/cxgb4_main.c | 1 +
drivers/net/ppp_generic.c | 3 +-
drivers/net/wimax/i2400m/debugfs.c | 2 +
drivers/net/wireless/airo.c | 24 ++++++++++++------
drivers/net/wireless/ath/ath5k/debug.c | 6 ++++
drivers/net/wireless/ath/ath9k/debug.c | 33 ++++++++++++++++--------
drivers/net/wireless/ath/ath9k/htc_drv_main.c | 9 ++++--
drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 1 +
drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 3 ++
drivers/net/wireless/iwmc3200wifi/debugfs.c | 4 +++
drivers/net/wireless/iwmc3200wifi/sdio.c | 1 +
drivers/net/wireless/libertas/debugfs.c | 1 +
drivers/net/wireless/ray_cs.c | 2 +
drivers/net/wireless/rt2x00/rt2x00debug.c | 4 +++
drivers/net/wireless/wl12xx/wl1251_debugfs.c | 2 +
drivers/net/wireless/wl12xx/wl1271_debugfs.c | 4 ++-
drivers/oprofile/oprofile_files.c | 8 +++++-
drivers/oprofile/oprofilefs.c | 3 ++
drivers/pci/pcie/aer/aer_inject.c | 1 +
drivers/pcmcia/pcmcia_ioctl.c | 1 +
drivers/platform/x86/sony-laptop.c | 1 +
drivers/rtc/rtc-m41t80.c | 1 +
drivers/s390/block/dasd_eer.c | 1 +
drivers/s390/char/fs3270.c | 1 +
drivers/s390/char/monreader.c | 1 +
drivers/s390/char/monwriter.c | 1 +
drivers/s390/char/tape_char.c | 1 +
drivers/s390/char/vmcp.c | 1 +
drivers/s390/char/vmlogrdr.c | 1 +
drivers/s390/char/vmwatchdog.c | 1 +
drivers/s390/char/zcore.c | 2 +
drivers/s390/cio/chsc_sch.c | 1 +
drivers/s390/cio/css.c | 1 +
drivers/s390/crypto/zcrypt_api.c | 3 +-
drivers/s390/scsi/zfcp_cfdc.c | 3 +-
drivers/sbus/char/display7seg.c | 1 +
drivers/sbus/char/envctrl.c | 1 +
drivers/scsi/3w-9xxx.c | 3 +-
drivers/scsi/3w-sas.c | 3 +-
drivers/scsi/3w-xxxx.c | 3 +-
drivers/scsi/aacraid/linit.c | 1 +
drivers/scsi/ch.c | 1 +
drivers/scsi/dpt_i2o.c | 1 +
drivers/scsi/gdth.c | 1 +
drivers/scsi/megaraid.c | 1 +
drivers/scsi/megaraid/megaraid_mm.c | 1 +
drivers/scsi/megaraid/megaraid_sas.c | 1 +
drivers/scsi/mpt2sas/mpt2sas_ctl.c | 1 +
drivers/scsi/osd/osd_uld.c | 1 +
drivers/scsi/pmcraid.c | 1 +
drivers/scsi/qla2xxx/qla_os.c | 1 +
drivers/scsi/scsi_tgt_if.c | 1 +
drivers/scsi/sg.c | 1 +
drivers/spi/dw_spi.c | 1 +
drivers/spi/spidev.c | 1 +
drivers/staging/batman-adv/device.c | 1 +
drivers/staging/comedi/comedi_fops.c | 1 +
drivers/staging/crystalhd/crystalhd_lnx.c | 1 +
drivers/staging/dream/camera/msm_camera.c | 3 ++
drivers/staging/dream/pmem.c | 2 +
drivers/staging/dream/qdsp5/adsp_driver.c | 1 +
drivers/staging/dream/qdsp5/audio_aac.c | 1 +
drivers/staging/dream/qdsp5/audio_amrnb.c | 1 +
drivers/staging/dream/qdsp5/audio_evrc.c | 1 +
drivers/staging/dream/qdsp5/audio_in.c | 2 +
drivers/staging/dream/qdsp5/audio_mp3.c | 1 +
drivers/staging/dream/qdsp5/audio_out.c | 2 +
drivers/staging/dream/qdsp5/audio_qcelp.c | 1 +
drivers/staging/dream/qdsp5/evlog.h | 1 +
drivers/staging/dream/qdsp5/snd.c | 1 +
drivers/staging/dt3155/dt3155_drv.c | 3 +-
drivers/staging/frontier/alphatrack.c | 1 +
drivers/staging/frontier/tranzport.c | 1 +
drivers/staging/iio/industrialio-core.c | 1 +
drivers/staging/iio/industrialio-ring.c | 1 +
drivers/staging/memrar/memrar_handler.c | 1 +
drivers/staging/panel/panel.c | 1 +
drivers/staging/sep/sep_driver.c | 1 +
drivers/telephony/ixj.c | 3 +-
drivers/telephony/phonedev.c | 1 +
drivers/uio/uio.c | 1 +
drivers/usb/class/cdc-wdm.c | 3 +-
drivers/usb/class/usblp.c | 1 +
drivers/usb/class/usbtmc.c | 1 +
drivers/usb/core/file.c | 1 +
drivers/usb/gadget/f_hid.c | 1 +
drivers/usb/gadget/printer.c | 3 +-
drivers/usb/host/ehci-dbg.c | 3 ++
drivers/usb/host/ohci-dbg.c | 3 ++
drivers/usb/image/mdc800.c | 1 +
drivers/usb/misc/adutux.c | 1 +
drivers/usb/misc/idmouse.c | 1 +
drivers/usb/misc/iowarrior.c | 1 +
drivers/usb/misc/ldusb.c | 1 +
drivers/usb/misc/rio500.c | 1 +
drivers/usb/misc/usblcd.c | 1 +
drivers/usb/usb-skeleton.c | 1 +
drivers/vhost/net.c | 1 +
drivers/video/fbmem.c | 1 +
drivers/video/mbx/mbxdebugfs.c | 6 ++++
drivers/watchdog/ar7_wdt.c | 1 +
drivers/watchdog/cpwd.c | 1 +
drivers/watchdog/ep93xx_wdt.c | 1 +
drivers/watchdog/omap_wdt.c | 1 +
drivers/xen/evtchn.c | 1 +
drivers/xen/xenfs/super.c | 1 +
drivers/xen/xenfs/xenbus.c | 1 +
fs/afs/mntpt.c | 1 +
fs/autofs4/dev-ioctl.c | 1 +
fs/binfmt_misc.c | 3 ++
fs/btrfs/super.c | 1 +
fs/cachefiles/daemon.c | 1 +
fs/char_dev.c | 1 +
fs/coda/pioctl.c | 1 +
fs/coda/psdev.c | 1 +
fs/debugfs/file.c | 3 ++
fs/dlm/debug_fs.c | 3 +-
fs/dlm/plock.c | 3 +-
fs/dlm/user.c | 3 ++
fs/ecryptfs/file.c | 1 +
fs/ecryptfs/miscdev.c | 1 +
fs/eventfd.c | 1 +
fs/eventpoll.c | 3 +-
fs/fifo.c | 1 +
fs/fuse/control.c | 4 +++
fs/fuse/cuse.c | 1 +
fs/gfs2/file.c | 2 +
fs/hppfs/hppfs.c | 1 +
fs/hugetlbfs/inode.c | 1 +
fs/logfs/dir.c | 1 +
fs/nfsd/nfsctl.c | 1 +
fs/no-block.c | 1 +
fs/notify/inotify/inotify_user.c | 1 +
fs/ntfs/file.c | 3 +-
fs/ocfs2/dlmfs/dlmfs.c | 1 +
fs/ocfs2/stack_user.c | 1 +
fs/proc/base.c | 7 +++++
fs/proc/proc_sysctl.c | 1 +
fs/proc/root.c | 1 +
fs/proc/task_mmu.c | 1 +
fs/romfs/super.c | 1 +
fs/signalfd.c | 1 +
fs/squashfs/dir.c | 3 +-
fs/timerfd.c | 1 +
fs/ubifs/debug.c | 1 +
ipc/mqueue.c | 1 +
ipc/shm.c | 2 +
kernel/configs.c | 1 +
kernel/gcov/fs.c | 1 +
kernel/kprobes.c | 1 +
kernel/pm_qos_params.c | 1 +
kernel/profile.c | 1 +
kernel/trace/blktrace.c | 2 +
kernel/trace/ftrace.c | 2 +
kernel/trace/ring_buffer.c | 1 +
kernel/trace/trace_events.c | 7 +++++
kernel/trace/trace_ksym.c | 1 +
kernel/trace/trace_stack.c | 1 +
kernel/trace/trace_sysprof.c | 1 +
lib/dma-debug.c | 1 +
net/atm/proc.c | 1 +
net/dccp/probe.c | 1 +
net/ipv4/tcp_probe.c | 1 +
net/mac80211/debugfs.c | 19 ++++++++++----
net/mac80211/rate.c | 1 +
net/mac80211/rc80211_minstrel_debugfs.c | 1 +
net/mac80211/rc80211_pid_debugfs.c | 1 +
net/netfilter/xt_recent.c | 1 +
net/nonet.c | 1 +
net/rfkill/core.c | 1 +
net/sctp/probe.c | 1 +
net/socket.c | 1 +
net/sunrpc/cache.c | 2 +
net/wireless/debugfs.c | 1 +
samples/tracepoints/tracepoint-sample.c | 1 +
security/inode.c | 1 +
security/smack/smackfs.c | 5 ++++
security/tomoyo/common.c | 1 +
sound/core/seq/oss/seq_oss.c | 1 +
sound/core/sound.c | 3 +-
sound/oss/au1550_ac97.c | 2 +
sound/oss/msnd_pinnacle.c | 1 +
sound/oss/sh_dac_audio.c | 1 +
sound/soc/soc-core.c | 1 +
sound/soc/soc-dapm.c | 1 +
sound/sound_core.c | 1 +
virt/kvm/kvm_main.c | 3 ++
335 files changed, 528 insertions(+), 69 deletions(-)
diff --git a/arch/arm/kernel/etm.c b/arch/arm/kernel/etm.c
index 8277539..88f48c7 100644
--- a/arch/arm/kernel/etm.c
+++ b/arch/arm/kernel/etm.c
@@ -314,6 +314,7 @@ static const struct file_operations etb_fops = {
.read = etb_read,
.open = etb_open,
.release = etb_release,
+ .llseek = no_llseek,/* open uses nonseekable */
};
static struct miscdevice etb_miscdev = {
diff --git a/arch/arm/mach-msm/last_radio_log.c b/arch/arm/mach-msm/last_radio_log.c
index b64ba5a..81058a3 100644
--- a/arch/arm/mach-msm/last_radio_log.c
+++ b/arch/arm/mach-msm/last_radio_log.c
@@ -48,7 +48,8 @@ static ssize_t last_radio_log_read(struct file *file, char __user *buf,
}
static struct file_operations last_radio_log_fops = {
- .read = last_radio_log_read
+ .read = last_radio_log_read,
+ .llseek = default_llseek,/* read accesses f_pos */
};
void msm_init_last_radio_log(struct module *owner)
diff --git a/arch/arm/mach-msm/smd_debug.c b/arch/arm/mach-msm/smd_debug.c
index 3b2dd71..e01a1ef 100644
--- a/arch/arm/mach-msm/smd_debug.c
+++ b/arch/arm/mach-msm/smd_debug.c
@@ -212,6 +212,7 @@ static int debug_open(struct inode *inode, struct file *file)
static const struct file_operations debug_ops = {
.read = debug_read,
.open = debug_open,
+ .llseek = default_llseek,/* read accesses f_pos */
};
static void debug_create(const char *name, mode_t mode,
diff --git a/arch/arm/plat-mxc/audmux-v2.c b/arch/arm/plat-mxc/audmux-v2.c
index 0c2cc5c..7de36c6 100644
--- a/arch/arm/plat-mxc/audmux-v2.c
+++ b/arch/arm/plat-mxc/audmux-v2.c
@@ -141,6 +141,7 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
static const struct file_operations audmux_debugfs_fops = {
.open = audmux_open_file,
.read = audmux_read_file,
+ .llseek = default_llseek,/* read accesses f_pos */
};
static void audmux_debugfs_init(void)
diff --git a/arch/avr32/boards/mimc200/fram.c b/arch/avr32/boards/mimc200/fram.c
index 54fbd95..a34cf5d 100644
--- a/arch/avr32/boards/mimc200/fram.c
+++ b/arch/avr32/boards/mimc200/fram.c
@@ -41,6 +41,7 @@ static int fram_mmap(struct file *filp, struct vm_area_struct *vma)
static const struct file_operations fram_fops = {
.owner = THIS_MODULE,
.mmap = fram_mmap,
+ .llseek = noop_llseek,/* no read or write fn */
};
#define FRAM_MINOR 0
diff --git a/arch/blackfin/kernel/kgdb_test.c b/arch/blackfin/kernel/kgdb_test.c
index 9a4b075..1a5fae7 100644
--- a/arch/blackfin/kernel/kgdb_test.c
+++ b/arch/blackfin/kernel/kgdb_test.c
@@ -88,6 +88,7 @@ static const struct file_operations kgdb_test_proc_fops = {
.owner = THIS_MODULE,
.read = kgdb_test_proc_read,
.write = kgdb_test_proc_write,
+ .llseek = noop_llseek,/* read and write both use no f_pos */
};
static int __init kgdbtest_init(void)
diff --git a/arch/blackfin/mach-bf561/coreb.c b/arch/blackfin/mach-bf561/coreb.c
index deb2271..0cb1f77 100644
--- a/arch/blackfin/mach-bf561/coreb.c
+++ b/arch/blackfin/mach-bf561/coreb.c
@@ -51,6 +51,7 @@ coreb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
static const struct file_operations coreb_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = coreb_ioctl,
+ .llseek = noop_llseek,/* no read or write fn */
};
static struct miscdevice coreb_dev = {
diff --git a/arch/cris/arch-v10/drivers/ds1302.c b/arch/cris/arch-v10/drivers/ds1302.c
index 8842756..b6d8d33 100644
--- a/arch/cris/arch-v10/drivers/ds1302.c
+++ b/arch/cris/arch-v10/drivers/ds1302.c
@@ -387,6 +387,7 @@ print_rtc_status(void)
static const struct file_operations rtc_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = rtc_unlocked_ioctl,
+ .llseek = noop_llseek,/* no read or write fn */
};
/* Probe for the chip by writing something to its RAM and try reading it back. */
diff --git a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c
index 4b0f65f..2516c2e 100644
--- a/arch/cris/arch-v10/drivers/gpio.c
+++ b/arch/cris/arch-v10/drivers/gpio.c
@@ -719,6 +719,7 @@ static const struct file_operations gpio_fops = {
.write = gpio_write,
.open = gpio_open,
.release = gpio_release,
+ .llseek = noop_llseek,/* write uses no f_pos */
};
static void ioif_watcher(const unsigned int gpio_in_available,
diff --git a/arch/cris/arch-v10/drivers/i2c.c b/arch/cris/arch-v10/drivers/i2c.c
index a8737a8..fc25b5f 100644
--- a/arch/cris/arch-v10/drivers/i2c.c
+++ b/arch/cris/arch-v10/drivers/i2c.c
@@ -622,6 +622,7 @@ static const struct file_operations i2c_fops = {
.ioctl = i2c_ioctl,
.open = i2c_open,
.release = i2c_release,
+ .llseek = noop_llseek,/* no read or write fn */
};
int __init
diff --git a/arch/cris/arch-v10/drivers/pcf8563.c b/arch/cris/arch-v10/drivers/pcf8563.c
index 7dcb1f8..fbf135b 100644
--- a/arch/cris/arch-v10/drivers/pcf8563.c
+++ b/arch/cris/arch-v10/drivers/pcf8563.c
@@ -64,6 +64,7 @@ static int voltage_low;
static const struct file_operations pcf8563_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = pcf8563_unlocked_ioctl,
+ .llseek = noop_llseek,/* no read or write fn */
};
unsigned char
diff --git a/arch/cris/arch-v10/drivers/sync_serial.c b/arch/cris/arch-v10/drivers/sync_serial.c
index 109dcd8..dd9b18b 100644
--- a/arch/cris/arch-v10/drivers/sync_serial.c
+++ b/arch/cris/arch-v10/drivers/sync_serial.c
@@ -250,7 +250,8 @@ static const struct file_operations sync_serial_fops = {
.poll = sync_serial_poll,
.ioctl = sync_serial_ioctl,
.open = sync_serial_open,
- .release = sync_serial_release
+ .release = sync_serial_release,
+ .llseek = noop_llseek,/* read and write both use no f_pos */
};
static int __init etrax_sync_serial_init(void)
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
index b70fb34..540d94d 100644
--- a/arch/cris/arch-v32/drivers/cryptocop.c
+++ b/arch/cris/arch-v32/drivers/cryptocop.c
@@ -282,7 +282,8 @@ const struct file_operations cryptocop_fops = {
.owner = THIS_MODULE,
.open = cryptocop_open,
.release = cryptocop_release,
- .ioctl = cryptocop_ioctl
+ .ioctl = cryptocop_ioctl,
+ .llseek = noop_llseek,/* no read or write fn */
};
diff --git a/arch/cris/arch-v32/drivers/i2c.c b/arch/cris/arch-v32/drivers/i2c.c
index 2fd6a74..69a1d9a 100644
--- a/arch/cris/arch-v32/drivers/i2c.c
+++ b/arch/cris/arch-v32/drivers/i2c.c
@@ -698,6 +698,7 @@ static const struct file_operations i2c_fops = {
.unlocked_ioctl = i2c_ioctl,
.open = i2c_open,
.release = i2c_release,
+ .llseek = noop_llseek,/* no read or write fn */
};
static int __init i2c_init(void)
diff --git a/arch/cris/arch-v32/drivers/mach-a3/gpio.c b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
index 97357cf..13bf637 100644
--- a/arch/cris/arch-v32/drivers/mach-a3/gpio.c
+++ b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
@@ -883,6 +883,7 @@ static const struct file_operations gpio_fops = {
.write = gpio_write,
.open = gpio_open,
.release = gpio_release,
+ .llseek = noop_llseek,/* write uses no f_pos */
};
#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
The default for llseek will change to no_llseek,
so ibmasmfs needs to add explicit .llseek
assignments. Since we're dealing with regular
files from a VFS perspective, use generic_file_llseek.
Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/misc/ibmasm/ibmasmfs.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
index 8844a3f..af2497a 100644
--- a/drivers/misc/ibmasm/ibmasmfs.c
+++ b/drivers/misc/ibmasm/ibmasmfs.c
@@ -584,6 +584,7 @@ static const struct file_operations command_fops = {
.release = command_file_close,
.read = command_file_read,
.write = command_file_write,
+ .llseek = generic_file_llseek,
};
static const struct file_operations event_fops = {
@@ -591,6 +592,7 @@ static const struct file_operations event_fops = {
.release = event_file_close,
.read = event_file_read,
.write = event_file_write,
+ .llseek = generic_file_llseek,
};
static const struct file_operations r_heartbeat_fops = {
@@ -598,6 +600,7 @@ static const struct file_operations r_heartbeat_fops = {
.release = r_heartbeat_file_close,
.read = r_heartbeat_file_read,
.write = r_heartbeat_file_write,
+ .llseek = generic_file_llseek,
};
static const struct file_operations remote_settings_fops = {
@@ -605,6 +608,7 @@ static const struct file_operations remote_settings_fops = {
.release = remote_settings_file_close,
.read = remote_settings_file_read,
.write = remote_settings_file_write,
+ .llseek = generic_file_llseek,
};
--
1.7.1
Some applications try to seek on tape devices
and fail if they return an error. Since we
want to change the default llseek action to
no_llseek, viotape needs to be changed to use
noop_llseek explicitly.
Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/char/viotape.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c
index 42f7fa4..442c3f5 100644
--- a/drivers/char/viotape.c
+++ b/drivers/char/viotape.c
@@ -804,6 +804,7 @@ const struct file_operations viotap_fops = {
.unlocked_ioctl = viotap_unlocked_ioctl,
.open = viotap_open,
.release = viotap_release,
+ .llseek = noop_llseek,
};
/* Handle interrupt events for tape */
--
1.7.1
The default for llseek will change to no_llseek,
so selinuxfs needs to add explicit .llseek
assignments. Since we're dealing with regular
files from a VFS perspective, use generic_file_llseek.
Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Stephen Smalley <[email protected]>
Cc: James Morris <[email protected]>
Cc: Eric Paris <[email protected]>
Cc: [email protected]
---
security/selinux/selinuxfs.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 0293843..79a1bb6 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -184,6 +184,7 @@ out:
static const struct file_operations sel_enforce_ops = {
.read = sel_read_enforce,
.write = sel_write_enforce,
+ .llseek = generic_file_llseek,
};
static ssize_t sel_read_handle_unknown(struct file *filp, char __user *buf,
@@ -201,6 +202,7 @@ static ssize_t sel_read_handle_unknown(struct file *filp, char __user *buf,
static const struct file_operations sel_handle_unknown_ops = {
.read = sel_read_handle_unknown,
+ .llseek = generic_file_llseek,
};
#ifdef CONFIG_SECURITY_SELINUX_DISABLE
@@ -251,6 +253,7 @@ out:
static const struct file_operations sel_disable_ops = {
.write = sel_write_disable,
+ .llseek = generic_file_llseek,
};
static ssize_t sel_read_policyvers(struct file *filp, char __user *buf,
@@ -265,6 +268,7 @@ static ssize_t sel_read_policyvers(struct file *filp, char __user *buf,
static const struct file_operations sel_policyvers_ops = {
.read = sel_read_policyvers,
+ .llseek = generic_file_llseek,
};
/* declaration for sel_write_load */
@@ -289,6 +293,7 @@ static ssize_t sel_read_mls(struct file *filp, char __user *buf,
static const struct file_operations sel_mls_ops = {
.read = sel_read_mls,
+ .llseek = generic_file_llseek,
};
static ssize_t sel_write_load(struct file *file, const char __user *buf,
@@ -356,6 +361,7 @@ out:
static const struct file_operations sel_load_ops = {
.write = sel_write_load,
+ .llseek = generic_file_llseek,
};
static ssize_t sel_write_context(struct file *file, char *buf, size_t size)
@@ -437,6 +443,7 @@ out:
static const struct file_operations sel_checkreqprot_ops = {
.read = sel_read_checkreqprot,
.write = sel_write_checkreqprot,
+ .llseek = generic_file_llseek,
};
/*
@@ -482,6 +489,7 @@ static const struct file_operations transaction_ops = {
.write = selinux_transaction_write,
.read = simple_transaction_read,
.release = simple_transaction_release,
+ .llseek = generic_file_llseek,
};
/*
@@ -883,6 +891,7 @@ out:
static const struct file_operations sel_bool_ops = {
.read = sel_read_bool,
.write = sel_write_bool,
+ .llseek = generic_file_llseek,
};
static ssize_t sel_commit_bools_write(struct file *filep,
@@ -935,6 +944,7 @@ out:
static const struct file_operations sel_commit_bools_ops = {
.write = sel_commit_bools_write,
+ .llseek = generic_file_llseek,
};
static void sel_remove_entries(struct dentry *de)
@@ -1127,10 +1137,12 @@ out:
static const struct file_operations sel_avc_cache_threshold_ops = {
.read = sel_read_avc_cache_threshold,
.write = sel_write_avc_cache_threshold,
+ .llseek = generic_file_llseek,
};
static const struct file_operations sel_avc_hash_stats_ops = {
.read = sel_read_avc_hash_stats,
+ .llseek = generic_file_llseek,
};
#ifdef CONFIG_SECURITY_SELINUX_AVC_STATS
@@ -1255,6 +1267,7 @@ static ssize_t sel_read_initcon(struct file *file, char __user *buf,
static const struct file_operations sel_initcon_ops = {
.read = sel_read_initcon,
+ .llseek = generic_file_llseek,
};
static int sel_make_initcon_files(struct dentry *dir)
@@ -1330,6 +1343,7 @@ out:
static const struct file_operations sel_class_ops = {
.read = sel_read_class,
+ .llseek = generic_file_llseek,
};
static ssize_t sel_read_perm(struct file *file, char __user *buf,
@@ -1354,6 +1368,7 @@ out:
static const struct file_operations sel_perm_ops = {
.read = sel_read_perm,
+ .llseek = generic_file_llseek,
};
static ssize_t sel_read_policycap(struct file *file, char __user *buf,
@@ -1372,6 +1387,7 @@ static ssize_t sel_read_policycap(struct file *file, char __user *buf,
static const struct file_operations sel_policycap_ops = {
.read = sel_read_policycap,
+ .llseek = generic_file_llseek,
};
static int sel_make_perm_files(char *objclass, int classvalue,
--
1.7.1
In future kernels, debugfs files need to specify
the llseek operation explicitly to allow seeking.
This sets the llseek operation in the omap iommu
debugfs files to generic_file_llseek, which is
appropriate for files using simple_read_from_buffer.
Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Tony Lindgren <[email protected]>
Cc: [email protected]
---
arch/arm/plat-omap/iommu-debug.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/arm/plat-omap/iommu-debug.c b/arch/arm/plat-omap/iommu-debug.c
index e6c0d53..f07cf2f 100644
--- a/arch/arm/plat-omap/iommu-debug.c
+++ b/arch/arm/plat-omap/iommu-debug.c
@@ -328,12 +328,14 @@ static int debug_open_generic(struct inode *inode, struct file *file)
.open = debug_open_generic, \
.read = debug_read_##name, \
.write = debug_write_##name, \
+ .llseek = generic_file_llseek, \
};
#define DEBUG_FOPS_RO(name) \
static const struct file_operations debug_##name##_fops = { \
.open = debug_open_generic, \
.read = debug_read_##name, \
+ .llseek = generic_file_llseek, \
};
DEBUG_FOPS_RO(ver);
--
1.7.1
The default for llseek will change to no_llseek,
so securityfs users need to add explicit .llseek
assignments. Since we're dealing with regular
files from a VFS perspective, use generic_file_llseek.
Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Mimi Zohar <[email protected]>
Cc: James Morris <[email protected]>
Cc: [email protected]
---
security/integrity/ima/ima_fs.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c
index 8fe736a..ef21b96 100644
--- a/security/integrity/ima/ima_fs.c
+++ b/security/integrity/ima/ima_fs.c
@@ -45,7 +45,8 @@ static ssize_t ima_show_htable_violations(struct file *filp,
}
static const struct file_operations ima_htable_violations_ops = {
- .read = ima_show_htable_violations
+ .read = ima_show_htable_violations,
+ .llseek = generic_file_llseek,
};
static ssize_t ima_show_measurements_count(struct file *filp,
@@ -57,7 +58,8 @@ static ssize_t ima_show_measurements_count(struct file *filp,
}
static const struct file_operations ima_measurements_count_ops = {
- .read = ima_show_measurements_count
+ .read = ima_show_measurements_count,
+ .llseek = generic_file_llseek,
};
/* returns pointer to hlist_node */
@@ -319,7 +321,8 @@ static int ima_release_policy(struct inode *inode, struct file *file)
static const struct file_operations ima_measure_policy_ops = {
.open = ima_open_policy,
.write = ima_write_policy,
- .release = ima_release_policy
+ .release = ima_release_policy,
+ .llseek = generic_file_llseek,
};
int __init ima_fs_init(void)
--
1.7.1
When the default llseek action gets changed to
no_llseek, all file systems relying on the
current behaviour need to set explicit .llseek
operations.
In case of qib_fs, we want the files to be
seekable, so generic_file_llseek fits best.
Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Roland Dreier <[email protected]>
Cc: Sean Hefty <[email protected]>
Cc: Hal Rosenstock <[email protected]>
Cc: [email protected]
---
drivers/infiniband/hw/qib/qib_fs.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c
index 844954b..9f989c0 100644
--- a/drivers/infiniband/hw/qib/qib_fs.c
+++ b/drivers/infiniband/hw/qib/qib_fs.c
@@ -135,8 +135,8 @@ static ssize_t driver_names_read(struct file *file, char __user *buf,
}
static const struct file_operations driver_ops[] = {
- { .read = driver_stats_read, },
- { .read = driver_names_read, },
+ { .read = driver_stats_read, .llseek = generic_file_llseek, },
+ { .read = driver_names_read, .llseek = generic_file_llseek, },
};
/* read the per-device counters */
@@ -164,8 +164,8 @@ static ssize_t dev_names_read(struct file *file, char __user *buf,
}
static const struct file_operations cntr_ops[] = {
- { .read = dev_counters_read, },
- { .read = dev_names_read, },
+ { .read = dev_counters_read, .llseek = generic_file_llseek, },
+ { .read = dev_names_read, .llseek = generic_file_llseek, },
};
/*
@@ -210,9 +210,9 @@ static ssize_t portcntrs_2_read(struct file *file, char __user *buf,
}
static const struct file_operations portcntr_ops[] = {
- { .read = portnames_read, },
- { .read = portcntrs_1_read, },
- { .read = portcntrs_2_read, },
+ { .read = portnames_read, .llseek = generic_file_llseek, },
+ { .read = portcntrs_1_read, .llseek = generic_file_llseek, },
+ { .read = portcntrs_2_read, .llseek = generic_file_llseek, },
};
/*
@@ -261,8 +261,8 @@ static ssize_t qsfp_2_read(struct file *file, char __user *buf,
}
static const struct file_operations qsfp_ops[] = {
- { .read = qsfp_1_read, },
- { .read = qsfp_2_read, },
+ { .read = qsfp_1_read, .llseek = generic_file_llseek, },
+ { .read = qsfp_2_read, .llseek = generic_file_llseek, },
};
static ssize_t flash_read(struct file *file, char __user *buf,
--
1.7.1
All file operations now have an explicit .llseek
operation pointer, so we can change the default
action for future code.
This makes changes the default from default_llseek
to no_llseek, which always returns -ESPIPE if
a user tries to seek on a file without a .llseek
operation.
The name of the default_llseek function remains
unchanged, if anyone thinks we should change it,
please speak up.
Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Al Viro <[email protected]>
Cc: [email protected]
---
fs/read_write.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/fs/read_write.c b/fs/read_write.c
index 31c0be7..d2ed19a 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -156,7 +156,6 @@ loff_t vfs_llseek(struct file *file, loff_t offset, int origin)
fn = no_llseek;
if (file->f_mode & FMODE_LSEEK) {
- fn = default_llseek;
if (file->f_op && file->f_op->llseek)
fn = file->f_op->llseek;
}
--
1.7.1
The default for llseek will change to no_llseek,
so the tracing debugfs files need to add explicit
.llseek assignments. Since we're dealing with regular
files from a VFS perspective, use generic_file_llseek.
Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
---
kernel/trace/trace.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 086d363..de3d6b3 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2394,6 +2394,7 @@ static const struct file_operations show_traces_fops = {
.open = show_traces_open,
.read = seq_read,
.release = seq_release,
+ .llseek = seq_lseek,
};
/*
@@ -2487,6 +2488,7 @@ static const struct file_operations tracing_cpumask_fops = {
.open = tracing_open_generic,
.read = tracing_cpumask_read,
.write = tracing_cpumask_write,
+ .llseek = generic_file_llseek,
};
static int tracing_trace_options_show(struct seq_file *m, void *v)
@@ -2653,6 +2655,7 @@ tracing_readme_read(struct file *filp, char __user *ubuf,
static const struct file_operations tracing_readme_fops = {
.open = tracing_open_generic,
.read = tracing_readme_read,
+ .llseek = generic_file_llseek,
};
static ssize_t
@@ -2703,6 +2706,7 @@ tracing_saved_cmdlines_read(struct file *file, char __user *ubuf,
static const struct file_operations tracing_saved_cmdlines_fops = {
.open = tracing_open_generic,
.read = tracing_saved_cmdlines_read,
+ .llseek = generic_file_llseek,
};
static ssize_t
@@ -3032,6 +3036,7 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)
if (iter->trace->pipe_open)
iter->trace->pipe_open(iter);
+ nonseekable_open(inode, filp);
out:
mutex_unlock(&trace_types_lock);
return ret;
@@ -3590,18 +3595,21 @@ static const struct file_operations tracing_max_lat_fops = {
.open = tracing_open_generic,
.read = tracing_max_lat_read,
.write = tracing_max_lat_write,
+ .llseek = generic_file_llseek,
};
static const struct file_operations tracing_ctrl_fops = {
.open = tracing_open_generic,
.read = tracing_ctrl_read,
.write = tracing_ctrl_write,
+ .llseek = generic_file_llseek,
};
static const struct file_operations set_tracer_fops = {
.open = tracing_open_generic,
.read = tracing_set_trace_read,
.write = tracing_set_trace_write,
+ .llseek = generic_file_llseek,
};
static const struct file_operations tracing_pipe_fops = {
@@ -3610,17 +3618,20 @@ static const struct file_operations tracing_pipe_fops = {
.read = tracing_read_pipe,
.splice_read = tracing_splice_read_pipe,
.release = tracing_release_pipe,
+ .llseek = no_llseek,
};
static const struct file_operations tracing_entries_fops = {
.open = tracing_open_generic,
.read = tracing_entries_read,
.write = tracing_entries_write,
+ .llseek = generic_file_llseek,
};
static const struct file_operations tracing_mark_fops = {
.open = tracing_open_generic,
.write = tracing_mark_write,
+ .llseek = generic_file_llseek,
};
static const struct file_operations trace_clock_fops = {
@@ -3926,6 +3937,7 @@ tracing_stats_read(struct file *filp, char __user *ubuf,
static const struct file_operations tracing_stats_fops = {
.open = tracing_open_generic,
.read = tracing_stats_read,
+ .llseek = generic_file_llseek,
};
#ifdef CONFIG_DYNAMIC_FTRACE
@@ -3962,6 +3974,7 @@ tracing_read_dyn_info(struct file *filp, char __user *ubuf,
static const struct file_operations tracing_dyn_info_fops = {
.open = tracing_open_generic,
.read = tracing_read_dyn_info,
+ .llseek = generic_file_llseek,
};
#endif
@@ -4115,6 +4128,7 @@ static const struct file_operations trace_options_fops = {
.open = tracing_open_generic,
.read = trace_options_read,
.write = trace_options_write,
+ .llseek = generic_file_llseek,
};
static ssize_t
@@ -4166,6 +4180,7 @@ static const struct file_operations trace_options_core_fops = {
.open = tracing_open_generic,
.read = trace_options_core_read,
.write = trace_options_core_write,
+ .llseek = generic_file_llseek,
};
struct dentry *trace_create_file(const char *name,
--
1.7.1
There are currently 191 users of default_llseek.
Nine of these are in device drivers that use the
big kernel lock. None of these ever touch
file->f_pos outside of llseek or file_pos_write.
Consequently, we never rely on the BKL
in the default_llseek function and can
replace that with i_mutex, which is also
used in generic_file_llseek.
Signed-off-by: Arnd Bergmann <[email protected]>
---
fs/read_write.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/read_write.c b/fs/read_write.c
index 9c04852..31c0be7 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -124,7 +124,7 @@ loff_t default_llseek(struct file *file, loff_t offset, int origin)
{
loff_t retval;
- lock_kernel();
+ mutex_lock(&file->f_dentry->d_inode->i_mutex);
switch (origin) {
case SEEK_END:
offset += i_size_read(file->f_path.dentry->d_inode);
@@ -145,7 +145,7 @@ loff_t default_llseek(struct file *file, loff_t offset, int origin)
retval = offset;
}
out:
- unlock_kernel();
+ mutex_unlock(&file->f_dentry->d_inode->i_mutex);
return retval;
}
EXPORT_SYMBOL(default_llseek);
--
1.7.1
The default llseek operation is changing from
default_llseek to no_llseek, so all code relying on
the current behaviour needs to make that explicit.
The wireless driver infrastructure and some of the drivers
make use of generated debugfs files, so they cannot
be converted by our script that automatically determines
the right operation.
All these files use debugfs and they typically rely
on simple_read_from_buffer, so the best llseek operation
here is generic_file_llseek.
Signed-off-by: Arnd Bergmann <[email protected]>
Cc: "John W. Linville" <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/misc/iwmc3200top/debugfs.c | 3 +++
drivers/net/wireless/b43/debugfs.c | 1 +
drivers/net/wireless/b43legacy/debugfs.c | 1 +
drivers/net/wireless/iwlwifi/iwl-debugfs.c | 3 +++
drivers/net/wireless/libertas/debugfs.c | 1 +
drivers/net/wireless/rt2x00/rt2x00debug.c | 1 +
drivers/net/wireless/wl12xx/wl1251_debugfs.c | 2 ++
drivers/net/wireless/wl12xx/wl1271_debugfs.c | 2 ++
net/mac80211/debugfs.c | 2 ++
net/mac80211/debugfs_key.c | 2 ++
net/mac80211/debugfs_netdev.c | 1 +
net/mac80211/debugfs_sta.c | 2 ++
net/wireless/debugfs.c | 1 +
13 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/drivers/misc/iwmc3200top/debugfs.c b/drivers/misc/iwmc3200top/debugfs.c
index e9eda47..62fbaec 100644
--- a/drivers/misc/iwmc3200top/debugfs.c
+++ b/drivers/misc/iwmc3200top/debugfs.c
@@ -71,6 +71,7 @@ ssize_t iwmct_dbgfs_##name##_write(struct file *file, \
static const struct file_operations iwmct_dbgfs_##name##_ops = { \
.read = iwmct_dbgfs_##name##_read, \
.open = iwmct_dbgfs_open_file_generic, \
+ .llseek = generic_file_llseek, \
};
#define DEBUGFS_WRITE_FILE_OPS(name) \
@@ -78,6 +79,7 @@ ssize_t iwmct_dbgfs_##name##_write(struct file *file, \
static const struct file_operations iwmct_dbgfs_##name##_ops = { \
.write = iwmct_dbgfs_##name##_write, \
.open = iwmct_dbgfs_open_file_generic, \
+ .llseek = generic_file_llseek, \
};
#define DEBUGFS_READ_WRITE_FILE_OPS(name) \
@@ -87,6 +89,7 @@ ssize_t iwmct_dbgfs_##name##_write(struct file *file, \
.write = iwmct_dbgfs_##name##_write, \
.read = iwmct_dbgfs_##name##_read, \
.open = iwmct_dbgfs_open_file_generic, \
+ .llseek = generic_file_llseek, \
};
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c
index 80b19a4..59f59fa 100644
--- a/drivers/net/wireless/b43/debugfs.c
+++ b/drivers/net/wireless/b43/debugfs.c
@@ -627,6 +627,7 @@ out_unlock:
.open = b43_debugfs_open, \
.read = b43_debugfs_read, \
.write = b43_debugfs_write, \
+ .llseek = generic_file_llseek, \
}, \
.file_struct_offset = offsetof(struct b43_dfsentry, \
file_##name), \
diff --git a/drivers/net/wireless/b43legacy/debugfs.c b/drivers/net/wireless/b43legacy/debugfs.c
index 1f85ac5..f232618 100644
--- a/drivers/net/wireless/b43legacy/debugfs.c
+++ b/drivers/net/wireless/b43legacy/debugfs.c
@@ -334,6 +334,7 @@ out_unlock:
.open = b43legacy_debugfs_open, \
.read = b43legacy_debugfs_read, \
.write = b43legacy_debugfs_write, \
+ .llseek = generic_file_llseek, \
}, \
.file_struct_offset = offsetof(struct b43legacy_dfsentry, \
file_##name), \
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 9659c5d..0d03cf2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -87,6 +87,7 @@ static int iwl_dbgfs_open_file_generic(struct inode *inode, struct file *file)
static const struct file_operations iwl_dbgfs_##name##_ops = { \
.read = iwl_dbgfs_##name##_read, \
.open = iwl_dbgfs_open_file_generic, \
+ .llseek = generic_file_llseek, \
};
#define DEBUGFS_WRITE_FILE_OPS(name) \
@@ -94,6 +95,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
static const struct file_operations iwl_dbgfs_##name##_ops = { \
.write = iwl_dbgfs_##name##_write, \
.open = iwl_dbgfs_open_file_generic, \
+ .llseek = generic_file_llseek, \
};
@@ -104,6 +106,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
.write = iwl_dbgfs_##name##_write, \
.read = iwl_dbgfs_##name##_read, \
.open = iwl_dbgfs_open_file_generic, \
+ .llseek = generic_file_llseek, \
};
int iwl_dbgfs_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz)
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index de2caac..94f8f99 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -713,6 +713,7 @@ out_unlock:
.open = open_file_generic, \
.read = (fread), \
.write = (fwrite), \
+ .llseek = generic_file_llseek, \
}
struct lbs_debugfs_files {
diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c
index e9fe93f..fe92500 100644
--- a/drivers/net/wireless/rt2x00/rt2x00debug.c
+++ b/drivers/net/wireless/rt2x00/rt2x00debug.c
@@ -508,6 +508,7 @@ static const struct file_operations rt2x00debug_fop_##__name = {\
.write = rt2x00debug_write_##__name, \
.open = rt2x00debug_file_open, \
.release = rt2x00debug_file_release, \
+ .llseek = generic_file_llseek, \
};
RT2X00DEBUGFS_OPS(csr, "0x%.8x\n", u32);
diff --git a/drivers/net/wireless/wl12xx/wl1251_debugfs.c b/drivers/net/wireless/wl12xx/wl1251_debugfs.c
index 5e4465a..a4ae7c4 100644
--- a/drivers/net/wireless/wl12xx/wl1251_debugfs.c
+++ b/drivers/net/wireless/wl12xx/wl1251_debugfs.c
@@ -50,6 +50,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \
static const struct file_operations name## _ops = { \
.read = name## _read, \
.open = wl1251_open_file_generic, \
+ .llseek = generic_file_llseek, \
};
#define DEBUGFS_ADD(name, parent) \
@@ -86,6 +87,7 @@ static ssize_t sub## _ ##name## _read(struct file *file, \
static const struct file_operations sub## _ ##name## _ops = { \
.read = sub## _ ##name## _read, \
.open = wl1251_open_file_generic, \
+ .llseek = generic_file_llseek, \
};
#define DEBUGFS_FWSTATS_ADD(sub, name) \
diff --git a/drivers/net/wireless/wl12xx/wl1271_debugfs.c b/drivers/net/wireless/wl12xx/wl1271_debugfs.c
index c239ef4..6e25303 100644
--- a/drivers/net/wireless/wl12xx/wl1271_debugfs.c
+++ b/drivers/net/wireless/wl12xx/wl1271_debugfs.c
@@ -51,6 +51,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \
static const struct file_operations name## _ops = { \
.read = name## _read, \
.open = wl1271_open_file_generic, \
+ .llseek = generic_file_llseek, \
};
#define DEBUGFS_ADD(name, parent) \
@@ -87,6 +88,7 @@ static ssize_t sub## _ ##name## _read(struct file *file, \
static const struct file_operations sub## _ ##name## _ops = { \
.read = sub## _ ##name## _read, \
.open = wl1271_open_file_generic, \
+ .llseek = generic_file_llseek, \
};
#define DEBUGFS_FWSTATS_ADD(sub, name) \
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index 637929b..31b6b89 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -36,6 +36,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \
static const struct file_operations name## _ops = { \
.read = name## _read, \
.open = mac80211_open_file_generic, \
+ .llseek = generic_file_llseek, \
};
#define DEBUGFS_ADD(name) \
@@ -349,6 +350,7 @@ static ssize_t stats_ ##name## _read(struct file *file, \
static const struct file_operations stats_ ##name## _ops = { \
.read = stats_ ##name## _read, \
.open = mac80211_open_file_generic, \
+ .llseek = generic_file_llseek, \
};
#define DEBUGFS_STATS_ADD(name) \
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c
index 97c9e46..1bc39ac 100644
--- a/net/mac80211/debugfs_key.c
+++ b/net/mac80211/debugfs_key.c
@@ -32,6 +32,7 @@ static ssize_t key_##name##_read(struct file *file, \
static const struct file_operations key_ ##name## _ops = { \
.read = key_##name##_read, \
.open = mac80211_open_file_generic, \
+ .llseek = generic_file_llseek, \
}
#define KEY_FILE(name, format) \
@@ -46,6 +47,7 @@ static const struct file_operations key_ ##name## _ops = { \
static const struct file_operations key_ ##name## _ops = { \
.read = key_conf_##name##_read, \
.open = mac80211_open_file_generic, \
+ .llseek = generic_file_llseek, \
}
#define KEY_CONF_FILE(name, format) \
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 20b2998..8ad33ee 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -121,6 +121,7 @@ static const struct file_operations name##_ops = { \
.read = ieee80211_if_read_##name, \
.write = (_write), \
.open = mac80211_open_file_generic, \
+ .llseek = generic_file_llseek, \
}
#define __IEEE80211_IF_FILE_W(name) \
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index e763f15..73f8f36 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -37,6 +37,7 @@ static ssize_t sta_ ##name## _read(struct file *file, \
static const struct file_operations sta_ ##name## _ops = { \
.read = sta_##name##_read, \
.open = mac80211_open_file_generic, \
+ .llseek = generic_file_llseek, \
}
#define STA_OPS_RW(name) \
@@ -44,6 +45,7 @@ static const struct file_operations sta_ ##name## _ops = { \
.read = sta_##name##_read, \
.write = sta_##name##_write, \
.open = mac80211_open_file_generic, \
+ .llseek = generic_file_llseek, \
}
#define STA_FILE(name, field, format) \
diff --git a/net/wireless/debugfs.c b/net/wireless/debugfs.c
index a4991a3..3f9a57e 100644
--- a/net/wireless/debugfs.c
+++ b/net/wireless/debugfs.c
@@ -34,6 +34,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \
static const struct file_operations name## _ops = { \
.read = name## _read, \
.open = cfg80211_open_file_generic, \
+ .llseek = generic_file_llseek, \
};
DEBUGFS_READONLY_FILE(rts_threshold, 20, "%d",
--
1.7.1
These could not be detected by the semantic patch.
Signed-off-by: Arnd Bergmann <[email protected]>
Cc: [email protected]
Cc: Greg Kroah-Hartman <[email protected]>
---
drivers/staging/msm/mdp4_debugfs.c | 10 ++--------
drivers/staging/panel/panel.c | 3 ++-
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/msm/mdp4_debugfs.c b/drivers/staging/msm/mdp4_debugfs.c
index 844d467..36954e8 100644
--- a/drivers/staging/msm/mdp4_debugfs.c
+++ b/drivers/staging/msm/mdp4_debugfs.c
@@ -63,13 +63,6 @@ DEFINE_SIMPLE_ATTRIBUTE(
"%llx\n");
-static int mdp4_debugfs_open(struct inode *inode, struct file *file)
-{
- /* non-seekable */
- file->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE);
- return 0;
-}
-
static int mdp4_debugfs_release(struct inode *inode, struct file *file)
{
return 0;
@@ -144,10 +137,11 @@ static ssize_t mdp4_debugfs_read(
}
static const struct file_operations mdp4_debugfs_fops = {
- .open = mdp4_debugfs_open,
+ .open = nonseekable_open,
.release = mdp4_debugfs_release,
.read = mdp4_debugfs_read,
.write = mdp4_debugfs_write,
+ .llseek = no_llseek,
};
int mdp4_debugfs_init(void)
diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 9ca0e9e..be05b98 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -1295,7 +1295,7 @@ static int lcd_open(struct inode *inode, struct file *file)
lcd_must_clear = 0;
}
lcd_open_cnt++;
- return 0;
+ return nonseekable_open(inode, file);
}
static int lcd_release(struct inode *inode, struct file *file)
@@ -1308,6 +1308,7 @@ static struct file_operations lcd_fops = {
.write = lcd_write,
.open = lcd_open,
.release = lcd_release,
+ .llseek = no_llseek,
};
static struct miscdevice lcd_dev = {
--
1.7.1
The raw_fops may need to seek, so there should
be an explicit reference to default_llseek.
raw_ctl_fops does not contain a read or write
method, so we use noop_llseek to ignore seeking
requests without an error.
Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/char/raw.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/char/raw.c b/drivers/char/raw.c
index b38942f..28c0169 100644
--- a/drivers/char/raw.c
+++ b/drivers/char/raw.c
@@ -258,6 +258,7 @@ static const struct file_operations raw_fops = {
.open = raw_open,
.release = raw_release,
.unlocked_ioctl = raw_ioctl,
+ .llseek = default_llseek,
.owner = THIS_MODULE,
};
@@ -265,6 +266,7 @@ static const struct file_operations raw_ctl_fops = {
.unlocked_ioctl = raw_ctl_ioctl,
.open = raw_open,
.owner = THIS_MODULE,
+ .llseek = noop_llseek,
};
static struct cdev raw_cdev;
--
1.7.1
On Wed, Jul 7, 2010 at 17:40, Arnd Bergmann wrote:
> All file_operations should get a .llseek
> operation so we can make nonseekable_open
> the default for future file operations
> without a .llseek pointer.
>
> The three cases that we can automatically
> detect are no_llseek, seq_lseek and
> default_llseek. For cases where we can
> we can automatically prove that the
> file offset is always ignored, we use
> noop_llseek, which maintains the current
> behavior of not returning an error from
> a seek.
>
> New drivers should normally not use
> noop_llseek but instead use no_llseek and
> call nonseekable_open at open time.
> Existing drivers can be converted to do
> the same when the maintainer knows for
> certain that no user code relies on calling
> seek on the device file.
can we skip the transition for devices that we already know ?
> --- a/arch/blackfin/kernel/kgdb_test.c
> +++ b/arch/blackfin/kernel/kgdb_test.c
> static const struct file_operations kgdb_test_proc_fops = {
> + Â Â Â .llseek = noop_llseek,/* read and write both use no f_pos */
> --- a/arch/blackfin/mach-bf561/coreb.c
> +++ b/arch/blackfin/mach-bf561/coreb.c
> Â static const struct file_operations coreb_fops = {
> + Â Â Â .llseek = noop_llseek,/* no read or write fn */
neither of these drivers are seekable, so attempts to do so should be
an error ...
> drivers/char/bfin-otp.c
>+ .llseek = default_llseek,/* read accesses f_pos */
lseeking should work fine with bfin-otp, so this change is OK
-mike
On Wed, Jul 07, 2010 at 11:40:11PM +0200, Arnd Bergmann wrote:
> The default for llseek will change to no_llseek,
> so the tracing debugfs files need to add explicit
> .llseek assignments. Since we're dealing with regular
> files from a VFS perspective, use generic_file_llseek.
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Cc: Steven Rostedt <[email protected]>
> Cc: Frederic Weisbecker <[email protected]>
> Cc: Ingo Molnar <[email protected]>
> ---
> kernel/trace/trace.c | 15 +++++++++++++++
> 1 files changed, 15 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 086d363..de3d6b3 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -2394,6 +2394,7 @@ static const struct file_operations show_traces_fops = {
> .open = show_traces_open,
> .read = seq_read,
> .release = seq_release,
> + .llseek = seq_lseek,
> };
>
> /*
> @@ -2487,6 +2488,7 @@ static const struct file_operations tracing_cpumask_fops = {
> .open = tracing_open_generic,
> .read = tracing_cpumask_read,
> .write = tracing_cpumask_write,
> + .llseek = generic_file_llseek,
> };
>
> static int tracing_trace_options_show(struct seq_file *m, void *v)
> @@ -2653,6 +2655,7 @@ tracing_readme_read(struct file *filp, char __user *ubuf,
> static const struct file_operations tracing_readme_fops = {
> .open = tracing_open_generic,
> .read = tracing_readme_read,
> + .llseek = generic_file_llseek,
> };
>
> static ssize_t
> @@ -2703,6 +2706,7 @@ tracing_saved_cmdlines_read(struct file *file, char __user *ubuf,
> static const struct file_operations tracing_saved_cmdlines_fops = {
> .open = tracing_open_generic,
> .read = tracing_saved_cmdlines_read,
> + .llseek = generic_file_llseek,
> };
>
> static ssize_t
> @@ -3032,6 +3036,7 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)
> if (iter->trace->pipe_open)
> iter->trace->pipe_open(iter);
>
> + nonseekable_open(inode, filp);
> out:
> mutex_unlock(&trace_types_lock);
> return ret;
> @@ -3590,18 +3595,21 @@ static const struct file_operations tracing_max_lat_fops = {
> .open = tracing_open_generic,
> .read = tracing_max_lat_read,
> .write = tracing_max_lat_write,
> + .llseek = generic_file_llseek,
> };
>
> static const struct file_operations tracing_ctrl_fops = {
> .open = tracing_open_generic,
> .read = tracing_ctrl_read,
> .write = tracing_ctrl_write,
> + .llseek = generic_file_llseek,
> };
>
> static const struct file_operations set_tracer_fops = {
> .open = tracing_open_generic,
> .read = tracing_set_trace_read,
> .write = tracing_set_trace_write,
> + .llseek = generic_file_llseek,
> };
>
> static const struct file_operations tracing_pipe_fops = {
> @@ -3610,17 +3618,20 @@ static const struct file_operations tracing_pipe_fops = {
> .read = tracing_read_pipe,
> .splice_read = tracing_splice_read_pipe,
> .release = tracing_release_pipe,
> + .llseek = no_llseek,
If you use nonseekable_open you don't need no_llseek there. That said I'm
all for keeping this as it's easier to grep fops that lack a proper llseek
callback with that.
> };
>
> static const struct file_operations tracing_entries_fops = {
> .open = tracing_open_generic,
> .read = tracing_entries_read,
> .write = tracing_entries_write,
> + .llseek = generic_file_llseek,
> };
>
> static const struct file_operations tracing_mark_fops = {
> .open = tracing_open_generic,
> .write = tracing_mark_write,
> + .llseek = generic_file_llseek,
> };
>
> static const struct file_operations trace_clock_fops = {
> @@ -3926,6 +3937,7 @@ tracing_stats_read(struct file *filp, char __user *ubuf,
> static const struct file_operations tracing_stats_fops = {
> .open = tracing_open_generic,
> .read = tracing_stats_read,
> + .llseek = generic_file_llseek,
> };
>
> #ifdef CONFIG_DYNAMIC_FTRACE
> @@ -3962,6 +3974,7 @@ tracing_read_dyn_info(struct file *filp, char __user *ubuf,
> static const struct file_operations tracing_dyn_info_fops = {
> .open = tracing_open_generic,
> .read = tracing_read_dyn_info,
> + .llseek = generic_file_llseek,
> };
> #endif
>
> @@ -4115,6 +4128,7 @@ static const struct file_operations trace_options_fops = {
> .open = tracing_open_generic,
> .read = trace_options_read,
> .write = trace_options_write,
> + .llseek = generic_file_llseek,
> };
>
> static ssize_t
> @@ -4166,6 +4180,7 @@ static const struct file_operations trace_options_core_fops = {
> .open = tracing_open_generic,
> .read = trace_options_core_read,
> .write = trace_options_core_write,
> + .llseek = generic_file_llseek,
> };
>
> struct dentry *trace_create_file(const char *name,
> --
> 1.7.1
>
Applied, thanks Arnd!
On Wednesday 07 July 2010 23:55:25 Mike Frysinger wrote:
> > New drivers should normally not use
> > noop_llseek but instead use no_llseek and
> > call nonseekable_open at open time.
> > Existing drivers can be converted to do
> > the same when the maintainer knows for
> > certain that no user code relies on calling
> > seek on the device file.
>
> can we skip the transition for devices that we already know ?
Yes, we could do that for the cases that call nonseekable_open
either by putting it into file_operations or by calling it
from their own open() function in the same file. These
are the two cases where the semantic patch currently adds
no_llseek.
The reason I added the explicit no_llseek was so I could
tell the difference between those file operations that
use nonseekable_open and those that spatch could for
some reason not identify as belonging into any of the
categories.
> > --- a/arch/blackfin/kernel/kgdb_test.c
> > +++ b/arch/blackfin/kernel/kgdb_test.c
> > static const struct file_operations kgdb_test_proc_fops = {
> > + .llseek = noop_llseek,/* read and write both use no f_pos */
> > --- a/arch/blackfin/mach-bf561/coreb.c
> > +++ b/arch/blackfin/mach-bf561/coreb.c
> > static const struct file_operations coreb_fops = {
> > + .llseek = noop_llseek,/* no read or write fn */
>
> neither of these drivers are seekable, so attempts to do so should be
> an error ...
Ok, then you should add ".open = nonseekable_open," to the file
operations and put that change into a tree that gets pulled into
linux-next. The semantic patch will do the right thing then,
whatever we decide.
Arnd
Hi Arnd,
> The default for llseek is changing, so we need
> explicit operations everywhere.
Looks good, but:
> @@ -2151,7 +2166,7 @@ static ssize_t spufs_ibox_info_read(struct file *file, char __user *buf,
> static const struct file_operations spufs_ibox_info_fops = {
> .open = spufs_info_open,
> .read = spufs_ibox_info_read,
> - .llseek = generic_file_llseek,
> + .llseek = no_llseek,
> };
>
> static ssize_t __spufs_wbox_info_read(struct spu_context *ctx,
> @@ -2194,7 +2209,7 @@ static ssize_t spufs_wbox_info_read(struct file *file, char __user *buf,
> static const struct file_operations spufs_wbox_info_fops = {
> .open = spufs_info_open,
> .read = spufs_wbox_info_read,
> - .llseek = generic_file_llseek,
> + .llseek = no_llseek,
> };
>
Why the change in behaviour for the mbox info files?
Cheers,
Jeremy
Hello.
Arnd Bergmann wrote:
> All file operations now have an explicit .llseek
> operation pointer, so we can change the default
> action for future code.
I saw patch for SELinux and IMA, but not for TOMOYO.
TOMOYO has
static const struct file_operations tomoyo_operations
without .llseek operation pointer.
TOMOYO does not deal offset pointer. Thus seek operation makes
no sense. But returning -ESPIPE for seek operation might break
some applications. What should I do for TOMOYO?
Regards.
On Thursday 08 July 2010, Tetsuo Handa wrote:
> Hello.
>
> Arnd Bergmann wrote:
> > All file operations now have an explicit .llseek
> > operation pointer, so we can change the default
> > action for future code.
>
> I saw patch for SELinux and IMA, but not for TOMOYO.
> TOMOYO has
>
> static const struct file_operations tomoyo_operations
>
> without .llseek operation pointer.
>
> TOMOYO does not deal offset pointer. Thus seek operation makes
> no sense. But returning -ESPIPE for seek operation might break
> some applications. What should I do for TOMOYO?
The semantic patch (16/18 in this series) had detected that case,
so I did not have to manually create a patch as for selinux
and ima.
The behaviour you want is noop_llseek, which is what gets used
when the semantic patch is applied. If you wish, you can
do the patch yourself and add .llseek = noop_llseek to the file
operations in your tree.
Arnd
On 07/08/2010 12:40 AM, Arnd Bergmann wrote:
> All file_operations should get a .llseek
> operation so we can make nonseekable_open
> the default for future file operations
> without a .llseek pointer.
>
> The three cases that we can automatically
> detect are no_llseek, seq_lseek and
> default_llseek. For cases where we can
> we can automatically prove that the
> file offset is always ignored, we use
> noop_llseek, which maintains the current
> behavior of not returning an error from
> a seek.
>
> New drivers should normally not use
> noop_llseek but instead use no_llseek and
> call nonseekable_open at open time.
> Existing drivers can be converted to do
> the same when the maintainer knows for
> certain that no user code relies on calling
> seek on the device file.
>
> The generated code is often incorrectly
> indented and right now contains comments that
> clarify for each added line why a specific
> variant was chosen. In the version that gets
> submitted upstream, the comments will be gone
> and I will manually fix the indentation,
> because there does not seem to be a way to
> do that using coccinelle.
>
> Some amount of new code is currently sitting
> in linux-next that should get the same
> modifications, which I will do at the end of
> the merge window.
>
> This specific posted version of the patch only
> covers first few files in order to avoid
> spamming everybody's inbox. I think you still
> get the point. The diffstat is complete, and
> the full patch is available in the 'llseek'
> branch of
> git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl.git
>
> Many thanks to Julia Lawall for helping me
> learn to write a semantic patch that does
> all this.
>
> ===== begin semantic patch =====
> // This adds an llseek= method to all file operations,
> // as a preparation for making no_llseek the default.
> //
> // The rules are
> // - use no_llseek explicitly if we do nonseekable_open
> // - use seq_lseek for sequential files
> // - use default_llseek if we know we access f_pos
> // - use noop_llseek if we know we don't access f_pos,
> // but we still want to allow users to call lseek
> //
> @ open1 exists @
> identifier nested_open;
> @@
> nested_open(...)
> {
> <+...
> nonseekable_open(...)
> ...+>
> }
>
> @ open exists@
> identifier open_f;
> identifier i, f;
> identifier open1.nested_open;
> @@
> int open_f(struct inode *i, struct file *f)
> {
> <+...
> (
> nonseekable_open(...)
> |
> nested_open(...)
> )
> ...+>
> }
>
> @ read disable optional_qualifier exists @
> identifier read_f;
> identifier f, p, s, off;
> type ssize_t, size_t, loff_t;
> expression E;
> identifier func;
> @@
> ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
> {
> <+...
> (
> *off = E
> |
> *off += E
> |
> func(..., off, ...)
> |
> E = *off
> )
> ...+>
> }
>
> @ read_no_fpos disable optional_qualifier exists @
> identifier read_f;
> identifier f, p, s, off;
> type ssize_t, size_t, loff_t;
> @@
> ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
> {
> ... when != off
> }
>
> @ write @
> identifier write_f;
> identifier f, p, s, off;
> type ssize_t, size_t, loff_t;
> expression E;
> identifier func;
> @@
> ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
> {
> <+...
> (
> *off = E
> |
> *off += E
> |
> func(..., off, ...)
> |
> E = *off
> )
> ...+>
> }
>
> @ write_no_fpos @
> identifier write_f;
> identifier f, p, s, off;
> type ssize_t, size_t, loff_t;
> @@
> ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
> {
> ... when != off
> }
>
> @ fops0 @
> identifier fops;
> @@
> struct file_operations fops = {
> ...
> };
>
> @ has_llseek depends on fops0 @
> identifier fops0.fops;
> identifier llseek_f;
> @@
> struct file_operations fops = {
> ...
> .llseek = llseek_f,
> ...
> };
>
> @ has_read depends on fops0 @
> identifier fops0.fops;
> identifier read_f;
> @@
> struct file_operations fops = {
> ...
> .read = read_f,
> ...
> };
>
> @ has_write depends on fops0 @
> identifier fops0.fops;
> identifier write_f;
> @@
> struct file_operations fops = {
> ...
> .write = write_f,
> ...
> };
>
> @ has_open depends on fops0 @
> identifier fops0.fops;
> identifier open_f;
> @@
> struct file_operations fops = {
> ...
> .open = open_f,
> ...
> };
>
> // use no_llseek if we call nonseekable_open
> ////////////////////////////////////////////
> @ nonseekable1 depends on !has_llseek && has_open @
> identifier fops0.fops;
> identifier nso ~= "nonseekable_open";
> @@
> struct file_operations fops = {
> ... .open = nso, ...
> +.llseek = no_llseek, /* nonseekable */
> };
>
> @ nonseekable2 depends on !has_llseek @
> identifier fops0.fops;
> identifier open.open_f;
> @@
> struct file_operations fops = {
> ... .open = open_f, ...
> +.llseek = no_llseek, /* open uses nonseekable */
> };
>
> // use seq_lseek for sequential files
> /////////////////////////////////////
> @ seq depends on !has_llseek @
> identifier fops0.fops;
> identifier sr ~= "seq_read";
> @@
> struct file_operations fops = {
> ... .read = sr, ...
> +.llseek = seq_lseek, /* we have seq_read */
> };
>
> // use default_llseek if there is a readdir
> ///////////////////////////////////////////
> @ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
> identifier fops0.fops;
> identifier readdir_e;
> @@
> // any other fop is used that changes pos
> struct file_operations fops = {
> ... .readdir = readdir_e, ...
> +.llseek = default_llseek, /* readdir is present */
> };
>
> // use default_llseek if at least one of read/write touches f_pos
> /////////////////////////////////////////////////////////////////
> @ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
> identifier fops0.fops;
> identifier read.read_f;
> @@
> // read fops use offset
> struct file_operations fops = {
> ... .read = read_f, ...
> +.llseek = default_llseek, /* read accesses f_pos */
> };
>
> @ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
> identifier fops0.fops;
> identifier write.write_f;
> @@
> // write fops use offset
> struct file_operations fops = {
> ... .write = write_f, ...
> + .llseek = default_llseek, /* write accesses f_pos */
> };
>
> // Use noop_llseek if neither read nor write accesses f_pos
> ///////////////////////////////////////////////////////////
>
> @ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
> identifier fops0.fops;
> identifier read_no_fpos.read_f;
> identifier write_no_fpos.write_f;
> @@
> // write fops use offset
> struct file_operations fops = {
> ...
> .write = write_f,
> .read = read_f,
> ...
> +.llseek = noop_llseek, /* read and write both use no f_pos */
> };
>
> @ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
> identifier fops0.fops;
> identifier write_no_fpos.write_f;
> @@
> struct file_operations fops = {
> ... .write = write_f, ...
> +.llseek = noop_llseek, /* write uses no f_pos */
> };
>
> @ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
> identifier fops0.fops;
> identifier read_no_fpos.read_f;
> @@
> struct file_operations fops = {
> ... .read = read_f, ...
> +.llseek = noop_llseek, /* read uses no f_pos */
> };
>
> @ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
> identifier fops0.fops;
> @@
> struct file_operations fops = {
> ...
> +.llseek = noop_llseek, /* no read or write fn */
> };
> ===== End semantic patch =====
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Cc: Julia Lawall <[email protected]>
> Cc: Christoph Hellwig <[email protected]>
> ---
> arch/arm/kernel/etm.c | 1 +
> arch/arm/mach-msm/last_radio_log.c | 3 +-
> arch/arm/mach-msm/smd_debug.c | 1 +
> arch/arm/plat-mxc/audmux-v2.c | 1 +
> arch/avr32/boards/mimc200/fram.c | 1 +
> arch/blackfin/kernel/kgdb_test.c | 1 +
> arch/blackfin/mach-bf561/coreb.c | 1 +
> arch/cris/arch-v10/drivers/ds1302.c | 1 +
> arch/cris/arch-v10/drivers/gpio.c | 1 +
> arch/cris/arch-v10/drivers/i2c.c | 1 +
> arch/cris/arch-v10/drivers/pcf8563.c | 1 +
> arch/cris/arch-v10/drivers/sync_serial.c | 3 +-
> arch/cris/arch-v32/drivers/cryptocop.c | 3 +-
> arch/cris/arch-v32/drivers/i2c.c | 1 +
> arch/cris/arch-v32/drivers/mach-a3/gpio.c | 1 +
> arch/cris/arch-v32/drivers/mach-fs/gpio.c | 1 +
> arch/cris/arch-v32/drivers/pcf8563.c | 1 +
> arch/cris/arch-v32/drivers/sync_serial.c | 3 +-
> arch/cris/kernel/profile.c | 1 +
> arch/ia64/kernel/salinfo.c | 2 +
> arch/ia64/sn/kernel/sn2/sn_hwperf.c | 1 +
> arch/m68k/bvme6000/rtc.c | 1 +
> arch/m68k/mvme16x/rtc.c | 1 +
> arch/mips/kernel/rtlx.c | 3 +-
> arch/mips/kernel/vpe.c | 3 +-
> arch/mips/sibyte/common/sb_tbprof.c | 1 +
> arch/powerpc/kernel/lparcfg.c | 1 +
> arch/powerpc/kernel/rtas_flash.c | 3 ++
> arch/powerpc/kernel/rtasd.c | 1 +
> arch/powerpc/platforms/iseries/mf.c | 1 +
> arch/powerpc/platforms/pseries/reconfig.c | 3 +-
> arch/powerpc/platforms/pseries/scanlog.c | 1 +
> arch/s390/crypto/prng.c | 1 +
> arch/s390/hypfs/hypfs_diag.c | 1 +
> arch/s390/hypfs/hypfs_vm.c | 1 +
> arch/s390/hypfs/inode.c | 1 +
> arch/s390/kernel/debug.c | 1 +
> arch/sh/boards/mach-landisk/gio.c | 1 +
> arch/sparc/kernel/apc.c | 1 +
> arch/sparc/kernel/mdesc.c | 1 +
> arch/um/drivers/harddog_kern.c | 1 +
> arch/um/drivers/mconsole_kern.c | 1 +
> arch/um/drivers/mmapper_kern.c | 1 +
> arch/um/drivers/random.c | 1 +
> arch/x86/kernel/apm_32.c | 1 +
> arch/x86/kernel/cpu/mcheck/mce-severity.c | 1 +
> arch/x86/kernel/cpu/mcheck/mce.c | 1 +
> arch/x86/kernel/kdebugfs.c | 1 +
> arch/x86/kernel/microcode_core.c | 1 +
> arch/x86/xen/debugfs.c | 1 +
> block/bsg.c | 1 +
> drivers/acpi/debug.c | 1 +
> drivers/acpi/event.c | 1 +
> drivers/acpi/system.c | 2 +
> drivers/block/DAC960.c | 3 +-
> drivers/block/aoe/aoechr.c | 1 +
> drivers/block/paride/pg.c | 1 +
> drivers/block/paride/pt.c | 1 +
> drivers/block/pktcdvd.c | 1 +
> drivers/bluetooth/btmrvl_debugfs.c | 10 +++++++
> drivers/bluetooth/hci_vhci.c | 1 +
> drivers/char/apm-emulation.c | 1 +
> drivers/char/bfin-otp.c | 1 +
> drivers/char/briq_panel.c | 1 +
> drivers/char/bsr.c | 1 +
> drivers/char/cs5535_gpio.c | 3 +-
> drivers/char/ds1302.c | 1 +
> drivers/char/ds1620.c | 1 +
> drivers/char/dsp56k.c | 1 +
> drivers/char/dtlk.c | 1 +
> drivers/char/genrtc.c | 1 +
> drivers/char/hw_random/core.c | 1 +
> drivers/char/ip2/ip2main.c | 1 +
> drivers/char/ipmi/ipmi_devintf.c | 1 +
> drivers/char/ipmi/ipmi_watchdog.c | 1 +
> drivers/char/istallion.c | 1 +
> drivers/char/lp.c | 1 +
> drivers/char/mem.c | 3 ++
> drivers/char/misc.c | 1 +
> drivers/char/mmtimer.c | 1 +
> drivers/char/mspec.c | 9 ++++--
> drivers/char/mwave/mwavedd.c | 3 +-
> drivers/char/nwbutton.c | 1 +
> drivers/char/pc8736x_gpio.c | 1 +
> drivers/char/pcmcia/cm4000_cs.c | 1 +
> drivers/char/pcmcia/cm4040_cs.c | 1 +
> drivers/char/random.c | 2 +
> drivers/char/rio/rio_linux.c | 1 +
> drivers/char/scx200_gpio.c | 1 +
> drivers/char/snsc.c | 1 +
> drivers/char/stallion.c | 1 +
> drivers/char/sx.c | 1 +
> drivers/char/sysrq.c | 1 +
> drivers/char/tb0219.c | 1 +
> drivers/char/tlclk.c | 1 +
> drivers/char/toshiba.c | 1 +
> drivers/char/uv_mmtimer.c | 1 +
> drivers/char/virtio_console.c | 3 ++
> drivers/char/xilinx_hwicap/xilinx_hwicap.c | 1 +
> drivers/dma/coh901318.c | 1 +
> drivers/gpu/drm/drm_drv.c | 3 +-
> drivers/gpu/drm/i810/i810_dma.c | 1 +
> drivers/gpu/drm/i830/i830_dma.c | 1 +
> drivers/gpu/drm/i915/i915_debugfs.c | 1 +
> drivers/gpu/vga/vgaarb.c | 1 +
> drivers/hid/hid-debug.c | 1 +
> drivers/hid/hid-roccat.c | 1 +
> drivers/hid/hidraw.c | 1 +
> drivers/hid/usbhid/hiddev.c | 1 +
> drivers/hwmon/asus_atk0110.c | 1 +
> drivers/ide/ide-tape.c | 1 +
> drivers/idle/i7300_idle.c | 1 +
> drivers/infiniband/hw/cxgb4/device.c | 1 +
> drivers/infiniband/hw/ipath/ipath_diag.c | 4 ++-
> drivers/infiniband/hw/ipath/ipath_file_ops.c | 3 +-
> drivers/infiniband/hw/ipath/ipath_fs.c | 3 ++
> drivers/infiniband/hw/qib/qib_diag.c | 4 ++-
> drivers/infiniband/hw/qib/qib_file_ops.c | 3 +-
> drivers/infiniband/hw/qib/qib_fs.c | 1 +
> drivers/input/evdev.c | 3 +-
> drivers/input/input.c | 1 +
> drivers/input/joydev.c | 1 +
> drivers/input/misc/uinput.c | 1 +
> drivers/input/mousedev.c | 1 +
> drivers/input/serio/serio_raw.c | 1 +
> drivers/isdn/mISDN/timerdev.c | 1 +
> drivers/lguest/lguest_user.c | 1 +
> drivers/macintosh/ans-lcd.c | 1 +
> drivers/macintosh/via-pmu.c | 1 +
> drivers/md/dm-ioctl.c | 1 +
> drivers/media/IR/imon.c | 6 +++-
> drivers/media/dvb/bt8xx/dst_ca.c | 3 +-
> drivers/media/dvb/dvb-core/dmxdev.c | 2 +
> drivers/media/dvb/dvb-core/dvb_ca_en50221.c | 1 +
> drivers/media/dvb/dvb-core/dvb_frontend.c | 3 +-
> drivers/media/dvb/dvb-core/dvb_net.c | 1 +
> drivers/media/dvb/dvb-core/dvbdev.c | 1 +
> drivers/media/dvb/firewire/firedtv-ci.c | 1 +
> drivers/media/dvb/ttpci/av7110.c | 1 +
> drivers/media/dvb/ttpci/av7110_av.c | 2 +
> drivers/media/dvb/ttpci/av7110_ca.c | 1 +
> drivers/media/dvb/ttpci/av7110_ir.c | 1 +
> drivers/mfd/ab3100-core.c | 1 +
> drivers/misc/hpilo.c | 1 +
> drivers/misc/phantom.c | 1 +
> drivers/misc/sgi-gru/grufile.c | 1 +
> drivers/mmc/core/debugfs.c | 1 +
> drivers/mtd/ubi/cdev.c | 1 +
> drivers/net/cxgb4/cxgb4_main.c | 1 +
> drivers/net/ppp_generic.c | 3 +-
> drivers/net/wimax/i2400m/debugfs.c | 2 +
> drivers/net/wireless/airo.c | 24 ++++++++++++------
> drivers/net/wireless/ath/ath5k/debug.c | 6 ++++
> drivers/net/wireless/ath/ath9k/debug.c | 33 ++++++++++++++++--------
> drivers/net/wireless/ath/ath9k/htc_drv_main.c | 9 ++++--
> drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 1 +
> drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 3 ++
> drivers/net/wireless/iwmc3200wifi/debugfs.c | 4 +++
> drivers/net/wireless/iwmc3200wifi/sdio.c | 1 +
> drivers/net/wireless/libertas/debugfs.c | 1 +
> drivers/net/wireless/ray_cs.c | 2 +
> drivers/net/wireless/rt2x00/rt2x00debug.c | 4 +++
> drivers/net/wireless/wl12xx/wl1251_debugfs.c | 2 +
> drivers/net/wireless/wl12xx/wl1271_debugfs.c | 4 ++-
> drivers/oprofile/oprofile_files.c | 8 +++++-
> drivers/oprofile/oprofilefs.c | 3 ++
> drivers/pci/pcie/aer/aer_inject.c | 1 +
> drivers/pcmcia/pcmcia_ioctl.c | 1 +
> drivers/platform/x86/sony-laptop.c | 1 +
> drivers/rtc/rtc-m41t80.c | 1 +
> drivers/s390/block/dasd_eer.c | 1 +
> drivers/s390/char/fs3270.c | 1 +
> drivers/s390/char/monreader.c | 1 +
> drivers/s390/char/monwriter.c | 1 +
> drivers/s390/char/tape_char.c | 1 +
> drivers/s390/char/vmcp.c | 1 +
> drivers/s390/char/vmlogrdr.c | 1 +
> drivers/s390/char/vmwatchdog.c | 1 +
> drivers/s390/char/zcore.c | 2 +
> drivers/s390/cio/chsc_sch.c | 1 +
> drivers/s390/cio/css.c | 1 +
> drivers/s390/crypto/zcrypt_api.c | 3 +-
> drivers/s390/scsi/zfcp_cfdc.c | 3 +-
> drivers/sbus/char/display7seg.c | 1 +
> drivers/sbus/char/envctrl.c | 1 +
> drivers/scsi/3w-9xxx.c | 3 +-
> drivers/scsi/3w-sas.c | 3 +-
> drivers/scsi/3w-xxxx.c | 3 +-
> drivers/scsi/aacraid/linit.c | 1 +
> drivers/scsi/ch.c | 1 +
> drivers/scsi/dpt_i2o.c | 1 +
> drivers/scsi/gdth.c | 1 +
> drivers/scsi/megaraid.c | 1 +
> drivers/scsi/megaraid/megaraid_mm.c | 1 +
> drivers/scsi/megaraid/megaraid_sas.c | 1 +
> drivers/scsi/mpt2sas/mpt2sas_ctl.c | 1 +
> drivers/scsi/osd/osd_uld.c | 1 +
> drivers/scsi/pmcraid.c | 1 +
> drivers/scsi/qla2xxx/qla_os.c | 1 +
> drivers/scsi/scsi_tgt_if.c | 1 +
> drivers/scsi/sg.c | 1 +
> drivers/spi/dw_spi.c | 1 +
> drivers/spi/spidev.c | 1 +
> drivers/staging/batman-adv/device.c | 1 +
> drivers/staging/comedi/comedi_fops.c | 1 +
> drivers/staging/crystalhd/crystalhd_lnx.c | 1 +
> drivers/staging/dream/camera/msm_camera.c | 3 ++
> drivers/staging/dream/pmem.c | 2 +
> drivers/staging/dream/qdsp5/adsp_driver.c | 1 +
> drivers/staging/dream/qdsp5/audio_aac.c | 1 +
> drivers/staging/dream/qdsp5/audio_amrnb.c | 1 +
> drivers/staging/dream/qdsp5/audio_evrc.c | 1 +
> drivers/staging/dream/qdsp5/audio_in.c | 2 +
> drivers/staging/dream/qdsp5/audio_mp3.c | 1 +
> drivers/staging/dream/qdsp5/audio_out.c | 2 +
> drivers/staging/dream/qdsp5/audio_qcelp.c | 1 +
> drivers/staging/dream/qdsp5/evlog.h | 1 +
> drivers/staging/dream/qdsp5/snd.c | 1 +
> drivers/staging/dt3155/dt3155_drv.c | 3 +-
> drivers/staging/frontier/alphatrack.c | 1 +
> drivers/staging/frontier/tranzport.c | 1 +
> drivers/staging/iio/industrialio-core.c | 1 +
> drivers/staging/iio/industrialio-ring.c | 1 +
> drivers/staging/memrar/memrar_handler.c | 1 +
> drivers/staging/panel/panel.c | 1 +
> drivers/staging/sep/sep_driver.c | 1 +
> drivers/telephony/ixj.c | 3 +-
> drivers/telephony/phonedev.c | 1 +
> drivers/uio/uio.c | 1 +
> drivers/usb/class/cdc-wdm.c | 3 +-
> drivers/usb/class/usblp.c | 1 +
> drivers/usb/class/usbtmc.c | 1 +
> drivers/usb/core/file.c | 1 +
> drivers/usb/gadget/f_hid.c | 1 +
> drivers/usb/gadget/printer.c | 3 +-
> drivers/usb/host/ehci-dbg.c | 3 ++
> drivers/usb/host/ohci-dbg.c | 3 ++
> drivers/usb/image/mdc800.c | 1 +
> drivers/usb/misc/adutux.c | 1 +
> drivers/usb/misc/idmouse.c | 1 +
> drivers/usb/misc/iowarrior.c | 1 +
> drivers/usb/misc/ldusb.c | 1 +
> drivers/usb/misc/rio500.c | 1 +
> drivers/usb/misc/usblcd.c | 1 +
> drivers/usb/usb-skeleton.c | 1 +
> drivers/vhost/net.c | 1 +
> drivers/video/fbmem.c | 1 +
> drivers/video/mbx/mbxdebugfs.c | 6 ++++
> drivers/watchdog/ar7_wdt.c | 1 +
> drivers/watchdog/cpwd.c | 1 +
> drivers/watchdog/ep93xx_wdt.c | 1 +
> drivers/watchdog/omap_wdt.c | 1 +
> drivers/xen/evtchn.c | 1 +
> drivers/xen/xenfs/super.c | 1 +
> drivers/xen/xenfs/xenbus.c | 1 +
> fs/afs/mntpt.c | 1 +
> fs/autofs4/dev-ioctl.c | 1 +
> fs/binfmt_misc.c | 3 ++
> fs/btrfs/super.c | 1 +
> fs/cachefiles/daemon.c | 1 +
> fs/char_dev.c | 1 +
> fs/coda/pioctl.c | 1 +
> fs/coda/psdev.c | 1 +
> fs/debugfs/file.c | 3 ++
> fs/dlm/debug_fs.c | 3 +-
> fs/dlm/plock.c | 3 +-
> fs/dlm/user.c | 3 ++
> fs/ecryptfs/file.c | 1 +
> fs/ecryptfs/miscdev.c | 1 +
> fs/eventfd.c | 1 +
> fs/eventpoll.c | 3 +-
> fs/fifo.c | 1 +
> fs/fuse/control.c | 4 +++
> fs/fuse/cuse.c | 1 +
> fs/gfs2/file.c | 2 +
> fs/hppfs/hppfs.c | 1 +
> fs/hugetlbfs/inode.c | 1 +
> fs/logfs/dir.c | 1 +
> fs/nfsd/nfsctl.c | 1 +
> fs/no-block.c | 1 +
> fs/notify/inotify/inotify_user.c | 1 +
> fs/ntfs/file.c | 3 +-
> fs/ocfs2/dlmfs/dlmfs.c | 1 +
> fs/ocfs2/stack_user.c | 1 +
> fs/proc/base.c | 7 +++++
> fs/proc/proc_sysctl.c | 1 +
> fs/proc/root.c | 1 +
> fs/proc/task_mmu.c | 1 +
> fs/romfs/super.c | 1 +
> fs/signalfd.c | 1 +
> fs/squashfs/dir.c | 3 +-
> fs/timerfd.c | 1 +
> fs/ubifs/debug.c | 1 +
> ipc/mqueue.c | 1 +
> ipc/shm.c | 2 +
> kernel/configs.c | 1 +
> kernel/gcov/fs.c | 1 +
> kernel/kprobes.c | 1 +
> kernel/pm_qos_params.c | 1 +
> kernel/profile.c | 1 +
> kernel/trace/blktrace.c | 2 +
> kernel/trace/ftrace.c | 2 +
> kernel/trace/ring_buffer.c | 1 +
> kernel/trace/trace_events.c | 7 +++++
> kernel/trace/trace_ksym.c | 1 +
> kernel/trace/trace_stack.c | 1 +
> kernel/trace/trace_sysprof.c | 1 +
> lib/dma-debug.c | 1 +
> net/atm/proc.c | 1 +
> net/dccp/probe.c | 1 +
> net/ipv4/tcp_probe.c | 1 +
> net/mac80211/debugfs.c | 19 ++++++++++----
> net/mac80211/rate.c | 1 +
> net/mac80211/rc80211_minstrel_debugfs.c | 1 +
> net/mac80211/rc80211_pid_debugfs.c | 1 +
> net/netfilter/xt_recent.c | 1 +
> net/nonet.c | 1 +
> net/rfkill/core.c | 1 +
> net/sctp/probe.c | 1 +
> net/socket.c | 1 +
> net/sunrpc/cache.c | 2 +
> net/wireless/debugfs.c | 1 +
> samples/tracepoints/tracepoint-sample.c | 1 +
> security/inode.c | 1 +
> security/smack/smackfs.c | 5 ++++
> security/tomoyo/common.c | 1 +
> sound/core/seq/oss/seq_oss.c | 1 +
> sound/core/sound.c | 3 +-
> sound/oss/au1550_ac97.c | 2 +
> sound/oss/msnd_pinnacle.c | 1 +
> sound/oss/sh_dac_audio.c | 1 +
> sound/soc/soc-core.c | 1 +
> sound/soc/soc-dapm.c | 1 +
> sound/sound_core.c | 1 +
> virt/kvm/kvm_main.c | 3 ++
> 335 files changed, 528 insertions(+), 69 deletions(-)
>
> diff --git a/arch/arm/kernel/etm.c b/arch/arm/kernel/etm.c
> index 8277539..88f48c7 100644
> --- a/arch/arm/kernel/etm.c
> +++ b/arch/arm/kernel/etm.c
> @@ -314,6 +314,7 @@ static const struct file_operations etb_fops = {
> .read = etb_read,
> .open = etb_open,
> .release = etb_release,
> + .llseek = no_llseek,/* open uses nonseekable */
> };
>
> static struct miscdevice etb_miscdev = {
> diff --git a/arch/arm/mach-msm/last_radio_log.c b/arch/arm/mach-msm/last_radio_log.c
> index b64ba5a..81058a3 100644
> --- a/arch/arm/mach-msm/last_radio_log.c
> +++ b/arch/arm/mach-msm/last_radio_log.c
> @@ -48,7 +48,8 @@ static ssize_t last_radio_log_read(struct file *file, char __user *buf,
> }
>
> static struct file_operations last_radio_log_fops = {
> - .read = last_radio_log_read
> + .read = last_radio_log_read,
> + .llseek = default_llseek,/* read accesses f_pos */
> };
>
> void msm_init_last_radio_log(struct module *owner)
> diff --git a/arch/arm/mach-msm/smd_debug.c b/arch/arm/mach-msm/smd_debug.c
> index 3b2dd71..e01a1ef 100644
> --- a/arch/arm/mach-msm/smd_debug.c
> +++ b/arch/arm/mach-msm/smd_debug.c
> @@ -212,6 +212,7 @@ static int debug_open(struct inode *inode, struct file *file)
> static const struct file_operations debug_ops = {
> .read = debug_read,
> .open = debug_open,
> + .llseek = default_llseek,/* read accesses f_pos */
> };
>
> static void debug_create(const char *name, mode_t mode,
> diff --git a/arch/arm/plat-mxc/audmux-v2.c b/arch/arm/plat-mxc/audmux-v2.c
> index 0c2cc5c..7de36c6 100644
> --- a/arch/arm/plat-mxc/audmux-v2.c
> +++ b/arch/arm/plat-mxc/audmux-v2.c
> @@ -141,6 +141,7 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
> static const struct file_operations audmux_debugfs_fops = {
> .open = audmux_open_file,
> .read = audmux_read_file,
> + .llseek = default_llseek,/* read accesses f_pos */
> };
>
> static void audmux_debugfs_init(void)
> diff --git a/arch/avr32/boards/mimc200/fram.c b/arch/avr32/boards/mimc200/fram.c
> index 54fbd95..a34cf5d 100644
> --- a/arch/avr32/boards/mimc200/fram.c
> +++ b/arch/avr32/boards/mimc200/fram.c
> @@ -41,6 +41,7 @@ static int fram_mmap(struct file *filp, struct vm_area_struct *vma)
> static const struct file_operations fram_fops = {
> .owner = THIS_MODULE,
> .mmap = fram_mmap,
> + .llseek = noop_llseek,/* no read or write fn */
> };
>
> #define FRAM_MINOR 0
> diff --git a/arch/blackfin/kernel/kgdb_test.c b/arch/blackfin/kernel/kgdb_test.c
> index 9a4b075..1a5fae7 100644
> --- a/arch/blackfin/kernel/kgdb_test.c
> +++ b/arch/blackfin/kernel/kgdb_test.c
> @@ -88,6 +88,7 @@ static const struct file_operations kgdb_test_proc_fops = {
> .owner = THIS_MODULE,
> .read = kgdb_test_proc_read,
> .write = kgdb_test_proc_write,
> + .llseek = noop_llseek,/* read and write both use no f_pos */
> };
>
> static int __init kgdbtest_init(void)
> diff --git a/arch/blackfin/mach-bf561/coreb.c b/arch/blackfin/mach-bf561/coreb.c
> index deb2271..0cb1f77 100644
> --- a/arch/blackfin/mach-bf561/coreb.c
> +++ b/arch/blackfin/mach-bf561/coreb.c
> @@ -51,6 +51,7 @@ coreb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> static const struct file_operations coreb_fops = {
> .owner = THIS_MODULE,
> .unlocked_ioctl = coreb_ioctl,
> + .llseek = noop_llseek,/* no read or write fn */
> };
>
> static struct miscdevice coreb_dev = {
> diff --git a/arch/cris/arch-v10/drivers/ds1302.c b/arch/cris/arch-v10/drivers/ds1302.c
> index 8842756..b6d8d33 100644
> --- a/arch/cris/arch-v10/drivers/ds1302.c
> +++ b/arch/cris/arch-v10/drivers/ds1302.c
> @@ -387,6 +387,7 @@ print_rtc_status(void)
> static const struct file_operations rtc_fops = {
> .owner = THIS_MODULE,
> .unlocked_ioctl = rtc_unlocked_ioctl,
> + .llseek = noop_llseek,/* no read or write fn */
> };
>
> /* Probe for the chip by writing something to its RAM and try reading it back. */
> diff --git a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c
> index 4b0f65f..2516c2e 100644
> --- a/arch/cris/arch-v10/drivers/gpio.c
> +++ b/arch/cris/arch-v10/drivers/gpio.c
> @@ -719,6 +719,7 @@ static const struct file_operations gpio_fops = {
> .write = gpio_write,
> .open = gpio_open,
> .release = gpio_release,
> + .llseek = noop_llseek,/* write uses no f_pos */
> };
>
> static void ioif_watcher(const unsigned int gpio_in_available,
> diff --git a/arch/cris/arch-v10/drivers/i2c.c b/arch/cris/arch-v10/drivers/i2c.c
> index a8737a8..fc25b5f 100644
> --- a/arch/cris/arch-v10/drivers/i2c.c
> +++ b/arch/cris/arch-v10/drivers/i2c.c
> @@ -622,6 +622,7 @@ static const struct file_operations i2c_fops = {
> .ioctl = i2c_ioctl,
> .open = i2c_open,
> .release = i2c_release,
> + .llseek = noop_llseek,/* no read or write fn */
> };
>
> int __init
> diff --git a/arch/cris/arch-v10/drivers/pcf8563.c b/arch/cris/arch-v10/drivers/pcf8563.c
> index 7dcb1f8..fbf135b 100644
> --- a/arch/cris/arch-v10/drivers/pcf8563.c
> +++ b/arch/cris/arch-v10/drivers/pcf8563.c
> @@ -64,6 +64,7 @@ static int voltage_low;
> static const struct file_operations pcf8563_fops = {
> .owner = THIS_MODULE,
> .unlocked_ioctl = pcf8563_unlocked_ioctl,
> + .llseek = noop_llseek,/* no read or write fn */
> };
>
> unsigned char
> diff --git a/arch/cris/arch-v10/drivers/sync_serial.c b/arch/cris/arch-v10/drivers/sync_serial.c
> index 109dcd8..dd9b18b 100644
> --- a/arch/cris/arch-v10/drivers/sync_serial.c
> +++ b/arch/cris/arch-v10/drivers/sync_serial.c
> @@ -250,7 +250,8 @@ static const struct file_operations sync_serial_fops = {
> .poll = sync_serial_poll,
> .ioctl = sync_serial_ioctl,
> .open = sync_serial_open,
> - .release = sync_serial_release
> + .release = sync_serial_release,
> + .llseek = noop_llseek,/* read and write both use no f_pos */
> };
>
> static int __init etrax_sync_serial_init(void)
> diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
> index b70fb34..540d94d 100644
> --- a/arch/cris/arch-v32/drivers/cryptocop.c
> +++ b/arch/cris/arch-v32/drivers/cryptocop.c
> @@ -282,7 +282,8 @@ const struct file_operations cryptocop_fops = {
> .owner = THIS_MODULE,
> .open = cryptocop_open,
> .release = cryptocop_release,
> - .ioctl = cryptocop_ioctl
> + .ioctl = cryptocop_ioctl,
> + .llseek = noop_llseek,/* no read or write fn */
> };
>
>
> diff --git a/arch/cris/arch-v32/drivers/i2c.c b/arch/cris/arch-v32/drivers/i2c.c
> index 2fd6a74..69a1d9a 100644
> --- a/arch/cris/arch-v32/drivers/i2c.c
> +++ b/arch/cris/arch-v32/drivers/i2c.c
> @@ -698,6 +698,7 @@ static const struct file_operations i2c_fops = {
> .unlocked_ioctl = i2c_ioctl,
> .open = i2c_open,
> .release = i2c_release,
> + .llseek = noop_llseek,/* no read or write fn */
> };
>
> static int __init i2c_init(void)
> diff --git a/arch/cris/arch-v32/drivers/mach-a3/gpio.c b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
> index 97357cf..13bf637 100644
> --- a/arch/cris/arch-v32/drivers/mach-a3/gpio.c
> +++ b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
> @@ -883,6 +883,7 @@ static const struct file_operations gpio_fops = {
> .write = gpio_write,
> .open = gpio_open,
> .release = gpio_release,
> + .llseek = noop_llseek,/* write uses no f_pos */
> };
>
> #ifdef CONFIG_ETRAX_VIRTUAL_GPIO
>
I only got up to here in the email. (See ml sig below)
Do you have this on git or better gitweb somewhere?
Boaz
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
On Thursday 08 July 2010, Boaz Harrosh wrote:
> On 07/08/2010 12:40 AM, Arnd Bergmann wrote:
> >
> > This specific posted version of the patch only
> > covers first few files in order to avoid
> > spamming everybody's inbox. I think you still
> > get the point. The diffstat is complete, and
> > the full patch is available in the 'llseek'
> > branch of
> > git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl.git
> >
> <snip>
>
> I only got up to here in the email. (See ml sig below)
> Do you have this on git or better gitweb somewhere?
Yes. I was afraid people might reply the patch and quote the
entire 500kb email without cutting the bits they haven't actually
read ;-)
FWIW, you can get the whole patch from
http://git.kernel.org/?p=linux/kernel/git/arnd/bkl.git;a=patch;h=dc731e01d2a08eb66ae08c226c97aa0cb8cf7b7f
Arnd
On 07/08/2010 03:23 PM, Arnd Bergmann wrote:
> On Thursday 08 July 2010, Boaz Harrosh wrote:
>> On 07/08/2010 12:40 AM, Arnd Bergmann wrote:
>>>
>>> This specific posted version of the patch only
>>> covers first few files in order to avoid
>>> spamming everybody's inbox. I think you still
>>> get the point. The diffstat is complete, and
>>> the full patch is available in the 'llseek'
>>> branch of
>>> git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl.git
>>>
Yes sorry, I've just seen that you did say.
>> <snip>
>>
>> I only got up to here in the email. (See ml sig below)
>> Do you have this on git or better gitweb somewhere?
>
> Yes. I was afraid people might reply the patch and quote the
> entire 500kb email without cutting the bits they haven't actually
> read ;-)
>
> FWIW, you can get the whole patch from
> http://git.kernel.org/?p=linux/kernel/git/arnd/bkl.git;a=patch;h=dc731e01d2a08eb66ae08c226c97aa0cb8cf7b7f
>
Grate thanks. Ack for the OSD stuff (of course)
> Arnd
>
Boaz
On Wed, 2010-07-07 at 23:40 +0200, Arnd Bergmann wrote:
> The default for llseek will change to no_llseek,
> so securityfs users need to add explicit .llseek
> assignments. Since we're dealing with regular
> files from a VFS perspective, use generic_file_llseek.
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Cc: Mimi Zohar <[email protected]>
> Cc: James Morris <[email protected]>
> Cc: [email protected]
As both the 'violations' and 'runtime_measurement_counts' are single
values and 'policy' doesn't support read, this patch doesn't hurt, but
adding .llseek is probably unnecessary.
thanks,
Mimi
> ---
> security/integrity/ima/ima_fs.c | 9 ++++++---
> 1 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c
> index 8fe736a..ef21b96 100644
> --- a/security/integrity/ima/ima_fs.c
> +++ b/security/integrity/ima/ima_fs.c
> @@ -45,7 +45,8 @@ static ssize_t ima_show_htable_violations(struct file *filp,
> }
>
> static const struct file_operations ima_htable_violations_ops = {
> - .read = ima_show_htable_violations
> + .read = ima_show_htable_violations,
> + .llseek = generic_file_llseek,
> };
>
> static ssize_t ima_show_measurements_count(struct file *filp,
> @@ -57,7 +58,8 @@ static ssize_t ima_show_measurements_count(struct file *filp,
> }
>
> static const struct file_operations ima_measurements_count_ops = {
> - .read = ima_show_measurements_count
> + .read = ima_show_measurements_count,
> + .llseek = generic_file_llseek,
> };
>
> /* returns pointer to hlist_node */
> @@ -319,7 +321,8 @@ static int ima_release_policy(struct inode *inode, struct file *file)
> static const struct file_operations ima_measure_policy_ops = {
> .open = ima_open_policy,
> .write = ima_write_policy,
> - .release = ima_release_policy
> + .release = ima_release_policy,
> + .llseek = generic_file_llseek,
> };
>
> int __init ima_fs_init(void)
Arnd Bergmann wrote:
> The behaviour you want is noop_llseek, which is what gets used
> when the semantic patch is applied. If you wish, you can
> do the patch yourself and add .llseek = noop_llseek to the file
> operations in your tree.
I see. [PATCH 16/18] ( http://lkml.org/lkml/2010/7/7/258 ) contains a line
security/tomoyo/common.c | 1 +
but no change in the patch. Patch was too large?
Anyway, that part is no longer in security/tomoyo/common.c
and is now security/tomoyo/securityfs_if.c .
James, please apply below patch.
----------
>From d0fdb09cdc8ef46151d330a9fc285de86306fa65 Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <[email protected]>
Date: Thu, 8 Jul 2010 21:38:05 +0900
Subject: [PATCH] TOMOYO: Explicitly set file_operations->llseek pointer.
TOMOYO does not deal offset pointer. Thus seek operation makes
no sense. Changing default seek operation from default_llseek()
to no_llseek() might break some applications. Thus, explicitly
set noop_llseek().
Signed-off-by: Tetsuo Handa <[email protected]>
---
security/tomoyo/securityfs_if.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/security/tomoyo/securityfs_if.c b/security/tomoyo/securityfs_if.c
index 9967c1c..e43d555 100644
--- a/security/tomoyo/securityfs_if.c
+++ b/security/tomoyo/securityfs_if.c
@@ -95,6 +95,7 @@ static const struct file_operations tomoyo_operations = {
.poll = tomoyo_poll,
.read = tomoyo_read,
.write = tomoyo_write,
+ .llseek = noop_llseek,
};
/**
--
1.6.1
On Thursday 08 July 2010, Mimi Zohar wrote:
> On Wed, 2010-07-07 at 23:40 +0200, Arnd Bergmann wrote:
> > The default for llseek will change to no_llseek,
> > so securityfs users need to add explicit .llseek
> > assignments. Since we're dealing with regular
> > files from a VFS perspective, use generic_file_llseek.
>
> As both the 'violations' and 'runtime_measurement_counts' are single
> values and 'policy' doesn't support read, this patch doesn't hurt, but
> adding .llseek is probably unnecessary.
Ok, thanks for the confirmation.
Are you applying the patch in your tree, or should I keep it in my
series?
Note that while it may not be necessary to add these specific .llseek
operations, the reason I'm doing it is because I want to provably
have a .llseek operation in every file_operation in the kernel before
the default gets changed.
Arnd
On Thursday 08 July 2010, Jeremy Kerr wrote:
> > @@ -2151,7 +2166,7 @@ static ssize_t spufs_ibox_info_read(struct file *file, char __user *buf,
> > static const struct file_operations spufs_ibox_info_fops = {
> > .open = spufs_info_open,
> > .read = spufs_ibox_info_read,
> > - .llseek = generic_file_llseek,
> > + .llseek = no_llseek,
> > };
> >
> > static ssize_t __spufs_wbox_info_read(struct spu_context *ctx,
> > @@ -2194,7 +2209,7 @@ static ssize_t spufs_wbox_info_read(struct file *file, char __user *buf,
> > static const struct file_operations spufs_wbox_info_fops = {
> > .open = spufs_info_open,
> > .read = spufs_wbox_info_read,
> > - .llseek = generic_file_llseek,
> > + .llseek = no_llseek,
> > };
> >
>
> Why the change in behaviour for the mbox info files?
>
D'oh, that wasn't intentional. I guess what must have happened is that I first
added generic_file_llseek to all file_operations in spufs and then made up my
mind and chose what I thought was correct in each case, which broke these.
Of course, these *_info_fops should be seekable.
Arnd
On Thursday 08 July 2010, Tetsuo Handa wrote:
> I see. [PATCH 16/18] ( http://lkml.org/lkml/2010/7/7/258 ) contains a line
>
> security/tomoyo/common.c | 1 +
>
> but no change in the patch. Patch was too large?
Yes, the total patch is almost 200kb, which I considered too large.
I explained this in the changelog.
In retrospect, I probably should have sent it all anyway, because the
changelog is already very long and a few other people did not realize
this either because they did only read the patch but not the changelog.
As I mentioned to Boaz Harrosh, the full patch is available on
http://git.kernel.org/?p=linux/kernel/git/arnd/bkl.git;a=patch;h=dc731e01d2a08eb66ae08c226c97aa0cb8cf7b7f
and I'll send it out completely if I send out the series again.
I first want to make sure we have consensus on the semantic patch though.
In particular, I want to be sure everyone agrees on the following questions:
- should we kill default_llseek in favour of a more generic generic_file_llseek
that also covers special files?
- if not, should default_llseek get renamed to something else?
- should I bother adding .llseek=no_llseek if we make that the default in the
next step anyway?
- should I drop all the automatically generated comments?
- Do I need to split this patch up into per-maintainer chunks and send them
through the individual trees, or do we just apply the semantic patch treewide
at the end of the merge window?
Arnd
On Thu, 2010-07-08 at 15:00 +0200, Arnd Bergmann wrote:
> On Thursday 08 July 2010, Mimi Zohar wrote:
> > On Wed, 2010-07-07 at 23:40 +0200, Arnd Bergmann wrote:
> > > The default for llseek will change to no_llseek,
> > > so securityfs users need to add explicit .llseek
> > > assignments. Since we're dealing with regular
> > > files from a VFS perspective, use generic_file_llseek.
> >
> > As both the 'violations' and 'runtime_measurement_counts' are single
> > values and 'policy' doesn't support read, this patch doesn't hurt, but
> > adding .llseek is probably unnecessary.
>
> Ok, thanks for the confirmation.
>
> Are you applying the patch in your tree, or should I keep it in my
> series?
I'll leave that up to James.
> Note that while it may not be necessary to add these specific .llseek
> operations, the reason I'm doing it is because I want to provably
> have a .llseek operation in every file_operation in the kernel before
> the default gets changed.
>
> Arnd
Thanks for the clarification.
Mimi
The default for llseek is changing, so we need
explicit operations everywhere.
Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Jeremy Kerr <[email protected]>
Cc: [email protected]
---
Same as previous version, but no longer breaking the existing llseek
operation in spufs_*box_info_fops. Pushed out to my bkl/llseek branch.
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 1a40da9..02f7b11 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -154,6 +154,7 @@ static const struct file_operations __fops = { \
.release = spufs_attr_release, \
.read = spufs_attr_read, \
.write = spufs_attr_write, \
+ .llseek = generic_file_llseek, \
};
@@ -521,6 +522,7 @@ static const struct file_operations spufs_cntl_fops = {
.release = spufs_cntl_release,
.read = simple_attr_read,
.write = simple_attr_write,
+ .llseek = generic_file_llseek,
.mmap = spufs_cntl_mmap,
};
@@ -714,6 +716,7 @@ static ssize_t spufs_mbox_read(struct file *file, char __user *buf,
static const struct file_operations spufs_mbox_fops = {
.open = spufs_pipe_open,
.read = spufs_mbox_read,
+ .llseek = no_llseek,
};
static ssize_t spufs_mbox_stat_read(struct file *file, char __user *buf,
@@ -743,6 +746,7 @@ static ssize_t spufs_mbox_stat_read(struct file *file, char __user *buf,
static const struct file_operations spufs_mbox_stat_fops = {
.open = spufs_pipe_open,
.read = spufs_mbox_stat_read,
+ .llseek = no_llseek,
};
/* low-level ibox access function */
@@ -863,6 +867,7 @@ static const struct file_operations spufs_ibox_fops = {
.read = spufs_ibox_read,
.poll = spufs_ibox_poll,
.fasync = spufs_ibox_fasync,
+ .llseek = no_llseek,
};
static ssize_t spufs_ibox_stat_read(struct file *file, char __user *buf,
@@ -890,6 +895,7 @@ static ssize_t spufs_ibox_stat_read(struct file *file, char __user *buf,
static const struct file_operations spufs_ibox_stat_fops = {
.open = spufs_pipe_open,
.read = spufs_ibox_stat_read,
+ .llseek = no_llseek,
};
/* low-level mailbox write */
@@ -1011,6 +1017,7 @@ static const struct file_operations spufs_wbox_fops = {
.write = spufs_wbox_write,
.poll = spufs_wbox_poll,
.fasync = spufs_wbox_fasync,
+ .llseek = no_llseek,
};
static ssize_t spufs_wbox_stat_read(struct file *file, char __user *buf,
@@ -1038,6 +1045,7 @@ static ssize_t spufs_wbox_stat_read(struct file *file, char __user *buf,
static const struct file_operations spufs_wbox_stat_fops = {
.open = spufs_pipe_open,
.read = spufs_wbox_stat_read,
+ .llseek = no_llseek,
};
static int spufs_signal1_open(struct inode *inode, struct file *file)
@@ -1166,6 +1174,7 @@ static const struct file_operations spufs_signal1_fops = {
.read = spufs_signal1_read,
.write = spufs_signal1_write,
.mmap = spufs_signal1_mmap,
+ .llseek = no_llseek,
};
static const struct file_operations spufs_signal1_nosched_fops = {
@@ -1173,6 +1182,7 @@ static const struct file_operations spufs_signal1_nosched_fops = {
.release = spufs_signal1_release,
.write = spufs_signal1_write,
.mmap = spufs_signal1_mmap,
+ .llseek = no_llseek,
};
static int spufs_signal2_open(struct inode *inode, struct file *file)
@@ -1305,6 +1315,7 @@ static const struct file_operations spufs_signal2_fops = {
.read = spufs_signal2_read,
.write = spufs_signal2_write,
.mmap = spufs_signal2_mmap,
+ .llseek = no_llseek,
};
static const struct file_operations spufs_signal2_nosched_fops = {
@@ -1312,6 +1323,7 @@ static const struct file_operations spufs_signal2_nosched_fops = {
.release = spufs_signal2_release,
.write = spufs_signal2_write,
.mmap = spufs_signal2_mmap,
+ .llseek = no_llseek,
};
/*
@@ -1451,6 +1463,7 @@ static const struct file_operations spufs_mss_fops = {
.open = spufs_mss_open,
.release = spufs_mss_release,
.mmap = spufs_mss_mmap,
+ .llseek = no_llseek,
};
static int
@@ -1508,6 +1521,7 @@ static const struct file_operations spufs_psmap_fops = {
.open = spufs_psmap_open,
.release = spufs_psmap_release,
.mmap = spufs_psmap_mmap,
+ .llseek = no_llseek,
};
@@ -1871,6 +1885,7 @@ static const struct file_operations spufs_mfc_fops = {
.fsync = spufs_mfc_fsync,
.fasync = spufs_mfc_fasync,
.mmap = spufs_mfc_mmap,
+ .llseek = no_llseek,
};
static int spufs_npc_set(void *data, u64 val)
@@ -2246,6 +2261,7 @@ static ssize_t spufs_dma_info_read(struct file *file, char __user *buf,
static const struct file_operations spufs_dma_info_fops = {
.open = spufs_info_open,
.read = spufs_dma_info_read,
+ .llseek = no_llseek,
};
static ssize_t __spufs_proxydma_info_read(struct spu_context *ctx,
@@ -2299,6 +2315,7 @@ static ssize_t spufs_proxydma_info_read(struct file *file, char __user *buf,
static const struct file_operations spufs_proxydma_info_fops = {
.open = spufs_info_open,
.read = spufs_proxydma_info_read,
+ .llseek = no_llseek,
};
static int spufs_show_tid(struct seq_file *s, void *private)
@@ -2585,6 +2602,7 @@ static const struct file_operations spufs_switch_log_fops = {
.read = spufs_switch_log_read,
.poll = spufs_switch_log_poll,
.release = spufs_switch_log_release,
+ .llseek = no_llseek,
};
/**
On Wed, 2010-07-07 at 23:40 +0200, Arnd Bergmann wrote:
> The default for llseek will change to no_llseek,
> so selinuxfs needs to add explicit .llseek
> assignments. Since we're dealing with regular
> files from a VFS perspective, use generic_file_llseek.
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Cc: Stephen Smalley <[email protected]>
> Cc: James Morris <[email protected]>
> Cc: Eric Paris <[email protected]>
> Cc: [email protected]
I'm ok with the patch as is since the .read handlers are ok with it, but
we probably should convert some of them to no_llseek. I'll try to
remember take a look, but if I forget I have no problem with this patch
going in....
-Eric
> ---
> security/selinux/selinuxfs.c | 16 ++++++++++++++++
> 1 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
> index 0293843..79a1bb6 100644
> --- a/security/selinux/selinuxfs.c
> +++ b/security/selinux/selinuxfs.c
> @@ -184,6 +184,7 @@ out:
> static const struct file_operations sel_enforce_ops = {
> .read = sel_read_enforce,
> .write = sel_write_enforce,
> + .llseek = generic_file_llseek,
> };
>
> static ssize_t sel_read_handle_unknown(struct file *filp, char __user *buf,
> @@ -201,6 +202,7 @@ static ssize_t sel_read_handle_unknown(struct file *filp, char __user *buf,
>
> static const struct file_operations sel_handle_unknown_ops = {
> .read = sel_read_handle_unknown,
> + .llseek = generic_file_llseek,
> };
>
> #ifdef CONFIG_SECURITY_SELINUX_DISABLE
> @@ -251,6 +253,7 @@ out:
>
> static const struct file_operations sel_disable_ops = {
> .write = sel_write_disable,
> + .llseek = generic_file_llseek,
> };
>
> static ssize_t sel_read_policyvers(struct file *filp, char __user *buf,
> @@ -265,6 +268,7 @@ static ssize_t sel_read_policyvers(struct file *filp, char __user *buf,
>
> static const struct file_operations sel_policyvers_ops = {
> .read = sel_read_policyvers,
> + .llseek = generic_file_llseek,
> };
>
> /* declaration for sel_write_load */
> @@ -289,6 +293,7 @@ static ssize_t sel_read_mls(struct file *filp, char __user *buf,
>
> static const struct file_operations sel_mls_ops = {
> .read = sel_read_mls,
> + .llseek = generic_file_llseek,
> };
>
> static ssize_t sel_write_load(struct file *file, const char __user *buf,
> @@ -356,6 +361,7 @@ out:
>
> static const struct file_operations sel_load_ops = {
> .write = sel_write_load,
> + .llseek = generic_file_llseek,
> };
>
> static ssize_t sel_write_context(struct file *file, char *buf, size_t size)
> @@ -437,6 +443,7 @@ out:
> static const struct file_operations sel_checkreqprot_ops = {
> .read = sel_read_checkreqprot,
> .write = sel_write_checkreqprot,
> + .llseek = generic_file_llseek,
> };
>
> /*
> @@ -482,6 +489,7 @@ static const struct file_operations transaction_ops = {
> .write = selinux_transaction_write,
> .read = simple_transaction_read,
> .release = simple_transaction_release,
> + .llseek = generic_file_llseek,
> };
>
> /*
> @@ -883,6 +891,7 @@ out:
> static const struct file_operations sel_bool_ops = {
> .read = sel_read_bool,
> .write = sel_write_bool,
> + .llseek = generic_file_llseek,
> };
>
> static ssize_t sel_commit_bools_write(struct file *filep,
> @@ -935,6 +944,7 @@ out:
>
> static const struct file_operations sel_commit_bools_ops = {
> .write = sel_commit_bools_write,
> + .llseek = generic_file_llseek,
> };
>
> static void sel_remove_entries(struct dentry *de)
> @@ -1127,10 +1137,12 @@ out:
> static const struct file_operations sel_avc_cache_threshold_ops = {
> .read = sel_read_avc_cache_threshold,
> .write = sel_write_avc_cache_threshold,
> + .llseek = generic_file_llseek,
> };
>
> static const struct file_operations sel_avc_hash_stats_ops = {
> .read = sel_read_avc_hash_stats,
> + .llseek = generic_file_llseek,
> };
>
> #ifdef CONFIG_SECURITY_SELINUX_AVC_STATS
> @@ -1255,6 +1267,7 @@ static ssize_t sel_read_initcon(struct file *file, char __user *buf,
>
> static const struct file_operations sel_initcon_ops = {
> .read = sel_read_initcon,
> + .llseek = generic_file_llseek,
> };
>
> static int sel_make_initcon_files(struct dentry *dir)
> @@ -1330,6 +1343,7 @@ out:
>
> static const struct file_operations sel_class_ops = {
> .read = sel_read_class,
> + .llseek = generic_file_llseek,
> };
>
> static ssize_t sel_read_perm(struct file *file, char __user *buf,
> @@ -1354,6 +1368,7 @@ out:
>
> static const struct file_operations sel_perm_ops = {
> .read = sel_read_perm,
> + .llseek = generic_file_llseek,
> };
>
> static ssize_t sel_read_policycap(struct file *file, char __user *buf,
> @@ -1372,6 +1387,7 @@ static ssize_t sel_read_policycap(struct file *file, char __user *buf,
>
> static const struct file_operations sel_policycap_ops = {
> .read = sel_read_policycap,
> + .llseek = generic_file_llseek,
> };
>
> static int sel_make_perm_files(char *objclass, int classvalue,
On Thu, 8 Jul 2010, Mimi Zohar wrote:
> On Thu, 2010-07-08 at 15:00 +0200, Arnd Bergmann wrote:
> > On Thursday 08 July 2010, Mimi Zohar wrote:
> > > On Wed, 2010-07-07 at 23:40 +0200, Arnd Bergmann wrote:
> > > > The default for llseek will change to no_llseek,
> > > > so securityfs users need to add explicit .llseek
> > > > assignments. Since we're dealing with regular
> > > > files from a VFS perspective, use generic_file_llseek.
> > >
> > > As both the 'violations' and 'runtime_measurement_counts' are single
> > > values and 'policy' doesn't support read, this patch doesn't hurt, but
> > > adding .llseek is probably unnecessary.
> >
> > Ok, thanks for the confirmation.
> >
> > Are you applying the patch in your tree, or should I keep it in my
> > series?
>
> I'll leave that up to James.
I can take the patches, depends on what Arnd thinks is best.
>
> > Note that while it may not be necessary to add these specific .llseek
> > operations, the reason I'm doing it is because I want to provably
> > have a .llseek operation in every file_operation in the kernel before
> > the default gets changed.
> >
> > Arnd
>
> Thanks for the clarification.
>
> Mimi
>
--
James Morris
<[email protected]>
On Thu, 8 Jul 2010, Tetsuo Handa wrote:
> >From d0fdb09cdc8ef46151d330a9fc285de86306fa65 Mon Sep 17 00:00:00 2001
> From: Tetsuo Handa <[email protected]>
> Date: Thu, 8 Jul 2010 21:38:05 +0900
> Subject: [PATCH] TOMOYO: Explicitly set file_operations->llseek pointer.
>
> TOMOYO does not deal offset pointer. Thus seek operation makes
> no sense. Changing default seek operation from default_llseek()
> to no_llseek() might break some applications. Thus, explicitly
> set noop_llseek().
>
> Signed-off-by: Tetsuo Handa <[email protected]>
Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#next
--
James Morris
<[email protected]>
On 07.07.10 17:40:13, Arnd Bergmann wrote:
> The event buffer cannot deal with seeks, so
> we should forbid that outright.
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Cc: Robert Richter <[email protected]>
> Cc: [email protected]
Acked-by: Robert Richter <[email protected]>
Thanks Arnd,
-Robert
--
Advanced Micro Devices, Inc.
Operating System Research Center
On Friday 09 July 2010, James Morris wrote:
> On Thu, 8 Jul 2010, Mimi Zohar wrote:
> >
> > I'll leave that up to James.
>
> I can take the patches, depends on what Arnd thinks is best.
I'd prefer you to take it. I'll work out with Frederic what we
do with the remaining patches, but ideally all maintainer
should just take their bits from this series, there are no
interdependencies except for the last two patches.
Arnd
On Wed, 7 Jul 2010, Arnd Bergmann wrote:
> The default for llseek will change to no_llseek,
> so selinuxfs needs to add explicit .llseek
> assignments. Since we're dealing with regular
> files from a VFS perspective, use generic_file_llseek.
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Cc: Stephen Smalley <[email protected]>
> Cc: James Morris <[email protected]>
> Cc: Eric Paris <[email protected]>
> Cc: [email protected]
Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#next
--
James Morris
<[email protected]>
On Wed, 7 Jul 2010, Arnd Bergmann wrote:
> The default for llseek will change to no_llseek,
> so securityfs users need to add explicit .llseek
> assignments. Since we're dealing with regular
> files from a VFS perspective, use generic_file_llseek.
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Cc: Mimi Zohar <[email protected]>
> Cc: James Morris <[email protected]>
> Cc: [email protected]
> ---
> security/integrity/ima/ima_fs.c | 9 ++++++---
> 1 files changed, 6 insertions(+), 3 deletions(-)
Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#next
--
James Morris
<[email protected]>
thanks, applied
--
Roland Dreier <[email protected]> || For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/index.html
Commit-ID: b444786f1a797a7f84e2561346a670649f9c7b3c
Gitweb: http://git.kernel.org/tip/b444786f1a797a7f84e2561346a670649f9c7b3c
Author: Arnd Bergmann <[email protected]>
AuthorDate: Wed, 7 Jul 2010 23:40:11 +0200
Committer: Frederic Weisbecker <[email protected]>
CommitDate: Tue, 20 Jul 2010 14:31:24 +0200
tracing: Use generic_file_llseek for debugfs
The default for llseek will change to no_llseek,
so the tracing debugfs files need to add explicit
.llseek assignments. Since we're dealing with regular
files from a VFS perspective, use generic_file_llseek.
Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: John Kacur <[email protected]>
Cc: Li Zefan <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Frederic Weisbecker <[email protected]>
---
kernel/trace/trace.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index d9a4aa0..c1752da 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2338,6 +2338,7 @@ static const struct file_operations show_traces_fops = {
.open = show_traces_open,
.read = seq_read,
.release = seq_release,
+ .llseek = seq_lseek,
};
/*
@@ -2431,6 +2432,7 @@ static const struct file_operations tracing_cpumask_fops = {
.open = tracing_open_generic,
.read = tracing_cpumask_read,
.write = tracing_cpumask_write,
+ .llseek = generic_file_llseek,
};
static int tracing_trace_options_show(struct seq_file *m, void *v)
@@ -2597,6 +2599,7 @@ tracing_readme_read(struct file *filp, char __user *ubuf,
static const struct file_operations tracing_readme_fops = {
.open = tracing_open_generic,
.read = tracing_readme_read,
+ .llseek = generic_file_llseek,
};
static ssize_t
@@ -2647,6 +2650,7 @@ tracing_saved_cmdlines_read(struct file *file, char __user *ubuf,
static const struct file_operations tracing_saved_cmdlines_fops = {
.open = tracing_open_generic,
.read = tracing_saved_cmdlines_read,
+ .llseek = generic_file_llseek,
};
static ssize_t
@@ -2976,6 +2980,7 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)
if (iter->trace->pipe_open)
iter->trace->pipe_open(iter);
+ nonseekable_open(inode, filp);
out:
mutex_unlock(&trace_types_lock);
return ret;
@@ -3534,18 +3539,21 @@ static const struct file_operations tracing_max_lat_fops = {
.open = tracing_open_generic,
.read = tracing_max_lat_read,
.write = tracing_max_lat_write,
+ .llseek = generic_file_llseek,
};
static const struct file_operations tracing_ctrl_fops = {
.open = tracing_open_generic,
.read = tracing_ctrl_read,
.write = tracing_ctrl_write,
+ .llseek = generic_file_llseek,
};
static const struct file_operations set_tracer_fops = {
.open = tracing_open_generic,
.read = tracing_set_trace_read,
.write = tracing_set_trace_write,
+ .llseek = generic_file_llseek,
};
static const struct file_operations tracing_pipe_fops = {
@@ -3554,17 +3562,20 @@ static const struct file_operations tracing_pipe_fops = {
.read = tracing_read_pipe,
.splice_read = tracing_splice_read_pipe,
.release = tracing_release_pipe,
+ .llseek = no_llseek,
};
static const struct file_operations tracing_entries_fops = {
.open = tracing_open_generic,
.read = tracing_entries_read,
.write = tracing_entries_write,
+ .llseek = generic_file_llseek,
};
static const struct file_operations tracing_mark_fops = {
.open = tracing_open_generic,
.write = tracing_mark_write,
+ .llseek = generic_file_llseek,
};
static const struct file_operations trace_clock_fops = {
@@ -3870,6 +3881,7 @@ tracing_stats_read(struct file *filp, char __user *ubuf,
static const struct file_operations tracing_stats_fops = {
.open = tracing_open_generic,
.read = tracing_stats_read,
+ .llseek = generic_file_llseek,
};
#ifdef CONFIG_DYNAMIC_FTRACE
@@ -3906,6 +3918,7 @@ tracing_read_dyn_info(struct file *filp, char __user *ubuf,
static const struct file_operations tracing_dyn_info_fops = {
.open = tracing_open_generic,
.read = tracing_read_dyn_info,
+ .llseek = generic_file_llseek,
};
#endif
@@ -4059,6 +4072,7 @@ static const struct file_operations trace_options_fops = {
.open = tracing_open_generic,
.read = trace_options_read,
.write = trace_options_write,
+ .llseek = generic_file_llseek,
};
static ssize_t
@@ -4110,6 +4124,7 @@ static const struct file_operations trace_options_core_fops = {
.open = tracing_open_generic,
.read = trace_options_core_read,
.write = trace_options_core_write,
+ .llseek = generic_file_llseek,
};
struct dentry *trace_create_file(const char *name,
On Wed, Jul 07, 2010 at 11:40:14PM +0200, Arnd Bergmann wrote:
> The raw_fops may need to seek, so there should
> be an explicit reference to default_llseek.
> raw_ctl_fops does not contain a read or write
> method, so we use noop_llseek to ignore seeking
> requests without an error.
>
> Signed-off-by: Arnd Bergmann <[email protected]>
Applied in a new branch: bkl/llseek, I will propose it for
-next soon.
Thanks.
On Wed, Jul 07, 2010 at 11:40:17PM +0200, Arnd Bergmann wrote:
> Some applications try to seek on tape devices
> and fail if they return an error. Since we
> want to change the default llseek action to
> no_llseek, viotape needs to be changed to use
> noop_llseek explicitly.
>
> Signed-off-by: Arnd Bergmann <[email protected]>
Applied, thanks.
On Wed, Jul 07, 2010 at 11:40:05PM +0200, Arnd Bergmann wrote:
> When the default llseek behavior gets changed to
> not allowing seek, all file operations that rely
> on the current behaviour need to use an explicit
> .llseek operation.
>
> The files that lkdtm uses in debugfs are regular
> files and they get read using simple_read_from_buffer,
> so generic_file_llseek is the right operation.
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> ---
Applied, thanks.
On 07.07.10 17:40:13, Arnd Bergmann wrote:
> The event buffer cannot deal with seeks, so
> we should forbid that outright.
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Cc: Robert Richter <[email protected]>
> Cc: [email protected]
Applied to:
git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile.git core
Thanks Arnd.
-Robert
--
Advanced Micro Devices, Inc.
Operating System Research Center