Date: Wed, 10 Jan 2001 21:42:41 +0300 From: andrew deryabin <djsf@sema.ru> To: freebsd-bugs@FreeBSD.ORG Subject: patch for /usr/src/sbin/mount_cd9660/mount_cd9660.c Message-ID: <20010110214241.A2276@technarchy.nodns>
next in thread | raw e-mail | index | archive | help
--+QahgC5+KEYLbs62 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This helps to mount CDs with extra non-ISOFS (e.g., junk-filled) sessions. get_ssector() function skips tracks without correct ISOFS signature. Similar changes in iso_get_ssector() function in /sys/isofs/cd9660/cd9660_vfsops.c would help to mount such CDs as root (but does anybody use w1nd0ze software for burning bootable FreeBSD disks? :) -- cu,djsf --+QahgC5+KEYLbs62 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="mount_cd9660.c.diff" --- mount_cd9660.c.ORiG Sat Oct 9 15:54:08 1999 +++ mount_cd9660.c Wed Jan 10 21:19:04 2001 @@ -57,6 +57,7 @@ #include <sys/param.h> #include <sys/mount.h> #include <sys/../isofs/cd9660/cd9660_mount.h> +#include <sys/../isofs/cd9660/iso.h> #include <err.h> #include <stdlib.h> @@ -194,7 +195,11 @@ struct ioc_toc_header h; struct ioc_read_toc_entry t; struct cd_toc_entry toc_buffer[100]; - int fd, ntocentries, i; + int fd, ntocentries, i, ssector, blkn; + union { + char iso_blk[ISO_DEFAULT_BLOCK_SIZE]; + struct iso_volume_descriptor vd; + } blk; if ((fd = open(dev, O_RDONLY)) == -1) return -1; @@ -218,14 +223,25 @@ close(fd); return -1; } - close(fd); for (i = ntocentries - 1; i >= 0; i--) - if ((toc_buffer[i].control & 4) != 0) - /* found a data track */ - break; - if (i < 0) - return -1; + if ((toc_buffer[i].control & 4) != 0) { + /* found a data track, checking for ISOFS signature */ + /* (stolen from /sys/isofs/cd9660/cd9660_vfsops.c) */ + ssector = ntohl(toc_buffer[i].addr.lba); + + if (lseek(fd, ISO_DEFAULT_BLOCK_SIZE * (16 + ssector), SEEK_SET) != -1) + for (blkn = 100-16; blkn; blkn--) { + if (read(fd, &blk, sizeof(blk)) == -1) + break; + if (!(bcmp(blk.vd.id, ISO_STANDARD_ID, sizeof(blk.vd.id)) && + bcmp(blk.vd.id, ISO_SIERRA_ID, sizeof(blk.vd.id)))) { + close(fd); + return ssector; + } + } + } - return ntohl(toc_buffer[i].addr.lba); + close(fd); + return -1; } --+QahgC5+KEYLbs62-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010110214241.A2276>