From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id 8166F386F83E for ; Sun, 17 May 2020 18:04:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8166F386F83E Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-392-C2QIxP2FPl2nkRS0AVYY7Q-1; Sun, 17 May 2020 14:04:54 -0400 X-MC-Unique: C2QIxP2FPl2nkRS0AVYY7Q-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AF5DB1005512 for ; Sun, 17 May 2020 18:04:53 +0000 (UTC) Received: from cascais.Home (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 445AD82A11 for ; Sun, 17 May 2020 18:04:53 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 2/3] Eliminate target_fileio_open_warn_if_slow Date: Sun, 17 May 2020 19:04:49 +0100 Message-Id: <20200517180450.14925-3-palves@redhat.com> In-Reply-To: <20200517180450.14925-1-palves@redhat.com> References: <20200517180450.14925-1-palves@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-16.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 May 2020 18:04:57 -0000 This basically makes target_fileio_open_1 extern, renamed to target_fileio_open, and eliminates the current target_fileio_open_warn_if_slow and target_fileio_open. A following parameter will want to change gdb_bfd_iovec_fileio_open, the only caller of target_fileio_open_warn_if_slow, to pass down "warn_if_slow" true/false from the caller, instead of hardcoding "warn_if_slow" true. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * gdb_bfd.c (gdb_bfd_iovec_fileio_open): Adjust. * target.c (target_fileio_open_1): Rename to target_fileio_open and make extern. Use bool. (target_fileio_open, target_fileio_open_warn_if_slow): Delete. (target_fileio_read_alloc_1): Adjust. * target.h (target_fileio_open): Add 'warn_if_slow' parameter. (target_fileio_open_warn_if_slow): Delete declaration. --- gdb/gdb_bfd.c | 9 ++++----- gdb/target.c | 33 +++++---------------------------- gdb/target.h | 20 +++++++------------- 3 files changed, 16 insertions(+), 46 deletions(-) diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c index 26262bfedf6..61872a0bf3d 100644 --- a/gdb/gdb_bfd.c +++ b/gdb/gdb_bfd.c @@ -284,11 +284,10 @@ gdb_bfd_iovec_fileio_open (struct bfd *abfd, void *inferior) gdb_assert (is_target_filename (filename)); - fd = target_fileio_open_warn_if_slow ((struct inferior *) inferior, - filename - + strlen (TARGET_SYSROOT_PREFIX), - FILEIO_O_RDONLY, 0, - &target_errno); + fd = target_fileio_open ((struct inferior *) inferior, + filename + strlen (TARGET_SYSROOT_PREFIX), + FILEIO_O_RDONLY, 0, true, + &target_errno); if (fd == -1) { errno = fileio_errno_to_host (target_errno); diff --git a/gdb/target.c b/gdb/target.c index 6982a806e3e..82c405a8491 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -2775,13 +2775,11 @@ target_ops::fileio_readlink (struct inferior *inf, const char *filename, return {}; } -/* Helper for target_fileio_open and - target_fileio_open_warn_if_slow. */ +/* See target.h. */ -static int -target_fileio_open_1 (struct inferior *inf, const char *filename, - int flags, int mode, int warn_if_slow, - int *target_errno) +int +target_fileio_open (struct inferior *inf, const char *filename, + int flags, int mode, bool warn_if_slow, int *target_errno) { for (target_ops *t = default_fileio_target (); t != NULL; t = t->beneath ()) { @@ -2813,27 +2811,6 @@ target_fileio_open_1 (struct inferior *inf, const char *filename, /* See target.h. */ -int -target_fileio_open (struct inferior *inf, const char *filename, - int flags, int mode, int *target_errno) -{ - return target_fileio_open_1 (inf, filename, flags, mode, 0, - target_errno); -} - -/* See target.h. */ - -int -target_fileio_open_warn_if_slow (struct inferior *inf, - const char *filename, - int flags, int mode, int *target_errno) -{ - return target_fileio_open_1 (inf, filename, flags, mode, 1, - target_errno); -} - -/* See target.h. */ - int target_fileio_pwrite (int fd, const gdb_byte *write_buf, int len, ULONGEST offset, int *target_errno) @@ -3036,7 +3013,7 @@ target_fileio_read_alloc_1 (struct inferior *inf, const char *filename, int target_errno; scoped_target_fd fd (target_fileio_open (inf, filename, FILEIO_O_RDONLY, - 0700, &target_errno)); + 0700, false, &target_errno)); if (fd.get () == -1) return -1; diff --git a/gdb/target.h b/gdb/target.h index 9a1dd805af9..37bfb29882a 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -2135,21 +2135,15 @@ extern int target_search_memory (CORE_ADDR start_addr, current_top_target ()->filesystem_is_local () /* Open FILENAME on the target, in the filesystem as seen by INF, - using FLAGS and MODE. If INF is NULL, use the filesystem seen - by the debugger (GDB or, for remote targets, the remote stub). - Return a target file descriptor, or -1 if an error occurs (and - set *TARGET_ERRNO). */ + using FLAGS and MODE. If INF is NULL, use the filesystem seen by + the debugger (GDB or, for remote targets, the remote stub). Return + a target file descriptor, or -1 if an error occurs (and set + *TARGET_ERRNO). If WARN_IF_SLOW is true, print a warning message + if the file is being accessed over a link that may be slow. */ extern int target_fileio_open (struct inferior *inf, const char *filename, int flags, - int mode, int *target_errno); - -/* Like target_fileio_open, but print a warning message if the - file is being accessed over a link that may be slow. */ -extern int target_fileio_open_warn_if_slow (struct inferior *inf, - const char *filename, - int flags, - int mode, - int *target_errno); + int mode, bool warn_if_slow, + int *target_errno); /* Write up to LEN bytes from WRITE_BUF to FD on the target. Return the number of bytes written, or -1 if an error occurs -- 2.14.5