[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    mdev -i ready for testing
From:       Isaac Dunham <ibid.ag () gmail ! com>
Date:       2015-03-21 15:49:14
Message-ID: 20150321154913.GA3453 () Sparta
[Download RAW message or body]

> 
> >Well, I've poked at this a little this evening.
> >
> >See
> >https://github.com/idunham/busybox
> >(in branch mdev) if you're curious about details.

This is ready for testing now: it works for me and I've tidied
it up a bit.

On Fri, Mar 20, 2015 at 10:04:19AM +0100, Laurent Bercot wrote:
>  A few comments:
> 
>  - Original mdev relies on getenv/putenv to handle environment
> variables; that's okay, because it's a short-lived program.
> But mdev -i is a long-lived program, so using and modifying its
> own environment for every event is conceptually unsatisfying, and
> ends up in a lot of unnecessary malloc/free/reallocs. It would be
> faster and more memory-efficient to allow handle_event to work with
> the raw string containing the VAR=VALUE\0 pairs.
>  I realize it may require modifying all the getenv() invocations in
> the rest of mdev, but I believe it's worth it. (Heavy getenv()
> usage in mdev was one of the parts that made me postpone my plans of
> modifying it myself...)

I've done this, at a cost of at least 70 bytes (it's actually over 100
bytes for just that bit, minus about 30 bytes for some tidying up.)

There's one getenv() call that's left in handle_event(), but that's
deliberate: SEQNUM only applies to the hotplugger.

I *think* I could simplify mdev -s and make it feature-equivalent to
hotplugging by rewriting fileAction() to read a uevent file, replace
\n with \0, and call handle_event().

>  - Why do you need to memset practically the whole buffer every
> poll() iteration ? 

This has been fixed with the getenv -> getkey switch.

Thanks for your comments, Laurent!


Thank you,
Isaac Dunham
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic