While we're discussing features that people would like:  Here at
UCLA-Mathnet we have over 100 machines which export various filesystems to
random other machines on an "as needed" basis.  On Solaris,
/etc/auto_master includes a line:

/net            -hosts          -nosuid,nobrowse

which means that if a user refers to /net/tupelo/h1/maint/jimc (for 
example), the toplevel automounter process will fork a submount for 
/net/tupelo, and that one will attempt to mount tupelo:/h1.  

To emulate this on Linux, I do (or the startup script does) "automount /net 
program /etc/auto.net", where the program map is a cockamamie script I 
wrote which creates a map file saying

*       tupelo:/&

in a special directory, and then exudes 

-rsize=8192,wsize=8192,retry=1,soft,fstype=autofs file:/rete/tupelo

so that the submount will get the newly created map file.  It also purges 
map files that are no longer in use.  This latter part is nasty and risky.

Automating this script would be really nice.  In the current Sun approach,
the whole thing is just assumed for a host map.  Here's a somewhat more
configurable proposal for Linux:

There would be a new map type of, well, what's a reasonable name for it?  
"macro".  The second field of the map row would be "macro:(the literal
content of the map)", as if read from a file.  Since it contains
whitespace, it must be enclosed in (parens).  (Not quotes, because you need
nested quoting, and it's too hard to determine the polarity of imbedded
quotes.)

Backslash should escape any character, in the sense that backslash-anything
(except newline?) turns into the "anything" character and magic semantics
is bypassed.  In particular, & and $ and a second backslash would have
their magic concealed.  To have a control character interpreted at the n-th
level you need (2^n)-1 backslashes.  (Since parens are nested, it doesn't
matter whether you put backslashes on them or not.)

For example, the host map could be represented in /etc/auto.master as:

    /net macro:(* macro:(* &:/\&)) -fstype=autofs,other_options

Upon access to /net/tgthost/filesys, the first ampersand is expanded to the 
toplevel key (target host name), producing a submount, which thinks its map 
file says:

    * macro:(* tgthost:/&) -other_options

Then when the submount sees the request it expands its macro into a map
line like this, with & replaced by the key from the request:

    * tgthost:/filesys -other_options

which is exactly what you need to get the job done.

Since lines can get long in automount maps, particularly macro lines, and
since we have to work on backslashes anyway, this might be a nice time to
put in backslash-newline escapes.  The rule would be to completely ignore
backslash-newline-whitespace.  If you want whitespace there, put a blank 
before \\n.  For example,

    key type:long_bunch_of_stuff \\n
        mount_options
    key type:more_prolix\\n
        _stuff mount_options

would be equivalent to

    key type:long_bunch_of_stuff mount_options
    key type:more_prolix_stuff mount_options

What do you think?  

James F. Carter          Voice 310 825 2897    FAX 310 206 6673
UCLA-Mathnet;  6115 MSA; 405 Hilgard Ave.; Los Angeles, CA, USA  90095-1555
Email: [EMAIL PROTECTED]    http://www.math.ucla.edu/~jimc (q.v. for PGP key)

_______________________________________________
autofs mailing list
[EMAIL PROTECTED]
http://linux.kernel.org/mailman/listinfo/autofs

Reply via email to