cleanups and bug fixes from John
[unix-history] / usr / src / sys / ufs / ffs / dir.h
index b1deac4..3b5160f 100644 (file)
@@ -1,4 +1,14 @@
-/*     dir.h   6.1     83/07/29        */
+/*
+ * Copyright (c) 1982, 1986, 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * %sccs.include.redist.c%
+ *
+ *     @(#)dir.h       7.10 (Berkeley) %G%
+ */
+
+#ifndef _DIR_H_
+#define        _DIR_H_
 
 /*
  * A directory consists of some number of blocks of DIRBLKSIZ
 
 /*
  * A directory consists of some number of blocks of DIRBLKSIZ
  * Entries other than the first in a directory do not normally have
  * dp->d_ino set to 0.
  */
  * Entries other than the first in a directory do not normally have
  * dp->d_ino set to 0.
  */
-/* so user programs can just include dir.h */
-#if !defined(KERNEL) && !defined(DEV_BSIZE)
-#define        DEV_BSIZE       512
-#endif
 #define DIRBLKSIZ      DEV_BSIZE
 #define        MAXNAMLEN       255
 
 #define DIRBLKSIZ      DEV_BSIZE
 #define        MAXNAMLEN       255
 
@@ -36,7 +42,7 @@ struct        direct {
        u_long  d_ino;                  /* inode number of entry */
        u_short d_reclen;               /* length of this record */
        u_short d_namlen;               /* length of string in d_name */
        u_long  d_ino;                  /* inode number of entry */
        u_short d_reclen;               /* length of this record */
        u_short d_namlen;               /* length of string in d_name */
-       char    d_name[MAXNAMLEN + 1];  /* name must be no longer than this */
+       char    d_name[MAXNAMLEN + 1];  /* name with length <= MAXNAMLEN */
 };
 
 /*
 };
 
 /*
@@ -45,32 +51,9 @@ 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.
  */
  * 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 DIRSIZ(dp) \
     ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
 
-#ifndef KERNEL
-/*
- * Definitions for library routines operating on directories.
- */
-typedef struct _dirdesc {
-       int     dd_fd;
-       long    dd_loc;
-       long    dd_size;
-       char    dd_buf[DIRBLKSIZ];
-} DIR;
-#ifndef NULL
-#define NULL 0
-#endif
-extern DIR *opendir();
-extern struct direct *readdir();
-extern long telldir();
-extern void seekdir();
-#define rewinddir(dirp)        seekdir((dirp), (long)0)
-extern void closedir();
-#endif
-
-#ifdef KERNEL
 /*
  * Template for manipulating directories.
  * Should use struct direct's, but the name field
 /*
  * Template for manipulating directories.
  * Should use struct direct's, but the name field
@@ -86,4 +69,4 @@ struct dirtemplate {
        short   dotdot_namlen;
        char    dotdot_name[4];         /* ditto */
 };
        short   dotdot_namlen;
        char    dotdot_name[4];         /* ditto */
 };
-#endif
+#endif /* !_DIR_H_ */