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 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #include <sys/types.h>
27 #include <sys/ksynch.h>
28 #include <sys/cmn_err.h>
29 #include <sys/kmem.h>
30 #include <sys/conf.h>
31 #include <sys/errno.h>
32
33 #ifdef _SunOS_5_6
34 /*
35 * on 2.6 both dki_lock.h and rpc/types.h define bool_t so we
36 * define enum_t here as it is all we need from rpc/types.h
37 * anyway and make it look like we included it. Yuck.
38 */
39 #define _RPC_TYPES_H
40 typedef int enum_t;
41 #else
42 #ifndef DS_DDICT
43 #include <rpc/types.h>
44 #endif
45 #endif /* _SunOS_5_6 */
46
47 #include <sys/ddi.h>
48
49 #include <sys/nsc_thread.h>
50 #include <sys/nsctl/nsctl.h>
51
5622
5623 /* Changed autosync, so update rest of the group */
5624
5625 for (p = krdc->group_next; p != krdc; p = p->group_next) {
5626 q = &rdc_u_info[p->index];
5627 q->autosync = urdc->autosync;
5628 rdc_write_state(q);
5629 }
5630 }
5631
5632 done:
5633 rdc_group_exit(krdc);
5634
5635 mutex_enter(&rdc_conf_lock);
5636 wakeup_busy(krdc);
5637 mutex_exit(&rdc_conf_lock);
5638
5639 return (rc);
5640 }
5641
5642 /*
5643 * Yet another standard thing that is not standard ...
5644 */
5645 #ifndef offsetof
5646 #define offsetof(s, m) ((size_t)(&((s *)0)->m))
5647 #endif
5648
5649 static int
5650 rdc_status(void *arg, int mode, rdc_config_t *uparms, spcs_s_info_t kstatus)
5651 {
5652 rdc_k_info_t *krdc;
5653 rdc_u_info_t *urdc;
5654 disk_queue *dqp;
5655 int rc = 0;
5656 int index;
5657 char *ptr;
5658 extern int rdc_status_copy32(const void *, void *, size_t, int);
5659
5660 mutex_enter(&rdc_conf_lock);
5661 index = rdc_lookup_byname(uparms->rdc_set);
5662 if (index >= 0)
5663 krdc = &rdc_k_info[index];
5664 if (index < 0 || (krdc->type_flag & RDC_DISABLEPEND)) {
5665 mutex_exit(&rdc_conf_lock);
5666 spcs_s_add(kstatus, RDC_EALREADY, uparms->rdc_set->primary.file,
5667 uparms->rdc_set->secondary.file);
5668 return (RDC_EALREADY);
|
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 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #include <sys/types.h>
27 #include <sys/ksynch.h>
28 #include <sys/cmn_err.h>
29 #include <sys/kmem.h>
30 #include <sys/conf.h>
31 #include <sys/errno.h>
32 #include <sys/sysmacros.h>
33
34 #ifdef _SunOS_5_6
35 /*
36 * on 2.6 both dki_lock.h and rpc/types.h define bool_t so we
37 * define enum_t here as it is all we need from rpc/types.h
38 * anyway and make it look like we included it. Yuck.
39 */
40 #define _RPC_TYPES_H
41 typedef int enum_t;
42 #else
43 #ifndef DS_DDICT
44 #include <rpc/types.h>
45 #endif
46 #endif /* _SunOS_5_6 */
47
48 #include <sys/ddi.h>
49
50 #include <sys/nsc_thread.h>
51 #include <sys/nsctl/nsctl.h>
52
5623
5624 /* Changed autosync, so update rest of the group */
5625
5626 for (p = krdc->group_next; p != krdc; p = p->group_next) {
5627 q = &rdc_u_info[p->index];
5628 q->autosync = urdc->autosync;
5629 rdc_write_state(q);
5630 }
5631 }
5632
5633 done:
5634 rdc_group_exit(krdc);
5635
5636 mutex_enter(&rdc_conf_lock);
5637 wakeup_busy(krdc);
5638 mutex_exit(&rdc_conf_lock);
5639
5640 return (rc);
5641 }
5642
5643 static int
5644 rdc_status(void *arg, int mode, rdc_config_t *uparms, spcs_s_info_t kstatus)
5645 {
5646 rdc_k_info_t *krdc;
5647 rdc_u_info_t *urdc;
5648 disk_queue *dqp;
5649 int rc = 0;
5650 int index;
5651 char *ptr;
5652 extern int rdc_status_copy32(const void *, void *, size_t, int);
5653
5654 mutex_enter(&rdc_conf_lock);
5655 index = rdc_lookup_byname(uparms->rdc_set);
5656 if (index >= 0)
5657 krdc = &rdc_k_info[index];
5658 if (index < 0 || (krdc->type_flag & RDC_DISABLEPEND)) {
5659 mutex_exit(&rdc_conf_lock);
5660 spcs_s_add(kstatus, RDC_EALREADY, uparms->rdc_set->primary.file,
5661 uparms->rdc_set->secondary.file);
5662 return (RDC_EALREADY);
|