Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 May 2000 20:40:27 -0700
From:      "David O'Brien" <obrien@freebsd.org>
To:        alpha@freebsd.org
Subject:   (FWD) `dd' patch pertaining to Alpha
Message-ID:  <20000502204027.A94062@dragon.nuxi.com>

next in thread | raw e-mail | index | archive | help
I sent Matt's patch to Brian (maintainer for `dd') and he reworked it
into this.  Can people comment if this fixes their `dd' problems, etc..

----- Forwarded message from Brian Fundakowski Feldman <green@FreeBSD.org> -----
--- dd.c	1999/10/03 18:49:51	1.27
+++ dd.c	2000/05/02 05:13:21
@@ -54,2 +54,3 @@
 #include <sys/conf.h>
+#include <sys/disklabel.h>
 #include <sys/filio.h>
@@ -220,4 +221,10 @@
 				io->flags |= ISTAPE;
-			else if (type & (D_DISK | D_MEM))
+			else if (type & (D_DISK | D_MEM)) {
+				if (type & D_DISK) {
+					const int one = 1;
+
+					(void)ioctl(io->fd, DIOCWLABEL, &one);
+				}
 				io->flags |= ISSEEK;
+			}
 			if (S_ISCHR(sb.st_mode) && (type & D_TAPE) == 0)

If the disk supports DIOCWLABEL or not, we have no way of knowing, so it
makes no sense to check the error return.  The error return may be EBADF
for trying to set DIOCWLABEL on a non-FWRITE file descriptor, or it may
be ENODEV for a device which doesn't support it, or it could be a valid
error.  In any case, DIOCWLABEL will make it not fail for da(4) devices,
and the error return DIOCWLABEL won't matter in the end.

How does that work for you?  I don't have da(4) disks...

Now to try to figure out what the difference between EPERM and EACCES is...
These things are so annoying.

--
 Brian Fundakowski Feldman           \  FreeBSD: The Power to Serve!  /
 green@FreeBSD.org                    `------------------------------'

----- End forwarded message -----


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000502204027.A94062>