mount_cd9660.c (22990) | mount_cd9660.c (23680) |
---|---|
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@blitz.com). The Rock Ridge Extension 7 * Support code is derived from software contributed to Berkeley 8 * by Atsushi Murai (amurai@spec.co.jp). --- 21 unchanged lines hidden (view full) --- 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 * | 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@blitz.com). The Rock Ridge Extension 7 * Support code is derived from software contributed to Berkeley 8 * by Atsushi Murai (amurai@spec.co.jp). --- 21 unchanged lines hidden (view full) --- 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 | 38 * @(#)mount_cd9660.c 8.7 (Berkeley) 5/1/95 |
39 */ 40 41#ifndef lint 42static 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/* | 39 */ 40 41#ifndef lint 42static 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/* |
49static char sccsid[] = "@(#)mount_cd9660.c 8.4 (Berkeley) 3/27/94"; | 49static char sccsid[] = "@(#)mount_cd9660.c 8.7 (Berkeley) 5/1/95"; |
50*/ 51static const char rcsid[] = | 50*/ 51static const char rcsid[] = |
52 "$Id$"; | 52 "$Id: mount_cd9660.c,v 1.9 1997/02/22 14:32:44 peter Exp $"; |
53#endif /* not lint */ 54 55#include <sys/param.h> | 53#endif /* not lint */ 54 55#include <sys/param.h> |
56#define CD9660 | |
57#include <sys/mount.h> | 56#include <sys/mount.h> |
57#include <sys/../isofs/cd9660/cd9660_mount.h> |
|
58 59#include <err.h> 60#include <stdlib.h> 61#include <stdio.h> 62#include <string.h> 63#include <sysexits.h> 64#include <unistd.h> 65 --- 13 unchanged lines hidden (view full) --- 79int 80main(argc, argv) 81 int argc; 82 char **argv; 83{ 84 struct iso_args args; 85 int ch, mntflags, opts; 86 char *dev, *dir; | 58 59#include <err.h> 60#include <stdlib.h> 61#include <stdio.h> 62#include <string.h> 63#include <sysexits.h> 64#include <unistd.h> 65 --- 13 unchanged lines hidden (view full) --- 79int 80main(argc, argv) 81 int argc; 82 char **argv; 83{ 84 struct iso_args args; 85 int ch, mntflags, opts; 86 char *dev, *dir; |
87 struct vfsconf *vfc; | 87 struct vfsconf vfc; 88 int error; |
88 89 mntflags = opts = 0; 90 while ((ch = getopt(argc, argv, "ego:r")) != EOF) 91 switch (ch) { 92 case 'e': 93 opts |= ISOFSMNT_EXTATT; 94 break; 95 case 'g': --- 14 unchanged lines hidden (view full) --- 110 111 if (argc != 2) 112 usage(); 113 114 dev = argv[0]; 115 dir = argv[1]; 116 117#define DEFAULT_ROOTUID -2 | 89 90 mntflags = opts = 0; 91 while ((ch = getopt(argc, argv, "ego:r")) != EOF) 92 switch (ch) { 93 case 'e': 94 opts |= ISOFSMNT_EXTATT; 95 break; 96 case 'g': --- 14 unchanged lines hidden (view full) --- 111 112 if (argc != 2) 113 usage(); 114 115 dev = argv[0]; 116 dir = argv[1]; 117 118#define DEFAULT_ROOTUID -2 |
118 args.fspec = dev; 119 args.export.ex_root = DEFAULT_ROOTUID; 120 | |
121 /* 122 * ISO 9660 filesystems are not writeable. 123 */ 124 mntflags |= MNT_RDONLY; 125 args.export.ex_flags = MNT_EXRDONLY; | 119 /* 120 * ISO 9660 filesystems are not writeable. 121 */ 122 mntflags |= MNT_RDONLY; 123 args.export.ex_flags = MNT_EXRDONLY; |
126 | 124 args.fspec = dev; 125 args.export.ex_root = DEFAULT_ROOTUID; |
127 args.flags = opts; 128 | 126 args.flags = opts; 127 |
129 vfc = getvfsbyname("cd9660"); 130 if(!vfc && vfsisloadable("cd9660")) { 131 if(vfsload("cd9660")) { | 128 error = getvfsbyname("cd9660", &vfc); 129 if (error && vfsisloadable("cd9660")) { 130 if (vfsload("cd9660")) |
132 err(EX_OSERR, "vfsload(cd9660)"); | 131 err(EX_OSERR, "vfsload(cd9660)"); |
133 } | |
134 endvfsent(); /* flush cache */ | 132 endvfsent(); /* flush cache */ |
135 vfc = getvfsbyname("cd9660"); | 133 error = getvfsbyname("cd9660", &vfc); |
136 } | 134 } |
137 if (!vfc) 138 errx(EX_OSERR, "cd9660 filesystem not available"); | 135 if (error) 136 errx(1, "cd9660 filesystem is not available"); |
139 | 137 |
140 if (mount(vfc->vfc_index, dir, mntflags, &args) < 0) 141 err(EX_OSERR, "%s", dev); | 138 if (mount(vfc.vfc_name, dir, mntflags, &args) < 0) 139 err(1, NULL); |
142 exit(0); 143} 144 145void 146usage() 147{ 148 (void)fprintf(stderr, 149 "usage: mount_cd9660 [-egrt] [-o options] special node\n"); 150 exit(EX_USAGE); 151} | 140 exit(0); 141} 142 143void 144usage() 145{ 146 (void)fprintf(stderr, 147 "usage: mount_cd9660 [-egrt] [-o options] special node\n"); 148 exit(EX_USAGE); 149} |