From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29563 invoked by alias); 9 Apr 2015 10:17:57 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 29550 invoked by uid 89); 9 Apr 2015 10:17:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 09 Apr 2015 10:17:55 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id BAB358EA3C for ; Thu, 9 Apr 2015 10:17:54 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t39AHrsA016915; Thu, 9 Apr 2015 06:17:53 -0400 Message-ID: <552651D0.9090302@redhat.com> Date: Thu, 09 Apr 2015 10:17:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Gary Benson , gdb-patches@sourceware.org Subject: Re: [PATCH] Introduce new shared function remote_fileio_to_fio_error References: <1428573072-8639-1-git-send-email-gbenson@redhat.com> In-Reply-To: <1428573072-8639-1-git-send-email-gbenson@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-04/txt/msg00326.txt.bz2 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