Commit eee91af6 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 0c2003b7
......@@ -38,20 +38,16 @@
static int gatepeterson_ioctl_get_config(struct gatepeterson_cmd_args *cargs)
{
struct gatepeterson_config config;
s32 retval = 0;
s32 osstatus = 0;
s32 size;
retval = gatepeterson_get_config(&config);
if (unlikely(retval))
goto exit;
cargs->api_status = gatepeterson_get_config(&config);
size = copy_to_user(cargs->args.get_config.config, &config,
sizeof(struct gatepeterson_config));
if (size)
retval = -EFAULT;
osstatus = -EFAULT;
exit:
return retval;
return osstatus;
}
/*
......@@ -62,19 +58,20 @@ exit:
static int gatepeterson_ioctl_setup(struct gatepeterson_cmd_args *cargs)
{
struct gatepeterson_config config;
s32 retval = 0;
s32 osstatus = 0;
s32 size;
size = copy_from_user(&config, cargs->args.setup.config,
sizeof(struct gatepeterson_config));
if (size) {
retval = -EFAULT;
osstatus = -EFAULT;
goto exit;
}
retval = gatepeterson_setup(&config);
cargs->api_status = gatepeterson_setup(&config);
exit:
return retval;
return osstatus;
}
/*
......@@ -82,11 +79,11 @@ exit:
* Purpose:
* 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;
retval = gatepeterson_destroy();
return retval;
cargs->api_status = gatepeterson_destroy();
return 0;
}
/*
......@@ -97,16 +94,16 @@ static int gatepeterson_ioctl_destroy()
static int gatepeterson_ioctl_params_init(struct gatepeterson_cmd_args *cargs)
{
struct gatepeterson_params params;
s32 retval = 0;
s32 osstatus = 0;
s32 size;
retval = gatepeterson_params_init(&params);
cargs->api_status = gatepeterson_params_init(&params);
size = copy_to_user(cargs->args.params_init.params, &params,
sizeof(struct gatepeterson_params));
if (size)
retval = -EFAULT;
osstatus = -EFAULT;
return retval;
return osstatus;
}
/*
......@@ -118,13 +115,13 @@ static int gatepeterson_ioctl_create(struct gatepeterson_cmd_args *cargs)
{
struct gatepeterson_params params;
void *handle = NULL;
s32 retval = 0;
s32 osstatus = 0;
s32 size;
size = copy_from_user(&params, cargs->args.create.params,
sizeof(struct gatepeterson_params));
if (size) {
retval = -EFAULT;
osstatus = -EFAULT;
goto exit;
}
......@@ -132,7 +129,7 @@ static int gatepeterson_ioctl_create(struct gatepeterson_cmd_args *cargs)
params.name = kmalloc(cargs->args.create.name_len + 1,
GFP_KERNEL);
if (params.name == NULL) {
retval = -ENOMEM;
osstatus = -ENOMEM;
goto exit;
}
......@@ -141,7 +138,7 @@ static int gatepeterson_ioctl_create(struct gatepeterson_cmd_args *cargs)
cargs->args.create.params->name,
cargs->args.create.name_len);
if (size) {
retval = -EFAULT;
osstatus = -EFAULT;
goto name_from_usr_error;
}
......@@ -154,13 +151,14 @@ static int gatepeterson_ioctl_create(struct gatepeterson_cmd_args *cargs)
proper return to application
*/
cargs->args.create.handle = handle;
cargs->api_status = 0;
name_from_usr_error:
if (cargs->args.open.name_len > 0)
kfree(params.name);
exit:
return retval;
return osstatus;
}
/*
......@@ -171,10 +169,8 @@ exit:
static int gatepeterson_ioctl_delete(struct gatepeterson_cmd_args *cargs)
{
s32 retval = 0;
retval = gatepeterson_delete(&cargs->args.delete.handle);
return retval;
cargs->api_status = gatepeterson_delete(&cargs->args.delete.handle);
return 0;
}
/*
......@@ -186,13 +182,13 @@ static int gatepeterson_ioctl_open(struct gatepeterson_cmd_args *cargs)
{
struct gatepeterson_params params;
void *handle = NULL;
s32 retval = 0;
s32 osstatus = 0;
s32 size;
size = copy_from_user(&params, cargs->args.open.params,
sizeof(struct gatepeterson_params));
if (size) {
retval = -EFAULT;
osstatus = -EFAULT;
goto exit;
}
......@@ -200,7 +196,7 @@ static int gatepeterson_ioctl_open(struct gatepeterson_cmd_args *cargs)
params.name = kmalloc(cargs->args.open.name_len + 1,
GFP_KERNEL);
if (params.name != NULL) {
retval = -ENOMEM;
osstatus = -ENOMEM;
goto exit;
}
......@@ -209,21 +205,22 @@ static int gatepeterson_ioctl_open(struct gatepeterson_cmd_args *cargs)
cargs->args.open.params->name,
cargs->args.open.name_len);
if (size) {
retval = -EFAULT;
osstatus = -EFAULT;
goto name_from_usr_error;
}
}
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->api_status = 0;
name_from_usr_error:
if (cargs->args.open.name_len > 0)
kfree(params.name);
exit:
return retval;
return osstatus;
}
/*
......@@ -233,10 +230,8 @@ exit:
*/
static int gatepeterson_ioctl_close(struct gatepeterson_cmd_args *cargs)
{
s32 retval = 0;
retval = gatepeterson_close(&cargs->args.close.handle);
return retval;
cargs->api_status = gatepeterson_close(&cargs->args.close.handle);
return 0;
}
/*
......@@ -246,10 +241,8 @@ static int gatepeterson_ioctl_close(struct gatepeterson_cmd_args *cargs)
*/
static int gatepeterson_ioctl_enter(struct gatepeterson_cmd_args *cargs)
{
s32 retval = 0;
retval = gatepeterson_enter(cargs->args.enter.handle);
return retval;
cargs->api_status = gatepeterson_enter(cargs->args.enter.handle);
return 0;
}
/*
......@@ -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)
{
struct gatepeterson_params params;
s32 retval = 0;
s32 osstatus = 0;
s32 size;
size = copy_from_user(&params, cargs->args.shared_memreq.params,
sizeof(struct gatepeterson_params));
if (size) {
retval = -EFAULT;
osstatus = -EFAULT;
goto exit;
}
cargs->args.shared_memreq.bytes =
gatepeterson_shared_memreq(cargs->args.shared_memreq.params);
cargs->api_status = 0;
exit:
return retval;
return osstatus;
}
/*
......@@ -333,7 +327,7 @@ int gatepeterson_ioctl(struct inode *inode, struct file *filp,
break;
case CMD_GATEPETERSON_DESTROY:
os_status = gatepeterson_ioctl_destroy();
os_status = gatepeterson_ioctl_destroy(&cargs);
break;
case CMD_GATEPETERSON_PARAMS_INIT:
......
......@@ -37,18 +37,13 @@ static int heapbuf_ioctl_alloc(struct heapbuf_cmd_args *cargs)
u32 *block_srptr = SHAREDREGION_INVALIDSRPTR;
void *block;
s32 index;
s32 retval = 0;
s32 osstatus = 0;
block = heapbuf_alloc(cargs->args.alloc.handle,
cargs->args.alloc.size,
cargs->args.alloc.align);
if (block != NULL) {
index = sharedregion_get_index(block);
if (index < 0) {
retval = index;
goto exit;
}
block_srptr = sharedregion_get_srptr(block, index);
}
/* 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)
but the actual fn might be failed inside heapbuf
*/
cargs->args.alloc.block_srptr = block_srptr;
exit:
return retval;
cargs->api_status = 0;
return osstatus;
}
/*
......@@ -70,12 +64,11 @@ exit:
static int heapbuf_ioctl_free(struct heapbuf_cmd_args *cargs)
{
char *block;
s32 retval = 0;
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);
return retval;
return 0;
}
/*
......@@ -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)
{
struct heapbuf_params params;
s32 retval = 0;
s32 osstatus = 0;
u32 size;
heapbuf_params_init(cargs->args.params_init.handle, &params);
size = copy_to_user(cargs->args.params_init.params, &params,
sizeof(struct heapbuf_params));
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)
static int heapbuf_ioctl_create(struct heapbuf_cmd_args *cargs)
{
struct heapbuf_params params;
s32 retval = 0;
s32 osstatus = 0;
u32 size;
void *handle = NULL;
size = copy_from_user(&params, cargs->args.create.params,
sizeof(struct heapbuf_params));
if (size) {
retval = -EFAULT;
osstatus = -EFAULT;
goto exit;
}
......@@ -121,7 +114,7 @@ static int heapbuf_ioctl_create(struct heapbuf_cmd_args *cargs)
params.name = kmalloc(cargs->args.create.name_len + 1,
GFP_KERNEL);
if (params.name == NULL) {
retval = -ENOMEM;
osstatus = -ENOMEM;
goto exit;
}
......@@ -130,7 +123,7 @@ static int heapbuf_ioctl_create(struct heapbuf_cmd_args *cargs)
cargs->args.create.params->name,
cargs->args.create.name_len);
if (size) {
retval = -EFAULT;
osstatus = -EFAULT;
goto name_from_usr_error;
}
}
......@@ -139,13 +132,14 @@ static int heapbuf_ioctl_create(struct heapbuf_cmd_args *cargs)
cargs->args.create.params->shared_addr);
handle = heapbuf_create(&params);
cargs->args.create.handle = handle;
cargs->api_status = 0;
name_from_usr_error:
if (cargs->args.open.name_len > 0)
kfree(params.name);
exit:
return retval;
return osstatus;
}
......@@ -156,10 +150,8 @@ exit:
*/
static int heapbuf_ioctl_delete(struct heapbuf_cmd_args *cargs)
{
s32 retval = 0;
retval = heapbuf_delete(cargs->args.delete.handle);
return retval;
cargs->api_status = heapbuf_delete(cargs->args.delete.handle);
return 0;
}
/*
......@@ -171,13 +163,13 @@ static int heapbuf_ioctl_open(struct heapbuf_cmd_args *cargs)
{
struct heapbuf_params params;
void *handle = NULL;
s32 retval = 0;
s32 osstatus = 0;
ulong size;
size = copy_from_user(&params, cargs->args.open.params,
sizeof(struct heapbuf_params));
if (size) {
retval = -EFAULT;
osstatus = -EFAULT;
goto exit;
}
......@@ -185,7 +177,7 @@ static int heapbuf_ioctl_open(struct heapbuf_cmd_args *cargs)
params.name = kmalloc(cargs->args.open.name_len + 1,
GFP_KERNEL);
if (params.name == NULL) {
retval = -ENOMEM;
osstatus = -ENOMEM;
goto exit;
}
......@@ -194,22 +186,22 @@ static int heapbuf_ioctl_open(struct heapbuf_cmd_args *cargs)
cargs->args.open.params->name,
cargs->args.open.name_len);
if (size) {
retval = -EFAULT;
osstatus = -EFAULT;
goto free_name;
}
}
params.shared_addr = sharedregion_get_ptr((u32 *)
cargs->args.open.params->shared_addr);
retval = heapbuf_open(&handle, &params);
if (retval)
cargs->api_status = heapbuf_open(&handle, &params);
if (cargs->api_status != 0)
goto free_name;
cargs->args.open.handle = handle;
size = copy_to_user(cargs->args.open.params, &params,
sizeof(struct heapbuf_params));
if (size) {
retval = -EFAULT;
osstatus = -EFAULT;
goto copy_to_usr_error;
}
......@@ -226,7 +218,7 @@ free_name:
kfree(params.name);
exit:
return retval;
return osstatus;
}
......@@ -237,10 +229,8 @@ exit:
*/
static int heapbuf_ioctl_close(struct heapbuf_cmd_args *cargs)
{
s32 retval = 0;
retval = heapbuf_close(cargs->args.close.handle);
return retval;
cargs->api_status = heapbuf_close(cargs->args.close.handle);
return 0;
}
/*
......@@ -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)
{
struct heapbuf_params params;
s32 retval = 0;
s32 osstatus = 0;
ulong size;
u32 bytes;
size = copy_from_user(&params, cargs->args.shared_memreq.params,
sizeof(struct heapbuf_params));
if (size) {
retval = -EFAULT;
osstatus = -EFAULT;
goto exit;
}
bytes = heapbuf_shared_memreq(&params);
cargs->args.shared_memreq.bytes = bytes;
cargs->api_status = 0;
exit:
return retval;
return osstatus;
}
......@@ -278,16 +269,16 @@ exit:
static int heapbuf_ioctl_get_config(struct heapbuf_cmd_args *cargs)
{
struct heap_config config;
s32 retval = 0;
s32 osstatus = 0;
ulong size;
retval = heapbuf_get_config(&config);
cargs->api_status = heapbuf_get_config(&config);
size = copy_to_user(cargs->args.get_config.config, &config,
sizeof(struct heap_config));
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)
static int heapbuf_ioctl_setup(struct heapbuf_cmd_args *cargs)
{
struct heap_config config;
s32 retval = 0;
s32 osstatus = 0;
ulong size;
size = copy_from_user(&config, cargs->args.setup.config,
sizeof(struct heap_config));
if (size) {
retval = -EFAULT;
osstatus = -EFAULT;
goto exit;
}
retval = heapbuf_setup(&config);
cargs->api_status = heapbuf_setup(&config);
exit:
return retval;
return osstatus;
}
/*
* ======== heapbuf_ioctl_destroy ========
* Purpose:
* 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;
retval = heapbuf_destroy();
return retval;
cargs->api_status = heapbuf_destroy();
return 0;
}
......@@ -334,21 +324,21 @@ static int heapbuf_ioctl_destroy()
static int heapbuf_ioctl_get_stats(struct heapbuf_cmd_args *cargs)
{
struct memory_stats stats;
s32 retval = 0;
s32 osstatus = 0;
ulong size;
retval = heapbuf_get_stats(cargs->args.get_stats.handle, &stats);
if (retval)
cargs->api_status = heapbuf_get_stats(cargs->args.get_stats.handle,
&stats);
if (osstatus)
goto exit;
size = copy_to_user(cargs->args.get_stats.stats, &stats,
sizeof(struct memory_stats));
if (size)
retval = -EFAULT;
osstatus = -EFAULT;
exit:
return retval;
return osstatus;
}
/*
......@@ -359,21 +349,21 @@ exit:
static int heapbuf_ioctl_get_extended_stats(struct heapbuf_cmd_args *cargs)
{
struct heap_extended_stats stats;
s32 retval = 0;
s32 osstatus = 0;
ulong size;
retval = heapbuf_get_extended_stats(
cargs->api_status = heapbuf_get_extended_stats(
cargs->args.get_extended_stats.handle, &stats);
if (retval)
if (cargs->api_status != 0)
goto exit;
size = copy_to_user(cargs->args.get_extended_stats.stats, &stats,
sizeof(struct heap_extended_stats));
if (size)
retval = -EFAULT;
osstatus = -EFAULT;
exit:
return retval;
return osstatus;
}
/*
......@@ -410,55 +400,55 @@ int heapbuf_ioctl(struct inode *pinode, struct file *filp,
switch (cmd) {
case CMD_HEAPBUF_ALLOC:
os_status = heapbuf_ioctl_alloc(uarg);
os_status = heapbuf_ioctl_alloc(&cargs);
break;
case CMD_HEAPBUF_FREE:
os_status = heapbuf_ioctl_free(uarg);
os_status = heapbuf_ioctl_free(&cargs);
break;
case CMD_HEAPBUF_PARAMS_INIT:
os_status = heapbuf_ioctl_params_init(uarg);
os_status = heapbuf_ioctl_params_init(&cargs);
break;
case CMD_HEAPBUF_CREATE:
os_status = heapbuf_ioctl_create(uarg);
os_status = heapbuf_ioctl_create(&cargs);
break;
case CMD_HEAPBUF_DELETE:
os_status = heapbuf_ioctl_delete(uarg);
os_status = heapbuf_ioctl_delete(&cargs);
break;
case CMD_HEAPBUF_OPEN:
os_status = heapbuf_ioctl_open(uarg);
os_status = heapbuf_ioctl_open(&cargs);
break;
case CMD_HEAPBUF_CLOSE:
os_status = heapbuf_ioctl_close(uarg);
os_status = heapbuf_ioctl_close(&cargs);
break;
case CMD_HEAPBUF_SHAREDMEMREQ:
os_status = heapbuf_ioctl_shared_memreq(uarg);
os_status = heapbuf_ioctl_shared_memreq(&cargs);
break;
case CMD_HEAPBUF_GETCONFIG:
os_status = heapbuf_ioctl_get_config(uarg);
os_status = heapbuf_ioctl_get_config(&cargs);
break;
case CMD_HEAPBUF_SETUP:
os_status = heapbuf_ioctl_setup(uarg);
os_status = heapbuf_ioctl_setup(&cargs);
break;
case CMD_HEAPBUF_DESTROY:
os_status = heapbuf_ioctl_destroy();
os_status = heapbuf_ioctl_destroy(&cargs);
break;
case CMD_HEAPBUF_GETSTATS:
os_status = heapbuf_ioctl_get_stats(uarg);
os_status = heapbuf_ioctl_get_stats(&cargs);
break;
case CMD_HEAPBUF_GETEXTENDEDSTATS:
os_status = heapbuf_ioctl_get_extended_stats(uarg);
os_status = heapbuf_ioctl_get_extended_stats(&cargs);
break;
default:
......
......@@ -36,7 +36,7 @@
static int nameserver_remotenotify_ioctl_get(
struct nameserver_remotenotify_cmd_args *cargs)
{
s32 retval = 0;
s32 osstatus = 0;
ulong size;
char *instance_name = NULL;
char *name = NULL;
......@@ -46,7 +46,7 @@ static int nameserver_remotenotify_ioctl_get(
instance_name = kmalloc(cargs->args.get.instance_name_len + 1,
GFP_KERNEL);
if (instance_name == NULL) {
retval = ENOMEM;
osstatus = ENOMEM;
goto exit;
}
......@@ -55,7 +55,7 @@ static int nameserver_remotenotify_ioctl_get(
cargs->args.get.instance_name,
cargs->args.get.instance_name_len);
if (size) {
retval = -ENOMEM;
osstatus = -ENOMEM;
goto exit;
}
}
......@@ -64,7 +64,7 @@ static int nameserver_remotenotify_ioctl_get(
name = kmalloc(cargs->args.get.name_len + 1,
GFP_KERNEL);
if (name == NULL) {
retval = ENOMEM;
osstatus = ENOMEM;
goto exit;
}
......@@ -72,7 +72,7 @@ static int nameserver_remotenotify_ioctl_get(
size = copy_from_user(name, cargs->args.get.name,
cargs->args.get.name_len);
if (size) {
retval = -ENOMEM;
osstatus = -ENOMEM;
goto exit;
}
}
......@@ -83,7 +83,7 @@ static int nameserver_remotenotify_ioctl_get(
size = copy_from_user(value, cargs->args.get.value,
cargs->args.get.value_len);
if (size) {
retval = -ENOMEM;
osstatus = -ENOMEM;
goto exit;
}
}
......@@ -95,11 +95,13 @@ static int nameserver_remotenotify_ioctl_get(
value,
cargs->args.get.value_len,
cargs->args.get.reserved);
cargs->api_status = 0;
exit:
kfree(value);
kfree(name);
kfree(instance_name);
return retval;
return osstatus;
}
/*
......@@ -111,7 +113,7 @@ static int nameserver_remotenotify_ioctl_shared_memreq(
struct nameserver_remotenotify_cmd_args *cargs)
{
struct nameserver_remotenotify_params params;
s32 retval = 0;
s32 osstatus = 0;
ulong size;
/* params may be NULL. */
......@@ -120,15 +122,17 @@ static int nameserver_remotenotify_ioctl_shared_memreq(
cargs->args.shared_memreq.params,
sizeof(struct nameserver_remotenotify_params));
if (size) {
retval = -EFAULT;
osstatus = -EFAULT;
goto exit;
}
}
cargs->args.shared_memreq.shared_mem_size =
nameserver_remotenotify_shared_memreq(&params);
cargs->api_status = 0;
exit:
return retval;
return osstatus;
}
/*
......@@ -140,7 +144,7 @@ static int nameserver_remotenotify_ioctl_params_init(
struct nameserver_remotenotify_cmd_args *cargs)
{
struct nameserver_remotenotify_params params;
s32 retval = 0;
s32 osstatus = 0;
ulong size;
nameserver_remotenotify_params_init(cargs->args.params_init.handle,
......@@ -148,9 +152,10 @@ static int nameserver_remotenotify_ioctl_params_init(
size = copy_to_user(cargs->args.params_init.params, &params,
sizeof(struct nameserver_remotenotify_params));
if (size)
retval = -EFAULT;
osstatus = -EFAULT;
return retval;
cargs->api_status = 0;
return osstatus;
}
/*
......@@ -162,12 +167,12 @@ static int nameserver_remotenotify_ioctl_create(
struct nameserver_remotenotify_cmd_args *cargs)
{
struct nameserver_remotenotify_params params;
s32 retval = 0;
s32 osstatus = 0;
ulong size;
size = copy_from_user(&params, cargs->args.create.params,
sizeof(struct nameserver_remotenotify_params));
if (size) {
retval = -EFAULT;
osstatus = -EFAULT;
goto exit;
}
......@@ -176,8 +181,9 @@ static int nameserver_remotenotify_ioctl_create(
cargs->args.create.handle = nameserver_remotenotify_create(
cargs->args.create.proc_id,
&params);
cargs->api_status = 0;
exit:
return retval;
return osstatus;
}
/*
......@@ -188,10 +194,9 @@ exit:
static int nameserver_remotenotify_ioctl_delete(
struct nameserver_remotenotify_cmd_args *cargs)
{
s32 retval = 0;
retval = nameserver_remotenotify_delete(
cargs->api_status = nameserver_remotenotify_delete(
&cargs->args.delete_instance.handle);
return retval;
return 0;
}
/*
......@@ -202,7 +207,7 @@ static int nameserver_remotenotify_ioctl_delete(
static int nameserver_remotenotify_ioctl_get_config(
struct nameserver_remotenotify_cmd_args *cargs)
{
s32 retval = 0;
s32 osstatus = 0;
ulong size;
struct nameserver_remotenotify_config config;
......@@ -210,9 +215,10 @@ static int nameserver_remotenotify_ioctl_get_config(
size = copy_to_user(cargs->args.get_config.config, &config,
sizeof(struct nameserver_remotenotify_config));
if (size)
retval = -EFAULT;
osstatus = -EFAULT;
return retval;
cargs->api_status = 0;
return osstatus;
}
/*
......@@ -224,19 +230,19 @@ static int nameserver_remotenotify_ioctl_setup(
struct nameserver_remotenotify_cmd_args *cargs)
{
struct nameserver_remotenotify_config config;
s32 retval = 0;
s32 osstatus = 0;
ulong size;
size = copy_from_user(&config, cargs->args.setup.config,
sizeof(struct nameserver_remotenotify_config));
if (size) {
retval = -EFAULT;
osstatus = -EFAULT;
goto exit;
}
retval = nameserver_remotenotify_setup(&config);
cargs->api_status = nameserver_remotenotify_setup(&config);
exit:
return retval;
return osstatus;
}
......@@ -245,11 +251,11 @@ exit:
* Purpose:
* 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;
retval = nameserver_remotenotify_destroy();
return retval;
cargs->api_status = nameserver_remotenotify_destroy();
return 0;
}
/*
......@@ -286,43 +292,35 @@ int nameserver_remotenotify_ioctl(struct inode *inode, struct file *filp,
switch (cmd) {
case CMD_NAMESERVERREMOTENOTIFY_GET:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_GET\n");
os_status = nameserver_remotenotify_ioctl_get(&cargs);
break;
case CMD_NAMESERVERREMOTENOTIFY_SHAREDMEMREQ:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_SHAREDMEMREQ\n");
os_status = nameserver_remotenotify_ioctl_shared_memreq(&cargs);
break;
case CMD_NAMESERVERREMOTENOTIFY_PARAMS_INIT:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_PARAMS_INIT\n");
os_status = nameserver_remotenotify_ioctl_params_init(&cargs);
break;
case CMD_NAMESERVERREMOTENOTIFY_CREATE:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_CREATE\n");
os_status = nameserver_remotenotify_ioctl_create(&cargs);
break;
case CMD_NAMESERVERREMOTENOTIFY_DELETE:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_DELETE\n");
os_status = nameserver_remotenotify_ioctl_delete(&cargs);
break;
case CMD_NAMESERVERREMOTENOTIFY_GETCONFIG:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_GETCONFIG\n");
os_status = nameserver_remotenotify_ioctl_get_config(&cargs);
break;
case CMD_NAMESERVERREMOTENOTIFY_SETUP:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_SETUP\n");
os_status = nameserver_remotenotify_ioctl_setup(&cargs);
break;
case CMD_NAMESERVERREMOTENOTIFY_DESTROY:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_DESTROY\n");
os_status = nameserver_remotenotify_ioctl_destroy();
os_status = nameserver_remotenotify_ioctl_destroy(&cargs);
break;
default:
......
......@@ -41,16 +41,16 @@ static int sharedregion_ioctl_get_config(struct sharedregion_cmd_args *cargs)
{
struct sharedregion_config config;
s32 retval = 0;
s32 osstatus = 0;
s32 size;
retval = sharedregion_get_config(&config);
cargs->api_status = sharedregion_get_config(&config);
size = copy_to_user(cargs->args.get_config.config, &config,
sizeof(struct sharedregion_config));
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)
static int sharedregion_ioctl_setup(struct sharedregion_cmd_args *cargs)
{
struct sharedregion_config config;
s32 retval = 0;
s32 osstatus = 0;
s32 size;
size = copy_from_user(&config, cargs->args.setup.config,
sizeof(struct sharedregion_config));
if (size) {
retval = -EFAULT;
osstatus = -EFAULT;
goto exit;
}
retval = sharedregion_setup(&config);
cargs->api_status = sharedregion_setup(&config);
exit:
return retval;
return osstatus;
}
/*
......@@ -83,11 +83,11 @@ exit:
* Purpose:
* 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;
retval = sharedregion_destroy();
return retval;
cargs->api_status = sharedregion_destroy();
return 0;
}
/*
......@@ -97,12 +97,10 @@ static int sharedregion_ioctl_destroy()
*/
static int sharedregion_ioctl_add(struct sharedregion_cmd_args *cargs)
{
s32 retval = 0;
retval = sharedregion_add(cargs->args.add.index,
cargs->api_status = sharedregion_add(cargs->args.add.index,
cargs->args.add.base,
cargs->args.add.len);
return retval;
return 0;
}
......@@ -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)
{
s32 retval = 0;
s32 index = 0;
index = sharedregion_get_index(cargs->args.get_index.addr);
cargs->args.get_index.index = index;
if (index < 0)
retval = index;
return retval;
cargs->api_status = 0;
return 0;
}
/*
......@@ -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)
{
s32 retval = 0;
void *addr = NULL;
addr = sharedregion_get_ptr(cargs->args.get_ptr.srptr);
......@@ -140,7 +134,8 @@ static int sharedregion_ioctl_get_ptr(struct sharedregion_cmd_args *cargs)
responsibilty to pass proper value to application
*/
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)
*/
static int sharedregion_ioctl_get_srptr(struct sharedregion_cmd_args *cargs)
{
s32 retval = 0;
u32 *srptr = NULL;
srptr = sharedregion_get_srptr(cargs->args.get_srptr.addr,
......@@ -159,7 +153,8 @@ static int sharedregion_ioctl_get_srptr(struct sharedregion_cmd_args *cargs)
responsibilty to pass proper value to application
*/
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(
struct sharedregion_cmd_args *cargs)
{
struct sharedregion_info info;
s32 retval = 0;
s32 osstatus = 0;
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.proc_id, &info);
if (retval)
goto exit;
size = copy_to_user(cargs->args.get_table_info.info, &info,
sizeof(struct sharedregion_info));
if (size)
retval = -EFAULT;
osstatus = -EFAULT;
exit:
return retval;
return osstatus;
}
......@@ -197,10 +188,8 @@ exit:
*/
static int sharedregion_ioctl_remove(struct sharedregion_cmd_args *cargs)
{
s32 retval = 0;
retval = sharedregion_remove(cargs->args.remove.index);
return retval;
cargs->api_status = sharedregion_remove(cargs->args.remove.index);
return 0;
}
/*
......@@ -212,22 +201,22 @@ static int sharedregion_ioctl_set_table_info(
struct sharedregion_cmd_args *cargs)
{
struct sharedregion_info info;
s32 retval = 0;
s32 osstatus = 0;
s32 size;
size = copy_from_user(&info, cargs->args.set_table_info.info,
sizeof(struct sharedregion_info));
if (size) {
retval = -EFAULT;
osstatus = -EFAULT;
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.proc_id, &info);
exit:
return retval;
return osstatus;
}
/*
......@@ -272,7 +261,7 @@ int sharedregion_ioctl(struct inode *inode, struct file *filp,
break;
case CMD_SHAREDREGION_DESTROY:
os_status = sharedregion_ioctl_destroy();
os_status = sharedregion_ioctl_destroy(&cargs);
break;
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