From owner-freebsd-hackers@FreeBSD.ORG Sun Aug 3 16:11:41 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B5E0A37B401 for ; Sun, 3 Aug 2003 16:11:41 -0700 (PDT) Received: from smtp7.andrew.cmu.edu (SMTP7.andrew.cmu.edu [128.2.10.87]) by mx1.FreeBSD.org (Postfix) with ESMTP id F009243F93 for ; Sun, 3 Aug 2003 16:11:40 -0700 (PDT) (envelope-from eno@andrew.cmu.edu) Received: from andrew.cmu.edu (BLISS.PDL.CMU.EDU [128.2.134.47]) (user=eno mech=PLAIN (0 bits))h73NBcDf020890 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT) for ; Sun, 3 Aug 2003 19:11:39 -0400 Message-ID: <3F2D96AB.9000607@andrew.cmu.edu> Date: Sun, 03 Aug 2003 19:11:39 -0400 From: Eno Thereska User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529 X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd hackers References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: getting from bio to buf in dastrategy() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Aug 2003 23:11:42 -0000 Hi all, I am hacking into the FreeBSD 5.0 code. I jumped from using 4.4 to 5.0 and a couple of things have changed. Here is my question: in /sys/cam/scsi/scsi_da.c the dastrategy() function takes as an argument "struct bio* bp" Now I need to get to the "struct *buf" that bp belongs to. In /sys/sys/buf.h I see that struct buf has as the first member "b_io" which is of type struct bio. I also see the BIOTOBUF #define which is supposed to take a bio and return the buf it belongs to. Now in dastrategy() if I use the BIOTOBUF function and try to access members of the struct buf I get junk, which means that the bio passed to the is not directly related to a buf. Am I missing something here? How do I know to which buf (if any) the bio belongs to? Also it seems to me that the new way of splitting the old struct buf into a struct bio and having a bunch of #defines inside the struct buf is kind of hacky. What was the rationale behind doing that (rather than just leaving it the way it was in 4.4)? Thanks Eno