dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / isns / isnsd / isns_dd.h
blob06b2469e2ed626940bbbda0c210d607e1d778ea5
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _ISNS_DD_H
28 #define _ISNS_DD_H
30 #include <synch.h>
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 typedef uint32_t bmp_t;
39 * dd matrix
41 typedef struct matrix {
42 uint32_t x, y;
43 /* uint32_t *z; */ /* obsoleted- map between uid & mid */
44 /* rwlock_t l; */ /* obsoleted */
45 bmp_t *m;
46 struct cache *c;
47 } matrix_t;
49 #define MATRIX_X_HEADER (1)
50 #define MATRIX_X_INFO(X) (X[0])
52 #define SIZEOF_X_UNIT(M) (((M)->x + MATRIX_X_HEADER) * sizeof (bmp_t))
53 #define MATRIX_X_UNIT(M, N) &(M)->m[(N) * ((M)->x + MATRIX_X_HEADER)]
55 #define NUM_OF_MEMBER(M) ((M)->x * sizeof (bmp_t) * 8)
56 #define UID2MID(M, UID) get_mid(M, UID)
57 #define NEW_MID(M, UID) new_mid(M, UID)
59 #define GET_PRIMARY(UID) (UID) / (sizeof (bmp_t) * 8)
60 #define GET_SECOND(UID) (UID) % (sizeof (bmp_t) * 8)
61 #define COMP_UID(PRI, SND) ((PRI) * sizeof (bmp_t) * 8 + (SND))
63 #define SET_MEMBERSHIP(BMP, PRI, SND) \
64 (BMP)[(PRI) + MATRIX_X_HEADER] |= (0x1 << (SND))
65 #define CLEAR_MEMBERSHIP(BMP, PRI, SND) \
66 (BMP)[(PRI) + MATRIX_X_HEADER] &= ~(0x1 << (SND))
68 #define TEST_MEMBERSHIP(BMP, PRI, SEC) \
69 ((BMP)[(PRI) + MATRIX_X_HEADER] & (0x1 << (SEC)))
71 #define FOR_EACH_MEMBER(BMP, NUM, UID, STMT) \
73 int i1624 = 0;\
74 while (i1624 < (NUM)) {\
75 int j1624 = 0;\
76 while (j1624 < 8 * sizeof ((BMP)[0])) {\
77 if (((BMP)[i1624] & (1 << j1624)) != 0) {\
78 UID = COMP_UID(i1624, j1624);\
79 STMT\
81 j1624 ++;\
83 i1624 ++;\
87 /* functions */
88 int dd_matrix_init(struct cache *);
89 int create_dd_object(isns_tlv_t *, uint16_t, isns_obj_t **);
90 int create_dds_object(isns_tlv_t *, uint16_t, isns_obj_t **);
91 int adm_create_dd(isns_obj_t **, uchar_t *, uint32_t, uint32_t);
92 int adm_create_dds(isns_obj_t **, uchar_t *, uint32_t, uint32_t);
93 int update_dd_name(uint32_t, uint32_t, uchar_t *);
94 int update_dds_name(uint32_t, uint32_t, uchar_t *);
95 int update_dd_features(uint32_t, uint32_t);
96 int update_dds_status(uint32_t, uint32_t);
97 uint32_t get_dd_id(uint32_t, uint32_t);
98 uint32_t get_dds_id(uint32_t, uint32_t);
99 uint32_t get_common_dd(uint32_t, uint32_t, uint32_t);
100 int remove_dd_object(uint32_t);
101 int remove_dds_object(uint32_t);
102 int add_dd_member(isns_obj_t *);
103 int add_dds_member(isns_obj_t *);
104 int remove_dd_member(isns_obj_t *);
105 int remove_dds_member(uint32_t, uint32_t);
106 int get_dd_matrix(const uint32_t, bmp_t **, uint32_t *);
107 int get_dds_matrix(const uint32_t, bmp_t **, uint32_t *);
108 int get_scope(uchar_t *, bmp_t **, uint32_t *);
109 int cb_clone_attrs(void *, void *);
110 int is_dd_active(uint32_t);
111 int update_ddd(void *, const uchar_t);
112 int verify_ddd(void);
114 #ifdef __cplusplus
116 #endif
118 #endif /* _ISNS_DD_H */