Commit b9dd8064 authored by Philippe Gerum's avatar Philippe Gerum
Browse files

evl/mapper: remove - superseded by file proxy


Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
parent 39ebd010
......@@ -26,7 +26,7 @@
({ \
struct evl_file_binding *__fbind = (__filp)->private_data; \
container_of(__fbind->element, __type, element); \
}) \
})
#define fundle_of(__obj) ((__obj)->element.fundle)
......@@ -156,7 +156,6 @@ extern struct evl_factory evl_thread_factory;
extern struct evl_factory evl_timerfd_factory;
extern struct evl_factory evl_trace_factory;
extern struct evl_factory evl_xbuf_factory;
extern struct evl_factory evl_mapper_factory;
extern struct evl_factory evl_proxy_factory;
#endif /* !_EVENLESS_FACTORY_H */
/*
* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
*
* Copyright (C) 2018 Philippe Gerum <rpm@xenomai.org>
*/
#ifndef _EVENLESS_UAPI_MAPPER_H
#define _EVENLESS_UAPI_MAPPER_H
struct evl_mapper_attrs {
__u32 fd;
};
#endif /* !_EVENLESS_UAPI_MAPPER_H */
......@@ -126,15 +126,6 @@ config EVENLESS_NR_XBUFS
This value gives the maximum number of x-buffers which can be
alive concurrently in the system for user-space applications.
config EVENLESS_NR_MAPPERS
int "Maximum number of mappers"
range 1 16384
default 64
help
This value gives the maximum number of mappers which can be
alive concurrently in the system for user-space applications.
config EVENLESS_NR_PROXIES
int "Maximum number of proxies"
range 1 16384
......
......@@ -11,7 +11,6 @@ evenless-y := \
irq.o \
ksem.o \
lock.o \
mapper.o \
memory.o \
monitor.o \
mutex.o \
......
......@@ -39,7 +39,6 @@ static struct evl_factory *factories[] = {
&evl_timerfd_factory,
&evl_poll_factory,
&evl_xbuf_factory,
&evl_mapper_factory,
&evl_proxy_factory,
#ifdef CONFIG_FTRACE
&evl_trace_factory,
......
/*
* SPDX-License-Identifier: GPL-2.0
*
* Copyright (C) 2018 Philippe Gerum <rpm@xenomai.org>
*/
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/uaccess.h>
#include <linux/file.h>
#include <linux/fs.h>
#include <evenless/factory.h>
#include <uapi/evenless/mapper.h>
struct evl_mapper {
struct file *mapfilp;
struct evl_element element;
};
static int mapper_mmap(struct file *filp, struct vm_area_struct *vma)
{
struct evl_mapper *mapper = element_of(filp, struct evl_mapper);
struct file *mapfilp = mapper->mapfilp;
int ret;
if (mapfilp->f_op->mmap == NULL)
return -ENODEV;
vma->vm_file = get_file(mapfilp);
ret = call_mmap(mapfilp, vma);
if (ret)
fput(mapfilp);
else
fput(filp);
return ret;
}
static const struct file_operations mapper_fops = {
.open = evl_open_element,
.release = evl_release_element,
.mmap = mapper_mmap,
};
static struct evl_element *
mapper_factory_build(struct evl_factory *fac, const char *name,
void __user *u_attrs, u32 *state_offp)
{
struct evl_mapper_attrs attrs;
struct evl_mapper *mapper;
struct file *mapfilp;
int ret;
ret = copy_from_user(&attrs, u_attrs, sizeof(attrs));
if (ret)
return ERR_PTR(-EFAULT);
mapfilp = fget(attrs.fd);
if (mapfilp == NULL)
return ERR_PTR(-EINVAL);
mapper = kzalloc(sizeof(*mapper), GFP_KERNEL);
if (mapper == NULL) {
ret = -ENOMEM;
goto fail_mapper;
}
ret = evl_init_element(&mapper->element, &evl_mapper_factory);
if (ret)
goto fail_element;
mapper->mapfilp = mapfilp;
evl_index_element(&mapper->element);
return &mapper->element;
fail_element:
kfree(mapper);
fail_mapper:
fput(mapfilp);
return ERR_PTR(ret);
}
static void mapper_factory_dispose(struct evl_element *e)
{
struct evl_mapper *mapper;
mapper = container_of(e, struct evl_mapper, element);
evl_unindex_element(&mapper->element);
fput(mapper->mapfilp);
evl_destroy_element(&mapper->element);
kfree_rcu(mapper, element.rcu);
}
struct evl_factory evl_mapper_factory = {
.name = "mapper",
.fops = &mapper_fops,
.build = mapper_factory_build,
.dispose = mapper_factory_dispose,
.nrdev = CONFIG_EVENLESS_NR_MAPPERS,
.flags = EVL_FACTORY_CLONE,
};
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