Exemple #1
0
/* ARGSUSED */
static cfga_sata_ret_t
sata_rcm_init(const char *rsrc, cfga_flags_t flags, char **errstring,
		uint_t *rflags)
{
	/* Validate the rsrc argument */
	if (rsrc == NULL) {
		return (CFGA_SATA_INTERNAL_ERROR);
	}

	/* Translate the cfgadm flags to RCM flags */
	if (rflags && (flags & CFGA_FLAG_FORCE)) {
		*rflags |= RCM_FORCE;
	}

	/* Get a handle for the RCM operations */
	(void) mutex_lock(&rcm_handle_lock);
	if (rcm_handle == NULL) {
		if (rcm_alloc_handle(NULL, RCM_NOPID, NULL, &rcm_handle) !=
		    RCM_SUCCESS) {
			(void) mutex_unlock(&rcm_handle_lock);

			return (CFGA_SATA_RCM_HANDLE);
		}
	}
	(void) mutex_unlock(&rcm_handle_lock);

	return (CFGA_SATA_OK);
}
Exemple #2
0
static int
drd_rcm_init(void)
{
	int	rv;

	drd_dbg("drd_rcm_init...");

	rv = rcm_alloc_handle(NULL, 0, NULL, &rcm_hdl);
	if (rv == RCM_FAILURE) {
		drd_err("unable to allocate RCM handle: %s", strerror(errno));
		return (-1);
	}

	return (0);
}