Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/etc

On Sat, 15 Sep 2012, Martin Husemann wrote:
On Sat, Sep 15, 2012 at 12:35:26PM +0200, Alan Barrett wrote:
Under what circumstances is it useful for MAKEDEV to mount ptyfs? Why can't we rely on other code to mount it later?

We can - this is just a very central place to catch them all easily. I don't mind doing it explicitly elsewehere.

Can we at least make this conditional on the "-M" flag being specified twice, as happens when init(8) invokes MAKEDEV?

Isn't that already the case? I thought the $do_create_mfs would only be set in that case.

do_create_mfs is set when MAKEDEV gets the "-M" flag. init(8) invokes MAKEDEV with "-MM", which causes MAKEDEV to do some extra stuff that is doesn't do when there's only one "-M" flag. This is intended to allow callers other than init(8) to use "-M", in case anything ever wants to do that. At present, the only extra thing that MAKEDEV does when given two "-M" flags is to redirect its output to the newly-created /dev/console as early as posible, but any special handling of ptyfs could also be linked to that.

I should probably use a variable with a better name than "do_redirect" to remember whether we got two "-M" flags. Perhaps like this:

--- MAKEDEV.tmpl        13 Aug 2012 08:30:51 -0000      1.157
+++ MAKEDEV.tmpl        15 Sep 2012 11:14:15 -0000
@@ -427,6 +427,7 @@ setup()
        : ${TOOL_PAX:=pax}
+       do_extra_for_init=false
@@ -441,8 +442,8 @@ setup()
                case ${ch} in
                        # "-M" sets do_create_mfs;
-                       # "-M -M" is for use from init(8), and sets do_redirect
-                       do_redirect=$do_create_mfs
+                       # "-M -M" is for use from init(8).
+                       do_extra_for_init=$do_create_mfs
                f)      do_force=true
@@ -529,6 +530,11 @@ setup()
+ # Extra things to do when invoked by init(8) with two "-M" flags
+       if $do_extra_for_init; then
+               do_redirect=true
+       fi
        # do_force requires mknod
        if $do_force; then
                if $do_mtree || $do_pax || $do_specfile; then

Home | Main Index | Thread Index | Old Index