1 /*
2  * Copyright (c) 1992, 1993
3  *      The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley
6  * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
7  * Support code is derived from software contributed to Berkeley
8  * by Atsushi Murai (amurai@spec.co.jp).
9  *
10  * %sccs.include.redist.c%
11  *
12  *      @(#)mount_cd9660.c	8.2 (Berkeley) 01/23/94
13  */
14 
15 #ifndef lint
16 static char copyright[] =
17 "@(#) Copyright (c) 1992, 1993\n\
18         The Regents of the University of California.  All rights reserved.\n";
19 #endif /* not lint */
20 
21 #ifndef lint
22 static char sccsid[] = "@(#)mount_cd9660.c	8.2 (Berkeley) 01/23/94";
23 #endif /* not lint */
24 
25 #include <stdio.h>
26 #include <sys/param.h>
27 #define CD9660
28 #include <sys/mount.h>
29 
30 #define DEFAULT_ROOTUID	-2
31 
32 void
33 usage ()
34 {
35 
36 	fprintf (stderr, "usage: mount_iso bdev dir\n");
37 	exit (1);
38 }
39 
40 int
41 main (argc, argv)
42 	int argc;
43 	char **argv;
44 {
45 	char *dev;
46 	char *dir;
47 	struct iso_args args;
48 	int c;
49 	int opts = 0, mntflags = 0;
50 
51 	argc--;
52 	argv++;
53 	while (argc > 2) {
54 		if (!strcmp("-F", argv[0])) {
55 			argc--; argv++;
56 			mntflags |= atoi(argv[0]);
57 			argc--; argv++;
58 		} else if (!strcmp(argv[0], "-norrip")) {
59 			opts |= ISOFSMNT_NORRIP;
60 			argc--; argv++;
61 		} else if (!strcmp(argv[0], "-gen")) {
62 			opts |= ISOFSMNT_GENS;
63 			argc--; argv++;
64 		} else if (!strcmp(argv[0], "-extattr")) {
65 			opts |= ISOFSMNT_EXTATT;
66 			argc--; argv++;
67 		} else if (!strcmp(argv[0], "-notrans")) {
68 			opts |= ISOFSMNT_NOTRANS;
69 			argc--; argv++;
70 		} else
71 			usage();
72 	}
73 
74 	dev = argv[0];
75 	dir = argv[1];
76 
77 	args.fspec = dev;
78 	args.export.ex_root = DEFAULT_ROOTUID;
79 	if (mntflags & MNT_RDONLY)
80 		args.export.ex_flags = MNT_EXRDONLY;
81 	else
82 		args.export.ex_flags = 0;
83 	args.flags = opts;
84 
85 	if (mount (MOUNT_CD9660, dir, mntflags, &args) < 0) {
86 		perror ("mount");
87 		exit (1);
88 	}
89 
90 	exit (0);
91 }
92