From owner-freebsd-net@FreeBSD.ORG Tue Mar 30 00:58:27 2010 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA366106568A for ; Tue, 30 Mar 2010 00:58:27 +0000 (UTC) (envelope-from jiani1012@126.com) Received: from m15-64.126.com (m15-64.126.com [220.181.15.64]) by mx1.freebsd.org (Postfix) with ESMTP id B82998FC1B for ; Tue, 30 Mar 2010 00:58:26 +0000 (UTC) Received: from jiani1012 ( [124.205.28.146] ) by ajax-webmail-wmsvr64 (Coremail) ; Tue, 30 Mar 2010 08:58:21 +0800 (CST) Date: Tue, 30 Mar 2010 08:58:21 +0800 (CST) From: jiani1012 To: freebsd-net Message-ID: MIME-Version: 1.0 X-Originating-IP: [124.205.28.146] X-Priority: 3 X-Mailer: Coremail Webmail Server Version SP_ntes V3.5 build 100224(9901.2908.2907) Copyright (c) 2002-2010 www.mailtech.cn 126com X-CM-CTRLDATA: C1WG4mZvb3Rlcl9odG09MTEzMDo0NA== X-CM-TRANSID: QMqowLCbSgGtTLFLU0sDAA--.2223W X-CM-SenderInfo: xmld0xarqrjqqrswhudrp/1tbivAijlEgYtsM2KAABs5 X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: space of ath_node X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2010 00:58:27 -0000 Hi,all A problem puzzled me in ath code. The following code in function ath_node_alloc( ) shows the space allocated to an, >struct ath_ratectrl { >size_t arc_space; /* space required for per-node state */ >}; >const size_t space = sizeof(struct ath_node) + sc->sc_rc->arc_space; >struct ath_node *an; >an = malloc(space, M_80211_NODE, M_NOWAIT|M_ZERO); but in the two lines below ,what is (an)[1]? Where is the initialization of (an)[1]? What does it contain? Can you show me? and how to get the content of sn? >struct sample_node *sn = ATH_NODE_SAMPLE(an); /*in sample.c*/ >#define ATH_NODE_SAMPLE(an) ((struct sample_node *)&(an)[1]) /*in sample.h*/ Otherwise, the struct ath_ratectrl has been used in structures ath_softc, sample_softc and so on. Is there any relations between them? Thank you! Jeny