summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/avs/ns/contract.h
blob: 0a4ec90e43ab13e289aa650b5233dfadae77511f (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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

/*
 * The sole purpose of this file is to document our violations of the DDI
 * in Solaris and to get ddict to run on the data services stack.
 * Definitions and declarations contained in this file are never compiled
 * into the code.  It is only included if we are running ddict on our src.
 *
 * IMPORTANT NOTE:
 * Many of the declarations are not correct. It does not matter.
 * Structure declarations only define the fields we require.
 * Structures which we use in an opaque manner are defined as void *
 */

#ifndef	_SYS_CONTRACT_H
#define	_SYS_CONTRACT_H

#ifdef	__cplusplus
extern "C" {
#endif

/*
 * Define our interfaces for nsctl because ddict is stupid
 * about intermodule dependencies
 */
#include <sys/nsctl/nsctl_inter.h>

/*
 * Define our ncall interfaces
 */
#include <sys/nsctl/ncall_inter.h>

/*
 * The STRUCT_DECL definitions in the ddict headers are fouled up
 * we include our own model.h here to redefine it to avoid errors.
 */
#if !defined(_SunOS_5_6)
#include <sys/nsctl/model.h>
#endif

/*
 * General violations
 * Everybody violates these
 * Why are they called ddi if it is not part of it?
 */

#define	DDI_PROP_NOTPROM 0

int ddi_rele_driver(void) { }
int ddi_hold_installed_driver(void) { }

/*
 * SV module violations
 */
void *curthread;
int devcnt;

/*
 * The following from vnode.h
 */
typedef struct  vode {
	int v_lock;	/* SDBC uses this too */
	int v_type;	/* nskern too */
	int v_rdev;	/* nskern too */
} vnode_t;

#define	FOLLOW 0
#define	NULLVPP NULL
#define	AT_RDEV 0
#define	VOP_GETATTR(vp, vap, f, cr) ((void)0)
#define	VN_RELE(vp) ((void)0)

/*
 *  The fields we use from vattr_t
 */
typedef struct vattr {
	uint_t	va_mask;
	dev_t	va_rdev;
	int	va_size;	/* nskern */
} vattr_t;

int lookupname(void, void, void, void, void) { }

/*
 * End of SV module violations
 */

/*
 * DSW/II module violations
 */

/*
 * This is really bogus that ddict does not understand sys/inttypes.h
 */
#define	INT32_MIN	0
#define	INT32_MAX	0
#define	INT64_MAX	0

/*
 * End of DSW/II module violations
 */

/*
 * UNISTAT module violations
 */

void mod_miscops;
typedef enum { B_FALSE, B_TRUE } boolean_t;

/*
 * End of UNISTAT module violations
 */

/*
 * NSCTL module violations
 */
#define	ERESTART 0
#define	EUSERS 0
#define	ENAMETOOLONG 0
#define	ENOSYS	0
#define	FOPEN	0
int ddi_name_to_major() { }
/*
 * End of NSCTL module violations
 */

/*
 * NSKERN module violations
 */
#define	UL_GETFSIZE	0
#define	USHRT_MAX	0

typedef	u_longlong_t	rlim64_t;
int ulimit() { }
int maxphys;

#define	AT_SIZE	0
#define	VBLK	0
#define	VCHR	0
#define	VREG	0
#define	VLNK	0

#define	VOP_CLOSE(vp, f, c, o, cr)	((void)0)
#define	VOP_RWLOCK(vp, w)	((void)0)
#define	VOP_RWUNLOCK(vp, w)	((void)0)
#define	VOP_READ(vp, uiop, iof, cr)	((void)0)
#define	VOP_WRITE(vp, uiop, iof, cr)	((void)0)

int vn_open(char *pnamep, void seg, int filemode, int createmode,
		struct vnode **vpp, void crwhy, mode_t umask) { }

/*
 * End of NSKERN module violations
 */

/*
 * NVRAM module violations
 */
#define	MMU_PAGESIZE	0

#ifndef MAXNAMELEN
#define	MAXNAMELEN	1
#endif

#define	DEVMAP_DEFAULTS 0
#define	PFN_INVALID	-1

char hw_serial[1];
int mmu_ptob(void arg) { }
int roundup(void arg) { }

/*
 * End of NVRAM module violations
 */

/*
 * RDCSVR (SNDR) module
 * Contract PSARC 2001/699
 */
#define	DUP_DONE	0
#define	DUP_ERROR	0
#define	DUP_INPROGRESS	0
#define	DUP_NEW		0
#define	DUP_DROP	0

#define	RPC_MAXDATASIZE	0


typedef void * file_t;		/* opaque */
typedef	void SVCXPRT;		/* opaque */
typedef	void SVCMASTERXPRT;	/* opaque */
typedef void xdrproc_t;		/* opaque */
typedef int enum_t;

typedef struct svc_req {	/* required fields */
	int rq_vers;
	int rq_proc;
} svc_req_t;

void SVC_FREEARGS(void xprt, void a, void *b) { }
void SVC_DUP(void xprt, void req, void i, void j, void *dr) { }
void svcerr_systemerr(void xprt) { }
void svcerr_noproc(void xprt) { }
void SVC_DUPDONE(void xprt, void dr, void a, void b, void c) { }

SVCXPRT *svc_tli_kcreate(void *f, void *n, void *b, void **x, void *t,
	uint_t c, uint_t d) { }

/*
 * non-ddi not under contracts
 */
struct netbuf {
	int	maxlen;
	int	len;
	char	*buf;
}

/*
 * End of RDCSRV module Contracts
 */

/*
 * RDC (SNDR) module
 * Contract PSARC 2001/699
 */

typedef	u_longlong_t	rpcproc_t;
typedef	u_longlong_t	xdrproc_t;
typedef	u_longlong_t	rpcvers_t;
#define	__dontcare__    -1
#define	RPC_INTR 0
#define	RPC_SUCCESS	0
#define	RPC_TLIERROR	0
#define	RPC_XPRTFAILED	0
#define	RPC_VERSMISMATCH	0
#define	RPC_PROGVERSMISMATCH 0
#define	RPC_INPROGRESS	0

#define	ENOEXEC	0
#define	EBADF	0

/*
 * XDR routines
 * from rpc/xdr.h
 */
typedef	void * XDR;	/* opaque */
int xdr_void() { }
int xdr_int() { }
int xdr_union() { }
int xdr_enum() { }
int xdr_u_int() { }
int xdr_u_longlong_t() { }
int xdr_opaque() { }
int xdr_bytes() { }
int xdr_array() { }
#define	NULL_xdrproc_t ((xdrproc_t)0)

/*
 * The following imported rpc/clnt.h
 */

/* Client is mostly opaque exccept for the following */

typedef struct __client {	/* required fields */
	void *cl_auth;
	bool_t cl_nosignal;
} CLIENT;

#define	CLSET_PROGRESS	0
#define	KNC_STRSIZE	128
struct knetconfig {
	unsigned int	knc_semantics;
	caddr_t		knc_protofmly;
	caddr_t		knc_proto;
	dev_t		knc_rdev;
};

void *clnt_sperrno() { }
void IS_UNRECOVERABLE_RPC(a) { }
void CLNT_CONTROL(cl, request, info) { }
void AUTH_DESTROY(void *a) { }
void CLNT_DESTROY(void *a) { }

int clnt_tli_kcreate(void *a, void *b, void c, void d, void e, void f,
	void *g, void **h) { }

int clnt_tli_kinit(void *h, void *config, void *addr, uint_t a, int b,
	void *c) { }

void	 CLNT_CALL(void, void, void, void, void, void, void) { }

/*
 * The following imported from rpc/svc.h
 */
void svc_sendreply() { }
void svcerr_decode() { }
void SVC_GETARGS() { }

/*
 * The following imported from sys/file.h
 */

void getf(void) { }
void releasef(void) { }

/*
 * Not under contract
 */
void sigintr(void) { }
void sigunintr(void) { }
dev_t expldev() { }

/*
 * End of RDC module
 */

/*
 * SDBC module violations
 */

/*
 *  devid uses internal structure
 *  from sys/ddi_impldefs.h
 */
typedef struct impl_devid {
	uchar_t did_type_hi;
	uchar_t did_type_lo;
} impl_devid_t;

#define	DEVID_GETTYPE(devid)  0
#define	DEVID_SCSI_SERIAL 0

#define	ENOLINK	0	/* NCALL too */
#define	E2BIG	0
#define	ENOENT 0
#define	EIDRM 0

#define	B_KERNBUF 0
#define	KSTAT_TYPE_RAW 0
#define	MAXPATHLEN 0

#define	VN_HOLD(bp) ((void)0)

/* Page list IO stuff */
typedef struct page {
	int v_count;	/* sdbc */
} page_t;
page_t kvp;		/* We use the kernel segment */
int page_add(void) { }
int page_find(void) { }
int page_list_concat(void) { }
int pageio_setup(void) { }
int pageio_done(void) { }

void kobj_getsymvalue(void) { }
int ddi_dev_pathname(void) { }

/*
 * HACK ALERT
 * struct buf hack for ddict.
 * SDBC currently violates in struct buf
 * 	b_pages
 *	b_proc
 * which we will define as the pad fields for ddict since
 * we can not overload the definition of struct buf with our own stuff.
 */

#define	b_pages	b_pad7	/* b_pages in struct buf */
#define	b_proc	b_pad8	/* b_proc in struct buf */
#define	b_forw	b_pad1	/* b_forw in struct buf */
#define	b_back	b_pad2	/* b_back in struct buf */

/*
 * End of SDBC moduel violations
 */

/*
 * SCMTEST module violations
 */

#define	ESRCH	0	/* NCALL too */

/*
 * End of SCMTEST module violations
 */
/*
 * SFTM module violations
 * Note: XXX This list is currently incomplete
 */

typedef void * cqe_t;			/* opaque */
typedef void * fcal_packet_t;		/* opaque */
typedef void * soc_response_t;		/* opaque */
typedef void * la_els_logi_t;		/* opaque */
typedef void * la_els_adisc_t;		/* opaque */
typedef void * fcp_rsp_t;		/* opaque */
typedef void * soc_request_t;		/* opaque */
typedef void * els_payload_t;		/* opaque */
typedef void * la_els_logo_t;		/* opaque */
typedef void * fc_frame_header_t;	/* opaque */

typedef struct la_els_prli_s {
	uchar_t		ls_code;
	uchar_t		page_length;
	ushort_t	payload_length;
	uchar_t		service_params[1];
} la_els_prli_t;

typedef	la_els_prli_t la_els_prli_reply_t;
typedef la_els_prli_t la_els_prlo_t;
typedef	la_els_prli_t la_els_prlo_reply_t;

/*
 * The following from /usr/include/sys/fc4/fcp.h
 */
typedef struct fcp_cntl {
	uchar_t	cntl_reserved_1	: 5,
		cntl_qtype	: 3;
	uchar_t	cntl_kill_tsk	: 1,
		cntl_clr_aca	: 1,
		cntl_reset	: 1,
		cntl_reserved_2	: 2,
		cntl_clr_tsk	: 1,
		cntl_abort_tsk	: 1,
		cntl_reserved_3	: 1;
	uchar_t	cntl_reserved_4	: 6,
		cntl_read_data	: 1,
		cntl_write_data	: 1;
} fcp_cntl_t;

typedef struct fcp_ent_addr {
	ushort_t ent_addr_0;
	ushort_t ent_addr_1;
	ushort_t ent_addr_2;
	ushort_t ent_addr_3;
} fcp_ent_addr_t;

typedef struct fcp_cmd_s {
	fcp_ent_addr_t	fcp_ent_addr;
	fcp_cntl_t	fcp_cntl;
	uchar_t		fcp_cdb[1];
	int		fcp_data_len;
} fcp_cmd_t;

typedef struct fcal_transport {
	uchar_t dummy1;
	uchar_t dummy2;
} fcal_transport_t;

/*
 * End of SFTM module violations
 */

/*
 * STE module violations
 */

typedef void  la_wwn_t;		/* opaque */
/* WWN formats from sys/fcal/fcal_linkapp.h */
typedef union la_wwn {
	uchar_t		raw_wwn[8];
	struct {
		uint_t	naa_id : 4;
		uint_t	nport_id : 12;
		uint_t	wwn_hi : 16;
		uint_t	wwn_lo;
	} w;
} la_wwn_t;

insque(void) { }
remque(void) { }
snprintf(void) { }

/*
 * STE uses inq_serial and inq_ackqreqq from struct scsi_inquiry
 */
#define	inq_serial	inq_pid
#define	inq_ackqreqq	inq_pid
/*
 * End of STE module violations
 */

/*
 * NCALL module violations
 */
#define	ENONET	0

/* NCALLSRV */
typedef int bool_t;

/* NCALLIP */
#ifndef TRUE
#define	TRUE	1
#endif

#ifndef FALSE
#define	FALSE	0
#endif

#define	ERANGE	0
#define	ENODATA	0

#define	RPC_TIMEDOUT 0

/*
 * End of NCALL violations
 */
#ifdef	__cplusplus
}
#endif

#endif /* _SYS_CONTRACT_H */