xref: /freebsd/lib/libcuse/cuse.3 (revision 58a8f6e9ecabba975f2cda8416bcc36c2073a7a8)
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.\"
28db92a6cdSHans Petter Selasky.Dd April 17, 2019
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
35b5112fafSChristian 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
47b5112fafSChristian Bruefferlibrary contains functions to create a character device in userspace.
48b5112fafSChristian 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.
58b5112fafSChristian BruefferSee
59b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
60b5112fafSChristian Bruefferfor known error codes.
61b5112fafSChristian BruefferIf the cuse kernel module is not loaded,
62b5112fafSChristian Brueffer.Dv CUSE_ERR_NOT_LOADED
63b5112fafSChristian 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.
71b5112fafSChristian BruefferSee
72b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
73b5112fafSChristian 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.
80b5112fafSChristian BruefferSee
81b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
82b5112fafSChristian 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"
86b5112fafSChristian 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.
90b5112fafSChristian BruefferSee the
91b5112fafSChristian Brueffer.Fn CUSE_ID_XXX
92b5112fafSChristian Brueffermacros for more information.
93fa0f6e62SHans Petter SelaskyThis function returns 0 on success or a negative value on failure.
94b5112fafSChristian BruefferSee
95b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
96b5112fafSChristian 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.
102b5112fafSChristian BruefferSee
103b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
104b5112fafSChristian 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.
112b5112fafSChristian BruefferSee
113b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
114b5112fafSChristian Bruefferfor known error codes.
115fa0f6e62SHans Petter Selasky.Sh LIBRARY USAGE
116fa0f6e62SHans Petter Selasky.Ft "void *"
117*58a8f6e9SHans Petter Selasky.Fn "cuse_vmalloc" "unsigned size"
118fa0f6e62SHans Petter SelaskyThis function allocates
119fa0f6e62SHans Petter Selasky.Ar size
120b5112fafSChristian Bruefferbytes of memory.
121b5112fafSChristian BruefferOnly memory allocated by this function can be memory
122b5112fafSChristian Brueffermapped by
123b5112fafSChristian Brueffer.Xr mmap 2 .
124b5112fafSChristian BruefferThis function returns a valid data pointer on success or
125b5112fafSChristian Brueffer.Dv NULL
126b5112fafSChristian 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
131b5112fafSChristian Bruefferand non-freed allocation, as returned by
132b5112fafSChristian 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 *"
137b5112fafSChristian BruefferThis function frees memory allocated by
138b5112fafSChristian Brueffer.Fn cuse_vmalloc .
1392ca43c3dSHans Petter SelaskyThis function is NULL safe.
140b5112fafSChristian BruefferNote that the
141fa0f6e62SHans Petter Selaskycuse library will internally not free the memory until the
142b5112fafSChristian Brueffer.Fn cuse_uninit
143b5112fafSChristian Bruefferfunction is called and that the number of unique
144fa0f6e62SHans Petter Selaskyallocations is limited.
145fa0f6e62SHans Petter Selasky.Pp
146fa0f6e62SHans Petter Selasky.Ft "unsigned long"
147fa0f6e62SHans Petter Selasky.Fn "cuse_vmoffset" "void *"
148fa0f6e62SHans Petter SelaskyThis function returns the mmap offset that the client must use to
149fa0f6e62SHans Petter Selaskyaccess the allocated memory.
150fa0f6e62SHans Petter Selasky.Pp
151fa0f6e62SHans Petter Selasky.Ft "struct cuse_dev *"
152fa0f6e62SHans Petter Selasky.Fn "cuse_dev_create" "const struct cuse_methods *mtod" "void *priv0" "void *priv1" "uid_t" "gid_t" "int permission" "const char *fmt" "..."
153fa0f6e62SHans Petter SelaskyThis function creates a new character device according to the given
154b5112fafSChristian Bruefferparameters.
155b5112fafSChristian BruefferThis function returns a valid cuse_dev structure pointer
156b5112fafSChristian Bruefferon success or
157b5112fafSChristian Brueffer.Dv NULL
158b5112fafSChristian Bruefferon failure.
159b5112fafSChristian BruefferThe device name can only contain a-z,
160fa0f6e62SHans Petter SelaskyA-Z, 0-9, dot, / and underscore characters.
161fa0f6e62SHans Petter Selasky.Pp
162fa0f6e62SHans Petter Selasky.Ft "void"
163fa0f6e62SHans Petter Selasky.Fn "cuse_dev_destroy" "struct cuse_dev *"
164fa0f6e62SHans Petter SelaskyThis functions destroys a previously created character device.
165fa0f6e62SHans Petter Selasky.Pp
166fa0f6e62SHans Petter Selasky.Ft "void *"
167b5112fafSChristian Brueffer.Fn "cuse_dev_get_priv0" "struct cuse_dev *" ,
168fa0f6e62SHans Petter Selasky.Ft "void *"
169b5112fafSChristian Brueffer.Fn "cuse_dev_get_priv1" "struct cuse_dev *" ,
170fa0f6e62SHans Petter Selasky.Ft "void"
171b5112fafSChristian Brueffer.Fn "cuse_dev_set_priv0" "struct cuse_dev *" "void *" ,
172fa0f6e62SHans Petter Selasky.Ft "void"
173fa0f6e62SHans Petter Selasky.Fn "cuse_dev_set_priv1" "struct cuse_dev *" "void *"
174fa0f6e62SHans Petter SelaskyThese functions are used to set and get the private data of the given
175fa0f6e62SHans Petter Selaskycuse device.
176fa0f6e62SHans Petter Selasky.Pp
177fa0f6e62SHans Petter Selasky.Ft "int"
178fa0f6e62SHans Petter Selasky.Fn "cuse_wait_and_process" "void"
179b5112fafSChristian BruefferThis function will block and do event processing.
180b5112fafSChristian BruefferIf parallel I/O is
181fa0f6e62SHans Petter Selaskyrequired multiple threads must be created looping on this
182fa0f6e62SHans Petter Selaskyfunction.
183fa0f6e62SHans Petter SelaskyThis function returns 0 on success or a negative value on failure.
184b5112fafSChristian BruefferSee
185b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
186b5112fafSChristian Bruefferfor known error codes.
187fa0f6e62SHans Petter Selasky.Pp
188fa0f6e62SHans Petter Selasky.Ft "void *"
189b5112fafSChristian Brueffer.Fn "cuse_dev_get_per_file_handle" "struct cuse_dev *" ,
190fa0f6e62SHans Petter Selasky.Ft "void"
191fa0f6e62SHans Petter Selasky.Fn "cuse_dev_set_per_file_handle" "struct cuse_dev *" "void *"
192fa0f6e62SHans Petter SelaskyThese functions are used to set and get the per-file-open specific handle
193fa0f6e62SHans Petter Selaskyand should only be used inside the cuse file operation callbacks.
194fa0f6e62SHans Petter Selasky.Pp
195fa0f6e62SHans Petter Selasky.Ft "void"
196fa0f6e62SHans Petter Selasky.Fn "cuse_set_local" "int"
197b5112fafSChristian BruefferThis function instructs
198b5112fafSChristian Brueffer.Fn cuse_copy_out
199b5112fafSChristian Bruefferand
200b5112fafSChristian Brueffer.Fn cuse_copy_in
201b5112fafSChristian Bruefferthat the
202fa0f6e62SHans Petter Selaskyuser pointer is local, if the argument passed to it is non-zero.
203fa0f6e62SHans Petter SelaskyElse the user pointer is assumed to be at the peer application.
204fa0f6e62SHans Petter SelaskyThis function should only be used inside the cuse file operation callbacks.
205fa0f6e62SHans Petter SelaskyThe value is reset to zero when the given file operation returns, and
206fa0f6e62SHans Petter Selaskydoes not affect any other file operation callbacks.
207fa0f6e62SHans Petter Selasky.Pp
208fa0f6e62SHans Petter Selasky.Ft "int"
209fa0f6e62SHans Petter Selasky.Fn "cuse_get_local" "void"
210b5112fafSChristian BruefferReturns the current local state.
211b5112fafSChristian BruefferSee
212b5112fafSChristian Brueffer.Fn cuse_set_local .
213fa0f6e62SHans Petter Selasky.Pp
214fa0f6e62SHans Petter Selasky.Ft "int"
215b5112fafSChristian Brueffer.Fn "cuse_copy_out" "const void *src" "void *peer_dst" "int len" ,
216fa0f6e62SHans Petter Selasky.Ft "int"
217fa0f6e62SHans Petter Selasky.Fn "cuse_copy_in" "const void *peer_src" "void *dst" "int len"
218fa0f6e62SHans Petter SelaskyThese functions are used to transfer data between the local
219b5112fafSChristian Bruefferapplication and the peer application.
220b5112fafSChristian BruefferThese functions must be used
221b5112fafSChristian Bruefferwhen operating on the data pointers passed to the
222b5112fafSChristian Brueffer.Fn cm_read ,
223b5112fafSChristian Brueffer.Fn cm_write ,
224b5112fafSChristian Bruefferand
225b5112fafSChristian Brueffer.Fn cm_ioctl
226b5112fafSChristian Brueffercallback functions.
227fa0f6e62SHans Petter SelaskyThese functions return 0 on success or a negative value on failure.
228b5112fafSChristian BruefferSee
229b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
230b5112fafSChristian Bruefferfor known error codes.
231fa0f6e62SHans Petter Selasky.Pp
232fa0f6e62SHans Petter Selasky.Ft "int"
233fa0f6e62SHans Petter Selasky.Fn "cuse_got_peer_signal" "void"
234fa0f6e62SHans Petter SelaskyThis function is used to check if a signal has been delivered to the
235fa0f6e62SHans Petter Selaskypeer application and should only be used inside the cuse file
236b5112fafSChristian Bruefferoperation callbacks.
237b5112fafSChristian BruefferThis function returns 0 if a signal has been
238fa0f6e62SHans Petter Selaskydelivered to the caller.
239fa0f6e62SHans Petter SelaskyElse it returns a negative value.
240b5112fafSChristian BruefferSee
241b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
242b5112fafSChristian Bruefferfor known error codes.
243fa0f6e62SHans Petter Selasky.Pp
244fa0f6e62SHans Petter Selasky.Ft "struct cuse_dev *"
245fa0f6e62SHans Petter Selasky.Fn "cuse_dev_get_current" "int *pcmd"
246fa0f6e62SHans Petter SelaskyThis function is used to get the current cuse device pointer and the
247b5112fafSChristian Brueffercurrently executing command, by
248b5112fafSChristian Brueffer.Dv CUSE_CMD_XXX
249b5112fafSChristian Brueffervalue.
250b5112fafSChristian BruefferThe
251b5112fafSChristian Brueffer.Ar pcmd
252b5112fafSChristian Bruefferargument
253b5112fafSChristian Bruefferis allowed to be
254b5112fafSChristian Brueffer.Dv NULL .
255b5112fafSChristian BruefferThis function should only be used inside the
256b5112fafSChristian Brueffercuse file operation callbacks.
257b5112fafSChristian BruefferOn success a valid cuse device pointer
258b5112fafSChristian Bruefferis returned.
259b5112fafSChristian BruefferOn failure
260b5112fafSChristian Brueffer.Dv NULL
261b5112fafSChristian Bruefferis returned.
262fa0f6e62SHans Petter Selasky.Pp
263fa0f6e62SHans Petter Selasky.Ft "void"
264fa0f6e62SHans Petter Selasky.Fn "cuse_poll_wakeup" "void"
265fa0f6e62SHans Petter SelaskyThis function will wake up any file pollers.
266fa0f6e62SHans Petter Selasky.Sh LIBRARY LIMITATIONS
267b5112fafSChristian BruefferTransfer lengths for
268b5112fafSChristian Brueffer.Fn read ,
269b5112fafSChristian Brueffer.Fn write ,
270b5112fafSChristian Brueffer.Fn cuse_copy_in ,
271b5112fafSChristian Bruefferand
272b5112fafSChristian Brueffer.Fn cuse_copy_out
273fa0f6e62SHans Petter Selaskyshould not exceed what can fit into a 32-bit signed integer and is
274b5112fafSChristian Bruefferdefined by the
275b5112fafSChristian Brueffer.Fn CUSE_LENGTH_MAX
276b5112fafSChristian Brueffermacro.
277fa0f6e62SHans Petter SelaskyTransfer lengths for ioctls should not exceed what is defined by the
278b5112fafSChristian Brueffer.Fn CUSE_BUFFER_MAX
279b5112fafSChristian Brueffermacro.
280fa0f6e62SHans Petter Selasky.Sh LIBRARY CALLBACK METHODS
281b5112fafSChristian BruefferIn general fflags are defined by
282b5112fafSChristian Brueffer.Dv CUSE_FFLAG_XXX
283b5112fafSChristian Bruefferand errors are defined by
284b5112fafSChristian 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
2969f16d9c9SHans Petter Selasky  CUSE_ERR_NO_DEVICE
297fa0f6e62SHans Petter Selasky
298fa0f6e62SHans Petter Selasky  CUSE_POLL_NONE
299fa0f6e62SHans Petter Selasky  CUSE_POLL_READ
300fa0f6e62SHans Petter Selasky  CUSE_POLL_WRITE
301fa0f6e62SHans Petter Selasky  CUSE_POLL_ERROR
302fa0f6e62SHans Petter Selasky
303fa0f6e62SHans Petter Selasky  CUSE_FFLAG_NONE
304fa0f6e62SHans Petter Selasky  CUSE_FFLAG_READ
305fa0f6e62SHans Petter Selasky  CUSE_FFLAG_WRITE
306fa0f6e62SHans Petter Selasky  CUSE_FFLAG_NONBLOCK
307db92a6cdSHans Petter Selasky  CUSE_FFLAG_COMPAT32
308fa0f6e62SHans Petter Selasky
309fa0f6e62SHans Petter Selasky  CUSE_CMD_NONE
310fa0f6e62SHans Petter Selasky  CUSE_CMD_OPEN
311fa0f6e62SHans Petter Selasky  CUSE_CMD_CLOSE
312fa0f6e62SHans Petter Selasky  CUSE_CMD_READ
313fa0f6e62SHans Petter Selasky  CUSE_CMD_WRITE
314fa0f6e62SHans Petter Selasky  CUSE_CMD_IOCTL
315fa0f6e62SHans Petter Selasky  CUSE_CMD_POLL
316fa0f6e62SHans Petter Selasky  CUSE_CMD_SIGNAL
317fa0f6e62SHans Petter Selasky  CUSE_CMD_SYNC
318fa0f6e62SHans Petter Selasky  CUSE_CMD_MAX
319fa0f6e62SHans Petter Selasky};
320fa0f6e62SHans Petter Selasky.Ed
321fa0f6e62SHans Petter Selasky.Pp
322fa0f6e62SHans Petter Selasky.Ft "int"
323fa0f6e62SHans Petter Selasky.Fn "cuse_open_t" "struct cuse_dev *" "int fflags"
324b5112fafSChristian BruefferThis function returns a
325b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
326b5112fafSChristian Brueffervalue.
327fa0f6e62SHans Petter Selasky.Pp
328fa0f6e62SHans Petter Selasky.Ft "int"
329fa0f6e62SHans Petter Selasky.Fn "cuse_close_t" "struct cuse_dev *" "int fflags"
330b5112fafSChristian BruefferThis function returns a
331b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
332b5112fafSChristian Brueffervalue.
333fa0f6e62SHans Petter Selasky.Pp
334fa0f6e62SHans Petter Selasky.Ft "int"
335fa0f6e62SHans Petter Selasky.Fn "cuse_read_t" "struct cuse_dev *" "int fflags" "void *peer_ptr" "int len"
336b5112fafSChristian BruefferThis function returns a
337b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
338b5112fafSChristian Brueffervalue in case of failure or the
339b5112fafSChristian Bruefferactually transferred length in case of success.
340b5112fafSChristian Brueffer.Fn cuse_copy_in
341b5112fafSChristian Bruefferand
342b5112fafSChristian Brueffer.Fn cuse_copy_out
343b5112fafSChristian Brueffermust be used to transfer data to and from the
344b5112fafSChristian Brueffer.Ar peer_ptr .
345fa0f6e62SHans Petter Selasky.Pp
346fa0f6e62SHans Petter Selasky.Ft "int"
347fa0f6e62SHans Petter Selasky.Fn "cuse_write_t" "struct cuse_dev *" "int fflags" "const void *peer_ptr" "int len"
348b5112fafSChristian BruefferThis function returns a
349b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
350b5112fafSChristian Brueffervalue in case of failure or the
351b5112fafSChristian Bruefferactually transferred length in case of success.
352b5112fafSChristian Brueffer.Fn cuse_copy_in
353b5112fafSChristian Bruefferand
354b5112fafSChristian Brueffer.Fn cuse_copy_out
355b5112fafSChristian Brueffermust be used to transfer data to and from the
356b5112fafSChristian Brueffer.Ar peer_ptr .
357fa0f6e62SHans Petter Selasky.Pp
358fa0f6e62SHans Petter Selasky.Ft "int"
359fa0f6e62SHans Petter Selasky.Fn "cuse_ioctl_t" "struct cuse_dev *" "int fflags" "unsigned long cmd" "void *peer_data"
360b5112fafSChristian BruefferThis function returns a
361b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
362b5112fafSChristian Brueffervalue in case of failure or zero
363b5112fafSChristian Bruefferin case of success.
364b5112fafSChristian Brueffer.Fn cuse_copy_in
365b5112fafSChristian Bruefferand
366b5112fafSChristian Brueffer.Fn cuse_copy_out
367b5112fafSChristian Brueffermust be used to
368b5112fafSChristian Brueffertransfer data to and from the
369b5112fafSChristian Brueffer.Ar peer_data .
370fa0f6e62SHans Petter Selasky.Pp
371fa0f6e62SHans Petter Selasky.Ft "int"
372fa0f6e62SHans Petter Selasky.Fn "cuse_poll_t" "struct cuse_dev *" "int fflags" "int events"
373b5112fafSChristian BruefferThis function returns a mask of
374b5112fafSChristian Brueffer.Dv CUSE_POLL_XXX
375b5112fafSChristian Brueffervalues in case of failure and success.
376b5112fafSChristian BruefferThe events argument is also a mask of
377b5112fafSChristian Brueffer.Dv CUSE_POLL_XXX
378b5112fafSChristian Brueffervalues.
379fa0f6e62SHans Petter Selasky.Bd -literal -offset indent
380fa0f6e62SHans Petter Selaskystruct cuse_methods {
381fa0f6e62SHans Petter Selasky  cuse_open_t *cm_open;
382fa0f6e62SHans Petter Selasky  cuse_close_t *cm_close;
383fa0f6e62SHans Petter Selasky  cuse_read_t *cm_read;
384fa0f6e62SHans Petter Selasky  cuse_write_t *cm_write;
385fa0f6e62SHans Petter Selasky  cuse_ioctl_t *cm_ioctl;
386fa0f6e62SHans Petter Selasky  cuse_poll_t *cm_poll;
387fa0f6e62SHans Petter Selasky};
388fa0f6e62SHans Petter Selasky.Ed
389fa0f6e62SHans Petter Selasky.Sh HISTORY
390fa0f6e62SHans Petter Selasky.Nm
391fa0f6e62SHans Petter Selaskywas written by Hans Petter Selasky.
392