deal with cygwin's dev_t (John Gordon)
This commit is contained in:
parent
a99e10df08
commit
96618476db
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: mknod.c,v 1.26 2003/05/08 11:34:19 dsl Exp $ */
|
/* $NetBSD: mknod.c,v 1.27 2003/05/08 13:29:39 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
__COPYRIGHT("@(#) Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.\n");
|
__COPYRIGHT("@(#) Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.\n");
|
||||||
__RCSID("$NetBSD: mknod.c,v 1.26 2003/05/08 11:34:19 dsl Exp $");
|
__RCSID("$NetBSD: mknod.c,v 1.27 2003/05/08 13:29:39 christos Exp $");
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -71,7 +71,7 @@ main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *name, *p;
|
char *name, *p;
|
||||||
mode_t mode;
|
mode_t mode;
|
||||||
dev_t dev;
|
portdev_t dev;
|
||||||
pack_t *pack;
|
pack_t *pack;
|
||||||
u_long numbers[MAXARGS];
|
u_long numbers[MAXARGS];
|
||||||
int n, ch, fifo, hasformat;
|
int n, ch, fifo, hasformat;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: pack_dev.c,v 1.4 2003/05/08 09:38:03 lukem Exp $ */
|
/* $NetBSD: pack_dev.c,v 1.5 2003/05/08 13:29:39 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID) && !defined(lint)
|
#if defined(__RCSID) && !defined(lint)
|
||||||
__RCSID("$NetBSD: pack_dev.c,v 1.4 2003/05/08 09:38:03 lukem Exp $");
|
__RCSID("$NetBSD: pack_dev.c,v 1.5 2003/05/08 13:29:39 christos Exp $");
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -68,10 +68,10 @@ static int compare_format(const void *, const void *);
|
||||||
|
|
||||||
|
|
||||||
/* exported */
|
/* exported */
|
||||||
dev_t
|
portdev_t
|
||||||
pack_native(int n, u_long numbers[])
|
pack_native(int n, u_long numbers[])
|
||||||
{
|
{
|
||||||
dev_t dev;
|
portdev_t dev;
|
||||||
|
|
||||||
if (n == 2) {
|
if (n == 2) {
|
||||||
dev = makedev(numbers[0], numbers[1]);
|
dev = makedev(numbers[0], numbers[1]);
|
||||||
|
@ -85,10 +85,10 @@ pack_native(int n, u_long numbers[])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static dev_t
|
static portdev_t
|
||||||
pack_netbsd(int n, u_long numbers[])
|
pack_netbsd(int n, u_long numbers[])
|
||||||
{
|
{
|
||||||
dev_t dev;
|
portdev_t dev;
|
||||||
|
|
||||||
if (n == 2) {
|
if (n == 2) {
|
||||||
dev = makedev_netbsd(numbers[0], numbers[1]);
|
dev = makedev_netbsd(numbers[0], numbers[1]);
|
||||||
|
@ -104,13 +104,13 @@ pack_netbsd(int n, u_long numbers[])
|
||||||
|
|
||||||
#define major_freebsd(x) ((int32_t)(((x) & 0x0000ff00) >> 8))
|
#define major_freebsd(x) ((int32_t)(((x) & 0x0000ff00) >> 8))
|
||||||
#define minor_freebsd(x) ((int32_t)(((x) & 0xffff00ff) >> 0))
|
#define minor_freebsd(x) ((int32_t)(((x) & 0xffff00ff) >> 0))
|
||||||
#define makedev_freebsd(x,y) ((dev_t)((((x) << 8) & 0x0000ff00) | \
|
#define makedev_freebsd(x,y) ((portdev_t)((((x) << 8) & 0x0000ff00) | \
|
||||||
(((y) << 0) & 0xffff00ff)))
|
(((y) << 0) & 0xffff00ff)))
|
||||||
|
|
||||||
static dev_t
|
static portdev_t
|
||||||
pack_freebsd(int n, u_long numbers[])
|
pack_freebsd(int n, u_long numbers[])
|
||||||
{
|
{
|
||||||
dev_t dev;
|
portdev_t dev;
|
||||||
|
|
||||||
if (n == 2) {
|
if (n == 2) {
|
||||||
dev = makedev_freebsd(numbers[0], numbers[1]);
|
dev = makedev_freebsd(numbers[0], numbers[1]);
|
||||||
|
@ -126,13 +126,13 @@ pack_freebsd(int n, u_long numbers[])
|
||||||
|
|
||||||
#define major_8_8(x) ((int32_t)(((x) & 0x0000ff00) >> 8))
|
#define major_8_8(x) ((int32_t)(((x) & 0x0000ff00) >> 8))
|
||||||
#define minor_8_8(x) ((int32_t)(((x) & 0x000000ff) >> 0))
|
#define minor_8_8(x) ((int32_t)(((x) & 0x000000ff) >> 0))
|
||||||
#define makedev_8_8(x,y) ((dev_t)((((x) << 8) & 0x0000ff00) | \
|
#define makedev_8_8(x,y) ((portdev_t)((((x) << 8) & 0x0000ff00) | \
|
||||||
(((y) << 0) & 0x000000ff)))
|
(((y) << 0) & 0x000000ff)))
|
||||||
|
|
||||||
static dev_t
|
static portdev_t
|
||||||
pack_8_8(int n, u_long numbers[])
|
pack_8_8(int n, u_long numbers[])
|
||||||
{
|
{
|
||||||
dev_t dev;
|
portdev_t dev;
|
||||||
|
|
||||||
if (n == 2) {
|
if (n == 2) {
|
||||||
dev = makedev_8_8(numbers[0], numbers[1]);
|
dev = makedev_8_8(numbers[0], numbers[1]);
|
||||||
|
@ -148,13 +148,13 @@ pack_8_8(int n, u_long numbers[])
|
||||||
|
|
||||||
#define major_12_20(x) ((int32_t)(((x) & 0xfff00000) >> 20))
|
#define major_12_20(x) ((int32_t)(((x) & 0xfff00000) >> 20))
|
||||||
#define minor_12_20(x) ((int32_t)(((x) & 0x000fffff) >> 0))
|
#define minor_12_20(x) ((int32_t)(((x) & 0x000fffff) >> 0))
|
||||||
#define makedev_12_20(x,y) ((dev_t)((((x) << 20) & 0xfff00000) | \
|
#define makedev_12_20(x,y) ((portdev_t)((((x) << 20) & 0xfff00000) | \
|
||||||
(((y) << 0) & 0x000fffff)))
|
(((y) << 0) & 0x000fffff)))
|
||||||
|
|
||||||
static dev_t
|
static portdev_t
|
||||||
pack_12_20(int n, u_long numbers[])
|
pack_12_20(int n, u_long numbers[])
|
||||||
{
|
{
|
||||||
dev_t dev;
|
portdev_t dev;
|
||||||
|
|
||||||
if (n == 2) {
|
if (n == 2) {
|
||||||
dev = makedev_12_20(numbers[0], numbers[1]);
|
dev = makedev_12_20(numbers[0], numbers[1]);
|
||||||
|
@ -170,13 +170,13 @@ pack_12_20(int n, u_long numbers[])
|
||||||
|
|
||||||
#define major_14_18(x) ((int32_t)(((x) & 0xfffc0000) >> 18))
|
#define major_14_18(x) ((int32_t)(((x) & 0xfffc0000) >> 18))
|
||||||
#define minor_14_18(x) ((int32_t)(((x) & 0x0003ffff) >> 0))
|
#define minor_14_18(x) ((int32_t)(((x) & 0x0003ffff) >> 0))
|
||||||
#define makedev_14_18(x,y) ((dev_t)((((x) << 18) & 0xfffc0000) | \
|
#define makedev_14_18(x,y) ((portdev_t)((((x) << 18) & 0xfffc0000) | \
|
||||||
(((y) << 0) & 0x0003ffff)))
|
(((y) << 0) & 0x0003ffff)))
|
||||||
|
|
||||||
static dev_t
|
static portdev_t
|
||||||
pack_14_18(int n, u_long numbers[])
|
pack_14_18(int n, u_long numbers[])
|
||||||
{
|
{
|
||||||
dev_t dev;
|
portdev_t dev;
|
||||||
|
|
||||||
if (n == 2) {
|
if (n == 2) {
|
||||||
dev = makedev_14_18(numbers[0], numbers[1]);
|
dev = makedev_14_18(numbers[0], numbers[1]);
|
||||||
|
@ -192,13 +192,13 @@ pack_14_18(int n, u_long numbers[])
|
||||||
|
|
||||||
#define major_8_24(x) ((int32_t)(((x) & 0xff000000) >> 24))
|
#define major_8_24(x) ((int32_t)(((x) & 0xff000000) >> 24))
|
||||||
#define minor_8_24(x) ((int32_t)(((x) & 0x00ffffff) >> 0))
|
#define minor_8_24(x) ((int32_t)(((x) & 0x00ffffff) >> 0))
|
||||||
#define makedev_8_24(x,y) ((dev_t)((((x) << 24) & 0xff000000) | \
|
#define makedev_8_24(x,y) ((portdev_t)((((x) << 24) & 0xff000000) | \
|
||||||
(((y) << 0) & 0x00ffffff)))
|
(((y) << 0) & 0x00ffffff)))
|
||||||
|
|
||||||
static dev_t
|
static portdev_t
|
||||||
pack_8_24(int n, u_long numbers[])
|
pack_8_24(int n, u_long numbers[])
|
||||||
{
|
{
|
||||||
dev_t dev;
|
portdev_t dev;
|
||||||
|
|
||||||
if (n == 2) {
|
if (n == 2) {
|
||||||
dev = makedev_8_24(numbers[0], numbers[1]);
|
dev = makedev_8_24(numbers[0], numbers[1]);
|
||||||
|
@ -215,14 +215,14 @@ pack_8_24(int n, u_long numbers[])
|
||||||
#define major_12_12_8(x) ((int32_t)(((x) & 0xfff00000) >> 20))
|
#define major_12_12_8(x) ((int32_t)(((x) & 0xfff00000) >> 20))
|
||||||
#define unit_12_12_8(x) ((int32_t)(((x) & 0x000fff00) >> 8))
|
#define unit_12_12_8(x) ((int32_t)(((x) & 0x000fff00) >> 8))
|
||||||
#define subunit_12_12_8(x) ((int32_t)(((x) & 0x000000ff) >> 0))
|
#define subunit_12_12_8(x) ((int32_t)(((x) & 0x000000ff) >> 0))
|
||||||
#define makedev_12_12_8(x,y,z) ((dev_t)((((x) << 20) & 0xfff00000) | \
|
#define makedev_12_12_8(x,y,z) ((portdev_t)((((x) << 20) & 0xfff00000) | \
|
||||||
(((y) << 8) & 0x000fff00) | \
|
(((y) << 8) & 0x000fff00) | \
|
||||||
(((z) << 0) & 0x000000ff)))
|
(((z) << 0) & 0x000000ff)))
|
||||||
|
|
||||||
static dev_t
|
static portdev_t
|
||||||
pack_bsdos(int n, u_long numbers[])
|
pack_bsdos(int n, u_long numbers[])
|
||||||
{
|
{
|
||||||
dev_t dev;
|
portdev_t dev;
|
||||||
|
|
||||||
if (n == 2) {
|
if (n == 2) {
|
||||||
dev = makedev_12_20(numbers[0], numbers[1]);
|
dev = makedev_12_20(numbers[0], numbers[1]);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: pack_dev.h,v 1.2 2003/05/08 09:38:03 lukem Exp $ */
|
/* $NetBSD: pack_dev.h,v 1.3 2003/05/08 13:29:39 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
|
||||||
|
@ -39,7 +39,12 @@
|
||||||
#ifndef _PACK_DEV_H
|
#ifndef _PACK_DEV_H
|
||||||
#define _PACK_DEV_H
|
#define _PACK_DEV_H
|
||||||
|
|
||||||
typedef dev_t pack_t(int, u_long []);
|
#ifdef __GYGWIN__
|
||||||
|
typedef __dev32_t portdev_t;
|
||||||
|
#else
|
||||||
|
typedef dev_t portdev_t;
|
||||||
|
#endif
|
||||||
|
typedef portdev_t pack_t(int, u_long []);
|
||||||
|
|
||||||
pack_t *pack_find(const char *);
|
pack_t *pack_find(const char *);
|
||||||
pack_t pack_native;
|
pack_t pack_native;
|
||||||
|
|
Loading…
Reference in New Issue