summaryrefslogtreecommitdiff
path: root/sbin/mount_cd9660
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2007-03-21 13:44:05 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2007-03-21 13:44:05 +0000
commit03c6166378b767783215ed2591b98c3664a878e8 (patch)
tree4db1fa0a07918910ff78eda2653798de8afee156 /sbin/mount_cd9660
parent0ffc3492dbf1a836c5da2f58639ebee32f48c3bc (diff)
Add support for mounting arbitrary sessions, from Enache Adrian
OK deraadt@ mjc@ canacar@ krw@, with much input from Enache himself
Diffstat (limited to 'sbin/mount_cd9660')
-rw-r--r--sbin/mount_cd9660/mount_cd9660.810
-rw-r--r--sbin/mount_cd9660/mount_cd9660.c21
2 files changed, 25 insertions, 6 deletions
diff --git a/sbin/mount_cd9660/mount_cd9660.8 b/sbin/mount_cd9660/mount_cd9660.8
index e953a339505..acda0542e22 100644
--- a/sbin/mount_cd9660/mount_cd9660.8
+++ b/sbin/mount_cd9660/mount_cd9660.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: mount_cd9660.8,v 1.19 2005/11/27 13:11:59 jmc Exp $
+.\" $OpenBSD: mount_cd9660.8,v 1.20 2007/03/21 13:44:04 pedro Exp $
.\" $NetBSD: mount_cd9660.8,v 1.3 1995/04/23 10:33:13 cgd Exp $
.\"
.\" Copyright (c) 1993, 1994
@@ -43,6 +43,7 @@
.Nm mount_cd9660
.Op Fl egjR
.Op Fl o Ar options
+.Op Fl s Ar offset
.Ar special node
.Sh DESCRIPTION
The
@@ -81,6 +82,13 @@ See the
man page for possible options and their meanings.
.It Fl R
Do not use any Rockridge extensions included in the filesystem.
+.It Fl s Ar offset
+Use the session starting at
+.Ar offset
+(counted in 2048-byte blocks from the start of the media) instead of
+the last session from the Table of Contents (TOC).
+The TOC can be inspected by using
+.Xr cdio 1 .
.El
.Sh SEE ALSO
.Xr mount 2 ,
diff --git a/sbin/mount_cd9660/mount_cd9660.c b/sbin/mount_cd9660/mount_cd9660.c
index 9b66f8fee8c..69ed81424f3 100644
--- a/sbin/mount_cd9660/mount_cd9660.c
+++ b/sbin/mount_cd9660/mount_cd9660.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount_cd9660.c,v 1.17 2005/04/08 20:09:36 jaredy Exp $ */
+/* $OpenBSD: mount_cd9660.c,v 1.18 2007/03/21 13:44:04 pedro Exp $ */
/* $NetBSD: mount_cd9660.c,v 1.3 1996/04/13 01:31:08 jtc Exp $ */
/*
@@ -45,7 +45,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)mount_cd9660.c 8.4 (Berkeley) 3/27/94";
#else
-static char rcsid[] = "$OpenBSD: mount_cd9660.c,v 1.17 2005/04/08 20:09:36 jaredy Exp $";
+static char rcsid[] = "$OpenBSD: mount_cd9660.c,v 1.18 2007/03/21 13:44:04 pedro Exp $";
#endif
#endif /* not lint */
@@ -55,6 +55,7 @@ static char rcsid[] = "$OpenBSD: mount_cd9660.c,v 1.17 2005/04/08 20:09:36 jared
#include <err.h>
#include <errno.h>
+#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -74,11 +75,12 @@ int
main(int argc, char *argv[])
{
struct iso_args args;
- int ch, mntflags, opts;
+ int ch, mntflags, opts, sess = 0;
char *dev, dir[MAXPATHLEN];
+ const char *errstr;
mntflags = opts = 0;
- while ((ch = getopt(argc, argv, "egjo:R")) != -1)
+ while ((ch = getopt(argc, argv, "egjo:Rs:")) != -1)
switch (ch) {
case 'e':
opts |= ISOFSMNT_EXTATT;
@@ -95,6 +97,13 @@ main(int argc, char *argv[])
case 'R':
opts |= ISOFSMNT_NORRIP;
break;
+ case 's':
+ opts |= ISOFSMNT_SESS;
+ sess = strtonum(optarg, 0, INT32_MAX, &errstr);
+ if (errstr)
+ errx(1, "session number is %s: %s", errstr,
+ optarg);
+ break;
case '?':
default:
usage();
@@ -121,6 +130,7 @@ main(int argc, char *argv[])
else
args.export_info.ex_flags = 0;
args.flags = opts;
+ args.sess = sess;
if (mount(MOUNT_CD9660, dir, mntflags, &args) < 0) {
if (errno == EOPNOTSUPP)
@@ -135,6 +145,7 @@ void
usage(void)
{
(void)fprintf(stderr,
- "usage: mount_cd9660 [-egjR] [-o options] special node\n");
+ "usage: mount_cd9660 [-egjR] [-o options] [-s offset] "
+ "special node\n");
exit(1);
}