Re: [PATCH] livepatch: add sysfs interface /sys/kernel/livepatch/state

From: Miroslav Benes
Date: Wed Jun 17 2015 - 04:13:24 EST


On Wed, 17 Jun 2015, Li Bin wrote:

> The added sysfs interface /sys/kernel/livepatch/state is read-only,
> it shows the patches that have been applied, incluing the stack index
> and the state of each patch.
>
> $ cat /sys/kernel/livepatch/state
> Index Patch State
> -----------------------------------------------
> 1 klp_test1 enabled
> 2 klp_test2 enabled
> 3 klp_test3 enabled
> -----------------------------------------------
>
> $ echo 0 > /sys/kernel/livepatch/klp_test3/enabled
> $ cat /sys/kernel/livepatch/state
> Index Patch State
> -----------------------------------------------
> 1 klp_test1 enabled
> 2 klp_test2 enabled
> 3 klp_test3 disabled
> -----------------------------------------------
>
> Signed-off-by: Li Bin <huawei.libin@xxxxxxxxxx>
> ---

Hi,

I think we should comply with sysfs policy and keep 'one value per
attribute' as mentioned in the Documentation/filesystems/sysfs.txt:

"
Attributes should be ASCII text files, preferably with only one value
per file. It is noted that it may not be efficient to contain only one
value per file, so it is socially acceptable to express an array of
values of the same type.

Mixing types, expressing multiple lines of data, and doing fancy
formatting of data is heavily frowned upon. Doing these things may get
you publicly humiliated and your code rewritten without notice.
"
The list of applied patches can be obtained just by 'ls
/sys/kernel/livepatch' and their state is in enabled attribute in each
respective patch (no, you cannot obtain the order in the stack).

Thanks,

Miroslav Benes
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/