datalink_mod.c revision 4dc927470baa43bc10074a7a7ae03610f3741e09
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhou * CDDL HEADER START
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhou * The contents of this file are subject to the terms of the
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhou * Common Development and Distribution License (the "License").
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhou * You may not use this file except in compliance with the License.
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhou * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhou * See the License for the specific language governing permissions
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhou * and limitations under the License.
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhou * When distributing Covered Code, include this CDDL HEADER in each
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhou * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhou * If applicable, add the following below this CDDL HEADER, with the
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhou * fields enclosed by brackets "[]" replaced with your own identifying
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhou * information: Portions Copyright [yyyy] [name of copyright owner]
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhou * CDDL HEADER END
5093e10312724e92dd76c008a15bdb59d414708aCathy Zhou * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhou * Use is subject to license terms.
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhou * datalink syseventd module.
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhou * The purpose of this module is to identify all datalink related events,
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhou * and react accordingly.
4dc927470baa43bc10074a7a7ae03610f3741e09Cheng Sean Yeextern void syseventd_err_print(char *, ...);
4dc927470baa43bc10074a7a7ae03610f3741e09Cheng Sean Ye/* ARGSUSED */
4dc927470baa43bc10074a7a7ae03610f3741e09Cheng Sean Ye * Send the PHYSLINK_NEW event to network_rcm to update
4dc927470baa43bc10074a7a7ae03610f3741e09Cheng Sean Ye * the network devices cache accordingly.
4dc927470baa43bc10074a7a7ae03610f3741e09Cheng Sean Ye if (rcm_notify_event(rcm_hdl, RCM_RESOURCE_PHYSLINK_NEW,
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhoudatalink_deliver_event(sysevent_t *ev, int unused)
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhou const char *subclass = sysevent_get_subclass_name(ev);
4dc927470baa43bc10074a7a7ae03610f3741e09Cheng Sean Ye * rcm_notify_event() needs to be called asynchronously otherwise when
4dc927470baa43bc10074a7a7ae03610f3741e09Cheng Sean Ye * sysevent queue is full, deadlock will happen.
4dc927470baa43bc10074a7a7ae03610f3741e09Cheng Sean Ye if ((newp = malloc(sizeof (struct event_list))) == NULL)
4dc927470baa43bc10074a7a7ae03610f3741e09Cheng Sean Ye * queue up at the end of the event list and signal notify_thread to
4dc927470baa43bc10074a7a7ae03610f3741e09Cheng Sean Ye * process it.
0dc974a9a2e66d676505db23524ebff105fb36a9Cathy Zhou if (rcm_alloc_handle(NULL, 0, NULL, &rcm_hdl) != RCM_SUCCESS)
4dc927470baa43bc10074a7a7ae03610f3741e09Cheng Sean Ye if (thr_create(NULL, 0, datalink_notify_thread, NULL, 0,