xref: /freebsd/lib/libcuse/cuse.3 (revision b2c76c41be32f904179efed29c0ca04d53f3996c)
1fa0f6e62SHans Petter Selasky.\"
2*280f34c3SHans Petter Selasky.\" Copyright (c) 2010-2022 Hans Petter Selasky
3fa0f6e62SHans Petter Selasky.\"
4fa0f6e62SHans Petter Selasky.\" All rights reserved.
5fa0f6e62SHans Petter Selasky.\"
6fa0f6e62SHans Petter Selasky.\" Redistribution and use in source and binary forms, with or without
7fa0f6e62SHans Petter Selasky.\" modification, are permitted provided that the following conditions
8fa0f6e62SHans Petter Selasky.\" are met:
9fa0f6e62SHans Petter Selasky.\" 1. Redistributions of source code must retain the above copyright
10fa0f6e62SHans Petter Selasky.\"    notice, this list of conditions and the following disclaimer.
11fa0f6e62SHans Petter Selasky.\" 2. Redistributions in binary form must reproduce the above copyright
12fa0f6e62SHans Petter Selasky.\"    notice, this list of conditions and the following disclaimer in the
13fa0f6e62SHans Petter Selasky.\"    documentation and/or other materials provided with the distribution.
14fa0f6e62SHans Petter Selasky.\"
15fa0f6e62SHans Petter Selasky.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16fa0f6e62SHans Petter Selasky.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17fa0f6e62SHans Petter Selasky.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18fa0f6e62SHans Petter Selasky.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19fa0f6e62SHans Petter Selasky.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20fa0f6e62SHans Petter Selasky.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21fa0f6e62SHans Petter Selasky.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22fa0f6e62SHans Petter Selasky.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23fa0f6e62SHans Petter Selasky.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24fa0f6e62SHans Petter Selasky.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25fa0f6e62SHans Petter Selasky.\" SUCH DAMAGE.
26fa0f6e62SHans Petter Selasky.\"
27*280f34c3SHans Petter Selasky.Dd July 18, 2022
28fa0f6e62SHans Petter Selasky.Dt CUSE 3
29fa0f6e62SHans Petter Selasky.Os
30fa0f6e62SHans Petter Selasky.Sh NAME
31fa0f6e62SHans Petter Selasky.Nm libcuse
32fa0f6e62SHans Petter Selasky.Nd "Userland character device library"
33fa0f6e62SHans Petter Selasky.Sh LIBRARY
34b5112fafSChristian Brueffer.Lb libcuse
35fa0f6e62SHans Petter Selasky.Sh SYNOPSIS
36fa0f6e62SHans Petter SelaskyTo load the required kernel module at boot time, place the following line in
37fa0f6e62SHans Petter Selasky.Xr loader.conf 5 :
38fa0f6e62SHans Petter Selasky.Bd -literal -offset indent
39fa0f6e62SHans Petter Selaskycuse_load="YES"
40fa0f6e62SHans Petter Selasky.Ed
41fa0f6e62SHans Petter Selasky.Pp
42fa0f6e62SHans Petter Selasky.In cuse.h
43fa0f6e62SHans Petter Selasky.Sh DESCRIPTION
44fa0f6e62SHans Petter SelaskyThe
45fa0f6e62SHans Petter Selasky.Nm
46b5112fafSChristian Bruefferlibrary contains functions to create a character device in userspace.
47b5112fafSChristian BruefferThe
48fa0f6e62SHans Petter Selasky.Nm
49fa0f6e62SHans Petter Selaskylibrary is thread safe.
50fa0f6e62SHans Petter Selasky.Sh LIBRARY INITIALISATION / DEINITIALISATION
51fa0f6e62SHans Petter Selasky.Ft "int"
52fa0f6e62SHans Petter Selasky.Fn "cuse_init" "void"
53fa0f6e62SHans Petter SelaskyThis function initialises
54fa0f6e62SHans Petter Selasky.Nm .
55fa0f6e62SHans Petter SelaskyMust be called at the beginning of the program.
56fa0f6e62SHans Petter SelaskyThis function returns 0 on success or a negative value on failure.
57b5112fafSChristian BruefferSee
58b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
59b5112fafSChristian Bruefferfor known error codes.
60b5112fafSChristian BruefferIf the cuse kernel module is not loaded,
61b5112fafSChristian Brueffer.Dv CUSE_ERR_NOT_LOADED
62b5112fafSChristian Bruefferis returned.
63fa0f6e62SHans Petter Selasky.Pp
64fa0f6e62SHans Petter Selasky.Ft "int"
65fa0f6e62SHans Petter Selasky.Fn "cuse_uninit" "void"
66fa0f6e62SHans Petter SelaskyDeinitialise
67fa0f6e62SHans Petter Selasky.Nm .
68fa0f6e62SHans Petter SelaskyCan be called at the end of the application.
69fa0f6e62SHans Petter SelaskyThis function returns 0 on success or a negative value on failure.
70b5112fafSChristian BruefferSee
71b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
72b5112fafSChristian Bruefferfor known error codes.
73fa0f6e62SHans Petter Selasky.Sh UNIT MANAGEMENT
74fa0f6e62SHans Petter Selasky.Ft "int"
75fa0f6e62SHans Petter Selasky.Fn "cuse_alloc_unit_number" "int *"
76fa0f6e62SHans Petter SelaskyThis function stores a uniq system unit number at the pointed
77fa0f6e62SHans Petter Selaskyinteger loation.
78fa0f6e62SHans Petter SelaskyThis function returns 0 on success or a negative value on failure.
79b5112fafSChristian BruefferSee
80b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
81b5112fafSChristian Bruefferfor known error codes.
82fa0f6e62SHans Petter Selasky.Pp
83fa0f6e62SHans Petter Selasky.Ft "int"
84fa0f6e62SHans Petter Selasky.Fn "cuse_alloc_unit_number_by_id" "int *" "int id"
85b5112fafSChristian BruefferThis function stores a unique system unit number at the pointed
86fa0f6e62SHans Petter Selaskyinteger loation.
87fa0f6e62SHans Petter SelaskyThe returned unit number is uniq within the given ID.
88fa0f6e62SHans Petter SelaskyValid ID values are defined by the cuse include file.
89b5112fafSChristian BruefferSee the
90b5112fafSChristian Brueffer.Fn CUSE_ID_XXX
91b5112fafSChristian Brueffermacros for more information.
92fa0f6e62SHans Petter SelaskyThis function returns 0 on success or a negative value on failure.
93b5112fafSChristian BruefferSee
94b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
95b5112fafSChristian Bruefferfor known error codes.
96fa0f6e62SHans Petter Selasky.Pp
97fa0f6e62SHans Petter Selasky.Ft "int"
98fa0f6e62SHans Petter Selasky.Fn "cuse_free_unit_number" "int"
99fa0f6e62SHans Petter SelaskyThis function frees the given allocated system unit number.
100fa0f6e62SHans Petter SelaskyThis function returns 0 on success or a negative value on failure.
101b5112fafSChristian BruefferSee
102b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
103b5112fafSChristian Bruefferfor known error codes.
104fa0f6e62SHans Petter Selasky.Pp
105fa0f6e62SHans Petter Selasky.Ft "int"
106fa0f6e62SHans Petter Selasky.Fn "cuse_free_unit_number_by_id" "int unit" "int id"
107fa0f6e62SHans Petter SelaskyThis function frees the given allocated system unit number belonging
108fa0f6e62SHans Petter Selaskyto the given ID.
109fa0f6e62SHans Petter SelaskyIf both the unit and id argument is -1, all allocated units will be freed.
110fa0f6e62SHans Petter SelaskyThis function returns 0 on success or a negative value on failure.
111b5112fafSChristian BruefferSee
112b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX
113b5112fafSChristian Bruefferfor known error codes.
114fa0f6e62SHans Petter Selasky.Sh LIBRARY USAGE
115fa0f6e62SHans Petter Selasky.Ft "void *"
11658a8f6e9SHans Petter Selasky.Fn "cuse_vmalloc" "unsigned size"
117fa0f6e62SHans Petter SelaskyThis function allocates
118fa0f6e62SHans Petter Selasky.Ar size
119b5112fafSChristian Bruefferbytes of memory.
120b5112fafSChristian BruefferOnly memory allocated by this function can be memory
121b5112fafSChristian Brueffermapped by
122b5112fafSChristian Brueffer.Xr mmap 2 .
123b5112fafSChristian BruefferThis function returns a valid data pointer on success or
124b5112fafSChristian Brueffer.Dv NULL
125b5112fafSChristian Bruefferon failure.
126*280f34c3SHans Petter SelaskyThe returned pointer is always aligned to the system page size.
127*280f34c3SHans Petter SelaskyThe number and size of allocations is limited by the
128*280f34c3SHans Petter Selasky.Xr mmap 2
129*280f34c3SHans Petter Selaskyoffset having to fit into a 32-bit variable typically for 32-bit
130*280f34c3SHans Petter Selaskyapplications.
131fa0f6e62SHans Petter Selasky.Pp
132fa0f6e62SHans Petter Selasky.Ft "int"
133fa0f6e62SHans Petter Selasky.Fn "cuse_is_vmalloc_addr" "void *"
134fa0f6e62SHans Petter SelaskyThis function returns non-zero if the passed pointer points to a valid
135b5112fafSChristian Bruefferand non-freed allocation, as returned by
136b5112fafSChristian Brueffer.Fn cuse_vmalloc .
137fa0f6e62SHans Petter SelaskyElse this function returns zero.
138fa0f6e62SHans Petter Selasky.Pp
139fa0f6e62SHans Petter Selasky.Ft "void"
140fa0f6e62SHans Petter Selasky.Fn "cuse_vmfree" "void *"
141b5112fafSChristian BruefferThis function frees memory allocated by
142b5112fafSChristian Brueffer.Fn cuse_vmalloc .
1432ca43c3dSHans Petter SelaskyThis function is NULL safe.
144fa0f6e62SHans Petter Selasky.Pp
145fa0f6e62SHans Petter Selasky.Ft "unsigned long"
146fa0f6e62SHans Petter Selasky.Fn "cuse_vmoffset" "void *"
147*280f34c3SHans Petter SelaskyThis function returns the mmap offset the client must use to
148fa0f6e62SHans Petter Selaskyaccess the allocated memory.
149*280f34c3SHans Petter SelaskyThe passed pointer must be aligned to the system page size.
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