From: Andrew Donnellan <ajd@linux.ibm.com>
To: Benjamin Gray <bgray@linux.ibm.com>, linuxppc-dev@lists.ozlabs.org
Cc: ruscur@russell.cc
Subject: Re: [PATCH v3 4/7] selftests/powerpc: Add read/write debugfs file, int
Date: Wed, 25 Jan 2023 15:59:56 +1100 [thread overview]
Message-ID: <24204e329b6c625ef75db05422edc5c5a30c65d6.camel@linux.ibm.com> (raw)
In-Reply-To: <20221128041948.58339-5-bgray@linux.ibm.com>
On Mon, 2022-11-28 at 15:19 +1100, Benjamin Gray wrote:
> Debugfs files are not always integers, so make *_file return/write a
> byte buffer, and *_int deal with int values specifically. This
> increases
> consistency with the other file read/write helpers.
>
> Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
This seems like a sensible idea.
Nitpick below, otherwise it looks like you have changed over all 21
call sites and the new helpers look better.
Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>
> -int read_debugfs_file(char *debugfs_file, int *result)
> +int read_debugfs_int(const char *debugfs_file, int *result)
> {
> int err;
> - char path[PATH_MAX];
> char value[16] = {0};
>
> - strcpy(path, "/sys/kernel/debug/");
> - strncat(path, debugfs_file, PATH_MAX - strlen(path) - 1);
> -
> - if ((err = read_file(path, value, sizeof(value) - 1, NULL)))
> + if ((err = read_debugfs_file(debugfs_file, value,
> sizeof(value) - 1)))
Per my comments on the previous patch, separate the function call from
the error check
--
Andrew Donnellan OzLabs, ADL Canberra
ajd@linux.ibm.com IBM Australia Limited
next prev parent reply other threads:[~2023-01-25 5:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 4:19 [PATCH v3 0/7] Expand selftest utils Benjamin Gray
2022-11-28 4:19 ` [PATCH v3 1/7] selftests/powerpc: Use mfspr/mtspr macros Benjamin Gray
2022-11-28 4:19 ` [PATCH v3 2/7] selftests/powerpc: Add ptrace setup_core_pattern() null-terminator Benjamin Gray
2022-12-02 3:52 ` Andrew Donnellan
2022-11-28 4:19 ` [PATCH v3 3/7] selftests/powerpc: Add generic read/write file util Benjamin Gray
2022-12-02 11:04 ` Michael Ellerman
2023-01-25 4:50 ` Andrew Donnellan
2022-11-28 4:19 ` [PATCH v3 4/7] selftests/powerpc: Add read/write debugfs file, int Benjamin Gray
2023-01-25 4:59 ` Andrew Donnellan [this message]
2022-11-28 4:19 ` [PATCH v3 5/7] selftests/powerpc: Parse long/unsigned long value safely Benjamin Gray
2022-11-28 4:19 ` [PATCH v3 6/7] selftests/powerpc: Add {read,write}_{long,ulong} Benjamin Gray
2022-11-28 4:19 ` [PATCH v3 7/7] selftests/powerpc: Add automatically allocating read_file Benjamin Gray
2022-12-08 12:40 ` (subset) [PATCH v3 0/7] Expand selftest utils Michael Ellerman
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=24204e329b6c625ef75db05422edc5c5a30c65d6.camel@linux.ibm.com \
--to=ajd@linux.ibm.com \
--cc=bgray@linux.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=ruscur@russell.cc \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.