Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Gary Benson <gbenson@redhat.com>
To: gdb-patches@sourceware.org
Cc: Pedro Alves <palves@redhat.com>
Subject: Re: [PATCH] Rename common-remote-fileio.[ch] as fileio.[ch]
Date: Thu, 09 Apr 2015 14:18:00 -0000	[thread overview]
Message-ID: <20150409141800.GA4980@blade.nx> (raw)
In-Reply-To: <1428588756-3553-1-git-send-email-gbenson@redhat.com>

git diff -M version as promised...

diff --git a/gdb/common/common-remote-fileio.c b/gdb/common/fileio.c
similarity index 68%
rename from gdb/common/common-remote-fileio.c
rename to gdb/common/fileio.c
index 30c2c6b..5d3e6ae 100644
--- a/gdb/common/common-remote-fileio.c
+++ b/gdb/common/fileio.c
@@ -1,4 +1,4 @@
-/* Remote File-I/O communications
+/* File-I/O functions for GDB, the GNU debugger.
 
    Copyright (C) 2003-2015 Free Software Foundation, Inc.
 
@@ -18,13 +18,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "common-defs.h"
-#include "common-remote-fileio.h"
+#include "fileio.h"
 #include <sys/stat.h>
 
-/* See common-remote-fileio.h.  */
+/* See fileio.h.  */
 
 int
-remote_fileio_to_fio_error (int error)
+host_to_fileio_error (int error)
 {
   switch (error)
     {
@@ -77,7 +77,7 @@ remote_fileio_to_fio_error (int error)
 /* Convert a host-format mode_t into a bitmask of File-I/O flags.  */
 
 static LONGEST
-remote_fileio_mode_to_target (mode_t mode)
+fileio_mode_pack (mode_t mode)
 {
   mode_t tmode = 0;
 
@@ -121,52 +121,51 @@ remote_fileio_mode_to_target (mode_t mode)
 /* Pack a host-format mode_t into an fio_mode_t.  */
 
 static void
-remote_fileio_to_fio_mode (mode_t num, fio_mode_t fnum)
+host_to_fileio_mode (mode_t num, fio_mode_t fnum)
 {
-  remote_fileio_to_be (remote_fileio_mode_to_target (num),
-		       (char *) fnum, 4);
+  host_to_bigendian (fileio_mode_pack (num), (char *) fnum, 4);
 }
 
 /* Pack a host-format integer into an fio_ulong_t.  */
 
 static void
-remote_fileio_to_fio_ulong (LONGEST num, fio_ulong_t fnum)
+host_to_fileio_ulong (LONGEST num, fio_ulong_t fnum)
 {
-  remote_fileio_to_be (num, (char *) fnum, 8);
+  host_to_bigendian (num, (char *) fnum, 8);
 }
 
-/* See common-remote-fileio.h.  */
+/* See fileio.h.  */
 
 void
-remote_fileio_to_fio_stat (struct stat *st, struct fio_stat *fst)
+host_to_fileio_stat (struct stat *st, struct fio_stat *fst)
 {
   LONGEST blksize;
 
-  remote_fileio_to_fio_uint ((long) st->st_dev, fst->fst_dev);
-  remote_fileio_to_fio_uint ((long) st->st_ino, fst->fst_ino);
-  remote_fileio_to_fio_mode (st->st_mode, fst->fst_mode);
-  remote_fileio_to_fio_uint ((long) st->st_nlink, fst->fst_nlink);
-  remote_fileio_to_fio_uint ((long) st->st_uid, fst->fst_uid);
-  remote_fileio_to_fio_uint ((long) st->st_gid, fst->fst_gid);
-  remote_fileio_to_fio_uint ((long) st->st_rdev, fst->fst_rdev);
-  remote_fileio_to_fio_ulong ((LONGEST) st->st_size, fst->fst_size);
+  host_to_fileio_uint ((long) st->st_dev, fst->fst_dev);
+  host_to_fileio_uint ((long) st->st_ino, fst->fst_ino);
+  host_to_fileio_mode (st->st_mode, fst->fst_mode);
+  host_to_fileio_uint ((long) st->st_nlink, fst->fst_nlink);
+  host_to_fileio_uint ((long) st->st_uid, fst->fst_uid);
+  host_to_fileio_uint ((long) st->st_gid, fst->fst_gid);
+  host_to_fileio_uint ((long) st->st_rdev, fst->fst_rdev);
+  host_to_fileio_ulong ((LONGEST) st->st_size, fst->fst_size);
 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
   blksize = st->st_blksize;
 #else
   blksize = 512;
 #endif
-  remote_fileio_to_fio_ulong (blksize, fst->fst_blksize);
+  host_to_fileio_ulong (blksize, fst->fst_blksize);
 #if HAVE_STRUCT_STAT_ST_BLOCKS
-  remote_fileio_to_fio_ulong ((LONGEST) st->st_blocks, fst->fst_blocks);
+  host_to_fileio_ulong ((LONGEST) st->st_blocks, fst->fst_blocks);
 #else
   /* FIXME: This is correct for DJGPP, but other systems that don't
      have st_blocks, if any, might prefer 512 instead of st_blksize.
      (eliz, 30-12-2003)  */
-  remote_fileio_to_fio_ulong (((LONGEST) st->st_size + blksize - 1)
-			      / blksize,
-			      fst->fst_blocks);
+  host_to_fileio_ulong (((LONGEST) st->st_size + blksize - 1)
+			/ blksize,
+			fst->fst_blocks);
 #endif
-  remote_fileio_to_fio_time (st->st_atime, fst->fst_atime);
-  remote_fileio_to_fio_time (st->st_mtime, fst->fst_mtime);
-  remote_fileio_to_fio_time (st->st_ctime, fst->fst_ctime);
+  host_to_fileio_time (st->st_atime, fst->fst_atime);
+  host_to_fileio_time (st->st_mtime, fst->fst_mtime);
+  host_to_fileio_time (st->st_ctime, fst->fst_ctime);
 }
diff --git a/gdb/common/common-remote-fileio.h b/gdb/common/fileio.h
similarity index 56%
rename from gdb/common/common-remote-fileio.h
rename to gdb/common/fileio.h
index 96e4aa5..69a735f 100644
--- a/gdb/common/common-remote-fileio.h
+++ b/gdb/common/fileio.h
@@ -1,4 +1,4 @@
-/* Remote File-I/O communications
+/* File-I/O functions for GDB, the GNU debugger.
 
    Copyright (C) 2003-2015 Free Software Foundation, Inc.
 
@@ -17,23 +17,22 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#ifndef COMMON_REMOTE_FILEIO_H
-#define COMMON_REMOTE_FILEIO_H
+#ifndef FILEIO_H
+#define FILEIO_H
 
 #include "gdb/fileio.h"
 #include <sys/stat.h>
 
-/* Convert a errno error number to a File-I/O error number for
-   transmission over the remote protocol.  */
+/* Convert a host-format errno value to a File-I/O error number.  */
 
-extern int remote_fileio_to_fio_error (int error);
+extern int host_to_fileio_error (int error);
 
-/* Pack a host-format integer into a byte buffer in big-endian format
-   ready for transmission over the remote protocol.  BYTES specifies
-   the size of the integer to pack in bytes.  */
+/* Pack a host-format integer into a byte buffer in big-endian
+   format.  BYTES specifies the size of the integer to pack in
+   bytes.  */
 
 static inline void
-remote_fileio_to_be (LONGEST num, char *buf, int bytes)
+host_to_bigendian (LONGEST num, char *buf, int bytes)
 {
   int i;
 
@@ -44,22 +43,21 @@ remote_fileio_to_be (LONGEST num, char *buf, int bytes)
 /* Pack a host-format integer into an fio_uint_t.  */
 
 static inline void
-remote_fileio_to_fio_uint (long num, fio_uint_t fnum)
+host_to_fileio_uint (long num, fio_uint_t fnum)
 {
-  remote_fileio_to_be ((LONGEST) num, (char *) fnum, 4);
+  host_to_bigendian ((LONGEST) num, (char *) fnum, 4);
 }
 
 /* Pack a host-format time_t into an fio_time_t.  */
 
 static inline void
-remote_fileio_to_fio_time (time_t num, fio_time_t fnum)
+host_to_fileio_time (time_t num, fio_time_t fnum)
 {
-  remote_fileio_to_be ((LONGEST) num, (char *) fnum, 4);
+  host_to_bigendian ((LONGEST) num, (char *) fnum, 4);
 }
 
 /* Pack a host-format struct stat into a struct fio_stat.  */
 
-extern void remote_fileio_to_fio_stat (struct stat *st,
-				       struct fio_stat *fst);
+extern void host_to_fileio_stat (struct stat *st, struct fio_stat *fst);
 
-#endif /* COMMON_REMOTE_FILEIO_H */
+#endif /* FILEIO_H */


  reply	other threads:[~2015-04-09 14:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-09  9:51 [PATCH] Introduce new shared function remote_fileio_to_fio_error Gary Benson
2015-04-09 10:17 ` Pedro Alves
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 [this message]
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=20150409141800.GA4980@blade.nx \
    --to=gbenson@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /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