[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Multi Session CD Patch
- To: tech_(_at_)_openbsd_(_dot_)_org
- Subject: Multi Session CD Patch
- From: Brandon Mercer <nomercy_(_at_)_eutonian_(_dot_)_com>
- Date: Tue, 04 Apr 2006 14:05:24 -0400
Hello,
I've been working on getting multisession CD support to work in a
somewhat usable fashion. What I've come up with is to add a flag to
mount_cd9660 to allow the user to specify the address of the session
they'd like to mount. This can be found by using cdrecord -toc or some
other method. By default it mounts the last session on the disk. If
the incorrect session is given it gives the user an error. I have
tested this only on i386, but it should work well in other archs.
My plan was also to set up a userland tool to display the track # and
allow the user to put that into mount rather than the address. Let me
know what you think of that idea. It seemed a bit like a cludge to do
that in mount_cd9660... I'm open to ideas. Thanks,
Brandon Mercer
Index: src/sys/sys/mount.h
===================================================================
RCS file: /cvs/src/sys/sys/mount.h,v
retrieving revision 1.68
diff -u -r1.68 mount.h
--- src/sys/sys/mount.h 31 Mar 2006 13:05:23 -0000 1.68
+++ src/sys/sys/mount.h 4 Apr 2006 17:33:41 -0000
@@ -94,11 +94,13 @@
char *fspec; /* block special device to mount */
struct export_args export_info;/* network export info */
int flags; /* mounting flags, see below */
+ u_int32_t sessaddr; /* address of session to mount */
};
#define ISOFSMNT_NORRIP 0x00000001 /* disable Rock Ridge Ext.*/
#define ISOFSMNT_GENS 0x00000002 /* enable generation
numbers */
#define ISOFSMNT_EXTATT 0x00000004 /* enable extended
attributes */
#define ISOFSMNT_NOJOLIET 0x00000008 /* disable Joliet Ext.*/
+#define ISOFSMNT_USESESS 0x00000010 /* enable session address */
/*
* Arguments to mount NFS
# cvs diff -u src/sys/isofs/cd9660/cd9660_vfsops.c
Index: src/sys/isofs/cd9660/cd9660_vfsops.c
===================================================================
RCS file: /cvs/src/sys/isofs/cd9660/cd9660_vfsops.c,v
retrieving revision 1.38
diff -u -r1.38 cd9660_vfsops.c
--- src/sys/isofs/cd9660/cd9660_vfsops.c 22 Jan 2006 00:40:02
-0000 1.38
+++ src/sys/isofs/cd9660/cd9660_vfsops.c 4 Apr 2006 17:34:58 -0000
@@ -265,9 +265,16 @@
*/
iso_bsize = ISO_DEFAULT_BLOCK_SIZE;
- error = VOP_IOCTL(devvp, CDIOREADMSADDR, (caddr_t)&sess, 0,
FSCRED, p);
- if (error)
+ /* check to see if the user sent a session address */
+ if (argp->flags & ISOFSMNT_USESESS) {
+ sess = argp->sessaddr;
+ } else {
+ error = VOP_IOCTL(devvp, CDIOREADMSADDR, (caddr_t)&sess, 0,
FSCRED, p);
+ if (error)
sess = 0;
+
+ }
+
joliet_level = 0;
for (iso_blknum = 16; iso_blknum < 100; iso_blknum++) {
# cvs diff -u src/sbin/mount_cd9660/mount_cd9660.c
Index: src/sbin/mount_cd9660/mount_cd9660.c
===================================================================
RCS file: /cvs/src/sbin/mount_cd9660/mount_cd9660.c,v
retrieving revision 1.17
diff -u -r1.17 mount_cd9660.c
--- src/sbin/mount_cd9660/mount_cd9660.c 8 Apr 2005 20:09:36
-0000 1.17
+++ src/sbin/mount_cd9660/mount_cd9660.c 4 Apr 2006 17:35:44 -0000
@@ -76,9 +77,10 @@
struct iso_args args;
int ch, mntflags, opts;
char *dev, dir[MAXPATHLEN];
+ const char *errstr;
mntflags = opts = 0;
- while ((ch = getopt(argc, argv, "egjo:R")) != -1)
+ while ((ch = getopt(argc, argv, "egjo:s:R")) != -1)
switch (ch) {
case 'e':
opts |= ISOFSMNT_EXTATT;
@@ -92,6 +94,12 @@
case 'o':
getmntopts(optarg, mopts, &mntflags);
break;
+ case 's':
+ opts |= ISOFSMNT_USESESS;
+ args.sessaddr = strtonum(optarg, 0, UINT_MAX,
&errstr);
+ if (errstr)
+ errx(1, "address %s: %s", errstr, optarg);
+ break;
case 'R':
opts |= ISOFSMNT_NORRIP;
break;
@@ -135,6 +143,6 @@
usage(void)
{
(void)fprintf(stderr,
- "usage: mount_cd9660 [-egjR] [-o options] special node\n");
+ "usage: mount_cd9660 [-egjR] [-o options] [-s
sessionaddr] special node\n");
exit(1);
}
Visit your host, monkey.org