}
EXPORT_SYMBOL_GPL(get_pf_group_by_tgid);
+struct pf_group *get_pf_group_dumb(void *priv)
+{
+ struct pf_group *pfg;
+ struct proc_filter *filter;
+
+ list_for_each_entry(pfg, &pfg_list, list) {
+ if (check_pf_dumb(pfg->filter))
+ return pfg;
+ }
+
+ filter = create_pf_dumb(pfg->filter);
+ pfg = create_pfg(filter);
+
+ add_pfg_by_list(pfg);
+
+ return pfg;
+}
+EXPORT_SYMBOL_GPL(get_pf_group_dumb);
+
void put_pf_group(struct pf_group *pfg)
{
struct pf_group *get_pf_group_by_dentry(struct dentry *dentry, void *priv);
struct pf_group *get_pf_group_by_tgid(pid_t tgid, void *priv);
+struct pf_group *get_pf_group_dumb(void *priv);
void put_pf_group(struct pf_group *pfg);
int pf_register_probe(struct pf_group *pfg, struct dentry *dentry,
return NULL;
}
+/* Dumb call. Each task is exactly what we are looking for :) */
+static struct task_struct *call_dumb(struct proc_filter *self,
+ struct task_struct *task)
+{
+ return task;
+}
+
static struct proc_filter *create_pf(void)
{
struct proc_filter *pf = kmalloc(sizeof(*pf), GFP_KERNEL);
return pf;
}
+struct proc_filter *create_pf_dumb(void *priv)
+{
+ struct proc_filter *pf = create_pf();
+
+ pf->call = &call_dumb;
+ pf->data = NULL;
+ pf->priv = priv;
+
+ return pf;
+}
+
void free_pf(struct proc_filter *pf)
{
kfree(pf);
return filter->data == (void *)tgid && filter->call == &call_by_tgid;
}
+int check_pf_dumb(struct proc_filter *filter)
+{
+ return filter->call == &call_dumb;
+}
+
struct dentry *get_dentry_by_pf(struct proc_filter *filter)
{
if (filter->call == &call_by_dentry)
struct proc_filter *create_pf_by_dentry(struct dentry *dentry, void *priv);
struct proc_filter *create_pf_by_tgid(pid_t tgid, void *priv);
+struct proc_filter *create_pf_dumb(void *priv);
void free_pf(struct proc_filter *pf);
int check_pf_by_dentry(struct proc_filter *filter, struct dentry *dentry);
int check_pf_by_tgid(struct proc_filter *filter, pid_t tgid);
+int check_pf_dumb(struct proc_filter *filter);
struct dentry *get_dentry_by_pf(struct proc_filter *filter);
#endif /* _PROC_FILTERS_H */