Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
The contents of this file are subject to the terms of the Common Development and Distribution License (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 or http://www.opensolaris.org/os/licensing. 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]
#include <sys/types.h> #include <sys/stream.h> #include <sys/stropts.h> #include <sys/ddi.h> #include <sys/sunddi.h> int qassociate(queue_t *q, int instance
Pointer to a queue(9S) structure. Either the read or write queue can be used.
Driver instance number or -1.
The qassociate() function associates the specified STREAMS queue with the specified instance of the bottom driver in the queue. Upon successful return, the stream is associated with the instance with any prior association dissolved.
A DLPI style 2 driver calls qassociate() while processing the DL_ATTACH_REQ message. The driver is also expected to call this interface while performing stream associations through other means, such as ndd(8) ioctl commands.
If instance is -1, the stream is left unassociated with any hardware instance.
If the interface returns failure, the stream is not associated with the specified instance. Any prior association is left untouched.
The interface typically fails because of failure to locate and attach the device instance. The interface never fails if the specified instance is -1.
Success.
Failure.
if (qassociate(q, instance) != 0) goto fail;
The association prevents Dynamic Reconfiguration (DR) from detaching the instance.
DLPI style 2 network driver DL_DETACH code specifies:
(void) qassociate(q, -1);
This dissolves the queue's association with any device instance.
DLPI style 2 network driver open(9E) code must call:
qassociate(q, -1);
This informs the framework that this driver has been modified to be DDI-compliant.