xref: /titanic_52/usr/src/uts/common/avs/ns/nsctl/nsc_ncallio.h (revision fcf3ce441efd61da9bb2884968af01cb7c1452cc)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _NSC_NCALLIO_H
27 #define	_NSC_NCALLIO_H
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #ifndef __NSC_GEN__
34 Error: Illegal #include - private file.
35 #endif
36 
37 #include <sys/types.h>
38 #include <sys/nsctl/nsc_dev.h>
39 #include <sys/nsctl/nsctl.h>
40 
41 /*
42  * ncall-io structures
43  */
44 
45 /*
46  * local per-device info structure
47  */
48 typedef struct nsc_ncio_dev {
49 	struct nsc_ncio_dev	*next;			/* linkage */
50 	char			path[NSC_MAXPATH];	/* pathname */
51 	uint64_t		phash;			/* path hash */
52 	uint64_t		partsize;		/* size (FBAs) */
53 	int			snode;			/* server node */
54 	int			ref;			/* ref count */
55 } nsc_ncio_dev_t;
56 
57 
58 /*
59  * on the wire partsize request structure (reply is inline).
60  */
61 typedef struct nsc_ncio_size {
62 	char	path[NSC_MAXPATH];
63 } nsc_ncio_size_t;
64 
65 
66 /*
67  * buffer handle and one the wire representation.
68  */
69 
70 #define	NSC_NCIO_MAXDATA	(NCALL_DATA_SZ - FBA_SIZE(1))
71 
72 
73 typedef struct nsc_ncio_rw {
74 	union {
75 		struct {
76 			int	snode;			/* server node */
77 			uint64_t pos;			/* offset of i/o */
78 			uint64_t len;			/* length of i/o */
79 			char	path[NSC_MAXPATH];	/* path of device */
80 		} rw;
81 		char pad[FBA_SIZE(1)];			/* pad to FBA */
82 	} rw_u;
83 	char	rw_data[NSC_NCIO_MAXDATA];		/* data */
84 } nsc_ncio_rw_t;
85 
86 #define	rw_snode	rw_u.rw.snode
87 #define	rw_path		rw_u.rw.path
88 #define	rw_pos		rw_u.rw.pos
89 #define	rw_len		rw_u.rw.len
90 
91 
92 typedef struct nsc_ncio_bufh {
93 	nsc_buf_t	bufh;
94 	nsc_vec_t	vec[2];
95 	void		(*disc)();
96 	struct nsc_ncio_bufh *next;
97 	struct nsc_ncio_rw rw;
98 } nsc_ncio_buf_t;
99 
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
105 #endif /* _NSC_NCALLIO_H */
106