Date: Sun, 03 Aug 2003 19:11:39 -0400 From: Eno Thereska <eno@andrew.cmu.edu> To: freebsd hackers <freebsd-hackers@freebsd.org> Subject: getting from bio to buf in dastrategy() Message-ID: <3F2D96AB.9000607@andrew.cmu.edu> References: <Pine.NEB.3.96L.1030803121148.97224B-100000@fledge.watson.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F2D96AB.9000607>