Date: Wed, 11 Jul 2001 14:20:37 -0700 (PDT) From: Paul Herman <pherman@frenchfries.net> To: <hackers@FreeBSD.ORG> Subject: [patch] error with newfs_msdos on DVD-RAM patch Message-ID: <20010711140555.K98886-100000@tick.sc.omation.com>
next in thread | raw e-mail | index | archive | help
Howdy Hackers,
I have a DVD-RAM:
cd0 at sym0 bus 0 target 4 lun 0
cd0: <MATSHITA DVD-RAM LF-D200 A120> Removable CD-ROM SCSI-4 device
cd0: 10.000MB/s transfers (10.000MHz, offset 16)
dd(1), newfs(8), mount(8) et. al. work just great on it, except
for newfs_msdos(8):
bash-2.05# newfs_msdos /dev/cd0c
/dev/cd0c: 2232334 sectors in 1116167 FAT32 clusters (4096 bytes/cluster)
bps=2048 spc=2 res=8 nft=2 mid=0xf0 spt=32 hds=64 hid=0 bsec=2236704 bspf=2181 rdcl=2 infs=1 bkbs=2
newfs_msdos: /dev/cd0c: Read-only file system
which is an out and out lie, because the medium is indeed
read-writable:
bash-2.05# dd if=/dev/zero of=/dev/cd0c bs=2k count=1
1+0 records in
1+0 records out
2048 bytes transferred in 0.002359 secs (868152 bytes/sec)
I looked to see what dd(1) was doing differently, and it seemed to
turn off disklabels in order to write to the boot sector (see
disklabel(5)). A patch against -STABLE follows, which fixes this
for me.
Would this patch be correct? I ask because dd(1) seems to go
through a few more checks (if it's a tape, etc.) If it is deemed
to be OK, could someone commit it please?
-Paul.
Index: newfs_msdos.c
===================================================================
RCS file: /home/ncvs/src/sbin/newfs_msdos/newfs_msdos.c,v
retrieving revision 1.9.2.3
diff -u -r1.9.2.3 newfs_msdos.c
--- newfs_msdos.c 2000/08/08 03:19:47 1.9.2.3
+++ newfs_msdos.c 2001/07/11 20:59:46
@@ -248,6 +248,7 @@
time_t now;
u_int fat, bss, rds, cls, dir, lsn, x, x1, x2;
int ch, fd, fd1;
+ const int one = 1;
while ((ch = getopt(argc, argv, opts)) != -1)
switch (ch) {
@@ -350,6 +351,7 @@
check_mounted(fname, sb.st_mode);
if (!S_ISCHR(sb.st_mode))
errx(1, "%s is not a character device", fname);
+ (void)ioctl(fd, DIOCWLABEL, &one);
memset(&bpb, 0, sizeof(bpb));
if (opt_f) {
getstdfmt(opt_f, &bpb);
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010711140555.K98886-100000>
