1139743Simp/*-
243412Snewton * Copyright (c) 1998 Mark Newton
343412Snewton * Copyright (c) 1994 Christos Zoulas
443412Snewton * All rights reserved.
543412Snewton *
643412Snewton * Redistribution and use in source and binary forms, with or without
743412Snewton * modification, are permitted provided that the following conditions
843412Snewton * are met:
943412Snewton * 1. Redistributions of source code must retain the above copyright
1043412Snewton *    notice, this list of conditions and the following disclaimer.
1143412Snewton * 2. Redistributions in binary form must reproduce the above copyright
1243412Snewton *    notice, this list of conditions and the following disclaimer in the
1343412Snewton *    documentation and/or other materials provided with the distribution.
1443412Snewton * 3. The name of the author may not be used to endorse or promote products
1543412Snewton *    derived from this software without specific prior written permission
1643412Snewton *
1743412Snewton * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1843412Snewton * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1943412Snewton * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2043412Snewton * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2143412Snewton * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2243412Snewton * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2343412Snewton * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2443412Snewton * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2543412Snewton * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2643412Snewton * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2749264Snewton *
2850477Speter * $FreeBSD: releng/10.2/sys/compat/svr4/svr4_types.h 187830 2009-01-28 17:57:16Z ed $
2943412Snewton */
3043412Snewton
3143412Snewton#ifndef	_SVR4_TYPES_H_
3243412Snewton#define	_SVR4_TYPES_H_
3343412Snewton
3443412Snewtontypedef u_quad_t	 svr4_ino64_t;
3543412Snewtontypedef quad_t		 svr4_off64_t;
3643412Snewtontypedef quad_t		 svr4_blkcnt64_t;
3743412Snewtontypedef u_quad_t	 svr4_fsblkcnt64_t;
3843412Snewton
3943412Snewtontypedef long  		 svr4_off_t;
4043412Snewtontypedef u_long		 svr4_dev_t;
4143412Snewtontypedef u_long		 svr4_ino_t;
4243412Snewtontypedef u_long		 svr4_mode_t;
4343412Snewtontypedef u_long		 svr4_nlink_t;
4443412Snewtontypedef long		 svr4_uid_t;
4543412Snewtontypedef long		 svr4_gid_t;
4643412Snewtontypedef long		 svr4_daddr_t;
4743412Snewtontypedef long		 svr4_pid_t;
4843412Snewtontypedef long		 svr4_time_t;
4943412Snewtontypedef long		 svr4_blkcnt_t;
5043412Snewtontypedef u_long		 svr4_fsblkcnt_t;
5143412Snewtontypedef char		*svr4_caddr_t;
5243412Snewtontypedef u_int		 svr4_size_t;
5343412Snewton
5443412Snewtontypedef short		 svr4_o_dev_t;
5543412Snewtontypedef short		 svr4_o_pid_t;
5643412Snewtontypedef u_short		 svr4_o_ino_t;
5743412Snewtontypedef u_short		 svr4_o_mode_t;
5843412Snewtontypedef short		 svr4_o_nlink_t;
5943412Snewtontypedef u_short		 svr4_o_uid_t;
6043412Snewtontypedef u_short		 svr4_o_gid_t;
6143412Snewtontypedef long		 svr4_clock_t;
6243412Snewtontypedef int		 svr4_key_t;
6343412Snewton
6443412Snewtontypedef struct timespec  svr4_timestruc_t;
6543412Snewton
6643412Snewton#define svr4_omajor(x)        ((int32_t)((((x) & 0x7f00) >> 8)))
6743412Snewton#define svr4_ominor(x)        ((int32_t)((((x) & 0x00ff) >> 0)))
6843412Snewton#define svr4_omakedev(x,y)    ((svr4_o_dev_t)((((x) << 8) & 0x7f00) | \
6943412Snewton					      (((y) << 0) & 0x00ff)))
7043412Snewton
71130640Sphk#define svr4_to_bsd_odev_t(d) makedev(svr4_omajor(d), svr4_ominor(d))
72187830Sed#define bsd_to_svr4_odev_t(d) svr4_omakedev(major(d), minor(d))
7343412Snewton
7443412Snewton#define svr4_major(x)         ((int32_t)((((x) & 0xfffc0000) >> 18)))
7543412Snewton#define svr4_minor(x)         ((int32_t)((((x) & 0x0003ffff) >> 0)))
7643412Snewton#define svr4_makedev(x,y)     ((svr4_dev_t)((((x) << 18) & 0xfffc0000) | \
7743412Snewton					    (((y) << 0) & 0x0003ffff)))
78130640Sphk#define svr4_to_bsd_dev_t(d)  makedev(svr4_major(d), svr4_minor(d))
79187830Sed#define bsd_to_svr4_dev_t(d)  svr4_makedev(major(d), minor(d))
8043412Snewton
8143412Snewton#endif /* !_SVR4_TYPES_H_ */
82