All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 610b3464 authored by Charlie Jacobsen's avatar Charlie Jacobsen Committed by Vikram Narayanan

Finished first draft of customer idl.

parent d58f894f
......@@ -14,11 +14,8 @@
#include "common.h"
#include "dealer.h"
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Auto buyer (LCD test)");
#ifdef CONFIG_RUN_IN_LCD
int customer_init(void)
int __customer_init(void)
#else
static int __init customer_init(void)
#endif
......@@ -26,23 +23,23 @@ static int __init customer_init(void)
struct automobile *a;
a = dealer_buy_car();
if (!a) {
AU_ERR("bad car");
LCD_ERR("bad car");
return -1;
}
AU_MSG("got a %d-door car with %d cylinders",
LCD_MSG("got a %d-door car with %d cylinders",
a->doors, a->engine->cylinders);
dealer_return_car(a);
AU_MSG("customer initialized (and done)");
LCD_MSG("customer initialized (and done)");
return 0;
}
#ifdef CONFIG_RUN_IN_LCD
void customer_exit(void)
void __customer_exit(void)
#else
static void __exit customer_exit(void)
#endif
{
AU_MSG("customer exited");
LCD_MSG("customer exited");
}
#ifndef CONFIG_RUN_IN_LCD
......
......@@ -73,12 +73,14 @@ fail1:
* OUT:
* lcd_r0 = ret val
* lcd_r1 = (cptr) to auto; used to refer to car in dealer space
* lcd_r2 = (cptr) to engine inside auto
*/
static int * dealer_buy_car_callee(void)
{
int ret;
struct automobile *a;
dsptr_t auto_dsptr;
dsptr_t engine_dsptr;
/*
* Call into internal code
*/
......@@ -89,25 +91,34 @@ static int * dealer_buy_car_callee(void)
goto fail1;
}
/*
* Alloc capability
* Alloc capabilities
*/
ret = lcd_ds_store(a, &auto_dsptr, lcd_reply_badge());
if(ret) {
LCD_ERR("store auto");
goto fail2;
}
ret = lcd_ds_store(a->engine, &engine_dsptr, lcd_reply_badge());
if(ret) {
LCD_ERR("store engine");
goto fail3;
}
/*
* Reply
*/
lcd_store_r0(0);
lcd_store_r1(auto_dsptr);
lcd_store_r2(engine_dsptr);
ret = lcd_reply();
if (ret) {
LCD_ERR("couldn't reply");
goto fail3;
goto fail4;
}
return ret;
fail4:
lcd_ds_drop(lcd_reply_badge(), engine_dsptr);
fail3:
lcd_ds_drop(lcd_reply_badge(), auto_dsptr);
fail2:
......@@ -382,7 +393,7 @@ int dealer_start(void)
*/
return execution_loop();
}
EXPORT_SYMBOL(manufacturer_start);
EXPORT_SYMBOL(dealer_start);
int __init dealer_init(void)
{
......
......@@ -4,8 +4,8 @@
*
*/
#ifndef LCD_IPC_AUTO_DEALER_IDL_H
#define LCD_IPC_AUTO_DEALER_IDL_H
#ifndef LCD_PROTOTYPE_DEALER_IDL_H
#define LCD_PROTOTYPE_DEALER_IDL_H
enum dealer_interface {
DEALER_BUY_CAR,
......
......@@ -4,8 +4,8 @@
*
*/
#ifndef LCD_IPC_AUTO_DEALER_H
#define LCD_IPC_AUTO_DEALER_H
#ifndef LCD_PROTOTYPE_DEALER_H
#define LCD_PROTOTYPE_DEALER_H
#include "../include/dstore.h"
......
......@@ -4,8 +4,8 @@
*
*/
#ifndef LCD_IPC_AUTO_MANUFACTURER_IDL_H
#define LCD_IPC_AUTO_MANUFACTURER_IDL_H
#ifndef LCD_PROTOTYPE_MANUFACTURER_IDL_H
#define LCD_PROTOTYPE_MANUFACTURER_IDL_H
enum manufacturer_interface {
MANUFACTURER_MK_ENGINE,
......
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