diff options
author | bde <bde@FreeBSD.org> | 1997-04-10 13:54:19 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1997-04-10 13:54:19 +0000 |
commit | 0425f851ec91e5c3426986b102dda2cccdf3abfd (patch) | |
tree | 14401c108ec008a8cc319591a6013b3090c6fbe2 | |
parent | 261bc7b5748c505961797f88858cc5dd45f7f6ae (diff) | |
download | FreeBSD-src-0425f851ec91e5c3426986b102dda2cccdf3abfd.zip FreeBSD-src-0425f851ec91e5c3426986b102dda2cccdf3abfd.tar.gz |
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.
-rw-r--r-- | sys/sys/dir.h | 25 | ||||
-rw-r--r-- | sys/sys/dirent.h | 19 |
2 files changed, 24 insertions, 20 deletions
diff --git a/sys/sys/dir.h b/sys/sys/dir.h index c0347c1..bea51b0 100644 --- a/sys/sys/dir.h +++ b/sys/sys/dir.h @@ -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_ */ diff --git a/sys/sys/dirent.h b/sys/sys/dirent.h index 2be561b..854ec38 100644 --- a/sys/sys/dirent.h +++ b/sys/sys/dirent.h @@ -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_ */ |