From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by dpdk.org (Postfix) with ESMTP id 0F7F369FF for ; Fri, 6 May 2016 16:01:10 +0200 (CEST) Received: by mail-wm0-f51.google.com with SMTP id a17so79664152wme.0 for ; Fri, 06 May 2016 07:01:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=Ew2Dn9tuXi+zV9zkds6gypSOfOYC/RcCxpUaupzrvTw=; b=UItiK5XCcCnNB/tOgqS5SDs4Lu7UqlmEYVhQmJpFKsE7E9fBql0OFn0SG2NzJIEUMZ owixufd+ejN/yYngYxP26oW1xX5uk9toL3fH8PexWl/8mb0jrGW9gbKywO2q/gIxEu3e 2TVbF5LBU/ZnyrIvWD8Jku+Xk18Q3RQ3PWTVVWhLm78RYETHRLp/aWvDDCbhyXltvgNY t/XgBWF7Ie6EByxPBUr0XjUKMFpiUGG/O8SH78AD3/hO0rI79ZlcYv+/1zU4MvNBsbSP XwvsvvUFr86VrMf48dA+xvtwZKeFVFZQUI3RHds/y6LfSKYrkSxfRJafxUrWeu3C63W2 +CKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding; bh=Ew2Dn9tuXi+zV9zkds6gypSOfOYC/RcCxpUaupzrvTw=; b=auQjb7pwdlv1hU1szw0BP3zwqpK7zsOouRjRf1IHHnC4cnUKRMh6JwkwvMYpVN0cs0 42z04A7fP4/nK+2nd38dhSEoMC3oZzCMf/37c0SM7IOFDdCz8FbriEf/5HBYt7fZ5qpA KO442XVc47JcgehfgN3KIijh9IaeccV8EjpFctjw1WgteKM4EAZXSkYraiaLmDkKn32r 8+mabvpYGrNZlrGfGcWTM1oMtd/XD0/qmx5TFbfS/TH44mcraQb2Wn9HgvAbvMgMxlyE t7KnGTQ+g2ca0ruWqOtOA8u5Q05cJ9sF9jmg85DTk8+Z+jYnp40FBg0y27fNfbkl7SDd O/5A== X-Gm-Message-State: AOPr4FW7TL4DuVQh9BqWAeTyWji+gIASGwYOZe1Cx5n1jXy0o+EQ/SzB0o4suEYoAHkpBeWR X-Received: by 10.28.212.71 with SMTP id l68mr9916131wmg.22.1462543269846; Fri, 06 May 2016 07:01:09 -0700 (PDT) Received: from xps13.localnet (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id cf6sm15139871wjc.12.2016.05.06.07.01.08 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 06 May 2016 07:01:09 -0700 (PDT) From: Thomas Monjalon To: Jan Viktorin Cc: dev@dpdk.org, Bruce Richardson , David Marchand Date: Fri, 06 May 2016 16:01:08 +0200 Message-ID: <7154696.NNSjZHJaDi@xps13> Organization: 6WIND User-Agent: KMail/4.14.10 (Linux/4.1.6-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <1462531720-26217-2-git-send-email-viktorin@rehivetech.com> References: <1462531720-26217-1-git-send-email-viktorin@rehivetech.com> <1462531720-26217-2-git-send-email-viktorin@rehivetech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v1 01/10] app/test: introduce resources for tests X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2016 14:01:10 -0000 2016-05-06 12:48, Jan Viktorin: > --- /dev/null > +++ b/app/test/resource.h > @@ -0,0 +1,61 @@ > +/*- > + * BSD LICENSE [...] > + */ Please include a multi-line comment here to explain what is a resource and why it is needed. > + > +#ifndef _RESOURCE_H_ > +#define _RESOURCE_H_ > + |...] |> + > +TAILQ_HEAD(resource_list, resource); > +extern struct resource_list resource_list; Why extern? > + > +struct resource { > + const char *name; > + const char *beg; begin? Bruce is removing some megabytes from lpm tests, so we have some room for field names ;) > + const char *end; > + TAILQ_ENTRY(resource) next; > +}; > + > +static inline size_t resource_size(const struct resource *r) Why inline? It could be in .c > +{ > + return r->end - r->beg; > +} > + > +const struct resource *resource_find(const char *name); > + > +void __resource_register(struct resource *r); A comment is needed to explain the role of this function. Why a double underscore? > +#define REGISTER_RESOURCE(_n, _b, _e) \ I'm not a big fan of the underscores. > +static struct resource linkres_ ##_n = { \ > + .name = RTE_STR(_n), \ > + .beg = _b, \ > + .end = _e, \ > +}; \ > +__REGISTER_RESOURCE(linkres_ ##_n) Please avoid nested macros. > +#define __REGISTER_RESOURCE(name) \ > +static void __attribute__((constructor,used)) resinitfn_ ##name(void); \ Why declaring the function just before its implementation? > +static void __attribute__((constructor,used)) resinitfn_ ##name(void) \ > +{ \ > + __resource_register(&name); \ > +}