Can someone tell me what this error means: parse error before string constant
Here is my code - for some reason I can't get the SPRINTF line to work because of the error... Thanks
Code:
#include<linux/kernel.h>
#include<linux/module.h>
#include<linux/proc_fs.h>
#include<asm/uaccess.h>
#define BUF_LEN 50
#define MESSAGE_LENGTH 80
static char Message[MESSAGE_LENGTH] ;
char message[MESSAGE_LENGTH+30] ;
static ssize_t module_output(
struct file *file,
char *buf,
size_t len,
loff_t *offset);
static ssize_t module_input(
struct file *file,
const char *buf,
size_t length,
loff_t *offset);
sprintf(message, "Last input:%s", Message) ;
int read_my_clock( char *a, char **b, off_t c, int d, int e)
{
printk(KERN_ALERT, "\nread_my_clock\n") ;
/* this is the function that I write to read
the clock file info that I created in proc
*/
}
struct proc_dir_entry dc_clock_mod_file = {
0,
12,
"dc_clock_mod",
S_IFREG | S_IRUGO,
1,
0,
0,
BUF_LEN,
NULL,
read_my_clock,
NULL
};
int init_module()
{
return proc_register(&proc_root, &dc_clock_mod_file);
}
void cleanup_module()
{
proc_unregister(&proc_root, dc_clock_mod_file.low_ino) ;
}
I am using the GCC compiler so you may have to use this line to compile.
gcc -I /usr/include -c -D__KERNEL__ -DMODULE <filename>