xref: /netbsd-src/sys/compat/linux/common/linux_dirent.h (revision e0ef945ceeb539dbcab5075a742dc92df2c5fb8e)
1*e0ef945cSchs /*	$NetBSD: linux_dirent.h,v 1.12 2010/09/11 20:53:04 chs Exp $	*/
2e6ad366cSerh 
3e6ad366cSerh /*-
48096c25aSfvdl  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
5e6ad366cSerh  * All rights reserved.
6e6ad366cSerh  *
7e6ad366cSerh  * This code is derived from software contributed to The NetBSD Foundation
88096c25aSfvdl  * by Frank van der Linden and Eric Haszlakiewicz.
9e6ad366cSerh  *
10e6ad366cSerh  * Redistribution and use in source and binary forms, with or without
11e6ad366cSerh  * modification, are permitted provided that the following conditions
12e6ad366cSerh  * are met:
13e6ad366cSerh  * 1. Redistributions of source code must retain the above copyright
14e6ad366cSerh  *    notice, this list of conditions and the following disclaimer.
15e6ad366cSerh  * 2. Redistributions in binary form must reproduce the above copyright
16e6ad366cSerh  *    notice, this list of conditions and the following disclaimer in the
17e6ad366cSerh  *    documentation and/or other materials provided with the distribution.
18e6ad366cSerh  *
19e6ad366cSerh  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20e6ad366cSerh  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21e6ad366cSerh  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22e6ad366cSerh  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23e6ad366cSerh  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24e6ad366cSerh  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25e6ad366cSerh  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26e6ad366cSerh  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27e6ad366cSerh  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28e6ad366cSerh  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29e6ad366cSerh  * POSSIBILITY OF SUCH DAMAGE.
30e6ad366cSerh  */
313bf459f3Sfvdl 
32908291d2Schristos #ifndef _LINUX_DIRENT_H
33908291d2Schristos #define _LINUX_DIRENT_H
343bf459f3Sfvdl 
35245f292fSmycroft #define LINUX_MAXNAMLEN	255
363bf459f3Sfvdl 
373bf459f3Sfvdl struct linux_dirent {
38245f292fSmycroft 	linux_ino_t	d_ino;
391e1e52e3Smycroft 	linux_off_t	d_off;
40245f292fSmycroft 	u_short		d_reclen;
41*e0ef945cSchs 	char		d_name[LINUX_MAXNAMLEN + 2];
423bf459f3Sfvdl };
433bf459f3Sfvdl 
4410ecebd4Schristos struct linux_dirent64 {
4510ecebd4Schristos         unsigned long long	d_ino;
4610ecebd4Schristos         long long		d_off;
4710ecebd4Schristos         unsigned short		d_reclen;
4810ecebd4Schristos         unsigned char		d_type;
4910ecebd4Schristos         char			d_name[LINUX_MAXNAMLEN + 1];
5010ecebd4Schristos };
5110ecebd4Schristos 
5210ecebd4Schristos 
531e891c87Stron #define LINUX_NAMEOFF(dp)       ((char *)&(dp)->d_name - (char *)(dp))
54*e0ef945cSchs #define LINUX_RECLEN(de,namlen) ALIGN((LINUX_NAMEOFF(de) + (namlen) + 2))
553bf459f3Sfvdl 
56908291d2Schristos #endif /* !_LINUX_DIRENT_H */
57