Deprecated <sys/dir.h> some more - changed the comment saying that

<dirent.h> should be used instead to a warning.  If this causes too
many warnings in ports then it should be changed back after checking
some ports for related configuration errors.

Moved the definition of DIRSIZ() from <sys/dir.h> to <sys/dirent.h>
so that it can be used in the kernel without including <sys/dir.h>.
Renamed it in some cases to avoid new namespace pollution.
This commit is contained in:
Bruce Evans 1997-04-10 13:54:19 +00:00
parent d075eaa4da
commit d1f3e5b0fe
2 changed files with 24 additions and 20 deletions

View File

@ -31,32 +31,23 @@
* SUCH DAMAGE.
*
* @(#)dir.h 8.2 (Berkeley) 1/4/94
* $Id$
*/
/*
* The information in this file should be obtained from <dirent.h>
* and is provided solely (and temporarily) for backward compatibility.
* $Id: dir.h,v 1.4 1997/02/22 09:45:01 peter Exp $
*/
#ifndef _SYS_DIR_H_
#define _SYS_DIR_H_
#if __GNUC__
#warning "The information in this file should be obtained from <dirent.h>"
#warning "and is provided solely (and temporarily) for backward compatibility."
#endif
#include <dirent.h>
/*
* Backwards compatibility.
*/
#define direct dirent
/*
* The DIRSIZ macro gives the minimum record length which will hold
* the directory entry. This requires the amount of space in struct direct
* without the d_name field, plus enough space for the name with a terminating
* null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
*/
#undef DIRSIZ
#define DIRSIZ(dp) \
((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
#define direct dirent
#define DIRSIZ(dp) _GENERIC_DIRSIZ(dp)
#endif /* !_SYS_DIR_H_ */

View File

@ -31,11 +31,11 @@
* SUCH DAMAGE.
*
* @(#)dirent.h 8.3 (Berkeley) 8/10/94
* $Id$
* $Id: dirent.h,v 1.7 1997/02/22 09:45:02 peter Exp $
*/
#ifndef _SYS_DIRENT_H_
#define _SYS_DIRENT_H_
#ifndef _SYS_DIRENT_H_
#define _SYS_DIRENT_H_
/*
* The dirent structure defines the format of directory entries returned by
@ -80,4 +80,17 @@ struct dirent {
#define IFTODT(mode) (((mode) & 0170000) >> 12)
#define DTTOIF(dirtype) ((dirtype) << 12)
/*
* The _GENERIC_DIRSIZ macro gives the minimum record length which will hold
* the directory entry. This requires the amount of space in struct direct
* without the d_name field, plus enough space for the name with a terminating
* null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
*/
#define _GENERIC_DIRSIZ(dp) \
((sizeof (struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
#ifdef KERNEL
#define GENERIC_DIRSIZ(dp) _GENERIC_DIRSIZ(dp)
#endif
#endif /* !_SYS_DIRENT_H_ */