Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1176480 > unrolled thread
| Started by | Marcin Niesluchowski <m.niesluchow@samsung.com> |
|---|---|
| First post | 2015-07-03 13:00 +0200 |
| Last post | 2015-07-03 17:40 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[RFC 5/8] kmsg: device support in mem class Marcin Niesluchowski <m.niesluchow@samsung.com> - 2015-07-03 13:00 +0200
Re: [RFC 5/8] kmsg: device support in mem class Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-07-03 17:40 +0200
| From | Marcin Niesluchowski <m.niesluchow@samsung.com> |
|---|---|
| Date | 2015-07-03 13:00 +0200 |
| Subject | [RFC 5/8] kmsg: device support in mem class |
| Message-ID | <pI6Rk-7tK-15@gated-at.bofh.it> |
Mem class is current class in which kmsg device is holded in.
Mem class is exteded by kmsg_sys devices handling.
Signed-off-by: Marcin Niesluchowski <m.niesluchow@samsung.com>
---
drivers/char/mem.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index e518040..8d5ba0d 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -815,7 +815,11 @@ static int memory_open(struct inode *inode, struct file *filp)
minor = iminor(inode);
if (minor >= ARRAY_SIZE(devlist))
+#ifdef CONFIG_PRINTK
+ minor = KMSG_MINOR;
+#else
return -ENXIO;
+#endif
dev = &devlist[minor];
if (!dev->fops)
@@ -837,8 +841,20 @@ static const struct file_operations memory_fops = {
static char *mem_devnode(struct device *dev, umode_t *mode)
{
- if (mode && devlist[MINOR(dev->devt)].mode)
- *mode = devlist[MINOR(dev->devt)].mode;
+ int minor;
+
+ if (!mode)
+ return NULL;
+
+ minor = MINOR(dev->devt);
+
+#ifdef CONFIG_PRINTK
+ if (minor >= ARRAY_SIZE(devlist))
+ kmsg_sys_mode(minor, mode);
+ else
+#endif
+ if (devlist[minor].mode)
+ *mode = devlist[minor].mode;
return NULL;
}
--
1.9.1
--
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/
[toc] | [next] | [standalone]
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Date | 2015-07-03 17:40 +0200 |
| Message-ID | <pIbeh-1No-7@gated-at.bofh.it> |
| In reply to | #1176480 |
On Fri, Jul 03, 2015 at 12:49:52PM +0200, Marcin Niesluchowski wrote:
> Mem class is current class in which kmsg device is holded in.
>
> Mem class is exteded by kmsg_sys devices handling.
>
> Signed-off-by: Marcin Niesluchowski <m.niesluchow@samsung.com>
> ---
> drivers/char/mem.c | 20 ++++++++++++++++++--
> 1 file changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/mem.c b/drivers/char/mem.c
> index e518040..8d5ba0d 100644
> --- a/drivers/char/mem.c
> +++ b/drivers/char/mem.c
> @@ -815,7 +815,11 @@ static int memory_open(struct inode *inode, struct file *filp)
>
> minor = iminor(inode);
> if (minor >= ARRAY_SIZE(devlist))
> +#ifdef CONFIG_PRINTK
> + minor = KMSG_MINOR;
> +#else
> return -ENXIO;
> +#endif
Ick, you are going to have to come up with a better api if you want this
to be able to be merged. I don't want to see #ifdef in .c files, as
these changes just make things much messier.
> @@ -837,8 +841,20 @@ static const struct file_operations memory_fops = {
>
> static char *mem_devnode(struct device *dev, umode_t *mode)
> {
> - if (mode && devlist[MINOR(dev->devt)].mode)
> - *mode = devlist[MINOR(dev->devt)].mode;
> + int minor;
> +
> + if (!mode)
> + return NULL;
> +
> + minor = MINOR(dev->devt);
> +
> +#ifdef CONFIG_PRINTK
> + if (minor >= ARRAY_SIZE(devlist))
> + kmsg_sys_mode(minor, mode);
> + else
> +#endif
Ick, not ok.
greg k-h
--
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/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web