xref: /freebsd/lib/libcuse/cuse.3 (revision b5112fafbb07ca69643ed23733460a1182e7e587)
1fa0f6e62SHans Petter Selasky.\" $FreeBSD$
2fa0f6e62SHans Petter Selasky.\"
3fa0f6e62SHans Petter Selasky.\" Copyright (c) 2010-2013 Hans Petter Selasky
4fa0f6e62SHans Petter Selasky.\"
5fa0f6e62SHans Petter Selasky.\" All rights reserved.
6fa0f6e62SHans Petter Selasky.\"
7fa0f6e62SHans Petter Selasky.\" Redistribution and use in source and binary forms, with or without
8fa0f6e62SHans Petter Selasky.\" modification, are permitted provided that the following conditions
9fa0f6e62SHans Petter Selasky.\" are met:
10fa0f6e62SHans Petter Selasky.\" 1. Redistributions of source code must retain the above copyright
11fa0f6e62SHans Petter Selasky.\"    notice, this list of conditions and the following disclaimer.
12fa0f6e62SHans Petter Selasky.\" 2. Redistributions in binary form must reproduce the above copyright
13fa0f6e62SHans Petter Selasky.\"    notice, this list of conditions and the following disclaimer in the
14fa0f6e62SHans Petter Selasky.\"    documentation and/or other materials provided with the distribution.
15fa0f6e62SHans Petter Selasky.\"
16fa0f6e62SHans Petter Selasky.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17fa0f6e62SHans Petter Selasky.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18fa0f6e62SHans Petter Selasky.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19fa0f6e62SHans Petter Selasky.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20fa0f6e62SHans Petter Selasky.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21fa0f6e62SHans Petter Selasky.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22fa0f6e62SHans Petter Selasky.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23fa0f6e62SHans Petter Selasky.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24fa0f6e62SHans Petter Selasky.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25fa0f6e62SHans Petter Selasky.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26fa0f6e62SHans Petter Selasky.\" SUCH DAMAGE.
27fa0f6e62SHans Petter Selasky.\"
28*b5112fafSChristian Brueffer.Dd June 6, 2014
29fa0f6e62SHans Petter Selasky.Dt CUSE 3
30fa0f6e62SHans Petter Selasky.Os
31fa0f6e62SHans Petter Selasky.Sh NAME
32fa0f6e62SHans Petter Selasky.Nm libcuse
33fa0f6e62SHans Petter Selasky.Nd "Userland character device library"
34fa0f6e62SHans Petter Selasky.Sh LIBRARY
35*b5112fafSChristian Brueffer.Lb libcuse
36fa0f6e62SHans Petter Selasky.Sh SYNOPSIS
37fa0f6e62SHans Petter SelaskyTo load the required kernel module at boot time, place the following line in
38fa0f6e62SHans Petter Selasky.Xr loader.conf 5 :
39fa0f6e62SHans Petter Selasky.Bd -literal -offset indent
40fa0f6e62SHans Petter Selaskycuse_load="YES"
41fa0f6e62SHans Petter Selasky.Ed
42fa0f6e62SHans Petter Selasky.Pp
43fa0f6e62SHans Petter Selasky.In cuse.h
44fa0f6e62SHans Petter Selasky.Sh DESCRIPTION
45fa0f6e62SHans Petter SelaskyThe
46fa0f6e62SHans Petter Selasky.Nm
47*b5112fafSChristian Bruefferlibrary contains functions to create a character device in userspace.
48*b5112fafSChristian BruefferThe
49fa0f6e62SHans Petter Selasky.Nm
50fa0f6e62SHans Petter Selaskylibrary is thread safe.
51fa0f6e62SHans Petter Selasky.Sh LIBRARY INITIALISATION / DEINITIALISATION
52fa0f6e62SHans Petter Selasky.Ft "int"
53fa0f6e62SHans Petter Selasky.Fn "cuse_init" "void"
54fa0f6e62SHans Petter SelaskyThis function initialises
55fa0f6e62SHans Petter Selasky.Nm .
56fa0f6e62SHans Petter SelaskyMust be called at the beginning of the program.
57fa0f6e62SHans Petter SelaskyThis function returns 0 on success or a negative value on failure.
58*b5112fafSChristian BruefferSee
59*b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
60*b5112fafSChristian Bruefferfor known error codes.
61*b5112fafSChristian BruefferIf the cuse kernel module is not loaded,
62*b5112fafSChristian Brueffer.Dv CUSE_ERR_NOT_LOADED
63*b5112fafSChristian Bruefferis returned.
64fa0f6e62SHans Petter Selasky.Pp
65fa0f6e62SHans Petter Selasky.Ft "int"
66fa0f6e62SHans Petter Selasky.Fn "cuse_uninit" "void"
67fa0f6e62SHans Petter SelaskyDeinitialise
68fa0f6e62SHans Petter Selasky.Nm .
69fa0f6e62SHans Petter SelaskyCan be called at the end of the application.
70fa0f6e62SHans Petter SelaskyThis function returns 0 on success or a negative value on failure.
71*b5112fafSChristian BruefferSee
72*b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
73*b5112fafSChristian Bruefferfor known error codes.
74fa0f6e62SHans Petter Selasky.Sh UNIT MANAGEMENT
75fa0f6e62SHans Petter Selasky.Ft "int"
76fa0f6e62SHans Petter Selasky.Fn "cuse_alloc_unit_number" "int *"
77fa0f6e62SHans Petter SelaskyThis function stores a uniq system unit number at the pointed
78fa0f6e62SHans Petter Selaskyinteger loation.
79fa0f6e62SHans Petter SelaskyThis function returns 0 on success or a negative value on failure.
80*b5112fafSChristian BruefferSee
81*b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
82*b5112fafSChristian Bruefferfor known error codes.
83fa0f6e62SHans Petter Selasky.Pp
84fa0f6e62SHans Petter Selasky.Ft "int"
85fa0f6e62SHans Petter Selasky.Fn "cuse_alloc_unit_number_by_id" "int *" "int id"
86*b5112fafSChristian BruefferThis function stores a unique system unit number at the pointed
87fa0f6e62SHans Petter Selaskyinteger loation.
88fa0f6e62SHans Petter SelaskyThe returned unit number is uniq within the given ID.
89fa0f6e62SHans Petter SelaskyValid ID values are defined by the cuse include file.
90*b5112fafSChristian BruefferSee the
91*b5112fafSChristian Brueffer.Fn CUSE_ID_XXX
92*b5112fafSChristian Brueffermacros for more information.
93fa0f6e62SHans Petter SelaskyThis function returns 0 on success or a negative value on failure.
94*b5112fafSChristian BruefferSee
95*b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
96*b5112fafSChristian Bruefferfor known error codes.
97fa0f6e62SHans Petter Selasky.Pp
98fa0f6e62SHans Petter Selasky.Ft "int"
99fa0f6e62SHans Petter Selasky.Fn "cuse_free_unit_number" "int"
100fa0f6e62SHans Petter SelaskyThis function frees the given allocated system unit number.
101fa0f6e62SHans Petter SelaskyThis function returns 0 on success or a negative value on failure.
102*b5112fafSChristian BruefferSee
103*b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
104*b5112fafSChristian Bruefferfor known error codes.
105fa0f6e62SHans Petter Selasky.Pp
106fa0f6e62SHans Petter Selasky.Ft "int"
107fa0f6e62SHans Petter Selasky.Fn "cuse_free_unit_number_by_id" "int unit" "int id"
108fa0f6e62SHans Petter SelaskyThis function frees the given allocated system unit number belonging
109fa0f6e62SHans Petter Selaskyto the given ID.
110fa0f6e62SHans Petter SelaskyIf both the unit and id argument is -1, all allocated units will be freed.
111fa0f6e62SHans Petter SelaskyThis function returns 0 on success or a negative value on failure.
112*b5112fafSChristian BruefferSee
113*b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
114*b5112fafSChristian Bruefferfor known error codes.
115fa0f6e62SHans Petter Selasky.Sh LIBRARY USAGE
116fa0f6e62SHans Petter Selasky.Ft "void *"
117fa0f6e62SHans Petter Selasky.Fn "cuse_vmalloc" "int size"
118fa0f6e62SHans Petter SelaskyThis function allocates
119fa0f6e62SHans Petter Selasky.Ar size
120*b5112fafSChristian Bruefferbytes of memory.
121*b5112fafSChristian BruefferOnly memory allocated by this function can be memory
122*b5112fafSChristian Brueffermapped by
123*b5112fafSChristian Brueffer.Xr mmap 2 .
124*b5112fafSChristian BruefferThis function returns a valid data pointer on success or
125*b5112fafSChristian Brueffer.Dv NULL
126*b5112fafSChristian Bruefferon failure.
127fa0f6e62SHans Petter Selasky.Pp
128fa0f6e62SHans Petter Selasky.Ft "int"
129fa0f6e62SHans Petter Selasky.Fn "cuse_is_vmalloc_addr" "void *"
130fa0f6e62SHans Petter SelaskyThis function returns non-zero if the passed pointer points to a valid
131*b5112fafSChristian Bruefferand non-freed allocation, as returned by
132*b5112fafSChristian Brueffer.Fn cuse_vmalloc .
133fa0f6e62SHans Petter SelaskyElse this function returns zero.
134fa0f6e62SHans Petter Selasky.Pp
135fa0f6e62SHans Petter Selasky.Ft "void"
136fa0f6e62SHans Petter Selasky.Fn "cuse_vmfree" "void *"
137*b5112fafSChristian BruefferThis function frees memory allocated by
138*b5112fafSChristian Brueffer.Fn cuse_vmalloc .
139*b5112fafSChristian BruefferNote that the
140fa0f6e62SHans Petter Selaskycuse library will internally not free the memory until the
141*b5112fafSChristian Brueffer.Fn cuse_uninit
142*b5112fafSChristian Bruefferfunction is called and that the number of unique
143fa0f6e62SHans Petter Selaskyallocations is limited.
144fa0f6e62SHans Petter Selasky.Pp
145fa0f6e62SHans Petter Selasky.Ft "unsigned long"
146fa0f6e62SHans Petter Selasky.Fn "cuse_vmoffset" "void *"
147fa0f6e62SHans Petter SelaskyThis function returns the mmap offset that the client must use to
148fa0f6e62SHans Petter Selaskyaccess the allocated memory.
149fa0f6e62SHans Petter Selasky.Pp
150fa0f6e62SHans Petter Selasky.Ft "struct cuse_dev *"
151fa0f6e62SHans Petter Selasky.Fn "cuse_dev_create" "const struct cuse_methods *mtod" "void *priv0" "void *priv1" "uid_t" "gid_t" "int permission" "const char *fmt" "..."
152fa0f6e62SHans Petter SelaskyThis function creates a new character device according to the given
153*b5112fafSChristian Bruefferparameters.
154*b5112fafSChristian BruefferThis function returns a valid cuse_dev structure pointer
155*b5112fafSChristian Bruefferon success or
156*b5112fafSChristian Brueffer.Dv NULL
157*b5112fafSChristian Bruefferon failure.
158*b5112fafSChristian BruefferThe device name can only contain a-z,
159fa0f6e62SHans Petter SelaskyA-Z, 0-9, dot, / and underscore characters.
160fa0f6e62SHans Petter Selasky.Pp
161fa0f6e62SHans Petter Selasky.Ft "void"
162fa0f6e62SHans Petter Selasky.Fn "cuse_dev_destroy" "struct cuse_dev *"
163fa0f6e62SHans Petter SelaskyThis functions destroys a previously created character device.
164fa0f6e62SHans Petter Selasky.Pp
165fa0f6e62SHans Petter Selasky.Ft "void *"
166*b5112fafSChristian Brueffer.Fn "cuse_dev_get_priv0" "struct cuse_dev *" ,
167fa0f6e62SHans Petter Selasky.Ft "void *"
168*b5112fafSChristian Brueffer.Fn "cuse_dev_get_priv1" "struct cuse_dev *" ,
169fa0f6e62SHans Petter Selasky.Ft "void"
170*b5112fafSChristian Brueffer.Fn "cuse_dev_set_priv0" "struct cuse_dev *" "void *" ,
171fa0f6e62SHans Petter Selasky.Ft "void"
172fa0f6e62SHans Petter Selasky.Fn "cuse_dev_set_priv1" "struct cuse_dev *" "void *"
173fa0f6e62SHans Petter SelaskyThese functions are used to set and get the private data of the given
174fa0f6e62SHans Petter Selaskycuse device.
175fa0f6e62SHans Petter Selasky.Pp
176fa0f6e62SHans Petter Selasky.Ft "int"
177fa0f6e62SHans Petter Selasky.Fn "cuse_wait_and_process" "void"
178*b5112fafSChristian BruefferThis function will block and do event processing.
179*b5112fafSChristian BruefferIf parallel I/O is
180fa0f6e62SHans Petter Selaskyrequired multiple threads must be created looping on this
181fa0f6e62SHans Petter Selaskyfunction.
182fa0f6e62SHans Petter SelaskyThis function returns 0 on success or a negative value on failure.
183*b5112fafSChristian BruefferSee
184*b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
185*b5112fafSChristian Bruefferfor known error codes.
186fa0f6e62SHans Petter Selasky.Pp
187fa0f6e62SHans Petter Selasky.Ft "void *"
188*b5112fafSChristian Brueffer.Fn "cuse_dev_get_per_file_handle" "struct cuse_dev *" ,
189fa0f6e62SHans Petter Selasky.Ft "void"
190fa0f6e62SHans Petter Selasky.Fn "cuse_dev_set_per_file_handle" "struct cuse_dev *" "void *"
191fa0f6e62SHans Petter SelaskyThese functions are used to set and get the per-file-open specific handle
192fa0f6e62SHans Petter Selaskyand should only be used inside the cuse file operation callbacks.
193fa0f6e62SHans Petter Selasky.Pp
194fa0f6e62SHans Petter Selasky.Ft "void"
195fa0f6e62SHans Petter Selasky.Fn "cuse_set_local" "int"
196*b5112fafSChristian BruefferThis function instructs
197*b5112fafSChristian Brueffer.Fn cuse_copy_out
198*b5112fafSChristian Bruefferand
199*b5112fafSChristian Brueffer.Fn cuse_copy_in
200*b5112fafSChristian Bruefferthat the
201fa0f6e62SHans Petter Selaskyuser pointer is local, if the argument passed to it is non-zero.
202fa0f6e62SHans Petter SelaskyElse the user pointer is assumed to be at the peer application.
203fa0f6e62SHans Petter SelaskyThis function should only be used inside the cuse file operation callbacks.
204fa0f6e62SHans Petter SelaskyThe value is reset to zero when the given file operation returns, and
205fa0f6e62SHans Petter Selaskydoes not affect any other file operation callbacks.
206fa0f6e62SHans Petter Selasky.Pp
207fa0f6e62SHans Petter Selasky.Ft "int"
208fa0f6e62SHans Petter Selasky.Fn "cuse_get_local" "void"
209*b5112fafSChristian BruefferReturns the current local state.
210*b5112fafSChristian BruefferSee
211*b5112fafSChristian Brueffer.Fn cuse_set_local .
212fa0f6e62SHans Petter Selasky.Pp
213fa0f6e62SHans Petter Selasky.Ft "int"
214*b5112fafSChristian Brueffer.Fn "cuse_copy_out" "const void *src" "void *peer_dst" "int len" ,
215fa0f6e62SHans Petter Selasky.Ft "int"
216fa0f6e62SHans Petter Selasky.Fn "cuse_copy_in" "const void *peer_src" "void *dst" "int len"
217fa0f6e62SHans Petter SelaskyThese functions are used to transfer data between the local
218*b5112fafSChristian Bruefferapplication and the peer application.
219*b5112fafSChristian BruefferThese functions must be used
220*b5112fafSChristian Bruefferwhen operating on the data pointers passed to the
221*b5112fafSChristian Brueffer.Fn cm_read ,
222*b5112fafSChristian Brueffer.Fn cm_write ,
223*b5112fafSChristian Bruefferand
224*b5112fafSChristian Brueffer.Fn cm_ioctl
225*b5112fafSChristian Brueffercallback functions.
226fa0f6e62SHans Petter SelaskyThese functions return 0 on success or a negative value on failure.
227*b5112fafSChristian BruefferSee
228*b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
229*b5112fafSChristian Bruefferfor known error codes.
230fa0f6e62SHans Petter Selasky.Pp
231fa0f6e62SHans Petter Selasky.Ft "int"
232fa0f6e62SHans Petter Selasky.Fn "cuse_got_peer_signal" "void"
233fa0f6e62SHans Petter SelaskyThis function is used to check if a signal has been delivered to the
234fa0f6e62SHans Petter Selaskypeer application and should only be used inside the cuse file
235*b5112fafSChristian Bruefferoperation callbacks.
236*b5112fafSChristian BruefferThis function returns 0 if a signal has been
237fa0f6e62SHans Petter Selaskydelivered to the caller.
238fa0f6e62SHans Petter SelaskyElse it returns a negative value.
239*b5112fafSChristian BruefferSee
240*b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
241*b5112fafSChristian Bruefferfor known error codes.
242fa0f6e62SHans Petter Selasky.Pp
243fa0f6e62SHans Petter Selasky.Ft "struct cuse_dev *"
244fa0f6e62SHans Petter Selasky.Fn "cuse_dev_get_current" "int *pcmd"
245fa0f6e62SHans Petter SelaskyThis function is used to get the current cuse device pointer and the
246*b5112fafSChristian Brueffercurrently executing command, by
247*b5112fafSChristian Brueffer.Dv CUSE_CMD_XXX
248*b5112fafSChristian Brueffervalue.
249*b5112fafSChristian BruefferThe
250*b5112fafSChristian Brueffer.Ar pcmd
251*b5112fafSChristian Bruefferargument
252*b5112fafSChristian Bruefferis allowed to be
253*b5112fafSChristian Brueffer.Dv NULL .
254*b5112fafSChristian BruefferThis function should only be used inside the
255*b5112fafSChristian Brueffercuse file operation callbacks.
256*b5112fafSChristian BruefferOn success a valid cuse device pointer
257*b5112fafSChristian Bruefferis returned.
258*b5112fafSChristian BruefferOn failure
259*b5112fafSChristian Brueffer.Dv NULL
260*b5112fafSChristian Bruefferis returned.
261fa0f6e62SHans Petter Selasky.Pp
262fa0f6e62SHans Petter Selasky.Ft "void"
263fa0f6e62SHans Petter Selasky.Fn "cuse_poll_wakeup" "void"
264fa0f6e62SHans Petter SelaskyThis function will wake up any file pollers.
265fa0f6e62SHans Petter Selasky.Pp
266fa0f6e62SHans Petter Selasky.Sh LIBRARY LIMITATIONS
267*b5112fafSChristian BruefferTransfer lengths for
268*b5112fafSChristian Brueffer.Fn read ,
269*b5112fafSChristian Brueffer.Fn write ,
270*b5112fafSChristian Brueffer.Fn cuse_copy_in ,
271*b5112fafSChristian Bruefferand
272*b5112fafSChristian Brueffer.Fn cuse_copy_out
273fa0f6e62SHans Petter Selaskyshould not exceed what can fit into a 32-bit signed integer and is
274*b5112fafSChristian Bruefferdefined by the
275*b5112fafSChristian Brueffer.Fn CUSE_LENGTH_MAX
276*b5112fafSChristian Brueffermacro.
277fa0f6e62SHans Petter SelaskyTransfer lengths for ioctls should not exceed what is defined by the
278*b5112fafSChristian Brueffer.Fn CUSE_BUFFER_MAX
279*b5112fafSChristian Brueffermacro.
280fa0f6e62SHans Petter Selasky.Sh LIBRARY CALLBACK METHODS
281*b5112fafSChristian BruefferIn general fflags are defined by
282*b5112fafSChristian Brueffer.Dv CUSE_FFLAG_XXX
283*b5112fafSChristian Bruefferand errors are defined by
284*b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX .
285fa0f6e62SHans Petter Selasky.Bd -literal -offset indent
286fa0f6e62SHans Petter Selaskyenum {
287fa0f6e62SHans Petter Selasky  CUSE_ERR_NONE
288fa0f6e62SHans Petter Selasky  CUSE_ERR_BUSY
289fa0f6e62SHans Petter Selasky  CUSE_ERR_WOULDBLOCK
290fa0f6e62SHans Petter Selasky  CUSE_ERR_INVALID
291fa0f6e62SHans Petter Selasky  CUSE_ERR_NO_MEMORY
292fa0f6e62SHans Petter Selasky  CUSE_ERR_FAULT
293fa0f6e62SHans Petter Selasky  CUSE_ERR_SIGNAL
294fa0f6e62SHans Petter Selasky  CUSE_ERR_OTHER
295fa0f6e62SHans Petter Selasky  CUSE_ERR_NOT_LOADED
296fa0f6e62SHans Petter Selasky
297fa0f6e62SHans Petter Selasky  CUSE_POLL_NONE
298fa0f6e62SHans Petter Selasky  CUSE_POLL_READ
299fa0f6e62SHans Petter Selasky  CUSE_POLL_WRITE
300fa0f6e62SHans Petter Selasky  CUSE_POLL_ERROR
301fa0f6e62SHans Petter Selasky
302fa0f6e62SHans Petter Selasky  CUSE_FFLAG_NONE
303fa0f6e62SHans Petter Selasky  CUSE_FFLAG_READ
304fa0f6e62SHans Petter Selasky  CUSE_FFLAG_WRITE
305fa0f6e62SHans Petter Selasky  CUSE_FFLAG_NONBLOCK
306fa0f6e62SHans Petter Selasky
307fa0f6e62SHans Petter Selasky  CUSE_CMD_NONE
308fa0f6e62SHans Petter Selasky  CUSE_CMD_OPEN
309fa0f6e62SHans Petter Selasky  CUSE_CMD_CLOSE
310fa0f6e62SHans Petter Selasky  CUSE_CMD_READ
311fa0f6e62SHans Petter Selasky  CUSE_CMD_WRITE
312fa0f6e62SHans Petter Selasky  CUSE_CMD_IOCTL
313fa0f6e62SHans Petter Selasky  CUSE_CMD_POLL
314fa0f6e62SHans Petter Selasky  CUSE_CMD_SIGNAL
315fa0f6e62SHans Petter Selasky  CUSE_CMD_SYNC
316fa0f6e62SHans Petter Selasky  CUSE_CMD_MAX
317fa0f6e62SHans Petter Selasky};
318fa0f6e62SHans Petter Selasky.Ed
319fa0f6e62SHans Petter Selasky.Pp
320fa0f6e62SHans Petter Selasky.Ft "int"
321fa0f6e62SHans Petter Selasky.Fn "cuse_open_t" "struct cuse_dev *" "int fflags"
322*b5112fafSChristian BruefferThis function returns a
323*b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
324*b5112fafSChristian Brueffervalue.
325fa0f6e62SHans Petter Selasky.Pp
326fa0f6e62SHans Petter Selasky.Ft "int"
327fa0f6e62SHans Petter Selasky.Fn "cuse_close_t" "struct cuse_dev *" "int fflags"
328*b5112fafSChristian BruefferThis function returns a
329*b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
330*b5112fafSChristian Brueffervalue.
331fa0f6e62SHans Petter Selasky.Pp
332fa0f6e62SHans Petter Selasky.Ft "int"
333fa0f6e62SHans Petter Selasky.Fn "cuse_read_t" "struct cuse_dev *" "int fflags" "void *peer_ptr" "int len"
334*b5112fafSChristian BruefferThis function returns a
335*b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
336*b5112fafSChristian Brueffervalue in case of failure or the
337*b5112fafSChristian Bruefferactually transferred length in case of success.
338*b5112fafSChristian Brueffer.Fn cuse_copy_in
339*b5112fafSChristian Bruefferand
340*b5112fafSChristian Brueffer.Fn cuse_copy_out
341*b5112fafSChristian Brueffermust be used to transfer data to and from the
342*b5112fafSChristian Brueffer.Ar peer_ptr .
343fa0f6e62SHans Petter Selasky.Pp
344fa0f6e62SHans Petter Selasky.Ft "int"
345fa0f6e62SHans Petter Selasky.Fn "cuse_write_t" "struct cuse_dev *" "int fflags" "const void *peer_ptr" "int len"
346*b5112fafSChristian BruefferThis function returns a
347*b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
348*b5112fafSChristian Brueffervalue in case of failure or the
349*b5112fafSChristian Bruefferactually transferred length in case of success.
350*b5112fafSChristian Brueffer.Fn cuse_copy_in
351*b5112fafSChristian Bruefferand
352*b5112fafSChristian Brueffer.Fn cuse_copy_out
353*b5112fafSChristian Brueffermust be used to transfer data to and from the
354*b5112fafSChristian Brueffer.Ar peer_ptr .
355fa0f6e62SHans Petter Selasky.Pp
356fa0f6e62SHans Petter Selasky.Ft "int"
357fa0f6e62SHans Petter Selasky.Fn "cuse_ioctl_t" "struct cuse_dev *" "int fflags" "unsigned long cmd" "void *peer_data"
358*b5112fafSChristian BruefferThis function returns a
359*b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
360*b5112fafSChristian Brueffervalue in case of failure or zero
361*b5112fafSChristian Bruefferin case of success.
362*b5112fafSChristian Brueffer.Fn cuse_copy_in
363*b5112fafSChristian Bruefferand
364*b5112fafSChristian Brueffer.Fn cuse_copy_out
365*b5112fafSChristian Brueffermust be used to
366*b5112fafSChristian Brueffertransfer data to and from the
367*b5112fafSChristian Brueffer.Ar peer_data .
368fa0f6e62SHans Petter Selasky.Pp
369fa0f6e62SHans Petter Selasky.Ft "int"
370fa0f6e62SHans Petter Selasky.Fn "cuse_poll_t" "struct cuse_dev *" "int fflags" "int events"
371*b5112fafSChristian BruefferThis function returns a mask of
372*b5112fafSChristian Brueffer.Dv CUSE_POLL_XXX
373*b5112fafSChristian Brueffervalues in case of failure and success.
374*b5112fafSChristian BruefferThe events argument is also a mask of
375*b5112fafSChristian Brueffer.Dv CUSE_POLL_XXX
376*b5112fafSChristian Brueffervalues.
377fa0f6e62SHans Petter Selasky.Pp
378fa0f6e62SHans Petter Selasky.Bd -literal -offset indent
379fa0f6e62SHans Petter Selaskystruct cuse_methods {
380fa0f6e62SHans Petter Selasky  cuse_open_t *cm_open;
381fa0f6e62SHans Petter Selasky  cuse_close_t *cm_close;
382fa0f6e62SHans Petter Selasky  cuse_read_t *cm_read;
383fa0f6e62SHans Petter Selasky  cuse_write_t *cm_write;
384fa0f6e62SHans Petter Selasky  cuse_ioctl_t *cm_ioctl;
385fa0f6e62SHans Petter Selasky  cuse_poll_t *cm_poll;
386fa0f6e62SHans Petter Selasky};
387fa0f6e62SHans Petter Selasky.Ed
388fa0f6e62SHans Petter Selasky.Sh HISTORY
389fa0f6e62SHans Petter Selasky.Nm
390fa0f6e62SHans Petter Selaskywas written by Hans Petter Selasky.
391