From owner-freebsd-questions@FreeBSD.ORG Sat Feb 17 10:14:15 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5851C16A402 for ; Sat, 17 Feb 2007 10:14:15 +0000 (UTC) (envelope-from abraham_aji@yahoo.co.in) Received: from web8325.mail.in.yahoo.com (web8325.mail.in.yahoo.com [202.43.219.176]) by mx1.freebsd.org (Postfix) with SMTP id 6646B13C48D for ; Sat, 17 Feb 2007 10:14:14 +0000 (UTC) (envelope-from abraham_aji@yahoo.co.in) Received: (qmail 153 invoked by uid 60001); 17 Feb 2007 09:47:29 -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=OFggjtcbqGkpaVPDfBOwNnLV4MraWh9S4wSfKut/xUKdZXMg4CbFUDWcnVqNZTljhinsDrRDiz1dspr328UFWhgyjOk07xPuvfj+Z/8eK/WCIcM37fSzw6+KrdU9vvBj75cVwFNYG4jJMDuNwh99sMAW880uxJqOlN72V7NUPPw=; X-YMail-OSG: pM805KYVM1lJmLxDEKRxiH9YkbuNehufUhu7K0R4yZhC5NRGA3qxAy.uetrFXh0AsTjjQGIRLfrmNFAUubmau.JmSprAgvKeM9EfizXvP6hqqXjzlT9tqR5kYTcne9n.ILfb.hLH2pbj8G8OuFhSAlS3_g-- Received: from [122.167.57.52] by web8325.mail.in.yahoo.com via HTTP; Sat, 17 Feb 2007 09:47:29 GMT Date: Sat, 17 Feb 2007 09:47:29 +0000 (GMT) From: aji abraham To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <152353.99611.qm@web8325.mail.in.yahoo.com> Subject: Doubts in "softc" and "device_get_softc(dev)" X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Feb 2007 10:14:15 -0000 --- aji abraham wrote: 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/