From: Krzysztof Opasiak <k.opasiak@samsung.com>
To: Christoph Hellwig <hch@lst.de>,
akpm@linux-foundation.org, nab@linux-iscsi.org,
pantelis.antoniou@konsulko.com, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] configfs: implement binary attributes
Date: Wed, 30 Dec 2015 00:26:41 +0100 [thread overview]
Message-ID: <568316B1.6090800@samsung.com> (raw)
In-Reply-To: <20151229230029.GC32415@noexit.roam.corp.google.com>
W dniu 2015-12-30 o 00:00, Joel Becker pisze:
> On Thu, Dec 24, 2015 at 03:51:10PM +0100, Christoph Hellwig wrote:
>> 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.
>
> Overall, I really like this addition.
>
>> @@ -423,7 +429,9 @@ static int configfs_attach_attr(struct
configfs_dirent * sd, struct dentry * den
>> spin_unlock(&configfs_dirent_lock);
>>
>> error = configfs_create(dentry, (attr->ca_mode & S_IALLUGO) |
S_IFREG,
>> - configfs_init_file);
>> + (sd->s_type & CONFIGFS_ITEM_ATTR) ?
>> + configfs_init_file :
>> + configfs_init_bin_file);
>
> BIN_ATTRs are the more uncommon type, at least for now. I would think
> this code should check for special cases and fall back to ITEM_ATTR. So
> reverse it.
>
> (sd->s_type & CONFIGFS_ITEM_BIN_ATTR) ?
> configfs_init_bin_file :
> configfs_init_file
>
I think that static inline helper can be usefull here to improve readability
>> +static ssize_t
>> +configfs_read_bin_file(struct file *file, char __user *buf,
>> + size_t count, loff_t *ppos)
>> +{
>> + struct configfs_buffer *buffer = file->private_data;
>> + struct dentry *dentry = file->f_path.dentry;
>> + struct config_item *item = to_item(dentry->d_parent);
>> + struct configfs_bin_attribute *bin_attr = to_bin_attr(dentry);
>> + ssize_t retval = 0;
>> + ssize_t len = min_t(size_t, count, PAGE_SIZE);
>> +
>> + mutex_lock(&buffer->mutex);
>> +
>> + /* we don't support switching read/write modes */
>> + if (buffer->write_in_progress) {
>> + retval = -EINVAL;
>> + goto out;
>> + }
>
> These are valid arguments, it's just competing with another operation.
> Wouldn't something like EINPROGRESS or ETXTBSY make more sense and be
> more informative? The same for configfs_write_bin_file().
>
> Joel
>
--
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics
next prev parent reply other threads:[~2015-12-29 23:26 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-24 14:51 a configfs update for 4.5, and the configfs tree question Christoph Hellwig
2015-12-24 14:51 ` [PATCH] configfs: implement binary attributes Christoph Hellwig
2015-12-29 23:00 ` Joel Becker
2015-12-29 23:26 ` Krzysztof Opasiak [this message]
2015-12-30 8:51 ` Pantelis Antoniou
2015-12-29 23:37 ` Krzysztof Opasiak
2015-12-29 23:05 ` a configfs update for 4.5, and the configfs tree question Joel Becker
2016-01-04 11:51 ` Christoph Hellwig
2016-01-04 12:37 ` Fengguang Wu
2016-01-04 20:46 ` Stephen Rothwell
2016-01-05 4:04 ` Joel Becker
2016-01-06 17:31 ` Nicholas A. Bellinger
-- strict thread matches above, loose matches on Subject: below --
2015-10-22 20:30 [PATCH] configfs: Implement binary attributes Pantelis Antoniou
2015-12-01 18:21 ` Christoph Hellwig
2015-12-18 11:20 ` Christoph Hellwig
2015-12-18 11:21 ` Pantelis Antoniou
2015-12-18 11:26 ` Christoph Hellwig
2015-12-18 11:27 ` Pantelis Antoniou
2015-12-18 14:31 ` Geert Uytterhoeven
2015-12-18 14:32 ` Pantelis Antoniou
2015-12-22 15:53 ` Christoph Hellwig
2015-12-22 15:56 ` Geert Uytterhoeven
2015-09-16 16:08 Pantelis Antoniou
2015-09-17 0:37 ` Christoph Hellwig
2015-09-17 6:29 ` Pantelis Antoniou
2015-09-17 21:14 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=568316B1.6090800@samsung.com \
--to=k.opasiak@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=hch@lst.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nab@linux-iscsi.org \
--cc=pantelis.antoniou@konsulko.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).