From: Pedro Alves <palves@redhat.com>
To: Gary Benson <gbenson@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Introduce new shared function remote_fileio_to_fio_error
Date: Thu, 09 Apr 2015 10:17:00 -0000 [thread overview]
Message-ID: <552651D0.9090302@redhat.com> (raw)
In-Reply-To: <1428573072-8639-1-git-send-email-gbenson@redhat.com>
On 04/09/2015 10:51 AM, Gary Benson wrote:
> Hi all,
>
> This commit introduces a new shared function to replace three
> identical functions in various places in the codebase.
>
> Ok to commit?
>
This is OK, but I think the "remote" in the name is really wrong.
This is converting a _host_ errno to a fileio error. I think the
function name should reflect that, and not mention remote at all.
This is a preexisting issue with remote_fileio_to_fio_stat as well
(should be called something like host_stat_to_fio_stat / stat_to_fio_stat /
stat_to_fileio_stat / fileio_host_stat_to_fio_stat), so I'm not
pushing back on this new case. We should probably rename
the "common-remote-fileio.*" files too.
> gdb/gdbserver/ChangeLog:
>
> * hostio-errno.c (errno_to_fileio_error): Remove function.
E.g., the old name here was clear.
> Update caller to use remote_fileio_to_fio_error.
> +int
> +remote_fileio_to_fio_error (int error)
> +{
> + switch (error)
> + {
> + case EPERM:
> + return FILEIO_EPERM;
... otherwise this is truly confusing. Reading the function
name as "X to Y", makes one go "hmm, what has 'remote fileio' got
to do with about EPERM?' ?
> /* Convert a host-format mode_t into a bitmask of File-I/O flags. */
>
> static LONGEST
> diff --git a/gdb/inf-child.c b/gdb/inf-child.c
> index b7161ab..5e5763b 100644
> --- a/gdb/inf-child.c
> +++ b/gdb/inf-child.c
> @@ -311,7 +260,7 @@ inf_child_fileio_open (struct target_ops *self,
> the standard values. */
> fd = gdb_open_cloexec (filename, nat_flags, mode);
> if (fd == -1)
> - *target_errno = inf_child_errno_to_fileio_error (errno);
> + *target_errno = remote_fileio_to_fio_error (errno);
>
... and inf-child calling a "remote_"-named function is truly bizarre.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2015-04-09 10:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-09 9:51 Gary Benson
2015-04-09 10:17 ` Pedro Alves [this message]
2015-04-09 10:50 ` Gary Benson
2015-04-09 11:00 ` Pedro Alves
2015-04-09 13:21 ` Gary Benson
2015-04-09 14:12 ` [PATCH] Rename common-remote-fileio.[ch] as fileio.[ch] Gary Benson
2015-04-09 14:18 ` Gary Benson
2015-04-09 14:23 ` Pedro Alves
2015-04-09 16:04 ` Gary Benson
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=552651D0.9090302@redhat.com \
--to=palves@redhat.com \
--cc=gbenson@redhat.com \
--cc=gdb-patches@sourceware.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