Re: [RFC] Teaching mount(8) to use nmount()

From: Pawel Jakub Dawidek (pjd_at_FreeBSD.org)
Date: 10/09/05

  • Next message: Poul-Henning Kamp: "Re: [RFC] Teaching mount(8) to use nmount()"
    Date: Sun, 9 Oct 2005 08:52:38 +0200
    To: Craig Rodrigues <rodrigc@crodrigues.org>
    
    
    

    On Fri, Oct 07, 2005 at 10:46:20PM -0400, Craig Rodrigues wrote:
    +> I would appreciate any comments on the attached patch.

    I haven't has chance to run any tests, as I'm not at home, so I just
    reviewed the patch a bit.

    +> +static void
    +> +usage(void)
    +> +{
    +> + (void)fprintf(stderr,
    +> + "usage: mount_xfs [-t fstype] [-o options] target_fs mount_point\n");

    mount_xfs is probably a typo here:)

    +> + printf("argc is: %d\n", argc); for (i=0; i < argc; ++i) { printf("%d: %s\n", argc, argv[i]); }

    You probably want to remove it before committing.

    +> + optind = optreset = 1; /* Reset for parse of new argv. */
    +> + while ((ch = getopt(argc, argv, "o:")) != -1) {
    +> + switch(ch) {
    +> + case 'o':
    +> + getmntopts(optarg, mopts, &mntflags, 0);
    +> + p = strchr(optarg, '=');
    +> + val = "";
    +> + if (p != NULL) {
    +> + *p = '\0';
    +> + val = p + 1;
    +> + }
    +> + build_iovec(&iov, &iovlen, optarg, val, -1);
    +> + break;

    Ok, as I suggested on IRC, this can handle only options given in form
    '-o opt1 -o opt2 -o opt3', but not '-o opt1,opt2,opt3'.

    +> + printf("argc is: %d\n", argc);

    Another debug printf.

    I think it is a step forward, so I'm not against committing it, but we need
    to design it better at the end.

    My suggestion (which I discusses with Craig on IRC a bit already) is as
    follows:

    - We create one mount(8) program.

    - When it is called with '-t <fs>' switch, we look for
      /lib/mount/mount_<fs>.so and try to dlopen() it.

    - When there is no such .so, we just pass all option via nmount() to the
      kernel.

    - When there is .so, we decided based on things found there which options
      needs special treatment (like '-C' for mount_cd9660, etc.). Options
      which are not defined in .so we pass to the kernel without touching.

    The advantages:

    - No more external executables for every single file system.
    - mount(8) doesn't have to know about any specific FS, we can just add
      mount_<fs>.so if needed dinamically.
    - We need to create .so only for file systems for which some work has to
      be done in userland.
    - Passing options via nmount(2) as strings should allow to remove this
      annoying behaviour:

            # mount
            ...
            /dev/md0 on /mnt/tmp (ufs, local, noatime, noexec, read-only)
            # mount -u -o rw /mnt/tmp
            # mount
            ...
            /dev/md0 on /mnt/tmp (ufs, local)

      'noexec' and 'noatime' are gone. I know that I can use 'current', but this
      doesn't seem to be intuitive for me (I think not only for me, but I can be
      wrong:)).

    Comments are welcome.

    -- 
    Pawel Jakub Dawidek                       http://www.wheel.pl
    pjd@FreeBSD.org                           http://www.FreeBSD.org
    FreeBSD committer                         Am I Evil? Yes, I Am!
    
    



  • Next message: Poul-Henning Kamp: "Re: [RFC] Teaching mount(8) to use nmount()"

    Relevant Pages

    • Re: [PATCH/RFC] Lustre VFS patch, version 2
      ... > People requested to see the code that uses the patch. ... > The client file system is the primary user of the kernel patch, ... > kernel without exporting it to user space. ... E.g. version of intent API. ...
      (Linux-Kernel)
    • Kernel Panic: VFS cannot open a root device
      ... > I have compiled my kernel with my IDE support and also with my file system ... The patch dont work fine (I think the patch is not installed ...
      (Linux-Kernel)
    • Re: RT patch acceptance
      ... judge the complexity of a design for that type of system. ... claim that you cannot judge the complexity of a kernel modification. ... Since the patch in question doesn't actually need that information to ... nanokernel's API up to date with additions to Linux's API that RT people ...
      (Linux-Kernel)
    • [RFC] Making percpu module variables have their own memory.
      ... Someone using the -rt patch found that one of the tracing options caused ... 64K for every CPU to cover all the per_cpu variables used in the kernel ... static void wakeup_softirqd_prio ...
      (Linux-Kernel)
    • Re: This is [Re:] How to improve the quality of the kernel[?].
      ... The -mm kernel already implements what your proposed PTS would do. ... If patch have no TS ID, ... Thus i can apply for example lguest patches and implement and test new ... How many open source projects use Bugzilla and how many use the Debian BTS? ...
      (Linux-Kernel)