Commit d5ff64e7 authored by Arun Gopalakrishnan's avatar Arun Gopalakrishnan Committed by Hari Kanigeri

ARM: OMAP Syslink IPC ioctl module variable name changes

Some  variables that makes a osal feel were renamed
Signed-off-by: default avatarArun M G <arunmg@ti.com>
parent d519b8d4
...@@ -38,16 +38,16 @@ ...@@ -38,16 +38,16 @@
static int gatepeterson_ioctl_get_config(struct gatepeterson_cmd_args *cargs) static int gatepeterson_ioctl_get_config(struct gatepeterson_cmd_args *cargs)
{ {
struct gatepeterson_config config; struct gatepeterson_config config;
s32 osstatus = 0; s32 status = 0;
s32 size; s32 size;
cargs->api_status = gatepeterson_get_config(&config); cargs->api_status = gatepeterson_get_config(&config);
size = copy_to_user(cargs->args.get_config.config, &config, size = copy_to_user(cargs->args.get_config.config, &config,
sizeof(struct gatepeterson_config)); sizeof(struct gatepeterson_config));
if (size) if (size)
osstatus = -EFAULT; status = -EFAULT;
return osstatus; return status;
} }
/* /*
...@@ -58,20 +58,20 @@ static int gatepeterson_ioctl_get_config(struct gatepeterson_cmd_args *cargs) ...@@ -58,20 +58,20 @@ static int gatepeterson_ioctl_get_config(struct gatepeterson_cmd_args *cargs)
static int gatepeterson_ioctl_setup(struct gatepeterson_cmd_args *cargs) static int gatepeterson_ioctl_setup(struct gatepeterson_cmd_args *cargs)
{ {
struct gatepeterson_config config; struct gatepeterson_config config;
s32 osstatus = 0; s32 status = 0;
s32 size; s32 size;
size = copy_from_user(&config, cargs->args.setup.config, size = copy_from_user(&config, cargs->args.setup.config,
sizeof(struct gatepeterson_config)); sizeof(struct gatepeterson_config));
if (size) { if (size) {
osstatus = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
cargs->api_status = gatepeterson_setup(&config); cargs->api_status = gatepeterson_setup(&config);
exit: exit:
return osstatus; return status;
} }
/* /*
...@@ -94,16 +94,16 @@ static int gatepeterson_ioctl_destroy( ...@@ -94,16 +94,16 @@ static int gatepeterson_ioctl_destroy(
static int gatepeterson_ioctl_params_init(struct gatepeterson_cmd_args *cargs) static int gatepeterson_ioctl_params_init(struct gatepeterson_cmd_args *cargs)
{ {
struct gatepeterson_params params; struct gatepeterson_params params;
s32 osstatus = 0; s32 status = 0;
s32 size; s32 size;
cargs->api_status = gatepeterson_params_init(&params); cargs->api_status = gatepeterson_params_init(&params);
size = copy_to_user(cargs->args.params_init.params, &params, size = copy_to_user(cargs->args.params_init.params, &params,
sizeof(struct gatepeterson_params)); sizeof(struct gatepeterson_params));
if (size) if (size)
osstatus = -EFAULT; status = -EFAULT;
return osstatus; return status;
} }
/* /*
...@@ -115,13 +115,13 @@ static int gatepeterson_ioctl_create(struct gatepeterson_cmd_args *cargs) ...@@ -115,13 +115,13 @@ static int gatepeterson_ioctl_create(struct gatepeterson_cmd_args *cargs)
{ {
struct gatepeterson_params params; struct gatepeterson_params params;
void *handle = NULL; void *handle = NULL;
s32 osstatus = 0; s32 status = 0;
s32 size; s32 size;
size = copy_from_user(&params, cargs->args.create.params, size = copy_from_user(&params, cargs->args.create.params,
sizeof(struct gatepeterson_params)); sizeof(struct gatepeterson_params));
if (size) { if (size) {
osstatus = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
...@@ -129,7 +129,7 @@ static int gatepeterson_ioctl_create(struct gatepeterson_cmd_args *cargs) ...@@ -129,7 +129,7 @@ static int gatepeterson_ioctl_create(struct gatepeterson_cmd_args *cargs)
params.name = kmalloc(cargs->args.create.name_len + 1, params.name = kmalloc(cargs->args.create.name_len + 1,
GFP_KERNEL); GFP_KERNEL);
if (params.name == NULL) { if (params.name == NULL) {
osstatus = -ENOMEM; status = -ENOMEM;
goto exit; goto exit;
} }
...@@ -138,7 +138,7 @@ static int gatepeterson_ioctl_create(struct gatepeterson_cmd_args *cargs) ...@@ -138,7 +138,7 @@ static int gatepeterson_ioctl_create(struct gatepeterson_cmd_args *cargs)
cargs->args.create.params->name, cargs->args.create.params->name,
cargs->args.create.name_len); cargs->args.create.name_len);
if (size) { if (size) {
osstatus = -EFAULT; status = -EFAULT;
goto name_from_usr_error; goto name_from_usr_error;
} }
...@@ -158,7 +158,7 @@ name_from_usr_error: ...@@ -158,7 +158,7 @@ name_from_usr_error:
kfree(params.name); kfree(params.name);
exit: exit:
return osstatus; return status;
} }
/* /*
...@@ -182,13 +182,13 @@ static int gatepeterson_ioctl_open(struct gatepeterson_cmd_args *cargs) ...@@ -182,13 +182,13 @@ static int gatepeterson_ioctl_open(struct gatepeterson_cmd_args *cargs)
{ {
struct gatepeterson_params params; struct gatepeterson_params params;
void *handle = NULL; void *handle = NULL;
s32 osstatus = 0; s32 status = 0;
s32 size; s32 size;
size = copy_from_user(&params, cargs->args.open.params, size = copy_from_user(&params, cargs->args.open.params,
sizeof(struct gatepeterson_params)); sizeof(struct gatepeterson_params));
if (size) { if (size) {
osstatus = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
...@@ -196,7 +196,7 @@ static int gatepeterson_ioctl_open(struct gatepeterson_cmd_args *cargs) ...@@ -196,7 +196,7 @@ static int gatepeterson_ioctl_open(struct gatepeterson_cmd_args *cargs)
params.name = kmalloc(cargs->args.open.name_len + 1, params.name = kmalloc(cargs->args.open.name_len + 1,
GFP_KERNEL); GFP_KERNEL);
if (params.name != NULL) { if (params.name != NULL) {
osstatus = -ENOMEM; status = -ENOMEM;
goto exit; goto exit;
} }
...@@ -205,13 +205,13 @@ static int gatepeterson_ioctl_open(struct gatepeterson_cmd_args *cargs) ...@@ -205,13 +205,13 @@ static int gatepeterson_ioctl_open(struct gatepeterson_cmd_args *cargs)
cargs->args.open.params->name, cargs->args.open.params->name,
cargs->args.open.name_len); cargs->args.open.name_len);
if (size) { if (size) {
osstatus = -EFAULT; status = -EFAULT;
goto name_from_usr_error; goto name_from_usr_error;
} }
} }
params.shared_addr = sharedregion_get_ptr((u32 *)params.shared_addr); params.shared_addr = sharedregion_get_ptr((u32 *)params.shared_addr);
osstatus = gatepeterson_open(&handle, &params); status = gatepeterson_open(&handle, &params);
cargs->args.open.handle = handle; cargs->args.open.handle = handle;
cargs->api_status = 0; cargs->api_status = 0;
...@@ -220,7 +220,7 @@ name_from_usr_error: ...@@ -220,7 +220,7 @@ name_from_usr_error:
kfree(params.name); kfree(params.name);
exit: exit:
return osstatus; return status;
} }
/* /*
...@@ -254,6 +254,7 @@ static int gatepeterson_ioctl_leave(struct gatepeterson_cmd_args *cargs) ...@@ -254,6 +254,7 @@ static int gatepeterson_ioctl_leave(struct gatepeterson_cmd_args *cargs)
{ {
gatepeterson_leave(cargs->args.enter.handle, gatepeterson_leave(cargs->args.enter.handle,
cargs->args.enter.flags); cargs->args.enter.flags);
cargs->api_status = 0;
return 0; return 0;
} }
...@@ -265,14 +266,14 @@ static int gatepeterson_ioctl_leave(struct gatepeterson_cmd_args *cargs) ...@@ -265,14 +266,14 @@ static int gatepeterson_ioctl_leave(struct gatepeterson_cmd_args *cargs)
static int gatepeterson_ioctl_shared_memreq(struct gatepeterson_cmd_args *cargs) static int gatepeterson_ioctl_shared_memreq(struct gatepeterson_cmd_args *cargs)
{ {
struct gatepeterson_params params; struct gatepeterson_params params;
s32 osstatus = 0; s32 status = 0;
s32 size; s32 size;
size = copy_from_user(&params, cargs->args.shared_memreq.params, size = copy_from_user(&params, cargs->args.shared_memreq.params,
sizeof(struct gatepeterson_params)); sizeof(struct gatepeterson_params));
if (size) { if (size) {
osstatus = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
...@@ -281,7 +282,7 @@ static int gatepeterson_ioctl_shared_memreq(struct gatepeterson_cmd_args *cargs) ...@@ -281,7 +282,7 @@ static int gatepeterson_ioctl_shared_memreq(struct gatepeterson_cmd_args *cargs)
cargs->api_status = 0; cargs->api_status = 0;
exit: exit:
return osstatus; return status;
} }
/* /*
...@@ -292,7 +293,7 @@ exit: ...@@ -292,7 +293,7 @@ exit:
int gatepeterson_ioctl(struct inode *inode, struct file *filp, int gatepeterson_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long args) unsigned int cmd, unsigned long args)
{ {
s32 os_status = 0; s32 status = 0;
s32 size = 0; s32 size = 0;
struct gatepeterson_cmd_args __user *uarg = struct gatepeterson_cmd_args __user *uarg =
(struct gatepeterson_cmd_args __user *)args; (struct gatepeterson_cmd_args __user *)args;
...@@ -300,12 +301,12 @@ int gatepeterson_ioctl(struct inode *inode, struct file *filp, ...@@ -300,12 +301,12 @@ int gatepeterson_ioctl(struct inode *inode, struct file *filp,
if (_IOC_DIR(cmd) & _IOC_READ) if (_IOC_DIR(cmd) & _IOC_READ)
os_status = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd)); status = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd));
else if (_IOC_DIR(cmd) & _IOC_WRITE) else if (_IOC_DIR(cmd) & _IOC_WRITE)
os_status = !access_ok(VERIFY_READ, uarg, _IOC_SIZE(cmd)); status = !access_ok(VERIFY_READ, uarg, _IOC_SIZE(cmd));
if (os_status) { if (status) {
os_status = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
...@@ -313,58 +314,58 @@ int gatepeterson_ioctl(struct inode *inode, struct file *filp, ...@@ -313,58 +314,58 @@ int gatepeterson_ioctl(struct inode *inode, struct file *filp,
size = copy_from_user(&cargs, uarg, size = copy_from_user(&cargs, uarg,
sizeof(struct gatepeterson_cmd_args)); sizeof(struct gatepeterson_cmd_args));
if (size) { if (size) {
os_status = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
switch (cmd) { switch (cmd) {
case CMD_GATEPETERSON_GETCONFIG: case CMD_GATEPETERSON_GETCONFIG:
os_status = gatepeterson_ioctl_get_config(&cargs); status = gatepeterson_ioctl_get_config(&cargs);
break; break;
case CMD_GATEPETERSON_SETUP: case CMD_GATEPETERSON_SETUP:
os_status = gatepeterson_ioctl_setup(&cargs); status = gatepeterson_ioctl_setup(&cargs);
break; break;
case CMD_GATEPETERSON_DESTROY: case CMD_GATEPETERSON_DESTROY:
os_status = gatepeterson_ioctl_destroy(&cargs); status = gatepeterson_ioctl_destroy(&cargs);
break; break;
case CMD_GATEPETERSON_PARAMS_INIT: case CMD_GATEPETERSON_PARAMS_INIT:
os_status = gatepeterson_ioctl_params_init(&cargs); status = gatepeterson_ioctl_params_init(&cargs);
break; break;
case CMD_GATEPETERSON_CREATE: case CMD_GATEPETERSON_CREATE:
os_status = gatepeterson_ioctl_create(&cargs); status = gatepeterson_ioctl_create(&cargs);
break; break;
case CMD_GATEPETERSON_DELETE: case CMD_GATEPETERSON_DELETE:
os_status = gatepeterson_ioctl_delete(&cargs); status = gatepeterson_ioctl_delete(&cargs);
break; break;
case CMD_GATEPETERSON_OPEN: case CMD_GATEPETERSON_OPEN:
os_status = gatepeterson_ioctl_open(&cargs); status = gatepeterson_ioctl_open(&cargs);
break; break;
case CMD_GATEPETERSON_CLOSE: case CMD_GATEPETERSON_CLOSE:
os_status = gatepeterson_ioctl_close(&cargs); status = gatepeterson_ioctl_close(&cargs);
break; break;
case CMD_GATEPETERSON_ENTER: case CMD_GATEPETERSON_ENTER:
os_status = gatepeterson_ioctl_enter(&cargs); status = gatepeterson_ioctl_enter(&cargs);
break; break;
case CMD_GATEPETERSON_LEAVE: case CMD_GATEPETERSON_LEAVE:
os_status = gatepeterson_ioctl_leave(&cargs); status = gatepeterson_ioctl_leave(&cargs);
break; break;
case CMD_GATEPETERSON_SHAREDMEMREQ: case CMD_GATEPETERSON_SHAREDMEMREQ:
os_status = gatepeterson_ioctl_shared_memreq(&cargs); status = gatepeterson_ioctl_shared_memreq(&cargs);
break; break;
default: default:
WARN_ON(cmd); WARN_ON(cmd);
os_status = -ENOTTY; status = -ENOTTY;
break; break;
} }
...@@ -372,11 +373,11 @@ int gatepeterson_ioctl(struct inode *inode, struct file *filp, ...@@ -372,11 +373,11 @@ int gatepeterson_ioctl(struct inode *inode, struct file *filp,
size = copy_to_user(uarg, &cargs, size = copy_to_user(uarg, &cargs,
sizeof(struct gatepeterson_cmd_args)); sizeof(struct gatepeterson_cmd_args));
if (size) { if (size) {
os_status = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
exit: exit:
return os_status; return status;
} }
...@@ -37,7 +37,7 @@ static int heapbuf_ioctl_alloc(struct heapbuf_cmd_args *cargs) ...@@ -37,7 +37,7 @@ static int heapbuf_ioctl_alloc(struct heapbuf_cmd_args *cargs)
u32 *block_srptr = SHAREDREGION_INVALIDSRPTR; u32 *block_srptr = SHAREDREGION_INVALIDSRPTR;
void *block; void *block;
s32 index; s32 index;
s32 osstatus = 0; s32 status = 0;
block = heapbuf_alloc(cargs->args.alloc.handle, block = heapbuf_alloc(cargs->args.alloc.handle,
cargs->args.alloc.size, cargs->args.alloc.size,
...@@ -53,7 +53,7 @@ static int heapbuf_ioctl_alloc(struct heapbuf_cmd_args *cargs) ...@@ -53,7 +53,7 @@ static int heapbuf_ioctl_alloc(struct heapbuf_cmd_args *cargs)
*/ */
cargs->args.alloc.block_srptr = block_srptr; cargs->args.alloc.block_srptr = block_srptr;
cargs->api_status = 0; cargs->api_status = 0;
return osstatus; return status;
} }
/* /*
...@@ -79,16 +79,16 @@ static int heapbuf_ioctl_free(struct heapbuf_cmd_args *cargs) ...@@ -79,16 +79,16 @@ static int heapbuf_ioctl_free(struct heapbuf_cmd_args *cargs)
static int heapbuf_ioctl_params_init(struct heapbuf_cmd_args *cargs) static int heapbuf_ioctl_params_init(struct heapbuf_cmd_args *cargs)
{ {
struct heapbuf_params params; struct heapbuf_params params;
s32 osstatus = 0; s32 status = 0;
u32 size; u32 size;
heapbuf_params_init(cargs->args.params_init.handle, &params); heapbuf_params_init(cargs->args.params_init.handle, &params);
size = copy_to_user(cargs->args.params_init.params, &params, size = copy_to_user(cargs->args.params_init.params, &params,
sizeof(struct heapbuf_params)); sizeof(struct heapbuf_params));
if (size) if (size)
osstatus = -EFAULT; status = -EFAULT;
return osstatus; return status;
} }
/* /*
...@@ -99,14 +99,14 @@ static int heapbuf_ioctl_params_init(struct heapbuf_cmd_args *cargs) ...@@ -99,14 +99,14 @@ static int heapbuf_ioctl_params_init(struct heapbuf_cmd_args *cargs)
static int heapbuf_ioctl_create(struct heapbuf_cmd_args *cargs) static int heapbuf_ioctl_create(struct heapbuf_cmd_args *cargs)
{ {
struct heapbuf_params params; struct heapbuf_params params;
s32 osstatus = 0; s32 status = 0;
u32 size; u32 size;
void *handle = NULL; void *handle = NULL;
size = copy_from_user(&params, cargs->args.create.params, size = copy_from_user(&params, cargs->args.create.params,
sizeof(struct heapbuf_params)); sizeof(struct heapbuf_params));
if (size) { if (size) {
osstatus = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
...@@ -114,7 +114,7 @@ static int heapbuf_ioctl_create(struct heapbuf_cmd_args *cargs) ...@@ -114,7 +114,7 @@ static int heapbuf_ioctl_create(struct heapbuf_cmd_args *cargs)
params.name = kmalloc(cargs->args.create.name_len + 1, params.name = kmalloc(cargs->args.create.name_len + 1,
GFP_KERNEL); GFP_KERNEL);
if (params.name == NULL) { if (params.name == NULL) {
osstatus = -ENOMEM; status = -ENOMEM;
goto exit; goto exit;
} }
...@@ -123,7 +123,7 @@ static int heapbuf_ioctl_create(struct heapbuf_cmd_args *cargs) ...@@ -123,7 +123,7 @@ static int heapbuf_ioctl_create(struct heapbuf_cmd_args *cargs)
cargs->args.create.params->name, cargs->args.create.params->name,
cargs->args.create.name_len); cargs->args.create.name_len);
if (size) { if (size) {
osstatus = -EFAULT; status = -EFAULT;
goto name_from_usr_error; goto name_from_usr_error;
} }
} }
...@@ -139,7 +139,7 @@ name_from_usr_error: ...@@ -139,7 +139,7 @@ name_from_usr_error:
kfree(params.name); kfree(params.name);
exit: exit:
return osstatus; return status;
} }
...@@ -163,13 +163,13 @@ static int heapbuf_ioctl_open(struct heapbuf_cmd_args *cargs) ...@@ -163,13 +163,13 @@ static int heapbuf_ioctl_open(struct heapbuf_cmd_args *cargs)
{ {
struct heapbuf_params params; struct heapbuf_params params;
void *handle = NULL; void *handle = NULL;
s32 osstatus = 0; s32 status = 0;
ulong size; ulong size;
size = copy_from_user(&params, cargs->args.open.params, size = copy_from_user(&params, cargs->args.open.params,
sizeof(struct heapbuf_params)); sizeof(struct heapbuf_params));
if (size) { if (size) {
osstatus = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
...@@ -177,7 +177,7 @@ static int heapbuf_ioctl_open(struct heapbuf_cmd_args *cargs) ...@@ -177,7 +177,7 @@ static int heapbuf_ioctl_open(struct heapbuf_cmd_args *cargs)
params.name = kmalloc(cargs->args.open.name_len + 1, params.name = kmalloc(cargs->args.open.name_len + 1,
GFP_KERNEL); GFP_KERNEL);
if (params.name == NULL) { if (params.name == NULL) {
osstatus = -ENOMEM; status = -ENOMEM;
goto exit; goto exit;
} }
...@@ -186,7 +186,7 @@ static int heapbuf_ioctl_open(struct heapbuf_cmd_args *cargs) ...@@ -186,7 +186,7 @@ static int heapbuf_ioctl_open(struct heapbuf_cmd_args *cargs)
cargs->args.open.params->name, cargs->args.open.params->name,
cargs->args.open.name_len); cargs->args.open.name_len);
if (size) { if (size) {
osstatus = -EFAULT; status = -EFAULT;
goto free_name; goto free_name;
} }
} }
...@@ -201,7 +201,7 @@ static int heapbuf_ioctl_open(struct heapbuf_cmd_args *cargs) ...@@ -201,7 +201,7 @@ static int heapbuf_ioctl_open(struct heapbuf_cmd_args *cargs)
size = copy_to_user(cargs->args.open.params, &params, size = copy_to_user(cargs->args.open.params, &params,
sizeof(struct heapbuf_params)); sizeof(struct heapbuf_params));
if (size) { if (size) {
osstatus = -EFAULT; status = -EFAULT;
goto copy_to_usr_error; goto copy_to_usr_error;
} }
...@@ -218,7 +218,7 @@ free_name: ...@@ -218,7 +218,7 @@ free_name:
kfree(params.name); kfree(params.name);
exit: exit:
return osstatus; return status;
} }
...@@ -241,14 +241,14 @@ static int heapbuf_ioctl_close(struct heapbuf_cmd_args *cargs) ...@@ -241,14 +241,14 @@ static int heapbuf_ioctl_close(struct heapbuf_cmd_args *cargs)
static int heapbuf_ioctl_shared_memreq(struct heapbuf_cmd_args *cargs) static int heapbuf_ioctl_shared_memreq(struct heapbuf_cmd_args *cargs)
{ {
struct heapbuf_params params; struct heapbuf_params params;
s32 osstatus = 0; s32 status = 0;
ulong size; ulong size;
u32 bytes; u32 bytes;
size = copy_from_user(&params, cargs->args.shared_memreq.params, size = copy_from_user(&params, cargs->args.shared_memreq.params,
sizeof(struct heapbuf_params)); sizeof(struct heapbuf_params));
if (size) { if (size) {
osstatus = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
...@@ -257,7 +257,7 @@ static int heapbuf_ioctl_shared_memreq(struct heapbuf_cmd_args *cargs) ...@@ -257,7 +257,7 @@ static int heapbuf_ioctl_shared_memreq(struct heapbuf_cmd_args *cargs)
cargs->api_status = 0; cargs->api_status = 0;
exit: exit:
return osstatus; return status;
} }
...@@ -269,16 +269,16 @@ exit: ...@@ -269,16 +269,16 @@ exit:
static int heapbuf_ioctl_get_config(struct heapbuf_cmd_args *cargs) static int heapbuf_ioctl_get_config(struct heapbuf_cmd_args *cargs)
{ {
struct heap_config config; struct heap_config config;
s32 osstatus = 0; s32 status = 0;
ulong size; ulong size;
cargs->api_status = heapbuf_get_config(&config); cargs->api_status = heapbuf_get_config(&config);
size = copy_to_user(cargs->args.get_config.config, &config, size = copy_to_user(cargs->args.get_config.config, &config,
sizeof(struct heap_config)); sizeof(struct heap_config));
if (size) if (size)
osstatus = -EFAULT; status = -EFAULT;
return osstatus; return status;
} }
/* /*
...@@ -289,20 +289,20 @@ static int heapbuf_ioctl_get_config(struct heapbuf_cmd_args *cargs) ...@@ -289,20 +289,20 @@ static int heapbuf_ioctl_get_config(struct heapbuf_cmd_args *cargs)
static int heapbuf_ioctl_setup(struct heapbuf_cmd_args *cargs) static int heapbuf_ioctl_setup(struct heapbuf_cmd_args *cargs)
{ {
struct heap_config config; struct heap_config config;
s32 osstatus = 0; s32 status = 0;
ulong size; ulong size;
size = copy_from_user(&config, cargs->args.setup.config, size = copy_from_user(&config, cargs->args.setup.config,
sizeof(struct heap_config)); sizeof(struct heap_config));
if (size) { if (size) {
osstatus = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
cargs->api_status = heapbuf_setup(&config); cargs->api_status = heapbuf_setup(&config);
exit: exit:
return osstatus; return status;
} }
/* /*
* ======== heapbuf_ioctl_destroy ======== * ======== heapbuf_ioctl_destroy ========
...@@ -324,21 +324,21 @@ static int heapbuf_ioctl_destroy(struct heapbuf_cmd_args *cargs) ...@@ -324,21 +324,21 @@ static int heapbuf_ioctl_destroy(struct heapbuf_cmd_args *cargs)
static int heapbuf_ioctl_get_stats(struct heapbuf_cmd_args *cargs) static int heapbuf_ioctl_get_stats(struct heapbuf_cmd_args *cargs)
{ {
struct memory_stats stats; struct memory_stats stats;
s32 osstatus = 0; s32 status = 0;
ulong size; ulong size;
cargs->api_status = heapbuf_get_stats(cargs->args.get_stats.handle, cargs->api_status = heapbuf_get_stats(cargs->args.get_stats.handle,
&stats); &stats);
if (osstatus) if (status)
goto exit; goto exit;
size = copy_to_user(cargs->args.get_stats.stats, &stats, size = copy_to_user(cargs->args.get_stats.stats, &stats,
sizeof(struct memory_stats)); sizeof(struct memory_stats));
if (size) if (size)
osstatus = -EFAULT; status = -EFAULT;
exit: exit:
return osstatus; return status;
} }
/* /*
...@@ -349,7 +349,7 @@ exit: ...@@ -349,7 +349,7 @@ exit:
static int heapbuf_ioctl_get_extended_stats(struct heapbuf_cmd_args *cargs) static int heapbuf_ioctl_get_extended_stats(struct heapbuf_cmd_args *cargs)
{ {
struct heap_extended_stats stats; struct heap_extended_stats stats;
s32 osstatus = 0; s32 status = 0;
ulong size; ulong size;
cargs->api_status = heapbuf_get_extended_stats( cargs->api_status = heapbuf_get_extended_stats(
...@@ -360,10 +360,10 @@ static int heapbuf_ioctl_get_extended_stats(struct heapbuf_cmd_args *cargs) ...@@ -360,10 +360,10 @@ static int heapbuf_ioctl_get_extended_stats(struct heapbuf_cmd_args *cargs)
size = copy_to_user(cargs->args.get_extended_stats.stats, &stats, size = copy_to_user(cargs->args.get_extended_stats.stats, &stats,
sizeof(struct heap_extended_stats)); sizeof(struct heap_extended_stats));
if (size) if (size)
osstatus = -EFAULT; status = -EFAULT;
exit: exit:
return osstatus; return status;
} }
/* /*
...@@ -374,19 +374,19 @@ exit: ...@@ -374,19 +374,19 @@ exit:
int heapbuf_ioctl(struct inode *pinode, struct file *filp, int heapbuf_ioctl(struct inode *pinode, struct file *filp,
unsigned int cmd, unsigned long args) unsigned int cmd, unsigned long args)
{ {
s32 os_status = 0; s32 status = 0;
s32 size = 0; s32 size = 0;
struct heapbuf_cmd_args __user *uarg = struct heapbuf_cmd_args __user *uarg =
(struct heapbuf_cmd_args __user *)args; (struct heapbuf_cmd_args __user *)args;
struct heapbuf_cmd_args cargs; struct heapbuf_cmd_args cargs;
if (_IOC_DIR(cmd) & _IOC_READ) if (_IOC_DIR(cmd) & _IOC_READ)
os_status = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd)); status = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd));
else if (_IOC_DIR(cmd) & _IOC_WRITE) else if (_IOC_DIR(cmd) & _IOC_WRITE)
os_status = !access_ok(VERIFY_READ, uarg, _IOC_SIZE(cmd)); status = !access_ok(VERIFY_READ, uarg, _IOC_SIZE(cmd));
if (os_status) { if (status) {
os_status = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
...@@ -394,66 +394,66 @@ int heapbuf_ioctl(struct inode *pinode, struct file *filp, ...@@ -394,66 +394,66 @@ int heapbuf_ioctl(struct inode *pinode, struct file *filp,
size = copy_from_user(&cargs, uarg, size = copy_from_user(&cargs, uarg,
sizeof(struct heapbuf_cmd_args)); sizeof(struct heapbuf_cmd_args));
if (size) { if (size) {
os_status = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
switch (cmd) { switch (cmd) {
case CMD_HEAPBUF_ALLOC: case CMD_HEAPBUF_ALLOC:
os_status = heapbuf_ioctl_alloc(&cargs); status = heapbuf_ioctl_alloc(&cargs);
break; break;
case CMD_HEAPBUF_FREE: case CMD_HEAPBUF_FREE:
os_status = heapbuf_ioctl_free(&cargs); status = heapbuf_ioctl_free(&cargs);
break; break;
case CMD_HEAPBUF_PARAMS_INIT: case CMD_HEAPBUF_PARAMS_INIT:
os_status = heapbuf_ioctl_params_init(&cargs); status = heapbuf_ioctl_params_init(&cargs);
break; break;
case CMD_HEAPBUF_CREATE: case CMD_HEAPBUF_CREATE:
os_status = heapbuf_ioctl_create(&cargs); status = heapbuf_ioctl_create(&cargs);
break; break;
case CMD_HEAPBUF_DELETE: case CMD_HEAPBUF_DELETE:
os_status = heapbuf_ioctl_delete(&cargs); status = heapbuf_ioctl_delete(&cargs);
break; break;
case CMD_HEAPBUF_OPEN: case CMD_HEAPBUF_OPEN:
os_status = heapbuf_ioctl_open(&cargs); status = heapbuf_ioctl_open(&cargs);
break; break;
case CMD_HEAPBUF_CLOSE: case CMD_HEAPBUF_CLOSE:
os_status = heapbuf_ioctl_close(&cargs); status = heapbuf_ioctl_close(&cargs);
break; break;
case CMD_HEAPBUF_SHAREDMEMREQ: case CMD_HEAPBUF_SHAREDMEMREQ:
os_status = heapbuf_ioctl_shared_memreq(&cargs); status = heapbuf_ioctl_shared_memreq(&cargs);
break; break;
case CMD_HEAPBUF_GETCONFIG: case CMD_HEAPBUF_GETCONFIG:
os_status = heapbuf_ioctl_get_config(&cargs); status = heapbuf_ioctl_get_config(&cargs);
break; break;
case CMD_HEAPBUF_SETUP: case CMD_HEAPBUF_SETUP:
os_status = heapbuf_ioctl_setup(&cargs); status = heapbuf_ioctl_setup(&cargs);
break; break;
case CMD_HEAPBUF_DESTROY: case CMD_HEAPBUF_DESTROY:
os_status = heapbuf_ioctl_destroy(&cargs); status = heapbuf_ioctl_destroy(&cargs);
break; break;
case CMD_HEAPBUF_GETSTATS: case CMD_HEAPBUF_GETSTATS:
os_status = heapbuf_ioctl_get_stats(&cargs); status = heapbuf_ioctl_get_stats(&cargs);
break; break;
case CMD_HEAPBUF_GETEXTENDEDSTATS: case CMD_HEAPBUF_GETEXTENDEDSTATS:
os_status = heapbuf_ioctl_get_extended_stats(&cargs); status = heapbuf_ioctl_get_extended_stats(&cargs);
break; break;
default: default:
WARN_ON(cmd); WARN_ON(cmd);
os_status = -ENOTTY; status = -ENOTTY;
break; break;
} }
...@@ -461,12 +461,12 @@ int heapbuf_ioctl(struct inode *pinode, struct file *filp, ...@@ -461,12 +461,12 @@ int heapbuf_ioctl(struct inode *pinode, struct file *filp,
size = copy_to_user(uarg, &cargs, size = copy_to_user(uarg, &cargs,
sizeof(struct heapbuf_cmd_args)); sizeof(struct heapbuf_cmd_args));
if (size) { if (size) {
os_status = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
exit: exit:
return os_status; return status;
} }
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
static int nameserver_remotenotify_ioctl_get( static int nameserver_remotenotify_ioctl_get(
struct nameserver_remotenotify_cmd_args *cargs) struct nameserver_remotenotify_cmd_args *cargs)
{ {
s32 osstatus = 0; s32 status = 0;
ulong size; ulong size;
char *instance_name = NULL; char *instance_name = NULL;
char *name = NULL; char *name = NULL;
...@@ -46,7 +46,7 @@ static int nameserver_remotenotify_ioctl_get( ...@@ -46,7 +46,7 @@ static int nameserver_remotenotify_ioctl_get(
instance_name = kmalloc(cargs->args.get.instance_name_len + 1, instance_name = kmalloc(cargs->args.get.instance_name_len + 1,
GFP_KERNEL); GFP_KERNEL);
if (instance_name == NULL) { if (instance_name == NULL) {
osstatus = ENOMEM; status = ENOMEM;
goto exit; goto exit;
} }
...@@ -55,7 +55,7 @@ static int nameserver_remotenotify_ioctl_get( ...@@ -55,7 +55,7 @@ static int nameserver_remotenotify_ioctl_get(
cargs->args.get.instance_name, cargs->args.get.instance_name,
cargs->args.get.instance_name_len); cargs->args.get.instance_name_len);
if (size) { if (size) {
osstatus = -ENOMEM; status = -ENOMEM;
goto exit; goto exit;
} }
} }
...@@ -64,7 +64,7 @@ static int nameserver_remotenotify_ioctl_get( ...@@ -64,7 +64,7 @@ static int nameserver_remotenotify_ioctl_get(
name = kmalloc(cargs->args.get.name_len + 1, name = kmalloc(cargs->args.get.name_len + 1,
GFP_KERNEL); GFP_KERNEL);
if (name == NULL) { if (name == NULL) {
osstatus = ENOMEM; status = ENOMEM;
goto exit; goto exit;
} }
...@@ -72,7 +72,7 @@ static int nameserver_remotenotify_ioctl_get( ...@@ -72,7 +72,7 @@ static int nameserver_remotenotify_ioctl_get(
size = copy_from_user(name, cargs->args.get.name, size = copy_from_user(name, cargs->args.get.name,
cargs->args.get.name_len); cargs->args.get.name_len);
if (size) { if (size) {
osstatus = -ENOMEM; status = -ENOMEM;
goto exit; goto exit;
} }
} }
...@@ -83,7 +83,7 @@ static int nameserver_remotenotify_ioctl_get( ...@@ -83,7 +83,7 @@ static int nameserver_remotenotify_ioctl_get(
size = copy_from_user(value, cargs->args.get.value, size = copy_from_user(value, cargs->args.get.value,
cargs->args.get.value_len); cargs->args.get.value_len);
if (size) { if (size) {
osstatus = -ENOMEM; status = -ENOMEM;
goto exit; goto exit;
} }
} }
...@@ -101,7 +101,7 @@ exit: ...@@ -101,7 +101,7 @@ exit:
kfree(value); kfree(value);
kfree(name); kfree(name);
kfree(instance_name); kfree(instance_name);
return osstatus; return status;
} }
/* /*
...@@ -113,7 +113,7 @@ static int nameserver_remotenotify_ioctl_shared_memreq( ...@@ -113,7 +113,7 @@ static int nameserver_remotenotify_ioctl_shared_memreq(
struct nameserver_remotenotify_cmd_args *cargs) struct nameserver_remotenotify_cmd_args *cargs)
{ {
struct nameserver_remotenotify_params params; struct nameserver_remotenotify_params params;
s32 osstatus = 0; s32 status = 0;
ulong size; ulong size;
/* params may be NULL. */ /* params may be NULL. */
...@@ -122,7 +122,7 @@ static int nameserver_remotenotify_ioctl_shared_memreq( ...@@ -122,7 +122,7 @@ static int nameserver_remotenotify_ioctl_shared_memreq(
cargs->args.shared_memreq.params, cargs->args.shared_memreq.params,
sizeof(struct nameserver_remotenotify_params)); sizeof(struct nameserver_remotenotify_params));
if (size) { if (size) {
osstatus = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
} }
...@@ -132,7 +132,7 @@ static int nameserver_remotenotify_ioctl_shared_memreq( ...@@ -132,7 +132,7 @@ static int nameserver_remotenotify_ioctl_shared_memreq(
cargs->api_status = 0; cargs->api_status = 0;
exit: exit:
return osstatus; return status;
} }
/* /*
...@@ -144,7 +144,7 @@ static int nameserver_remotenotify_ioctl_params_init( ...@@ -144,7 +144,7 @@ static int nameserver_remotenotify_ioctl_params_init(
struct nameserver_remotenotify_cmd_args *cargs) struct nameserver_remotenotify_cmd_args *cargs)
{ {
struct nameserver_remotenotify_params params; struct nameserver_remotenotify_params params;
s32 osstatus = 0; s32 status = 0;
ulong size; ulong size;
nameserver_remotenotify_params_init(cargs->args.params_init.handle, nameserver_remotenotify_params_init(cargs->args.params_init.handle,
...@@ -152,10 +152,10 @@ static int nameserver_remotenotify_ioctl_params_init( ...@@ -152,10 +152,10 @@ static int nameserver_remotenotify_ioctl_params_init(
size = copy_to_user(cargs->args.params_init.params, &params, size = copy_to_user(cargs->args.params_init.params, &params,
sizeof(struct nameserver_remotenotify_params)); sizeof(struct nameserver_remotenotify_params));
if (size) if (size)
osstatus = -EFAULT; status = -EFAULT;
cargs->api_status = 0; cargs->api_status = 0;
return osstatus; return status;
} }
/* /*
...@@ -167,12 +167,12 @@ static int nameserver_remotenotify_ioctl_create( ...@@ -167,12 +167,12 @@ static int nameserver_remotenotify_ioctl_create(
struct nameserver_remotenotify_cmd_args *cargs) struct nameserver_remotenotify_cmd_args *cargs)
{ {
struct nameserver_remotenotify_params params; struct nameserver_remotenotify_params params;
s32 osstatus = 0; s32 status = 0;
ulong size; ulong size;
size = copy_from_user(&params, cargs->args.create.params, size = copy_from_user(&params, cargs->args.create.params,
sizeof(struct nameserver_remotenotify_params)); sizeof(struct nameserver_remotenotify_params));
if (size) { if (size) {
osstatus = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
...@@ -183,7 +183,7 @@ static int nameserver_remotenotify_ioctl_create( ...@@ -183,7 +183,7 @@ static int nameserver_remotenotify_ioctl_create(
&params); &params);
cargs->api_status = 0; cargs->api_status = 0;
exit: exit:
return osstatus; return status;
} }
/* /*
...@@ -207,7 +207,7 @@ static int nameserver_remotenotify_ioctl_delete( ...@@ -207,7 +207,7 @@ static int nameserver_remotenotify_ioctl_delete(
static int nameserver_remotenotify_ioctl_get_config( static int nameserver_remotenotify_ioctl_get_config(
struct nameserver_remotenotify_cmd_args *cargs) struct nameserver_remotenotify_cmd_args *cargs)
{ {
s32 osstatus = 0; s32 status = 0;
ulong size; ulong size;
struct nameserver_remotenotify_config config; struct nameserver_remotenotify_config config;
...@@ -215,10 +215,10 @@ static int nameserver_remotenotify_ioctl_get_config( ...@@ -215,10 +215,10 @@ static int nameserver_remotenotify_ioctl_get_config(
size = copy_to_user(cargs->args.get_config.config, &config, size = copy_to_user(cargs->args.get_config.config, &config,
sizeof(struct nameserver_remotenotify_config)); sizeof(struct nameserver_remotenotify_config));
if (size) if (size)
osstatus = -EFAULT; status = -EFAULT;
cargs->api_status = 0; cargs->api_status = 0;
return osstatus; return status;
} }
/* /*
...@@ -230,19 +230,19 @@ static int nameserver_remotenotify_ioctl_setup( ...@@ -230,19 +230,19 @@ static int nameserver_remotenotify_ioctl_setup(
struct nameserver_remotenotify_cmd_args *cargs) struct nameserver_remotenotify_cmd_args *cargs)
{ {
struct nameserver_remotenotify_config config; struct nameserver_remotenotify_config config;
s32 osstatus = 0; s32 status = 0;
ulong size; ulong size;
size = copy_from_user(&config, cargs->args.setup.config, size = copy_from_user(&config, cargs->args.setup.config,
sizeof(struct nameserver_remotenotify_config)); sizeof(struct nameserver_remotenotify_config));
if (size) { if (size) {
osstatus = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
cargs->api_status = nameserver_remotenotify_setup(&config); cargs->api_status = nameserver_remotenotify_setup(&config);
exit: exit:
return osstatus; return status;
} }
...@@ -266,19 +266,19 @@ static int nameserver_remotenotify_ioctl_destroy( ...@@ -266,19 +266,19 @@ static int nameserver_remotenotify_ioctl_destroy(
int nameserver_remotenotify_ioctl(struct inode *inode, struct file *filp, int nameserver_remotenotify_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long args) unsigned int cmd, unsigned long args)
{ {
s32 os_status = 0; s32 status = 0;
s32 size = 0; s32 size = 0;
struct nameserver_remotenotify_cmd_args __user *uarg = struct nameserver_remotenotify_cmd_args __user *uarg =
(struct nameserver_remotenotify_cmd_args __user *)args; (struct nameserver_remotenotify_cmd_args __user *)args;
struct nameserver_remotenotify_cmd_args cargs; struct nameserver_remotenotify_cmd_args cargs;
if (_IOC_DIR(cmd) & _IOC_READ) if (_IOC_DIR(cmd) & _IOC_READ)
os_status = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd)); status = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd));
else if (_IOC_DIR(cmd) & _IOC_WRITE) else if (_IOC_DIR(cmd) & _IOC_WRITE)
os_status = !access_ok(VERIFY_READ, uarg, _IOC_SIZE(cmd)); status = !access_ok(VERIFY_READ, uarg, _IOC_SIZE(cmd));
if (os_status) { if (status) {
os_status = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
...@@ -286,46 +286,46 @@ int nameserver_remotenotify_ioctl(struct inode *inode, struct file *filp, ...@@ -286,46 +286,46 @@ int nameserver_remotenotify_ioctl(struct inode *inode, struct file *filp,
size = copy_from_user(&cargs, uarg, size = copy_from_user(&cargs, uarg,
sizeof(struct nameserver_remotenotify_cmd_args)); sizeof(struct nameserver_remotenotify_cmd_args));
if (size) { if (size) {
os_status = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
switch (cmd) { switch (cmd) {
case CMD_NAMESERVERREMOTENOTIFY_GET: case CMD_NAMESERVERREMOTENOTIFY_GET:
os_status = nameserver_remotenotify_ioctl_get(&cargs); status = nameserver_remotenotify_ioctl_get(&cargs);
break; break;
case CMD_NAMESERVERREMOTENOTIFY_SHAREDMEMREQ: case CMD_NAMESERVERREMOTENOTIFY_SHAREDMEMREQ:
os_status = nameserver_remotenotify_ioctl_shared_memreq(&cargs); status = nameserver_remotenotify_ioctl_shared_memreq(&cargs);
break; break;
case CMD_NAMESERVERREMOTENOTIFY_PARAMS_INIT: case CMD_NAMESERVERREMOTENOTIFY_PARAMS_INIT:
os_status = nameserver_remotenotify_ioctl_params_init(&cargs); status = nameserver_remotenotify_ioctl_params_init(&cargs);
break; break;
case CMD_NAMESERVERREMOTENOTIFY_CREATE: case CMD_NAMESERVERREMOTENOTIFY_CREATE:
os_status = nameserver_remotenotify_ioctl_create(&cargs); status = nameserver_remotenotify_ioctl_create(&cargs);
break; break;
case CMD_NAMESERVERREMOTENOTIFY_DELETE: case CMD_NAMESERVERREMOTENOTIFY_DELETE:
os_status = nameserver_remotenotify_ioctl_delete(&cargs); status = nameserver_remotenotify_ioctl_delete(&cargs);
break; break;
case CMD_NAMESERVERREMOTENOTIFY_GETCONFIG: case CMD_NAMESERVERREMOTENOTIFY_GETCONFIG:
os_status = nameserver_remotenotify_ioctl_get_config(&cargs); status = nameserver_remotenotify_ioctl_get_config(&cargs);
break; break;
case CMD_NAMESERVERREMOTENOTIFY_SETUP: case CMD_NAMESERVERREMOTENOTIFY_SETUP:
os_status = nameserver_remotenotify_ioctl_setup(&cargs); status = nameserver_remotenotify_ioctl_setup(&cargs);
break; break;
case CMD_NAMESERVERREMOTENOTIFY_DESTROY: case CMD_NAMESERVERREMOTENOTIFY_DESTROY:
os_status = nameserver_remotenotify_ioctl_destroy(&cargs); status = nameserver_remotenotify_ioctl_destroy(&cargs);
break; break;
default: default:
WARN_ON(cmd); WARN_ON(cmd);
os_status = -ENOTTY; status = -ENOTTY;
break; break;
} }
...@@ -333,13 +333,13 @@ int nameserver_remotenotify_ioctl(struct inode *inode, struct file *filp, ...@@ -333,13 +333,13 @@ int nameserver_remotenotify_ioctl(struct inode *inode, struct file *filp,
size = copy_to_user(uarg, &cargs, size = copy_to_user(uarg, &cargs,
sizeof(struct nameserver_remotenotify_cmd_args)); sizeof(struct nameserver_remotenotify_cmd_args));
if (size) { if (size) {
os_status = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
printk(KERN_ERR "\n"); printk(KERN_ERR "\n");
exit: exit:
return os_status; return status;
} }
...@@ -41,16 +41,16 @@ static int sharedregion_ioctl_get_config(struct sharedregion_cmd_args *cargs) ...@@ -41,16 +41,16 @@ static int sharedregion_ioctl_get_config(struct sharedregion_cmd_args *cargs)
{ {
struct sharedregion_config config; struct sharedregion_config config;
s32 osstatus = 0; s32 status = 0;
s32 size; s32 size;
cargs->api_status = sharedregion_get_config(&config); cargs->api_status = sharedregion_get_config(&config);
size = copy_to_user(cargs->args.get_config.config, &config, size = copy_to_user(cargs->args.get_config.config, &config,
sizeof(struct sharedregion_config)); sizeof(struct sharedregion_config));
if (size) if (size)
osstatus = -EFAULT; status = -EFAULT;
return osstatus; return status;
} }
...@@ -62,20 +62,20 @@ static int sharedregion_ioctl_get_config(struct sharedregion_cmd_args *cargs) ...@@ -62,20 +62,20 @@ static int sharedregion_ioctl_get_config(struct sharedregion_cmd_args *cargs)
static int sharedregion_ioctl_setup(struct sharedregion_cmd_args *cargs) static int sharedregion_ioctl_setup(struct sharedregion_cmd_args *cargs)
{ {
struct sharedregion_config config; struct sharedregion_config config;
s32 osstatus = 0; s32 status = 0;
s32 size; s32 size;
size = copy_from_user(&config, cargs->args.setup.config, size = copy_from_user(&config, cargs->args.setup.config,
sizeof(struct sharedregion_config)); sizeof(struct sharedregion_config));
if (size) { if (size) {
osstatus = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
cargs->api_status = sharedregion_setup(&config); cargs->api_status = sharedregion_setup(&config);
exit: exit:
return osstatus; return status;
} }
/* /*
...@@ -166,7 +166,7 @@ static int sharedregion_ioctl_get_table_info( ...@@ -166,7 +166,7 @@ static int sharedregion_ioctl_get_table_info(
struct sharedregion_cmd_args *cargs) struct sharedregion_cmd_args *cargs)
{ {
struct sharedregion_info info; struct sharedregion_info info;
s32 osstatus = 0; s32 status = 0;
s32 size; s32 size;
cargs->api_status = sharedregion_get_table_info( cargs->api_status = sharedregion_get_table_info(
...@@ -175,9 +175,9 @@ static int sharedregion_ioctl_get_table_info( ...@@ -175,9 +175,9 @@ static int sharedregion_ioctl_get_table_info(
size = copy_to_user(cargs->args.get_table_info.info, &info, size = copy_to_user(cargs->args.get_table_info.info, &info,
sizeof(struct sharedregion_info)); sizeof(struct sharedregion_info));
if (size) if (size)
osstatus = -EFAULT; status = -EFAULT;
return osstatus; return status;
} }
...@@ -201,13 +201,13 @@ static int sharedregion_ioctl_set_table_info( ...@@ -201,13 +201,13 @@ static int sharedregion_ioctl_set_table_info(
struct sharedregion_cmd_args *cargs) struct sharedregion_cmd_args *cargs)
{ {
struct sharedregion_info info; struct sharedregion_info info;
s32 osstatus = 0; s32 status = 0;
s32 size; s32 size;
size = copy_from_user(&info, cargs->args.set_table_info.info, size = copy_from_user(&info, cargs->args.set_table_info.info,
sizeof(struct sharedregion_info)); sizeof(struct sharedregion_info));
if (size) { if (size) {
osstatus = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
...@@ -216,7 +216,7 @@ static int sharedregion_ioctl_set_table_info( ...@@ -216,7 +216,7 @@ static int sharedregion_ioctl_set_table_info(
cargs->args.set_table_info.proc_id, &info); cargs->args.set_table_info.proc_id, &info);
exit: exit:
return osstatus; return status;
} }
/* /*
...@@ -227,19 +227,19 @@ exit: ...@@ -227,19 +227,19 @@ exit:
int sharedregion_ioctl(struct inode *inode, struct file *filp, int sharedregion_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long args) unsigned int cmd, unsigned long args)
{ {
s32 os_status = 0; s32 status = 0;
s32 size = 0; s32 size = 0;
struct sharedregion_cmd_args __user *uarg = struct sharedregion_cmd_args __user *uarg =
(struct sharedregion_cmd_args __user *)args; (struct sharedregion_cmd_args __user *)args;
struct sharedregion_cmd_args cargs; struct sharedregion_cmd_args cargs;
if (_IOC_DIR(cmd) & _IOC_READ) if (_IOC_DIR(cmd) & _IOC_READ)
os_status = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd)); status = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd));
else if (_IOC_DIR(cmd) & _IOC_WRITE) else if (_IOC_DIR(cmd) & _IOC_WRITE)
os_status = !access_ok(VERIFY_READ, uarg, _IOC_SIZE(cmd)); status = !access_ok(VERIFY_READ, uarg, _IOC_SIZE(cmd));
if (os_status) { if (status) {
os_status = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
...@@ -247,54 +247,54 @@ int sharedregion_ioctl(struct inode *inode, struct file *filp, ...@@ -247,54 +247,54 @@ int sharedregion_ioctl(struct inode *inode, struct file *filp,
size = copy_from_user(&cargs, uarg, size = copy_from_user(&cargs, uarg,
sizeof(struct sharedregion_cmd_args)); sizeof(struct sharedregion_cmd_args));
if (size) { if (size) {
os_status = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
switch (cmd) { switch (cmd) {
case CMD_SHAREDREGION_GETCONFIG: case CMD_SHAREDREGION_GETCONFIG:
os_status = sharedregion_ioctl_get_config(&cargs); status = sharedregion_ioctl_get_config(&cargs);
break; break;
case CMD_SHAREDREGION_SETUP: case CMD_SHAREDREGION_SETUP:
os_status = sharedregion_ioctl_setup(&cargs); status = sharedregion_ioctl_setup(&cargs);
break; break;
case CMD_SHAREDREGION_DESTROY: case CMD_SHAREDREGION_DESTROY:
os_status = sharedregion_ioctl_destroy(&cargs); status = sharedregion_ioctl_destroy(&cargs);
break; break;
case CMD_SHAREDREGION_ADD: case CMD_SHAREDREGION_ADD:
os_status = sharedregion_ioctl_add(&cargs); status = sharedregion_ioctl_add(&cargs);
break; break;
case CMD_SHAREDREGION_GETINDEX: case CMD_SHAREDREGION_GETINDEX:
os_status = sharedregion_ioctl_get_index(&cargs); status = sharedregion_ioctl_get_index(&cargs);
break; break;
case CMD_SHAREDREGION_GETPTR: case CMD_SHAREDREGION_GETPTR:
os_status = sharedregion_ioctl_get_ptr(&cargs); status = sharedregion_ioctl_get_ptr(&cargs);
break; break;
case CMD_SHAREDREGION_GETSRPTR: case CMD_SHAREDREGION_GETSRPTR:
os_status = sharedregion_ioctl_get_srptr(&cargs); status = sharedregion_ioctl_get_srptr(&cargs);
break; break;
case CMD_SHAREDREGION_GETTABLEINFO: case CMD_SHAREDREGION_GETTABLEINFO:
os_status = sharedregion_ioctl_get_table_info(&cargs); status = sharedregion_ioctl_get_table_info(&cargs);
break; break;
case CMD_SHAREDREGION_REMOVE: case CMD_SHAREDREGION_REMOVE:
os_status = sharedregion_ioctl_remove(&cargs); status = sharedregion_ioctl_remove(&cargs);
break; break;
case CMD_SHAREDREGION_SETTABLEINFO: case CMD_SHAREDREGION_SETTABLEINFO:
os_status = sharedregion_ioctl_set_table_info(&cargs); status = sharedregion_ioctl_set_table_info(&cargs);
break; break;
default: default:
WARN_ON(cmd); WARN_ON(cmd);
os_status = -ENOTTY; status = -ENOTTY;
break; break;
} }
...@@ -302,11 +302,11 @@ int sharedregion_ioctl(struct inode *inode, struct file *filp, ...@@ -302,11 +302,11 @@ int sharedregion_ioctl(struct inode *inode, struct file *filp,
/* Copy the full args to the user-side. */ /* Copy the full args to the user-side. */
size = copy_to_user(uarg, &cargs, sizeof(struct sharedregion_cmd_args)); size = copy_to_user(uarg, &cargs, sizeof(struct sharedregion_cmd_args));
if (size) { if (size) {
os_status = -EFAULT; status = -EFAULT;
goto exit; goto exit;
} }
exit: exit:
return os_status; return status;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment