aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/include/generic-netbsd/dev/pud/pud_msgif.h
blob: e89dd2d64ed6109e894c8855905d7be198d79a56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*	$NetBSD: pud_msgif.h,v 1.4 2007/11/28 16:59:02 pooka Exp $	*/

/*
 * Copyright (c) 2007  Antti Kantee.  All Rights Reserved.
 *
 * Development of this software was supported by the
 * Research Foundation of Helsinki University of Technology
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#ifndef _DEV_PUD_PUDMSGIF_H_
#define _DEV_PUD_PUDMSGIF_H_

#include <dev/putter/putter.h>

struct pud_req {
	struct putter_hdr	pdr_pth;

	dev_t			pdr_dev;

	pid_t			pdr_pid;
	lwpid_t			pdr_lid;

	int			pdr_reqclass;
	int			pdr_reqtype;

	uint64_t		pdr_reqid;
	int			pdr_rv;

	size_t			pdr_len;
	uint8_t			pdr_data[0];
};

#define PUD_REQ_CDEV	1
#define PUD_REQ_BDEV	2
#define PUD_REQ_CONF	3

struct pud_register {
	dev_t	pm_dev;
};

#define pud_creq_open pud_req_openclose
#define pud_creq_close pud_req_openclose
struct pud_req_openclose {
	struct pud_req	pm_pdr;

	int		pm_flags;
	int		pm_fmt;
};

#define pud_creq_read pud_req_readwrite
#define pud_creq_write pud_req_readwrite
struct pud_req_readwrite {
	struct pud_req	pm_pdr;

	off_t		pm_offset;
	size_t		pm_resid;

	uint8_t		pm_data[0];
};

struct pud_req_ioctl {
	struct pud_req	pm_pdr;

	u_long		pm_iocmd;
	int		pm_flag;	/* XXX: I feel like a cargo cult */

	uint8_t		pm_data[0];
};

#define PUD_DEVNAME_MAX 31
struct pud_conf_reg {
	struct pud_req	pm_pdr;

	int		pm_version;
	dev_t		pm_regdev;
	int		pm_flags;
	char		pm_devname[PUD_DEVNAME_MAX+1];
};
#define PUD_CONFFLAG_BDEV	1

#define PUD_DEVELVERSION	0x80000000
#define PUD_VERSION		1

enum {
	PUD_CDEV_OPEN,	PUD_CDEV_CLOSE,	PUD_CDEV_READ,	PUD_CDEV_WRITE,
	PUD_CDEV_IOCTL,	PUD_CDEV_POLL,	PUD_CDEV_MMAP,	PUD_CDEV_KQFILTER,
	PUD_CDEV_STOP,	PUD_CDEV_TTY,
};

enum {
	PUD_BDEV_OPEN,	PUD_BDEV_CLOSE, PUD_BDEV_STRATREAD, PUD_BDEV_STRATWRITE,
	PUD_BDEV_IOCTL,	PUD_BDEV_DUMP,	PUD_BDEV_PSIZE,
};

enum {
	PUD_CONF_REG,	PUD_CONF_DEREG,	PUD_CONF_MMAP,
};

#endif /* _DEV_PUD_PUDMSGIF_H_ */