os/ossrv/genericopenlibs/openenvcore/include/sys/dirent.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/include/sys/dirent.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,121 @@
     1.4 +/*-
     1.5 + * Copyright (c) 1989, 1993
     1.6 + *	The Regents of the University of California.  All rights reserved.
     1.7 + *
     1.8 + * Redistribution and use in source and binary forms, with or without
     1.9 + * modification, are permitted provided that the following conditions
    1.10 + * are met:
    1.11 + * 1. Redistributions of source code must retain the above copyright
    1.12 + *    notice, this list of conditions and the following disclaimer.
    1.13 + * 2. Redistributions in binary form must reproduce the above copyright
    1.14 + *    notice, this list of conditions and the following disclaimer in the
    1.15 + *    documentation and/or other materials provided with the distribution.
    1.16 + * 4. Neither the name of the University nor the names of its contributors
    1.17 + *    may be used to endorse or promote products derived from this software
    1.18 + *    without specific prior written permission.
    1.19 + *
    1.20 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    1.21 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.22 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.23 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    1.24 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    1.25 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    1.26 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    1.27 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    1.28 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    1.29 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.30 + * SUCH DAMAGE.
    1.31 + *
    1.32 + *	@(#)dirent.h	8.3 (Berkeley) 8/10/94
    1.33 + * $FreeBSD: src/sys/sys/dirent.h,v 1.14 2004/04/07 04:19:49 imp Exp $
    1.34 + */
    1.35 +
    1.36 +#ifndef	_SYS_DIRENT_H_
    1.37 +#define	_SYS_DIRENT_H_
    1.38 +
    1.39 +#include <sys/cdefs.h>
    1.40 +#include <sys/_types.h>
    1.41 +#include <stddef.h>
    1.42 +
    1.43 +/*
    1.44 + * The dirent structure defines the format of directory entries returned by
    1.45 + * the getdirentries(2) system call.
    1.46 + *
    1.47 + * A directory entry has a struct dirent at the front of it, containing its
    1.48 + * inode number, the length of the entry, and the length of the name
    1.49 + * contained in the entry.  These are followed by the name padded to a 4
    1.50 + * byte boundary with null bytes.  All names are guaranteed null terminated.
    1.51 + * The maximum length of a name in a directory is MAXNAMLEN.
    1.52 + */
    1.53 +
    1.54 +struct dirent {
    1.55 +	__uint32_t d_fileno;		/* file number of entry */
    1.56 +	__uint16_t d_reclen;		/* length of this record */
    1.57 +	__uint8_t  d_type; 		/* file type, see below */
    1.58 +	__uint8_t  d_namlen;		/* length of string in d_name */
    1.59 +#if __BSD_VISIBLE
    1.60 +#define	MAXNAMLEN	255
    1.61 +	char	d_name[MAXNAMLEN + 1];	/* name must be no longer than this */
    1.62 +#else
    1.63 +	char	d_name[255 + 1];	/* name must be no longer than this */
    1.64 +#endif
    1.65 +};
    1.66 +
    1.67 +#if defined(SYMBIAN_OE_LARGE_FILE_SUPPORT) && !defined(SYMBIAN_OE_NO_LFS)
    1.68 +#define dirent64	dirent
    1.69 +#endif /* SYMBIAN_OE_LARGE_FILE_SUPPORT && !SYMBIAN_OE_NO_LFS */
    1.70 +
    1.71 +
    1.72 +#ifdef __SYMBIAN32__
    1.73 +struct wdirent {
    1.74 +	unsigned long	d_fileno;
    1.75 +	unsigned short	d_namlen;
    1.76 +	wchar_t*		d_name;
    1.77 +};
    1.78 +
    1.79 +#if defined(SYMBIAN_OE_LARGE_FILE_SUPPORT) && !defined(SYMBIAN_OE_NO_LFS)
    1.80 +#define wdirent64	wdirent
    1.81 +#endif /* SYMBIAN_OE_LARGE_FILE_SUPPORT && !SYMBIAN_OE_NO_LFS */
    1.82 +
    1.83 +typedef struct __EPOC32_WDIR WDIR;
    1.84 +#endif
    1.85 +
    1.86 +
    1.87 +#if __BSD_VISIBLE
    1.88 +/*
    1.89 + * File types
    1.90 + */
    1.91 +#define	DT_UNKNOWN	 0
    1.92 +#define	DT_FIFO		 1
    1.93 +#define	DT_CHR		 2
    1.94 +#define	DT_DIR		 4
    1.95 +#define	DT_BLK		 6
    1.96 +#define	DT_REG		 8
    1.97 +#define	DT_LNK		10
    1.98 +#define	DT_SOCK		12
    1.99 +#define	DT_WHT		14
   1.100 +
   1.101 +/*
   1.102 + * Convert between stat structure types and directory types.
   1.103 + */
   1.104 +#define	IFTODT(mode)	(((mode) & 0170000) >> 12)
   1.105 +#define	DTTOIF(dirtype)	((dirtype) << 12)
   1.106 +
   1.107 +/*
   1.108 + * The _GENERIC_DIRSIZ macro gives the minimum record length which will hold
   1.109 + * the directory entry.  This requires the amount of space in struct direct
   1.110 + * without the d_name field, plus enough space for the name with a terminating
   1.111 + * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
   1.112 + *
   1.113 + * XXX although this macro is in the implementation namespace, it requires
   1.114 + * a manifest constant that is not.
   1.115 + */
   1.116 +#define	_GENERIC_DIRSIZ(dp) \
   1.117 +    ((sizeof (struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
   1.118 +#endif /* __BSD_VISIBLE */
   1.119 +
   1.120 +#ifdef _KERNEL
   1.121 +#define	GENERIC_DIRSIZ(dp)	_GENERIC_DIRSIZ(dp)
   1.122 +#endif
   1.123 +
   1.124 +#endif /* !_SYS_DIRENT_H_ */