X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/f419961de4a8e818c602b0642492ce76dd5bf979..04ac67cc3cac14cd601daacd0592121ec0b84012:/lincan/src/ioctl.c diff --git a/lincan/src/ioctl.c b/lincan/src/ioctl.c index 2d410f1..d3582d0 100644 --- a/lincan/src/ioctl.c +++ b/lincan/src/ioctl.c @@ -37,7 +37,7 @@ #include "../include/main.h" #include "../include/ioctl.h" -int can_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) +long can_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { int i=0; unsigned short channel=0; @@ -46,12 +46,12 @@ int can_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned struct msgobj_t *obj; struct canchip_t *chip; struct canque_ends_t *qends; - + if(!canuser || (canuser->magic != CAN_USER_MAGIC)){ CANMSG("can_ioctl: bad canuser magic\n"); return -ENODEV; } - + obj = canuser->msgobj; if (obj == NULL) { CANMSG("Could not assign buffer structure\n"); @@ -92,14 +92,14 @@ int can_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned case CONF_FILTER: { /* In- and output buffer re-initialization */ - + if(canuser->rx_edge0){ canque_set_filt(canuser->rx_edge0, arg, ~0, 0); } break; } - + case CANQUE_FILTER: { struct canfilt_t canfilt; int ret; @@ -110,11 +110,11 @@ int can_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned } break; } - + case CANRTR_READ: { int ret; struct canmsg_t rtr_msg; - + ret = copy_from_user(&rtr_msg, (void*)arg, sizeof(struct canmsg_t)); if(ret) return -EFAULT; ret = can_ioctl_remote_read(canuser, &rtr_msg, rtr_msg.id, 0); @@ -135,11 +135,11 @@ int can_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned } break; } - + case CONF_BAUDPARAMS: { struct can_baudparams_t params; int ret; - + ret = copy_from_user(¶ms, (void*)arg, sizeof(struct can_baudparams_t)); if(ret) return -EFAULT; @@ -162,7 +162,7 @@ int can_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned CANMSG("Not a valid ioctl command\n"); return -EINVAL; } - + } return 0;