From owner-freebsd-hackers Wed Jul 11 16:12:52 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from iatl0x01.coxmail.com (iatl0x02.coxmail.com [206.157.225.11]) by hub.freebsd.org (Postfix) with ESMTP id 2B38437B403 for ; Wed, 11 Jul 2001 16:12:45 -0700 (PDT) (envelope-from pherman@frenchfries.net) Received: from tick.sc.omation.com ([64.58.167.31]) by iatl0x01.coxmail.com (InterMail vK.4.03.02.00 201-232-124 license 85f4f10023be2bd3bce00b3a38363ea2) with ESMTP id <20010711231239.GQVS949.iatl0x01@tick.sc.omation.com> for ; Wed, 11 Jul 2001 19:12:39 -0400 Received: from tick.sc.omation.com (tick.sc.omation.com [10.0.0.253]) by tick.sc.omation.com (8.11.3/8.11.3) with ESMTP id f6BLKbN05320 for ; Wed, 11 Jul 2001 14:20:38 -0700 (PDT) (envelope-from pherman@frenchfries.net) Date: Wed, 11 Jul 2001 14:20:37 -0700 (PDT) From: Paul Herman To: Subject: [patch] error with newfs_msdos on DVD-RAM patch Message-ID: <20010711140555.K98886-100000@tick.sc.omation.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Howdy Hackers, I have a DVD-RAM: cd0 at sym0 bus 0 target 4 lun 0 cd0: 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