From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id D35743858C20 for ; Mon, 29 Aug 2022 16:29:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D35743858C20 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 27TGTTHT015289 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 29 Aug 2022 12:29:33 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 27TGTTHT015289 Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id AE6E61E227; Mon, 29 Aug 2022 12:29:28 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH v2 1/3] gdbsupport: move include/gdb/fileio.h contents to fileio.h Date: Mon, 29 Aug 2022 12:29:24 -0400 Message-Id: <20220829162926.3752040-2-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220829162926.3752040-1-simon.marchi@polymtl.ca> References: <20220826195459.2540898-1-simon.marchi@efficios.com> <20220829162926.3752040-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 29 Aug 2022 16:29:29 +0000 X-Spam-Status: No, score=-3190.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Mon, 29 Aug 2022 16:29:45 -0000 From: Simon Marchi I don't see why include/gdb/fileio.h is placed there. It's not installed by "make install", and it's not included by anything outside of gdb/gdbserver/gdbsupport. Move its content back to gdbsupport/fileio.h. I have omitted the bits inside an `#if 0`, since it's obviously not used, as well as the "limits" constants, which are also unused. Change-Id: I6fbc2ea10fbe4cfcf15f9f76006b31b99c20e5a9 --- gdb/gdb_bfd.c | 2 +- gdb/remote.c | 2 +- gdb/target.c | 2 +- gdbserver/hostio.cc | 2 +- gdbserver/win32-low.cc | 2 +- gdbsupport/fileio.h | 110 ++++++++++++++++++++++++++++++- include/gdb/fileio.h | 144 ----------------------------------------- 7 files changed, 114 insertions(+), 150 deletions(-) delete mode 100644 include/gdb/fileio.h diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c index 6c03ae5ef053..1079623d79f7 100644 --- a/gdb/gdb_bfd.c +++ b/gdb/gdb_bfd.c @@ -30,7 +30,7 @@ #endif #endif #include "target.h" -#include "gdb/fileio.h" +#include "gdbsupport/fileio.h" #include "inferior.h" #include "cli/cli-style.h" diff --git a/gdb/remote.c b/gdb/remote.c index 70f918a7362c..5bae65472ed0 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -59,7 +59,7 @@ #include "gdbcore.h" #include "remote-fileio.h" -#include "gdb/fileio.h" +#include "gdbsupport/fileio.h" #include #include "xml-support.h" diff --git a/gdb/target.c b/gdb/target.c index 41144901fc19..9d698afb09dc 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -40,7 +40,7 @@ #include "exec.h" #include "inline-frame.h" #include "tracepoint.h" -#include "gdb/fileio.h" +#include "gdbsupport/fileio.h" #include "gdbsupport/agent.h" #include "auxv.h" #include "target-debug.h" diff --git a/gdbserver/hostio.cc b/gdbserver/hostio.cc index 2d17b6d1a705..4f763f382bb0 100644 --- a/gdbserver/hostio.cc +++ b/gdbserver/hostio.cc @@ -19,7 +19,7 @@ along with this program. If not, see . */ #include "server.h" -#include "gdb/fileio.h" +#include "gdbsupport/fileio.h" #include "hostio.h" #include diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc index 5e2c028d683e..af132f60215d 100644 --- a/gdbserver/win32-low.cc +++ b/gdbserver/win32-low.cc @@ -20,7 +20,7 @@ #include "server.h" #include "regcache.h" -#include "gdb/fileio.h" +#include "gdbsupport/fileio.h" #include "mem-break.h" #include "win32-low.h" #include "gdbthread.h" diff --git a/gdbsupport/fileio.h b/gdbsupport/fileio.h index 2b4f977a0206..9809c1623140 100644 --- a/gdbsupport/fileio.h +++ b/gdbsupport/fileio.h @@ -20,9 +20,117 @@ #ifndef COMMON_FILEIO_H #define COMMON_FILEIO_H -#include "gdb/fileio.h" #include +/* The following flags are defined to be independent of the host + as well as the target side implementation of these constants. + All constants are defined with a leading FILEIO_ in the name + to allow the usage of these constants together with the + corresponding implementation dependent constants in one module. */ + +/* open(2) flags */ +#define FILEIO_O_RDONLY 0x0 +#define FILEIO_O_WRONLY 0x1 +#define FILEIO_O_RDWR 0x2 +#define FILEIO_O_APPEND 0x8 +#define FILEIO_O_CREAT 0x200 +#define FILEIO_O_TRUNC 0x400 +#define FILEIO_O_EXCL 0x800 +#define FILEIO_O_SUPPORTED (FILEIO_O_RDONLY | FILEIO_O_WRONLY| \ + FILEIO_O_RDWR | FILEIO_O_APPEND| \ + FILEIO_O_CREAT | FILEIO_O_TRUNC| \ + FILEIO_O_EXCL) + +/* mode_t bits */ +#define FILEIO_S_IFREG 0100000 +#define FILEIO_S_IFDIR 040000 +#define FILEIO_S_IFCHR 020000 +#define FILEIO_S_IRUSR 0400 +#define FILEIO_S_IWUSR 0200 +#define FILEIO_S_IXUSR 0100 +#define FILEIO_S_IRWXU 0700 +#define FILEIO_S_IRGRP 040 +#define FILEIO_S_IWGRP 020 +#define FILEIO_S_IXGRP 010 +#define FILEIO_S_IRWXG 070 +#define FILEIO_S_IROTH 04 +#define FILEIO_S_IWOTH 02 +#define FILEIO_S_IXOTH 01 +#define FILEIO_S_IRWXO 07 +#define FILEIO_S_SUPPORTED (FILEIO_S_IFREG|FILEIO_S_IFDIR| \ + FILEIO_S_IRWXU|FILEIO_S_IRWXG| \ + FILEIO_S_IRWXO) + +/* lseek(2) flags */ +#define FILEIO_SEEK_SET 0 +#define FILEIO_SEEK_CUR 1 +#define FILEIO_SEEK_END 2 + +/* errno values */ +#define FILEIO_EPERM 1 +#define FILEIO_ENOENT 2 +#define FILEIO_EINTR 4 +#define FILEIO_EIO 5 +#define FILEIO_EBADF 9 +#define FILEIO_EACCES 13 +#define FILEIO_EFAULT 14 +#define FILEIO_EBUSY 16 +#define FILEIO_EEXIST 17 +#define FILEIO_ENODEV 19 +#define FILEIO_ENOTDIR 20 +#define FILEIO_EISDIR 21 +#define FILEIO_EINVAL 22 +#define FILEIO_ENFILE 23 +#define FILEIO_EMFILE 24 +#define FILEIO_EFBIG 27 +#define FILEIO_ENOSPC 28 +#define FILEIO_ESPIPE 29 +#define FILEIO_EROFS 30 +#define FILEIO_ENOSYS 88 +#define FILEIO_ENAMETOOLONG 91 +#define FILEIO_EUNKNOWN 9999 + +#define FIO_INT_LEN 4 +#define FIO_UINT_LEN 4 +#define FIO_MODE_LEN 4 +#define FIO_TIME_LEN 4 +#define FIO_LONG_LEN 8 +#define FIO_ULONG_LEN 8 + +typedef char fio_int_t[FIO_INT_LEN]; +typedef char fio_uint_t[FIO_UINT_LEN]; +typedef char fio_mode_t[FIO_MODE_LEN]; +typedef char fio_time_t[FIO_TIME_LEN]; +typedef char fio_long_t[FIO_LONG_LEN]; +typedef char fio_ulong_t[FIO_ULONG_LEN]; + +/* Struct stat as used in protocol. For complete independence + of host/target systems, it's defined as an array with offsets + to the members. */ + +struct fio_stat +{ + fio_uint_t fst_dev; + fio_uint_t fst_ino; + fio_mode_t fst_mode; + fio_uint_t fst_nlink; + fio_uint_t fst_uid; + fio_uint_t fst_gid; + fio_uint_t fst_rdev; + fio_ulong_t fst_size; + fio_ulong_t fst_blksize; + fio_ulong_t fst_blocks; + fio_time_t fst_atime; + fio_time_t fst_mtime; + fio_time_t fst_ctime; +}; + +struct fio_timeval +{ + fio_time_t ftv_sec; + fio_long_t ftv_usec; +}; + /* Convert a host-format errno value to a File-I/O error number. */ extern int host_to_fileio_error (int error); diff --git a/include/gdb/fileio.h b/include/gdb/fileio.h deleted file mode 100644 index f472f828f722..000000000000 --- a/include/gdb/fileio.h +++ /dev/null @@ -1,144 +0,0 @@ -/* Hosted File I/O interface definitions, for GDB, the GNU Debugger. - - Copyright (C) 2003-2022 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#ifndef GDB_FILEIO_H_ -#define GDB_FILEIO_H_ - -/* The following flags are defined to be independent of the host - as well as the target side implementation of these constants. - All constants are defined with a leading FILEIO_ in the name - to allow the usage of these constants together with the - corresponding implementation dependent constants in one module. */ - -/* open(2) flags */ -#define FILEIO_O_RDONLY 0x0 -#define FILEIO_O_WRONLY 0x1 -#define FILEIO_O_RDWR 0x2 -#define FILEIO_O_APPEND 0x8 -#define FILEIO_O_CREAT 0x200 -#define FILEIO_O_TRUNC 0x400 -#define FILEIO_O_EXCL 0x800 -#define FILEIO_O_SUPPORTED (FILEIO_O_RDONLY | FILEIO_O_WRONLY| \ - FILEIO_O_RDWR | FILEIO_O_APPEND| \ - FILEIO_O_CREAT | FILEIO_O_TRUNC| \ - FILEIO_O_EXCL) - -/* mode_t bits */ -#define FILEIO_S_IFREG 0100000 -#define FILEIO_S_IFDIR 040000 -#define FILEIO_S_IFCHR 020000 -#define FILEIO_S_IRUSR 0400 -#define FILEIO_S_IWUSR 0200 -#define FILEIO_S_IXUSR 0100 -#define FILEIO_S_IRWXU 0700 -#define FILEIO_S_IRGRP 040 -#define FILEIO_S_IWGRP 020 -#define FILEIO_S_IXGRP 010 -#define FILEIO_S_IRWXG 070 -#define FILEIO_S_IROTH 04 -#define FILEIO_S_IWOTH 02 -#define FILEIO_S_IXOTH 01 -#define FILEIO_S_IRWXO 07 -#define FILEIO_S_SUPPORTED (FILEIO_S_IFREG|FILEIO_S_IFDIR| \ - FILEIO_S_IRWXU|FILEIO_S_IRWXG| \ - FILEIO_S_IRWXO) - -/* lseek(2) flags */ -#define FILEIO_SEEK_SET 0 -#define FILEIO_SEEK_CUR 1 -#define FILEIO_SEEK_END 2 - -/* errno values */ -#define FILEIO_EPERM 1 -#define FILEIO_ENOENT 2 -#define FILEIO_EINTR 4 -#define FILEIO_EIO 5 -#define FILEIO_EBADF 9 -#define FILEIO_EACCES 13 -#define FILEIO_EFAULT 14 -#define FILEIO_EBUSY 16 -#define FILEIO_EEXIST 17 -#define FILEIO_ENODEV 19 -#define FILEIO_ENOTDIR 20 -#define FILEIO_EISDIR 21 -#define FILEIO_EINVAL 22 -#define FILEIO_ENFILE 23 -#define FILEIO_EMFILE 24 -#define FILEIO_EFBIG 27 -#define FILEIO_ENOSPC 28 -#define FILEIO_ESPIPE 29 -#define FILEIO_EROFS 30 -#define FILEIO_ENOSYS 88 -#define FILEIO_ENAMETOOLONG 91 -#define FILEIO_EUNKNOWN 9999 - -/* limits */ -#define FILEIO_INT_MIN -2147483648L -#define FILEIO_INT_MAX 2147483647L -#define FILEIO_UINT_MAX 4294967295UL -#define FILEIO_LONG_MIN -9223372036854775808LL -#define FILEIO_LONG_MAX 9223372036854775807LL -#define FILEIO_ULONG_MAX 18446744073709551615ULL - -/* Integral types as used in protocol. */ -#if 0 -typedef __int32_t fio_int_t; -typedef __uint32_t fio_uint_t, fio_mode_t, fio_time_t; -typedef __int64_t fio_long_t; -typedef __uint64_t fio_ulong_t; -#endif - -#define FIO_INT_LEN 4 -#define FIO_UINT_LEN 4 -#define FIO_MODE_LEN 4 -#define FIO_TIME_LEN 4 -#define FIO_LONG_LEN 8 -#define FIO_ULONG_LEN 8 - -typedef char fio_int_t[FIO_INT_LEN]; -typedef char fio_uint_t[FIO_UINT_LEN]; -typedef char fio_mode_t[FIO_MODE_LEN]; -typedef char fio_time_t[FIO_TIME_LEN]; -typedef char fio_long_t[FIO_LONG_LEN]; -typedef char fio_ulong_t[FIO_ULONG_LEN]; - -/* Struct stat as used in protocol. For complete independence - of host/target systems, it's defined as an array with offsets - to the members. */ - -struct fio_stat { - fio_uint_t fst_dev; - fio_uint_t fst_ino; - fio_mode_t fst_mode; - fio_uint_t fst_nlink; - fio_uint_t fst_uid; - fio_uint_t fst_gid; - fio_uint_t fst_rdev; - fio_ulong_t fst_size; - fio_ulong_t fst_blksize; - fio_ulong_t fst_blocks; - fio_time_t fst_atime; - fio_time_t fst_mtime; - fio_time_t fst_ctime; -}; - -struct fio_timeval { - fio_time_t ftv_sec; - fio_long_t ftv_usec; -}; - -#endif /* GDB_FILEIO_H_ */ -- 2.37.2