mount utility

By covering the mount() library function and the operation in the resource manager, we've pretty well covered the mount utility.

However, if you're writing a mount handler, there may be occasions when you want to do custom parsing of arguments and provide your own data structure to your server. This is why the mount command will always first try to call out to a separate program named mount_XXX, where XXX is the type that you specified with the -t option of mount. To see just what would be called (in terms of options, etc.), you can use the -v option, which should provide you with the command line that would be exec()'ed.

Note: For the full list of mount options, see the mount entry in the QNX Neutrino RTOS Utilities Reference.

In order to help with the argument parsing, there's a utility function, mount_parse_generic_args(), that you can call to process the common options. The function is defined in <sys/mount.h> as:

char *mount_parse_generic_args(char *options, int *flags);

This function parses the given options, removes any options that it recognizes, and sets or clears the appropriate bits in the flags. It returns a pointer to the modified version of options containing any options that it didn't recognize, or NULL if it recognized all the options. You use mount_parse_generic_args() like this:

while ((c = getopt(argv, argc, "o:"))) {
   switch (c) {

      case 'o':

        if ((mysteryop = mount_parse_generic_args(optarg, &flags))) {

           /* You can do your own getsubopt-type processing here.
              The common options are removed from mysteryop. */
        }

        break;
    }
}

For more information about the stripped options and the corresponding flags, see the entry for mount_parse_generic_args(), in the QNX Neutrino C Library Reference.