Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1282418
| From | Jerry Hoemann <jerry.hoemann@hpe.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v3 1/3] nvdimm: Clean-up access mode check. |
| Date | 2015-12-02 22:10 +0100 |
| Message-ID | <qBmP2-47N-67@gated-at.bofh.it> (permalink) |
| References | <qBmP0-47N-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Change nd_ioctl and nvdimm_ioctl access mode check to use O_RDONLY.
Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
---
drivers/nvdimm/bus.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index 7e2c43f..1c81203 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -602,14 +602,14 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
static long nd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
long id = (long) file->private_data;
- int rc = -ENXIO, read_only;
+ int rc = -ENXIO, ro;
struct nvdimm_bus *nvdimm_bus;
- read_only = (O_RDWR != (file->f_flags & O_ACCMODE));
+ ro = ((file->f_flags & O_ACCMODE) == O_RDONLY);
mutex_lock(&nvdimm_bus_list_mutex);
list_for_each_entry(nvdimm_bus, &nvdimm_bus_list, list) {
if (nvdimm_bus->id == id) {
- rc = __nd_ioctl(nvdimm_bus, NULL, read_only, cmd, arg);
+ rc = __nd_ioctl(nvdimm_bus, NULL, ro, cmd, arg);
break;
}
}
@@ -633,10 +633,10 @@ static int match_dimm(struct device *dev, void *data)
static long nvdimm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
- int rc = -ENXIO, read_only;
+ int rc = -ENXIO, ro;
struct nvdimm_bus *nvdimm_bus;
- read_only = (O_RDWR != (file->f_flags & O_ACCMODE));
+ ro = ((file->f_flags & O_ACCMODE) == O_RDONLY);
mutex_lock(&nvdimm_bus_list_mutex);
list_for_each_entry(nvdimm_bus, &nvdimm_bus_list, list) {
struct device *dev = device_find_child(&nvdimm_bus->dev,
@@ -647,7 +647,7 @@ static long nvdimm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
continue;
nvdimm = to_nvdimm(dev);
- rc = __nd_ioctl(nvdimm_bus, nvdimm, read_only, cmd, arg);
+ rc = __nd_ioctl(nvdimm_bus, nvdimm, ro, cmd, arg);
put_device(dev);
break;
}
--
1.7.11.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v3 0/3] nvdimm: Add an IOCTL pass thru for DSM calls Jerry Hoemann <jerry.hoemann@hpe.com> - 2015-12-02 22:10 +0100
[PATCH v3 2/3] nvdimm: Add wrapper for IOCTL pass thru Jerry Hoemann <jerry.hoemann@hpe.com> - 2015-12-02 22:10 +0100
[PATCH v3 3/3] nvdimm: Add IOCTL pass thru functions Jerry Hoemann <jerry.hoemann@hpe.com> - 2015-12-02 22:10 +0100
Re: [PATCH v3 3/3] nvdimm: Add IOCTL pass thru functions Dan Williams <dan.j.williams@intel.com> - 2015-12-09 03:20 +0100
Re: [PATCH v3 3/3] nvdimm: Add IOCTL pass thru functions Jerry Hoemann <jerry.hoemann@hpe.com> - 2015-12-10 01:30 +0100
Re: [PATCH v3 3/3] nvdimm: Add IOCTL pass thru functions Dan Williams <dan.j.williams@intel.com> - 2015-12-10 01:50 +0100
Re: [PATCH v3 3/3] nvdimm: Add IOCTL pass thru functions Jerry Hoemann <jerry.hoemann@hpe.com> - 2015-12-11 19:20 +0100
Re: [PATCH v3 3/3] nvdimm: Add IOCTL pass thru functions Dan Williams <dan.j.williams@intel.com> - 2015-12-11 19:20 +0100
Re: [PATCH v3 3/3] nvdimm: Add IOCTL pass thru functions Jerry Hoemann <jerry.hoemann@hpe.com> - 2015-12-11 20:10 +0100
[PATCH v3 1/3] nvdimm: Clean-up access mode check. Jerry Hoemann <jerry.hoemann@hpe.com> - 2015-12-02 22:10 +0100
csiph-web