From owner-freebsd-questions@FreeBSD.ORG Sat Feb 17 09:29:17 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 B9C4416A408; Sat, 17 Feb 2007 09:29:17 +0000 (UTC) (envelope-from aji@katuns.org) Received: from host06.mywebns.com (host06.mywebns.com [69.65.107.207]) by mx1.freebsd.org (Postfix) with ESMTP id 8F2FE13C442; Sat, 17 Feb 2007 09:29:17 +0000 (UTC) (envelope-from aji@katuns.org) Received: from katunsor by host06.mywebns.com with local (Exim 4.63) (envelope-from ) id 1HIKyX-0003aL-Bw; Sat, 17 Feb 2007 08:31:21 +0000 Received: from 122.167.57.52 ([122.167.57.52]) (SquirrelMail authenticated user aji@katuns.org) by katuns.org with HTTP; Sat, 17 Feb 2007 08:31:21 -0000 (GMT) Message-ID: <41759.122.167.57.52.1171701081.squirrel@katuns.org> Date: Sat, 17 Feb 2007 08:31:21 -0000 (GMT) From: aji@katuns.org To: freebsd-questions@FreeBSD.org User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Sender: X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host06.mywebns.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [32051 500] / [47 12] X-AntiAbuse: Sender Address Domain - katuns.org X-Source: X-Source-Args: X-Source-Dir: X-Mailman-Approved-At: Sat, 17 Feb 2007 16:24:13 +0000 Cc: freebsd-doc@FreeBSD.org Subject: 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 09:29:17 -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