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 /** 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
,
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
);
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
);
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 */