Merge commit 'b31320a79e2054c6739b5229259dbf98f3afc547' into merges
[unleashed.git] / share / man / man9f / usb_pipe_set_private.9f
blob20735dcc1d373aa3db6de390daedf737b1795ae6
1 '\" te
2 .\" Copyright (c) 2004, Sun Microsystems, Inc., All Rights Reserved
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH USB_PIPE_SET_PRIVATE 9F "Sep 16, 2016"
7 .SH NAME
8 usb_pipe_set_private, usb_pipe_get_private \- USB user-defined pipe data-field
9 facility
10 .SH SYNOPSIS
11 .LP
12 .nf
13 #include <sys/usb/usba.h>
15 \fBint \fR\fBusb_pipe_set_private\fR(\fBusb_pipe_handle_t\fR \fIpipe_handle\fR, \fBusb_opaque_t\fR \fIdata\fR);
16 .fi
18 .LP
19 .nf
20 \fB\fR\fBusb_opaque_t usb_pipe_get_private \fR(\fBusb_pipe_handle_t\fR \fIpipe_handle\fR);
21 .fi
23 .SH INTERFACE LEVEL
24 .LP
25 Solaris DDI specific (Solaris DDI)
26 .SH PARAMETERS
27 .LP
28 For \fBusb_pipe_set_private()\fR:
29 .sp
30 .ne 2
31 .na
32 \fB\fIpipe_handle\fR\fR
33 .ad
34 .RS 15n
35 Pipe handle into which user-defined data is placed.
36 .RE
38 .sp
39 .ne 2
40 .na
41 \fB\fIdata\fR\fR
42 .ad
43 .RS 15n
44 Data to store in the pipe handle.
45 .RE
47 .sp
48 .LP
49 For \fBusb_pipe_get_private()\fR:
50 .sp
51 .ne 2
52 .na
53 \fB\fIpipe_handle\fR\fR
54 .ad
55 .RS 15n
56 Pipe handle from which user-defined data is retrieved.
57 .RE
59 .SH DESCRIPTION
60 .LP
61 The \fBusb_set_driver_private()\fR function initializes the user-private data
62 field of the pipe referred to by \fIpipe_handle\fR, using \fIdata\fR. The
63 user-private data field is  used to store any data the client desires and is
64 not used in any way by the USBA or OS framework. Client drivers often store
65 their soft-state here for convenient retrieval by their callback handlers.
66 .sp
67 .LP
68 The \fBusb_get_driver_private()\fR function retrieves the user-private data
69 stored via \fBusb_set_driver_private()\fR, from the pipe referred to by
70 \fIpipe_handle\fR.
71 .SH RETURN VALUES
72 .LP
73 For \fBusb_pipe_set_private()\fR:
74 .sp
75 .ne 2
76 .na
77 \fBUSB_SUCCESS\fR
78 .ad
79 .RS 20n
80 Private data has been successfully stored in pipe handle.
81 .RE
83 .sp
84 .ne 2
85 .na
86 \fBUSB_INVALID_PIPE\fR
87 .ad
88 .RS 20n
89 \fIpipe_handle\fR argument is \fBNULL\fR or invalid.
90 .sp
91 Pipe is closing or closed.
92 .RE
94 .sp
95 .ne 2
96 .na
97 \fBUSB_INVALID_PERM\fR
98 .ad
99 .RS 20n
100 The \fIpipe_handle\fR argument refers to the default control pipe.
105 For \fBusb_pipe_get_private()\fR:
108 On success: usb_opaque_t pointer to data being retrieved.
111 On failure: \fBNULL\fR. Fails if pipe handle is \fBNULL\fR or invalid. Fails if
112 pipe handle is to a pipe which is closing or closed.
113 .SH CONTEXT
115 May be called from user, kernel or interrupt context.
116 .SH EXAMPLES
117 .in +2
119     usb_pipe_handle_t pipe;
121     /* Some driver defined datatype. */
122     xxx_data_t *data = kmem_zalloc(...);
124     usb_pipe_set_private(pipe, data);
126     ----
128     xxx_data_t *xxx_data_ptr = (xxx_data_t *)usb_pipe_get_private(pipe);
131 .in -2
133 .SH ATTRIBUTES
135 See \fBattributes\fR(5) for descriptions of the following attributes:
140 box;
141 c | c
142 l | l .
143 ATTRIBUTE TYPE  ATTRIBUTE VALUE
145 Architecture    PCI-based systems
147 Interface stability     Committed
150 .SH SEE ALSO
152 \fBattributes\fR(5), \fBusb_pipe_xopen\fR(9F), \fBusb_alloc_request\fR(9F)