tizen 2.4 release
[profile/mobile/platform/kernel/linux-3.10-sc7730.git] / kernel / swap / buffer / buffer_queue.h
1 /**
2  * @file buffer/buffer_queue.h
3  * @author Alexander Aksenov <a.aksenov@samsung.com>
4  *
5  * @section LICENSE
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  *
21  * @section COPYRIGHT
22  *
23  * Copyright (C) Samsung Electronics, 2013
24  *
25  * @section DESCRIPTION
26  *
27  * Represents buffers queues interface
28  */
29
30 /* SWAP Buffer queues interface */
31
32 #ifndef __BUFFER_QUEUE_H__
33 #define __BUFFER_QUEUE_H__
34
35 #include <linux/types.h>
36 #include "buffer_description.h"
37
38 int buffer_queue_allocation(size_t subbuffer_size,
39                             unsigned int subbuffers_count);
40 void buffer_queue_free(void);
41 int buffer_queue_reset(void);
42 void buffer_queue_flush(void);
43 struct swap_subbuffer *get_from_write_list(size_t size, void **ptr_to_write,
44                                            bool wakeup);
45 struct swap_subbuffer *get_from_read_list(void);
46 void add_to_write_list(struct swap_subbuffer *subbuffer);
47 void add_to_read_list(struct swap_subbuffer *subbuffer);
48 void add_to_busy_list(struct swap_subbuffer *subbuffer);
49 int remove_from_busy_list(struct swap_subbuffer *subbuffer);
50
51 unsigned int get_readable_buf_cnt(void);
52 unsigned int get_writable_buf_cnt(void);
53 int get_busy_buffers_count(void);
54 int get_pages_count_in_subbuffer(void);
55
56 #endif /* __BUFFER_QUEUE_H__ */