kdbus: the driver, original and non-working
[platform/kernel/linux-exynos.git] / ipc / kdbus / pool.h
1 /*
2  * Copyright (C) 2013-2015 Kay Sievers
3  * Copyright (C) 2013-2015 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4  * Copyright (C) 2013-2015 Daniel Mack <daniel@zonque.org>
5  * Copyright (C) 2013-2015 David Herrmann <dh.herrmann@gmail.com>
6  * Copyright (C) 2013-2015 Linux Foundation
7  * Copyright (C) 2014-2015 Djalal Harouni <tixxdz@opendz.org>
8  *
9  * kdbus is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU Lesser General Public License as published by the
11  * Free Software Foundation; either version 2.1 of the License, or (at
12  * your option) any later version.
13  */
14
15 #ifndef __KDBUS_POOL_H
16 #define __KDBUS_POOL_H
17
18 #include <linux/uio.h>
19
20 struct kdbus_pool;
21 struct kdbus_pool_slice;
22
23 struct kdbus_pool *kdbus_pool_new(const char *name, size_t size);
24 void kdbus_pool_free(struct kdbus_pool *pool);
25 void kdbus_pool_accounted(struct kdbus_pool *pool, size_t *size, size_t *acc);
26 int kdbus_pool_mmap(const struct kdbus_pool *pool, struct vm_area_struct *vma);
27 int kdbus_pool_release_offset(struct kdbus_pool *pool, size_t off);
28 void kdbus_pool_publish_empty(struct kdbus_pool *pool, u64 *off, u64 *size);
29
30 struct kdbus_pool_slice *kdbus_pool_slice_alloc(struct kdbus_pool *pool,
31                                                 size_t size, bool accounted);
32 void kdbus_pool_slice_release(struct kdbus_pool_slice *slice);
33 void kdbus_pool_slice_publish(struct kdbus_pool_slice *slice,
34                               u64 *out_offset, u64 *out_size);
35 off_t kdbus_pool_slice_offset(const struct kdbus_pool_slice *slice);
36 size_t kdbus_pool_slice_size(const struct kdbus_pool_slice *slice);
37 int kdbus_pool_slice_copy(const struct kdbus_pool_slice *slice_dst,
38                           const struct kdbus_pool_slice *slice_src);
39 ssize_t kdbus_pool_slice_copy_kvec(const struct kdbus_pool_slice *slice,
40                                    loff_t off, struct kvec *kvec,
41                                    size_t kvec_count, size_t total_len);
42 ssize_t kdbus_pool_slice_copy_iovec(const struct kdbus_pool_slice *slice,
43                                     loff_t off, struct iovec *iov,
44                                     size_t iov_count, size_t total_len);
45
46 #endif