From owner-freebsd-drivers@FreeBSD.ORG Sat Feb 17 10:08:34 2007 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6956A16A409 for ; Sat, 17 Feb 2007 10:08:34 +0000 (UTC) (envelope-from abraham_aji@yahoo.co.in) Received: from web8315.mail.in.yahoo.com (web8315.mail.in.yahoo.com [202.43.219.9]) by mx1.freebsd.org (Postfix) with SMTP id F086113C428 for ; Sat, 17 Feb 2007 10:08:32 +0000 (UTC) (envelope-from abraham_aji@yahoo.co.in) Received: (qmail 28352 invoked by uid 60001); 17 Feb 2007 09:41:46 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=D1LBOqL64waUuOb2QfpmR/dNLDprISQruGRM0UerkCMQtvXql0AnHlqVSV7B98jZbGBUBaCAEPl2MSTTVIQJdfnuwAOQsBknKa6JeVI8+5bgeTnYSJq6B3tQ+/xheLfaLK3xYHwOfvJOGJx3XRbgld4lQS8SOcohHbfLpFxzjmU=; X-YMail-OSG: h4VGoCEVM1m7l.EWy_h_tDkdCbTgtuxIE9PaktRjecrLxMD2fvOK6crc8URK1bX5gOExpdU0Bn5vcC9uSEWmozBsEbRBuW4Jr6Ji4CwWO8Bg470xltWeEKtzHO9rABck3C.nMFw541f12x6Yj243RtUQIA-- Received: from [122.167.57.52] by web8315.mail.in.yahoo.com via HTTP; Sat, 17 Feb 2007 09:41:46 GMT Date: Sat, 17 Feb 2007 09:41:46 +0000 (GMT) From: aji abraham To: freebsd-drivers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <150997.27592.qm@web8315.mail.in.yahoo.com> Subject: Doudts in "softc" and "device_get_softc(dev)" X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Feb 2007 10:08:34 -0000 hi My name is Aji Abraham, now working with device drivers. the word "softc" and the function "device_get_softc(dev)" getting confuse me a lot. am listing some query below .. pls help me .. Q1 In a free BSD driver Code, there are two device depended structures struct xx_softc { ....... ...... }; struct xx_if_softc { ....... ...... }; sizeof(struct xx_softc ) is 68 sizeof(struct xx_if_softc ) is 1186 And in device attach function xx_attach(dev){ struct xx_softc *sc; struct xx_if_softc *if_sc; sc_if = device_get_softc(dev); sc = device_get_softc(device_get_parent(dev)); sc_if-> ..... sc-> .... ....... ...... } Both allocation uses the same function. How it possible ? can we access all structure member ? Regards Aji Abraham __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/