lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 16 Jul 2013 11:29:42 -0700
From:	Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
To:	Greg KH <gregkh@...uxfoundation.org>
CC:	Linux Kernel <linux-kernel@...r.kernel.org>,
	"Brown, Len" <len.brown@...el.com>,
	"Rafael J. Wysocki" <rjw@...k.pl>
Subject: Re: driver model, duplicate names question

Thanks for the quick response. Here I am creating virtual devices using 
device_register.
I have attached a simple test program, which will give error.

This is my intention:

$> cd /sys/class/test_class
$> ls
power_zone_cpu_package_0
power_zone_cpu_package_1


$> cd power_zone_cpu_package_0
$> ls
power-zone-cpu-0

$> cd ..

$> cd power_zone_cpu_package_1
$> ls
power-zone-cpu-0


The error will be "
Error:
sysfs: cannot create duplicate filename '/class/test_class/power-zone-cpu-0'

I want to avoid a flat model, if there is a server system with many CPU 
packages with multiple cores in each.

Thanks,
Srinivas











On 07/16/2013 09:44 AM, Greg KH wrote:
> On Tue, Jul 16, 2013 at 09:34:57AM -0700, Srinivas Pandruvada wrote:
>> Hi Greg,
>>
>> I would like to create tree like structure using device model (struct
>> device, device_register/device_unregister) using parent/child
>> relationship while creation. I want to be able to create duplicate
>> names, when their parents are different, similar to a directory structure.
>> I see that I can't create devices with duplicate names (device names),
>> even when their parents are different.
> We actually check that?  Nice, I didn't realize that :)
>
>> How can I allow duplicate names when their parents are different devices?
>> I want to avoid flat model as I have parent child relationship and there
>> will be too many devices using flat model.
> Devices on the same bus shouldn't have the same name, but if they are in
> a "tree", it should be ok.  What check is erroring out?
>
>> Why, I need?
>> I am going to publish RFC for a new power cap class driver. We have a
>> multiple controllers under power cap class (they are devices). Under
>> which there are multiple power zones, with parent/child relationships.
>> Currently I have to use  kobject_init_and_add, which I want to avoid and
>> just use device_register. Other places, wherever such relationships are
>> required, kobjects are used like cpufreq.
> Yes, you shouldn't use "raw" kobject calls at all, so we should fix
> this.
>
> thanks,
>
> greg k-h
>


View attachment "test_dev_create.c" of type "text/x-csrc" (2190 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ