lkml.org 
[lkml]   [2021]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] sysfs: add sysfs_add_bin_file_to_group()
On Mon, Dec 20, 2021 at 07:47:29AM +0100, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
>
> There already is sysfs_add_file_to_group() for adding "attribute" to a
> group. This new function allows adding "bin_attribute" as well.
>
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
> fs/sysfs/file.c | 31 +++++++++++++++++++++++++++----
> include/linux/sysfs.h | 3 +++
> 2 files changed, 30 insertions(+), 4 deletions(-)
>
> diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
> index 42dcf96881b6..30c798c38d89 100644
> --- a/fs/sysfs/file.c
> +++ b/fs/sysfs/file.c
> @@ -376,14 +376,19 @@ EXPORT_SYMBOL_GPL(sysfs_create_files);
> * @attr: attribute descriptor.
> * @group: group name.
> */
> -int sysfs_add_file_to_group(struct kobject *kobj,
> - const struct attribute *attr, const char *group)
> +int __sysfs_add_file_to_group(struct kobject *kobj,
> + const struct attribute *attr,
> + const struct bin_attribute *battr,
> + const char *group)
> {
> struct kernfs_node *parent;
> kuid_t uid;
> kgid_t gid;
> int error;
>
> + if (WARN_ON((attr && battr) || (!attr && !battr)))
> + return -EINVAL;

How can this ever happen?

\
 
 \ /
  Last update: 2021-12-20 09:02    [W:0.320 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site