From: Seewer Philippe <philippe.seewer-omB+W0Dpw2o@public.gmane.org>
To: David Dillow <dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
Cc: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC ONLY 4/5] netroot: move dracut syntax validation to root handlers
Date: Tue, 7 Jul 2009 09:47:31 +0200 [thread overview]
Message-ID: <4A52FD93.3000406@bfh.ch> (raw)
In-Reply-To: <d1aed501ae771d769efcd370f47184f12b9800d6.1246656269.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
David Dillow wrote:
> This reduces the argument parsers in the cmdline hook to giving warnings
> about usage and translating legacy syntaxes to dracut's syntax. The root
> handlers themselves become responsible for validating the dracut syntax.
> This simplifies the cmdline parsers and centralizes the syntax parsers,
> which keeps them from multiplying as new functionality is added.
I don't think that centralizing code is that important. Dracut is
module based after all and the central point to find code is the module
directory. But reducing complexiting and eliminating duplicate code is
always good. And I like the approach of separating legacy cmdline
parseing and parsing dracut-style syntax.
But there's a two things about this approach that bug me:
- The netroot handlers become some sort of multi-call utilities, doing
possibly entirely different things depending on arguments. From a
functional point of view netroot handlers should only care about
the actual mount/login.
- Arguments are constantly reparsed. This is unnecessary but applies to
the current implementation as well
We need to refactor the netroot handlers, that is clear. Because only
the netroot modules can give us a server IP for STP arping. And
second, you are correct that we should get rid of duplicate code in
the current implementation.
What hit me only after really reviewing your code is that the main reason
for duplicate code is that we are using the netroot argument as container
for all parameters a netroot module needs. Hence the constant reparsing
and splitting of that argument.
In an object oriented language, I'd probably define an abstract
superclass which would define methods for the external interface and
concrete Implementations would have to provide. How the actual parameters
are stored internally I couldn't care less. While this isn't really
possible with shell code, a similar approach might simplify things
even more.
Suggestion: We don't use the netroot argument inside netroot. Instead, the
different parsers should write out /tmp/netroot.info in a similar format
to net.ethX.override or dhclient.ethX.dhcpopts. Netroot modules would
have to provide three files: Legacy cmdline parser (optional),
dracut-syntax parser (for netroot= and dhcp root-path), mount/login handler.
This would work like this:
cmdline step 1: All legacy parsers run first, validating if necessary
and/or reformat arguments into netroot= if possible
cmdline step 2: call proto-validate.sh which parses and validates
dracut-syntax
==> After this step, if all parameters are correct and root!=dhcp,
/tmp/netroot.info should be available.
netroot step 1: If root=dhcp do the same as cmdline step 2
==> After this step and if all parameters are correct /tmp/netroot.info
should be available.
netroot step 2: Source /tmp/netroot.info and use "$server" for STP arping.
If it's empty, issue a warning, use dhcp server and rewrite
the file with the new server=.
netroot step 3: Just call the mount/login handler without any arguments.
Everything it needs is in /tmp/netroot.info
What do you think?
Regards,
Philippe
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2009-07-07 7:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-03 21:40 [RFC ONLY 0/5] Move argument validation to root handlers David Dillow
[not found] ` <cover.1246656269.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
2009-07-03 21:40 ` [RFC ONLY 1/5] netroot: remove unused hook David Dillow
[not found] ` <bd4d79bc048ad3944156f86eafb62cf4bc29b1f9.1246656269.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
2009-07-06 12:56 ` Seewer Philippe
2009-07-03 21:40 ` [RFC ONLY 2/5] netroot: remove unhelpful argument checks David Dillow
[not found] ` <0535c73bd25fdcaa9bf4de0bc4b041b74d11e547.1246656269.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
2009-07-06 13:00 ` Seewer Philippe
2009-07-03 21:40 ` [RFC ONLY 3/5] netroot: remove netif from handler invocation David Dillow
[not found] ` <44494af931ad839908cb4542f7c35ae59a4ef65e.1246656269.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
2009-07-06 13:56 ` Seewer Philippe
[not found] ` <4A520291.7010203-omB+W0Dpw2o@public.gmane.org>
2009-07-06 14:43 ` David Dillow
[not found] ` <1246891382.24010.6.camel-FqX9LgGZnHWDB2HL1qBt2PIbXMQ5te18@public.gmane.org>
2009-07-06 15:02 ` Seewer Philippe
[not found] ` <4A521208.2050605-omB+W0Dpw2o@public.gmane.org>
2009-07-06 16:06 ` David Dillow
[not found] ` <1246896365.24010.14.camel-FqX9LgGZnHWDB2HL1qBt2PIbXMQ5te18@public.gmane.org>
2009-07-07 8:10 ` Seewer Philippe
2009-07-03 21:40 ` [RFC ONLY 4/5] netroot: move dracut syntax validation to root handlers David Dillow
[not found] ` <d1aed501ae771d769efcd370f47184f12b9800d6.1246656269.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
2009-07-07 7:47 ` Seewer Philippe [this message]
[not found] ` <4A52FD93.3000406-omB+W0Dpw2o@public.gmane.org>
2009-07-07 14:57 ` David Dillow
2009-07-03 21:40 ` [RFC ONLY 5/5] PROOF-OF-CONCEPT: wait for spanning tree timeout via arping David Dillow
[not found] ` <8cf3d034e4611fbe661d4585fbfd1a03a6fd094b.1246656269.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
2009-07-07 8:08 ` Seewer Philippe
[not found] ` <4A530297.1020906-omB+W0Dpw2o@public.gmane.org>
2009-07-07 15:09 ` David Dillow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A52FD93.3000406@bfh.ch \
--to=philippe.seewer-omb+w0dpw2o@public.gmane.org \
--cc=dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org \
--cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.