summaryrefslogtreecommitdiffstats
path: root/sys/sys/dirent.h
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1997-04-10 13:54:19 +0000
committerbde <bde@FreeBSD.org>1997-04-10 13:54:19 +0000
commit0425f851ec91e5c3426986b102dda2cccdf3abfd (patch)
tree14401c108ec008a8cc319591a6013b3090c6fbe2 /sys/sys/dirent.h
parent261bc7b5748c505961797f88858cc5dd45f7f6ae (diff)
downloadFreeBSD-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.
Diffstat (limited to 'sys/sys/dirent.h')
-rw-r--r--sys/sys/dirent.h19
1 files changed, 16 insertions, 3 deletions
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_ */
OpenPOWER on IntegriCloud