Clean up {alphasort,versionsort,scandir,scandirat}{,64} for struct dirent == struct dirent64.

This commit is contained in:
Roland McGrath 2012-08-06 16:47:58 -07:00
parent 03af952060
commit 8e49df1d65
34 changed files with 153 additions and 51 deletions

View File

@ -1,5 +1,48 @@
2012-08-06 Roland McGrath <roland@hack.frob.com> 2012-08-06 Roland McGrath <roland@hack.frob.com>
* dirent/alphasort.c [_DIRENT_MATCHES_DIRENT64]:
Define alphasort64 as an alias.
* dirent/versionsort.c [_DIRENT_MATCHES_DIRENT64]:
Define versionsort64 as an alias.
* dirent/scandir.c [_DIRENT_MATCHES_DIRENT64]:
Define scandir64 as an alias.
* dirent/scandirat.c [_DIRENT_MATCHES_DIRENT64]:
Define scandirat64 as an alias.
* dirent/alphasort64.c (alphasort64):
Conditionalize on [!_DIRENT_MATCHES_DIRENT64].
* dirent/versionsort64.c: Likewise.
* dirent/scandir64.c: Likewise.
* dirent/scandirat64.c: Likewise.
* sysdeps/wordsize-64/alphasort.c: File removed.
* sysdeps/wordsize-64/alphasort64.c: File removed.
* sysdeps/wordsize-64/scandir.c: File removed.
* sysdeps/wordsize-64/scandir64.c: File removed.
* sysdeps/wordsize-64/scandirat.c: File removed.
* sysdeps/wordsize-64/scandirat64.c: File removed.
* sysdeps/wordsize-64/versionsort.c: File removed.
* sysdeps/wordsize-64/versionsort64.c: File removed.
* sysdeps/unix/sysv/linux/x86_64/x32/alphasort.c: File removed.
* sysdeps/unix/sysv/linux/x86_64/x32/alphasort64.c: File removed.
* sysdeps/unix/sysv/linux/x86_64/x32/scandir.c: File removed.
* sysdeps/unix/sysv/linux/x86_64/x32/scandir64.c: File removed.
* sysdeps/unix/sysv/linux/x86_64/x32/scandirat.c: File removed.
* sysdeps/unix/sysv/linux/x86_64/x32/scandirat64.c: File removed.
* sysdeps/unix/sysv/linux/x86_64/x32/versionsort.c: File removed.
* sysdeps/unix/sysv/linux/x86_64/x32/versionsort64.c: File removed.
* bits/typesizes.h [__LP64__] (__INO_T_MATCHES_INO64_T): New macros.
* sysdeps/unix/sysv/linux/s390/bits/typesizes.h:
[__s390x__] (__INO_T_MATCHES_INO64_T): New macro.
* sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
[defined __arch64__ || defined __sparcv9]
(__INO_T_MATCHES_INO64_T): New macro.
* sysdeps/unix/sysv/linux/x86/bits/typesizes.h
[__x86_64__] (__INO_T_MATCHES_INO64_T): New macro.
* bits/dirent.h (_DIRENT_MATCHES_DIRENT64): New macro.
* sysdeps/unix/sysv/linux/bits/dirent.h
[defined __OFF_T_MATCHES_OFF64_T && defined __INO_T_MATCHES_INO64_T]
(_DIRENT_MATCHES_DIRENT64): New macro.
* io/lockf.c [__OFF_T_MATCHES_OFF64_T]: * io/lockf.c [__OFF_T_MATCHES_OFF64_T]:
Define lockf64 as an alias. Define lockf64 as an alias.
* libio/fseeko.c [__OFF_T_MATCHES_OFF64_T]: * libio/fseeko.c [__OFF_T_MATCHES_OFF64_T]:

View File

@ -1,5 +1,5 @@
/* Directory entry structure `struct dirent'. Stub version. /* Directory entry structure `struct dirent'. Stub version.
Copyright (C) 1996, 1997 Free Software Foundation, Inc. Copyright (C) 1996-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -33,3 +33,6 @@ struct dirent64
int d_fileno; int d_fileno;
}; };
#endif #endif
/* Inform libc code that these two types are identical. */
#define _DIRENT_MATCHES_DIRENT64 1

View File

@ -66,6 +66,9 @@
for all ABI purposes, even if possibly expressed as different base types for all ABI purposes, even if possibly expressed as different base types
for C type-checking purposes. */ for C type-checking purposes. */
# define __OFF_T_MATCHES_OFF64_T 1 # define __OFF_T_MATCHES_OFF64_T 1
/* Same for ino_t and ino64_t. */
# define __INO_T_MATCHES_INO64_T 1
#endif #endif
/* Number of descriptors that can fit in an `fd_set'. */ /* Number of descriptors that can fit in an `fd_set'. */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992, 1997, 1998, 2009 Free Software Foundation, Inc. /* Copyright (C) 1992-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -15,7 +15,15 @@
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */ <http://www.gnu.org/licenses/>. */
/* We need to avoid the header declaration of alphasort64, because
the types don't match alphasort and then the compiler will
complain about the mismatch when we do the alias below. */
#define alphasort64 __renamed_alphasort64
#include <dirent.h> #include <dirent.h>
#undef alphasort64
#include <string.h> #include <string.h>
int int
@ -23,3 +31,7 @@ alphasort (const struct dirent **a, const struct dirent **b)
{ {
return strcoll ((*a)->d_name, (*b)->d_name); return strcoll ((*a)->d_name, (*b)->d_name);
} }
#ifdef _DIRENT_MATCHES_DIRENT64
weak_alias (alphasort, alphasort64)
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992, 1997, 1998, 2000, 2009 Free Software Foundation, Inc. /* Copyright (C) 1992-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -18,8 +18,13 @@
#include <dirent.h> #include <dirent.h>
#include <string.h> #include <string.h>
/* alphasort.c defines alphasort64 as an alias if _DIRENT_MATCHES_DIRENT64. */
#ifndef _DIRENT_MATCHES_DIRENT64
int int
alphasort64 (const struct dirent64 **a, const struct dirent64 **b) alphasort64 (const struct dirent64 **a, const struct dirent64 **b)
{ {
return strcoll ((*a)->d_name, (*b)->d_name); return strcoll ((*a)->d_name, (*b)->d_name);
} }
#endif

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1992-1998,2000,2002,2003,2009,2011 /* Copyright (C) 1992-2012 Free Software Foundation, Inc.
Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +15,15 @@
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */ <http://www.gnu.org/licenses/>. */
/* We need to avoid the header declaration of scandir64, because
the types don't match scandir and then the compiler will
complain about the mismatch when we do the alias below. */
#define scandir64 __renamed_scandir64
#include <dirent.h> #include <dirent.h>
#undef scandir64
#include <fcntl.h> #include <fcntl.h>
#ifndef SCANDIR #ifndef SCANDIR
@ -35,3 +42,7 @@ SCANDIR (dir, namelist, select, cmp)
{ {
return SCANDIRAT (AT_FDCWD, dir, namelist, select, cmp); return SCANDIRAT (AT_FDCWD, dir, namelist, select, cmp);
} }
#ifdef _DIRENT_MATCHES_DIRENT64
weak_alias (scandir, scandir64)
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000, 2009, 2011 Free Software Foundation, Inc. /* Copyright (C) 2000-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -17,8 +17,13 @@
#include <dirent.h> #include <dirent.h>
/* scandir.c defines scandir64 as an alias if _DIRENT_MATCHES_DIRENT64. */
#ifndef _DIRENT_MATCHES_DIRENT64
#define SCANDIR scandir64 #define SCANDIR scandir64
#define SCANDIRAT scandirat64 #define SCANDIRAT scandirat64
#define DIRENT_TYPE struct dirent64 #define DIRENT_TYPE struct dirent64
#include <dirent/scandir.c> #include <dirent/scandir.c>
#endif

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1992-1998,2000,2002,2003,2009,2011 /* Copyright (C) 1992-2012 Free Software Foundation, Inc.
Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +15,15 @@
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */ <http://www.gnu.org/licenses/>. */
/* We need to avoid the header declaration of scandir64, because
the types don't match scandir and then the compiler will
complain about the mismatch when we do the alias below. */
#define scandirat64 __renamed_scandirat64
#include <dirent.h> #include <dirent.h>
#undef scandirat64
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
@ -141,3 +148,7 @@ SCANDIRAT (dfd, dir, namelist, select, cmp)
return c.cnt; return c.cnt;
} }
libc_hidden_def (SCANDIRAT) libc_hidden_def (SCANDIRAT)
#ifdef _DIRENT_MATCHES_DIRENT64
weak_alias (scandirat, scandirat64)
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000, 2009, 2011 Free Software Foundation, Inc. /* Copyright (C) 2000-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -17,9 +17,14 @@
#include <dirent.h> #include <dirent.h>
/* scandirat.c defines scandirat64 as an alias if _DIRENT_MATCHES_DIRENT64. */
#ifndef _DIRENT_MATCHES_DIRENT64
#define SCANDIRAT scandirat64 #define SCANDIRAT scandirat64
#define READDIR __readdir64 #define READDIR __readdir64
#define DIRENT_TYPE struct dirent64 #define DIRENT_TYPE struct dirent64
#define SKIP_SCANDIR_CANCEL 1 #define SKIP_SCANDIR_CANCEL 1
#include "scandirat.c" #include "scandirat.c"
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992, 1997, 1998, 2009 Free Software Foundation, Inc. /* Copyright (C) 1992-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -15,7 +15,15 @@
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */ <http://www.gnu.org/licenses/>. */
/* We need to avoid the header declaration of versionsort64, because
the types don't match versionsort and then the compiler will
complain about the mismatch when we do the alias below. */
#define versionsort64 __renamed_versionsort64
#include <dirent.h> #include <dirent.h>
#undef versionsort64
#include <string.h> #include <string.h>
int int
@ -23,3 +31,7 @@ versionsort (const struct dirent **a, const struct dirent **b)
{ {
return __strverscmp ((*a)->d_name, (*b)->d_name); return __strverscmp ((*a)->d_name, (*b)->d_name);
} }
#ifdef _DIRENT_MATCHES_DIRENT64
weak_alias (versionsort, versionsort64)
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992, 1997, 1998, 2000, 2009 Free Software Foundation, Inc. /* Copyright (C) 1992-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -18,8 +18,13 @@
#include <dirent.h> #include <dirent.h>
#include <string.h> #include <string.h>
/* versionsort.c defines a versionsort64 alias if _DIRENT_MATCHES_DIRENT64. */
#ifndef _DIRENT_MATCHES_DIRENT64
int int
versionsort64 (const struct dirent64 **a, const struct dirent64 **b) versionsort64 (const struct dirent64 **a, const struct dirent64 **b)
{ {
return __strverscmp ((*a)->d_name, (*b)->d_name); return __strverscmp ((*a)->d_name, (*b)->d_name);
} }
#endif

View File

@ -1,3 +1,8 @@
2012-08-02 Roland McGrath <roland@hack.frob.com>
* sysdeps/unix/sysv/linux/alpha/bits/dirent.h
(_DIRENT_MATCHES_DIRENT64): New macro.
2012-08-02 Roland McGrath <roland@hack.frob.com> 2012-08-02 Roland McGrath <roland@hack.frob.com>
* sysdeps/unix/sysv/linux/alpha/bits/typesizes.h * sysdeps/unix/sysv/linux/alpha/bits/typesizes.h

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. /* Copyright (C) 1996-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -51,4 +51,7 @@ struct dirent64
#define _DIRENT_HAVE_D_OFF #define _DIRENT_HAVE_D_OFF
#define _DIRENT_HAVE_D_TYPE #define _DIRENT_HAVE_D_TYPE
/* Inform libc code that these two types are effectively identical. */
#define _DIRENT_MATCHES_DIRENT64 1
#endif /* bits/dirent.h */ #endif /* bits/dirent.h */

View File

@ -67,6 +67,9 @@
for all ABI purposes, even if possibly expressed as different base types for all ABI purposes, even if possibly expressed as different base types
for C type-checking purposes. */ for C type-checking purposes. */
# define __OFF_T_MATCHES_OFF64_T 1 # define __OFF_T_MATCHES_OFF64_T 1
/* Same for ino_t and ino64_t. */
# define __INO_T_MATCHES_INO64_T 1
#endif #endif
/* Number of descriptors that can fit in an `fd_set'. */ /* Number of descriptors that can fit in an `fd_set'. */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. /* Copyright (C) 1996-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -50,3 +50,8 @@ struct dirent64
#define _DIRENT_HAVE_D_RECLEN #define _DIRENT_HAVE_D_RECLEN
#define _DIRENT_HAVE_D_OFF #define _DIRENT_HAVE_D_OFF
#define _DIRENT_HAVE_D_TYPE #define _DIRENT_HAVE_D_TYPE
#if defined __OFF_T_MATCHES_OFF64_T && defined __INO_T_MATCHES_INO64_T
/* Inform libc code that these two types are effectively identical. */
# define _DIRENT_MATCHES_DIRENT64 1
#endif

View File

@ -72,6 +72,9 @@
for all ABI purposes, even if possibly expressed as different base types for all ABI purposes, even if possibly expressed as different base types
for C type-checking purposes. */ for C type-checking purposes. */
# define __OFF_T_MATCHES_OFF64_T 1 # define __OFF_T_MATCHES_OFF64_T 1
/* Same for ino_t and ino64_t. */
# define __INO_T_MATCHES_INO64_T 1
#endif #endif
/* Number of descriptors that can fit in an `fd_set'. */ /* Number of descriptors that can fit in an `fd_set'. */

View File

@ -66,6 +66,9 @@
for all ABI purposes, even if possibly expressed as different base types for all ABI purposes, even if possibly expressed as different base types
for C type-checking purposes. */ for C type-checking purposes. */
# define __OFF_T_MATCHES_OFF64_T 1 # define __OFF_T_MATCHES_OFF64_T 1
/* Same for ino_t and ino64_t. */
# define __INO_T_MATCHES_INO64_T 1
#endif #endif
/* Number of descriptors that can fit in an `fd_set'. */ /* Number of descriptors that can fit in an `fd_set'. */

View File

@ -78,6 +78,9 @@
for all ABI purposes, even if possibly expressed as different base types for all ABI purposes, even if possibly expressed as different base types
for C type-checking purposes. */ for C type-checking purposes. */
# define __OFF_T_MATCHES_OFF64_T 1 # define __OFF_T_MATCHES_OFF64_T 1
/* Same for ino_t and ino64_t. */
# define __INO_T_MATCHES_INO64_T 1
#endif #endif
/* Number of descriptors that can fit in an `fd_set'. */ /* Number of descriptors that can fit in an `fd_set'. */

View File

@ -1 +0,0 @@
#include <sysdeps/wordsize-64/alphasort.c>

View File

@ -1 +0,0 @@
#include <sysdeps/wordsize-64/alphasort64.c>

View File

@ -1 +0,0 @@
#include <sysdeps/wordsize-64/scandir.c>

View File

@ -1 +0,0 @@
#include <sysdeps/wordsize-64/scandir64.c>

View File

@ -1 +0,0 @@
#include <sysdeps/wordsize-64/scandirat.c>

View File

@ -1 +0,0 @@
#include <sysdeps/wordsize-64/scandirat64.c>

View File

@ -1 +0,0 @@
#include <sysdeps/wordsize-64/versionsort.c>

View File

@ -1 +0,0 @@
#include <sysdeps/wordsize-64/versionsort64.c>

View File

@ -1,7 +0,0 @@
#define alphasort64 rename_alphasort64
#include "../../dirent/alphasort.c"
#undef alphasort64
weak_alias (alphasort, alphasort64)

View File

@ -1 +0,0 @@
/* Defined in alphasort.c. */

View File

@ -1,6 +0,0 @@
#define scandir64 scandir64_renamed
#include "../../dirent/scandir.c"
#undef scandir64
weak_alias (scandir, scandir64)

View File

@ -1 +0,0 @@
/* Defined in scandir.c. */

View File

@ -1,6 +0,0 @@
#define scandirat64 scandirat64_renamed
#include "../../dirent/scandirat.c"
#undef scandirat64
weak_alias (scandirat, scandirat64)

View File

@ -1 +0,0 @@
/* Defined in scandirat.c. */

View File

@ -1,7 +0,0 @@
#define versionsort64 rename_versionsort64
#include "../../dirent/versionsort.c"
#undef versionsort64
weak_alias (versionsort, versionsort64)

View File

@ -1 +0,0 @@
/* Defined in versionsort.c. */