mount_cd9660.c revision 1.1.1.1 1 /*
2 * Copyright (c) 1992, 1993, 1994
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 (at) blitz.com). The Rock Ridge Extension
7 * Support code is derived from software contributed to Berkeley
8 * by Atsushi Murai (amurai (at) spec.co.jp).
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the University of
21 * California, Berkeley and its contributors.
22 * 4. Neither the name of the University nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)mount_cd9660.c 8.4 (Berkeley) 3/27/94
39 */
40
41 #ifndef lint
42 static char copyright[] =
43 "@(#) Copyright (c) 1992, 1993, 1994\n\
44 The Regents of the University of California. All rights reserved.\n";
45 #endif /* not lint */
46
47 #ifndef lint
48 static char sccsid[] = "@(#)mount_cd9660.c 8.4 (Berkeley) 3/27/94";
49 #endif /* not lint */
50
51 #include <sys/param.h>
52 #define CD9660
53 #include <sys/mount.h>
54
55 #include <err.h>
56 #include <stdlib.h>
57 #include <stdio.h>
58 #include <string.h>
59 #include <unistd.h>
60
61 #include "mntopts.h"
62
63 struct mntopt mopts[] = {
64 MOPT_STDOPTS,
65 MOPT_UPDATE,
66 { NULL }
67 };
68
69 void usage __P((void));
70
71 int
72 main(argc, argv)
73 int argc;
74 char **argv;
75 {
76 struct iso_args args;
77 int ch, mntflags, opts;
78 char *dev, *dir, *options;
79
80 options = NULL;
81 mntflags = opts = 0;
82 while ((ch = getopt(argc, argv, "ego:r")) != EOF)
83 switch (ch) {
84 case 'e':
85 opts |= ISOFSMNT_EXTATT;
86 break;
87 case 'g':
88 opts |= ISOFSMNT_GENS;
89 break;
90 case 'o':
91 getmntopts(options, mopts, &mntflags);
92 break;
93 case 'r':
94 opts |= ISOFSMNT_NORRIP;
95 break;
96 case '?':
97 default:
98 usage();
99 }
100 argc -= optind;
101 argv += optind;
102
103 if (argc != 2)
104 usage();
105
106 dev = argv[0];
107 dir = argv[1];
108
109 #define DEFAULT_ROOTUID -2
110 args.fspec = dev;
111 args.export.ex_root = DEFAULT_ROOTUID;
112
113 if (mntflags & MNT_RDONLY)
114 args.export.ex_flags = MNT_EXRDONLY;
115 else
116 args.export.ex_flags = 0;
117 args.flags = opts;
118
119 if (mount(MOUNT_CD9660, dir, mntflags, &args) < 0)
120 err(1, NULL);
121 exit(0);
122 }
123
124 void
125 usage()
126 {
127 (void)fprintf(stderr,
128 "usage: mount_cd9660 [-egrt] [-o options] special node\n");
129 exit(1);
130 }
131