PageRenderTime 24ms CodeModel.GetById 13ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/core/10.4/fusefs/fuse_knote.h

http://macfuse.googlecode.com/
C++ Header | 82 lines | 58 code | 19 blank | 5 comment | 0 complexity | d46807558260e161ffdd7f21905e51a9 MD5 | raw file
 1/*
 2 * Copyright (C) 2007 Google. All Rights Reserved.
 3 * Amit Singh <singh@>
 4 */
 5
 6#ifndef _FUSE_KNOTE_H_
 7#define _FUSE_KNOTE_H_
 8
 9#include <fuse_param.h>
10
11#if M_MACFUSE_ENABLE_KQUEUE
12
13#include <sys/event.h>
14
15/* What a kludge! */
16#ifndef KNOTE
17
18SLIST_HEAD(klist, knote);
19
20struct filterops {
21    int  f_isfd; /* true if ident == filedescriptor */
22    int  (*f_attach)(struct knote *kn);
23    void (*f_detach)(struct knote *kn);
24    int  (*f_event)(struct knote *kn, long hint);
25};
26
27TAILQ_HEAD(kqtailq, knote); /* a list of "queued" events */
28
29struct knote {
30    int                  kn_inuse;       /* inuse count */
31    struct kqtailq      *kn_tq;          /* pointer to tail queue */
32    TAILQ_ENTRY(knote)   kn_tqe;         /* linkage for tail queue */
33    struct kqueue       *kn_kq;          /* which kqueue we are on */
34    SLIST_ENTRY(knote)   kn_link;        /* linkage for search list */
35    SLIST_ENTRY(knote)   kn_selnext;     /* klist element chain */
36    union {
37        struct fileproc *p_fp;           /* file data pointer */
38        struct proc     *p_proc;         /* proc pointer */
39    } kn_ptr;
40    struct filterops    *kn_fop;
41    int                  kn_status;      /* status bits */
42    int                  kn_sfflags;     /* saved filter flags */
43    struct               kevent kn_kevent;
44    caddr_t              kn_hook;
45    int                  kn_hookid;
46    int64_t              kn_sdata;       /* saved data field */
47
48#define kn_id     kn_kevent.ident
49#define kn_filter kn_kevent.filter
50#define kn_flags  kn_kevent.flags
51#define kn_fflags kn_kevent.fflags
52#define kn_data   kn_kevent.data
53#define kn_fp     kn_ptr.p_fp
54
55};
56
57#define KNOTE(list, hint)       knote(list, hint)
58#define KNOTE_ATTACH(list, kn)  knote_attach(list, kn)
59#define KNOTE_DETACH(list, kn)  knote_detach(list, kn)
60
61extern void knote(struct klist *klist, long hint);
62extern int  knote_attach(struct klist *list, struct knote *kn);
63extern int  knote_detach(struct klist *list, struct knote *kn);
64
65#endif /* !KNOTE */
66
67void filt_fusedetach(struct knote *kn);
68int  filt_fuseread(struct knote *kn, long hint);
69int  filt_fusewrite(struct knote *kn, long hint);
70int  filt_fusevnode(struct knote *kn, long hint);
71
72extern struct filterops fuseread_filtops;
73extern struct filterops fusewrite_filtops;
74extern struct filterops fusevnode_filtops;
75
76#define FUSE_KNOTE(vp, hint)    KNOTE(&VTOFUD(vp)->c_knotes, (hint))
77
78#else
79#define FUSE_KNOTE(vp, hint)    {}
80#endif /* M_MACFUSE_ENABLE_KQUEUE */
81
82#endif /* _FUSE_NODE_H_ */