From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2A210A0563; Mon, 23 Mar 2020 10:26:55 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E98831C036; Mon, 23 Mar 2020 10:26:54 +0100 (CET) Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by dpdk.org (Postfix) with ESMTP id 7E25C1C029 for ; Mon, 23 Mar 2020 10:26:53 +0100 (CET) Received: by mail-io1-f67.google.com with SMTP id c19so13359757ioo.6 for ; Mon, 23 Mar 2020 02:26:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=akLTEsXRHyQLCjo/u9MMH84igbVEHYXZFj7pQ88yU8Q=; b=OcsPRU7WFXLgclX7CnIHJnkyiu+KgAECWt2XRG+zAyuNfW8bb6C2xTZD8mjczBf1Nb GQCD73aJME6ChsFW9KcYptixkEMZI3echdgy1dCrlXF/D9xbip5jGlik2+9CWTNAq8qC d+wxBCwsdkGxNCdvK3sfprFQG7gO7EIPFFDOJMfiLFyprZ8KxB8marv9V8FLCv2KnCPm u5U30NPwdJydH3WbYOWsi/HuQVoXW+ctigxKtEuhgJWsazm7S1sFeFCY0vaWBZrzE8Tg /7ywAbk0RDop02hVsTk/SyCi0JKKb+bS71BfYx8r+EeYXqORkkcGaEKC9MAbebrTT3rt nivA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=akLTEsXRHyQLCjo/u9MMH84igbVEHYXZFj7pQ88yU8Q=; b=mpsXoX2rSgq8LrM3LC2FFkVkWoBf5X5aSKWdFE8Au0HhFnU0u33/dx+p2lX4RAwWjf 7qjNcD6wOsyO+dFcii9HsGahx3WqtPtmx2grfUEHakxD3vykULlGYJ2Fxq3xj8lLsqlW RronS6ssbNJ8Ohtgl7J501eVtTNMuDa2WF3xO7/eGOQmbfLft6S2gnaIa3Yr2bqi+kx2 MrYxk6Sz2rbp/jABUXH/FnZ/k8aNI2WMpSWcEvNt8Ew2XJcta7J+0XK0aqkUcH+C8pNL J6K6tKxv3L3KtPn4k9RZeECnZ126kgCFsuLmJ7AX3ZuyJvnaNDuhKKe68gXz9qkDOcK1 BnqQ== X-Gm-Message-State: ANhLgQ3/u9taRfQZpbxOkK0vkBp31arzvfu6TtY8Q93Pwiaes8UCyBv1 rm5pKaZpBTd4OniFLbDOy2tm7JefWTzCVkxcoy0= X-Google-Smtp-Source: ADFU+vv9nEbM4E/rFjke4WzNc06SWAUXlwwzgdZJ/kotzKXe8gshrqme/UsyDc2ENaW69+6VXHHsUpImU9mrfyfSaMA= X-Received: by 2002:a5d:8796:: with SMTP id f22mr18297936ion.163.1584955612857; Mon, 23 Mar 2020 02:26:52 -0700 (PDT) MIME-Version: 1.0 References: <20200318190241.3150971-1-jerinj@marvell.com> <20200318190241.3150971-12-jerinj@marvell.com> <940db31d-6901-1167-06cc-60c9f9e87705@ericsson.com> In-Reply-To: <940db31d-6901-1167-06cc-60c9f9e87705@ericsson.com> From: Jerin Jacob Date: Mon, 23 Mar 2020 14:56:37 +0530 Message-ID: To: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= Cc: "jerinj@marvell.com" , Sunil Kumar Kori , "dev@dpdk.org" , "thomas@monjalon.net" , "bruce.richardson@intel.com" , "david.marchand@redhat.com" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH v1 11/32] eal/trace: implement trace save X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, Mar 20, 2020 at 12:37 AM Mattias R=C3=B6nnblom wrote: > > On 2020-03-18 20:02, jerinj@marvell.com wrote: > > From: Jerin Jacob > > +static int > > +trace_meta_save(struct trace *trace) > > +{ > > + char file_name[PATH_MAX]; > > + FILE *f; > > + int rc; > > + > > + rc =3D snprintf(file_name, PATH_MAX, "%s/metadata", trace->dir); > > + if (rc < 0) > > + return rc; > > + > > + f =3D fopen(file_name, "w"); > > + if (f =3D=3D NULL) > > + return -errno; > > + > > + rc =3D rte_trace_metadata_dump(f); > > + > > + fclose(f); > Check fclose() return code. Ack. Will fix it v2. > > + return rc; > > +} > > + > > + > > +static inline int > > +trace_file_sz(struct __rte_trace_header *hdr) > > +{ > > + return sizeof(struct __rte_trace_stream_header) + hdr->offset; > > +} > > + > > +static int > > +trace_mem_save(struct trace *trace, struct __rte_trace_header *hdr, > > + uint32_t cnt) > > +{ > > + char file_name[PATH_MAX]; > > + FILE *f; > > + int rc; > > + > > + rc =3D snprintf(file_name, PATH_MAX, "%s/channel0_%d", trace->dir= , cnt); > > + if (rc < 0) > > + return rc; > > + > > + f =3D fopen(file_name, "w"); > > + if (f =3D=3D NULL) > > + return -errno; > > + > > + rc =3D fwrite(&hdr->stream_header, trace_file_sz(hdr), 1, f); > > + fclose(f); > Again, check return code. Ack. Will fix it v2.