2004-11-18 23:17:38

by Greg KH

[permalink] [raw]
Subject: [ANNOUNCE] a very tiny /sbin/hotplug

So, a number of people have complained over the past few years about the
fact that /sbin/hotplug was a shell script. Funny enough, it's the
people on the huge boxes, with huge number of devices that are
complaining, not the embedded people with limited resources (ironic,
isn't it...)

Anyway, attached below is a replacement /sbin/hotplug written in c.
Compiling it with klibc gives you me the following size:
$ size hotplug
text data bss dec hex filename
4149 28 20 4197 1065 hotplug
$ ls -l hotplug
-rwxr-xr-x 1 greg users 4636 Nov 18 15:08 hotplug

Which is smaller than /bin/true on my boxes (and /bin/true is linked
dynamically, this is a static binary. Linked dynamically, it's still
smaller than /bin/true. gnu programs, go figure...)

I'll be putting this all togther in a "hotplug-ng" type tarball, as I
slowly replace the existing hotplug scripts with rewrites based on the
fact that we've learned things over the past 4 years, and dropping
support for 2.4 and previous kernels. But for now, have fun with this
program.

Oh, and yeah, I know I need to fix up the fact that if /dev/null isn't
present, we should create it ourselves and go from there. That's next
on the list after putting it all in a project.

thanks,

greg k-h

p.s. the list.h and logging.h files come from the udev project, if you
want to build this yourself.


Attachments:
(No filename) (1.35 kB)
hot.c (3.87 kB)
Download all attachments

2004-11-18 23:53:41

by Eugene Surovegin

[permalink] [raw]
Subject: Re: [ANNOUNCE] a very tiny /sbin/hotplug

On Thu, Nov 18, 2004 at 03:14:06PM -0800, Greg Kroah-Hartman wrote:
> So, a number of people have complained over the past few years about the
> fact that /sbin/hotplug was a shell script. Funny enough, it's the
> people on the huge boxes, with huge number of devices that are
> complaining, not the embedded people with limited resources (ironic,
> isn't it...)

This is probably because embedded people don't use hotplug at all :).
On dozen different PPC and MIPS boxes I worked on, we never needed
this feature.

--
Eugene

2004-11-18 23:55:53

by Chris Larson

[permalink] [raw]
Subject: Re: [ANNOUNCE] a very tiny /sbin/hotplug

* Eugene Surovegin ([email protected]) wrote:
> On Thu, Nov 18, 2004 at 03:14:06PM -0800, Greg Kroah-Hartman wrote:
> > So, a number of people have complained over the past few years about the
> > fact that /sbin/hotplug was a shell script. Funny enough, it's the
> > people on the huge boxes, with huge number of devices that are
> > complaining, not the embedded people with limited resources (ironic,
> > isn't it...)
>
> This is probably because embedded people don't use hotplug at all :).
> On dozen different PPC and MIPS boxes I worked on, we never needed
> this feature.

I tend to focus on ARM, and find this very useful. I know of a number
of folks using erik andersen's "diethotplug" (which hasnt been touched
in some time). I look forward to your further hotplug improvements.
--
Chris Larson - kergoth at handhelds dot org
Linux Software Systems Engineer - clarson at ti dot com
OpenZaurus Project Maintainer - http://openzaurus.org/

2004-11-19 00:23:18

by Greg KH

[permalink] [raw]
Subject: Re: [ANNOUNCE] a very tiny /sbin/hotplug

On Thu, Nov 18, 2004 at 05:53:01PM -0600, Chris Larson wrote:
> * Eugene Surovegin ([email protected]) wrote:
> > On Thu, Nov 18, 2004 at 03:14:06PM -0800, Greg Kroah-Hartman wrote:
> > > So, a number of people have complained over the past few years about the
> > > fact that /sbin/hotplug was a shell script. Funny enough, it's the
> > > people on the huge boxes, with huge number of devices that are
> > > complaining, not the embedded people with limited resources (ironic,
> > > isn't it...)
> >
> > This is probably because embedded people don't use hotplug at all :).
> > On dozen different PPC and MIPS boxes I worked on, we never needed
> > this feature.
>
> I tend to focus on ARM, and find this very useful. I know of a number
> of folks using erik andersen's "diethotplug" (which hasnt been touched
> in some time). I look forward to your further hotplug improvements.

Yes, diethotplug is based on my old package called, supprise,
diethotplug, and is located at
http://www.kernel.org/pub/linux/utils/kernel/hotplug/

But that only does module loading. The "full" replacement of today's
/sbin/hotplug functionality needs this hotplug multiplexer, and a
diethotplug replacement (which can get much smaller than the current
diethotplug due to the way modprobe works in 2.6.)

thanks,

greg k-h

2004-11-19 10:07:02

by Robert Schwebel

[permalink] [raw]
Subject: Re: [ANNOUNCE] a very tiny /sbin/hotplug

On Thu, Nov 18, 2004 at 03:46:29PM -0800, Eugene Surovegin wrote:
> This is probably because embedded people don't use hotplug at all :).

Not true ;) PTXdist has hotplug support for some time.

Robert
--
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Hornemannstra?e 12, 31137 Hildesheim, Germany
Phone: +49-5121-28619-0 | Fax: +49-5121-28619-4