Re: Sysfs Device Attributes: Subdirectory under subdirectory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 29, 2010 at 09:41:21AM +0530, Himanshu Chauhan wrote:
> On Thu, Jan 28, 2010 at 01:11:36PM -0800, Greg KH wrote:
> > On Fri, Jan 29, 2010 at 12:12:31AM +0530, Himanshu Chauhan wrote:
> > > Dear all,
> > > 
> > > I want to create subdirectory under subdirectory in sysfs
> > > for a device.
> > 
> > Ick, don't.
> > 
> > > For example, if vhci_hcd is my device I want
> > > the following hierarchy:
> > > 
> > > vhci_hcd
> > >     |
> > >     +--> status
> > >            |
> > >            +--->0
> > >            |    |
> > >            |    +--> status
> > >            |    |
> > >            |    +--> speed
> > >            |    |
> > >            |    +--> device id
> > >            |    |
> > >            |    +--> socket
> > >            |    |
> > >            |    +--> busid
> > >         ....
> > >         ....
> > >         ....
> > >            |
> > >            +--->N
> > >                 |
> > >                 +--> status
> > >                 |
> > >                 +--> speed
> > >                 |
> > >                 +--> device id
> > >                 |
> > >                 +--> socket
> > >                 |
> > >                 +--> busid
> > 
> > No, you really do not want this.  Why do you feel that you would want to
> > create something that does not fit into the current driver/device model
> > of the kernel?
> > 
> > In short, what specifically are you trying to convey here?
> 
> There are 8 ports exported by VHCI.

What is 'vhci'?

What do you do with a "port"?

> So I want to group the attributes of each port together. 0 to N are
> the port numbers.  All attributes of port zero will be under 0 and all
> attributes of port 1 will be under 1 and so on.

So then make each "port" a device on your bus.  Then the topology
automatically happens for you, no need to mess with "raw" kobjects at
all (which you shouldn't be doing in the first place.)

Can devices be plugged into ports?

> > > So, how do I create subdirectories 0 to N under
> > > status? I created attribute groups from 0 to N,
> > > how do I attach it to status and then in turn,
> > > status to vhci_hcd?
> > 
> > What does these 0-N subdirectories represent?
> > 
> > What does 'status' represent?  Why would status have subdirectories?
> 
> status under VHCI should rather be port_status. So hierarcy would be
> VHCI_HCD->port_status->port_number[0-8]-><attributes>

Why put the port number below the status?

> > And why in that subdirectory would you have another file called status?
> Status is the status of the port if its connected to the stub on the server.
> 
> If this is not good, what would be the best layout?


HCD->port[N]->attributes

where you have a bus for your HCD, and then port[N] are devices attached
to that bus.

Sound reasonable?

thanks,

greg k-h

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux