diff options
author | Alexis211 <alexis211@gmail.com> | 2010-09-10 19:35:31 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2010-09-10 19:35:31 +0200 |
commit | a8da6dba7ddc5e3d31a1914597e7b38fbc2d197c (patch) | |
tree | fbef80d474e5b9c891e0eb353cfa602acf67fdae /src/include | |
parent | aba6ed4b91aff5d914be11704e34de75bfd4d003 (diff) | |
download | TCE-a8da6dba7ddc5e3d31a1914597e7b38fbc2d197c.tar.gz TCE-a8da6dba7ddc5e3d31a1914597e7b38fbc2d197c.zip |
Removed all old object/request/... stuff (that was crap)
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gc/obj.h | 10 | ||||
-rw-r--r-- | src/include/gc/server.h | 90 | ||||
-rw-r--r-- | src/include/gc/syscall.h | 12 | ||||
-rw-r--r-- | src/include/gm/call.h | 18 | ||||
-rw-r--r-- | src/include/gm/call/manager.h | 14 | ||||
-rw-r--r-- | src/include/gm/method.h | 27 | ||||
-rw-r--r-- | src/include/gm/method/manager.h | 20 |
7 files changed, 2 insertions, 189 deletions
diff --git a/src/include/gc/obj.h b/src/include/gc/obj.h deleted file mode 100644 index fcb60cd..0000000 --- a/src/include/gc/obj.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef DEF_OBJ_H -#define DEF_OBJ_H - -// generic method error codes -#define ME_UNHANDLED -32767 -#define ME_INTERRUPTED -32766 - -typedef int Object; - -#endif diff --git a/src/include/gc/server.h b/src/include/gc/server.h deleted file mode 100644 index 3612a1d..0000000 --- a/src/include/gc/server.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef DEF_SERVER_H -#define DEF_SERVER_H - -#include "syscall.h" -#include "obj.h" - -//parameter/return values types -#define PT_VOID 0 -#define PT_OBJDESC 1 -#define PT_LONG 2 -#define PT_LONGLONG 3 //for return values -#define PT_SHM 3 - -struct method_data { - struct { - union { - int i; - void* p; - }; - int type; - int keepShm; //for messages : keep shared memory segment after return or unmap ? (default : 0 = unmap) - size_t shmsize; - } parameters[3]; - uint32_t func; - int pid; - int blocking; //1 : blocking request, 0 : message - struct object_srv *obj; -}; - -struct method_ret { - union { - int i; - int64_t l; - }; - int type; - int status; //= error code if any -}; - -//helper function for creating return values -struct method_ret mr_long(int val); -struct method_ret mr_llong(int64_t val); -struct method_ret mr_obj(Object obj); -struct method_ret mr_srv(struct object_srv* obj); -struct method_ret mr_void(); -struct method_ret mr_err(int error); - -// for checking if a string passed in shared memory is valid -#define CHKSSTR(md, n) { size_t _i, _ok = 0; if (md->parameters[n].p == 0) return mr_err(-1); \ - for (_i = 0; _i < md->parameters[n].shmsize; _i++) { \ - if (*((char*)md->parameters[n].p + _i) == 0) { \ - _ok = 1; break; \ - } } \ - if (!_ok && md->parameters[n].shmsize != 0) return mr_err(-1); } - -typedef struct method_ret (*method_handler)(struct method_data*); - -struct method_srv { - uint32_t id; - method_handler h; - - struct method_srv *next; -}; - -struct object_srv { - int id; //descriptor - struct method_srv *methods; - - void *data; - - struct object_srv *next; -}; - -typedef struct object_srv Server; - -extern Server procServer; //corresponds to descriptor 0. - -//possible actions for srv_handle -#define HA_ONCE 1 //check if requests are waiting, if so handle them -#define HA_WAIT 2 //check if requests are waiting, if so handle them, else wait for one to come and handle it -#define HA_LOOP 3 //wait for requests to come, handling them in an infinite loop - -void srv_handleAll(); //check all objects once -void srv_handle(Server* o, int act); - -Server *srv_create(); -void srv_delete(Server *o); -Server *srv_get(int descriptor); -void srv_addHandler(Server* o, uint32_t method, method_handler h); - -#endif diff --git a/src/include/gc/syscall.h b/src/include/gc/syscall.h index e6005c1..a8928e3 100644 --- a/src/include/gc/syscall.h +++ b/src/include/gc/syscall.h @@ -35,17 +35,9 @@ void printk(char* str); void thread_new(void (*entry)(void*), void *data); void irq_wait(int number); int proc_priv(); + +int proc_setheap(size_t start, size_t end); int shm_create(size_t offset, size_t length); int shm_delete(size_t offset); -int object_create(); -int object_owned(int descriptor); -void object_close(int descriptor); -int request_get(int descriptor, struct user_request *rq, int wait); -int request_has(int descriptor); -void request_answer(int descriptor, uint32_t answer1, uint32_t answer2, int errcode); -int request_mapShm(int descriptor, size_t offset, int number); -int request(int descriptor, struct user_sendrequest *rq); -int send_msg(int descriptor, struct user_sendrequest *rq); -int proc_setheap(size_t start, size_t end); #endif diff --git a/src/include/gm/call.h b/src/include/gm/call.h deleted file mode 100644 index 5c3849d..0000000 --- a/src/include/gm/call.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef DEF_CALL_H -#define DEF_CALL_H - -/* - * This file and all files in include/call/ define prototypes to helper functions for calling methods on objects. - */ - -#include <gc/obj.h> - -#define _CHP Object o, int block -#define _CHC if (block) request(o, &sr); else send_msg(o, &sr); - -int c_handleCheck(_CHP, int method); -int c_handleCheckA(_CHP, int* methods, int number); - -int c_nothing(_CHP); - -#endif diff --git a/src/include/gm/call/manager.h b/src/include/gm/call/manager.h deleted file mode 100644 index 49aafe7..0000000 --- a/src/include/gm/call/manager.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef DEF_CALL_MANAGER_H -#define DEF_CALL_MANAGER_H - -#include <gm/call.h> -#include <gc/obj.h> - -Object c_open(_CHP, char *c); -Object open(char *c); //calls c_open with object 1 - -void c_registerSvc(char *name); //automatically calls with objecct id 0 - -void c_logSvc(char *log, int level); - -#endif diff --git a/src/include/gm/method.h b/src/include/gm/method.h deleted file mode 100644 index 13d3f16..0000000 --- a/src/include/gm/method.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef DEF_METHOD_H -#define DEF_METHOD_H - -#define MP(r, a, b, c) (((r << 6) | (a << 4) | (b << 2) | c) << 24) - -/* ****** FORMAT FOR #define NAMES : ****** - * M_<method_name>_<ret><param1><param2><param3> - * where ret, param1, param2 and param3 are one of the following : - * - V (0) : nothing (void) - * - O (1) : object descriptor - * - I (2) : int - * - B (2) : int used as a boolean (0 = no, 1 = yes) - * - M (3) : shared memory, only for parameters - * - L (3) : int64 (long long), only for return values - */ - -#define M_HANDLECHECK_BIVV (1 | MP(2, 2, 0, 0)) -#define M_HANDLECHECK_BMIV (1 | MP(2, 3, 2, 0)) -/* Checks if object handles that method. In case BIVV, only one method is checked for. - * In case BMIV, the [b] methods in shared memory [a] are checked, first one not found returns false. */ - -#define M_NOTHING_VVVV (2) -/* This method does nothing, it just checks message transmission to an object. */ - -#include "method/manager.h" - -#endif diff --git a/src/include/gm/method/manager.h b/src/include/gm/method/manager.h deleted file mode 100644 index 2066093..0000000 --- a/src/include/gm/method/manager.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifdef DEF_METHOD_H - -#define M_OPEN_OMVV (10 | MP(1, 3, 0, 0)) -/* This function opens a distant ressource. Example : open("file:Root/Public/test.txt"); */ - -#define M_REGISTERSVC_VMOV (11 | MP(0, 3, 1, 0)) -/* This function registers a service. - * parameter 1 : service name; - * parameter 2 : service root object. */ - -#define M_LOGSVC_VMIV (12 | MP(0, 3, 2, 0)) -/* This parameters logs an entry for service with corresponding PID. Parameter 2 is : */ -#define LL_CRITICAL 0 -#define LL_ERROR 1 -#define LL_WARNING 2 -#define LL_NOTICE 3 -#define LL_STATUS 4 -#define LL_DEBUG 5 - -#endif |