VirtualBox

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

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

Additions/Common/VBoxGuest: put Solaris helper functions into their own file.

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