~ubuntu-branches/debian/squeeze/ecryptfs-utils/squeeze

« back to all changes in this revision

Viewing changes to src/jprobes/test-jprobe.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-10-17 09:21:46 UTC
  • mfrom: (16.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20091017092146-mx8azups35026ux3
Tags: 81-2
* Adding patch from upstream to ecryptfs-setup-private, in order to
  not incorrectly assume that the home/private directory ownerships
  should be owned by USER:USER but USER:GROUP.
* Minimizing rules file.
* Sorting and wrapping depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <linux/module.h>
2
 
#include <linux/init.h>
3
 
#include <linux/kprobes.h>
4
 
#include <linux/kallsyms.h>
5
 
#include <linux/fs.h>
6
 
 
7
 
struct jprobe_mapping_elem {
8
 
        struct jprobe *jp;
9
 
        char *symbol;
10
 
        void *fp;
11
 
};
12
 
 
13
 
void jp_ecryptfs_kill_block_super(struct super_block *sb)
14
 
{
15
 
        printk(KERN_INFO "sb = [0x%p]\n", sb);
16
 
        jprobe_return();
17
 
}
18
 
 
19
 
struct jprobe_mapping_elem jprobe_mapping[] = {
20
 
        {NULL, "ecryptfs_kill_block_super", jp_ecryptfs_kill_block_super},
21
 
};
22
 
 
23
 
static int __init test_jprobe_init(void)
24
 
{
25
 
        int i;
26
 
 
27
 
        for (i = 0; i < ARRAY_SIZE(jprobe_mapping); i++) {
28
 
                jprobe_mapping[i].jp = kmalloc(sizeof(struct jprobe),
29
 
                                               GFP_KERNEL);
30
 
                jprobe_mapping[i].jp->entry = jprobe_mapping[i].fp;
31
 
                jprobe_mapping[i].jp->kp.addr = (kprobe_opcode_t *)
32
 
                        kallsyms_lookup_name(jprobe_mapping[i].symbol);
33
 
                if (jprobe_mapping[i].jp->kp.addr == NULL) {
34
 
                        printk(KERN_NOTICE "Unable to find symbol [%s]\n",
35
 
                               jprobe_mapping[i].symbol);
36
 
                        return 1;
37
 
                }
38
 
                register_jprobe(jprobe_mapping[i].jp);
39
 
        }
40
 
        return 0;
41
 
}
42
 
 
43
 
static void __exit test_jprobe_exit(void)
44
 
{
45
 
        int i;
46
 
 
47
 
        for (i = 0; i < ARRAY_SIZE(jprobe_mapping); i++) {
48
 
                unregister_jprobe(jprobe_mapping[i].jp);
49
 
                kfree(jprobe_mapping[i].jp);
50
 
        }
51
 
}
52
 
 
53
 
module_init(test_jprobe_init);
54
 
module_exit(test_jprobe_exit);
55
 
MODULE_LICENSE("GPL");