Commit da5ab68f authored by Charles Jacobsen's avatar Charles Jacobsen Committed by Vikram Narayanan

Fixed build errors. All cap tests passing.

parent 2768af28
obj-$(CONFIG_LCD_PROTOTYPE_API) += api.o
api-y += cap.o
obj-$(CONFIG_LCD_PROTOTYPE_API) += lcd-prototype-api.o
lcd-prototype-api-y := main.o cap.o api-tests.o
......@@ -6,6 +6,11 @@
* Copyright: University of Utah
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include "../include/common.h"
#include "defs.h"
#define LCD_FAIL(msg...) do{ LCD_ERR(msg); return -1; } while(0)
#define LCD_PASS() do{ return 0; } while(0)
......@@ -37,7 +42,6 @@ static int test02(void)
static int test03(void)
{
struct cspace *cspace;
int ret;
cptr_t cptr;
int i;
if (lcd_mk_cspace(&cspace))
......@@ -63,7 +67,6 @@ static int test03(void)
static int test04(void)
{
struct cspace *cspace;
int ret;
cptr_t cptr;
int i;
int x;
......@@ -83,7 +86,7 @@ static int test04(void)
LCD_FAIL("insert");
}
if (lcd_cnode_lookup(cspace, cptr, &cnode)) {
lcd_rm_cpsace(cspace);
lcd_rm_cspace(cspace);
LCD_FAIL("lookup");
}
if (cnode->type != LCD_CAP_TYPE_SYNC_EP ||
......@@ -100,7 +103,6 @@ static int test05(void)
{
struct cspace *src_cspace;
struct cspace *dest_cspace;
int ret;
cptr_t src_cptr, dest_cptr;
int i;
int x;
......@@ -153,7 +155,7 @@ static int test05(void)
LCD_PASS();
}
static int api_tests(void)
int api_tests(void)
{
if (test01())
return -1;
......
......@@ -70,7 +70,7 @@ static inline int lcd_cap_alloc(struct cspace *cspace, cptr_t *cptr)
int ret = lcd_lock_cspace(cspace);
if (!ret) {
if (cspace->free_slot < LCD_NUM_CAPS)
*cptr = ++cspace->free_slot;
*cptr = cspace->free_slot++;
else
ret = -ENOMEM;
lcd_unlock_cspace(cspace);
......
......@@ -6,17 +6,15 @@
* Copyright: University of Utah
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include "../include/common.h"
#include "defs.h"
static int api_tests(void);
int api_tests(void);
static int __init api_init(void)
int __init api_init(void)
{
LCD_MSG("api starting");
/*
* Run regression tests
*/
......@@ -27,7 +25,7 @@ static int __init api_init(void)
return 0;
}
static void __exit api_exit(void)
void __exit api_exit(void)
{
return;
}
......@@ -35,6 +33,3 @@ static void __exit api_exit(void)
module_init(api_init);
module_exit(api_exit);
/* DEBUG -------------------------------------------------- */
#include "api-tests.c"
......@@ -6,7 +6,7 @@
#ifndef LCD_PROTOTYPE_COMMON_H
#define LCD_PROTOTYPE_COMMON_H
#define LCD_ERR(msg...) __lcd_err(__FILE__, __LINE__, msg)
#define LCD_ERR(fmt, args...) __lcd_err(__FILE__, __LINE__, fmt "\n" , ##args)
static inline void __lcd_err(char *file, int lineno, char *fmt, ...)
{
va_list args;
......@@ -15,7 +15,7 @@ static inline void __lcd_err(char *file, int lineno, char *fmt, ...)
vprintk(fmt, args);
va_end(args);
}
#define LCD_MSG(msg...) __lcd_msg(__FILE__, __LINE__, msg)
#define LCD_MSG(fmt, args...) __lcd_msg(__FILE__, __LINE__, fmt "\n" , ##args)
static inline void __lcd_msg(char *file, int lineno, char *fmt, ...)
{
va_list args;
......@@ -24,7 +24,7 @@ static inline void __lcd_msg(char *file, int lineno, char *fmt, ...)
vprintk(fmt, args);
va_end(args);
}
#define LCD_WARN(msg...) __lcd_warn(__FILE__, __LINE__, msg)
#define LCD_WARN(fmt, args...) __lcd_warn(__FILE__, __LINE__, fmt "\n" , ##args)
static inline void __lcd_warn(char *file, int lineno, char *fmt, ...)
{
va_list args;
......
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