lkml.org 
[lkml]   [2010]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] Introduce {sysfs,device}_create_file_mode
On Wed, May 12, 2010 at 21:08, Anton Vorontsov <cbouatmailru@gmail.com> wrote:
> On Wed, May 12, 2010 at 11:38:06AM -0700, Greg KH wrote:
>> On Wed, May 12, 2010 at 10:15:46PM +0400, Anton Vorontsov wrote:
>> > We need to create attributes with different modes across devices.
>> > We can do this by modifying attr.mode between device_create_file
>> > invocations, but that is racy in case of globally defined attrs.
>> >
>> > Luckily, there's sysfs_add_file_mode() function that seems to do
>> > exactly what we want, and if we use it, we don't need any locks
>> > to avoid races. Though, it isn't exposed via device-drivers core
>> > API.
>>
>> But you race the creation of the device notifying userspace, and then
>> the file being created, right?
>
> Yep, you've raised that question once, like 3 years ago. :-)
>
> http://lkml.org/lkml/2007/4/11/452
> http://lkml.org/lkml/2007/4/12/144
>
> In short: we can't use attr groups since the attributes creation
> is conditional. And we especially don't want to use the attr groups
> for attrs with different modes. But it's not a problem, because...

Groups have a filter callback for every member, to decide if the
attribute should be created or not.

Kay


\
 
 \ /
  Last update: 2010-05-12 21:15    [W:0.082 / U:29.664 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site