Received: | from smtp1.google.com (smtp1.google.com [216.239.33.27]) |
by aueb.gr (8.8.5/8.8.5) with ESMTP id UAA06394 | |
for <dds@aueb.gr>; Tue, 12 Mar 2002 20:20:46 +0200 (EET) | |
Received: | from sjins1.sj.google.com ([216.239.35.4]) |
by smtp1.google.com with ESMTP id KAA09604 | |
for <dds@aueb.gr>; Tue, 12 Mar 2002 10:20:47 -0800 | |
Received: | from sjdd43.sj.google.com (sjdd43.prod.google.com [10.6.30.43]) |
by sjins1.sj.google.com (8.9.3/8.9.3) with ESMTP id KAA00981 | |
for <dds@aueb.gr>; Tue, 12 Mar 2002 10:20:42 -0800 | |
Received: | (from root@localhost) |
by sjdd43.sj.google.com (8.9.3/8.9.3) id KAA09166; | |
Tue, 12 Mar 2002 10:20:42 -0800 | |
From: | posting-system@google.com |
Date: | Tue, 12 Mar 2002 10:20:42 -0800 |
Message-ID: | <1af18db.0203121020.270a07c1@posting.google.com> |
Reply-To: | posting-system@google.com |
To: | dds@aueb.gr |
Subject: | Calling device-driver strategy routines |
Errors-To: | posting-system@google.com |
Mime-Version: | 1.0 |
Content-Transfer-Encoding: | 7bit |
Content-Type: | text/plain; charset=ISO-8859-1 |
From: | dds@aueb.gr (Diomidis Spinellis) |
Newsgroups: | mailing.netbsd.tech.kern,comp.unix.bsd.misc,comp.unix.bsd.netbsd.misc |
Subject: | Calling device-driver strategy routines |
NNTP-Posting-Host: | 195.251.255.250 |
Message-ID: | <1af18db.0203121020.7d38fa1b@posting.google.com> |
Greetings, I am trying to understand how block device read/write calls communicate with the respective device driver strategy routines. After a day of digging in both directions and in Bach and Leffler I fail to find the common link; perhaps a kind soul will enlighten me. Tracing the call sequence from top to bottom for an ext2fs file I end-up with a call to ufs_strategy with vp pointing to the original vnode which will result in a series of further recursive calls to ufs_strategy. The sequence (in NetBSD 1.5) as I understand it is: sys_generic.c:sys_write(...) vfs_vnops:vn_write(...) vnode_if.c:VOP_WRITE(vp, uio, ioflag, cred) { a.a_vp = vp; return (VCALL(vp, VOFFSET(vop_write), &a)); ext2fs_readwrite.c:ext2fs_write(v) { *ap = v; vp = ap->a_vp; ip = VTOI(vp) bp can be allocated by ext2fs_balloc(ip, ...) vp = ITOV(ip) which calls getblk(vp, ...) which using bgetvp(vp, bp) sets bp->b_vp = vp; vfs_bio.c:bwrite(bp) { VOP_STRATEGY(bp); vnode_if.h:VOP_STRATEGY(bp) { a.a_bp = bp; return (VCALL(bp->b_vp, VOFFSET(vop_strategy), &a)); #define VCALL(VP,OFF,AP) VOCALL((VP)->v_op,(OFF),(AP)) #define VOCALL(OPSV,OFF,AP) (( *((OPSV)[(OFF)])) (AP)) ext2fs_vnops.c: { &vop_strategy_desc, ufs_strategy }, ufs_vnops.c:ufs_strategy(v) *ap = v; register struct buf *bp = ap->a_bp; register struct vnode *vp = bp->b_vp; VOCALL (vp->v_op, VOFFSET(vop_strategy), ap); I then tried to go in the opposite direction. The e.g. SCSI strategy routine is stored as a pointer in a dk_driver structure field. I grepped through the kernel source looking for it but could not find the point where this pointer is called or assigned to another variable. I am completely puzzled and will appreciate any help or just a pointer to where I should look. Thanks, Diomidis - http://www.spinellis.gr