Commit 0de25ed1 authored by Anton Burtsev's avatar Anton Burtsev Committed by Vikram Narayanan

Rewriting capability code -- kmalloc -> slab -- split public header in two

parent b7ddc26c
......@@ -17,6 +17,7 @@
#include <linux/kthread.h>
#include <lcd/lcd.h>
#include <lcd/cap-internal.h>
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("LCD ping-pong IPC test (sender)");
......
This diff is collapsed.
This diff is collapsed.
......@@ -20,6 +20,9 @@ union utcb_union {
struct sync_ipc * alloc_sync_ipc(void);
int lcd_ipc_init(void);
int lcd_ipc_exit(void);
int ipc_send(capability_t cap, struct message_info *msg);
int ipc_recv(capability_t rvp_cap, struct message_info *msg);
......
......@@ -60,7 +60,7 @@ struct sched_param {
#include <linux/magic.h>
#include <linux/cgroup-defs.h>
#ifdef CONFIG_LCD
#ifdef CONFIG_HAVE_LCD
#include <lcd/cap.h>
#include <lcd/ipc.h>
#endif
......@@ -1468,7 +1468,7 @@ struct task_struct {
atomic_t usage;
unsigned int flags; /* per process flags, defined below */
unsigned int ptrace;
#ifdef CONFIG_LCD
#ifdef CONFIG_HAVE_LCD
struct cap_space cspace;
struct list_head sync_rendezvous;
struct utcb *utcb;
......
This diff is collapsed.
......@@ -3,14 +3,32 @@
#include <linux/types.h>
#include <linux/spinlock.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <lcd/cap.h>
#include <lcd/cap-internal.h>
#include <lcd/lcd.h>
struct kmem_cache *sync_ipc_cache;
int lcd_ipc_init(void){
sync_ipc_cache = KMEM_CACHE(sync_ipc, 0);
if(!sync_ipc_cache){
printk(KERN_ERR "Failed to allocate cte slab\n");
return -ENOMEM;
};
return 0;
};
int lcd_ipc_exit(void) {
if (sync_ipc_cache)
kmem_cache_destroy(sync_ipc_cache);
return 0;
}
struct sync_ipc * alloc_sync_ipc() {
struct sync_ipc *rvp;
rvp = (struct sync_ipc*) kmalloc(sizeof(struct sync_ipc), GFP_KERNEL);
rvp = (struct sync_ipc*) kmem_cache_alloc(sync_ipc_cache, GFP_KERNEL);
if(!rvp) {
printk(KERN_ERR "Failed to allocate memory\n");
return NULL;
......@@ -21,6 +39,12 @@ struct sync_ipc * alloc_sync_ipc() {
};
EXPORT_SYMBOL(alloc_sync_ipc);
void free_sync_ipc(struct sync_ipc *rvp) {
kmem_cache_free(sync_ipc_cache, rvp);
return;
};
EXPORT_SYMBOL(free_sync_ipc);
int ipc_send(capability_t rvp_cap, struct message_info *msg)
{
struct task_struct *recv_task;
......
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