View | Details | Raw Unified | Return to bug 25273 | Differences between
and this patch

Collapse All | Expand All

(-)vnconfig.8 (+12 lines)
Lines 188-193 Link Here
188
.Xr mount 2 .
188
.Xr mount 2 .
189
.It Dv Pf mount= Pa mount_point
189
.It Dv Pf mount= Pa mount_point
190
Same as ``mountrw=''.
190
Same as ``mountrw=''.
191
.It Dv Pf type= Pa fstype
192
Mounts the file system as type
193
.Ar fstype .
194
The type
195
.Ar ufs
196
is the default.
191
.El
197
.El
192
.Pp
198
.Pp
193
A configuration file contains one line per device/file pair in the form:
199
A configuration file contains one line per device/file pair in the form:
Lines 217-222 Link Here
217
Configures
223
Configures
218
.Pa vn0c
224
.Pa vn0c
219
and enables swapping on it.
225
and enables swapping on it.
226
.Pp
227
.Dl vnconfig -e vn0c myisoimage mountro=/iso type=cd9660
228
.Pp
229
Configures
230
.Pa vn0c
231
and read-only mounts an ISO-9660 image file.
220
.Pp
232
.Pp
221
.Dl vnconfig -d vn0c myfilesystem mount=/mnt
233
.Dl vnconfig -d vn0c myfilesystem mount=/mnt
222
.Pp
234
.Pp
(-)vnconfig.c (-14 / +28 lines)
Lines 75-80 Link Here
75
	int	flags;
75
	int	flags;
76
	int	size;
76
	int	size;
77
	char	*oarg;
77
	char	*oarg;
78
	char	*otype;
78
} vndisks[MAXVNDISK];
79
} vndisks[MAXVNDISK];
79
80
80
#define VN_CONFIG	0x01
81
#define VN_CONFIG	0x01
Lines 222-229 Link Here
222
		vndisks[0].flags = flags;
223
		vndisks[0].flags = flags;
223
		vndisks[0].size = size;
224
		vndisks[0].size = size;
224
		vndisks[0].autolabel = autolabel;
225
		vndisks[0].autolabel = autolabel;
225
		if (optind < argc)
226
		vndisks[0].oarg = NULL;
226
			getoptions(&vndisks[0], argv[optind]);
227
		vndisks[0].otype = "ufs";
228
		while (optind < argc)
229
			getoptions(&vndisks[0], argv[optind++]);
227
		nvndisks = 1;
230
		nvndisks = 1;
228
	}
231
	}
229
	rv = 0;
232
	rv = 0;
Lines 242-249 Link Here
242
	if (!strcmp(str,"follow")) { *p |= VN_FOLLOW; return 0; }
245
	if (!strcmp(str,"follow")) { *p |= VN_FOLLOW; return 0; }
243
	if (!strcmp(str,"debug")) { *p |= VN_DEBUG; return 0; }
246
	if (!strcmp(str,"debug")) { *p |= VN_DEBUG; return 0; }
244
	if (!strcmp(str,"io")) { *p |= VN_IO; return 0; }
247
	if (!strcmp(str,"io")) { *p |= VN_IO; return 0; }
245
	if (!strcmp(str,"all")) { *p |= ~0; return 0; }
248
	if (!strcmp(str,"all")) { *p = ~0; return 0; }
246
	if (!strcmp(str,"none")) { *p |= 0; return 0; }
249
	if (!strcmp(str,"none")) { *p = 0; return 0; }
247
	return 1;
250
	return 1;
248
}
251
}
249
252
Lines 251-257 Link Here
251
config(vnp)
254
config(vnp)
252
	struct vndisk *vnp;
255
	struct vndisk *vnp;
253
{
256
{
254
	char *dev, *file, *oarg;
257
	char *dev, *file, *oarg, *otype;
255
	int flags;
258
	int flags;
256
	struct vn_ioctl vnio;
259
	struct vn_ioctl vnio;
257
	register int rv;
260
	register int rv;
Lines 272-277 Link Here
272
	file = vnp->file;
275
	file = vnp->file;
273
	flags = vnp->flags;
276
	flags = vnp->flags;
274
	oarg = vnp->oarg;
277
	oarg = vnp->oarg;
278
	otype = vnp->otype;
275
279
276
	if (flags & VN_IGNORE)
280
	if (flags & VN_IGNORE)
277
		return(0);
281
		return(0);
Lines 436-441 Link Here
436
			printf("%s: flags now=%08lx\n",dev,l);
440
			printf("%s: flags now=%08lx\n",dev,l);
437
	}
441
	}
438
442
443
	fclose(f);
444
439
	/*
445
	/*
440
	 * Enable special functions on the device
446
	 * Enable special functions on the device
441
	 */
447
	 */
Lines 446-467 Link Here
446
				warn("swapon");
452
				warn("swapon");
447
			else if (verbose)
453
			else if (verbose)
448
				printf("%s: swapping enabled\n", dev);
454
				printf("%s: swapping enabled\n", dev);
449
		}
455
		} else
450
		if (flags & (VN_MOUNTRO|VN_MOUNTRW)) {
456
		if (flags & (VN_MOUNTRO|VN_MOUNTRW)) {
451
			struct ufs_args args;
457
			struct ufs_args args;
452
			int mflags;
458
			int mflags;
453
459
454
			args.fspec = dev;
460
			args.fspec = dev;
455
			mflags = (flags & VN_MOUNTRO) ? MNT_RDONLY : 0;
461
			mflags = (flags & VN_MOUNTRO) ? MNT_RDONLY : 0;
456
			rv = mount("ufs", oarg, mflags, &args);
462
			rv = mount(otype, oarg, mflags, &args);
457
			if (rv)
463
			if (rv)
458
				warn("mount");
464
				warn("mount");
459
			else if (verbose)
465
			else if (verbose)
460
				printf("%s: mounted on %s\n", dev, oarg);
466
				printf("%s: mounted on %s (%s)\n", dev, oarg, otype);
461
		}
467
		}
462
	}
468
	}
463
/* done: */
469
/* done: */
464
	fclose(f);
465
	fflush(stdout);
470
	fflush(stdout);
466
	return(rv < 0);
471
	return(rv < 0);
467
}
472
}
Lines 509-523 Link Here
509
514
510
		if (*sp == '%' && strtol(sp + 1, NULL, 0) > 0) {
515
		if (*sp == '%' && strtol(sp + 1, NULL, 0) > 0) {
511
			vndisks[ix].size = getsize(sp + 1);
516
			vndisks[ix].size = getsize(sp + 1);
517
			vndisks[ix].file = NULL;
512
		} else {
518
		} else {
519
			vndisks[ix].size = 0;
513
			vndisks[ix].file = malloc(cp - sp);
520
			vndisks[ix].file = malloc(cp - sp);
514
			strcpy(vndisks[ix].file, sp);
521
			strcpy(vndisks[ix].file, sp);
515
		}
522
		}
516
523
		vndisks[ix].autolabel = NULL;
517
		while (!EOL(*cp) && WHITE(*cp))
524
		while (!EOL(*cp) && WHITE(*cp))
518
			cp++;
525
			cp++;
519
		vndisks[ix].flags = flags;
526
		vndisks[ix].flags = flags;
520
		if (!EOL(*cp)) {
527
		vndisks[ix].oarg = NULL;
528
		vndisks[ix].otype = "ufs";
529
		while (!EOL(*cp)) {
521
			sp = cp;
530
			sp = cp;
522
			while (!EOL(*cp) && !WHITE(*cp))
531
			while (!EOL(*cp) && !WHITE(*cp))
523
				cp++;
532
				cp++;
Lines 536-541 Link Here
536
{
545
{
537
	int flags = 0;
546
	int flags = 0;
538
	char *oarg = NULL;
547
	char *oarg = NULL;
548
	char *otype = NULL;
539
549
540
	if (strcmp(fstr, "swap") == 0)
550
	if (strcmp(fstr, "swap") == 0)
541
		flags |= VN_SWAP;
551
		flags |= VN_SWAP;
Lines 548-561 Link Here
548
	} else if (strncmp(fstr, "mountro=", 8) == 0) {
558
	} else if (strncmp(fstr, "mountro=", 8) == 0) {
549
		flags |= VN_MOUNTRO;
559
		flags |= VN_MOUNTRO;
550
		oarg = &fstr[8];
560
		oarg = &fstr[8];
561
	} else if (strncmp(fstr, "type=", 5) == 0) {
562
		otype = &fstr[5];
551
	} else if (strcmp(fstr, "ignore") == 0)
563
	} else if (strcmp(fstr, "ignore") == 0)
552
		flags |= VN_IGNORE;
564
		flags |= VN_IGNORE;
553
	vnp->flags |= flags;
565
	vnp->flags |= flags;
554
	if (oarg) {
566
	if (oarg) {
555
		vnp->oarg = malloc(strlen(oarg) + 1);
567
		vnp->oarg = malloc(strlen(oarg) + 1);
556
		strcpy(vnp->oarg, oarg);
568
		strcpy(vnp->oarg, oarg);
557
	} else
569
	} else if (otype) {
558
		vnp->oarg = NULL;
570
		vnp->otype = malloc(strlen(otype) + 1);
571
		strcpy(vnp->otype, otype);
572
	}
559
}
573
}
560
574
561
char *
575
char *
Lines 585-591 Link Here
585
{
599
{
586
	fprintf(stderr, "%s\n%s\n%s\n",
600
	fprintf(stderr, "%s\n%s\n%s\n",
587
		"usage: vnconfig [-cdeguv] [-s option] [-r option] [-S value] special_file",
601
		"usage: vnconfig [-cdeguv] [-s option] [-r option] [-S value] special_file",
588
		"                [regular_file] [feature]",
602
		"                [regular_file] [features]",
589
		"       vnconfig -a [-cdeguv] [-s option] [-r option] [-f config_file]");
603
		"       vnconfig -a [-cdeguv] [-s option] [-r option] [-f config_file]");
590
	exit(1);
604
	exit(1);
591
}
605
}

Return to bug 25273