Gianluca Guida f19a4bf1c4 Various fixes for NBSD include.
This patch include various fixes to NBSD includes.

- unistd.h: Avoid different linkages on non-_NETBSD_SOURCE 
 compilation;
- stdlib.h: remove devname declaration.
- sys/select.h: Add _MINIX specific flags.
- limits.h: Add SYMLOOP_MAX and SYMLINK_MAX
- time.h: Fix CLOCKS_PER_SEC and remove BSD's timer_t, as it
  confuses minix own specific timers.
- utmp.h: Set Minix-specific paths and use Minix utmp format.
- param.h: Do not set BSD4_4, as this mostly means sa_len in
  struct sock_addr.
- arch/i386/include/param.h: include <machine/vmparam.h> to 
  add PAGE_SIZE and related macros, defined round_page() and
  trunc_page() for minix compatibility.

- dirent.h: remove DIRBLKSIZ and fix d_ino/d_fileno.
- sys/dir.h: ADD from existing includes and edit include
  conditions.
- sys/dirent.h: include <minix/dirent.h>, fix d_ino/d_fileno.

- sys/fd_set.h: set default FD_SETSIZE at __MINIX_OPENMAX, as 
  the default NetBSD value is too big and cause vfs to return
  an error.
- sys/cdefs.h: Always include <minix/ansi.h>

- minix/paths.h: Add Minix-specific paths.
- minix/dirent.h: ADD, keep only "direct" and "flex"definitions.
- minix/types.h: include <minix/ansi.h>

- sys/Makefile: add sys/dirent.h and statfs.h (forgot!)
- minix/Makefile: add minix/dirent.h

   nbsd_include/minix-port.patch updated accordingly.
2011-03-04 23:15:48 +00:00

57 lines
1.7 KiB
C

/* dirent.h - Declarations for directory reading routines.
* Author: Kees J. Bot
* 24 Apr 1989
*
* Note: The V7 format directory entries used under Minix must be transformed
* into a struct dirent with a d_name of at least 15 characters. Given that
* we have to transform V7 entries anyhow it is little trouble to let the
* routines understand the so-called "flex" directory format too.
*/
#ifndef _DIRENT_H
#define _DIRENT_H
#include <sys/cdefs.h>
#include <minix/dir.h>
/* _fl_direct is a flexible directory entry. Actually it's a union of 8
* characters and the 3 fields defined below.
*/
/* Flexible directory entry: */
struct _fl_direct { /* First slot in an entry */
ino_t d_ino;
unsigned char d_extent;
char d_name[3]; /* two characters for the shortest name */
};
/* Name of length len needs _EXTENT(len) extra slots. */
#define _EXTENT(len) (((len) + 5) >> 3)
/* Version 7 directory entry: */
struct _v7_direct {
ino_t d_ino;
char d_name[DIRSIZ];
};
/* The block size must be at least 1024 bytes, because otherwise
* the superblock (at 1024 bytes) overlaps with other filesystem data.
*/
#define _MIN_BLOCK_SIZE 1024
/* The below is allocated in some parts of the system as the largest
* a filesystem block can be. For instance, the boot monitor allocates
* 3 of these blocks and has to fit within 64kB, so this can't be
* increased without taking that into account.
*/
#define _MAX_BLOCK_SIZE 4096
/* This is the block size for the fixed versions of the filesystem (V1/V2) */
#define _STATIC_BLOCK_SIZE 1024
#define _STATIC_FLEX_PER_BLOCK (_STATIC_BLOCK_SIZE/sizeof(struct _fl_direct))
#define _FLEX_PER_V7 (_EXTENT(DIRSIZ) + 1)
#define _FLEX_PER_BLOCK (_STATIC_BLOCK_SIZE/sizeof(struct _fl_direct))
#endif /* _DIRENT_H */