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]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #pragma ident "%Z%%M% %I% %E% SMI"
43 #include <sys/types.h>
45 #include <sys/param.h>
49 #define VS_DOOR_VERSION 1
50 static int vs_door_cookie
;
52 /* function prototype */
53 static void vs_door_scan_req(void *, char *, size_t, door_desc_t
*, uint_t
);
56 static int vs_door_fd
= -1;
57 static pthread_mutex_t vs_door_mutex
= PTHREAD_MUTEX_INITIALIZER
;
63 * Start the vscand door service.
64 * Returns 0 on success. Otherwise, -1.
69 (void) pthread_mutex_lock(&vs_door_mutex
);
71 if ((vs_door_fd
= door_create(vs_door_scan_req
,
72 &vs_door_cookie
, (DOOR_UNREF
| DOOR_REFUSE_DESC
))) < 0) {
73 syslog(LOG_ERR
, "vscand: door create%s", strerror(errno
));
77 (void) pthread_mutex_unlock(&vs_door_mutex
);
85 * Stop the vscand door service.
90 (void) pthread_mutex_lock(&vs_door_mutex
);
92 if (vs_door_fd
>= 0) {
93 if (door_revoke(vs_door_fd
) < 0)
94 syslog(LOG_ERR
, "vscand: door revoke %s",
100 (void) pthread_mutex_unlock(&vs_door_mutex
);
107 * Invoke the vscand door service.
111 vs_door_scan_req(void *cookie
, char *ptr
, size_t size
, door_desc_t
*dp
,
114 vs_scan_req_t
*scan_req
;
115 uint32_t result
= VS_STATUS_ERROR
;
118 /* LINTED E_BAD_PTR_CAST_ALIGN - to be fixed with encoding */
119 scan_req
= (vs_scan_req_t
*)ptr
;
120 result
= vs_svc_queue_scan_req(scan_req
);
123 (void) door_return((char *)&result
, sizeof (uint32_t), NULL
, 0);