+2015-04-09 Gary Benson <gbenson@redhat.com>
+
+ * common/common-remote-fileio.h: Rename to...
+ * common/fileio.h: ...this. Update all references.
+ (remote_fileio_to_fio_error): Rename to...
+ (host_to_fileio_error): ...this.
+ (remote_fileio_to_be): Rename to...
+ (host_to_bigendian): ...this. Update all callers.
+ (remote_fileio_to_fio_uint): Rename to...
+ (host_to_fileio_uint): ...this. Update all callers.
+ (remote_fileio_to_fio_time): Rename to...
+ (host_to_fileio_time): ...this. Update all callers.
+ (remote_fileio_to_fio_stat): Rename to...
+ (host_to_fileio_stat): ...this.
+ Update all references.
+ * common/common-remote-fileio.c: Rename to...
+ * common/fileio.c: ...this. Update all references.
+ (remote_fileio_to_fio_error): Rename to...
+ (host_to_fileio_error): ...this. Update all callers.
+ (remote_fileio_mode_to_target): Rename to...
+ (fileio_mode_pack): ...this. Update all callers.
+ (remote_fileio_to_fio_mode): Rename to...
+ (host_to_fileio_mode): ...this. Update all callers.
+ (remote_fileio_to_fio_ulong): Rename to...
+ (host_to_fileio_ulong): ...this. Update all callers.
+ (remote_fileio_to_fio_stat): Rename to...
+ (host_to_fileio_stat): ...this. Update all callers.
+
2015-04-09 Andy Wingo <wingo@igalia.com>
* guile/scm-frame.c (gdbscm_frame_read_register): New function.
common/format.c common/filestuff.c btrace.c record-btrace.c ctf.c \
target/waitstatus.c common/print-utils.c common/rsp-low.c \
common/errors.c common/common-debug.c common/common-exceptions.c \
- common/btrace-common.c common/common-remote-fileio.c \
+ common/btrace-common.c common/fileio.c \
$(SUBDIR_GCC_COMPILE_SRCS)
LINTFILES = $(SFILES) $(YYFILES) $(CONFIG_SRCS) init.c
common/common-debug.h common/cleanups.h common/gdb_setjmp.h \
common/common-exceptions.h target/target.h common/symbol.h \
common/common-regcache.h fbsd-tdep.h nat/linux-personality.h \
-common/common-remote-fileio.h nat/x86-linux.h nat/x86-linux-dregs.h
+common/fileio.h nat/x86-linux.h nat/x86-linux-dregs.h
# Header files that already have srcdir in them, or which are in objdir.
common-utils.o buffer.o ptid.o gdb-dlfcn.o common-agent.o \
format.o registry.o btrace.o record-btrace.o waitstatus.o \
print-utils.o rsp-low.o errors.o common-debug.o debug.o \
- common-exceptions.o btrace-common.o common-remote-fileio.o \
+ common-exceptions.o btrace-common.o fileio.o \
$(SUBDIR_GCC_COMPILE_OBS)
TSOBS = inflow.o
$(COMPILE) $(srcdir)/common/btrace-common.c
$(POSTCOMPILE)
-common-remote-fileio.o: ${srcdir}/common/common-remote-fileio.c
- $(COMPILE) $(srcdir)/common/common-remote-fileio.c
+fileio.o: ${srcdir}/common/fileio.c
+ $(COMPILE) $(srcdir)/common/fileio.c
$(POSTCOMPILE)
#
# gdb/target/ dependencies
-/* Remote File-I/O communications
+/* File-I/O functions for GDB, the GNU debugger.
Copyright (C) 2003-2015 Free Software Foundation, Inc.
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)
{
/* 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;
/* 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);
}
-/* Remote File-I/O communications
+/* File-I/O functions for GDB, the GNU debugger.
Copyright (C) 2003-2015 Free Software Foundation, Inc.
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;
/* 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 */
$(srcdir)/common/common-debug.c $(srcdir)/common/cleanups.c \
$(srcdir)/common/common-exceptions.c $(srcdir)/symbol.c \
$(srcdir)/common/btrace-common.c \
- $(srcdir)/common/common-remote-fileio.c
+ $(srcdir)/common/fileio.c
DEPFILES = @GDBSERVER_DEPFILES@
mem-break.o hostio.o event-loop.o tracepoint.o xml-utils.o \
common-utils.o ptid.o buffer.o format.o filestuff.o dll.o notif.o \
tdesc.o print-utils.o rsp-low.o errors.o common-debug.o cleanups.o \
- common-exceptions.o symbol.o btrace-common.o common-remote-fileio.o \
+ common-exceptions.o symbol.o btrace-common.o fileio.o \
$(XML_BUILTIN) $(DEPFILES) $(LIBOBJS)
GDBREPLAY_OBS = gdbreplay.o version.o
GDBSERVER_LIBS = @GDBSERVER_LIBS@
waitstatus.o: ../target/waitstatus.c
$(COMPILE) $<
$(POSTCOMPILE)
-common-remote-fileio.o: ../common/common-remote-fileio.c
+fileio.o: ../common/fileio.c
$(COMPILE) $<
$(POSTCOMPILE)
on top of errno. */
#include "server.h"
-#include "common-remote-fileio.h"
+#include "fileio.h"
void
hostio_last_error_from_errno (char *buf)
{
int error = errno;
- int fileio_error = remote_fileio_to_fio_error (error);
+ int fileio_error = host_to_fileio_error (error);
sprintf (buf, "F-1,%x", fileio_error);
}
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include "common-remote-fileio.h"
+#include "fileio.h"
extern int remote_debug;
return;
}
- remote_fileio_to_fio_stat (&st, &fst);
+ host_to_fileio_stat (&st, &fst);
bytes_sent = hostio_reply_with_data (own_buf,
(char *) &fst, sizeof (fst),
#include "inferior.h"
#include <sys/stat.h>
#include "inf-child.h"
-#include "common-remote-fileio.h"
+#include "fileio.h"
#include "agent.h"
#include "gdb_wait.h"
#include "filestuff.h"
the standard values. */
fd = gdb_open_cloexec (filename, nat_flags, mode);
if (fd == -1)
- *target_errno = remote_fileio_to_fio_error (errno);
+ *target_errno = host_to_fileio_error (errno);
return fd;
}
}
if (ret == -1)
- *target_errno = remote_fileio_to_fio_error (errno);
+ *target_errno = host_to_fileio_error (errno);
return ret;
}
}
if (ret == -1)
- *target_errno = remote_fileio_to_fio_error (errno);
+ *target_errno = host_to_fileio_error (errno);
return ret;
}
ret = fstat (fd, sb);
if (ret == -1)
- *target_errno = remote_fileio_to_fio_error (errno);
+ *target_errno = host_to_fileio_error (errno);
return ret;
}
ret = close (fd);
if (ret == -1)
- *target_errno = remote_fileio_to_fio_error (errno);
+ *target_errno = host_to_fileio_error (errno);
return ret;
}
ret = unlink (filename);
if (ret == -1)
- *target_errno = remote_fileio_to_fio_error (errno);
+ *target_errno = host_to_fileio_error (errno);
return ret;
}
len = readlink (filename, buf, sizeof buf);
if (len < 0)
{
- *target_errno = remote_fileio_to_fio_error (errno);
+ *target_errno = host_to_fileio_error (errno);
return NULL;
}
static void
remote_fileio_to_fio_long (LONGEST num, fio_long_t fnum)
{
- remote_fileio_to_be (num, (char *) fnum, 8);
+ host_to_bigendian (num, (char *) fnum, 8);
}
static void
remote_fileio_to_fio_timeval (struct timeval *tv, struct fio_timeval *ftv)
{
- remote_fileio_to_fio_time (tv->tv_sec, ftv->ftv_sec);
+ host_to_fileio_time (tv->tv_sec, ftv->ftv_sec);
remote_fileio_to_fio_long (tv->tv_usec, ftv->ftv_usec);
}
remote_fileio_return_errno (int retcode)
{
remote_fileio_reply (retcode, retcode < 0
- ? remote_fileio_to_fio_error (errno) : 0);
+ ? host_to_fileio_error (errno) : 0);
}
static void
}
if (statptr)
{
- remote_fileio_to_fio_stat (&st, &fst);
- remote_fileio_to_fio_uint (0, fst.fst_dev);
+ host_to_fileio_stat (&st, &fst);
+ host_to_fileio_uint (0, fst.fst_dev);
errno = target_write_memory (statptr, (gdb_byte *) &fst, sizeof fst);
if (errno != 0)
remote_fio_no_longjmp = 1;
if (fd == FIO_FD_CONSOLE_IN || fd == FIO_FD_CONSOLE_OUT)
{
- remote_fileio_to_fio_uint (1, fst.fst_dev);
+ host_to_fileio_uint (1, fst.fst_dev);
memset (&st, 0, sizeof (st));
st.st_mode = S_IFCHR | (fd == FIO_FD_CONSOLE_IN ? S_IRUSR : S_IWUSR);
st.st_nlink = 1;
}
if (ptrval)
{
- remote_fileio_to_fio_stat (&st, &fst);
+ host_to_fileio_stat (&st, &fst);
errno = target_write_memory (ptrval, (gdb_byte *) &fst, sizeof fst);
if (errno != 0)
#ifndef REMOTE_FILEIO_H
#define REMOTE_FILEIO_H
-#include "common-remote-fileio.h"
+#include "fileio.h"
struct cmd_list_element;