SLES10 Fixes (part 9)

- Proper ioctl() 32/64-bit binary compatibility.  We need to ensure the
  ioctl data itself is always packed the same for 32/64-bit binaries.
  Additionally, the correct thing to do is encode this size in bytes
  as part of the command using _IOC_SIZE().
- Minor formatting changes to respect the 80 character limit.
- Move all SPLAT_SUBSYSTEM_* defines in to splat-ctl.h.
- Increase SPLAT_SUBSYSTEM_UNKNOWN because we were getting close
  to accidentally using it for a real registered subsystem.
This commit is contained in:
Brian Behlendorf
2009-05-21 10:56:11 -07:00
parent 9593ef76d9
commit e554dffa60
16 changed files with 64 additions and 85 deletions
-1
View File
@@ -26,7 +26,6 @@
#include "splat-internal.h"
#define SPLAT_SUBSYSTEM_ATOMIC 0x0b00
#define SPLAT_ATOMIC_NAME "atomic"
#define SPLAT_ATOMIC_DESC "Kernel Atomic Tests"
-1
View File
@@ -26,7 +26,6 @@
#include "splat-internal.h"
#define SPLAT_SUBSYSTEM_CONDVAR 0x0500
#define SPLAT_CONDVAR_NAME "condvar"
#define SPLAT_CONDVAR_DESC "Kernel Condition Variable Tests"
+16 -7
View File
@@ -326,11 +326,15 @@ splat_validate(struct file *file, splat_subsystem_t *sub, int cmd, void *arg)
}
static int
splat_ioctl_cfg(struct file *file, unsigned long arg)
splat_ioctl_cfg(struct file *file, unsigned int cmd, unsigned long arg)
{
splat_cfg_t kcfg;
int rc = 0;
/* User and kernel space agree about arg size */
if (_IOC_SIZE(cmd) != sizeof(kcfg))
return -EBADMSG;
if (copy_from_user(&kcfg, (splat_cfg_t *)arg, sizeof(kcfg)))
return -EFAULT;
@@ -362,7 +366,7 @@ splat_ioctl_cfg(struct file *file, unsigned long arg)
case SPLAT_CFG_SUBSYSTEM_LIST:
/* cfg_arg1 - Unused
* cfg_rc1 - Set to number of subsystems
* cfg_data.splat_subsystems - Populated with subsystems
* cfg_data.splat_subsystems - Set with subsystems
*/
rc = splat_subsystem_list(&kcfg, arg);
break;
@@ -380,7 +384,8 @@ splat_ioctl_cfg(struct file *file, unsigned long arg)
rc = splat_test_list(&kcfg, arg);
break;
default:
splat_print(file, "Bad config command %d\n", kcfg.cfg_cmd);
splat_print(file, "Bad config command %d\n",
kcfg.cfg_cmd);
rc = -EINVAL;
break;
}
@@ -389,13 +394,17 @@ splat_ioctl_cfg(struct file *file, unsigned long arg)
}
static int
splat_ioctl_cmd(struct file *file, unsigned long arg)
splat_ioctl_cmd(struct file *file, unsigned int cmd, unsigned long arg)
{
splat_subsystem_t *sub;
splat_cmd_t kcmd;
int rc = -EINVAL;
void *data = NULL;
/* User and kernel space agree about arg size */
if (_IOC_SIZE(cmd) != sizeof(kcmd))
return -EBADMSG;
if (copy_from_user(&kcmd, (splat_cfg_t *)arg, sizeof(kcmd)))
return -EFAULT;
@@ -432,7 +441,7 @@ splat_ioctl_cmd(struct file *file, unsigned long arg)
static int
splat_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{
unsigned int minor = iminor(file->f_dentry->d_inode);
int rc = 0;
@@ -446,10 +455,10 @@ splat_ioctl(struct inode *inode, struct file *file,
switch (cmd) {
case SPLAT_CFG:
rc = splat_ioctl_cfg(file, arg);
rc = splat_ioctl_cfg(file, cmd, arg);
break;
case SPLAT_CMD:
rc = splat_ioctl_cmd(file, arg);
rc = splat_ioctl_cmd(file, cmd, arg);
break;
default:
splat_print(file, "Bad ioctl command %d\n", cmd);
-1
View File
@@ -26,7 +26,6 @@
#include "splat-internal.h"
#define SPLAT_SUBSYSTEM_GENERIC 0x0d00
#define SPLAT_GENERIC_NAME "generic"
#define SPLAT_GENERIC_DESC "Kernel Generic Tests"
-1
View File
@@ -26,7 +26,6 @@
#include "splat-internal.h"
#define SPLAT_SUBSYSTEM_KMEM 0x0100
#define SPLAT_KMEM_NAME "kmem"
#define SPLAT_KMEM_DESC "Kernel Malloc/Slab Tests"
-1
View File
@@ -26,7 +26,6 @@
#include "splat-internal.h"
#define SPLAT_SUBSYSTEM_KOBJ 0x0a00
#define SPLAT_KOBJ_NAME "kobj"
#define SPLAT_KOBJ_DESC "Kernel Kobj Tests"
-1
View File
@@ -26,7 +26,6 @@
#include "splat-internal.h"
#define SPLAT_SUBSYSTEM_LIST 0x0c00
#define SPLAT_LIST_NAME "list"
#define SPLAT_LIST_DESC "Kernel List Tests"
-1
View File
@@ -26,7 +26,6 @@
#include "splat-internal.h"
#define SPLAT_SUBSYSTEM_MUTEX 0x0400
#define SPLAT_MUTEX_NAME "mutex"
#define SPLAT_MUTEX_DESC "Kernel Mutex Tests"
-1
View File
@@ -26,7 +26,6 @@
#include "splat-internal.h"
#define SPLAT_SUBSYSTEM_KRNG 0x0300
#define SPLAT_KRNG_NAME "krng"
#define SPLAT_KRNG_DESC "Kernel Random Number Generator Tests"
-1
View File
@@ -26,7 +26,6 @@
#include "splat-internal.h"
#define SPLAT_SUBSYSTEM_RWLOCK 0x0700
#define SPLAT_RWLOCK_NAME "rwlock"
#define SPLAT_RWLOCK_DESC "Kernel RW Lock Tests"
-1
View File
@@ -26,7 +26,6 @@
#include "splat-internal.h"
#define SPLAT_SUBSYSTEM_TASKQ 0x0200
#define SPLAT_TASKQ_NAME "taskq"
#define SPLAT_TASKQ_DESC "Kernel Task Queue Tests"
-1
View File
@@ -26,7 +26,6 @@
#include "splat-internal.h"
#define SPLAT_SUBSYSTEM_THREAD 0x0600
#define SPLAT_THREAD_NAME "thread"
#define SPLAT_THREAD_DESC "Kernel Thread Tests"
-1
View File
@@ -26,7 +26,6 @@
#include "splat-internal.h"
#define SPLAT_SUBSYSTEM_TIME 0x0800
#define SPLAT_TIME_NAME "time"
#define SPLAT_TIME_DESC "Kernel Time Tests"
-1
View File
@@ -27,7 +27,6 @@
#include "splat-internal.h"
#include <linux/rcupdate.h>
#define SPLAT_SUBSYSTEM_VNODE 0x0900
#define SPLAT_VNODE_NAME "vnode"
#define SPLAT_VNODE_DESC "Kernel Vnode Tests"