[REFACTOR] separate definitions and kernel operations in buffer
authorAlexander Aksenov <a.aksenov@samsung.com>
Mon, 11 Nov 2013 07:42:47 +0000 (11:42 +0400)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Mon, 11 Nov 2013 09:55:09 +0000 (09:55 +0000)
Change-Id: I602a03b4f4bec4d95632ad5b30040d7057c7cbbb
Signed-off-by: Alexander Aksenov <a.aksenov@samsung.com>
buffer/buffer_description.h
buffer/buffer_queue.c
buffer/data_types.h [new file with mode: 0644]
buffer/kernel_operations.h
buffer/swap_buffer_module.c
driver/driver_to_buffer.c

index 988c780..2be9eaf 100644 (file)
@@ -27,7 +27,7 @@
 #ifndef __BUFFER_DESCRIPTION_H__
 #define __BUFFER_DESCRIPTION_H__
 
-#include "kernel_operations.h"
+#include "data_types.h"
 
 struct swap_subbuffer {
        /* Pointer to the next subbuffer in queue */
index 28f7640..7ba67fb 100644 (file)
@@ -45,6 +45,7 @@
 #include "buffer_queue.h"
 #include "swap_buffer_to_buffer_queue.h"
 #include "swap_buffer_errors.h"
+#include "kernel_operations.h"
 
 /* Queue structure. Consist of pointers to the first and the last elements of
  * queue. */
diff --git a/buffer/data_types.h b/buffer/data_types.h
new file mode 100644 (file)
index 0000000..6da8b4c
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ *  SWAP Buffer Module
+ *  modules/buffer/data_types.h
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) Samsung Electronics, 2013
+ *
+ * 2013         Alexander Aksenov <a.aksenov@samsung.com>: SWAP Buffer implement
+ *
+ */
+
+#ifndef __DATA_TYPES_H__
+#define __DATA_TYPES_H__
+
+
+#include <linux/spinlock.h>
+
+
+struct page;
+
+/* Using spinlocks as sync primitives */
+struct sync_t {
+       spinlock_t spinlock;
+       unsigned long flags;
+};
+
+/* swap_subbuffer_ptr points to the first memory page of the subbuffer */
+typedef struct page *swap_subbuffer_ptr;
+
+#endif /* __DATA_TYPES_H__ */
index 1c41f98..9327c1e 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/gfp.h>
 #include <linux/mm.h>
 
+#include "data_types.h"
 
 
 /* MESSAGES */
 
 /* LOCKS */
 
-/* Using spinlocks as sync primitives */
-struct sync_t {
-       spinlock_t spinlock;
-       unsigned long flags;
-};
-
 /* Spinlocks initialization */
 static inline void sync_init(struct sync_t *buffer_sync)
 {
@@ -82,8 +77,6 @@ static inline void sync_unlock(struct sync_t *buffer_sync)
 
 /* SWAP SUBBUFER */
 
-/* swap_subbuffer_ptr points to the first memory page of the subbuffer */
-typedef struct page *swap_subbuffer_ptr;
 
 /* We alloc memory for swap_subbuffer structures with common kmalloc */
 #define memory_allocation(memory_size)  kmalloc(memory_size, GFP_KERNEL)
index c0da9f5..17d8f70 100644 (file)
@@ -28,6 +28,7 @@
 #include "buffer_queue.h"
 #include "buffer_description.h"
 #include "swap_buffer_errors.h"
+#include "kernel_operations.h"
 
 /* Bitwise mask for buffer status */
 enum _swap_buffer_status_mask {
index 9fd59c9..dd2836a 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/splice.h>
 #include <asm/uaccess.h>
 #include <linux/spinlock.h>
+#include <linux/mm.h>
 
 #include <buffer/swap_buffer_module.h>
 #include <buffer/swap_buffer_errors.h>