From owner-FreeBSD-tech-jp@jp.freebsd.org  Tue Jul 14 23:04:47 1998
Received: (from daemon@localhost)
	by jaz.jp.freebsd.org (8.8.8+3.0Wbeta13/8.7.3) id XAA14938;
	Tue, 14 Jul 1998 23:04:47 +0900 (JST)
	(envelope-from owner-FreeBSD-tech-jp@jp.FreeBSD.org)
Received: from shidahara1.planet.kobe-u.ac.jp (root@shidahara1.planet.kobe-u.ac.jp [133.30.50.200])
	by jaz.jp.freebsd.org (8.8.8+3.0Wbeta13/8.7.3) with ESMTP id XAA14933
	for <FreeBSD-tech-jp@jp.freebsd.org>; Tue, 14 Jul 1998 23:04:45 +0900 (JST)
	(envelope-from takawata@shidahara1.planet.kobe-u.ac.jp)
Received: from shidahara1.planet.kobe-u.ac.jp (localhost [127.0.0.1])
	by shidahara1.planet.kobe-u.ac.jp (8.8.8+2.7Wbeta7/8.8.8) with ESMTP id WAA14679
	for <FreeBSD-tech-jp@jp.freebsd.org>; Tue, 14 Jul 1998 22:57:42 +0900 (JST)
Message-Id: <199807141357.WAA14679@shidahara1.planet.kobe-u.ac.jp>
To: FreeBSD-tech-jp@jp.freebsd.org
In-reply-to: Your message of "Mon, 13 Jul 1998 19:12:16 JST"
References: <9807131012.AA02376@kmegate.kme.mei.co.jp> 
Date: Tue, 14 Jul 1998 22:57:41 +0900
From: Takanori Watanabe <takawata@shidahara1.planet.kobe-u.ac.jp>
Reply-To: FreeBSD-tech-jp@jp.freebsd.org
Precedence: bulk
X-Distribute: distribute [version 2.1 (Alpha) patchlevel=24e+ JFUG special]
X-Sequence: FreeBSD-tech-jp 1637
Subject: [FreeBSD-tech-jp 1637] Re: ATAPI MO (Re: What is difference between
	 Direct-Access and Optical?) 
Errors-To: owner-FreeBSD-tech-jp@jp.freebsd.org
Sender: owner-FreeBSD-tech-jp@jp.freebsd.org

In message <9807131012.AA02376@kmegate.kme.mei.co.jp>, Shunsuke Akiyama $B$5$s$$$o(B
$B$/(B:
>> $BG0$N$?$a$G$9$,!"(B3.0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9 1998/03/20 23:14:52 msmith Exp $
$B$KBP$9$k%Q%C%A$r$D$1$F$*$-$^$9!#0lIt:G?7HG$N(Bwfd$B%I%i%$%P$GD>$C$F$kItJ,$b(B
$B$"$j$^$9$,!#(B

$BEOJUB:5*(B
$B?@8MBg3XBg3X1!<+A32J3X8&5f2J(BD1$B>pJs%a%G%#%"2J3X@l96(B
<a href="http://www.planet.kobe-u.ac.jp/~takawata/key.html">
Public Key</a>
Key fingerprint =  2C 51 E2 78 2C E1 C5 2D  0F F1 20 A3 11 3A 62 2A 



--- wfd.c	Tue Jul 14 19:34:27 1998
+++ wfd.c.org	Tue Jul 14 09:54:09 1998
@@ -116,13 +116,7 @@
     u_short         rpm;                    /* Rotations per minute */
     u_char          reserved30[2];
 };
-#if 1
-/*READ_CAPACITY structure*/
-struct capacity{
-  u_char disksize[4];
-  u_char sectorsize[4];
-};
-#endif
+
 /* misuse a flag to identify format operation */
 #define B_FORMAT B_XXX
 
@@ -270,6 +264,7 @@
 void wfd_describe (struct wfd *t)
 {
 	int no_print = 0;
+
 	t->cap.cyls = ntohs (t->cap.cyls);
 	t->cap.sector_size = ntohs (t->cap.sector_size);
 
@@ -334,7 +329,6 @@
 int wfdbopen (dev_t dev, int flags, int fmt, struct proc *p)
 {
 	int lun = UNIT(dev);
-	long secperu=0;
 	struct wfd *t;
 	struct atapires result;
 	int errcode = 0;
@@ -363,25 +357,7 @@
 		t->cap.cyls = ntohs (t->cap.cyls);
 		t->cap.sector_size = ntohs (t->cap.sector_size);
 	}
-#if 1
-	{
-	  static struct capacity capa;
-	  /*TRY TO READ CAPACITY*/
-	  result=atapi_request_wait(t->ata,t->unit,ATAPI_READ_CAPACITY
-				    ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-				    (char *)&capa,sizeof(capa));
-	  if(result.code)
-	    printf("wfd%d:Read capacity is failed.\n",t->lun);
-	  else{
-	    secperu=capa.disksize[0]<<24;
-	    secperu+=capa.disksize[1]<<16;
-	    secperu+=capa.disksize[2]<<8;
-	    secperu+=capa.disksize[3];
-	    secperu++;
-	    printf("wfd%d:Capacity=%ld\n",t->lun,secperu);
-	  }
-	}
-#endif
+
 	/* Build label for whole disk. */
 	bzero(&label, sizeof label);
 	label.d_secsize = t->cap.sector_size;
@@ -390,28 +366,16 @@
 	label.d_ncylinders = t->cap.cyls;
 	label.d_secpercyl = t->cap.heads * t->cap.sectors;
 	label.d_rpm = 720;
-#if 0
 	label.d_secperunit = label.d_secpercyl * t->cap.cyls;
-#else
-	label.d_secperunit= secperu;
-#endif
+
 	/* Initialize slice tables. */
 	errcode = dsopen("wfd", dev, fmt, &t->dk_slices, &label, wfdstrategy1,
 			 (ds_setgeom_t *)NULL, &wfd_bdevsw, &wfd_cdevsw);
 	if (errcode != 0)
-		goto bad;
+		return errcode;
 
 	t->flags |= F_BOPEN;
 	return (0);
-      bad:
-/*If I fail to open,Unlock this device */
-	if(!dsisopen(t->dk_slices)) {
-		/* If we were the last open of the entire device, release it. */
-	  wfd_request_wait (t, ATAPI_PREVENT_ALLOW,
-			    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
-	  t->flags &= ~F_BOPEN;
-	}
-	return errcode;
 }
 
 /*







