DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chengchang Tang <tangchengchang@huawei.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
	"Min Hu (Connor)" <humin29@huawei.com>
Cc: <dev@dpdk.org>, <maryam.tahhan@intel.com>, <reshma.pattan@intel.com>
Subject: Re: [dpdk-dev] [PATCH] app/procinfo: add device registers dump
Date: Mon, 19 Jul 2021 15:00:20 +0800	[thread overview]
Message-ID: <fa96a4dd-b043-839a-5c6f-4c4244373106@huawei.com> (raw)
In-Reply-To: <20210717105333.58d98920@hermes.local>



On 2021/7/18 1:53, Stephen Hemminger wrote:
> On Sun, 25 Apr 2021 21:02:22 +0800
> "Min Hu (Connor)" <humin29@huawei.com> 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.

I think the use of the file here does not seem to be exactly the same as
the behavior you object to. The directories of the file and its name prefix
is passed by user. some suffixes has been added based on user's input.

This is mainly considering the scenario where the user does not specify a
device. If no device is specified, this command will dump regs for all
devices, and their dumped files are distinguished by the suffixes. If the
user is required to give a name to the dumped file of each device, the ease
of use of this command may decreases
> 
> Also, since you are writing binary data, there is no point in using
> stdio here.
> .
> 

  reply	other threads:[~2021-07-19  7:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-25 13:02 Min Hu (Connor)
2021-05-19 10:16 ` Thomas Monjalon
2021-06-04 15:04 ` Pattan, Reshma
2021-06-05  3:15   ` Chengchang Tang
2021-06-10 16:25     ` Pattan, Reshma
2021-06-21  2:17 ` [dpdk-dev] [PATCH v2] " Min Hu (Connor)
2021-07-09 21:55   ` Thomas Monjalon
2021-07-17  2:16     ` Min Hu (Connor)
2021-07-17 17:51 ` [dpdk-dev] [PATCH] " Stephen Hemminger
2021-07-19  6:40   ` Chengchang Tang
2021-07-17 17:53 ` Stephen Hemminger
2021-07-19  7:00   ` Chengchang Tang [this message]
2021-07-22 10:58 ` [dpdk-dev] [PATCH v3] " Min Hu (Connor)
2021-07-29 14:14   ` Pattan, Reshma
2021-07-30 16:46     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fa96a4dd-b043-839a-5c6f-4c4244373106@huawei.com \
    --to=tangchengchang@huawei.com \
    --cc=dev@dpdk.org \
    --cc=humin29@huawei.com \
    --cc=maryam.tahhan@intel.com \
    --cc=reshma.pattan@intel.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).