157429Smarkm/*	$NetBSD: pack_dev.h,v 1.7 2008/04/28 20:23:09 martin Exp $	*/
257429Smarkm
357429Smarkm/*-
457429Smarkm * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
557429Smarkm * All rights reserved.
657429Smarkm *
765674Skris * This code is derived from software contributed to The NetBSD Foundation
865674Skris * by Charles M. Hannum.
965674Skris *
1065674Skris * Redistribution and use in source and binary forms, with or without
1165674Skris * modification, are permitted provided that the following conditions
1265674Skris * are met:
1365674Skris * 1. Redistributions of source code must retain the above copyright
1465674Skris *    notice, this list of conditions and the following disclaimer.
1565674Skris * 2. Redistributions in binary form must reproduce the above copyright
1665674Skris *    notice, this list of conditions and the following disclaimer in the
1765674Skris *    documentation and/or other materials provided with the distribution.
1865674Skris *
1965674Skris * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2065674Skris * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2165674Skris * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2265674Skris * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2365674Skris * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2465674Skris * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2565674Skris * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2665674Skris * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2765674Skris * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2865674Skris * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2965674Skris * POSSIBILITY OF SUCH DAMAGE.
3065674Skris */
3165674Skris
3265674Skris#ifndef	_PACK_DEV_H
3365674Skris#define	_PACK_DEV_H
3465674Skris
3565674Skris#ifdef __CYGWIN__
3657429Smarkmtypedef	__dev32_t	portdev_t;
3757429Smarkm#else
3857429Smarkmtypedef	dev_t		portdev_t;
3998684Sdes#endif
4099748Sdestypedef	portdev_t pack_t(int, u_long [], const char **);
4157429Smarkm
4257429Smarkmpack_t	*pack_find(const char *);
4376262Sgreenpack_t	 pack_native;
4457429Smarkm
4576262Sgreen#define	major_netbsd(x)		((int32_t)((((x) & 0x000fff00) >>  8)))
4657429Smarkm#define	minor_netbsd(x)		((int32_t)((((x) & 0xfff00000) >> 12) | \
4799748Sdes					   (((x) & 0x000000ff) >>  0)))
4899748Sdes#define	makedev_netbsd(x,y)	((dev_t)((((x) <<  8) & 0x000fff00) | \
4999748Sdes					 (((y) << 12) & 0xfff00000) | \
5099748Sdes					 (((y) <<  0) & 0x000000ff)))
5199748Sdes
5299748Sdes#endif	/* _PACK_DEV_H */
5399748Sdes