1/*	$NetBSD: linux32_types.h,v 1.1 2021/11/25 03:08:04 ryo Exp $	*/
2
3/*-
4 * Copyright (c) 2021 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Ryo Shimizu.
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 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _AARCH64_LINUX32_TYPES_H_
33#define _AARCH64_LINUX32_TYPES_H_
34
35typedef uint16_t linux32_uid_t;		/* arm: unsigned short */
36typedef uint16_t linux32_gid_t;		/* arm: unsigned short */
37typedef uint32_t linux32_ino_t;		/* arm: unsigned long */
38typedef uint32_t linux32_size_t;	/* arm: size_t */
39typedef int32_t linux32_time_t;		/* arm: long */
40typedef int32_t linux32_clock_t;	/* arm: long */
41typedef int32_t linux32_off_t;		/* arm: long */
42typedef int32_t linux32_pid_t;		/* arm: int */
43
44typedef netbsd32_pointer_t linux32_ulongp_t;
45typedef netbsd32_pointer_t linux32_user_descp_t;
46
47struct linux32_stat {
48	uint16_t			lst_dev;
49	uint16_t			pad1;
50	linux32_ino_t			lst_ino;
51	uint16_t			lst_mode;
52	uint16_t			lst_nlink;
53	linux32_uid_t			lst_uid;
54	linux32_gid_t			lst_gid;
55	uint16_t			lst_rdev;
56	uint16_t			pad2;
57	linux32_off_t			lst_size;
58	linux32_size_t			lst_blksize;
59	uint32_t			lst_blocks;
60	linux32_time_t			lst_atime;
61	uint32_t			unused1;
62	linux32_time_t			lst_mtime;
63	uint32_t			unused2;
64	linux32_time_t			lst_ctime;
65	uint32_t			unused3;
66	uint32_t			unused4;
67	uint32_t			unused5;
68} __packed;
69
70struct linux32_stat64 {
71	unsigned long long		lst_dev;
72#define LINUX32_STAT64_HAS_BROKEN_ST_INO
73	unsigned long long		__lst_ino;
74	uint32_t			lst_mode;
75	uint32_t			lst_nlink;
76	uint32_t			lst_uid;
77	uint32_t			lst_gid;
78	unsigned long long		lst_rdev;
79	unsigned long long		__pad1;
80	long long			lst_size;
81	uint32_t			lst_blksize;
82	uint32_t			__pad2;
83	unsigned long long		lst_blocks;
84#define LINUX32_STAT64_HAS_NSEC
85	uint32_t			lst_atime;
86	uint32_t			lst_atime_nsec;
87	uint32_t			lst_mtime;
88	uint32_t			lst_mtime_nsec;
89	uint32_t			lst_ctime;
90	uint32_t			lst_ctime_nsec;
91	unsigned long long		lst_ino;
92} __packed;
93
94struct linux32_utimbuf {
95	linux32_time_t		l_actime;
96	linux32_time_t		l_modtime;
97};
98
99#endif /* _AARCH64_LINUX32_TYPES_H_ */
100