rcm_event.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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
* 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 (c) 1999-2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <door.h>
#include <assert.h>
#include <librcm_event.h>
#include "rcm_impl.h"
/*
* Event handling routine
*/
#define RCM_NOTIFY 0
#define RCM_GETINFO 1
#define RCM_REQUEST 2
#define RCM_EFAULT 3
#define RCM_EPERM 4
#define RCM_EINVAL 5
static void rcm_print_nvlist(nvlist_t *);
/*
* Top level function for event service
*/
void
{
int cmd;
int lerrno;
int seq_num;
/* Decode the data from the door into an unpacked nvlist */
return;
}
return;
}
/* Do nothing if the door is just being knocked on */
return;
}
*datalen = 0;
return;
}
/*
* Go increment thread count. Before daemon is fully initialized,
* the event processing blocks inside this function.
*/
/*
* Decrement thread count
*/
out:
*datalen = 0;
}
/*
* Actually processes events; returns a reply event
*/
static void
{
int i;
int error;
uint_t nvl_nrsrcs = 0;
size_t interval_size = 0;
/*
* Extract data from the door argument nvlist. Not all arguments
* are needed; sanity checks are performed later.
*/
&nvl_nrsrcs);
&buflen);
buflen = 0;
}
&buflen);
for (i = 0; i < nvl_nrsrcs; i++) {
}
/*
* Switch off the command being performed to do the appropriate
* sanity checks and dispatch the arguments to the appropriate
* implementation routine.
*/
switch (cmd) {
case CMD_REGISTER:
goto faildata;
&info);
break;
case CMD_UNREGISTER:
goto faildata;
flag);
break;
case CMD_GETINFO:
goto faildata;
== EINVAL) {
"invalid argument in get info request\n");
return;
}
break;
case CMD_SUSPEND:
goto faildata;
break;
case CMD_RESUME:
goto faildata;
&info);
break;
case CMD_OFFLINE:
goto faildata;
&info);
break;
case CMD_ONLINE:
goto faildata;
&info);
break;
case CMD_REMOVE:
goto faildata;
&info);
break;
case CMD_EVENT:
(event_data == NULL))
goto faildata;
event_data, &info);
break;
case CMD_REQUEST_CHANGE:
(change_data == NULL))
goto faildata;
break;
case CMD_NOTIFY_CHANGE:
(change_data == NULL))
goto faildata;
change_data, &info);
break;
case CMD_GETSTATE:
goto faildata;
break;
default:
return;
}
return;
}
/*
* Generate reply event from resource registration information
*/
static void
{
/* Allocate an empty nvlist */
}
/* Encode the result of the operation in the nvlist */
gettext("nvlist_add(RESULT) failed: %s\n"),
}
/* Go through the RCM info tuples, appending them all to the nvlist */
while (tmp) {
buflen = 0;
NV_ENCODE_NATIVE, 0)) {
gettext("nvlist_pack(INFO) failed: %s\n"),
}
gettext("nvlist_add(INFO) failed: %s\n"),
}
}
}
/* Return the nvlist (unpacked) in the return argument */
}
static void
{
char *data_string;
char **data_strings;
int i;
char *name;
switch (type) {
case DATA_TYPE_BOOLEAN:
break;
case DATA_TYPE_BYTE:
break;
case DATA_TYPE_INT16:
break;
case DATA_TYPE_UINT16:
break;
case DATA_TYPE_INT32:
break;
case DATA_TYPE_UINT32:
break;
case DATA_TYPE_INT64:
break;
case DATA_TYPE_UINT64:
break;
case DATA_TYPE_STRING:
break;
case DATA_TYPE_STRING_ARRAY:
for (i = 0; i < data_nstrings; i++) {
"\t\"%s\" (string)\n", data_strings[i]);
if (i < (data_nstrings - 1))
}
break;
default:
break;
}
}
}