Commit 756dc1aa authored by Arun Gopalakrishnan's avatar Arun Gopalakrishnan Committed by Hari Kanigeri

ARM: OMAP Syslink IPC ioctl module fixes

The changes are
1. The ioctl interface of some of the modified based on review
   comment to make it consistest with other ipc modules(e.g messageq)
2. All the ioctl interface functions will return api_status
   to reflect the module specific return and osstatus to
   reflect the os specific return (the original syslink approach)
3. IPC Modules affected are
	sharedregion, gatepeterson, nameserver_remotenotify, heapbuf,
	and nameserver
Signed-off-by: default avatarArun M G <arunmg@ti.com>
parent 685ef3b5
...@@ -38,20 +38,16 @@ ...@@ -38,20 +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 retval = 0; s32 osstatus = 0;
s32 size; s32 size;
retval = gatepeterson_get_config(&config); cargs->api_status = gatepeterson_get_config(&config);
if (unlikely(retval))
goto exit;
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)
retval = -EFAULT; osstatus = -EFAULT;
exit: return osstatus;
return retval;
} }
/* /*
...@@ -62,19 +58,20 @@ exit: ...@@ -62,19 +58,20 @@ exit:
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 retval = 0; s32 osstatus = 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) {
retval = -EFAULT; osstatus = -EFAULT;
goto exit; goto exit;
} }
retval = gatepeterson_setup(&config); cargs->api_status = gatepeterson_setup(&config);
exit: exit:
return retval; return osstatus;
} }
/* /*
...@@ -82,11 +79,11 @@ exit: ...@@ -82,11 +79,11 @@ exit:
* Purpose: * Purpose:
* This ioctl interface to gatepeterson_destroy function * This ioctl interface to gatepeterson_destroy function
*/ */
static int gatepeterson_ioctl_destroy() static int gatepeterson_ioctl_destroy(
struct gatepeterson_cmd_args *cargs)
{ {
s32 retval = 0; cargs->api_status = gatepeterson_destroy();
retval = gatepeterson_destroy(); return 0;
return retval;
} }
/* /*
...@@ -97,16 +94,16 @@ static int gatepeterson_ioctl_destroy() ...@@ -97,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 retval = 0; s32 osstatus = 0;
s32 size; s32 size;
retval = 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)
retval = -EFAULT; osstatus = -EFAULT;
return retval; return osstatus;
} }
/* /*
...@@ -118,13 +115,13 @@ static int gatepeterson_ioctl_create(struct gatepeterson_cmd_args *cargs) ...@@ -118,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 retval = 0; s32 osstatus = 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) {
retval = -EFAULT; osstatus = -EFAULT;
goto exit; goto exit;
} }
...@@ -132,7 +129,7 @@ static int gatepeterson_ioctl_create(struct gatepeterson_cmd_args *cargs) ...@@ -132,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) {
retval = -ENOMEM; osstatus = -ENOMEM;
goto exit; goto exit;
} }
...@@ -141,7 +138,7 @@ static int gatepeterson_ioctl_create(struct gatepeterson_cmd_args *cargs) ...@@ -141,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) {
retval = -EFAULT; osstatus = -EFAULT;
goto name_from_usr_error; goto name_from_usr_error;
} }
...@@ -154,13 +151,14 @@ static int gatepeterson_ioctl_create(struct gatepeterson_cmd_args *cargs) ...@@ -154,13 +151,14 @@ static int gatepeterson_ioctl_create(struct gatepeterson_cmd_args *cargs)
proper return to application proper return to application
*/ */
cargs->args.create.handle = handle; cargs->args.create.handle = handle;
cargs->api_status = 0;
name_from_usr_error: name_from_usr_error:
if (cargs->args.open.name_len > 0) if (cargs->args.open.name_len > 0)
kfree(params.name); kfree(params.name);
exit: exit:
return retval; return osstatus;
} }
/* /*
...@@ -171,10 +169,8 @@ exit: ...@@ -171,10 +169,8 @@ exit:
static int gatepeterson_ioctl_delete(struct gatepeterson_cmd_args *cargs) static int gatepeterson_ioctl_delete(struct gatepeterson_cmd_args *cargs)
{ {
s32 retval = 0; cargs->api_status = gatepeterson_delete(&cargs->args.delete.handle);
return 0;
retval = gatepeterson_delete(&cargs->args.delete.handle);
return retval;
} }
/* /*
...@@ -186,13 +182,13 @@ static int gatepeterson_ioctl_open(struct gatepeterson_cmd_args *cargs) ...@@ -186,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 retval = 0; s32 osstatus = 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) {
retval = -EFAULT; osstatus = -EFAULT;
goto exit; goto exit;
} }
...@@ -200,7 +196,7 @@ static int gatepeterson_ioctl_open(struct gatepeterson_cmd_args *cargs) ...@@ -200,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) {
retval = -ENOMEM; osstatus = -ENOMEM;
goto exit; goto exit;
} }
...@@ -209,21 +205,22 @@ static int gatepeterson_ioctl_open(struct gatepeterson_cmd_args *cargs) ...@@ -209,21 +205,22 @@ 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) {
retval = -EFAULT; osstatus = -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);
retval = gatepeterson_open(&handle, &params); osstatus = gatepeterson_open(&handle, &params);
cargs->args.open.handle = handle; cargs->args.open.handle = handle;
cargs->api_status = 0;
name_from_usr_error: name_from_usr_error:
if (cargs->args.open.name_len > 0) if (cargs->args.open.name_len > 0)
kfree(params.name); kfree(params.name);
exit: exit:
return retval; return osstatus;
} }
/* /*
...@@ -233,10 +230,8 @@ exit: ...@@ -233,10 +230,8 @@ exit:
*/ */
static int gatepeterson_ioctl_close(struct gatepeterson_cmd_args *cargs) static int gatepeterson_ioctl_close(struct gatepeterson_cmd_args *cargs)
{ {
s32 retval = 0; cargs->api_status = gatepeterson_close(&cargs->args.close.handle);
return 0;
retval = gatepeterson_close(&cargs->args.close.handle);
return retval;
} }
/* /*
...@@ -246,10 +241,8 @@ static int gatepeterson_ioctl_close(struct gatepeterson_cmd_args *cargs) ...@@ -246,10 +241,8 @@ static int gatepeterson_ioctl_close(struct gatepeterson_cmd_args *cargs)
*/ */
static int gatepeterson_ioctl_enter(struct gatepeterson_cmd_args *cargs) static int gatepeterson_ioctl_enter(struct gatepeterson_cmd_args *cargs)
{ {
s32 retval = 0; cargs->api_status = gatepeterson_enter(cargs->args.enter.handle);
return 0;
retval = gatepeterson_enter(cargs->args.enter.handle);
return retval;
} }
/* /*
...@@ -272,22 +265,23 @@ static int gatepeterson_ioctl_leave(struct gatepeterson_cmd_args *cargs) ...@@ -272,22 +265,23 @@ 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 retval = 0; s32 osstatus = 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) {
retval = -EFAULT; osstatus = -EFAULT;
goto exit; goto exit;
} }
cargs->args.shared_memreq.bytes = cargs->args.shared_memreq.bytes =
gatepeterson_shared_memreq(cargs->args.shared_memreq.params); gatepeterson_shared_memreq(cargs->args.shared_memreq.params);
cargs->api_status = 0;
exit: exit:
return retval; return osstatus;
} }
/* /*
...@@ -333,7 +327,7 @@ int gatepeterson_ioctl(struct inode *inode, struct file *filp, ...@@ -333,7 +327,7 @@ int gatepeterson_ioctl(struct inode *inode, struct file *filp,
break; break;
case CMD_GATEPETERSON_DESTROY: case CMD_GATEPETERSON_DESTROY:
os_status = gatepeterson_ioctl_destroy(); os_status = gatepeterson_ioctl_destroy(&cargs);
break; break;
case CMD_GATEPETERSON_PARAMS_INIT: case CMD_GATEPETERSON_PARAMS_INIT:
......
...@@ -37,18 +37,13 @@ static int heapbuf_ioctl_alloc(struct heapbuf_cmd_args *cargs) ...@@ -37,18 +37,13 @@ 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 retval = 0; s32 osstatus = 0;
block = heapbuf_alloc(cargs->args.alloc.handle, block = heapbuf_alloc(cargs->args.alloc.handle,
cargs->args.alloc.size, cargs->args.alloc.size,
cargs->args.alloc.align); cargs->args.alloc.align);
if (block != NULL) { if (block != NULL) {
index = sharedregion_get_index(block); index = sharedregion_get_index(block);
if (index < 0) {
retval = index;
goto exit;
}
block_srptr = sharedregion_get_srptr(block, index); block_srptr = sharedregion_get_srptr(block, index);
} }
/* The error on above fn will be a null ptr. We are not /* The error on above fn will be a null ptr. We are not
...@@ -57,9 +52,8 @@ static int heapbuf_ioctl_alloc(struct heapbuf_cmd_args *cargs) ...@@ -57,9 +52,8 @@ static int heapbuf_ioctl_alloc(struct heapbuf_cmd_args *cargs)
but the actual fn might be failed inside heapbuf but the actual fn might be failed inside heapbuf
*/ */
cargs->args.alloc.block_srptr = block_srptr; cargs->args.alloc.block_srptr = block_srptr;
cargs->api_status = 0;
exit: return osstatus;
return retval;
} }
/* /*
...@@ -70,12 +64,11 @@ exit: ...@@ -70,12 +64,11 @@ exit:
static int heapbuf_ioctl_free(struct heapbuf_cmd_args *cargs) static int heapbuf_ioctl_free(struct heapbuf_cmd_args *cargs)
{ {
char *block; char *block;
s32 retval = 0;
block = sharedregion_get_ptr(cargs->args.free.block_srptr); block = sharedregion_get_ptr(cargs->args.free.block_srptr);
retval = heapbuf_free(cargs->args.free.handle, block, cargs->api_status = heapbuf_free(cargs->args.free.handle, block,
cargs->args.free.size); cargs->args.free.size);
return retval; return 0;
} }
/* /*
...@@ -86,16 +79,16 @@ static int heapbuf_ioctl_free(struct heapbuf_cmd_args *cargs) ...@@ -86,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 retval = 0; s32 osstatus = 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)
retval = -EFAULT; osstatus = -EFAULT;
return retval; return osstatus;
} }
/* /*
...@@ -106,14 +99,14 @@ static int heapbuf_ioctl_params_init(struct heapbuf_cmd_args *cargs) ...@@ -106,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 retval = 0; s32 osstatus = 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) {
retval = -EFAULT; osstatus = -EFAULT;
goto exit; goto exit;
} }
...@@ -121,7 +114,7 @@ static int heapbuf_ioctl_create(struct heapbuf_cmd_args *cargs) ...@@ -121,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) {
retval = -ENOMEM; osstatus = -ENOMEM;
goto exit; goto exit;
} }
...@@ -130,7 +123,7 @@ static int heapbuf_ioctl_create(struct heapbuf_cmd_args *cargs) ...@@ -130,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) {
retval = -EFAULT; osstatus = -EFAULT;
goto name_from_usr_error; goto name_from_usr_error;
} }
} }
...@@ -139,13 +132,14 @@ static int heapbuf_ioctl_create(struct heapbuf_cmd_args *cargs) ...@@ -139,13 +132,14 @@ static int heapbuf_ioctl_create(struct heapbuf_cmd_args *cargs)
cargs->args.create.params->shared_addr); cargs->args.create.params->shared_addr);
handle = heapbuf_create(&params); handle = heapbuf_create(&params);
cargs->args.create.handle = handle; cargs->args.create.handle = handle;
cargs->api_status = 0;
name_from_usr_error: name_from_usr_error:
if (cargs->args.open.name_len > 0) if (cargs->args.open.name_len > 0)
kfree(params.name); kfree(params.name);
exit: exit:
return retval; return osstatus;
} }
...@@ -156,10 +150,8 @@ exit: ...@@ -156,10 +150,8 @@ exit:
*/ */
static int heapbuf_ioctl_delete(struct heapbuf_cmd_args *cargs) static int heapbuf_ioctl_delete(struct heapbuf_cmd_args *cargs)
{ {
s32 retval = 0; cargs->api_status = heapbuf_delete(cargs->args.delete.handle);
return 0;
retval = heapbuf_delete(cargs->args.delete.handle);
return retval;
} }
/* /*
...@@ -171,13 +163,13 @@ static int heapbuf_ioctl_open(struct heapbuf_cmd_args *cargs) ...@@ -171,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 retval = 0; s32 osstatus = 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) {
retval = -EFAULT; osstatus = -EFAULT;
goto exit; goto exit;
} }
...@@ -185,7 +177,7 @@ static int heapbuf_ioctl_open(struct heapbuf_cmd_args *cargs) ...@@ -185,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) {
retval = -ENOMEM; osstatus = -ENOMEM;
goto exit; goto exit;
} }
...@@ -194,22 +186,22 @@ static int heapbuf_ioctl_open(struct heapbuf_cmd_args *cargs) ...@@ -194,22 +186,22 @@ 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) {
retval = -EFAULT; osstatus = -EFAULT;
goto free_name; goto free_name;
} }
} }
params.shared_addr = sharedregion_get_ptr((u32 *) params.shared_addr = sharedregion_get_ptr((u32 *)
cargs->args.open.params->shared_addr); cargs->args.open.params->shared_addr);
retval = heapbuf_open(&handle, &params); cargs->api_status = heapbuf_open(&handle, &params);
if (retval) if (cargs->api_status != 0)
goto free_name; goto free_name;
cargs->args.open.handle = handle; cargs->args.open.handle = handle;
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) {
retval = -EFAULT; osstatus = -EFAULT;
goto copy_to_usr_error; goto copy_to_usr_error;
} }
...@@ -226,7 +218,7 @@ free_name: ...@@ -226,7 +218,7 @@ free_name:
kfree(params.name); kfree(params.name);
exit: exit:
return retval; return osstatus;
} }
...@@ -237,10 +229,8 @@ exit: ...@@ -237,10 +229,8 @@ exit:
*/ */
static int heapbuf_ioctl_close(struct heapbuf_cmd_args *cargs) static int heapbuf_ioctl_close(struct heapbuf_cmd_args *cargs)
{ {
s32 retval = 0; cargs->api_status = heapbuf_close(cargs->args.close.handle);
return 0;
retval = heapbuf_close(cargs->args.close.handle);
return retval;
} }
/* /*
...@@ -251,22 +241,23 @@ static int heapbuf_ioctl_close(struct heapbuf_cmd_args *cargs) ...@@ -251,22 +241,23 @@ 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 retval = 0; s32 osstatus = 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) {
retval = -EFAULT; osstatus = -EFAULT;
goto exit; goto exit;
} }
bytes = heapbuf_shared_memreq(&params); bytes = heapbuf_shared_memreq(&params);
cargs->args.shared_memreq.bytes = bytes; cargs->args.shared_memreq.bytes = bytes;
cargs->api_status = 0;
exit: exit:
return retval; return osstatus;
} }
...@@ -278,16 +269,16 @@ exit: ...@@ -278,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 retval = 0; s32 osstatus = 0;
ulong size; ulong size;
retval = 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)
retval = -EFAULT; osstatus = -EFAULT;
return retval; return osstatus;
} }
/* /*
...@@ -298,31 +289,30 @@ static int heapbuf_ioctl_get_config(struct heapbuf_cmd_args *cargs) ...@@ -298,31 +289,30 @@ 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 retval = 0; s32 osstatus = 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) {
retval = -EFAULT; osstatus = -EFAULT;
goto exit; goto exit;
} }
retval = heapbuf_setup(&config); cargs->api_status = heapbuf_setup(&config);
exit: exit:
return retval; return osstatus;
} }
/* /*
* ======== heapbuf_ioctl_destroy ======== * ======== heapbuf_ioctl_destroy ========
* Purpose: * Purpose:
* This ioctl interface to heapbuf_destroy function * This ioctl interface to heapbuf_destroy function
*/ */
static int heapbuf_ioctl_destroy() static int heapbuf_ioctl_destroy(struct heapbuf_cmd_args *cargs)
{ {
s32 retval = 0; cargs->api_status = heapbuf_destroy();
retval = heapbuf_destroy(); return 0;
return retval;
} }
...@@ -334,21 +324,21 @@ static int heapbuf_ioctl_destroy() ...@@ -334,21 +324,21 @@ static int heapbuf_ioctl_destroy()
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 retval = 0; s32 osstatus = 0;
ulong size; ulong size;
cargs->api_status = heapbuf_get_stats(cargs->args.get_stats.handle,
retval = heapbuf_get_stats(cargs->args.get_stats.handle, &stats); &stats);
if (retval) if (osstatus)
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)
retval = -EFAULT; osstatus = -EFAULT;
exit: exit:
return retval; return osstatus;
} }
/* /*
...@@ -359,21 +349,21 @@ exit: ...@@ -359,21 +349,21 @@ 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 retval = 0; s32 osstatus = 0;
ulong size; ulong size;
retval = heapbuf_get_extended_stats( cargs->api_status = heapbuf_get_extended_stats(
cargs->args.get_extended_stats.handle, &stats); cargs->args.get_extended_stats.handle, &stats);
if (retval) if (cargs->api_status != 0)
goto exit; goto exit;
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)
retval = -EFAULT; osstatus = -EFAULT;
exit: exit:
return retval; return osstatus;
} }
/* /*
...@@ -410,55 +400,55 @@ int heapbuf_ioctl(struct inode *pinode, struct file *filp, ...@@ -410,55 +400,55 @@ int heapbuf_ioctl(struct inode *pinode, struct file *filp,
switch (cmd) { switch (cmd) {
case CMD_HEAPBUF_ALLOC: case CMD_HEAPBUF_ALLOC:
os_status = heapbuf_ioctl_alloc(uarg); os_status = heapbuf_ioctl_alloc(&cargs);
break; break;
case CMD_HEAPBUF_FREE: case CMD_HEAPBUF_FREE:
os_status = heapbuf_ioctl_free(uarg); os_status = heapbuf_ioctl_free(&cargs);
break; break;
case CMD_HEAPBUF_PARAMS_INIT: case CMD_HEAPBUF_PARAMS_INIT:
os_status = heapbuf_ioctl_params_init(uarg); os_status = heapbuf_ioctl_params_init(&cargs);
break; break;
case CMD_HEAPBUF_CREATE: case CMD_HEAPBUF_CREATE:
os_status = heapbuf_ioctl_create(uarg); os_status = heapbuf_ioctl_create(&cargs);
break; break;
case CMD_HEAPBUF_DELETE: case CMD_HEAPBUF_DELETE:
os_status = heapbuf_ioctl_delete(uarg); os_status = heapbuf_ioctl_delete(&cargs);
break; break;
case CMD_HEAPBUF_OPEN: case CMD_HEAPBUF_OPEN:
os_status = heapbuf_ioctl_open(uarg); os_status = heapbuf_ioctl_open(&cargs);
break; break;
case CMD_HEAPBUF_CLOSE: case CMD_HEAPBUF_CLOSE:
os_status = heapbuf_ioctl_close(uarg); os_status = heapbuf_ioctl_close(&cargs);
break; break;
case CMD_HEAPBUF_SHAREDMEMREQ: case CMD_HEAPBUF_SHAREDMEMREQ:
os_status = heapbuf_ioctl_shared_memreq(uarg); os_status = heapbuf_ioctl_shared_memreq(&cargs);
break; break;
case CMD_HEAPBUF_GETCONFIG: case CMD_HEAPBUF_GETCONFIG:
os_status = heapbuf_ioctl_get_config(uarg); os_status = heapbuf_ioctl_get_config(&cargs);
break; break;
case CMD_HEAPBUF_SETUP: case CMD_HEAPBUF_SETUP:
os_status = heapbuf_ioctl_setup(uarg); os_status = heapbuf_ioctl_setup(&cargs);
break; break;
case CMD_HEAPBUF_DESTROY: case CMD_HEAPBUF_DESTROY:
os_status = heapbuf_ioctl_destroy(); os_status = heapbuf_ioctl_destroy(&cargs);
break; break;
case CMD_HEAPBUF_GETSTATS: case CMD_HEAPBUF_GETSTATS:
os_status = heapbuf_ioctl_get_stats(uarg); os_status = heapbuf_ioctl_get_stats(&cargs);
break; break;
case CMD_HEAPBUF_GETEXTENDEDSTATS: case CMD_HEAPBUF_GETEXTENDEDSTATS:
os_status = heapbuf_ioctl_get_extended_stats(uarg); os_status = heapbuf_ioctl_get_extended_stats(&cargs);
break; break;
default: default:
......
...@@ -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 retval = 0; s32 osstatus = 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) {
retval = ENOMEM; osstatus = 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) {
retval = -ENOMEM; osstatus = -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) {
retval = ENOMEM; osstatus = 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) {
retval = -ENOMEM; osstatus = -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) {
retval = -ENOMEM; osstatus = -ENOMEM;
goto exit; goto exit;
} }
} }
...@@ -95,11 +95,13 @@ static int nameserver_remotenotify_ioctl_get( ...@@ -95,11 +95,13 @@ static int nameserver_remotenotify_ioctl_get(
value, value,
cargs->args.get.value_len, cargs->args.get.value_len,
cargs->args.get.reserved); cargs->args.get.reserved);
cargs->api_status = 0;
exit: exit:
kfree(value); kfree(value);
kfree(name); kfree(name);
kfree(instance_name); kfree(instance_name);
return retval; return osstatus;
} }
/* /*
...@@ -111,7 +113,7 @@ static int nameserver_remotenotify_ioctl_shared_memreq( ...@@ -111,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 retval = 0; s32 osstatus = 0;
ulong size; ulong size;
/* params may be NULL. */ /* params may be NULL. */
...@@ -120,15 +122,17 @@ static int nameserver_remotenotify_ioctl_shared_memreq( ...@@ -120,15 +122,17 @@ 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) {
retval = -EFAULT; osstatus = -EFAULT;
goto exit; goto exit;
} }
} }
cargs->args.shared_memreq.shared_mem_size = cargs->args.shared_memreq.shared_mem_size =
nameserver_remotenotify_shared_memreq(&params); nameserver_remotenotify_shared_memreq(&params);
cargs->api_status = 0;
exit: exit:
return retval; return osstatus;
} }
/* /*
...@@ -140,7 +144,7 @@ static int nameserver_remotenotify_ioctl_params_init( ...@@ -140,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 retval = 0; s32 osstatus = 0;
ulong size; ulong size;
nameserver_remotenotify_params_init(cargs->args.params_init.handle, nameserver_remotenotify_params_init(cargs->args.params_init.handle,
...@@ -148,9 +152,10 @@ static int nameserver_remotenotify_ioctl_params_init( ...@@ -148,9 +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)
retval = -EFAULT; osstatus = -EFAULT;
return retval; cargs->api_status = 0;
return osstatus;
} }
/* /*
...@@ -162,12 +167,12 @@ static int nameserver_remotenotify_ioctl_create( ...@@ -162,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 retval = 0; s32 osstatus = 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) {
retval = -EFAULT; osstatus = -EFAULT;
goto exit; goto exit;
} }
...@@ -176,8 +181,9 @@ static int nameserver_remotenotify_ioctl_create( ...@@ -176,8 +181,9 @@ static int nameserver_remotenotify_ioctl_create(
cargs->args.create.handle = nameserver_remotenotify_create( cargs->args.create.handle = nameserver_remotenotify_create(
cargs->args.create.proc_id, cargs->args.create.proc_id,
&params); &params);
cargs->api_status = 0;
exit: exit:
return retval; return osstatus;
} }
/* /*
...@@ -188,10 +194,9 @@ exit: ...@@ -188,10 +194,9 @@ exit:
static int nameserver_remotenotify_ioctl_delete( static int nameserver_remotenotify_ioctl_delete(
struct nameserver_remotenotify_cmd_args *cargs) struct nameserver_remotenotify_cmd_args *cargs)
{ {
s32 retval = 0; cargs->api_status = nameserver_remotenotify_delete(
retval = nameserver_remotenotify_delete( &cargs->args.delete_instance.handle);
&cargs->args.delete_instance.handle); return 0;
return retval;
} }
/* /*
...@@ -202,7 +207,7 @@ static int nameserver_remotenotify_ioctl_delete( ...@@ -202,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 retval = 0; s32 osstatus = 0;
ulong size; ulong size;
struct nameserver_remotenotify_config config; struct nameserver_remotenotify_config config;
...@@ -210,9 +215,10 @@ static int nameserver_remotenotify_ioctl_get_config( ...@@ -210,9 +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)
retval = -EFAULT; osstatus = -EFAULT;
return retval; cargs->api_status = 0;
return osstatus;
} }
/* /*
...@@ -224,19 +230,19 @@ static int nameserver_remotenotify_ioctl_setup( ...@@ -224,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 retval = 0; s32 osstatus = 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) {
retval = -EFAULT; osstatus = -EFAULT;
goto exit; goto exit;
} }
retval = nameserver_remotenotify_setup(&config); cargs->api_status = nameserver_remotenotify_setup(&config);
exit: exit:
return retval; return osstatus;
} }
...@@ -245,11 +251,11 @@ exit: ...@@ -245,11 +251,11 @@ exit:
* Purpose: * Purpose:
* This ioctl interface to nameserver_remotenotify_destroy function * This ioctl interface to nameserver_remotenotify_destroy function
*/ */
static int nameserver_remotenotify_ioctl_destroy() static int nameserver_remotenotify_ioctl_destroy(
struct nameserver_remotenotify_cmd_args *cargs)
{ {
s32 retval = 0; cargs->api_status = nameserver_remotenotify_destroy();
retval = nameserver_remotenotify_destroy(); return 0;
return retval;
} }
/* /*
...@@ -286,43 +292,35 @@ int nameserver_remotenotify_ioctl(struct inode *inode, struct file *filp, ...@@ -286,43 +292,35 @@ int nameserver_remotenotify_ioctl(struct inode *inode, struct file *filp,
switch (cmd) { switch (cmd) {
case CMD_NAMESERVERREMOTENOTIFY_GET: case CMD_NAMESERVERREMOTENOTIFY_GET:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_GET\n");
os_status = nameserver_remotenotify_ioctl_get(&cargs); os_status = nameserver_remotenotify_ioctl_get(&cargs);
break; break;
case CMD_NAMESERVERREMOTENOTIFY_SHAREDMEMREQ: case CMD_NAMESERVERREMOTENOTIFY_SHAREDMEMREQ:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_SHAREDMEMREQ\n");
os_status = nameserver_remotenotify_ioctl_shared_memreq(&cargs); os_status = nameserver_remotenotify_ioctl_shared_memreq(&cargs);
break; break;
case CMD_NAMESERVERREMOTENOTIFY_PARAMS_INIT: case CMD_NAMESERVERREMOTENOTIFY_PARAMS_INIT:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_PARAMS_INIT\n");
os_status = nameserver_remotenotify_ioctl_params_init(&cargs); os_status = nameserver_remotenotify_ioctl_params_init(&cargs);
break; break;
case CMD_NAMESERVERREMOTENOTIFY_CREATE: case CMD_NAMESERVERREMOTENOTIFY_CREATE:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_CREATE\n");
os_status = nameserver_remotenotify_ioctl_create(&cargs); os_status = nameserver_remotenotify_ioctl_create(&cargs);
break; break;
case CMD_NAMESERVERREMOTENOTIFY_DELETE: case CMD_NAMESERVERREMOTENOTIFY_DELETE:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_DELETE\n");
os_status = nameserver_remotenotify_ioctl_delete(&cargs); os_status = nameserver_remotenotify_ioctl_delete(&cargs);
break; break;
case CMD_NAMESERVERREMOTENOTIFY_GETCONFIG: case CMD_NAMESERVERREMOTENOTIFY_GETCONFIG:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_GETCONFIG\n");
os_status = nameserver_remotenotify_ioctl_get_config(&cargs); os_status = nameserver_remotenotify_ioctl_get_config(&cargs);
break; break;
case CMD_NAMESERVERREMOTENOTIFY_SETUP: case CMD_NAMESERVERREMOTENOTIFY_SETUP:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_SETUP\n");
os_status = nameserver_remotenotify_ioctl_setup(&cargs); os_status = nameserver_remotenotify_ioctl_setup(&cargs);
break; break;
case CMD_NAMESERVERREMOTENOTIFY_DESTROY: case CMD_NAMESERVERREMOTENOTIFY_DESTROY:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_DESTROY\n"); os_status = nameserver_remotenotify_ioctl_destroy(&cargs);
os_status = nameserver_remotenotify_ioctl_destroy();
break; break;
default: default:
......
...@@ -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 retval = 0; s32 osstatus = 0;
s32 size; s32 size;
retval = 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)
retval = -EFAULT; osstatus = -EFAULT;
return retval; return osstatus;
} }
...@@ -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 retval = 0; s32 osstatus = 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) {
retval = -EFAULT; osstatus = -EFAULT;
goto exit; goto exit;
} }
retval = sharedregion_setup(&config); cargs->api_status = sharedregion_setup(&config);
exit: exit:
return retval; return osstatus;
} }
/* /*
...@@ -83,11 +83,11 @@ exit: ...@@ -83,11 +83,11 @@ exit:
* Purpose: * Purpose:
* This ioctl interface to sharedregion_destroy function * This ioctl interface to sharedregion_destroy function
*/ */
static int sharedregion_ioctl_destroy() static int sharedregion_ioctl_destroy(
struct sharedregion_cmd_args *cargs)
{ {
s32 retval = 0; cargs->api_status = sharedregion_destroy();
retval = sharedregion_destroy(); return 0;
return retval;
} }
/* /*
...@@ -97,12 +97,10 @@ static int sharedregion_ioctl_destroy() ...@@ -97,12 +97,10 @@ static int sharedregion_ioctl_destroy()
*/ */
static int sharedregion_ioctl_add(struct sharedregion_cmd_args *cargs) static int sharedregion_ioctl_add(struct sharedregion_cmd_args *cargs)
{ {
s32 retval = 0; cargs->api_status = sharedregion_add(cargs->args.add.index,
retval = sharedregion_add(cargs->args.add.index,
cargs->args.add.base, cargs->args.add.base,
cargs->args.add.len); cargs->args.add.len);
return retval; return 0;
} }
...@@ -114,15 +112,12 @@ static int sharedregion_ioctl_add(struct sharedregion_cmd_args *cargs) ...@@ -114,15 +112,12 @@ static int sharedregion_ioctl_add(struct sharedregion_cmd_args *cargs)
*/ */
static int sharedregion_ioctl_get_index(struct sharedregion_cmd_args *cargs) static int sharedregion_ioctl_get_index(struct sharedregion_cmd_args *cargs)
{ {
s32 retval = 0;
s32 index = 0; s32 index = 0;
index = sharedregion_get_index(cargs->args.get_index.addr); index = sharedregion_get_index(cargs->args.get_index.addr);
cargs->args.get_index.index = index; cargs->args.get_index.index = index;
if (index < 0) cargs->api_status = 0;
retval = index; return 0;
return retval;
} }
/* /*
...@@ -132,7 +127,6 @@ static int sharedregion_ioctl_get_index(struct sharedregion_cmd_args *cargs) ...@@ -132,7 +127,6 @@ static int sharedregion_ioctl_get_index(struct sharedregion_cmd_args *cargs)
*/ */
static int sharedregion_ioctl_get_ptr(struct sharedregion_cmd_args *cargs) static int sharedregion_ioctl_get_ptr(struct sharedregion_cmd_args *cargs)
{ {
s32 retval = 0;
void *addr = NULL; void *addr = NULL;
addr = sharedregion_get_ptr(cargs->args.get_ptr.srptr); addr = sharedregion_get_ptr(cargs->args.get_ptr.srptr);
...@@ -140,7 +134,8 @@ static int sharedregion_ioctl_get_ptr(struct sharedregion_cmd_args *cargs) ...@@ -140,7 +134,8 @@ static int sharedregion_ioctl_get_ptr(struct sharedregion_cmd_args *cargs)
responsibilty to pass proper value to application responsibilty to pass proper value to application
*/ */
cargs->args.get_ptr.addr = addr; cargs->args.get_ptr.addr = addr;
return retval; cargs->api_status = 0;
return 0;
} }
/* /*
...@@ -150,7 +145,6 @@ static int sharedregion_ioctl_get_ptr(struct sharedregion_cmd_args *cargs) ...@@ -150,7 +145,6 @@ static int sharedregion_ioctl_get_ptr(struct sharedregion_cmd_args *cargs)
*/ */
static int sharedregion_ioctl_get_srptr(struct sharedregion_cmd_args *cargs) static int sharedregion_ioctl_get_srptr(struct sharedregion_cmd_args *cargs)
{ {
s32 retval = 0;
u32 *srptr = NULL; u32 *srptr = NULL;
srptr = sharedregion_get_srptr(cargs->args.get_srptr.addr, srptr = sharedregion_get_srptr(cargs->args.get_srptr.addr,
...@@ -159,7 +153,8 @@ static int sharedregion_ioctl_get_srptr(struct sharedregion_cmd_args *cargs) ...@@ -159,7 +153,8 @@ static int sharedregion_ioctl_get_srptr(struct sharedregion_cmd_args *cargs)
responsibilty to pass proper value to application responsibilty to pass proper value to application
*/ */
cargs->args.get_srptr.srptr = srptr; cargs->args.get_srptr.srptr = srptr;
return retval; cargs->api_status = 0;
return 0;
} }
/* /*
...@@ -171,22 +166,18 @@ static int sharedregion_ioctl_get_table_info( ...@@ -171,22 +166,18 @@ 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 retval = 0; s32 osstatus = 0;
s32 size; s32 size;
retval = sharedregion_get_table_info( cargs->api_status = sharedregion_get_table_info(
cargs->args.get_table_info.index, cargs->args.get_table_info.index,
cargs->args.get_table_info.proc_id, &info); cargs->args.get_table_info.proc_id, &info);
if (retval)
goto exit;
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)
retval = -EFAULT; osstatus = -EFAULT;
exit: return osstatus;
return retval;
} }
...@@ -197,10 +188,8 @@ exit: ...@@ -197,10 +188,8 @@ exit:
*/ */
static int sharedregion_ioctl_remove(struct sharedregion_cmd_args *cargs) static int sharedregion_ioctl_remove(struct sharedregion_cmd_args *cargs)
{ {
s32 retval = 0; cargs->api_status = sharedregion_remove(cargs->args.remove.index);
return 0;
retval = sharedregion_remove(cargs->args.remove.index);
return retval;
} }
/* /*
...@@ -212,22 +201,22 @@ static int sharedregion_ioctl_set_table_info( ...@@ -212,22 +201,22 @@ 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 retval = 0; s32 osstatus = 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) {
retval = -EFAULT; osstatus = -EFAULT;
goto exit; goto exit;
} }
retval = sharedregion_set_table_info( cargs->api_status = sharedregion_set_table_info(
cargs->args.set_table_info.index, cargs->args.set_table_info.index,
cargs->args.set_table_info.proc_id, &info); cargs->args.set_table_info.proc_id, &info);
exit: exit:
return retval; return osstatus;
} }
/* /*
...@@ -272,7 +261,7 @@ int sharedregion_ioctl(struct inode *inode, struct file *filp, ...@@ -272,7 +261,7 @@ int sharedregion_ioctl(struct inode *inode, struct file *filp,
break; break;
case CMD_SHAREDREGION_DESTROY: case CMD_SHAREDREGION_DESTROY:
os_status = sharedregion_ioctl_destroy(); os_status = sharedregion_ioctl_destroy(&cargs);
break; break;
case CMD_SHAREDREGION_ADD: case CMD_SHAREDREGION_ADD:
......
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