xref: /netbsd/sys/compat/linux/arch/mips/linux_types.h (revision bf9ec67e)
1 /*	$NetBSD: linux_types.h,v 1.5 2002/02/17 23:57:57 rafal 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 _MIPS_LINUX_TYPES_H
40 #define _MIPS_LINUX_TYPES_H
41 
42 /*
43  * from Linux's include/asm-mips/posix-types.h
44  */
45 typedef struct {
46 	int val[2];
47 } linux_fsid_t;
48 
49 typedef int linux_uid_t;
50 typedef int linux_gid_t;
51 typedef unsigned int linux_dev_t;
52 typedef unsigned int linux_mode_t;
53 typedef long linux_time_t;
54 typedef long linux_clock_t;
55 typedef long linux_off_t;
56 typedef int linux_pid_t;
57 #if defined(ELFSIZE) && (ELFSIZE == 64)
58 typedef unsigned int linux_ino_t;
59 typedef unsigned int linux_nlink_t;
60 typedef unsigned long linux_ino_t32;
61 typedef int linux_nlink_t32;
62 #else
63 typedef unsigned long linux_ino_t;
64 typedef int linux_nlink_t;
65 typedef linux_ino_t linux_ino_t32;
66 typedef linux_nlink_t linux_nlink_t32;
67 #endif
68 
69 /*
70  * From Linux's include/asm-mips/termbits.h
71  */
72 typedef unsigned char linux_cc_t;
73 #if defined(ELFSIZE) && (ELFSIZE == 64)
74 typedef unsigned int linux_speed_t;
75 typedef unsigned int linux_tcflag_t;
76 #else
77 typedef unsigned long linux_speed_t;
78 typedef unsigned long linux_tcflag_t;
79 #endif
80 
81 /*
82  * From Linux's include/asm-mips/statfs.h
83  */
84 struct linux_statfs {
85 	long l_ftype;	   /* Linux name -> NetBSD Linux emul name: s/f_/I_f/ */
86 	long l_fbsize;
87 	long l_ffrsize;
88 	long l_fblocks;
89 	long l_fbfree;
90 	long l_ffiles;
91 	long l_fffree;
92 	long l_fbavail;
93 	linux_fsid_t l_ffsid;
94 	long l_fnamelen;
95 	long l_fspare[6];
96 };
97 
98 #if defined(ELFSIZE) && (ELFSIZE == 64)
99 /*
100  * From Linux's include/asm-mips64/stat.h
101  * 64 bit version of struct linux_stat memory layout is the
102  * same as of struct stat64 of the 32-bit Linux kernel
103  */
104 struct linux_stat {
105 	linux_dev_t	lst_dev;
106 	unsigned int	lst_pad0[3];
107 	unsigned long	lst_ino;
108 	linux_mode_t	lst_mode;
109 	linux_nlink_t	lst_nlink;
110 	linux_uid_t	lst_uid;
111 	linux_gid_t	lst_gid;
112 	linux_dev_t	lst_rdev;
113 	unsigned int	lst_pad1[3];
114 	linux_off_t	lst_size;
115 	unsigned int	lst_atime;
116 	unsigned int	lreserved0;
117 	unsigned int	lst_mtime;
118 	unsigned int	lreserved1;
119 	unsigned int	lst_ctime;
120 	unsigned int	lreserved2;
121 	unsigned int	lst_blksize;
122 	unsigned int	lst_pad2;
123 	unsigned long	lst_blocks;
124 };
125 
126 struct stat32 {
127 	linux_dev_t	lst_dev;
128  	int		lst_pad1[3];
129  	linux_ino_t32	lst_ino;
130  	linux_mode_t	lst_mode;
131  	linux_nlink_t32	lst_nlink;
132  	linux_uid_t	lst_uid;
133  	linux_gid_t	lst_gid;
134  	linux_dev_t	lst_rdev;
135  	int		lst_pad2[2];
136  	linux_off_t	lst_size;
137  	int		lst_pad3;
138  	linux_time_t	lst_atime;
139  	int		lreserved0;
140  	linux_time_t	lst_mtime;
141  	int		lreserved1;
142  	linux_time_t	lst_ctime;
143  	int		lreserved2;
144  	int		lst_blksize;
145  	int		lst_blocks;
146  	int		lst_pad4[14];
147 };
148 #else
149 /*
150  * This matches struct stat64 in glibc2.1, hence the absolutely
151  * insane amounts of padding around dev_t's.
152  *
153  * Still from Linux's include/asm-mips/stat.h
154  */
155 struct linux_stat64 {
156 	unsigned long	lst_dev;
157 	unsigned long	lst_pad0[3];
158 	unsigned long long lst_ino;
159 #define lst_ino64 lst_ino
160 	linux_mode_t	lst_mode;
161 	linux_nlink_t	lst_nlink;
162 	linux_uid_t	lst_uid;
163 	linux_gid_t	lst_gid;
164 	unsigned long	lst_rdev;
165 	unsigned long	lst_pad1[3];
166 	long long	lst_size;
167 	linux_time_t	lst_atime;
168 	unsigned long 	lreserved0;
169 	linux_time_t	lst_mtime;
170 	unsigned long 	lreserved1;
171 	linux_time_t	lst_ctime;
172 	unsigned long 	lreserved2;
173 	unsigned long	lst_blksize;
174 	long long 	lst_blocks;
175 };
176 
177 /*
178  * struct linux_stat is defined in Linux's include/asm-mips/stat.h
179  * There is also a old_kernel_stat in Linux
180  */
181 struct linux_stat {
182 	linux_dev_t	lst_dev;
183 	long		lst_pad[3];
184 	linux_ino_t32	lst_ino;
185 	linux_mode_t	lst_mode;
186 	linux_nlink_t32	lst_nlink;
187 	linux_uid_t	lst_uid;
188 	linux_gid_t	lst_gid;
189 	linux_dev_t	lst_rdev;
190 	long		lst_pad2[2];
191 	linux_off_t	lst_size;
192 	long		lst_pad3;
193 	linux_time_t	lst_atime;
194 	long		lreserved0;
195 	linux_time_t	lst_mtime;
196 	long		lreserved1;
197 	linux_time_t	lst_ctime;
198 	long		lreserved2;
199 	long		lst_blksize;
200 	long		lst_blocks;
201 	char		lst_fstype[16];
202 	long		lst_pad4[8];
203 	unsigned int	lst_flags;
204 	unsigned int	lst_gen;
205 };
206 #endif
207 
208 #endif /* !_MIPS_LINUX_TYPES_H */
209