Re: EVMS Submission for 2.5

Patrick Mochel
2002-10-03T16:48:48Z

> > > I might agree with something along the lines of
> > > * when evms is initialized, it's notified of all existing gendisks
> > > * whenever disk is added after evms initialization, we notify evms
> > > * whenever disk is removed, we notify evms
> >
> > This sounds like it would be exactly what EVMS needs. The only thing we would
> > want to add to this list is: "*whenever a disk is modified, notify evms". For
> > example, with removable media drives (such as Zip and Jaz), when a cartidge
> > is changed, the capacity of the drive might change, and we would like to be
> > notified of that event.
>
> Umm... OK. There were some plans to add a notifier chain for such events
> and EVMS looks like a possible user of that beast. However, it's not
> obvious whether we need to do any of that in the kernel - we definitely
> can have userland up and running before _any_ block devices are initialized,
> so it might be a work for userland helper.

There should be (almost) enough infrastructure in place to do either of
those things using the driver model core. There is now a disk
device_class, with which a struct device_interface can register with. When
a device is added to the class, it is passed to each of the interfaces
registered with the class (via the add_device method).

There is a struct device in struct gendisk, and each device registered
with the class will be the member of a struct gendisk. So, you can do

int add_device(struct device * dev)
{
struct gendisk * disk = container_of(dev,struct gendisk,disk_dev);
...

to get the gendisk structure.

See include/linux/device.h and Documentation/driver-model/ for more info.

Also, /sbin/hotplug will be called after a device is registered with a
class. Greg has been working on this aspect, and should be close to having
it done.

The missing piece is converting the disk drivers to have thier ->devclass
set to the disk class, and having them register with the core.

-pat