Add support for newers kernels, remove the temporary IOCTL and set back the writev function.
This commit is contained in:
parent
789713fa0b
commit
472265ae8a
@ -38,7 +38,7 @@
|
|||||||
* Copyright (c) 2001, Sensoria Corporation
|
* Copyright (c) 2001, Sensoria Corporation
|
||||||
* Copyright (c) 2002-2003, Regents of the University of California
|
* Copyright (c) 2002-2003, Regents of the University of California
|
||||||
* Copyright (c) 2007 Monty and Xiph.Org
|
* Copyright (c) 2007 Monty and Xiph.Org
|
||||||
* Copyright (c) 2009-2011 Manoel Trapier <godzil@godzil.net>
|
* Copyright (c) 2009-2012 Manoel Trapier <godzil@godzil.net>
|
||||||
*
|
*
|
||||||
* $Id: kfusd.c 12354 2007-01-19 17:26:14Z xiphmont $
|
* $Id: kfusd.c 12354 2007-01-19 17:26:14Z xiphmont $
|
||||||
*/
|
*/
|
||||||
@ -194,6 +194,11 @@ struct class_private {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
struct sysfs_dirent *attr_sd = dentry->d_fsdata;
|
||||||
|
struct kobject *kobj = attr_sd->s_parent->s_dir.kobj;
|
||||||
|
*/
|
||||||
|
|
||||||
static inline struct kobject * to_kobj (struct dentry * dentry)
|
static inline struct kobject * to_kobj (struct dentry * dentry)
|
||||||
{
|
{
|
||||||
struct sysfs_dirent * sd = dentry->d_fsdata;
|
struct sysfs_dirent * sd = dentry->d_fsdata;
|
||||||
@ -201,7 +206,7 @@ static inline struct kobject * to_kobj (struct dentry * dentry)
|
|||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
|
||||||
return ((struct kobject *) sd->s_element );
|
return ((struct kobject *) sd->s_element );
|
||||||
#else
|
#else
|
||||||
return ((struct kobject *) sd->s_dir.kobj );
|
return ((struct kobject *) sd->s_parent->s_dir.kobj );
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -257,7 +262,7 @@ DEFINE_SEMAPHORE (fusd_devlist_sem);
|
|||||||
|
|
||||||
//#ifdef MODULE_LICENSE
|
//#ifdef MODULE_LICENSE
|
||||||
MODULE_AUTHOR ("Jeremy Elson <jelson@acm.org> (c)2001");
|
MODULE_AUTHOR ("Jeremy Elson <jelson@acm.org> (c)2001");
|
||||||
MODULE_AUTHOR ("Manoel Trapier <godzil@godzil.net> (c)2009-2011");
|
MODULE_AUTHOR ("Manoel Trapier <godzil@godzil.net> (c)2009-2012");
|
||||||
MODULE_LICENSE ("GPL");
|
MODULE_LICENSE ("GPL");
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
@ -315,7 +320,12 @@ STATIC void rdebug_real (char *fmt, ...)
|
|||||||
|
|
||||||
# define MAX_MEM_DEBUG 10000
|
# define MAX_MEM_DEBUG 10000
|
||||||
|
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
|
||||||
DECLARE_MUTEX (fusd_memdebug_sem);
|
DECLARE_MUTEX (fusd_memdebug_sem);
|
||||||
|
#else
|
||||||
|
DEFINE_SEMAPHORE (fusd_memdebug_sem);
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@ -464,6 +474,7 @@ STATIC inline void free_fusd_msg (fusd_msg_t **fusd_msg)
|
|||||||
VFREE(( *fusd_msg )->data);
|
VFREE(( *fusd_msg )->data);
|
||||||
( *fusd_msg )->data = NULL;
|
( *fusd_msg )->data = NULL;
|
||||||
}
|
}
|
||||||
|
RDEBUG(1, "Freeing fusd_msg [%p] then set to NULL", fusd_msg);
|
||||||
KFREE(*fusd_msg);
|
KFREE(*fusd_msg);
|
||||||
*fusd_msg = NULL;
|
*fusd_msg = NULL;
|
||||||
}
|
}
|
||||||
@ -2229,6 +2240,7 @@ STATIC int fusd_register_device (fusd_dev_t *fusd_dev,
|
|||||||
struct kobject *ko = to_kobj(classdir2);
|
struct kobject *ko = to_kobj(classdir2);
|
||||||
sys_class = ( ko ? to_class(ko)->class : NULL );
|
sys_class = ( ko ? to_class(ko)->class : NULL );
|
||||||
|
|
||||||
|
#if 0
|
||||||
if ( sys_class )
|
if ( sys_class )
|
||||||
{
|
{
|
||||||
/* W T F ???? Using an existing sys_class will led to a NULL pointer crash
|
/* W T F ???? Using an existing sys_class will led to a NULL pointer crash
|
||||||
@ -2237,7 +2249,7 @@ STATIC int fusd_register_device (fusd_dev_t *fusd_dev,
|
|||||||
RDEBUG(1, "ERROR: Using existing class name is currently unsported !!!");
|
RDEBUG(1, "ERROR: Using existing class name is currently unsported !!!");
|
||||||
goto register_failed4;
|
goto register_failed4;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if ( !sys_class )
|
if ( !sys_class )
|
||||||
RDEBUG(2, "WARNING: sysfs entry for %s has no kobject!\n", register_msg.clazz);
|
RDEBUG(2, "WARNING: sysfs entry for %s has no kobject!\n", register_msg.clazz);
|
||||||
}
|
}
|
||||||
@ -2630,7 +2642,7 @@ STATIC ssize_t fusd_write (struct file *file,
|
|||||||
RDEBUG(1, "%s: [%p:%p:%d:%p] [sl: %d]!!", __func__, file, buffer, length, offset, sizeof (fusd_msg_t ));
|
RDEBUG(1, "%s: [%p:%p:%d:%p] [sl: %d]!!", __func__, file, buffer, length, offset, sizeof (fusd_msg_t ));
|
||||||
return fusd_process_write(file, buffer, length, NULL, 0);
|
return fusd_process_write(file, buffer, length, NULL, 0);
|
||||||
}
|
}
|
||||||
|
#ifndef HAVE_UNLOCKED_IOCTL
|
||||||
STATIC ssize_t fusd_writev (struct file *file,
|
STATIC ssize_t fusd_writev (struct file *file,
|
||||||
const struct iovec *iov,
|
const struct iovec *iov,
|
||||||
unsigned long count,
|
unsigned long count,
|
||||||
@ -2646,6 +2658,23 @@ STATIC ssize_t fusd_writev (struct file *file,
|
|||||||
iov[0].iov_base, iov[0].iov_len,
|
iov[0].iov_base, iov[0].iov_len,
|
||||||
iov[1].iov_base, iov[1].iov_len);
|
iov[1].iov_base, iov[1].iov_len);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
STATIC ssize_t fusd_aio_write (struct kiocb *iocb,
|
||||||
|
const struct iovec *iov,
|
||||||
|
unsigned long count,
|
||||||
|
loff_t offset)
|
||||||
|
{
|
||||||
|
if ( count != 2 )
|
||||||
|
{
|
||||||
|
RDEBUG(2, "fusd_writev: got illegal iov count of %ld", count);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fusd_process_write(iocb->ki_filp,
|
||||||
|
iov[0].iov_base, iov[0].iov_len,
|
||||||
|
iov[1].iov_base, iov[1].iov_len);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_UNLOCKED_IOCTL
|
#ifndef HAVE_UNLOCKED_IOCTL
|
||||||
STATIC int fusd_ioctl (struct inode *inode, struct file *file,
|
STATIC int fusd_ioctl (struct inode *inode, struct file *file,
|
||||||
@ -2656,6 +2685,7 @@ STATIC long fusd_unlocked_ioctl (struct file *file,
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
void __user *argp = (void __user *) arg;
|
void __user *argp = (void __user *) arg;
|
||||||
|
#if 0
|
||||||
struct iovec iov;
|
struct iovec iov;
|
||||||
|
|
||||||
if ( ( argp != NULL ) && ( cmd == 0xb16b00b5 ) )
|
if ( ( argp != NULL ) && ( cmd == 0xb16b00b5 ) )
|
||||||
@ -2672,6 +2702,7 @@ STATIC long fusd_unlocked_ioctl (struct file *file,
|
|||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
RDEBUG(2, "%s: got illegal ioctl #%08X# Or ARG is null [%p]", __func__, cmd, argp);
|
RDEBUG(2, "%s: got illegal ioctl #%08X# Or ARG is null [%p]", __func__, cmd, argp);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@ -2882,7 +2913,7 @@ STATIC struct file_operations fusd_fops = {
|
|||||||
.open = fusd_open,
|
.open = fusd_open,
|
||||||
.read = fusd_read,
|
.read = fusd_read,
|
||||||
.write = fusd_write,
|
.write = fusd_write,
|
||||||
//writev: fusd_writev,
|
.aio_write = fusd_aio_write,
|
||||||
.unlocked_ioctl = fusd_unlocked_ioctl,
|
.unlocked_ioctl = fusd_unlocked_ioctl,
|
||||||
.release = fusd_release,
|
.release = fusd_release,
|
||||||
.poll = fusd_poll,
|
.poll = fusd_poll,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user