From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ustc.edu.cn (smtp2.ustc.edu.cn [202.38.64.46]) by dpdk.org (Postfix) with ESMTP id 09D768DAE for ; Thu, 15 Oct 2015 03:41:06 +0200 (CEST) Received: from dell (unknown [222.195.92.204]) by newmailweb.ustc.edu.cn (Coremail) with SMTP id LkAmygAnCMEjBB9W4TO2AQ--.37947S2; Thu, 15 Oct 2015 09:41:03 +0800 (CST) Date: Thu, 15 Oct 2015 09:40:43 +0800 From: Tiwei Bie To: Don Provan Message-ID: <20151015014043.GA55827@dell> References: <1444726446-8106-1-git-send-email-btw@mail.ustc.edu.cn> <1444726446-8106-2-git-send-email-btw@mail.ustc.edu.cn> <20151014022843.GA26774@dell> <20151014093128.GC32308@bricha3-MOBL3> <20151014101933.GB68200@dell> <20151014112813.GA1514@dell> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-CM-TRANSID: LkAmygAnCMEjBB9W4TO2AQ--.37947S2 X-Coremail-Antispam: 1UD129KBjvJXoW7KF1kXF1DWw13uFW7ur17ZFb_yoW8tr4Dpa yaqFnFvFn7GF4akrnFyw45Z3WFkFs7Ca47JFykG3s5AFnIkF48tr1ftr4j9F4rGrW3Kr10 vr4aqayjva1DZaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUk0b7Iv0xC_tr1lb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26F4UJVW0owA2z4x0Y4 vEx4A2jsIEc7CjxVAFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xv F2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r 4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvEwIxGrwCY02Avz4vE14v_KwCF04k20xvY 0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I 0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jrv_JF1lIxkGc2Ij64vIr41lIxAI cVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcV CF04k26cxKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280 aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjxUc6wZUUUUU X-CM-SenderInfo: xewzqzxdloh3xvwfhvlgxou0/1tbiAQcDAVQhmEhlYAABsl Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] eal/bsd: reinitialize optind and optreset to 1 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: Thu, 15 Oct 2015 01:41:08 -0000 Hi Don! I'm truly sorry for my misunderstanding. :-( Thank you so much for your detailed comments! I will update my patch! Thanks again! Best wishes, Tiwei Bie On Wed, Oct 14, 2015 at 05:54:14PM +0000, Don Provan wrote: > > > On Wed, Oct 14, 2015 at 10:28:44AM +0800, Tiwei Bie wrote: > > > > It is designed to have DPDK's parameters specified in the front of the > > > > cmd line and terminated by '--'. > > In other words, it is designed assuming the DPDK library can dictate > the application's command line. This is an incorrect assumption > that should be eliminated. > > I don't think I'm the only one that has figured out that layering a > service on top of DPDK requires creating a fake argc/argv array. > The original plan of having rte_eal_init() parse the actual application > command line organized as dictated by DPDK is not reasonable. > > > > > And 1 or 0 are not some > > > > arbitrary values. They are used to put the index back to the beginning > > > > of the new argv[] array. > > They're arbitrary values from the point of view of the calling > application. If the caller is using getopt() for its own purposes, > it has every reason to expect optind to have the same value > after the call to rte_eal_init() that it had before, not some > other value that the DPDK library happened to think was > useful. > > > > > We shouldn't mix up DPDK's parameters and application's parameters. > > > > And we should group them using '--'. > > Exactly! Yet we do confuse the two by using getopt() without considering > that the application's parameters might not be in the argc/argv list that's > passed to rte_eal_init(). > > > I'm considering updating optind to make it point to the option after > > '--' before eal_parse_args() returns, and eal_parse_args() will return > > 0 to avoid breaking the current applications which use the return value > > of rte_eal_init() to update argc/argv. > > > > Any comments? Thanks! :-) > > Don't do it. Last time I looked, optind wasn't even mentioned in the > documentation. Even if I thought it was reasonable to change it, > I would still argue against using it as an undocumented return > value, particularly when the documented return value works fine. > > -don provan > dprovan@bivio.net