public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Steve Ellcey <sellcey@cavium.com>
To: libc-alpha@sourceware.org
Subject: [PATCH] Allow [f]statfs64 to alias [f]statfs
Date: Mon, 07 Nov 2016 22:13:00 -0000	[thread overview]
Message-ID: <201611072213.uA7MDcpB020773@sellcey-lt.caveonetworks.com> (raw)

This is a preparatory patch for the ILP32 aarch64 patch.  On that system
statfs and fstatfs will match statfs64 and fstatfs64.  So this patch
follows what was already done for xstat and fxstat in making the 64
bit entry points aliases of the regular versions.  Right now this will
not affect any existing platform because none of them define
STATFS_IS_STATFS64 but aarch64 will define this later.

My main question is, is this an OK use of '#ifdef' or should the
STATFS_IS_STATFS64 be defined on all platforms (presumably in kernel_stat.h)
so that we can check the value instead of checking to see it is defined
or not?  I know that we want to move in that direction but I wasn't
sure if I should include that change in this patch or not.  I also wasn't
sure if I should try to change how XSTAT_IS_XSTAT64 or STAT_IS_KERNEL_STAT
are used.

There are 13 kernel_stat.h files in the glibc source tree, in addition
to a number of _HAVE_* macros, some of them define XSTAT_IS_XSTAT64
and some define STAT_IS_KERNEL_STAT.  Those are the only defines
in those files right now.  So the magnitude of the change isn't too large
if we do want to define those two macros everywhere.

I tested this patch on x86 to make sure nothing broke and I tested with
the full ILP32 aarch64 patch to make sure this part of the patch worked
with the rest of the ILP32 changes.

Is the patch OK like this or should it be redone?

Steve Ellcey
sellcey@caviumnetworks.com


2016-11-07  Steve Ellcey  <sellcey@caviumnetworks.com>

	* sysdeps/unix/sysv/linux/fstatfs64.c: Make __fstatfs and fstatfs
	aliases of __fstatfs64 if __STATFS_IS_STATFS64 is set.
	* sysdeps/unix/sysv/linux/statfs64.c: Ditto for __statfs, statfs,
	and __statfs64.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/fstatfs.c: Do not
	define __fstatfs and fstatfs if __STATFS_IS_STATFS64 is set.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/statfs.c: Ditto
	for __statfs and statfs.


diff --git a/sysdeps/unix/sysv/linux/fstatfs64.c b/sysdeps/unix/sysv/linux/fstatfs64.c
index a624de6..ac11fff 100644
--- a/sysdeps/unix/sysv/linux/fstatfs64.c
+++ b/sysdeps/unix/sysv/linux/fstatfs64.c
@@ -70,3 +70,8 @@ __fstatfs64 (int fd, struct statfs64 *buf)
 #endif
 }
 weak_alias (__fstatfs64, fstatfs64)
+
+#ifdef STATFS_IS_STATFS64
+weak_alias (__fstatfs64, __fstatfs)
+weak_alias (__fstatfs64, fstatfs)
+#endif
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/fstatfs.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/fstatfs.c
index be9599a..e41afb9 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/fstatfs.c
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/fstatfs.c
@@ -20,6 +20,7 @@
 #include <sys/statfs.h>
 #include <stddef.h>
 
+#ifndef STATFS_IS_STATFS64
 #include "overflow.h"
 
 /* Return information about the filesystem on which FD resides.  */
@@ -30,3 +31,4 @@ __fstatfs (int fd, struct statfs *buf)
   return rc ?: statfs_overflow (buf);
 }
 weak_alias (__fstatfs, fstatfs)
+#endif
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/statfs.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/statfs.c
index 1937f05..a7f9187 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/statfs.c
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/statfs.c
@@ -20,6 +20,7 @@
 #include <sys/statfs.h>
 #include <stddef.h>
 
+#ifndef STATFS_IS_STATFS64
 #include "overflow.h"
 
 /* Return information about the filesystem on which FILE resides.  */
@@ -31,3 +32,4 @@ __statfs (const char *file, struct statfs *buf)
 }
 libc_hidden_def (__statfs)
 weak_alias (__statfs, statfs)
+#endif
diff --git a/sysdeps/unix/sysv/linux/statfs64.c b/sysdeps/unix/sysv/linux/statfs64.c
index de42261..c75d4cf 100644
--- a/sysdeps/unix/sysv/linux/statfs64.c
+++ b/sysdeps/unix/sysv/linux/statfs64.c
@@ -72,3 +72,9 @@ __statfs64 (const char *file, struct statfs64 *buf)
 #endif
 }
 weak_alias (__statfs64, statfs64)
+
+#ifdef STATFS_IS_STATFS64
+weak_alias (__statfs64, __statfs)
+weak_alias (__statfs64, statfs)
+libc_hidden_ver (__statfs64, __statfs)
+#endif

             reply	other threads:[~2016-11-07 22:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-07 22:13 Steve Ellcey [this message]
2016-11-09 21:21 ` Steve Ellcey
2016-11-16 22:55   ` Steve Ellcey
2016-11-17  8:53 ` Andreas Schwab
2016-11-17 18:34   ` Steve Ellcey
2016-11-21 18:07   ` Steve Ellcey
2016-11-22 13:16     ` Andreas Schwab
2016-11-23  1:20     ` Joseph Myers
2016-11-23 16:23       ` Steve Ellcey

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=201611072213.uA7MDcpB020773@sellcey-lt.caveonetworks.com \
    --to=sellcey@cavium.com \
    --cc=libc-alpha@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).