4 * API for machine-specific interrupts to interface
7 * @remark Copyright 2002 OProfile authors
8 * @remark Read the file COPYING
10 * @author John Levon <levon@movementarian.org>
16 #include <linux/types.h>
17 #include <linux/spinlock.h>
18 #include <asm/atomic.h>
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.
28 int (*create_files)(struct super_block * sb, struct dentry * root);
29 /* Do any necessary interrupt setup. Optional. */
31 /* Do any necessary interrupt shutdown. Optional. */
32 void (*shutdown)(void);
33 /* Start delivering interrupts. */
35 /* Stop delivering interrupts. */
37 /* CPU identification string. */
42 * One-time initialisation. *ops must be set to a filled-in
43 * operations structure. This is called even in timer interrupt
46 * Return 0 on success.
48 int oprofile_arch_init(struct oprofile_operations ** ops);
51 * One-time exit/cleanup for the arch.
53 void oprofile_arch_exit(void);
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);
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 int oprofilefs_create_file_perm(struct super_block * sb, struct dentry * root,
70 char const * name, struct file_operations * fops, int perm);
72 /** Create a file for read/write access to an unsigned long. */
73 int oprofilefs_create_ulong(struct super_block * sb, struct dentry * root,
74 char const * name, ulong * val);
76 /** Create a file for read-only access to an unsigned long. */
77 int oprofilefs_create_ro_ulong(struct super_block * sb, struct dentry * root,
78 char const * name, ulong * val);
80 /** Create a file for read-only access to an atomic_t. */
81 int oprofilefs_create_ro_atomic(struct super_block * sb, struct dentry * root,
82 char const * name, atomic_t * val);
84 /** create a directory */
85 struct dentry * oprofilefs_mkdir(struct super_block * sb, struct dentry * root,
89 * Write the given asciz string to the given user buffer @buf, updating *offset
90 * appropriately. Returns bytes written or -EFAULT.
92 ssize_t oprofilefs_str_to_user(char const * str, char __user * buf, size_t count, loff_t * offset);
95 * Convert an unsigned long value into ASCII and copy it to the user buffer @buf,
96 * updating *offset appropriately. Returns bytes written or -EFAULT.
98 ssize_t oprofilefs_ulong_to_user(unsigned long val, char __user * buf, size_t count, loff_t * offset);
101 * Read an ASCII string for a number from a userspace buffer and fill *val on success.
102 * Returns 0 on success, < 0 on error.
104 int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, size_t count);
106 /** lock for read/write safety */
107 extern spinlock_t oprofilefs_lock;
109 #endif /* OPROFILE_H */