lkml.org 
[lkml]   [2003]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: ANNOUNCE: User-space System Device Enumation (uSDE)
Date
On Tue, 28 Oct 2003 22:52:33 +0000, Greg KH wrote:
> For SDE:
> $ find . -type f | egrep '[.c|.h]$' | xargs wc -l | tail -1
> 57328 total
...
> For udev:
> $ find . -type f | egrep '[.c|.h]$' | xargs wc -l | tail -1
> 17632 total

Here is a config file and a 41 lines shell script, that
will populate /udev with all devices found via /sys.
A version to add or remove only one file should be about
the same size.

---cat /etc/makedev.conf---
ttyS0 root dialout 0660
zero root root 0666
null root root 0666
---cat makedev---
#!/bin/sh
set -e

DEV=/udev
CONFIG=/etc/makedev.conf

cd $DEV

find /sys/class -name dev |while read A;
do
B=`dirname $A`
B=`basename $B`
MM=`cat $A|tr ":" " "`
mknod --mode=0600 $B c $MM
if grep -q "$B " $CONFIG
then
USER=`grep "$B " $CONFIG|cut -d" " -f2`
GROUP=`grep "$B " $CONFIG|cut -d" " -f3`
MODE=`grep "$B " $CONFIG|cut -d" " -f4`
chown $USER.$GROUP $B
chmod $MODE $B
fi
done
find /sys/block -name dev |while read A;
do
B=`dirname $A`
B=`basename $B`
MM=`cat $A|tr ":" " "`
mknod --mode=0600 $B b $MM
if grep -q "$B " $CONFIG
then
USER=`grep "$B " $CONFIG|cut -d" " -f2`
GROUP=`grep "$B " $CONFIG|cut -d" " -f3`
MODE=`grep "$B " $CONFIG|cut -d" " -f4`
chown $USER.$GROUP $B
chmod $MODE $B
fi
done
---cut---
So udev is 99% overhead?

sure, it's fast and small, and has lots of features that I don't need.

> SDE: 57328 lines
> udev: 9090 lines
shell script: 41 lines

> that udev is suffering from "lack of maintainability and bloat" if you
> really want :)

bloat. lots of bloat. what is that tdb database for?
filesystems are persistent. if you want to save space,
create a tar file :-)

> p.s. yes, I know lines of code is a horrible metric, and doesn't really
> mean squat. I just want to point out the huge size difference between
> the current state of udev and SDE, with pretty much identical
> functionality from what I can tell.

I agree. lines of codes is a horrible metric, and comparing a shell
script that uses many external commands to a c application with
everything build is makes absolutely no sense. but I wonder why
the off the shelf machine needs a c applications, if all those
external commands are installed anyway.

Regards, Andreas

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:58    [from the cache]
©2003-2011 Jasper Spaans