diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2020-07-15 19:35:58 +0000 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2020-09-11 14:35:32 -0300 |
commit | 04986243d1af37ac0177ed2f9db0a066ebd2b212 (patch) | |
tree | 87b9cebcc14f51dd0cf4103be16fc26542b65c69 /io | |
parent | 23159962159038891d3211c5632c3900d465f0c7 (diff) | |
download | glibc-04986243d1af37ac0177ed2f9db0a066ebd2b212.zip glibc-04986243d1af37ac0177ed2f9db0a066ebd2b212.tar.gz glibc-04986243d1af37ac0177ed2f9db0a066ebd2b212.tar.bz2 |
Remove internal usage of extensible stat functions
It replaces the internal usage of __{f,l}xstat{at}{64} with the
__{f,l}stat{at}{64}. It should not change the generate code since
sys/stat.h explicit defines redirections to internal calls back to
xstat* symbols.
Checked with a build for all affected ABIs. I also check on
x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Diffstat (limited to 'io')
-rw-r--r-- | io/file_change_detection.c | 4 | ||||
-rw-r--r-- | io/fts.c | 15 | ||||
-rw-r--r-- | io/fts64.c | 5 | ||||
-rw-r--r-- | io/ftw.c | 46 | ||||
-rw-r--r-- | io/ftw64.c | 8 | ||||
-rw-r--r-- | io/getdirname.c | 4 | ||||
-rw-r--r-- | io/mkdirat.c | 2 | ||||
-rw-r--r-- | io/mkfifoat.c | 2 | ||||
-rw-r--r-- | io/openat.c | 2 | ||||
-rw-r--r-- | io/openat64.c | 2 | ||||
-rw-r--r-- | io/xmknodat.c | 2 |
11 files changed, 47 insertions, 45 deletions
diff --git a/io/file_change_detection.c b/io/file_change_detection.c index c6d700e..f52d8fe 100644 --- a/io/file_change_detection.c +++ b/io/file_change_detection.c @@ -67,7 +67,7 @@ __file_change_detection_for_path (struct file_change_detection *file, const char *path) { struct stat64 st; - if (stat64 (path, &st) != 0) + if (__stat64 (path, &st) != 0) switch (errno) { case EACCES: @@ -105,7 +105,7 @@ __file_change_detection_for_fp (struct file_change_detection *file, else { struct stat64 st; - if (fstat64 (__fileno (fp), &st) != 0) + if (__fstat64 (__fileno (fp), &st) != 0) /* If we already have a file descriptor, all errors are fatal. */ return false; else @@ -81,8 +81,9 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; # define FTSOBJ FTS # define FTSENTRY FTSENT # define INO_T ino_t -# define STAT stat -# define LSTAT lstat +# define STRUCT_STAT stat +# define STAT __stat +# define LSTAT __lstat #endif static FTSENTRY *fts_alloc (FTSOBJ *, const char *, size_t); @@ -872,7 +873,7 @@ fts_stat (FTSOBJ *sp, FTSENTRY *p, int follow) FTSENTRY *t; dev_t dev; INO_T ino; - struct STAT *sbp, sb; + struct STRUCT_STAT *sbp, sb; int saved_errno; /* If user needs stat info, stat buffer already allocated. */ @@ -906,7 +907,7 @@ fts_stat (FTSOBJ *sp, FTSENTRY *p, int follow) } } else if (LSTAT(p->fts_accpath, sbp)) { p->fts_errno = errno; -err: memset(sbp, 0, sizeof(struct STAT)); +err: memset(sbp, 0, sizeof(struct STRUCT_STAT)); return (FTS_NS); } @@ -996,7 +997,7 @@ fts_alloc (FTSOBJ *sp, const char *name, size_t namelen) */ len = sizeof(FTSENTRY) + namelen; if (!ISSET(FTS_NOSTAT)) - len += sizeof(struct STAT) + ALIGNBYTES; + len += sizeof(struct STRUCT_STAT) + ALIGNBYTES; if ((p = malloc(len)) == NULL) return (NULL); @@ -1005,7 +1006,7 @@ fts_alloc (FTSOBJ *sp, const char *name, size_t namelen) p->fts_name[namelen] = '\0'; if (!ISSET(FTS_NOSTAT)) - p->fts_statp = (struct STAT *)ALIGN(p->fts_name + namelen + 2); + p->fts_statp = (struct STRUCT_STAT *)ALIGN(p->fts_name + namelen + 2); p->fts_namelen = namelen; p->fts_path = sp->fts_path; p->fts_errno = 0; @@ -1116,7 +1117,7 @@ fts_safe_changedir (FTSOBJ *sp, FTSENTRY *p, int fd, const char *path) return (0); if (fd < 0 && (newfd = __open(path, O_RDONLY, 0)) < 0) return (-1); - if (__fxstat64(_STAT_VER, newfd, &sb)) { + if (__fstat64(newfd, &sb)) { ret = -1; goto bail; } @@ -24,7 +24,8 @@ #define FTSOBJ FTS64 #define FTSENTRY FTSENT64 #define INO_T ino64_t -#define STAT stat64 -#define LSTAT lstat64 +#define STRUCT_STAT stat64 +#define STAT __stat64 +#define LSTAT __lstat64 #include "fts.c" @@ -135,15 +135,15 @@ int rpl_lstat (const char *, struct stat *); # define NFTW_OLD_NAME __old_nftw # define NFTW_NEW_NAME __new_nftw # define INO_T ino_t -# define STAT stat +# define STRUCT_STAT stat # ifdef _LIBC -# define LXSTAT __lxstat -# define XSTAT __xstat -# define FXSTATAT __fxstatat +# define LSTAT __lstat +# define STAT __stat +# define FSTATAT __fstatat # else -# define LXSTAT(V,f,sb) lstat (f,sb) -# define XSTAT(V,f,sb) stat (f,sb) -# define FXSTATAT(V,d,f,sb,m) fstatat (d, f, sb, m) +# define LSTAT lstat +# define XTAT stat +# define FSTATAT fstatat # endif # define FTW_FUNC_T __ftw_func_t # define NFTW_FUNC_T __nftw_func_t @@ -219,7 +219,7 @@ static const int ftw_arr[] = /* Forward declarations of local functions. */ -static int ftw_dir (struct ftw_data *data, struct STAT *st, +static int ftw_dir (struct ftw_data *data, struct STRUCT_STAT *st, struct dir_data *old_dir); @@ -239,7 +239,7 @@ object_compare (const void *p1, const void *p2) static int -add_object (struct ftw_data *data, struct STAT *st) +add_object (struct ftw_data *data, struct STRUCT_STAT *st) { struct known_object *newp = malloc (sizeof (struct known_object)); if (newp == NULL) @@ -251,7 +251,7 @@ add_object (struct ftw_data *data, struct STAT *st) static inline int -find_object (struct ftw_data *data, struct STAT *st) +find_object (struct ftw_data *data, struct STRUCT_STAT *st) { struct known_object obj; obj.dev = st->st_dev; @@ -378,7 +378,7 @@ static int process_entry (struct ftw_data *data, struct dir_data *dir, const char *name, size_t namlen, int d_type) { - struct STAT st; + struct STRUCT_STAT st; int result = 0; int flag = 0; size_t new_buflen; @@ -405,16 +405,16 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name, int statres; if (dir->streamfd != -1) - statres = FXSTATAT (_STAT_VER, dir->streamfd, name, &st, - (data->flags & FTW_PHYS) ? AT_SYMLINK_NOFOLLOW : 0); + statres = FSTATAT (dir->streamfd, name, &st, + (data->flags & FTW_PHYS) ? AT_SYMLINK_NOFOLLOW : 0); else { if ((data->flags & FTW_CHDIR) == 0) name = data->dirbuf; statres = ((data->flags & FTW_PHYS) - ? LXSTAT (_STAT_VER, name, &st) - : XSTAT (_STAT_VER, name, &st)); + ? LSTAT (name, &st) + : STAT (name, &st)); } if (statres < 0) @@ -430,10 +430,10 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name, it should contain information about the link (ala lstat). We do our best to fill in what data we can. */ if (dir->streamfd != -1) - statres = FXSTATAT (_STAT_VER, dir->streamfd, name, &st, - AT_SYMLINK_NOFOLLOW); + statres = FSTATAT (dir->streamfd, name, &st, + AT_SYMLINK_NOFOLLOW); else - statres = LXSTAT (_STAT_VER, name, &st); + statres = LSTAT (name, &st); if (statres == 0 && S_ISLNK (st.st_mode)) flag = FTW_SLN; else @@ -476,7 +476,7 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name, static int __attribute ((noinline)) -ftw_dir (struct ftw_data *data, struct STAT *st, struct dir_data *old_dir) +ftw_dir (struct ftw_data *data, struct STRUCT_STAT *st, struct dir_data *old_dir) { struct dir_data dir; struct dirent64 *d; @@ -630,7 +630,7 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, int flags) { struct ftw_data data; - struct STAT st; + struct STRUCT_STAT st; int result = 0; int save_err; int cwdfd = -1; @@ -740,12 +740,12 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, name = data.dirbuf; if (((flags & FTW_PHYS) - ? LXSTAT (_STAT_VER, name, &st) - : XSTAT (_STAT_VER, name, &st)) < 0) + ? LSTAT (name, &st) + : STAT (name, &st)) < 0) { if (!(flags & FTW_PHYS) && errno == ENOENT - && LXSTAT (_STAT_VER, name, &st) == 0 + && LSTAT (name, &st) == 0 && S_ISLNK (st.st_mode)) result = (*data.func) (data.dirbuf, &st, data.cvt_arr[FTW_SLN], &data.ftw); @@ -22,10 +22,10 @@ #define NFTW_OLD_NAME __old_nftw64 #define NFTW_NEW_NAME __new_nftw64 #define INO_T ino64_t -#define STAT stat64 -#define LXSTAT __lxstat64 -#define XSTAT __xstat64 -#define FXSTATAT __fxstatat64 +#define STRUCT_STAT stat64 +#define LSTAT __lstat64 +#define STAT __stat64 +#define FSTATAT __fstatat64 #define FTW_FUNC_T __ftw64_func_t #define NFTW_FUNC_T __nftw64_func_t diff --git a/io/getdirname.c b/io/getdirname.c index dd69e4e..2465b62 100644 --- a/io/getdirname.c +++ b/io/getdirname.c @@ -32,8 +32,8 @@ get_current_dir_name (void) pwd = getenv ("PWD"); if (pwd != NULL - && stat64 (".", &dotstat) == 0 - && stat64 (pwd, &pwdstat) == 0 + && __stat64 (".", &dotstat) == 0 + && __stat64 (pwd, &pwdstat) == 0 && pwdstat.st_dev == dotstat.st_dev && pwdstat.st_ino == dotstat.st_ino) /* The PWD value is correct. Use it. */ diff --git a/io/mkdirat.c b/io/mkdirat.c index cfe01b5..094f0d7 100644 --- a/io/mkdirat.c +++ b/io/mkdirat.c @@ -36,7 +36,7 @@ mkdirat (int fd, const char *path, mode_t mode) { /* Check FD is associated with a directory. */ struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) != 0) + if (__fstat64 (fd, &st) != 0) return -1; if (!S_ISDIR (st.st_mode)) diff --git a/io/mkfifoat.c b/io/mkfifoat.c index 409f551..f2af653 100644 --- a/io/mkfifoat.c +++ b/io/mkfifoat.c @@ -37,7 +37,7 @@ mkfifoat (int fd, const char *path, mode_t mode) { /* Check FD is associated with a directory. */ struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) != 0) + if (__fstat64 (fd, &st) != 0) return -1; if (!S_ISDIR (st.st_mode)) diff --git a/io/openat.c b/io/openat.c index 2f5a9f0..d810ace 100644 --- a/io/openat.c +++ b/io/openat.c @@ -42,7 +42,7 @@ __openat (int fd, const char *file, int oflag, ...) { /* Check FD is associated with a directory. */ struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) != 0) + if (__fstat64 (fd, &st) != 0) return -1; if (!S_ISDIR (st.st_mode)) diff --git a/io/openat64.c b/io/openat64.c index b66979c..a4bb188 100644 --- a/io/openat64.c +++ b/io/openat64.c @@ -40,7 +40,7 @@ __openat64 (int fd, const char *file, int oflag, ...) { /* Check FD is associated with a directory. */ struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) != 0) + if (__fstat64 (fd, &st) != 0) return -1; if (!S_ISDIR (st.st_mode)) diff --git a/io/xmknodat.c b/io/xmknodat.c index 0e69db1..b6c6681 100644 --- a/io/xmknodat.c +++ b/io/xmknodat.c @@ -44,7 +44,7 @@ __xmknodat (int vers, int fd, const char *path, mode_t mode, dev_t *dev) { /* Check FD is associated with a directory. */ struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) != 0) + if (__fstat64 (fd, &st) != 0) return -1; if (!S_ISDIR (st.st_mode)) |