24 #ifndef _XENO_NUCLEUS_VFILE_H
25 #define _XENO_NUCLEUS_VFILE_H
27 #if defined(CONFIG_XENO_OPT_VFILE) || defined(DOXYGEN_CPP)
32 #include <linux/proc_fs.h>
33 #include <linux/seq_file.h>
34 #include <nucleus/types.h>
36 struct xnvfile_directory;
42 struct proc_dir_entry *pde;
70 int (*
get)(
struct xnvfile *vfile);
78 void (*
put)(
struct xnvfile *vfile);
86 struct xnvfile_hostlock_class {
91 struct xnvfile_nklock_class {
96 struct xnvfile_input {
97 const char __user *u_buf;
99 struct xnvfile *vfile;
256 ssize_t (*
store)(
struct xnvfile_input *input);
259 struct xnvfile_regular {
260 struct xnvfile entry;
265 struct xnvfile_regular_template {
480 ssize_t (*
store)(
struct xnvfile_input *input);
495 struct xnvfile_snapshot_template {
515 struct xnvfile entry;
546 struct xnvfile_directory {
547 struct xnvfile entry;
550 struct xnvfile_link {
551 struct xnvfile entry;
555 #define VFILE_SEQ_EMPTY ((void *)-1)
557 #define VFILE_SEQ_START SEQ_START_TOKEN
559 #define VFILE_SEQ_SKIP 2
561 #define xnvfile_printf(it, args...) seq_printf((it)->seq, ##args)
562 #define xnvfile_write(it, data, len) seq_write((it)->seq, (data),(len))
563 #define xnvfile_puts(it, s) seq_puts((it)->seq, (s))
564 #define xnvfile_putc(it, c) seq_putc((it)->seq, (c))
573 xnvfile_touch_tag(vfile->tag);
576 #define xnvfile_noentry \
584 #define xnvfile_nodir { .entry = xnvfile_noentry }
585 #define xnvfile_nolink { .entry = xnvfile_noentry }
586 #define xnvfile_nofile { .entry = xnvfile_noentry }
588 #define xnvfile_priv(e) ((e)->entry.private)
589 #define xnvfile_nref(e) ((e)->entry.refcnt)
590 #define xnvfile_file(e) ((e)->entry.file)
591 #define xnvfile_iterator_priv(it) ((void *)(&(it)->private))
593 extern struct xnvfile_nklock_class xnvfile_nucleus_lock;
595 extern struct xnvfile_directory
nkvfroot;
597 int xnvfile_init_root(
void);
599 void xnvfile_destroy_root(
void);
607 struct xnvfile_directory *parent);
610 struct xnvfile_regular *vfile,
611 struct xnvfile_directory *parent);
614 struct xnvfile_directory *vdir,
615 struct xnvfile_directory *parent);
619 struct xnvfile_link *vlink,
620 struct xnvfile_directory *parent);
625 void *data,
size_t size);
628 char *s,
size_t maxlen);
632 int __vfile_hostlock_get(
struct xnvfile *vfile);
634 void __vfile_hostlock_put(
struct xnvfile *vfile);
647 void xnvfile_destroy_regular(
struct xnvfile_regular *vfile)
653 void xnvfile_destroy_dir(
struct xnvfile_directory *vdir)
659 void xnvfile_destroy_link(
struct xnvfile_link *vlink)
664 #define DEFINE_VFILE_HOSTLOCK(name) \
665 struct xnvfile_hostlock_class name = { \
667 .get = __vfile_hostlock_get, \
668 .put = __vfile_hostlock_put, \
670 .sem = __SEMAPHORE_INITIALIZER(name.sem, 1), \
675 #define xnvfile_touch_tag(tag) do { } while (0)
677 #define xnvfile_touch(vfile) do { } while (0)