1 /*	$NetBSD: linux_types.h,v 1.2 2001/01/20 10:36:05 manu Exp $ */
2 
3 /*-
4  * Copyright (c) 1995, 1998, 2001 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Frank van der Linden, Eric Haszlakiewicz and Emmanuel Dreyfus.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *	This product includes software developed by the NetBSD
21  *	Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #ifndef _POWERPC_LINUX_TYPES_H
40 #define _POWERPC_LINUX_TYPES_H
41 
42 /*
43  * from Linux's include/asm-ppc/posix-types.h
44  */
45 typedef struct {
46 	int val[2];
47 } linux_fsid_t;
48 
49 typedef unsigned int linux_uid_t;
50 typedef unsigned int linux_gid_t;
51 typedef unsigned int linux_dev_t;
52 typedef unsigned int linux_ino_t;
53 typedef unsigned int linux_mode_t;
54 typedef unsigned short linux_nlink_t;
55 typedef long linux_time_t;
56 typedef long linux_clock_t;
57 typedef long linux_off_t;
58 typedef int linux_pid_t;
59 
60 /*
61  * From Linux's include/asm-ppc/termbits.h
62  */
63 typedef unsigned char linux_cc_t;
64 typedef unsigned int linux_speed_t;
65 typedef unsigned int linux_tcflag_t;
66 
67 /*
68  * From Linux's include/asm-ppc/statfs.h
69  */
70 struct linux_statfs {
71 	long l_ftype;	   /* Linux name -> NetBSD Linux emul name: s/f_/I_f/ */
72 	long l_fbsize;
73 	long l_fblocks;
74 	long l_fbfree;
75 	long l_fbavail;
76 	long l_ffiles;
77 	long l_fffree;
78 	linux_fsid_t l_ffsid;
79 	long l_fnamelen;
80 	long l_fspare[6];
81 };
82 
83 /*
84  * From Linux's include/asm-ppc/stat.h
85  */
86 struct linux_stat {  /* warning: there is also a old_kernel_stat in Linux*/
87 	linux_dev_t		lst_dev;
88 	linux_ino_t		lst_ino;
89 	linux_mode_t	lst_mode;
90 	linux_nlink_t	lst_nlink;
91 	linux_uid_t		lst_uid;
92 	linux_gid_t		lst_gid;
93 	linux_dev_t		lst_rdev;
94 	linux_off_t		lst_size;
95 	unsigned long	lst_blksize;
96 	unsigned long	lst_blocks;
97 	unsigned long	lst_atime;
98 	unsigned long	unused1;
99 	unsigned long	lst_mtime;
100 	unsigned long	unused2;
101 	unsigned long	lst_ctime;
102 	unsigned long	unused3;
103 	unsigned long	unused4;
104 	unsigned long	unused5;
105 };
106 
107 /*
108  * This matches struct stat64 in glibc2.1, hence the absolutely
109  * insane amounts of padding around dev_t's.
110  *
111  * Still from Linux'sinclude/asm-ppc/stat.h
112  */
113 struct linux_stat64 {
114 	unsigned long long lst_dev;
115 	unsigned long long lst_ino;
116 	unsigned int lst_mode;
117 	unsigned int lst_nlink;
118 	unsigned int lst_uid;
119 	unsigned int lst_gid;
120 	unsigned long long lst_rdev;
121 	unsigned short	int __pad2;
122 	long long lst_size;
123 	long lst_blksize;
124 	long long lst_blocks;	/* Number 512-byte blocks allocated. */
125 	long lst_atime;
126 	unsigned long int	__unused1;
127 	long lst_mtime;
128 	unsigned long int	__unused2;
129 	long lst_ctime;
130 	unsigned long int	__unused3;
131 	unsigned long int	__unused4;
132 	unsigned long int	__unused5;
133 };
134 
135 #endif /* !_POWERPC_LINUX_TYPES_H */
136