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*9f16d9c9SHans Petter Selasky.Dd October 5, 2017 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 *" 117fa0f6e62SHans Petter Selasky.Fn "cuse_vmalloc" "int 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 . 139b5112fafSChristian BruefferNote that the 140fa0f6e62SHans Petter Selaskycuse library will internally not free the memory until the 141b5112fafSChristian Brueffer.Fn cuse_uninit 142b5112fafSChristian 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 153b5112fafSChristian Bruefferparameters. 154b5112fafSChristian BruefferThis function returns a valid cuse_dev structure pointer 155b5112fafSChristian Bruefferon success or 156b5112fafSChristian Brueffer.Dv NULL 157b5112fafSChristian Bruefferon failure. 158b5112fafSChristian 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 *" 166b5112fafSChristian Brueffer.Fn "cuse_dev_get_priv0" "struct cuse_dev *" , 167fa0f6e62SHans Petter Selasky.Ft "void *" 168b5112fafSChristian Brueffer.Fn "cuse_dev_get_priv1" "struct cuse_dev *" , 169fa0f6e62SHans Petter Selasky.Ft "void" 170b5112fafSChristian 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" 178b5112fafSChristian BruefferThis function will block and do event processing. 179b5112fafSChristian 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. 183b5112fafSChristian BruefferSee 184b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX 185b5112fafSChristian Bruefferfor known error codes. 186fa0f6e62SHans Petter Selasky.Pp 187fa0f6e62SHans Petter Selasky.Ft "void *" 188b5112fafSChristian 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" 196b5112fafSChristian BruefferThis function instructs 197b5112fafSChristian Brueffer.Fn cuse_copy_out 198b5112fafSChristian Bruefferand 199b5112fafSChristian Brueffer.Fn cuse_copy_in 200b5112fafSChristian 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" 209b5112fafSChristian BruefferReturns the current local state. 210b5112fafSChristian BruefferSee 211b5112fafSChristian Brueffer.Fn cuse_set_local . 212fa0f6e62SHans Petter Selasky.Pp 213fa0f6e62SHans Petter Selasky.Ft "int" 214b5112fafSChristian 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 218b5112fafSChristian Bruefferapplication and the peer application. 219b5112fafSChristian BruefferThese functions must be used 220b5112fafSChristian Bruefferwhen operating on the data pointers passed to the 221b5112fafSChristian Brueffer.Fn cm_read , 222b5112fafSChristian Brueffer.Fn cm_write , 223b5112fafSChristian Bruefferand 224b5112fafSChristian Brueffer.Fn cm_ioctl 225b5112fafSChristian Brueffercallback functions. 226fa0f6e62SHans Petter SelaskyThese functions return 0 on success or a negative value on failure. 227b5112fafSChristian BruefferSee 228b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX 229b5112fafSChristian 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 235b5112fafSChristian Bruefferoperation callbacks. 236b5112fafSChristian BruefferThis function returns 0 if a signal has been 237fa0f6e62SHans Petter Selaskydelivered to the caller. 238fa0f6e62SHans Petter SelaskyElse it returns a negative value. 239b5112fafSChristian BruefferSee 240b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX 241b5112fafSChristian 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 246b5112fafSChristian Brueffercurrently executing command, by 247b5112fafSChristian Brueffer.Dv CUSE_CMD_XXX 248b5112fafSChristian Brueffervalue. 249b5112fafSChristian BruefferThe 250b5112fafSChristian Brueffer.Ar pcmd 251b5112fafSChristian Bruefferargument 252b5112fafSChristian Bruefferis allowed to be 253b5112fafSChristian Brueffer.Dv NULL . 254b5112fafSChristian BruefferThis function should only be used inside the 255b5112fafSChristian Brueffercuse file operation callbacks. 256b5112fafSChristian BruefferOn success a valid cuse device pointer 257b5112fafSChristian Bruefferis returned. 258b5112fafSChristian BruefferOn failure 259b5112fafSChristian Brueffer.Dv NULL 260b5112fafSChristian 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.Sh LIBRARY LIMITATIONS 266b5112fafSChristian BruefferTransfer lengths for 267b5112fafSChristian Brueffer.Fn read , 268b5112fafSChristian Brueffer.Fn write , 269b5112fafSChristian Brueffer.Fn cuse_copy_in , 270b5112fafSChristian Bruefferand 271b5112fafSChristian Brueffer.Fn cuse_copy_out 272fa0f6e62SHans Petter Selaskyshould not exceed what can fit into a 32-bit signed integer and is 273b5112fafSChristian Bruefferdefined by the 274b5112fafSChristian Brueffer.Fn CUSE_LENGTH_MAX 275b5112fafSChristian Brueffermacro. 276fa0f6e62SHans Petter SelaskyTransfer lengths for ioctls should not exceed what is defined by the 277b5112fafSChristian Brueffer.Fn CUSE_BUFFER_MAX 278b5112fafSChristian Brueffermacro. 279fa0f6e62SHans Petter Selasky.Sh LIBRARY CALLBACK METHODS 280b5112fafSChristian BruefferIn general fflags are defined by 281b5112fafSChristian Brueffer.Dv CUSE_FFLAG_XXX 282b5112fafSChristian Bruefferand errors are defined by 283b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX . 284fa0f6e62SHans Petter Selasky.Bd -literal -offset indent 285fa0f6e62SHans Petter Selaskyenum { 286fa0f6e62SHans Petter Selasky CUSE_ERR_NONE 287fa0f6e62SHans Petter Selasky CUSE_ERR_BUSY 288fa0f6e62SHans Petter Selasky CUSE_ERR_WOULDBLOCK 289fa0f6e62SHans Petter Selasky CUSE_ERR_INVALID 290fa0f6e62SHans Petter Selasky CUSE_ERR_NO_MEMORY 291fa0f6e62SHans Petter Selasky CUSE_ERR_FAULT 292fa0f6e62SHans Petter Selasky CUSE_ERR_SIGNAL 293fa0f6e62SHans Petter Selasky CUSE_ERR_OTHER 294fa0f6e62SHans Petter Selasky CUSE_ERR_NOT_LOADED 295*9f16d9c9SHans Petter Selasky CUSE_ERR_NO_DEVICE 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" 322b5112fafSChristian BruefferThis function returns a 323b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX 324b5112fafSChristian Brueffervalue. 325fa0f6e62SHans Petter Selasky.Pp 326fa0f6e62SHans Petter Selasky.Ft "int" 327fa0f6e62SHans Petter Selasky.Fn "cuse_close_t" "struct cuse_dev *" "int fflags" 328b5112fafSChristian BruefferThis function returns a 329b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX 330b5112fafSChristian 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" 334b5112fafSChristian BruefferThis function returns a 335b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX 336b5112fafSChristian Brueffervalue in case of failure or the 337b5112fafSChristian Bruefferactually transferred length in case of success. 338b5112fafSChristian Brueffer.Fn cuse_copy_in 339b5112fafSChristian Bruefferand 340b5112fafSChristian Brueffer.Fn cuse_copy_out 341b5112fafSChristian Brueffermust be used to transfer data to and from the 342b5112fafSChristian 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" 346b5112fafSChristian BruefferThis function returns a 347b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX 348b5112fafSChristian Brueffervalue in case of failure or the 349b5112fafSChristian Bruefferactually transferred length in case of success. 350b5112fafSChristian Brueffer.Fn cuse_copy_in 351b5112fafSChristian Bruefferand 352b5112fafSChristian Brueffer.Fn cuse_copy_out 353b5112fafSChristian Brueffermust be used to transfer data to and from the 354b5112fafSChristian 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" 358b5112fafSChristian BruefferThis function returns a 359b5112fafSChristian Brueffer.Dv CUSE_ERR_XXX 360b5112fafSChristian Brueffervalue in case of failure or zero 361b5112fafSChristian Bruefferin case of success. 362b5112fafSChristian Brueffer.Fn cuse_copy_in 363b5112fafSChristian Bruefferand 364b5112fafSChristian Brueffer.Fn cuse_copy_out 365b5112fafSChristian Brueffermust be used to 366b5112fafSChristian Brueffertransfer data to and from the 367b5112fafSChristian 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" 371b5112fafSChristian BruefferThis function returns a mask of 372b5112fafSChristian Brueffer.Dv CUSE_POLL_XXX 373b5112fafSChristian Brueffervalues in case of failure and success. 374b5112fafSChristian BruefferThe events argument is also a mask of 375b5112fafSChristian Brueffer.Dv CUSE_POLL_XXX 376b5112fafSChristian Brueffervalues. 377fa0f6e62SHans Petter Selasky.Bd -literal -offset indent 378fa0f6e62SHans Petter Selaskystruct cuse_methods { 379fa0f6e62SHans Petter Selasky cuse_open_t *cm_open; 380fa0f6e62SHans Petter Selasky cuse_close_t *cm_close; 381fa0f6e62SHans Petter Selasky cuse_read_t *cm_read; 382fa0f6e62SHans Petter Selasky cuse_write_t *cm_write; 383fa0f6e62SHans Petter Selasky cuse_ioctl_t *cm_ioctl; 384fa0f6e62SHans Petter Selasky cuse_poll_t *cm_poll; 385fa0f6e62SHans Petter Selasky}; 386fa0f6e62SHans Petter Selasky.Ed 387fa0f6e62SHans Petter Selasky.Sh HISTORY 388fa0f6e62SHans Petter Selasky.Nm 389fa0f6e62SHans Petter Selaskywas written by Hans Petter Selasky. 390