[Pvfs2-cvs] commit by kunkel in pvfs2/src/io/trove: trove.c trove.h trove-mgmt.c trove-error.c trove-types.h trove-internal.h

CVS commit program cvs at parl.clemson.edu
Sat Dec 2 06:20:32 EST 2006


Update of /projects/cvsroot/pvfs2/src/io/trove
In directory parlweb1:/tmp/cvs-serv18213/src/io/trove

Modified Files:
      Tag: kunkel-hint-branch
	trove.c trove.h trove-mgmt.c trove-error.c trove-types.h 
	trove-internal.h 
Log Message:
Upgrade to current CVS version


Index: trove.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove.c,v
diff -p -u -r1.10.2.2 -r1.10.2.3
--- trove.c	26 Sep 2006 13:03:09 -0000	1.10.2.2
+++ trove.c	2 Dec 2006 11:20:32 -0000	1.10.2.3
@@ -30,10 +30,11 @@ extern struct TROVE_mgmt_ops    *mgmt_me
 struct PINT_perf_counter* PINT_server_pc = NULL;
 
 int TROVE_db_cache_size_bytes = 0;
-int TROVE_alt_aio_mode = 0;
 int TROVE_shm_key_hint = 0;
 int TROVE_max_concurrent_io = 16;
 
+extern TROVE_method_callback global_trove_method_callback;
+
 /** Initiate reading from a contiguous region in a bstream into a
  *  contiguous region in memory.
  */
@@ -50,12 +51,14 @@ int trove_bstream_read_at(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return bstream_method_table[method_id]->bstream_read_at(
            coll_id,
            handle,
@@ -86,12 +89,14 @@ int trove_bstream_write_at(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return bstream_method_table[method_id]->bstream_write_at(
            coll_id,
            handle,
@@ -121,12 +126,14 @@ int trove_bstream_resize(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return bstream_method_table[method_id]->bstream_resize(
            coll_id,
            handle,
@@ -149,12 +156,14 @@ int trove_bstream_validate(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return bstream_method_table[method_id]->bstream_validate(
            coll_id,
            handle,
@@ -187,12 +196,14 @@ int trove_bstream_read_list(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return bstream_method_table[method_id]->bstream_read_list(
            coll_id,
            handle,
@@ -232,13 +243,15 @@ int trove_bstream_write_list(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
-    return bstream_method_table[method_id]->bstream_write_list(
+
+   return bstream_method_table[method_id]->bstream_write_list(
            coll_id,
            handle,
            mem_offset_array,
@@ -268,12 +281,14 @@ int trove_bstream_flush(
     TROVE_op_id* out_op_id_p,
                      PVFS_hint * hints)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return bstream_method_table[method_id]->bstream_flush(
            coll_id,
            handle,
@@ -298,19 +313,20 @@ int trove_keyval_read(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
-
-	 /* Check arguments */
-	 if (key_p->buffer_sz < 2)
-		 return -TROVE_EINVAL;
-	 if (((char *)key_p->buffer)[key_p->buffer_sz-1] != 0)
-		 return -TROVE_EINVAL;
+    TROVE_method_id method_id;
 
-	 /* Look up collection id */
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
+    /* Check arguments */
+    if (key_p->buffer_sz < 2)
+	return -TROVE_EINVAL;
+    if (((char *)key_p->buffer)[key_p->buffer_sz-1] != 0)
+	return -TROVE_EINVAL;
+
     return keyval_method_table[method_id]->keyval_read(
            coll_id,
            handle,
@@ -343,19 +359,20 @@ int trove_keyval_write(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
-
-	 /* Check arguments */
-	 if (key_p->buffer_sz < 2)
-		 return -TROVE_EINVAL;
-	 if (((char *)key_p->buffer)[key_p->buffer_sz-1] != 0)
-		 return -TROVE_EINVAL;
+    TROVE_method_id method_id;
 
-	 /* Look up collection id */
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
+    /* Check arguments */
+    if (key_p->buffer_sz < 2)
+	return -TROVE_EINVAL;
+    if (((char *)key_p->buffer)[key_p->buffer_sz-1] != 0)
+	return -TROVE_EINVAL;
+
     return keyval_method_table[method_id]->keyval_write(
            coll_id,
            handle,
@@ -383,12 +400,14 @@ int trove_keyval_remove(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return keyval_method_table[method_id]->keyval_remove(
            coll_id,
            handle,
@@ -412,12 +431,14 @@ int trove_keyval_validate(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return keyval_method_table[method_id]->keyval_validate(
            coll_id,
            handle,
@@ -443,12 +464,14 @@ int trove_keyval_iterate(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return keyval_method_table[method_id]->keyval_iterate(
            coll_id,
            handle,
@@ -477,12 +500,14 @@ int trove_keyval_iterate_keys(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return keyval_method_table[method_id]->keyval_iterate_keys(
            coll_id,
            handle,
@@ -514,23 +539,24 @@ int trove_keyval_read_list(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
-	 int i;
+    TROVE_method_id method_id;
+    int i;
 
-	 /* Check arguments */
-	 for (i = 0; i < count; i++)
-	 {
-	 	if (key_array[i].buffer_sz < 2)
-		 	return -TROVE_EINVAL;
-	 	if (((char *)key_array[i].buffer)[key_array[i].buffer_sz-1] != 0)
-		 	return -TROVE_EINVAL;
-	 }
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
+    }
 
-	 /* Look up collection id */
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    /* Check arguments */
+    for (i = 0; i < count; i++)
+    {
+	if (key_array[i].buffer_sz < 2)
+	    return -TROVE_EINVAL;
+	if (((char *)key_array[i].buffer)[key_array[i].buffer_sz-1] != 0)
+	    return -TROVE_EINVAL;
     }
+
     return keyval_method_table[method_id]->keyval_read_list(
            coll_id,
            handle,
@@ -562,23 +588,24 @@ int trove_keyval_write_list(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
-	 int i;
+    int i;
+    TROVE_method_id method_id;
 
-	 /* Check arguments */
-	 for (i = 0; i < count; i++)
-	 {
-	 	if (key_array[i].buffer_sz < 2)
-		 	return -TROVE_EINVAL;
-	 	if (((char *)key_array[i].buffer)[key_array[i].buffer_sz-1] != 0)
-		 	return -TROVE_EINVAL;
-	 }
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
+    }
 
-	 /* Look up collection id */
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    /* Check arguments */
+    for (i = 0; i < count; i++)
+    {
+	if (key_array[i].buffer_sz < 2)
+	    return -TROVE_EINVAL;
+	if (((char *)key_array[i].buffer)[key_array[i].buffer_sz-1] != 0)
+	    return -TROVE_EINVAL;
     }
+
     return keyval_method_table[method_id]->keyval_write_list(
            coll_id,
            handle,
@@ -605,12 +632,14 @@ int trove_keyval_flush(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return keyval_method_table[method_id]->keyval_flush(
            coll_id,
            handle,
@@ -630,12 +659,14 @@ int trove_keyval_get_handle_info(TROVE_c
 				 TROVE_op_id *out_op_id_p,
                  PVFS_hint * hints)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return keyval_method_table[method_id]->keyval_get_handle_info(
 	coll_id,
 	handle,
@@ -661,12 +692,14 @@ int trove_dspace_create(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return dspace_method_table[method_id]->dspace_create(
            coll_id,
            handle_extent_array,
@@ -691,12 +724,14 @@ int trove_dspace_remove(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return dspace_method_table[method_id]->dspace_remove(
            coll_id,
            handle,
@@ -718,12 +753,14 @@ int trove_dspace_iterate_handles(
     TROVE_context_id context_id,
     TROVE_op_id* out_op_id_p)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return dspace_method_table[method_id]->dspace_iterate_handles(
            coll_id,
            position_p,
@@ -746,12 +783,14 @@ int trove_dspace_verify(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return dspace_method_table[method_id]->dspace_verify(
            coll_id,
            handle,
@@ -775,12 +814,14 @@ int trove_dspace_getattr(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return dspace_method_table[method_id]->dspace_getattr(
            coll_id,
            handle,
@@ -808,17 +849,17 @@ int trove_dspace_getattr_list(
 {
     int method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
+    method_id = global_trove_method_callback(coll_id);
     if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+        return -TROVE_EINVAL;
     }
     return dspace_method_table[method_id]->dspace_getattr_list(
            coll_id,
-			  nhandles,
+	   nhandles,
            handle_array,
            ds_attr_p,
-			  error_array,
-           flags,
+	   error_array,
+	   flags,
            user_ptr,
            context_id,
            out_op_id_p,
@@ -835,12 +876,14 @@ int trove_dspace_setattr(
     TROVE_op_id* out_op_id_p,
     PVFS_hint * hints)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return dspace_method_table[method_id]->dspace_setattr(
            coll_id,
            handle,
@@ -857,12 +900,14 @@ int trove_dspace_cancel(
     TROVE_op_id id,
     TROVE_context_id context_id)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return dspace_method_table[method_id]->dspace_cancel(
            coll_id,
            id,
@@ -881,12 +926,14 @@ int trove_dspace_test(
     TROVE_ds_state* state_p,
     int max_idle_time_ms)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return dspace_method_table[method_id]->dspace_test(
            coll_id,
            id,
@@ -911,12 +958,14 @@ int trove_dspace_testsome(
     TROVE_ds_state* state_array,
     int max_idle_time_ms)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return dspace_method_table[method_id]->dspace_testsome(
            coll_id,
            context_id,
@@ -940,12 +989,14 @@ int trove_dspace_testcontext(
     int max_idle_time_ms,
     TROVE_context_id context_id)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return dspace_method_table[method_id]->dspace_testcontext(
            coll_id,
            ds_id_array,
@@ -965,12 +1016,14 @@ int trove_collection_geteattr(
     TROVE_context_id context_id,
     TROVE_op_id* out_op_id_p)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return mgmt_method_table[method_id]->collection_geteattr(
            coll_id,
            key_p,
@@ -990,12 +1043,14 @@ int trove_collection_seteattr(
     TROVE_context_id context_id,
     TROVE_op_id* out_op_id_p)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return mgmt_method_table[method_id]->collection_seteattr(
            coll_id,
            key_p,
@@ -1012,12 +1067,14 @@ int trove_collection_getinfo(
     TROVE_coll_getinfo_options opt,
     void* parameter)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return mgmt_method_table[method_id]->collection_getinfo(
            coll_id,
            context_id,
@@ -1031,7 +1088,7 @@ int trove_collection_setinfo(
     int option,
     void* parameter)
 {
-    int method_id;
+    TROVE_method_id method_id;
 
     if(option == TROVE_DB_CACHE_SIZE_BYTES)
     {
@@ -1043,22 +1100,20 @@ int trove_collection_setinfo(
         TROVE_shm_key_hint = *((int*)parameter);
 	return(0);
     }
-    if(option == TROVE_ALT_AIO_MODE)
-    {
-        TROVE_alt_aio_mode = *((int*)parameter);
-	return(0);
-    }
     if(option == TROVE_MAX_CONCURRENT_IO)
     {
         TROVE_max_concurrent_io = *((int*)parameter);
 	return(0);
     }
 
-    method_id = map_coll_id_to_method(coll_id);
-    if (method_id < 0) {
-        return -1; /* NEED STATUS TYPE FOR THIS */
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+	return -TROVE_EINVAL;
     }
+
     return mgmt_method_table[method_id]->collection_setinfo(
+	   method_id,
            coll_id,
            context_id,
            option,

Index: trove.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove.h,v
diff -p -u -r1.37.2.2 -r1.37.2.3
--- trove.h	26 Sep 2006 13:03:09 -0000	1.37.2.2
+++ trove.h	2 Dec 2006 11:20:32 -0000	1.37.2.3
@@ -92,12 +92,12 @@ enum
  *  functions.
  */
 int trove_initialize(
+    TROVE_method_id method_id,
+    TROVE_method_callback method_callback,
     char *stoname,
-    TROVE_ds_flags flags,
-    char **method_name_p,
-    int method_id);
+    TROVE_ds_flags flags);
 
-int trove_finalize(void);
+int trove_finalize(TROVE_method_id method_id);
 
 int trove_open_context(
     TROVE_coll_id coll_id,
@@ -108,11 +108,13 @@ int trove_close_context(
     TROVE_context_id context_id);
 
 int trove_storage_create(
+    TROVE_method_id method_id,
     char *stoname,
     void *user_ptr,
     TROVE_op_id *out_op_id_p);
 
 int trove_storage_remove(
+    TROVE_method_id method_id,
     char *stoname,
     void *user_ptr,
     TROVE_op_id *out_op_id_p);
@@ -125,12 +127,14 @@ int trove_collection_create(
     TROVE_op_id *out_op_id_p);
 
 int trove_collection_remove(
+    TROVE_method_id method_id,
 /* char *stoname, */
     char *collname,
     void *user_ptr,
     TROVE_op_id *out_op_id_p);
 
 int trove_collection_lookup(
+    TROVE_method_id method_id,
 /* char *stoname, */
     char *collname,
     TROVE_coll_id *out_coll_id_p,
@@ -138,6 +142,7 @@ int trove_collection_lookup(
     TROVE_op_id *out_op_id_p);
 
 int trove_collection_iterate(
+    TROVE_method_id method_id,
     TROVE_ds_position *inout_position_p,
     TROVE_keyval_s *name_array,
     TROVE_coll_id *coll_id_array,
@@ -147,7 +152,8 @@ int trove_collection_iterate(
     void *user_ptr,
     TROVE_op_id *out_op_id_p);
 
-int trove_bstream_read_at(TROVE_coll_id coll_id,
+int trove_bstream_read_at(
+                          TROVE_coll_id coll_id,
 			  TROVE_handle handle,
 			  void *buffer,
 			  TROVE_size *inout_size_p,
@@ -159,7 +165,8 @@ int trove_bstream_read_at(TROVE_coll_id 
 			  TROVE_op_id *out_op_id_p,
               PVFS_hint * hints);
 
-int trove_bstream_write_at(TROVE_coll_id coll_id,
+int trove_bstream_write_at(
+                           TROVE_coll_id coll_id,
 			   TROVE_handle handle,
 			   void *buffer,
 			   TROVE_size *inout_size_p,
@@ -171,7 +178,8 @@ int trove_bstream_write_at(TROVE_coll_id
 			   TROVE_op_id *out_op_id_p,
                PVFS_hint * hints);
 
-int trove_bstream_resize(TROVE_coll_id coll_id,
+int trove_bstream_resize(
+                         TROVE_coll_id coll_id,
 			 TROVE_handle handle,
 			 TROVE_size *inout_size_p,
 			 TROVE_ds_flags flags,
@@ -181,7 +189,8 @@ int trove_bstream_resize(TROVE_coll_id c
 			 TROVE_op_id *out_op_id_p,
              PVFS_hint * hints);
 
-int trove_bstream_validate(TROVE_coll_id coll_id,
+int trove_bstream_validate(
+                           TROVE_coll_id coll_id,
 			   TROVE_handle handle,
 			   TROVE_ds_flags flags,
 			   TROVE_vtag_s *vtag,
@@ -190,7 +199,8 @@ int trove_bstream_validate(TROVE_coll_id
 			   TROVE_op_id *out_op_id_p,
                PVFS_hint * hints);
 
-int trove_bstream_read_list(TROVE_coll_id coll_id,
+int trove_bstream_read_list(
+                            TROVE_coll_id coll_id,
 			    TROVE_handle handle,
 			    char **mem_offset_array, 
 			    TROVE_size *mem_size_array,
@@ -206,7 +216,8 @@ int trove_bstream_read_list(TROVE_coll_i
 			    TROVE_op_id *out_op_id_p,
                 PVFS_hint * hints);
 
-int trove_bstream_write_list(TROVE_coll_id coll_id,
+int trove_bstream_write_list(
+                             TROVE_coll_id coll_id,
 			     TROVE_handle handle,
 			     char **mem_offset_array, 
 			     TROVE_size *mem_size_array,
@@ -223,7 +234,7 @@ int trove_bstream_write_list(TROVE_coll_
                  PVFS_hint * hints);
 
 int trove_bstream_flush(TROVE_coll_id coll_id,
-			TROVE_handle handle,
+                        TROVE_handle handle,
 			TROVE_ds_flags flags,
 			void *user_ptr,
 			TROVE_context_id context_id,
@@ -303,8 +314,7 @@ int trove_keyval_iterate_keys(
 			      TROVE_op_id *out_op_id_p,
                   PVFS_hint * hints);
 
-int trove_keyval_read_list(
-			   TROVE_coll_id coll_id,
+int trove_keyval_read_list(TROVE_coll_id coll_id,
 			   TROVE_handle handle,
 			   TROVE_keyval_s *key_array,
 			   TROVE_keyval_s *val_array,
@@ -360,7 +370,7 @@ int trove_dspace_create(TROVE_coll_id co
 
 int trove_dspace_remove(TROVE_coll_id coll_id,
 			TROVE_handle handle,
-			TROVE_ds_flags flags,
+                        TROVE_ds_flags flags,
 			void *user_ptr,
 			TROVE_context_id context_id,
 			TROVE_op_id *out_op_id_p,

Index: trove-mgmt.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-mgmt.c,v
diff -p -u -r1.28 -r1.28.40.1
--- trove-mgmt.c	15 Oct 2004 20:33:44 -0000	1.28
+++ trove-mgmt.c	2 Dec 2006 11:20:32 -0000	1.28.40.1
@@ -12,20 +12,49 @@
 #include "gen-locks.h"
 #include "trove-handle-mgmt/trove-handle-mgmt.h"
 
-/* currently we only have one method for these tables to refer to */
-struct TROVE_mgmt_ops *mgmt_method_table[1];
-struct TROVE_dspace_ops *dspace_method_table[1];
-struct TROVE_keyval_ops *keyval_method_table[1];
-struct TROVE_bstream_ops *bstream_method_table[1];
-struct TROVE_context_ops *context_method_table[1];
+TROVE_method_callback global_trove_method_callback;
+
+static TROVE_method_id TROVE_default_method(TROVE_coll_id id);
 
-/* currently DBPF is our only implementation */
 extern struct TROVE_mgmt_ops dbpf_mgmt_ops;
 extern struct TROVE_dspace_ops dbpf_dspace_ops;
 extern struct TROVE_keyval_ops dbpf_keyval_ops;
 extern struct TROVE_bstream_ops dbpf_bstream_ops;
 extern struct TROVE_context_ops dbpf_context_ops;
 
+extern struct TROVE_bstream_ops alt_aio_bstream_ops;
+
+/* currently we only have one method for these tables to refer to */
+struct TROVE_mgmt_ops *mgmt_method_table[] =
+{
+    &dbpf_mgmt_ops,
+    &dbpf_mgmt_ops /* alt-aio */
+};
+
+struct TROVE_dspace_ops *dspace_method_table[] =
+{
+    &dbpf_dspace_ops,
+    &dbpf_dspace_ops /* alt-aio */
+};
+
+struct TROVE_keyval_ops *keyval_method_table[] =
+{
+    &dbpf_keyval_ops,
+    &dbpf_keyval_ops /* alt-aio */
+};
+
+struct TROVE_bstream_ops *bstream_method_table[] =
+{
+    &dbpf_bstream_ops,
+    &alt_aio_bstream_ops
+};
+
+struct TROVE_context_ops *context_method_table[] =
+{
+    &dbpf_context_ops,
+    &dbpf_context_ops /* alt-aio */
+};
+
 /* trove_init_mutex, trove_init_status
  *
  * These two are used to ensure that trove is only initialized once.
@@ -42,13 +71,12 @@ static int trove_init_status = 0;
  * success.  This is in keeping with the "1 is immediate succcess"
  * semantic for return values used throughout trove.
  */
-int trove_initialize(char *stoname,
-                     TROVE_ds_flags flags,
-                     char **method_name_p,
-                     int method_id)
+int trove_initialize(TROVE_method_id method_id,
+                     TROVE_method_callback method_callback,
+                     char *stoname,
+                     TROVE_ds_flags flags)
 {
     int ret = -TROVE_EALREADY;
-    char *ret_method_name_p = NULL;
 
     gen_mutex_lock(&trove_init_mutex);
     if (trove_init_status)
@@ -63,21 +91,24 @@ int trove_initialize(char *stoname,
         return ret;
     }
 
-    mgmt_method_table[0] = &dbpf_mgmt_ops;
-    dspace_method_table[0] = &dbpf_dspace_ops;
-    keyval_method_table[0] = &dbpf_keyval_ops;
-    bstream_method_table[0] = &dbpf_bstream_ops;
-    context_method_table[0] = &dbpf_context_ops;
+    if(!method_callback)
+    {
+        global_trove_method_callback = TROVE_default_method;
+    }
+    else
+    {
+        global_trove_method_callback = method_callback;
+    }
 
     /*
       for each underlying method, call its initialize function.
       initialize can fail if storage name isn't valid, but we want
       those op pointers to be right either way.
     */
-    ret = dbpf_mgmt_ops.initialize(stoname, flags, &ret_method_name_p, 0);
+    ret = mgmt_method_table[method_id]->initialize(
+        stoname, flags);
     if (ret > -1)
     {
-        free(ret_method_name_p);
         ret = 1;
         trove_init_status = 1;
     }
@@ -85,7 +116,7 @@ int trove_initialize(char *stoname,
     return ret;
 }
 
-int trove_finalize(void)
+int trove_finalize(TROVE_method_id method_id)
 {
     int ret = -TROVE_EALREADY;
 
@@ -100,7 +131,7 @@ int trove_finalize(void)
         trove_init_status = 0;
     }
 
-    ret = mgmt_method_table[0]->finalize();
+    ret = mgmt_method_table[method_id]->finalize();
 
     ret = trove_handle_mgmt_finalize();
 
@@ -109,22 +140,24 @@ int trove_finalize(void)
     return ((ret < 0) ? ret : 1);
 }
 
-int trove_storage_create(char *stoname,
+int trove_storage_create(TROVE_method_id method_id,
+                         char *stoname,
                          void *user_ptr,
                          TROVE_op_id *out_op_id_p)
 {
-    int ret = mgmt_method_table[0]->storage_create(
+    int ret = mgmt_method_table[method_id]->storage_create(
         stoname, user_ptr, out_op_id_p);
 
     return ((ret < 0) ? ret : 1);
 }
 
 
-int trove_storage_remove(char *stoname,
+int trove_storage_remove(TROVE_method_id method_id,
+                         char *stoname,
                          void *user_ptr,
                          TROVE_op_id *out_op_id_p)
 {
-    int ret = mgmt_method_table[0]->storage_remove(
+    int ret = mgmt_method_table[method_id]->storage_remove(
         stoname, user_ptr, out_op_id_p);
 
     return ((ret < 0) ? ret : 1);
@@ -135,6 +168,7 @@ int trove_collection_create(char *collna
                             void *user_ptr,
                             TROVE_op_id *out_op_id_p)
 {
+    TROVE_method_id method_id;
     int ret = -TROVE_EINVAL;
 
     if (new_coll_id == TROVE_COLL_ID_NULL)
@@ -143,34 +177,38 @@ int trove_collection_create(char *collna
         return ret;
     }
 
-    ret = mgmt_method_table[0]->collection_create(
+    method_id = global_trove_method_callback(new_coll_id);
+    ret = mgmt_method_table[method_id]->collection_create(
         collname, new_coll_id, user_ptr, out_op_id_p);
 
     return ((ret < 0) ? ret : 1);
 }
 
-int trove_collection_remove(char *collname,
+int trove_collection_remove(TROVE_method_id method_id,
+                            char *collname,
                             void *user_ptr,
                             TROVE_op_id *out_op_id_p)
 {
-    int ret = mgmt_method_table[0]->collection_remove(
+    int ret = mgmt_method_table[method_id]->collection_remove(
         collname, user_ptr, out_op_id_p);
 
     return ((ret < 0) ? ret : 1);
 }
 
-int trove_collection_lookup(char *collname,
+int trove_collection_lookup(TROVE_method_id method_id,
+                            char *collname,
                             TROVE_coll_id *coll_id_p,
                             void *user_ptr,
                             TROVE_op_id *out_op_id_p)
 {
-    int ret = mgmt_method_table[0]->collection_lookup(
+    int ret = mgmt_method_table[method_id]->collection_lookup(
         collname, coll_id_p, user_ptr, out_op_id_p);
 
     return ((ret < 0) ? ret : 1);
 }
 
-int trove_collection_iterate(TROVE_ds_position *inout_position_p,
+int trove_collection_iterate(TROVE_method_id method_id,
+                             TROVE_ds_position *inout_position_p,
                              TROVE_keyval_s *name_array,
                              TROVE_coll_id *coll_id_array,
                              int *inout_count_p,
@@ -179,7 +217,7 @@ int trove_collection_iterate(TROVE_ds_po
                              void *user_ptr,
                              TROVE_op_id *out_op_id_p)
 {
-    int ret = mgmt_method_table[0]->collection_iterate(
+    int ret = mgmt_method_table[method_id]->collection_iterate(
         inout_position_p, name_array, coll_id_array, inout_count_p,
         flags, vtag, user_ptr, out_op_id_p);
 
@@ -190,8 +228,14 @@ int trove_open_context(
     TROVE_coll_id coll_id,
     TROVE_context_id *context_id)
 {
+    TROVE_method_id method_id;
     int ret = 0;
-    int method_id = map_coll_id_to_method(coll_id);
+
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+        return -TROVE_EINVAL;
+    }
 
     if (trove_init_status != 0)
     {
@@ -205,8 +249,14 @@ int trove_close_context(
     TROVE_coll_id coll_id,
     TROVE_context_id context_id)
 {
+    TROVE_method_id method_id;
     int ret = 0;
-    int method_id = map_coll_id_to_method(coll_id);
+
+    method_id = global_trove_method_callback(coll_id);
+    if(method_id < 0)
+    {
+        return -TROVE_EINVAL;
+    }
 
     if (trove_init_status != 0)
     {
@@ -216,13 +266,9 @@ int trove_close_context(
     return ret;
 }
 
-/* map_coll_id_to_method()
- *
- * NOTE: this is a hack for now.
- */
-int map_coll_id_to_method(int coll_id)
+static TROVE_method_id TROVE_default_method(TROVE_coll_id id)
 {
-    return 0;
+    return TROVE_METHOD_DBPF;
 }
 
 /*

Index: trove-error.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-error.c,v
diff -p -u -r1.7 -r1.7.40.1
--- trove-error.c	15 Oct 2004 20:33:44 -0000	1.7
+++ trove-error.c	2 Dec 2006 11:20:32 -0000	1.7.40.1
@@ -75,6 +75,7 @@ static __trove_errno_mapping_t s_trove_e
     { EHOSTUNREACH, TROVE_EHOSTUNREACH },
     { EALREADY, TROVE_EALREADY },
     { ECANCELED, TROVE_ECANCEL },
+    { EACCES, TROVE_EACCES },
     { 0, 0 }
 };
 
@@ -96,7 +97,7 @@ PVFS_error trove_errno_to_trove_error(in
             return s_trove_error_map[i].trove_value;
         }
     }
-    return -4242; /* just return some identifiable number */
+    return 4242; /* just return some identifiable number */
 }
 
 /*

Index: trove-types.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-types.h,v
diff -p -u -r1.31 -r1.31.6.1
--- trove-types.h	14 Jun 2006 18:41:25 -0000	1.31
+++ trove-types.h	2 Dec 2006 11:20:32 -0000	1.31.6.1
@@ -48,6 +48,14 @@ typedef PVFS_statfs		   TROVE_statfs;
 typedef PVFS_coll_getinfo_options  TROVE_coll_getinfo_options;
 typedef PVFS_object_ref            TROVE_object_ref;
 
+typedef enum
+{
+    TROVE_METHOD_DBPF = 0,
+    TROVE_METHOD_DBPF_ALTAIO
+} TROVE_method_id;
+
+typedef TROVE_method_id (*TROVE_method_callback)(TROVE_coll_id);
+
 #define TROVE_HANDLE_NULL          PVFS_HANDLE_NULL
 #define TROVE_COLL_ID_NULL         PVFS_FS_ID_NULL
 
@@ -116,6 +124,7 @@ typedef PVFS_object_ref            TROVE
 #define TROVE_ENOMEDIUM       (PVFS_ENOMEDIUM | PVFS_ERROR_TROVE)
 #define TROVE_EMEDIUMTYPE     (PVFS_EMEDIUMTYPE | PVFS_ERROR_TROVE)
 #define TROVE_ECANCEL         (PVFS_ECANCEL | PVFS_ERROR_TROVE)
+#define TROVE_EACCES          (PVFS_EACCES | PVFS_ERROR_TROVE)
 
 #endif
 

Index: trove-internal.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-internal.h,v
diff -p -u -r1.23.6.2 -r1.23.6.3
--- trove-internal.h	26 Sep 2006 13:03:09 -0000	1.23.6.2
+++ trove-internal.h	2 Dec 2006 11:20:32 -0000	1.23.6.3
@@ -9,8 +9,6 @@
 
 #include "trove-types.h"
 
-int map_coll_id_to_method(int coll_id);
-
 PVFS_error trove_errno_to_trove_error(int errno_value);
 
 
@@ -347,9 +345,7 @@ struct TROVE_mgmt_ops
 {
     int (*initialize)(
 		      char *stoname,
-		      TROVE_ds_flags flags,
-		      char **method_name_p,
-		      int method_id);
+		      TROVE_ds_flags flags);
     
     int (*finalize)(void);
     
@@ -394,6 +390,7 @@ struct TROVE_mgmt_ops
 
     /* Note: setinfo and getinfo always return immediately */
     int (*collection_setinfo)(
+                              TROVE_method_id method_id,
 			      TROVE_coll_id coll_id,
 			      TROVE_context_id context_id,
 			      int option,



More information about the Pvfs2-cvs mailing list