Subject: Re: [PATCH 2.6.13-rc1 8/17] bonding: SYSFS INTERFACE (large)

From: Greg KH <[email-masked]>
Date: Wed, 6 Jul 2005 12:52:32 -0700

On Wed, Jul 06, 2005 at 11:53:13AM -0700, Mitch Williams wrote:
> 
> 
> On Sat, 2 Jul 2005, Greg KH wrote:
> 
> >
> > This violates the 1-value-per-sysfs file rule.  Please fix this up.
> >
> 
> Thanks for looking at our patch, Greg.  We're aware of the "one value"
> rule, but we really couldn't find any way to do what we wanted to do
> any other way.  The kernel docs do indicate that it is "socially
> acceptable to express an array of values of values of the same type",
> which this certainly is.
> 
> In this particular case, the file /sys/class/net/bonding_masters contains
> the names of all of the bonds in the system.  By default, the module
> creates a single bond when it loads, thus:
> 
> $ cat bonding_masters
> bond0

And, if you have a _lot_ of bonds, you will not show them all, right?
That would not work well if you read the file, and then append a new one
and write it back.

> You can add and remove bonds just by writing to the file.  In keeping with
> the "array of types" concept, you must write the names of all active bonds
> back to the file.  Thus,
> 
> $ echo "bond0 bond1" > bonding_masters
> 
> retains bond0 and adds bond1.  Likewise,
> 
> $ echo "bond1 bond2" > bonding_masters
> 
> retains bond1, deletes bond0, and adds bond2.
> 
> The slaves file in each bond's directory acts the same way, and is used to
> add or remove slaves from each individual bond.
> 
> We discussed this design extensively before implementation, but really
> couldn't come up with anything as elegant or easy to understand as this
> scheme.  Since it really is an array of similar values, we are hoping that
> it will be viewed as socially acceptable.

No.

How about this:
	bond_add - write to this to add a new bond, one value only.
	bond_remove - write to this to remove a bond that is present.
	bonds/bond0
	bonds/bond1
	bonds/bond2
	...
		- list of bonds currently present.  If you want, you
		  could make those bondX files directories, and put
		  other info about the individual bonds in there, if you
		  need it (I know nothing about the bonding intrerface,
		  sorry.)

Would that work?

thanks,

greg k-h