K
Kürşat ÖNSÖZ
Hi guys,
I try compile kernel module in c but I get this error.
make -C /lib/modules/3.5.0-17-generic/build M=/home/kursat/Desktop/dev-uyg/2 modules
make[1]: Entering directory `/usr/src/linux-headers-3.5.0-17-generic'
CC [M] /home/kursat/Desktop/dev-uyg/2/mehmet.o
/home/kursat/Desktop/dev-uyg/2/mehmet.c: In function ‘mehmet_read’:
/home/kursat/Desktop/dev-uyg/2/mehmet.c:20:35: error: parameter name omitted
make[2]: *** [/home/kursat/Desktop/dev-uyg/2/mehmet.o] Error 1
make[1]: *** [_module_/home/kursat/Desktop/dev-uyg/2] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.5.0-17-generic'
make: *** [all] Error 2
my makefile :
obj-m += mehmet.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
my source code is :
#ifndef __KERNEL__
#define __KERNEL__
#define MODULE
#define LINUX
#endif
#include <linux/module.h>
#include <linux/version.h>
#include <linux/fs.h>
static ssize_t mehmet_read (struct file *, char * ,size_t,loff_t *);
static ssize_t mehmet_write (struct file *, const char *, size_t, loff_t *);
static struct file_operations mehmet_fops = {
read : mehmet_read,
write : mehmet_write,
};
static ssize_t mehmet_read(struct file *, char * buf,size_t count, loff_t *ppos)
{
return 0;
}
static ssize_t mehmet_write (struct file * file, const char * buf, size_t size, loff_t * ppos)
{
return size;
}
int init_module(void)
{
int i = 0;
i = register_chrdev(222,"mehmet",&mehmet_fops);
if(i<0)
return i;
return 0;
}
void cleanup_module (void)
{
unregister_chrdev (222, "mehmet");
}
I try compile kernel module in c but I get this error.
make -C /lib/modules/3.5.0-17-generic/build M=/home/kursat/Desktop/dev-uyg/2 modules
make[1]: Entering directory `/usr/src/linux-headers-3.5.0-17-generic'
CC [M] /home/kursat/Desktop/dev-uyg/2/mehmet.o
/home/kursat/Desktop/dev-uyg/2/mehmet.c: In function ‘mehmet_read’:
/home/kursat/Desktop/dev-uyg/2/mehmet.c:20:35: error: parameter name omitted
make[2]: *** [/home/kursat/Desktop/dev-uyg/2/mehmet.o] Error 1
make[1]: *** [_module_/home/kursat/Desktop/dev-uyg/2] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.5.0-17-generic'
make: *** [all] Error 2
my makefile :
obj-m += mehmet.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
my source code is :
#ifndef __KERNEL__
#define __KERNEL__
#define MODULE
#define LINUX
#endif
#include <linux/module.h>
#include <linux/version.h>
#include <linux/fs.h>
static ssize_t mehmet_read (struct file *, char * ,size_t,loff_t *);
static ssize_t mehmet_write (struct file *, const char *, size_t, loff_t *);
static struct file_operations mehmet_fops = {
read : mehmet_read,
write : mehmet_write,
};
static ssize_t mehmet_read(struct file *, char * buf,size_t count, loff_t *ppos)
{
return 0;
}
static ssize_t mehmet_write (struct file * file, const char * buf, size_t size, loff_t * ppos)
{
return size;
}
int init_module(void)
{
int i = 0;
i = register_chrdev(222,"mehmet",&mehmet_fops);
if(i<0)
return i;
return 0;
}
void cleanup_module (void)
{
unregister_chrdev (222, "mehmet");
}