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