VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuest/testcase/solaris.h@ 40311

Last change on this file since 40311 was 40311, checked in by vboxsync, 13 years ago

Additions/VBoxGuest: first drop of streams-based Solaris version, not yet tested or even compiled under Solaris.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 10.1 KB
Line 
1/* $Id: solaris.h 40311 2012-03-01 12:09:56Z vboxsync $ */
2/** @file
3 * VBoxGuest - Guest Additions Driver for Solaris - testcase stubs.
4 */
5
6/*
7 * Copyright (C) 2011 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it ddi_info_cmd_tcomes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ___VBoxGuestTestCaseSolaris_h
19#define ___VBoxGuestTestCaseSolaris_h
20
21#include <iprt/assert.h>
22#include <iprt/string.h> /* RT_ZERO */
23#include <errno.h>
24
25/* Const#define MOD_NOAUTOUNLOAD 0x1ants */
26#define DDI_FAILURE (-1)
27#define DDI_SUCCESS (0)
28
29#define MODMAXNAMELEN 32
30#define MODMAXLINKINFOLEN 32
31#define MODMAXLINK 10
32
33#define MOD_NOAUTOUNLOAD 0x1
34
35#define M_BREAK 0x08
36#define M_PASSFP 0x09
37#define M_EVENT 0x0a
38#define M_SIG 0x0b
39#define M_DELAY 0x0c
40#define M_CTL 0x0d
41#define M_IOCTL 0x0e
42#define M_SETOPTS 0x10
43#define M_RSE 0x11
44
45#define M_IOCACK 0x81
46#define M_IOCNAK 0x82
47#define M_PCPROTO 0x83
48#define M_PCSIG 0x84
49#define M_READ 0x85
50#define M_FLUSH 0x86
51#define M_STOP 0x87
52#define M_START 0x88
53#define M_HANGUP 0x89
54#define M_ERROR 0x8a
55#define M_COPYIN 0x8b
56#define M_COPYOUT 0x8c
57#define M_IOCDATA 0x8d
58#define M_PCRSE 0x8e
59#define M_STOPI 0x8f
60#define M_STARTI 0x90
61#define M_PCEVENT 0x91
62#define M_UNHANGUP 0x92
63#define M_CMD 0x93
64
65#define FLUSHALL 1
66#define FLUSHDATA 0
67
68#define TRANSPARENT (unsigned int)(-1)
69
70#define FLUSHR 0x01
71#define FLUSHW 0x02
72
73#define MSIOC ('m'<<8)
74#define MSIOGETPARMS (MSIOC|1)
75#define MSIOSETPARMS (MSIOC|2)
76#define MSIOBUTTONS (MSIOC|3)
77#define MSIOSRESOLUTION (MSIOC|4)
78
79#define VUIOC ('v'<<8)
80#define VUIDSFORMAT (VUIOC|1)
81#define VUIDGFORMAT (VUIOC|2)
82#define VUID_NATIVE 0
83#define VUID_FIRM_EVENT 1
84
85#define VUIDSADDR (VUIOC|3)
86#define VUIDGADDR (VUIOC|4)
87
88#define VUID_WHEEL_MAX_COUNT 256
89#define VUIDGWHEELCOUNT (VUIOC|15)
90#define VUIDGWHEELINFO (VUIOC|16)
91#define VUIDGWHEELSTATE (VUIOC|17)
92#define VUIDSWHEELSTATE (VUIOC|18)
93
94#define DDI_DEVICE_ATTR_V0 0x0001
95#define DDI_DEVICE_ATTR_V1 0x0002
96
97#define DDI_NEVERSWAP_ACC 0x00
98#define DDI_STRUCTURE_LE_ACC 0x01
99#define DDI_STRUCTURE_BE_ACC 0x02
100
101#define DDI_STRICTORDER_ACC 0x00
102#define DDI_UNORDERED_OK_ACC 0x01
103#define DDI_MERGING_OK_ACC 0x02
104#define DDI_LOADCACHING_OK_ACC 0x03
105#define DDI_STORECACHING_OK_ACC 0x04
106
107/** @todo fix this */
108#define DDI_DEFAULT_ACC DDI_STRICTORDER_ACC
109
110#define DDI_INTR_CLAIMED 1
111#define DDI_INTR_UNCLAIMED 0
112
113#define DDI_INTR_TYPE_FIXED 0x1
114#define DDI_INTR_TYPE_MSI 0x2
115#define DDI_INTR_TYPE_MSIX 0x4
116
117#define LOC_FIRST_DELTA 32640
118#define LOC_X_DELTA 32640
119#define LOC_Y_DELTA 32641
120#define LOC_LAST_DELTA 32641
121#define LOC_FIRST_ABSOLUTE 32642
122#define LOC_X_ABSOLUTE 32642
123#define LOC_Y_ABSOLUTE 32643
124#define LOC_LAST_ABSOLUTE 32643
125
126#define FE_PAIR_NONE 0
127#define FE_PAIR_SET 1
128#define FE_PAIR_DELTA 2
129#define FE_PAIR_ABSOLUTE 3
130
131typedef enum
132{
133 DDI_INFO_DEVT2DEVINFO = 0,
134 DDI_INFO_DEVT2INSTANCE = 1
135} ddi_info_cmd_t;
136
137typedef enum
138{
139 DDI_ATTACH = 0,
140 DDI_RESUME = 1,
141 DDI_PM_RESUME = 2
142} ddi_attach_cmd_t;
143
144typedef enum
145{
146 DDI_DETACH = 0,
147 DDI_SUSPEND = 1,
148 DDI_PM_SUSPEND = 2,
149 DDI_HOTPLUG_DETACH = 3
150} ddi_detach_cmd_t;
151
152/* Simple types */
153
154typedef struct cred *cred_t;
155typedef struct dev_info *dev_info_t;
156typedef struct __ddi_acc_handle * ddi_acc_handle_t;
157typedef struct __ddi_intr_handle *ddi_intr_handle_t;
158typedef struct mutex *kmutex_t;
159typedef unsigned long uint_t;
160typedef unsigned short ushort_t;
161typedef unsigned char uchar_t;
162
163/* Structures */
164
165struct modspecific_info {
166 char msi_linkinfo[MODMAXLINKINFOLEN];
167 int msi_p0;
168};
169
170struct modinfo {
171 int mi_info;
172 int mi_state;
173 int mi_id;
174 int mi_nextid;
175 char *mi_base; /* Was caddr_t */
176 size_t mi_size;
177 int mi_rev;
178 int mi_loadcnt;
179 char mi_name[MODMAXNAMELEN];
180 struct modspecific_info mi_msinfo[MODMAXLINK];
181};
182
183typedef struct queue
184{
185 struct qinit *q_qinfo;
186 struct msgb *q_first;
187 struct msgb *q_last;
188 struct queue *q_next;
189 void *q_ptr;
190 size_t q_count;
191 uint_t q_flag;
192 ssize_t q_minpsz;
193 ssize_t q_maxpsz;
194 size_t q_hiwat;
195 size_t q_lowat;
196} queue_t;
197
198typedef struct msgb
199{
200 struct msgb *b_next;
201 struct msgb *b_prev;
202 struct msgb *b_cont;
203 unsigned char *b_rptr;
204 unsigned char *b_wptr;
205 struct datab *b_datap;
206 unsigned char b_band;
207 unsigned short b_flag;
208} mblk_t;
209
210typedef struct datab
211{
212 unsigned char *db_base;
213 unsigned char *db_lim;
214 unsigned char db_ref;
215 unsigned char db_type;
216} dlk_t;
217
218struct iocblk
219{
220 int ioc_cmd;
221 cred_t *ioc_cr;
222 uint_t ioc_id;
223 uint_t ioc_flag;
224 uint_t ioc_count;
225 int ioc_rval;
226 int ioc_error;
227};
228
229struct copyresp
230{
231 int cp_cmd;
232 cred_t *cp_cr;
233 uint_t cp_id;
234 uint_t cp_flag;
235 mblk_t *cp_private;
236 caddr_t cp_rval;
237};
238
239typedef struct modctl
240{
241 /* ... */
242 char mod_loadflags;
243 /* ... */
244} modctl_t;
245
246typedef struct {
247 int jitter_thresh;
248 int speed_law;
249 int speed_limit;
250} Ms_parms;
251
252typedef struct {
253 int height;
254 int width;
255} Ms_screen_resolution;
256
257typedef struct vuid_addr_probe {
258 short base;
259 union
260 {
261 short next;
262 short current;
263 } data;
264} Vuid_addr_probe;
265
266typedef struct ddi_device_acc_attr
267{
268 ushort_t devacc_attr_version;
269 uchar_t devacc_attr_endian_flags;
270 uchar_t devacc_attr_dataorder;
271 uchar_t devacc_attr_access;
272} ddi_device_acc_attr_t;
273
274typedef struct firm_event
275{
276 ushort_t id;
277 uchar_t pair_type;
278 uchar_t pair;
279 int value;
280 struct timeval time;
281} Firm_event;
282
283/* Prototypes */
284
285#define _init vboxguestSolarisInit
286extern int vboxguestSolarisInit(void);
287#define _fini vboxguestSolarisFini
288extern int vboxguestSolarisFini(void);
289#define _info vboxguestSolarisInfo
290extern int vboxguestSolarisInfo(struct modinfo *pModInfo);
291
292/* Simple API stubs */
293
294#define cmn_err(...) do {} while(0)
295#define allocb(...) NULL
296#define ddi_soft_state_init(...) 0
297#define ddi_soft_state_fini(...) do {} while(0)
298#define mod_install(...) 0
299#define mod_remove(...) 0
300#define mod_info(...) 0
301#define makedevice(...) 0
302#define getmajor(...) 0
303#define RTR0Init(...) VINF_SUCCESS
304#define RTR0Term(...) do {} while(0)
305#define VBoxGuestCreateKernelSession(...) VINF_SUCCESS
306#define VBoxGuestCreateUserSession(...) VINF_SUCCESS
307#define VBoxGuestCloseSession(...) do {} while(0)
308#define VBoxGuestInitDevExt(...) VINF_SUCCESS
309#define VBoxGuestDeleteDevExt(...) do {} while(0)
310#define VBoxGuestCommonIOCtl(...) VINF_SUCCESS
311#define VBoxGuestCommonISR(...) true
312#define VbglGRAlloc(...) VINF_SUCCESS
313#define VbglGRPerform(...) VINF_SUCCESS
314#define VbglGRFree(...) do {} while(0)
315#define qprocson(...) do {} while(0)
316#define qprocsoff(...) do {} while(0)
317#define flushq(...) do {} while(0)
318#define qreply(...) do {} while(0)
319#define miocack(...) do {} while(0)
320#define miocnak(...) do {} while(0)
321#define mcopyin(...) do {} while(0)
322#define mcopyout(...) do {} while(0)
323#define freemsg(...) do {} while(0)
324#define putnext(...) do {} while(0)
325#define miocpullup(...) 0
326#define ddi_get_instance(...) 0
327#define pci_config_setup(...) DDI_SUCCESS
328#define pci_config_teardown(...) do {} while(0)
329#define ddi_regs_map_setup(...) DDI_SUCCESS
330#define ddi_regs_map_free(...) do {} while(0)
331#define ddi_dev_regsize(...) DDI_SUCCESS
332#define ddi_create_minor_node(...) DDI_SUCCESS
333#define ddi_remove_minor_node(...) do {} while(0)
334#define ddi_intr_get_supported_types(...) DDI_SUCCESS
335#define ddi_intr_get_nintrs(...) DDI_SUCCESS
336#define ddi_intr_get_navail(...) DDI_SUCCESS
337#define ddi_intr_alloc(...) DDI_SUCCESS
338#define ddi_intr_free(...) do {} while(0)
339#define ddi_intr_get_pri(...) DDI_SUCCESS
340#define ddi_intr_enable(...) DDI_SUCCESS
341#define ddi_intr_disable(...) DDI_SUCCESS
342#define ddi_intr_add_handler(...) DDI_SUCCESS
343#define ddi_intr_remove_handler(...) DDI_SUCCESS
344#define mutex_init(...) do {} while(0)
345#define mutex_destroy(...) do {} while(0)
346#define mutex_enter(...) do {} while(0)
347#define mutex_exit(...) do {} while(0)
348#define uniqtime32(...) do {} while(0)
349#define canput(...) true
350#define putbq(...) do {} while(0)
351
352/* API stubs with simple logic */
353
354static modctl_t s_ModCtl;
355
356#define mod_getctl(...) (&s_ModCtl)
357
358#define QREADR 0x00000010
359#define WR(q) ((q)->q_flag & QREADR ? (q) + 1 : (q))
360#define RD(q) ((q)->q_flag & QREADR ? (q) : (q) - 1)
361
362/* API stubs with controllable logic */
363
364void *s_pSoftState[256];
365void *s_pInstSoftState;
366
367static void testSetInstSoftState(void *pInst, unsigned cAllocated)
368{
369 unsigned i;
370 Assert(cAllocated < RT_ELEMENTS(s_pSoftState));
371 s_pInstSoftState = pInst;
372 RT_ZERO(s_pSoftState);
373 for (i = 0; i < cAllocated; ++i)
374 s_pSoftState[i] = (void *)1;
375}
376
377#define ddi_get_soft_state(a, c) \
378 (c < RT_ELEMENTS(s_pSoftState) ? s_pSoftState[c] : NULL)
379#define ddi_soft_state_zalloc(a, c) \
380 ( c < RT_ELEMENTS(s_pSoftState) && (s_pSoftState[c] = s_pInstSoftState) \
381 ? DDI_SUCCESS : DDI_FAILURE)
382#define ddi_soft_state_free(a, c) \
383 (c < RT_ELEMENTS(s_pSoftState) ? s_pSoftState[c] = NULL : NULL)
384
385#endif /* ___VBoxGuestTestCaseSolaris_h */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette