1299425Smm/*	$NetBSD: pack_dev.h,v 1.8 2013/06/14 16:28:20 tsutsui Exp $	*/
2299425Smm
3299425Smm/*-
4299425Smm * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
5299425Smm * All rights reserved.
6299425Smm *
7299425Smm * This code is derived from software contributed to The NetBSD Foundation
8299425Smm * by Charles M. Hannum.
9299425Smm *
10299425Smm * Redistribution and use in source and binary forms, with or without
11299425Smm * modification, are permitted provided that the following conditions
12299425Smm * are met:
13299425Smm * 1. Redistributions of source code must retain the above copyright
14299425Smm *    notice, this list of conditions and the following disclaimer.
15299425Smm * 2. Redistributions in binary form must reproduce the above copyright
16299425Smm *    notice, this list of conditions and the following disclaimer in the
17299425Smm *    documentation and/or other materials provided with the distribution.
18299425Smm *
19299425Smm * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20299425Smm * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21299425Smm * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22299425Smm * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23299425Smm * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24299425Smm * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25299425Smm * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26299425Smm * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27299425Smm * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28299425Smm * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29299425Smm * POSSIBILITY OF SUCH DAMAGE.
30299425Smm */
31299425Smm
32299425Smm/* Originally from NetBSD's mknod(8) source. */
33299425Smm
34358090Smm#ifndef	ARCHIVE_PACK_DEV_H
35358090Smm#define	ARCHIVE_PACK_DEV_H
36299425Smm
37299425Smmtypedef	dev_t pack_t(int, unsigned long [], const char **);
38299425Smm
39299425Smmpack_t	*pack_find(const char *);
40299425Smmpack_t	 pack_native;
41299425Smm
42299425Smm#define	major_netbsd(x)		((int32_t)((((x) & 0x000fff00) >>  8)))
43299425Smm#define	minor_netbsd(x)		((int32_t)((((x) & 0xfff00000) >> 12) | \
44299425Smm					   (((x) & 0x000000ff) >>  0)))
45299425Smm#define	makedev_netbsd(x,y)	((dev_t)((((x) <<  8) & 0x000fff00) | \
46299425Smm					 (((y) << 12) & 0xfff00000) | \
47299425Smm					 (((y) <<  0) & 0x000000ff)))
48299425Smm
49358090Smm#endif	/* ARCHIVE_PACK_DEV_H */
50