Adjust nios2 and m68k semihosting for sys/stat.h changes.

Message ID 20190901235201.10239-1-sandra@codesourcery.com
State New
Headers show
Series
  • Adjust nios2 and m68k semihosting for sys/stat.h changes.
Related show

Commit Message

Sandra Loosemore Sept. 1, 2019, 11:52 p.m.
Commit 72ff9acad2ab54e80a19ddaec0106065c817e3f6 caused st_atime,
st_ctime, and st_mtime to be defined as macros.  This collided with use of
these identifiers as field names in struct gdb_stat (which represents
the GDB RSP encoding of struct stat) in libgloss semihosting support for
nios2 and m68k.  This patch renames all the fields of struct gdb_stat.

Signed-off-by: Sandra Loosemore <sandra@codesourcery.com>

---
 libgloss/m68k/io-gdb.c  | 26 +++++++++++++-------------
 libgloss/m68k/io.h      | 26 +++++++++++++-------------
 libgloss/nios2/io-gdb.c | 26 +++++++++++++-------------
 libgloss/nios2/io.h     | 26 +++++++++++++-------------
 4 files changed, 52 insertions(+), 52 deletions(-)

-- 
2.8.1

Comments

Corinna Vinschen Sept. 2, 2019, 8:36 a.m. | #1
Hi Sandra,

On Sep  1 17:52, Sandra Loosemore wrote:
> Commit 72ff9acad2ab54e80a19ddaec0106065c817e3f6 caused st_atime,

> st_ctime, and st_mtime to be defined as macros.  This collided with use of

> these identifiers as field names in struct gdb_stat (which represents

> the GDB RSP encoding of struct stat) in libgloss semihosting support for

> nios2 and m68k.  This patch renames all the fields of struct gdb_stat.


Commit d0651704411d fixes this by only renaming the st_Xtime fields
in struct gdb_stat to st_Xtim.  Maybe that's an option for you, too?
Otherwise we have multiple different names in an otherwise identical
struct...


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
Sandra Loosemore Sept. 3, 2019, 3:28 p.m. | #2
On 9/2/19 2:36 AM, Corinna Vinschen wrote:
> Hi Sandra,

> 

> On Sep  1 17:52, Sandra Loosemore wrote:

>> Commit 72ff9acad2ab54e80a19ddaec0106065c817e3f6 caused st_atime,

>> st_ctime, and st_mtime to be defined as macros.  This collided with use of

>> these identifiers as field names in struct gdb_stat (which represents

>> the GDB RSP encoding of struct stat) in libgloss semihosting support for

>> nios2 and m68k.  This patch renames all the fields of struct gdb_stat.

> 

> Commit d0651704411d fixes this by only renaming the st_Xtime fields

> in struct gdb_stat to st_Xtim.  Maybe that's an option for you, too?

> Otherwise we have multiple different names in an otherwise identical

> struct...


OK, that works too.  I'll post a V2 patch shortly.

-Sandra

Patch

diff --git a/libgloss/m68k/io-gdb.c b/libgloss/m68k/io-gdb.c
index 4f16b2f..1965ccc 100644
--- a/libgloss/m68k/io-gdb.c
+++ b/libgloss/m68k/io-gdb.c
@@ -84,19 +84,19 @@  void
 __hosted_from_gdb_stat (const struct gdb_stat *gs,
 			struct stat *s)
 {
-  s->st_dev = gs->st_dev;
-  s->st_ino = gs->st_ino;
-  s->st_mode = gs->st_mode;
-  s->st_nlink = gs->st_nlink;
-  s->st_uid = gs->st_uid;
-  s->st_gid = gs->st_gid;
-  s->st_rdev = gs->st_rdev;
-  s->st_size = gs->st_size;
-  s->st_blksize = gs->st_blksize;
-  s->st_blocks = gs->st_blocks;
-  s->st_atime = gs->st_atime;
-  s->st_mtime = gs->st_mtime;
-  s->st_ctime = gs->st_ctime;
+  s->st_dev = gs->gdb_st_dev;
+  s->st_ino = gs->gdb_st_ino;
+  s->st_mode = gs->gdb_st_mode;
+  s->st_nlink = gs->gdb_st_nlink;
+  s->st_uid = gs->gdb_st_uid;
+  s->st_gid = gs->gdb_st_gid;
+  s->st_rdev = gs->gdb_st_rdev;
+  s->st_size = gs->gdb_st_size;
+  s->st_blksize = gs->gdb_st_blksize;
+  s->st_blocks = gs->gdb_st_blocks;
+  s->st_atime = gs->gdb_st_atime;
+  s->st_mtime = gs->gdb_st_mtime;
+  s->st_ctime = gs->gdb_st_ctime;
 }
 
 void
diff --git a/libgloss/m68k/io.h b/libgloss/m68k/io.h
index b6b2287..998eb7c 100644
--- a/libgloss/m68k/io.h
+++ b/libgloss/m68k/io.h
@@ -48,19 +48,19 @@  typedef uint32_t gdb_mode_t;
 typedef uint32_t gdb_time_t;
 
 struct gdb_stat {
-  uint32_t    st_dev;     /* device */
-  uint32_t    st_ino;     /* inode */
-  gdb_mode_t  st_mode;    /* protection */
-  uint32_t    st_nlink;   /* number of hard links */
-  uint32_t    st_uid;     /* user ID of owner */
-  uint32_t    st_gid;     /* group ID of owner */
-  uint32_t    st_rdev;    /* device type (if inode device) */
-  uint64_t    st_size;    /* total size, in bytes */
-  uint64_t    st_blksize; /* blocksize for filesystem I/O */
-  uint64_t    st_blocks;  /* number of blocks allocated */
-  gdb_time_t  st_atime;   /* time of last access */
-  gdb_time_t  st_mtime;   /* time of last modification */
-  gdb_time_t  st_ctime;   /* time of last change */
+  uint32_t    gdb_st_dev;     /* device */
+  uint32_t    gdb_st_ino;     /* inode */
+  gdb_mode_t  gdb_st_mode;    /* protection */
+  uint32_t    gdb_st_nlink;   /* number of hard links */
+  uint32_t    gdb_st_uid;     /* user ID of owner */
+  uint32_t    gdb_st_gid;     /* group ID of owner */
+  uint32_t    gdb_st_rdev;    /* device type (if inode device) */
+  uint64_t    gdb_st_size;    /* total size, in bytes */
+  uint64_t    gdb_st_blksize; /* blocksize for filesystem I/O */
+  uint64_t    gdb_st_blocks;  /* number of blocks allocated */
+  gdb_time_t  gdb_st_atime;   /* time of last access */
+  gdb_time_t  gdb_st_mtime;   /* time of last modification */
+  gdb_time_t  gdb_st_ctime;   /* time of last change */
 };
 
 struct gdb_timeval {
diff --git a/libgloss/nios2/io-gdb.c b/libgloss/nios2/io-gdb.c
index ee58559..9051db4 100644
--- a/libgloss/nios2/io-gdb.c
+++ b/libgloss/nios2/io-gdb.c
@@ -96,19 +96,19 @@  void
 __hosted_from_gdb_stat (const struct gdb_stat *gs,
 			struct stat *s)
 {
-  s->st_dev = SWAP32 (gs->st_dev);
-  s->st_ino = SWAP32 (gs->st_ino);
-  s->st_mode = SWAP32 (gs->st_mode);
-  s->st_nlink = SWAP32 (gs->st_nlink);
-  s->st_uid = SWAP32 (gs->st_uid);
-  s->st_gid = SWAP32 (gs->st_gid);
-  s->st_rdev = SWAP32 (gs->st_rdev);
-  s->st_size = SWAP64 (gs->st_size);
-  s->st_blksize = SWAP64 (gs->st_blksize);
-  s->st_blocks = SWAP64 (gs->st_blocks);
-  s->st_atime = SWAP32 (gs->st_atime);
-  s->st_mtime = SWAP32 (gs->st_mtime);
-  s->st_ctime = SWAP32 (gs->st_ctime);
+  s->st_dev = SWAP32 (gs->gdb_st_dev);
+  s->st_ino = SWAP32 (gs->gdb_st_ino);
+  s->st_mode = SWAP32 (gs->gdb_st_mode);
+  s->st_nlink = SWAP32 (gs->gdb_st_nlink);
+  s->st_uid = SWAP32 (gs->gdb_st_uid);
+  s->st_gid = SWAP32 (gs->gdb_st_gid);
+  s->st_rdev = SWAP32 (gs->gdb_st_rdev);
+  s->st_size = SWAP64 (gs->gdb_st_size);
+  s->st_blksize = SWAP64 (gs->gdb_st_blksize);
+  s->st_blocks = SWAP64 (gs->gdb_st_blocks);
+  s->st_atime = SWAP32 (gs->gdb_st_atime);
+  s->st_mtime = SWAP32 (gs->gdb_st_mtime);
+  s->st_ctime = SWAP32 (gs->gdb_st_ctime);
 }
 
 void
diff --git a/libgloss/nios2/io.h b/libgloss/nios2/io.h
index e118435..7343e7e 100644
--- a/libgloss/nios2/io.h
+++ b/libgloss/nios2/io.h
@@ -47,19 +47,19 @@  typedef uint32_t gdb_mode_t;
 typedef uint32_t gdb_time_t;
 
 struct gdb_stat {
-  uint32_t    st_dev;     /* device */
-  uint32_t    st_ino;     /* inode */
-  gdb_mode_t  st_mode;    /* protection */
-  uint32_t    st_nlink;   /* number of hard links */
-  uint32_t    st_uid;     /* user ID of owner */
-  uint32_t    st_gid;     /* group ID of owner */
-  uint32_t    st_rdev;    /* device type (if inode device) */
-  uint64_t    st_size;    /* total size, in bytes */
-  uint64_t    st_blksize; /* blocksize for filesystem I/O */
-  uint64_t    st_blocks;  /* number of blocks allocated */
-  gdb_time_t  st_atime;   /* time of last access */
-  gdb_time_t  st_mtime;   /* time of last modification */
-  gdb_time_t  st_ctime;   /* time of last change */
+  uint32_t    gdb_st_dev;     /* device */
+  uint32_t    gdb_st_ino;     /* inode */
+  gdb_mode_t  gdb_st_mode;    /* protection */
+  uint32_t    gdb_st_nlink;   /* number of hard links */
+  uint32_t    gdb_st_uid;     /* user ID of owner */
+  uint32_t    gdb_st_gid;     /* group ID of owner */
+  uint32_t    gdb_st_rdev;    /* device type (if inode device) */
+  uint64_t    gdb_st_size;    /* total size, in bytes */
+  uint64_t    gdb_st_blksize; /* blocksize for filesystem I/O */
+  uint64_t    gdb_st_blocks;  /* number of blocks allocated */
+  gdb_time_t  gdb_st_atime;   /* time of last access */
+  gdb_time_t  gdb_st_mtime;   /* time of last modification */
+  gdb_time_t  gdb_st_ctime;   /* time of last change */
 };
 
 struct gdb_timeval {