File Systems 269
case 'o':
data = optarg;
break;
case 't':
fstype = optarg;
break;
case 'f':
for (j = 0; j < strlen(optarg); j++) {
switch (optarg[j]) {
case 'b': flags |= MS_BIND; break;
case 'd': flags |= MS_DIRSYNC; break;
case 'l': flags |= MS_MANDLOCK; break;
case 'm': flags |= MS_MOVE; break;
case 'A': flags |= MS_NOATIME; break;
case 'V': flags |= MS_NODEV; break;
case 'D': flags |= MS_NODIRATIME; break;
case 'E': flags |= MS_NOEXEC; break;
case 'S': flags |= MS_NOSUID; break;
case 'r': flags |= MS_RDONLY; break;
case 'c': flags |= MS_REC; break;
case 'R': flags |= MS_REMOUNT; break;
case 's': flags |= MS_SYNCHRONOUS; break;
default: usageError(argv[0], NULL);
}
}
break;
default:
usageError(argv[0], NULL);
}
}
if (argc != optind + 2)
usageError(argv[0], "Wrong number of arguments\n");
if (mount(argv[optind], argv[optind + 1], fstype, flags, data) == -1)
errExit("mount");
exit(EXIT_SUCCESS);
}
–––––––––––––––––––––––––––––––––––––––––––––––––––––––––filesys/t_mount.c
14.8.2 Unmounting a File System: umount() and umount2()................................
The umount() system call unmounts a mounted file system.
The target argument specifies the mount point of the file system to be unmounted.
#include <sys/mount.h>
int umount(const char *target);
Returns 0 on success, or –1 on error