12222d055SIngo Weinhold/*
29d570af7SIngo Weinhold * Copyright 2007-2010, Ingo Weinhold, ingo_weinhold@gmx.de.
32222d055SIngo Weinhold * Distributed under the terms of the MIT License.
42222d055SIngo Weinhold */
5a38a92c9SIngo Weinhold#ifndef _FSSH_TYPES_H
6a38a92c9SIngo Weinhold#define _FSSH_TYPES_H
7a38a92c9SIngo Weinhold
82222d055SIngo Weinhold
9a38a92c9SIngo Weinhold#include <inttypes.h>
10a38a92c9SIngo Weinhold
112222d055SIngo Weinhold
12a38a92c9SIngo Weinholdtypedef volatile int32_t	vint32_t;
13a3ca7ebcSJérôme Duvaltypedef volatile int64_t	vint64_t;
14a38a92c9SIngo Weinhold
15c6f1a3bfSJérôme Duval#ifdef HAIKU_HOST_PLATFORM_64_BIT
16a3ca7ebcSJérôme Duvaltypedef uint64_t	fssh_addr_t;
17d34daac8SIngo Weinholdtypedef uint64_t	fssh_phys_addr_t;
184a57f843SIngo Weinholdtypedef uint64_t	fssh_generic_addr_t;
19a9139aa3SIngo Weinholdtypedef uint64_t	fssh_size_t;
20a9139aa3SIngo Weinholdtypedef int64_t		fssh_ssize_t;
21a3ca7ebcSJérôme Duval#else
22a38a92c9SIngo Weinholdtypedef uint32_t	fssh_addr_t;
23d34daac8SIngo Weinholdtypedef uint32_t	fssh_phys_addr_t;
244a57f843SIngo Weinholdtypedef uint32_t	fssh_generic_addr_t;
25a9139aa3SIngo Weinholdtypedef uint32_t	fssh_size_t;
26a9139aa3SIngo Weinholdtypedef int32_t		fssh_ssize_t;
27a3ca7ebcSJérôme Duval#endif
28ea021b94SIngo Weinholdtypedef fssh_phys_addr_t	fssh_phys_size_t;
294a57f843SIngo Weinholdtypedef fssh_generic_addr_t	fssh_generic_size_t;
30a38a92c9SIngo Weinhold
31a38a92c9SIngo Weinholdtypedef int32_t		fssh_dev_t;
32a38a92c9SIngo Weinholdtypedef int64_t		fssh_ino_t;
33a38a92c9SIngo Weinhold
34a38a92c9SIngo Weinholdtypedef int64_t		fssh_off_t;
35a38a92c9SIngo Weinhold
36a38a92c9SIngo Weinholdtypedef int64_t		fssh_bigtime_t;
37a38a92c9SIngo Weinhold
38a38a92c9SIngo Weinholdtypedef int32_t		fssh_status_t;
39a38a92c9SIngo Weinholdtypedef uint32_t	fssh_type_code;
40a38a92c9SIngo Weinhold
41a38a92c9SIngo Weinholdtypedef uint32_t	fssh_mode_t;
42a38a92c9SIngo Weinholdtypedef uint32_t	fssh_nlink_t;
43a38a92c9SIngo Weinholdtypedef uint32_t	fssh_uid_t;
44a38a92c9SIngo Weinholdtypedef uint32_t	fssh_gid_t;
45a38a92c9SIngo Weinholdtypedef int32_t		fssh_pid_t;
46a38a92c9SIngo Weinhold
47a38a92c9SIngo Weinhold#ifndef NULL
48a38a92c9SIngo Weinhold#define NULL (0)
49a38a92c9SIngo Weinhold#endif
50a38a92c9SIngo Weinhold
512222d055SIngo Weinhold
522222d055SIngo Weinhold// NOTE: For this to work the __STDC_FORMAT_MACROS feature macro must be
532222d055SIngo Weinhold// defined.
542222d055SIngo Weinhold
552222d055SIngo Weinhold/* printf()/scanf() format strings for [u]int* types */
562222d055SIngo Weinhold#define FSSH_B_PRId8		PRId8
572222d055SIngo Weinhold#define FSSH_B_PRIi8		PRIi8
582222d055SIngo Weinhold#define FSSH_B_PRId16		PRId16
592222d055SIngo Weinhold#define FSSH_B_PRIi16		PRIi16
602222d055SIngo Weinhold#define FSSH_B_PRId32		PRId32
612222d055SIngo Weinhold#define FSSH_B_PRIi32		PRIi32
622222d055SIngo Weinhold#define FSSH_B_PRId64		PRId64
632222d055SIngo Weinhold#define FSSH_B_PRIi64		PRIi64
642222d055SIngo Weinhold#define FSSH_B_PRIu8		PRIu8
652222d055SIngo Weinhold#define FSSH_B_PRIo8		PRIo8
662222d055SIngo Weinhold#define FSSH_B_PRIx8		PRIx8
672222d055SIngo Weinhold#define FSSH_B_PRIX8		PRIX8
682222d055SIngo Weinhold#define FSSH_B_PRIu16		PRIu16
692222d055SIngo Weinhold#define FSSH_B_PRIo16		PRIo16
702222d055SIngo Weinhold#define FSSH_B_PRIx16		PRIx16
712222d055SIngo Weinhold#define FSSH_B_PRIX16		PRIX16
722222d055SIngo Weinhold#define FSSH_B_PRIu32		PRIu32
732222d055SIngo Weinhold#define FSSH_B_PRIo32		PRIo32
742222d055SIngo Weinhold#define FSSH_B_PRIx32		PRIx32
752222d055SIngo Weinhold#define FSSH_B_PRIX32		PRIX32
762222d055SIngo Weinhold#define FSSH_B_PRIu64		PRIu64
772222d055SIngo Weinhold#define FSSH_B_PRIo64		PRIo64
782222d055SIngo Weinhold#define FSSH_B_PRIx64		PRIx64
792222d055SIngo Weinhold#define FSSH_B_PRIX64		PRIX64
802222d055SIngo Weinhold
812222d055SIngo Weinhold#define FSSH_B_SCNd8 		SCNd8
822222d055SIngo Weinhold#define FSSH_B_SCNi8 		SCNi8
832222d055SIngo Weinhold#define FSSH_B_SCNd16		SCNd16
842222d055SIngo Weinhold#define FSSH_B_SCNi16 		SCNi16
852222d055SIngo Weinhold#define FSSH_B_SCNd32 		SCNd32
862222d055SIngo Weinhold#define FSSH_B_SCNi32 		SCNi32
872222d055SIngo Weinhold#define FSSH_B_SCNd64		SCNd64
882222d055SIngo Weinhold#define FSSH_B_SCNi64 		SCNi64
892222d055SIngo Weinhold#define FSSH_B_SCNu8 		SCNu8
902222d055SIngo Weinhold#define FSSH_B_SCNo8 		SCNo8
912222d055SIngo Weinhold#define FSSH_B_SCNx8 		SCNx8
922222d055SIngo Weinhold#define FSSH_B_SCNu16		SCNu16
932222d055SIngo Weinhold#define FSSH_B_SCNu16		SCNu16
942222d055SIngo Weinhold#define FSSH_B_SCNx16		SCNx16
952222d055SIngo Weinhold#define FSSH_B_SCNu32 		SCNu32
962222d055SIngo Weinhold#define FSSH_B_SCNo32 		SCNo32
972222d055SIngo Weinhold#define FSSH_B_SCNx32 		SCNx32
982222d055SIngo Weinhold#define FSSH_B_SCNu64		SCNu64
992222d055SIngo Weinhold#define FSSH_B_SCNo64		SCNo64
1002222d055SIngo Weinhold#define FSSH_B_SCNx64		SCNx64
1012222d055SIngo Weinhold
1022222d055SIngo Weinhold
1032222d055SIngo Weinhold/* printf() format strings for some standard types */
104a9139aa3SIngo Weinhold/* addr_t, size_t, ssize_t */
1052222d055SIngo Weinhold#ifdef HAIKU_HOST_PLATFORM_64_BIT
1062222d055SIngo Weinhold#	define FSSH_B_PRIuADDR	FSSH_B_PRIu64
1072222d055SIngo Weinhold#	define FSSH_B_PRIoADDR	FSSH_B_PRIo64
1082222d055SIngo Weinhold#	define FSSH_B_PRIxADDR	FSSH_B_PRIx64
1092222d055SIngo Weinhold#	define FSSH_B_PRIXADDR	FSSH_B_PRIX64
110a9139aa3SIngo Weinhold#	define FSSH_B_PRIuSIZE	FSSH_B_PRIu64
111a9139aa3SIngo Weinhold#	define FSSH_B_PRIoSIZE	FSSH_B_PRIo64
112a9139aa3SIngo Weinhold#	define FSSH_B_PRIxSIZE	FSSH_B_PRIx64
113a9139aa3SIngo Weinhold#	define FSSH_B_PRIXSIZE	FSSH_B_PRIX64
114a9139aa3SIngo Weinhold#	define FSSH_B_PRIdSSIZE	FSSH_B_PRId64
115a9139aa3SIngo Weinhold#	define FSSH_B_PRIiSSIZE	FSSH_B_PRIi64
1162222d055SIngo Weinhold#else
1172222d055SIngo Weinhold#	define FSSH_B_PRIuADDR	FSSH_B_PRIu32
1182222d055SIngo Weinhold#	define FSSH_B_PRIoADDR	FSSH_B_PRIo32
1192222d055SIngo Weinhold#	define FSSH_B_PRIxADDR	FSSH_B_PRIx32
1202222d055SIngo Weinhold#	define FSSH_B_PRIXADDR	FSSH_B_PRIX32
121a9139aa3SIngo Weinhold#	define FSSH_B_PRIuSIZE	FSSH_B_PRIu32
122a9139aa3SIngo Weinhold#	define FSSH_B_PRIoSIZE	FSSH_B_PRIo32
123a9139aa3SIngo Weinhold#	define FSSH_B_PRIxSIZE	FSSH_B_PRIx32
124a9139aa3SIngo Weinhold#	define FSSH_B_PRIXSIZE	FSSH_B_PRIX32
125a9139aa3SIngo Weinhold#	define FSSH_B_PRIdSSIZE	FSSH_B_PRId32
126a9139aa3SIngo Weinhold#	define FSSH_B_PRIiSSIZE	FSSH_B_PRIi32
1272222d055SIngo Weinhold#endif
128d34daac8SIngo Weinhold/* phys_addr_t */
129d34daac8SIngo Weinhold#ifdef HAIKU_HOST_PLATFORM_64_BIT
130d34daac8SIngo Weinhold#	define FSSH_B_PRIuPHYSADDR	FSSH_B_PRIu64
131d34daac8SIngo Weinhold#	define FSSH_B_PRIoPHYSADDR	FSSH_B_PRIo64
132d34daac8SIngo Weinhold#	define FSSH_B_PRIxPHYSADDR	FSSH_B_PRIx64
133d34daac8SIngo Weinhold#	define FSSH_B_PRIXPHYSADDR	FSSH_B_PRIX64
134d34daac8SIngo Weinhold#else
135d34daac8SIngo Weinhold#	define FSSH_B_PRIuPHYSADDR	FSSH_B_PRIu32
136d34daac8SIngo Weinhold#	define FSSH_B_PRIoPHYSADDR	FSSH_B_PRIo32
137d34daac8SIngo Weinhold#	define FSSH_B_PRIxPHYSADDR	FSSH_B_PRIx32
138d34daac8SIngo Weinhold#	define FSSH_B_PRIXPHYSADDR	FSSH_B_PRIX32
139d34daac8SIngo Weinhold#endif
1404a57f843SIngo Weinhold/* generic_addr_t */
1414a57f843SIngo Weinhold#define FSSH_B_PRIuGENADDR	FSSH_B_PRIuPHYSADDR
1424a57f843SIngo Weinhold#define FSSH_B_PRIoGENADDR	FSSH_B_PRIoPHYSADDR
1434a57f843SIngo Weinhold#define FSSH_B_PRIxGENADDR	FSSH_B_PRIxPHYSADDR
1444a57f843SIngo Weinhold#define FSSH_B_PRIXGENADDR	FSSH_B_PRIXPHYSADDR
1452222d055SIngo Weinhold/* off_t */
1462222d055SIngo Weinhold#define FSSH_B_PRIdOFF		FSSH_B_PRId64
1472222d055SIngo Weinhold#define FSSH_B_PRIiOFF		FSSH_B_PRIi64
1482222d055SIngo Weinhold/* dev_t */
1492222d055SIngo Weinhold#define FSSH_B_PRIdDEV		FSSH_B_PRId32
1502222d055SIngo Weinhold#define FSSH_B_PRIiDEV		FSSH_B_PRIi32
1512222d055SIngo Weinhold/* ino_t */
1522222d055SIngo Weinhold#define FSSH_B_PRIdINO		FSSH_B_PRId64
1532222d055SIngo Weinhold#define FSSH_B_PRIiINO		FSSH_B_PRIi64
154cf844822SIngo Weinhold/* time_t */
155cf844822SIngo Weinhold#define FSSH_B_PRIdTIME		FSSH_B_PRId32
156cf844822SIngo Weinhold#define FSSH_B_PRIiTIME		FSSH_B_PRIi32
157cf844822SIngo Weinhold
158cf844822SIngo Weinhold
159cf844822SIngo Weinhold/* limits */
160a9139aa3SIngo Weinhold#ifdef HAIKU_HOST_PLATFORM_64_BIT
161a9139aa3SIngo Weinhold#	define FSSH_SIZE_MAX		UINT64_MAX
162a9139aa3SIngo Weinhold#	define FSSH_SSIZE_MAX		INT64_MAX
163a9139aa3SIngo Weinhold#else
164a9139aa3SIngo Weinhold#	define FSSH_SIZE_MAX		UINT32_MAX
165a9139aa3SIngo Weinhold#	define FSSH_SSIZE_MAX		INT32_MAX
166a9139aa3SIngo Weinhold#endif
1672222d055SIngo Weinhold
1682222d055SIngo Weinhold
169a38a92c9SIngo Weinhold#endif	// _FSSH_TYPES_H
170