This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
Strip off common mount arguments
#include <sys/mount.h> char * mount_parse_generic_args( char * options, int * flags );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The mount_parse_generic_args() function allows you to strip out common flags to help you parse mount arguments. This is useful when you want to create a custom mount utility.
Here's a list of the supported options that may be stripped:
Option: | Set/Clear this bit: | Description: |
---|---|---|
after | Set _MOUNT_AFTER | Call resmgr_attach() with RESMGR_FLAG_AFTER. |
atime | Clear _MOUNT_ATIME | Log file access times (default). |
before | Set _MOUNT_BEFORE | Call resmgr_attach() with RESMGR_FLAG_BEFORE. |
creat | Clear _MOUNT_CREAT | Allow file creation on the filesystem (default). |
enumerate | Set _MOUNT_ENUMERATE | Auto-detect on this device. |
exec | Clear _MOUNT_NOEXEC | Load executables (default). |
force | Set _MOUNT_FORCE | Force an unmount or a remount change. |
noatime | Set _MOUNT_NOATIME | Disable logging of file access times. |
nocreat | Set _MOUNT_NOCREAT | Don't allow file creation on the filesystem. |
noexec | Set _MOUNT_NOEXEC | Don't allow executables to load. |
nostat | Set _MFLAG_OCB | Don't attempt to stat() the special device before mounting (i.e. -t). |
nosuid | Set _MOUNT_NOSUID | Don't honor setuid bits on the filesystem. |
opaque | Set _MOUNT_OPAQUE | Call resmgr_attach() with RESMGR_FLAG_OPAQUE. |
remount | Set _MOUNT_REMOUNT | This path is already mounted; perform an update. |
ro | Set _MOUNT_READONLY | Mark the filesystem mountpoint as read-only. |
rw | Clear _MOUNT_READONLY | Mark the filesystem mountpoint as read/write (default). |
suid | Clear _MOUNT_SUID | Honor setuid bits on the filesystem (default). |
update | Set _MOUNT_REMOUNT | This path is already mounted, perform an update. |
A string pointing to unprocessed options.
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 mysteryop is stripped of the common options. */ } break; } }
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |
mount(), resmgr_attach(), umount()
mount in the Utilities Reference
Writing a Resource Manager in Programmer's Guide