From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D45E3A0C4B; Sat, 17 Jul 2021 19:53:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9BC204067B; Sat, 17 Jul 2021 19:53:38 +0200 (CEST) Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by mails.dpdk.org (Postfix) with ESMTP id A6FF44003C for ; Sat, 17 Jul 2021 19:53:36 +0200 (CEST) Received: by mail-pl1-f176.google.com with SMTP id y3so2722754plp.4 for ; Sat, 17 Jul 2021 10:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=p/eIYJcmF4f7cK4WcdLB4ZMilcTMwVzK7St8xzE05rA=; b=nCz1RfV0hJfalrjA4qK0Hla4Yj/YuZWzAqqDhBRtEewunRFkcG5ttocZvjHwu8fMSM vwJ5fFOSE9YozfPg8N7teCbO2i/jRXou29urKaOt+pHgw77VqwDyBRWTFLtxfOiwhJRC qlI6SLudZOB6oXffCpr26cT93+ElsTGdRBWN7aEiIKDtT+O2W2jVGFwZuxWU0s4/jWEH SBlyXKHSmB52jn2RXC5uFxl6YSX+cXePO1ioKRVyNBQGhx6c/zQ+27n64/TekGL84Cw2 Gu2tg3gZiGG3173dlpnzFT0TWLKUUUWWkEyJXT7Npm9V9d71+ReMggjU4kxMUrUkfVVI ZgBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p/eIYJcmF4f7cK4WcdLB4ZMilcTMwVzK7St8xzE05rA=; b=YrPBkHD2jGe64QXaRPLiwxO4wzdI64ih0gQvkrewJcXw/RIAYyNGClmklFWC3adtzo hQfJpQG5JYegoCEbon1NDIHG5+T6CvyP8jaZfep85vnA33c7plAISnSwLacy7pi+AEvS iLkXOBHW2J1zI6Yix+zY4Ob6Np+DVRyQKbXZFrBAzsQICPzgWsUlBSCQEZGgBrej36wI 2FrIz2J8ogj/YyEa1ghvE4baZC3U0Pd9+kwoxYjOEyZLRB5MZD4/yQUiBFODu7VoHKyk nYF07+v0zfNWNW/4zdaPDzenJhLhjB1wtDAfi68H3CW8GfUc0/UemgGc/+LYtWqLeGXL tI5g== X-Gm-Message-State: AOAM531DqjqJOd/pj2qq5PbgKYU1vUPJvrPSse5a1JitJ3e1fL5Nuh8L Zr56NnI0+RGgx0E8QHYQaa8SdQ== X-Google-Smtp-Source: ABdhPJwEwUNwc2cj1znN3H/gLBNAUG8yngex7uW9PjcIfwOKL7Zx3yfyPRN2K2KrMjI72VSXzkteSQ== X-Received: by 2002:a17:90a:3807:: with SMTP id w7mr15297520pjb.115.1626544415889; Sat, 17 Jul 2021 10:53:35 -0700 (PDT) Received: from hermes.local (204-195-33-123.wavecable.com. [204.195.33.123]) by smtp.gmail.com with ESMTPSA id z13sm14382896pfn.94.2021.07.17.10.53.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Jul 2021 10:53:35 -0700 (PDT) Date: Sat, 17 Jul 2021 10:53:33 -0700 From: Stephen Hemminger To: "Min Hu (Connor)" Cc: , , Message-ID: <20210717105333.58d98920@hermes.local> In-Reply-To: <1619355742-15429-1-git-send-email-humin29@huawei.com> References: <1619355742-15429-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] app/procinfo: add device registers dump X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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 Sun, 25 Apr 2021 21:02:22 +0800 "Min Hu (Connor)" wrote: > snprintf(file_name, MAX_FILE_NAME_SZ, "%s-port%u", > + file_prefix, i); > + fp_regs = fopen(file_name, "wb"); > + if (fp_regs == NULL) { > + printf("Error during opening '%s' for writing\n", > + file_name); > + } else { > + if ((int)fwrite(buf_data, 1, buf_size, fp_regs) != > + buf_size) > + printf("Error during writing %s\n", > + file_prefix); > + else > + printf("dump device (%s) regs successfully, " > + "driver:%s version:0X%08X\n", > + dev_info.device->name, > + dev_info.driver_name, reg_info.version); > + > + fclose(fp_regs); > + I don't like applications opening and writing an arbitrary file in the current directory. Any file should be an argument to the application and optional. Also, since you are writing binary data, there is no point in using stdio here.