Files need modification, initial interface adds
authoradash <adash>
Wed, 14 Feb 2007 22:29:30 +0000 (22:29 +0000)
committeradash <adash>
Wed, 14 Feb 2007 22:29:30 +0000 (22:29 +0000)
Robust/src/Runtime/DSTM/interface/machinelookup.c [new file with mode: 0644]
Robust/src/Runtime/DSTM/interface/machinelookup.h [new file with mode: 0644]
Robust/src/Runtime/DSTM/interface/object.c [new file with mode: 0644]
Robust/src/Runtime/DSTM/interface/object.h [new file with mode: 0644]

diff --git a/Robust/src/Runtime/DSTM/interface/machinelookup.c b/Robust/src/Runtime/DSTM/interface/machinelookup.c
new file mode 100644 (file)
index 0000000..f826f20
--- /dev/null
@@ -0,0 +1,24 @@
+
+/****************************************************
+* $File: machinelookup.c
+* $Author: adash@uci.edu       
+* $Revision: 1.1 $Date:02/12/2006
+* $Description: machine/node look up table operations 
+******************************************************/
+
+#include "object.h"
+#include "machinelookup.h"
+
+void* getaddress(int o_id){
+//TODO: 1. lookup for o_id and get address)
+
+}
+
+unsigned hash(char *id) {
+       unsigned hashval;
+       for(hashval = 0; *id!= 100;  id++)
+               hashval= *id + 31 * hashval;
+       return hashval % HASHSIZE;
+}
+
+       
diff --git a/Robust/src/Runtime/DSTM/interface/machinelookup.h b/Robust/src/Runtime/DSTM/interface/machinelookup.h
new file mode 100644 (file)
index 0000000..ccf32d1
--- /dev/null
@@ -0,0 +1,25 @@
+/* This is a header file for Machine look up table */
+/***********************************************************************
+* $File: Machinelookup.h
+* $Author: adash
+* $Revision: 1.1 $Date:02/12/2006
+* $Description: This has all the definitions of a machine lookup table
+************************************************************************/
+#ifndef _machine_lookup_h_
+#define _machine_lookup_h_
+
+#define HASHSIZE 101
+
+static struct machinelookup *hashtab[HASHSIZE];
+struct machinelookup {                 //table entry
+       struct machinelookup *next;     // next  entry in table
+        int *o_id;                     //O_id of the object
+       void *ptr;                      //address of the Object
+};
+typedef struct machinelookup mlt;
+
+void * getaddress(int o_id);
+unsigned hash(char *id);
+//struct machinelookup *lookup( int *);
+
+#endif
diff --git a/Robust/src/Runtime/DSTM/interface/object.c b/Robust/src/Runtime/DSTM/interface/object.c
new file mode 100644 (file)
index 0000000..3fa1204
--- /dev/null
@@ -0,0 +1,45 @@
+/* This is the C file for the "objects" */
+
+/****************************************
+* $File: Object.c
+* $Author: adash@uci.edu       
+* $Revision: 1.1 $Date:02/12/2006
+* $Description: Header file for objects
+* ******************************************/
+
+#include "object.h"
+#include <stdio.h>
+
+unsigned int getobjid(object_t *obj) {
+       return obj->o_id;
+}
+
+short getobjversion(object_t *obj) {
+       return obj->version;
+}
+
+short getobjtype(object_t *obj) {
+       return obj->type;
+}
+
+short getobjrcount(object_t *obj) {
+       return obj->ref_count;
+} 
+
+object_t *createobject(void) {
+       /* TODO:
+          1. Create object using malloc
+          2. Assign it a unique id
+          3. Insert a new entry in machine table with <id, addr>
+          */
+}
+
+int deleteobject(object *ptr) {
+       /* TODO:
+          1. Remove entry from machine entry
+          2. Inform other machines of delete
+          3. free memory
+          4. decrement object reference count
+          */
+}
diff --git a/Robust/src/Runtime/DSTM/interface/object.h b/Robust/src/Runtime/DSTM/interface/object.h
new file mode 100644 (file)
index 0000000..9429e85
--- /dev/null
@@ -0,0 +1,27 @@
+/* This is a header file for  class objects */
+/*****************************************************
+ * $File: Object.h
+ * $Author: adash@uci.edu
+ * $Revision: 1.1 $Date:02/12/2006
+ * $Description: This has all definitions for object
+ ****************************************************/
+
+#ifndef _object_h_
+#define _object_h_
+struct object_t {
+       int o_id;
+       short version;
+       int type;
+       short ref_count;
+       char update_flag;
+};
+typedef struct object_t object_t;
+
+int getobjid(object_t *obj);
+short getobjversion(object_t *obj);
+int getobjtype(object_t *obj);
+short getobjrcount(object_t *obj);
+object_t *createobject(void);
+int deleteobject(object_t *);
+
+#endif