From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [119.145.14.65]) by dpdk.org (Postfix) with ESMTP id 9BFA17F3D for ; Wed, 29 Oct 2014 07:40:28 +0100 (CET) Received: from 172.24.2.119 (EHLO szxeml406-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CBN20448; Wed, 29 Oct 2014 14:49:16 +0800 (CST) Received: from [127.0.0.1] (10.177.19.115) by szxeml406-hub.china.huawei.com (10.82.67.93) with Microsoft SMTP Server id 14.3.158.1; Wed, 29 Oct 2014 14:49:10 +0800 Message-ID: <54508DE1.9090908@huawei.com> Date: Wed, 29 Oct 2014 14:49:05 +0800 From: Linhaifeng User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: "Qiu, Michael" , Matthew Hall References: <1414551269-5820-1-git-send-email-haifeng.lin@huawei.com> <533710CFB86FA344BFBF2D6802E60286C7CAAB@SHSMSX101.ccr.corp.intel.com> <20141029034437.GA29486@mhcomputing.net> <533710CFB86FA344BFBF2D6802E60286C7CB42@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <533710CFB86FA344BFBF2D6802E60286C7CB42@SHSMSX101.ccr.corp.intel.com> Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.19.115] X-CFilter-Loop: Reflected Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] add free hugepage function 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: Wed, 29 Oct 2014 06:40:29 -0000 On 2014/10/29 13:26, Qiu, Michael wrote: > 在 10/29/2014 11:46 AM, Matthew Hall 写道: >> On Wed, Oct 29, 2014 at 03:27:58AM +0000, Qiu, Michael wrote: >>> I just saw one return path with value '0', and no any other place >>> return a negative value, so it is better to be designed as one >>> non-return function, >>> >>> +void >>> +rte_eal_hugepage_free(void) >>> +{ >>> + struct hugepage_file *hugepg_tbl = g_hugepage_table.hugepg_tbl; >>> + unsigned i; >>> + unsigned nr_hugefiles = g_hugepage_table.nr_hugefiles; >>> + >>> + RTE_LOG(INFO, EAL, "unlink %u hugepage files\n", nr_hugefiles); >>> + >>> + for (i = 0; i < nr_hugefiles; i++) { >>> + unlink(hugepg_tbl[i].filepath); >>> + hugepg_tbl[i].orig_va = NULL; >>> + } >>> +} >>> + >>> >>> Thanks, >>> Michael >> Actually, I don't think that's quite right. >> >> http://linux.die.net/man/2/unlink >> >> "On success, zero is returned. On error, -1 is returned, and errno is set >> appropriately." So it should be returning an error, and logging a message for >> a file it cannot unlink or people will be surprised with weird failures. > > Really need one message for unlink failed, but I'm afraid that if it > make sense for return an error code when application exit. > > Thanks > Michael >> It also had some minor typos / English in the comments but we can fix that too. >> >> Matthew. >> > > > Agree.May be it is not need to return error? -- Regards, Haifeng