2 CUSE: Character device in Userspace
3 Copyright (C) 2008-2009 SUSE Linux Products GmbH
4 Copyright (C) 2008-2009 Tejun Heo <tj@kernel.org>
6 This program can be distributed under the terms of the GNU LGPLv2.
7 See the file COPYING.LIB.
9 Read example/cusexmp.c for usages.
12 #ifndef _CUSE_LOWLEVEL_H_
13 #define _CUSE_LOWLEVEL_H_
15 #ifndef FUSE_USE_VERSION
16 #define FUSE_USE_VERSION 29
19 #include "fuse_lowlevel.h"
22 #include <sys/types.h>
29 #define CUSE_UNRESTRICTED_IOCTL (1 << 0) /* use unrestricted ioctl */
36 unsigned dev_info_argc
;
37 const char **dev_info_argv
;
42 * Most ops behave almost identically to the matching fuse_lowlevel
43 * ops except that they don't take @ino.
45 * init_done : called after initialization is complete
46 * read/write : always direct IO, simultaneous operations allowed
47 * ioctl : might be in unrestricted mode depending on ci->flags
49 struct cuse_lowlevel_ops
{
50 void (*init
) (void *userdata
, struct fuse_conn_info
*conn
);
51 void (*init_done
) (void *userdata
);
52 void (*destroy
) (void *userdata
);
53 void (*open
) (fuse_req_t req
, struct fuse_file_info
*fi
);
54 void (*read
) (fuse_req_t req
, size_t size
, off_t off
,
55 struct fuse_file_info
*fi
);
56 void (*write
) (fuse_req_t req
, const char *buf
, size_t size
, off_t off
,
57 struct fuse_file_info
*fi
);
58 void (*flush
) (fuse_req_t req
, struct fuse_file_info
*fi
);
59 void (*release
) (fuse_req_t req
, struct fuse_file_info
*fi
);
60 void (*fsync
) (fuse_req_t req
, int datasync
, struct fuse_file_info
*fi
);
61 void (*ioctl
) (fuse_req_t req
, int cmd
, void *arg
,
62 struct fuse_file_info
*fi
, unsigned int flags
,
63 const void *in_buf
, size_t in_bufsz
, size_t out_bufsz
);
64 void (*poll
) (fuse_req_t req
, struct fuse_file_info
*fi
,
65 struct fuse_pollhandle
*ph
);
68 struct fuse_session
*cuse_lowlevel_new(struct fuse_args
*args
,
69 const struct cuse_info
*ci
,
70 const struct cuse_lowlevel_ops
*clop
,
73 struct fuse_session
*cuse_lowlevel_setup(int argc
, char *argv
[],
74 const struct cuse_info
*ci
,
75 const struct cuse_lowlevel_ops
*clop
,
76 int *multithreaded
, void *userdata
);
78 void cuse_lowlevel_teardown(struct fuse_session
*se
);
80 int cuse_lowlevel_main(int argc
, char *argv
[], const struct cuse_info
*ci
,
81 const struct cuse_lowlevel_ops
*clop
, void *userdata
);
87 #endif /* _CUSE_LOWLEVEL_H_ */