[NET]: Add some sparse annotations to network driver stack.
[linux-2.6/history.git] / include / linux / oprofile.h
blob9555dd4d69fc47cbe8a6a25834bfad5fb575a19f
1 /**
2 * @file oprofile.h
4 * API for machine-specific interrupts to interface
5 * to oprofile.
7 * @remark Copyright 2002 OProfile authors
8 * @remark Read the file COPYING
10 * @author John Levon <levon@movementarian.org>
13 #ifndef OPROFILE_H
14 #define OPROFILE_H
16 #include <linux/types.h>
17 #include <linux/spinlock.h>
18 #include <asm/atomic.h>
20 struct super_block;
21 struct dentry;
22 struct file_operations;
24 /* Operations structure to be filled in */
25 struct oprofile_operations {
26 /* create any necessary configuration files in the oprofile fs.
27 * Optional. */
28 int (*create_files)(struct super_block * sb, struct dentry * root);
29 /* Do any necessary interrupt setup. Optional. */
30 int (*setup)(void);
31 /* Do any necessary interrupt shutdown. Optional. */
32 void (*shutdown)(void);
33 /* Start delivering interrupts. */
34 int (*start)(void);
35 /* Stop delivering interrupts. */
36 void (*stop)(void);
37 /* CPU identification string. */
38 char * cpu_type;
41 /**
42 * One-time initialisation. *ops must be set to a filled-in
43 * operations structure. This is called even in timer interrupt
44 * mode.
46 * Return 0 on success.
48 int oprofile_arch_init(struct oprofile_operations ** ops);
50 /**
51 * One-time exit/cleanup for the arch.
53 void oprofile_arch_exit(void);
55 /**
56 * Add a sample. This may be called from any context. Pass
57 * smp_processor_id() as cpu.
59 extern void oprofile_add_sample(unsigned long eip, unsigned int is_kernel,
60 unsigned long event, int cpu);
62 /**
63 * Create a file of the given name as a child of the given root, with
64 * the specified file operations.
66 int oprofilefs_create_file(struct super_block * sb, struct dentry * root,
67 char const * name, struct file_operations * fops);
69 /** Create a file for read/write access to an unsigned long. */
70 int oprofilefs_create_ulong(struct super_block * sb, struct dentry * root,
71 char const * name, ulong * val);
73 /** Create a file for read-only access to an unsigned long. */
74 int oprofilefs_create_ro_ulong(struct super_block * sb, struct dentry * root,
75 char const * name, ulong * val);
77 /** Create a file for read-only access to an atomic_t. */
78 int oprofilefs_create_ro_atomic(struct super_block * sb, struct dentry * root,
79 char const * name, atomic_t * val);
81 /** create a directory */
82 struct dentry * oprofilefs_mkdir(struct super_block * sb, struct dentry * root,
83 char const * name);
85 /**
86 * Write the given asciz string to the given user buffer @buf, updating *offset
87 * appropriately. Returns bytes written or -EFAULT.
89 ssize_t oprofilefs_str_to_user(char const * str, char * buf, size_t count, loff_t * offset);
91 /**
92 * Convert an unsigned long value into ASCII and copy it to the user buffer @buf,
93 * updating *offset appropriately. Returns bytes written or -EFAULT.
95 ssize_t oprofilefs_ulong_to_user(unsigned long val, char * buf, size_t count, loff_t * offset);
97 /**
98 * Read an ASCII string for a number from a userspace buffer and fill *val on success.
99 * Returns 0 on success, < 0 on error.
101 int oprofilefs_ulong_from_user(unsigned long * val, char const * buf, size_t count);
103 /** lock for read/write safety */
104 extern spinlock_t oprofilefs_lock;
106 #endif /* OPROFILE_H */