Re: [PATCH] configfs: implement binary attributes

Krzysztof Opasiak
2015-12-29T23:37:12Z

W dniu 2015-12-24 o 15:51, Christoph Hellwig pisze:
> From: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
>
> ConfigFS lacked binary attributes up until now. This patch
> introduces support for binary attributes in a somewhat similar
> manner of sysfs binary attributes albeit with changes that
> fit the configfs usage model.
>
> Problems that configfs binary attributes fix are everything that
> requires a binary blob as part of the configuration of a resource,
> such as bitstream loading for FPGAs, DTBs for dynamically created
> devices etc.
>
> Look at Documentation/filesystems/configfs/configfs.txt for internals
> and howto use them.
>
> This patch is against linux-next as of today that contains
> Christoph's configfs rework.
>
> Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
> [hch: folded a fix from Geert Uytterhoeven <geert+renesas@glider.be>]
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

(...)

>
> #include <linux/configfs.h>
> @@ -48,6 +49,10 @@ struct configfs_buffer {
> struct configfs_item_operations * ops;
> struct mutex mutex;
> int needs_read_fill;
> + int read_in_progress;
> + int write_in_progress;

Those 2 should be probably bool instead of int.

> + char *bin_buffer;
> + int bin_buffer_size;
> };

(...)

> diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c
> index eae8757..0cc810e 100644
> --- a/fs/configfs/inode.c
> +++ b/fs/configfs/inode.c
> @@ -218,7 +218,7 @@ const unsigned char * configfs_get_name(struct configfs_dirent *sd)
> if (sd->s_type & (CONFIGFS_DIR | CONFIGFS_ITEM_LINK))
> return sd->s_dentry->d_name.name;
>
> - if (sd->s_type & CONFIGFS_ITEM_ATTR) {
> + if (sd->s_type & (CONFIGFS_ITEM_ATTR | CONFIGFS_ITEM_BIN_ATTR)) {

I would also recomend a static inline helper here instead of adding this
or as this may simplify the code in a few places.

Best regards,
--
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics