19 #ifndef _COBALT_KERNEL_VFILE_H 20 #define _COBALT_KERNEL_VFILE_H 22 #if defined(CONFIG_XENO_OPT_VFILE) || defined(DOXYGEN_CPP) 24 #include <linux/proc_fs.h> 25 #include <linux/seq_file.h> 26 #include <cobalt/kernel/lock.h> 33 struct xnvfile_directory;
39 struct proc_dir_entry *pde;
67 int (*
get)(
struct xnvfile *vfile);
75 void (*
put)(
struct xnvfile *vfile);
78 struct xnvfile_hostlock_class {
83 struct xnvfile_nklock_class {
88 struct xnvfile_input {
89 const char __user *u_buf;
91 struct xnvfile *vfile;
248 ssize_t (*
store)(
struct xnvfile_input *input);
251 struct xnvfile_regular {
252 struct xnvfile entry;
257 struct xnvfile_regular_template {
472 ssize_t (*
store)(
struct xnvfile_input *input);
487 struct xnvfile_snapshot_template {
507 struct xnvfile entry;
538 struct xnvfile_directory {
539 struct xnvfile entry;
542 struct xnvfile_link {
543 struct xnvfile entry;
547 #define VFILE_SEQ_EMPTY ((void *)-1) 549 #define VFILE_SEQ_START SEQ_START_TOKEN 551 #define VFILE_SEQ_SKIP 2 553 #define xnvfile_printf(it, args...) seq_printf((it)->seq, ##args) 554 #define xnvfile_write(it, data, len) seq_write((it)->seq, (data),(len)) 555 #define xnvfile_puts(it, s) seq_puts((it)->seq, (s)) 556 #define xnvfile_putc(it, c) seq_putc((it)->seq, (c)) 565 xnvfile_touch_tag(vfile->tag);
568 #define xnvfile_noentry \ 576 #define xnvfile_nodir { .entry = xnvfile_noentry } 577 #define xnvfile_nolink { .entry = xnvfile_noentry } 578 #define xnvfile_nofile { .entry = xnvfile_noentry } 580 #define xnvfile_priv(e) ((e)->entry.private) 581 #define xnvfile_nref(e) ((e)->entry.refcnt) 582 #define xnvfile_file(e) ((e)->entry.file) 583 #define xnvfile_iterator_priv(it) ((void *)(&(it)->private)) 585 extern struct xnvfile_nklock_class xnvfile_nucleus_lock;
589 int xnvfile_init_root(
void);
591 void xnvfile_destroy_root(
void);
595 struct xnvfile_directory *parent);
598 struct xnvfile_regular *vfile,
599 struct xnvfile_directory *parent);
602 struct xnvfile_directory *vdir,
603 struct xnvfile_directory *parent);
607 struct xnvfile_link *vlink,
608 struct xnvfile_directory *parent);
613 void *data,
size_t size);
616 char *s,
size_t maxlen);
620 int __vfile_hostlock_get(
struct xnvfile *vfile);
622 void __vfile_hostlock_put(
struct xnvfile *vfile);
631 void xnvfile_destroy_regular(
struct xnvfile_regular *vfile)
637 void xnvfile_destroy_dir(
struct xnvfile_directory *vdir)
643 void xnvfile_destroy_link(
struct xnvfile_link *vlink)
648 #define DEFINE_VFILE_HOSTLOCK(name) \ 649 struct xnvfile_hostlock_class name = { \ 651 .get = __vfile_hostlock_get, \ 652 .put = __vfile_hostlock_put, \ 654 .mutex = __MUTEX_INITIALIZER(name.mutex), \ 659 #define xnvfile_touch_tag(tag) do { } while (0) 661 #define xnvfile_touch(vfile) do { } while (0) struct xnvfile_snapshot * vfile
Backlink to the vfile being read.
Definition: vfile.h:528
Snapshot-driven vfile iterator.
Definition: vfile.h:520
void(* endfn)(struct xnvfile_snapshot_iterator *it, void *buf)
Buffer release handler.
Definition: vfile.h:530
void xnvfile_destroy(struct xnvfile *vfile)
Removes a virtual file entry.
Definition: vfile.c:763
int(* show)(struct xnvfile_regular_iterator *it, void *data)
Definition: vfile.h:219
loff_t pos
Current record position while iterating.
Definition: vfile.h:271
Vfile locking operations.
Definition: vfile.h:54
ssize_t(* store)(struct xnvfile_input *input)
Definition: vfile.h:248
ssize_t(* store)(struct xnvfile_input *input)
Definition: vfile.h:472
struct seq_file * seq
Backlink to the host sequential file supporting the vfile.
Definition: vfile.h:526
Snapshot revision tag.
Definition: vfile.h:482
int xnvfile_init_link(const char *from, const char *to, struct xnvfile_link *vlink, struct xnvfile_directory *parent)
Initialize a virtual link entry.
Definition: vfile.c:730
Snapshot vfile operation descriptor.
Definition: vfile.h:293
int(* next)(struct xnvfile_snapshot_iterator *it, void *data)
Definition: vfile.h:413
int xnvfile_init_regular(const char *name, struct xnvfile_regular *vfile, struct xnvfile_directory *parent)
Initialize a regular vfile.
Definition: vfile.c:637
ssize_t xnvfile_get_integer(struct xnvfile_input *input, long *valp)
Evaluate the string written to the vfile as a long integer.
Definition: vfile.c:896
int(* rewind)(struct xnvfile_regular_iterator *it)
Definition: vfile.h:121
void(* put)(struct xnvfile *vfile)
Definition: vfile.h:75
struct xnvfile_regular * vfile
Backlink to the vfile being read.
Definition: vfile.h:275
Regular vfile iterator.
Definition: vfile.h:269
void(* end)(struct xnvfile_regular_iterator *it)
Definition: vfile.h:190
int(* show)(struct xnvfile_snapshot_iterator *it, void *data)
Definition: vfile.h:442
int rev
Current revision number.
Definition: vfile.h:484
caddr_t databuf
Address of record buffer.
Definition: vfile.h:524
struct xnvfile_directory cobalt_vfroot
Xenomai vfile root directory.
Definition: vfile.c:88
int xnvfile_init_snapshot(const char *name, struct xnvfile_snapshot *vfile, struct xnvfile_directory *parent)
Initialize a snapshot-driven vfile.
Definition: vfile.c:397
ssize_t xnvfile_get_string(struct xnvfile_input *input, char *s, size_t maxlen)
Read in a C-string written to the vfile.
Definition: vfile.c:842
Regular vfile operation descriptor.
Definition: vfile.h:103
struct seq_file * seq
Backlink to the host sequential file supporting the vfile.
Definition: vfile.h:273
int(* rewind)(struct xnvfile_snapshot_iterator *it)
Definition: vfile.h:334
int xnvfile_init_dir(const char *name, struct xnvfile_directory *vdir, struct xnvfile_directory *parent)
Initialize a virtual directory entry.
Definition: vfile.c:682
ssize_t xnvfile_get_blob(struct xnvfile_input *input, void *data, size_t size)
Read in a data bulk written to the vfile.
Definition: vfile.c:797
void(* end)(struct xnvfile_snapshot_iterator *it, void *buf)
Definition: vfile.h:380
Snapshot vfile descriptor.
Definition: vfile.h:506
int nrdata
Number of collected records.
Definition: vfile.h:522