Thread (25 messages) 25 messages, 6 authors, 2021-07-30

Re: [RFC PATCH 3/8] block: Add kernel APIs to create & delete block device LED triggers

From: Valdis Klētnieks <hidden>
Date: 2021-07-29 03:45:50
Also in: linux-block, linux-leds, lkml

On Wed, 28 Jul 2021 20:53:39 -0500, Ian Pilcher said:
quoted hunk ↗ jump to hunk
* New file - include/linux/blk-ledtrig.h

Signed-off-by: Ian Pilcher <redacted>
---
 block/blk-ledtrig.c         | 152 ++++++++++++++++++++++++++++++++++++
 include/linux/blk-ledtrig.h |  19 +++++
 2 files changed, 171 insertions(+)
 create mode 100644 include/linux/blk-ledtrig.h
diff --git a/block/blk-ledtrig.c b/block/blk-ledtrig.c
index 345a3b6bdbc6..c69ea1539336 100644
--- a/block/blk-ledtrig.c
+++ b/block/blk-ledtrig.c
+
+static int __blk_ledtrig_create(const char *const name, const size_t len)
(...)
+	if (blk_ledtrig_find(name, len) != NULL) {
+		pr_warn("blockdev LED trigger named %.*s already exists\n",
+			(int)len, name);

Is pr_warn() the right level for this stuff? I'd think this sort of pilot error should
be pr_info() or even pr_debug(), if mentioned at all.  pr_warn() would be for
something like an unexpected situation like trying to blink an LED but failing.
Simple syntax errors should probably just toss a -EINVAL and return.

(Among other things, this allows a userspace script to spam the
log by simply repeatedly trying to create the same entry)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help