[PVFS2-CVS] commit by slang in pvfs2/src/common/misc: pint-cached-config.c pint-cached-config.h pint-util.c pvfs2-util.c server-config.c server-config.h state-machine-fns.h str-utils.c str-utils.h

CVS commit program cvs at parl.clemson.edu
Tue Aug 23 15:44:17 EDT 2005


Update of /projects/cvsroot/pvfs2/src/common/misc
In directory parlweb:/tmp/cvs-serv20354/src/common/misc

Modified Files:
	pint-cached-config.c pint-cached-config.h pint-util.c 
	pvfs2-util.c server-config.c server-config.h 
	state-machine-fns.h str-utils.c str-utils.h 
Log Message:
merged acache changes to trunk.


Index: pint-cached-config.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pint-cached-config.c,v
diff -p -u -r1.14 -r1.15
--- pint-cached-config.c	29 Jun 2005 20:39:24 -0000	1.14
+++ pint-cached-config.c	23 Aug 2005 18:44:17 -0000	1.15
@@ -899,6 +899,32 @@ int PINT_cached_config_get_root_handle(
     return ret;
 }
 
+int PINT_cached_config_get_handle_timeout(
+    PVFS_fs_id fsid,
+    struct timeval *timeout)
+{
+    int ret = -PVFS_EINVAL;
+    struct qlist_head *hash_link = NULL;
+    struct config_fs_cache_s *cur_config_cache = NULL;
+
+    hash_link = qhash_search(PINT_fsid_config_cache_table, &(fsid));
+    if(hash_link)
+    {
+        cur_config_cache = qlist_entry(
+            hash_link, struct config_fs_cache_s, hash_link);
+
+        assert(cur_config_cache);
+        assert(cur_config_cache->fs);
+
+        timeout->tv_sec = 
+            cur_config_cache->fs->handle_recycle_timeout_sec.tv_sec;
+        timeout->tv_usec =
+            cur_config_cache->fs->handle_recycle_timeout_sec.tv_usec;
+        ret = 0;
+    }
+    return ret;
+}
+
 /* cache_server_array()
  *
  * verifies that the arrays of physical server addresses have been

Index: pint-cached-config.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pint-cached-config.h,v
diff -p -u -r1.6 -r1.7
--- pint-cached-config.h	10 Aug 2004 20:30:55 -0000	1.6
+++ pint-cached-config.h	23 Aug 2005 18:44:17 -0000	1.7
@@ -99,6 +99,13 @@ int PINT_cached_config_get_root_handle(
     PVFS_fs_id fsid,
     PVFS_handle *fh_root);
 
+int PINT_cached_config_get_handle_timeout(
+    PVFS_fs_id fsid,
+    struct timeval *timeout);
+
+int PINT_cached_config_reinitialize(
+    struct server_configuration_s *config);
+
 #define map_handle_range_to_extent_list(hrange_list)             \
 do { cur = hrange_list;                                          \
  while(cur) {                                                    \

Index: pint-util.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pint-util.c,v
diff -p -u -r1.8 -r1.9
--- pint-util.c	11 Jul 2005 20:06:23 -0000	1.8
+++ pint-util.c	23 Aug 2005 18:44:17 -0000	1.9
@@ -156,53 +156,53 @@ int PINT_copy_object_attr(PVFS_object_at
         }
 
 	if ((src->mask & PVFS_ATTR_COMMON_TYPE) &&
-            (src->objtype == PVFS_TYPE_METAFILE) &&
-            (src->mask & PVFS_ATTR_META_DFILES))
-	{
-	    PVFS_size df_array_size = src->u.meta.dfile_count *
-                sizeof(PVFS_handle);
-
-            if (df_array_size)
+            (src->objtype == PVFS_TYPE_METAFILE))
+        {      
+            if(src->mask & PVFS_ATTR_META_DFILES)
             {
-		if ((dest->mask & PVFS_ATTR_META_DFILES) &&
-		    dest->u.meta.dfile_count > 0)
+                PVFS_size df_array_size = src->u.meta.dfile_count *
+                    sizeof(PVFS_handle);
+
+                if (df_array_size)
                 {
-                    if (dest->u.meta.dfile_array)
+                    if ((dest->mask & PVFS_ATTR_META_DFILES) &&
+                        dest->u.meta.dfile_count > 0)
                     {
-                        free(dest->u.meta.dfile_array);
+                        if (dest->u.meta.dfile_array)
+                        {
+                            free(dest->u.meta.dfile_array);
+                        }
                     }
+                    dest->u.meta.dfile_array = malloc(df_array_size);
+                    if (!dest->u.meta.dfile_array)
+                    {
+                        return ret;
+                    }
+                    memcpy(dest->u.meta.dfile_array,
+                           src->u.meta.dfile_array, df_array_size);
                 }
-		dest->u.meta.dfile_array = malloc(df_array_size);
-		if (!dest->u.meta.dfile_array)
-		{
-                    return ret;
-		}
-		memcpy(dest->u.meta.dfile_array,
-                       src->u.meta.dfile_array, df_array_size);
-	    }
-            else
-            {
-		dest->u.meta.dfile_array = NULL;
-	    }
-	    dest->u.meta.dfile_count = src->u.meta.dfile_count;
-	}
-
-	if ((src->mask & PVFS_ATTR_COMMON_TYPE) &&
-            (src->objtype == PVFS_TYPE_METAFILE) &&
-            (src->mask & PVFS_ATTR_META_DIST))
-	{
-            assert(src->u.meta.dist_size > 0);
-
-	    if ((dest->mask & PVFS_ATTR_META_DIST))
-            {
-                PINT_dist_free(dest->u.meta.dist);
+                else
+                {
+                    dest->u.meta.dfile_array = NULL;
+                }
+                dest->u.meta.dfile_count = src->u.meta.dfile_count;
             }
-            dest->u.meta.dist = PINT_dist_copy(src->u.meta.dist);
-            if (dest->u.meta.dist == NULL)
+
+            if(src->mask & PVFS_ATTR_META_DIST)
             {
-                return ret;
+                assert(src->u.meta.dist_size > 0);
+
+                if ((dest->mask & PVFS_ATTR_META_DIST))
+                {
+                    PINT_dist_free(dest->u.meta.dist);
+                }
+                dest->u.meta.dist = PINT_dist_copy(src->u.meta.dist);
+                if (dest->u.meta.dist == NULL)
+                {
+                    return ret;
+                }
+                dest->u.meta.dist_size = src->u.meta.dist_size;
             }
-            dest->u.meta.dist_size = src->u.meta.dist_size;
         }
 
         if (src->mask & PVFS_ATTR_SYMLNK_TARGET)

Index: pvfs2-util.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pvfs2-util.c,v
diff -p -u -r1.78 -r1.79
--- pvfs2-util.c	15 Aug 2005 21:16:25 -0000	1.78
+++ pvfs2-util.c	23 Aug 2005 18:44:17 -0000	1.79
@@ -24,6 +24,8 @@
 #include "pvfs2-util.h"
 #include "pvfs2-debug.h"
 #include "gossip.h"
+#include "pvfs2-attr.h"
+#include "pvfs2-types-debug.h"
 #include "str-utils.h"
 #include "gen-locks.h"
 #include "realpath.h"
@@ -132,17 +134,17 @@ int PVFS_util_copy_sys_attr(
         dest_attr->objtype = src_attr->objtype;
         dest_attr->mask = src_attr->mask;
 
-        if ((src_attr->mask & PVFS_ATTR_COMMON_TYPE) &&
-            (src_attr->objtype == PVFS_TYPE_SYMLINK) &&
+        if((src_attr->mask & PVFS_ATTR_SYS_LNK_TARGET) &&
             src_attr->link_target)
         {
             dest_attr->link_target = strdup(src_attr->link_target);
             if (!dest_attr->link_target)
             {
                 ret = -PVFS_ENOMEM;
+                return ret;
             }
-            ret = 0;
         }
+        ret = 0;
     }
     return ret;
 }
@@ -151,7 +153,7 @@ void PVFS_util_release_sys_attr(PVFS_sys
 {
     if (attr)
     {
-        if ((attr->mask & PVFS_ATTR_COMMON_TYPE) &&
+        if ((attr->mask & PVFS_ATTR_SYS_TYPE) &&
             (attr->objtype == PVFS_TYPE_SYMLINK) && attr->link_target)
         {
             free(attr->link_target);
@@ -1125,11 +1127,7 @@ static int parse_flowproto_string(
         comma[0] = '\0';
     }
 
-    if (!strcmp(flow, "bmi_trove"))
-    {
-        *flowproto = FLOWPROTO_BMI_TROVE;
-    }
-    else if (!strcmp(flow, "dump_offsets"))
+    if (!strcmp(flow, "dump_offsets"))
     {
         *flowproto = FLOWPROTO_DUMP_OFFSETS;
     }
@@ -1397,6 +1395,86 @@ void PINT_release_pvfstab(void)
     }
 
     gen_mutex_unlock(&s_stat_tab_mutex);
+}
+
+inline uint32_t PVFS_util_sys_to_object_attr_mask(
+    uint32_t sys_attrmask)
+{
+
+    /*
+      adjust parameters as necessary; what's happening here
+      is that we're converting sys_attr masks to obj_attr masks
+      before passing the getattr request to the server.
+    */
+    uint32_t attrmask = 0;
+    if (sys_attrmask & PVFS_ATTR_SYS_SIZE)
+    {
+        /* need datafile handles and distribution in order to get 
+         * datafile handles and know what function to call to get
+         * the file size.
+         */
+        attrmask |= (PVFS_ATTR_META_ALL | PVFS_ATTR_DATA_SIZE);
+    }
+
+    if (sys_attrmask & PVFS_ATTR_SYS_DFILE_COUNT)
+    {
+        attrmask |= PVFS_ATTR_META_DFILES;
+    }
+
+    if (sys_attrmask & PVFS_ATTR_SYS_LNK_TARGET)
+    {
+        attrmask |= PVFS_ATTR_SYMLNK_TARGET;
+    }
+
+    gossip_debug(GOSSIP_GETATTR_DEBUG,
+                 "attrmask being passed to server: ");
+    PINT_attrmask_print(GOSSIP_GETATTR_DEBUG, attrmask);
+
+    return attrmask;
+}
+
+inline uint32_t PVFS_util_object_to_sys_attr_mask( 
+    uint32_t obj_mask)
+{
+    int sys_mask = 0;
+
+    if (obj_mask & PVFS_ATTR_COMMON_UID)
+    {
+        sys_mask |= PVFS_ATTR_SYS_UID;
+    }
+    if (obj_mask & PVFS_ATTR_COMMON_GID)
+    {
+        sys_mask |= PVFS_ATTR_SYS_GID;
+    }
+    if (obj_mask & PVFS_ATTR_COMMON_PERM)
+    {
+        sys_mask |= PVFS_ATTR_SYS_PERM;
+    }
+    if (obj_mask & PVFS_ATTR_COMMON_ATIME)
+    {
+        sys_mask |= PVFS_ATTR_SYS_ATIME;
+    }
+    if (obj_mask & PVFS_ATTR_COMMON_CTIME)
+    {
+        sys_mask |= PVFS_ATTR_SYS_CTIME;
+    }
+    if (obj_mask & PVFS_ATTR_COMMON_MTIME)
+    {
+        sys_mask |= PVFS_ATTR_SYS_MTIME;
+    }
+    if (obj_mask & PVFS_ATTR_COMMON_TYPE)
+    {
+        sys_mask |= PVFS_ATTR_SYS_TYPE;
+    }
+    if (obj_mask & PVFS_ATTR_DATA_SIZE)
+    {
+        sys_mask |= PVFS_ATTR_DATA_SIZE;
+    }
+    if (obj_mask & PVFS_ATTR_SYMLNK_TARGET)
+    {
+        sys_mask |= PVFS_ATTR_SYS_LNK_TARGET;
+    }
+    return sys_mask;
 }
 
 /*

Index: server-config.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/server-config.c,v
diff -p -u -r1.71 -r1.72
--- server-config.c	19 Jul 2005 21:12:46 -0000	1.71
+++ server-config.c	23 Aug 2005 18:44:17 -0000	1.72
@@ -69,9 +69,10 @@ static DOTCONF_CB(get_client_job_flow_ti
 static DOTCONF_CB(get_client_retry_limit);
 static DOTCONF_CB(get_client_retry_delay);
 static FUNC_ERRORHANDLER(errorhandler);
+const char *contextchecker(command_t *cmd, unsigned long mask);
 
 /* internal helper functions */
-static int is_valid_alias(char *str);
+static int is_valid_alias(PINT_llist * host_aliases, char *str);
 static int is_valid_handle_range_description(char *h_range);
 static void free_host_handle_mapping(void *ptr);
 static void free_host_alias(void *ptr);
@@ -80,6 +81,7 @@ static void copy_filesystem(
     struct filesystem_configuration_s *dest_fs,
     struct filesystem_configuration_s *src_fs);
 static int cache_config_files(
+    struct server_configuration_s *config_s,
     char *global_config_filename,
     char *server_config_filename);
 static int is_populated_filesystem_configuration(
@@ -110,54 +112,440 @@ static int is_root_handle_in_my_range(
     struct filesystem_configuration_s *fs);
 #endif
 
-static struct server_configuration_s *config_s = NULL;
-
+/* 
+ * NOTE: The documentation for the server config format is generated
+ * from the following static array.  The documentation for an option
+ * is taken from the comments found before the beginning of each sub-structure
+ * as shown.
+ */
 static const configoption_t options[] =
 {
-    {"HostID",ARG_STR, get_pvfs_server_id,NULL,CTX_ALL},
-    {"StorageSpace",ARG_STR, get_storage_space,NULL,CTX_ALL},
-    {"<Defaults>",ARG_NONE, enter_defaults_context,NULL,CTX_ALL},
-    {"</Defaults>",ARG_NONE, exit_defaults_context,NULL,CTX_ALL},
-    {"<Aliases>",ARG_NONE, enter_aliases_context,NULL,CTX_ALL},
-    {"</Aliases>",ARG_NONE, exit_aliases_context,NULL,CTX_ALL},
-    {"Alias",ARG_LIST, get_alias_list,NULL,CTX_ALL},
-    {"<FileSystem>",ARG_NONE, enter_filesystem_context,NULL,CTX_ALL},
-    {"</FileSystem>",ARG_NONE, exit_filesystem_context,NULL,CTX_ALL},
-    {"<StorageHints>",ARG_NONE, enter_storage_hints_context,NULL,CTX_ALL},
-    {"</StorageHints>",ARG_NONE, exit_storage_hints_context,NULL,CTX_ALL},
-    {"<MetaHandleRanges>",ARG_NONE, enter_mhranges_context,NULL,CTX_ALL},
-    {"</MetaHandleRanges>",ARG_NONE, exit_mhranges_context,NULL,CTX_ALL},
-    {"<DataHandleRanges>",ARG_NONE, enter_dhranges_context,NULL,CTX_ALL},
-    {"</DataHandleRanges>",ARG_NONE, exit_dhranges_context,NULL,CTX_ALL},
-    {"<DefaultDistribution>",ARG_NONE,enter_distribution_context,NULL,CTX_ALL},
-    {"</DefaultDistribution>",ARG_NONE,exit_distribution_context,NULL,CTX_ALL},
-    {"Range",ARG_LIST, get_range_list,NULL,CTX_ALL},
-    {"RootHandle",ARG_STR, get_root_handle,NULL,CTX_ALL},
-    {"Name",ARG_STR, get_name,NULL,CTX_ALL},
-    {"ID",ARG_INT, get_filesystem_collid,NULL,CTX_ALL},
-    {"LogFile",ARG_STR, get_logfile,NULL,CTX_ALL},
-    {"EventLogging",ARG_LIST, get_event_logging_list,NULL,CTX_ALL},
-    {"UnexpectedRequests",ARG_INT, get_unexp_req,NULL,CTX_ALL},
-    {"ServerJobBMITimeoutSecs",ARG_INT, get_server_job_bmi_timeout,NULL,CTX_ALL},
-    {"ServerJobFlowTimeoutSecs",ARG_INT, get_server_job_flow_timeout,NULL,CTX_ALL},
-    {"ClientJobBMITimeoutSecs",ARG_INT, get_client_job_bmi_timeout,NULL,CTX_ALL},
-    {"ClientJobFlowTimeoutSecs",ARG_INT, get_client_job_flow_timeout,NULL,CTX_ALL},
-    {"ClientRetryLimit",ARG_INT, get_client_retry_limit,NULL,CTX_ALL},
-    {"ClientRetryDelayMilliSecs",ARG_INT, get_client_retry_delay,NULL,CTX_ALL},
-    {"PerfUpdateInterval",ARG_INT, get_perf_update_interval,NULL,CTX_ALL},
-    {"BMIModules",ARG_LIST, get_bmi_module_list,NULL,CTX_ALL},
-    {"FlowModules",ARG_LIST, get_flow_module_list,NULL,CTX_ALL},
+    /* 
+     * Specifies a string identifier for the pvfs2 server that is to be
+     * run on this host.  The format of this string is:
+     *
+     * {transport}://{hostname}:{port}
+     *
+     * Where {transport} is one of the possible BMI transport modules
+     * (tcp, ib, gm).  Example:
+     *
+     * tcp://myhost.mydn:12345
+     *
+     */
+    {"HostID",ARG_STR, get_pvfs_server_id,NULL,CTX_GLOBAL,NULL},
+    
+    /* Specifies the local path for the pvfs2 server to use as storage space.
+     * Example:
+     *
+     * /tmp/pvfs.storage
+     */
+    {"StorageSpace",ARG_STR, get_storage_space,NULL,CTX_GLOBAL,NULL},
+
+    /* Specifies the beginning of the Defaults context.  Options specified
+     * within the Defaults context are used as default values over all the
+     * pvfs2 server specific config files.
+     */
+    {"<Defaults>",ARG_NONE, enter_defaults_context,NULL,CTX_GLOBAL,NULL},
+
+    /* Specifies the end-tag for the Defaults context.
+     */
+    {"</Defaults>",ARG_NONE, exit_defaults_context,NULL,CTX_DEFAULTS,NULL},
+
+    /* Specifies the beginning of the Aliases context.  This groups 
+     * the Alias mapping options.
+     *
+     * The Aliases context should be defined before any FileSystem contexts
+     * are defined, as options in the FileSystem context usually need to
+     * reference the aliases defined in this context.
+     */
+    {"<Aliases>",ARG_NONE, enter_aliases_context,NULL,CTX_GLOBAL,NULL},
+
+    /* Specifies the end-tag for the Aliases context.
+     */
+    {"</Aliases>",ARG_NONE, exit_aliases_context,NULL,CTX_ALIASES,NULL},
+
+    /* Specifies an alias in the form of a non-whitespace string that
+     * can be used to reference a BMI server address (a HostID).  This
+     * allows us to reference individual servers by an alias instead of their
+     * full HostID.  The format of the Alias option is:
+     *
+     * Alias {alias string} {bmi address}
+     *
+     * As an example:
+     *
+     * Alias mynode1 tcp://hostname1.clustername1.domainname:12345
+     */
+    {"Alias",ARG_LIST, get_alias_list,NULL,CTX_ALIASES,NULL},
+
+    /* Specifies the beginning of a Filesystem context.  This groups
+     * options specific to a filesystem.  A pvfs2 server may manage
+     * more than one filesystem, so a config file may have more than
+     * one Filesystem context, each defining the parameters of a different
+     * Filesystem.
+     */
+    {"<FileSystem>",ARG_NONE, enter_filesystem_context,NULL,CTX_GLOBAL,NULL},
+
+    /* Specifies the end-tag of a Filesystem context.
+     */
+    {"</FileSystem>",ARG_NONE, exit_filesystem_context,NULL,CTX_FILESYSTEM,
+        NULL},
+
+    /* Specifies the beginning of a StorageHints context.  This groups
+     * options specific to a filesystem and related to the behavior of the
+     * storage system.  Mostly these options are passed directly to the
+     * TROVE storage module which may or may not support them.  The
+     * DBPF module (the only TROVE module implemented at present) supports
+     * all of them.
+     */
+    {"<StorageHints>",ARG_NONE, enter_storage_hints_context,NULL,
+        CTX_FILESYSTEM,NULL},
+
+    /* Specifies the end-tag of the StorageHints context.
+     */
+    {"</StorageHints>",ARG_NONE, exit_storage_hints_context,NULL,
+        CTX_STORAGEHINTS,NULL},
+
+    /* This context groups together the Range options that define valid values
+     * for meta handles on a per-host basis for this filesystem.
+     *
+     * The MetaHandleRanges context is required to be present in a
+     * Filesystem context.
+     */
+    {"<MetaHandleRanges>",ARG_NONE, enter_mhranges_context,NULL,
+        CTX_FILESYSTEM,NULL},
+
+    /* Specifies the end-tag for the MetaHandleRanges context.
+     */
+    {"</MetaHandleRanges>",ARG_NONE, exit_mhranges_context,NULL,
+        CTX_METAHANDLERANGES,NULL},
+
+    /* This context groups together the Range options that define valid values
+     * for the data handles on a per-host basis for this filesystem.
+     *
+     * A DataHandleRanges context is required to be present in a
+     * Filesystem context.
+     */
+    {"<DataHandleRanges>",ARG_NONE, enter_dhranges_context,NULL,
+        CTX_FILESYSTEM,NULL},
+
+    /* Specifies the end-tag for the DataHandleRanges context.
+     */
+    {"</DataHandleRanges>",ARG_NONE, exit_dhranges_context,NULL,
+        CTX_DATAHANDLERANGES,NULL},
+    
+    /* Provides a context for defining the filesystem's default
+     * distribution to use and the parameters to be set for that distribution.
+     *
+     * Valid options within the Distribution context are Name, Param, and Value.
+     *
+     * This context is an optional context within the Filesystem context.  If
+     * not specified, the filesystem defaults to the simple-stripe distribution.
+     */
+    {"<Distribution>",ARG_NONE, enter_distribution_context,NULL,
+        CTX_FILESYSTEM,NULL},
+
+    /* Specifies the end-tag for the Distribution context.
+     */
+    {"</Distribution>",ARG_NONE, exit_distribution_context,NULL,
+        CTX_DISTRIBUTION,NULL},
+
+    /* As logical files are created in pvfs2, the data files and meta files
+     * that represent them are given filesystem unique handle values.  The
+     * user can specify a range of values (or set of ranges) 
+     * to be allocated to data files and meta files for a particular server,
+     * using the Range option in the DataHandleRanges and MetaHandleRanges
+     * contexts.  Note that in most cases, its easier to let the 
+     * pvfs2-genconfig script determine the best ranges to specify.
+     *
+     * This option specifies a range of handle values that can be used for 
+     * a particular pvfs2 server in a particular context (meta handles
+     * or data handles).  The DataHandleRanges and MetaHandleRanges contexts
+     * should contain one or more Range options.  The format is:
+     *
+     * Range {alias} {min value1}-{max value1}[, {min value2}-{max value2},...]
+     *
+     * Where {alias} is one of the alias strings already specified in the
+     * Aliases context.
+     *
+     * {min value} and {max value} are positive integer values that specify
+     * the range of possible handles that can be given out for that particular
+     * host.  {max value} must be less than 18446744073709551615 (UINT64_MAX).
+     *
+     * As shown in the specified format, multiple ranges can be specified for
+     * the same alias.  The format requires that max value of a given range
+     * is less than the min value of the next one, 
+     * i.e. {max value1}<{min value2}
+     * 
+     * Example of a Range option for data handles:
+     *
+     * Range mynode1 2147483651-4294967297
+     */
+    {"Range",ARG_LIST, get_range_list,NULL,
+        CTX_METAHANDLERANGES|CTX_DATAHANDLERANGES,NULL},
+
+    /* Specifies the handle value for the root of the Filesystem.  This
+     * is a required option in the Filesystem context.  The format is:
+     *
+     * RootHandle {handle value}
+     *
+     * Where {handle value} is a positive integer no greater than 
+     * 18446744073709551615 (UIN64_MAX).
+     *
+     * In general its best to let the pvfs2-genconfig script specify a
+     * RootHandle value for the filesystem.
+     */
+    {"RootHandle",ARG_STR, get_root_handle,NULL,
+        CTX_FILESYSTEM,NULL},
+
+    /* This option specifies the name of the particular filesystem or
+     * distribution that its defined in.  It is a required option in
+     * Filesystem and Distribution contexts.
+     */
+    {"Name",ARG_STR, get_name,NULL,
+        CTX_FILESYSTEM|CTX_DISTRIBUTION,NULL},
+
+    /* A pvfs2 server may manage more than one filesystem, and so a
+     * unique identifier is used to represent each one.  
+     * This option specifies such an ID (sometimes called a 'collection
+     * id') for the filesystem it is defined in.  
+     *
+     * The ID value can be any positive integer, no greater than
+     * 2147483647 (INT32_MAX).  It is a required option in the Filesystem
+     * context.
+     */
+    {"ID",ARG_INT, get_filesystem_collid,NULL,
+        CTX_FILESYSTEM,NULL},
+
+    /* The gossip interface in pvfs2 allows users to specify different
+     * levels of logging for the pvfs2 server.  The output of these
+     * different log levels is written to a file, which is specified in
+     * this option.  The value of the option must be the path pointing to a 
+     * file with valid write permissions.  The Logfile option can be
+     * specified for all the pvfs2 servers in the Defaults context or for
+     * a particular server in the Global context.
+     */
+    {"LogFile",ARG_STR, get_logfile,NULL,
+        CTX_DEFAULTS|CTX_GLOBAL,"/tmp/pvfs2-server.log"},
+
+    /* The gossip interface in pvfs2 allows users to specify different
+     * levels of logging for the pvfs2 server.  This option sets that level for
+     * either all servers (by being defined in the Defaults context) or for
+     * a particular server by defining it in the Global context.  Possible
+     * values for event logging are:
+     *
+     * __EVENTLOGGING__
+     *
+     * The value of the EventLogging option can be a comma separated list
+     * of the above values.  Individual values can also be negated with
+     * a '-'.  Examples of possible values are:
+     *
+     * EventLogging flow,msgpair,io
+     * EventLogging -storage
+     * EventLogging -flow,-flowproto
+     */
+    {"EventLogging",ARG_LIST, get_event_logging_list,NULL,
+        CTX_DEFAULTS|CTX_GLOBAL,"none,"},
+
+    /* At startup each pvfs2 server allocates space for a set number
+     * of incoming requests to prevent the allocation delay at the beginning
+     * of each unexpected request.  This parameter specifies the number
+     * of requests for which to allocate space.
+     *
+     * If set in the Defaults context, its value will be used for all servers.
+     * The default value can also be overwritten by setting a separate value
+     * in the Global context.
+     */
+     {"UnexpectedRequests",ARG_INT, get_unexp_req,NULL,
+         CTX_DEFAULTS|CTX_GLOBAL,"50"},
+
+     /* Specifies the timeout value in seconds for BMI jobs on the server.
+      */
+     {"ServerJobBMITimeoutSecs",ARG_INT, get_server_job_bmi_timeout,NULL,
+         CTX_DEFAULTS|CTX_GLOBAL, "30"},
+     
+     /* Specifies the timeout value in seconds for TROVE jobs on the server.
+      */
+     {"ServerJobFlowTimeoutSecs",ARG_INT, get_server_job_flow_timeout,NULL,
+         CTX_DEFAULTS|CTX_GLOBAL, "30"},
+     
+     /* Specifies the timeout value in seconds for BMI jobs on the client.
+      */
+     {"ClientJobBMITimeoutSecs",ARG_INT, get_client_job_bmi_timeout,NULL,
+         CTX_DEFAULTS|CTX_GLOBAL, "300"},
+
+     /* Specifies the timeout value in seconds for FLOW jobs on the client.
+      */
+     {"ClientJobFlowTimeoutSecs",ARG_INT, get_client_job_flow_timeout,NULL,
+         CTX_DEFAULTS|CTX_GLOBAL, "300"},
+
+     /* Specifies the number of retry attempts for operations (when possible)
+      */
+     {"ClientRetryLimit",ARG_INT, get_client_retry_limit,NULL,
+         CTX_DEFAULTS|CTX_GLOBAL, "5"},
+
+     /* Specifies the delay in milliseconds to wait between retries.
+      */
+     {"ClientRetryDelayMilliSecs",ARG_INT, get_client_retry_delay,NULL,
+         CTX_DEFAULTS|CTX_GLOBAL, "2000"},
+
+     /* This specifies the frequency (in milliseconds) 
+      * that performance monitor should be updated
+      * when the pvfs2 server is running in admin mode.
+      *
+      * Can be set in either Default or Global contexts.
+      */
+    {"PerfUpdateInterval",ARG_INT, get_perf_update_interval,NULL,
+        CTX_DEFAULTS|CTX_GLOBAL,"1000"},
+
+    /* List the BMI modules to load when the server is started.  At present,
+     * only tcp, infiniband, and myrinet are valid BMI modules.  
+     * The format of the list is a comma separated list of one of:
+     *
+     * bmi_tcp
+     * bmi_ib
+     * bmi_gm
+     *
+     * For example:
+     *
+     * BMIModules bmi_tcp,bmi_ib
+     *
+     * Note that only the bmi modules compiled into pvfs2 should be
+     * specified in this list.  The BMIModules option can be specified
+     * in either the Defaults or Global contexts.
+     */
+    {"BMIModules",ARG_LIST, get_bmi_module_list,NULL,
+        CTX_DEFAULTS|CTX_GLOBAL,NULL},
+    
+    /* List the flow modules to load when the server is started.  The modules
+     * available for loading currently are:
+     *
+     * flowproto_multiqueue - A flow module that handles all the possible flows,
+     * bmi->trove, trove->bmi, mem->bmi, bmi->mem.  At present, this is the
+     * default and only available flow for production use.
+     *
+     * flowproto_bmi_cache - A flow module that enables the use of the NCAC
+     * (network-centric adaptive cache) in the pvfs2 server.  Since the NCAC
+     * is currently disable and unsupported, this module exists as a proof
+     * of concept only.
+     *
+     * flowproto_dump_offsets - Used for debugging, this module allows the
+     * developer to see what/when flows are being posted, without making
+     * any actual BMI or TROVE requests.  This should only be used if you
+     * know what you're doing.
+     *
+     */
+    {"FlowModules",ARG_LIST, get_flow_module_list,NULL,
+        CTX_DEFAULTS|CTX_GLOBAL,"flowproto_multiqueue,"},
+
+    /* The TROVE storage layer has a management component that deals with
+     * allocating handle values for new metafiles and datafiles.  The underlying
+     * trove module can be given a hint to tell it how long to wait before
+     * reusing handle values that have become freed up (only deleting files will
+     * free up a handle).  The HandleRecycleTimeoutSecs option specifies
+     * the number of seconds to wait for each filesystem.  This is an
+     * optional parameter that can be specified in the StorageHints context.
+     */
     {"HandleRecycleTimeoutSecs", ARG_INT,
-     get_handle_recycle_timeout_seconds, NULL, CTX_ALL},
-    {"AttrCacheKeywords",ARG_LIST, get_attr_cache_keywords_list,NULL,CTX_ALL},
-    {"AttrCacheSize",ARG_INT, get_attr_cache_size, NULL,CTX_ALL},
-    {"AttrCacheMaxNumElems",ARG_INT,get_attr_cache_max_num_elems,NULL,CTX_ALL},
-    {"TroveSyncMeta",ARG_STR, get_trove_sync_meta, NULL, CTX_ALL},
-    {"TroveSyncData",ARG_STR, get_trove_sync_data, NULL, CTX_ALL},
-    {"LogStamp",ARG_STR, get_logstamp,NULL,CTX_ALL},
-    {"Param", ARG_STR, get_param, NULL, CTX_ALL},
-    {"Value", ARG_INT, get_value, NULL, CTX_ALL},
-    {"DefaultNumDFiles", ARG_INT, get_default_num_dfiles, NULL,CTX_ALL},
+         get_handle_recycle_timeout_seconds, NULL, 
+         CTX_STORAGEHINTS,"360"},
+    
+    /* The TROVE layer has an attribute caching component that handles
+     * caching of stored attributes.  This is used to improve the performance of
+     * metadata accesses.  The AttrCacheKeywords option is a list of the
+     * object types that should get cached in the attribute cache.  
+     * The possible values for this option are:
+     *
+     * datafile_handles - This will cache the array of datafile handles for
+     *                    each logical file in this filesystem
+     * 
+     * metafile_dist - This will cache (for each logical file)
+     *                 the file distribution information used to create/manage
+     *                 the datafiles.  
+     *
+     * dir_ent - This will cache the handles of the directory entries in this
+     *           filesystem
+     *
+     * symlink_target - This will cache the target path for the symbolic links
+     *                  in this filesystem
+     *
+     * The format of this option is a comma-separated list of one or more
+     * of the above values.  For example:
+     *
+     * AttrCacheKeywords datafile_handles,metafile_dist,dir_ent
+     */
+    {"AttrCacheKeywords",ARG_LIST, get_attr_cache_keywords_list,NULL,
+        CTX_STORAGEHINTS,
+        "datafile_handles,metafile_dist,dir_ent,symlink_target,"},
+    
+    /* The attribute cache in the TROVE layer mentioned in the documentation
+     * for the AttrCacheKeywords option is managed as a hashtable.  The
+     * AttrCacheSize adjusts the number of buckets that this hashtable contains.
+     * This value can be adjusted for better performance.  A good hashtable
+     * size should always be a prime number.
+     */
+    {"AttrCacheSize",ARG_INT, get_attr_cache_size, NULL,
+        CTX_STORAGEHINTS,"511"},
+
+    /* This option specifies the max cache size of the attribute cache 
+     * in the TROVE layer mentioned in the documentation
+     * for the AttrCacheKeywords option.  This value can be adjusted for
+     * better performance.
+     */
+    {"AttrCacheMaxNumElems",ARG_INT,get_attr_cache_max_num_elems,NULL,
+        CTX_STORAGEHINTS,"1024"},
+    
+    /* The TroveSyncMeta option allows users to turn off metadata
+     * synchronization with every metadata write.  This can greatly improve
+     * performance.  In general, this value should probably be set to yes,
+     * otherwise metadata transaction could be lost in the event of server
+     * failover.
+     */
+    {"TroveSyncMeta",ARG_STR, get_trove_sync_meta, NULL, 
+        CTX_STORAGEHINTS,"yes"},
+
+    /* The TroveSyncData option allows users to turn off datafile
+     * synchronization with every write operation.  This can greatly improve
+     * performance, but may cause lost data in the event of server failover.
+     */
+    {"TroveSyncData",ARG_STR, get_trove_sync_data, NULL, 
+        CTX_STORAGEHINTS,"yes"},
+
+    /* Specifies the format of the date/timestamp that events will have
+     * in the event log.  Possible values are:
+     *
+     * usec: [%H:%M:%S
+     *
+     * datetime: [%m/%d %H:%M]
+     *
+     * none
+     *
+     * The format of the option is one of the above values.  For example,
+     *
+     * LogStamp datetime
+     */
+    {"LogStamp",ARG_STR, get_logstamp,NULL,
+        CTX_DEFAULTS|CTX_GLOBAL,"usec"},
+    
+    /* This option specifies a parameter name to be passed to the 
+     * distribution to be used.  This option should be immediately
+     * followed by a Value option.
+     */
+    {"Param", ARG_STR, get_param, NULL, 
+        CTX_DISTRIBUTION,NULL},
+    
+    /* This option specifies the value of the parameter who's name
+     * was specified in the previous option.
+     */
+    {"Value", ARG_INT, get_value, NULL, 
+        CTX_DISTRIBUTION,NULL},
+    
+    /* This option specifies the default number of datafiles to use
+     * when a new file is created.  The value is passed to the distribution
+     * and it determines whether to use that value or not.
+     */
+    {"DefaultNumDFiles", ARG_INT, get_default_num_dfiles, NULL,
+        CTX_FILESYSTEM,"0"},
+
     LAST_OPTION
 };
 
@@ -178,6 +566,7 @@ int PINT_parse_config(
     char *global_config_filename,
     char *server_config_filename)
 {
+    struct server_configuration_s *config_s;
     configfile_t *configfile = (configfile_t *)0;
 
     if (!config_obj)
@@ -199,7 +588,8 @@ int PINT_parse_config(
     config_s->client_retry_limit = PVFS2_CLIENT_RETRY_LIMIT_DEFAULT;
     config_s->client_retry_delay_ms = PVFS2_CLIENT_RETRY_DELAY_MS_DEFAULT;
 
-    if (cache_config_files(global_config_filename, server_config_filename))
+    if (cache_config_files(
+            config_s, global_config_filename, server_config_filename))
     {
         return 1;
     }
@@ -207,9 +597,10 @@ int PINT_parse_config(
     assert(config_s->server_config_buflen && config_s->server_config_buf);
 
     /* first read in the fs.conf defaults config file */
-    config_s->configuration_context = GLOBAL_CONFIG;
+    config_s->configuration_context = CTX_GLOBAL;
     configfile = PINT_dotconf_create(config_s->fs_config_filename,
-                                     options, NULL, CASE_INSENSITIVE);
+                                     options, (void *)config_s, 
+                                     CASE_INSENSITIVE);
     if (!configfile)
     {
         gossip_err("Error opening config file %s\n",
@@ -217,7 +608,8 @@ int PINT_parse_config(
         return 1;
     }
     configfile->errorhandler = (dotconf_errorhandler_t)errorhandler;
-
+    configfile->contextchecker = (dotconf_contextchecker_t)contextchecker;
+    
     if(PINT_dotconf_command_loop(configfile) == 0)
     {
         /* NOTE: dotconf error handler will log message */
@@ -226,9 +618,9 @@ int PINT_parse_config(
     PINT_dotconf_cleanup(configfile);
 
     /* then read in the server.conf (host specific) config file */
-    config_s->configuration_context = GLOBAL_CONFIG;
+    config_s->configuration_context = CTX_GLOBAL;
     configfile = PINT_dotconf_create(config_s->server_config_filename,
-                                options, NULL, CASE_INSENSITIVE);
+                                options, (void *)config_s, CASE_INSENSITIVE);
     if (!configfile)
     {
         gossip_err("Error opening config file: %s\n",
@@ -236,6 +628,7 @@ int PINT_parse_config(
         return 1;
     }
     configfile->errorhandler = (dotconf_errorhandler_t)errorhandler;
+    configfile->contextchecker = (dotconf_contextchecker_t)contextchecker;
 
     if (PINT_dotconf_command_loop(configfile) == 0)
     {
@@ -265,23 +658,37 @@ int PINT_parse_config(
 	return 1;
     }
 
+    /* We set to the default flow module since there's only one.
+    */
     if (!config_s->flow_modules)
     {
-	gossip_err("Configuration file error. "
-                   "No Flow modules specified.\n");
+        gossip_err("Configuration file error. No flow module specified\n");
 	return 1;
     }
-
+    
+    /* Users don't need to learn about this unless they want to
+    */
     if (!config_s->perf_update_interval)
     {
-	gossip_err("Configuration file error.  "
+        gossip_err("Configuration file error.  "
                    "No PerfUpdateInterval specified.\n");
-	return 1;
+        return 1;
     }
-
+    
     return 0;
 }
 
+const char *contextchecker(command_t *cmd, unsigned long mask)
+{
+    struct server_configuration_s *config_s = cmd->context;
+
+    if(!(mask & config_s->configuration_context))
+    {
+        return "Option can't be defined in that context";
+    }
+    return NULL;
+}
+    
 FUNC_ERRORHANDLER(errorhandler)
 {
     gossip_err("Error: %s line %ld: %s", configfile->filename,
@@ -291,10 +698,8 @@ FUNC_ERRORHANDLER(errorhandler)
 
 DOTCONF_CB(get_pvfs_server_id)
 {
-    if (config_s->configuration_context != GLOBAL_CONFIG)
-    {
-        return("HostID Tag can only be in the Global context.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
     if (config_s->host_id)
     {
         gossip_err("WARNING: HostID value being overwritten (from "
@@ -307,12 +712,8 @@ DOTCONF_CB(get_pvfs_server_id)
 
 DOTCONF_CB(get_logstamp)
 {
-    if ((config_s->configuration_context != DEFAULTS_CONFIG) &&
-        (config_s->configuration_context != GLOBAL_CONFIG))
-    {
-        return("LogStamp tag can only be in a "
-                   "Defaults or Global block.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
 
     if(!strcmp(cmd->data.str, "none"))
     {
@@ -337,10 +738,8 @@ DOTCONF_CB(get_logstamp)
 
 DOTCONF_CB(get_storage_space)
 {
-    if (config_s->configuration_context != GLOBAL_CONFIG)
-    {
-        return("StorageSpace Tag can only be in the Global context.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
     if (config_s->storage_path)
     {
         gossip_err("WARNING: StorageSpace value being overwritten.\n");
@@ -353,46 +752,42 @@ DOTCONF_CB(get_storage_space)
 
 DOTCONF_CB(enter_defaults_context)
 {
-    if (config_s->configuration_context != GLOBAL_CONFIG)
-    {
-        return("Error in context.  Cannot have Defaults tag here.\n");
-    }
-    config_s->configuration_context = DEFAULTS_CONFIG;
-    return NULL;
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
+    config_s->configuration_context = CTX_DEFAULTS;
+
+    return PINT_dotconf_set_defaults(
+        cmd->configfile, CTX_DEFAULTS);
 }
 
 DOTCONF_CB(exit_defaults_context)
 {
-    if (config_s->configuration_context != DEFAULTS_CONFIG)
-    {
-        return("Error in context.  Cannot have /Defaults tag here.\n");
-    }
-    config_s->configuration_context = GLOBAL_CONFIG;
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
+    config_s->configuration_context = CTX_GLOBAL;
     return NULL;
 }
 
 DOTCONF_CB(enter_aliases_context)
 {
-    if (config_s->configuration_context != GLOBAL_CONFIG)
-    {
-        return("Error in context.  Cannot have Aliases tag here.\n");
-    }
-    config_s->configuration_context = ALIASES_CONFIG;
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
+    config_s->configuration_context = CTX_ALIASES;
     return NULL;
 }
 
 DOTCONF_CB(exit_aliases_context)
 {
-    if (config_s->configuration_context != ALIASES_CONFIG)
-    {
-        return("Error in context.  Cannot have /Aliases tag here.\n");
-    }
-    config_s->configuration_context = GLOBAL_CONFIG;
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
+    config_s->configuration_context = CTX_GLOBAL;
     return NULL;
 }
 
 DOTCONF_CB(enter_filesystem_context)
 {
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
     struct filesystem_configuration_s *fs_conf = NULL;
 
     if (config_s->host_aliases == NULL)
@@ -401,11 +796,6 @@ DOTCONF_CB(enter_filesystem_context)
                    "be declared before an Aliases tag.\n");
     }
 
-    if (config_s->configuration_context != GLOBAL_CONFIG)
-    {
-        return("Error in context.  Cannot have Filesystem tag here.\n");
-    }
-
     fs_conf = (struct filesystem_configuration_s *)
         malloc(sizeof(struct filesystem_configuration_s));
     assert(fs_conf);
@@ -423,18 +813,18 @@ DOTCONF_CB(enter_filesystem_context)
     }
     PINT_llist_add_to_head(config_s->file_systems,(void *)fs_conf);
     assert(PINT_llist_head(config_s->file_systems) == (void *)fs_conf);
-    config_s->configuration_context = FILESYSTEM_CONFIG;
-    return NULL;
+    config_s->configuration_context = CTX_FILESYSTEM;
+
+    return PINT_dotconf_set_defaults(
+        cmd->configfile,
+        CTX_FILESYSTEM);
 }
 
 DOTCONF_CB(exit_filesystem_context)
 {
     struct filesystem_configuration_s *fs_conf = NULL;
-
-    if (config_s->configuration_context != FILESYSTEM_CONFIG)
-    {
-        return("Error in context.  Cannot have /Filesystem tag here.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
 
     fs_conf = (struct filesystem_configuration_s *)
         PINT_llist_head(config_s->file_systems);
@@ -451,54 +841,43 @@ DOTCONF_CB(exit_filesystem_context)
                    "tag before all filesystem attributes are declared.\n");
     }
 
-    config_s->configuration_context = GLOBAL_CONFIG;
+    config_s->configuration_context = CTX_GLOBAL;
     return NULL;
 }
 
 DOTCONF_CB(enter_storage_hints_context)
 {
-    if (config_s->configuration_context != FILESYSTEM_CONFIG)
-    {
-        return("Error in context.  Cannot "
-                   "have StorageHints tag here.\n");
-    }
-    config_s->configuration_context = STORAGEHINTS_CONFIG;
-    return NULL;
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
+    config_s->configuration_context = CTX_STORAGEHINTS;
+
+    return PINT_dotconf_set_defaults(
+        cmd->configfile, CTX_STORAGEHINTS);
 }
 
 DOTCONF_CB(exit_storage_hints_context)
 {
-    if (config_s->configuration_context != STORAGEHINTS_CONFIG)
-    {
-        return("Error in context.  Cannot "
-                   "have /StorageHints tag here.\n");
-    }
-    config_s->configuration_context = FILESYSTEM_CONFIG;
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
+    config_s->configuration_context = CTX_FILESYSTEM;
     return NULL;
 }
 
 
 DOTCONF_CB(enter_mhranges_context)
 {
-    if (config_s->configuration_context != FILESYSTEM_CONFIG)
-    {
-        return("Error in context.  Cannot have "
-                   "MetaHandleRanges tag here.\n");
-    }
-    config_s->configuration_context = META_HANDLERANGES_CONFIG;
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
+    config_s->configuration_context = CTX_METAHANDLERANGES;
     return NULL;
 }
 
 DOTCONF_CB(exit_mhranges_context)
 {
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
     struct filesystem_configuration_s *fs_conf = NULL;
 
-    if (config_s->configuration_context != META_HANDLERANGES_CONFIG)
-    {
-        return("Error in context.  Cannot have "
-                   "/MetaHandleRanges tag here.\n");
-    }
-
     fs_conf = (struct filesystem_configuration_s *)
         PINT_llist_head(config_s->file_systems);
     assert(fs_conf);
@@ -507,31 +886,24 @@ DOTCONF_CB(exit_mhranges_context)
     {
         return("No valid mhandle ranges added to file system.\n");
     }
-    config_s->configuration_context = FILESYSTEM_CONFIG;
+    config_s->configuration_context = CTX_FILESYSTEM;
     return NULL;
 }
 
 DOTCONF_CB(enter_dhranges_context)
 {
-    if (config_s->configuration_context != FILESYSTEM_CONFIG)
-    {
-        return("Error in context.  Cannot have "
-                   "DataHandleRanges tag here.\n");
-    }
-    config_s->configuration_context = DATA_HANDLERANGES_CONFIG;
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
+    config_s->configuration_context = CTX_DATAHANDLERANGES;
     return NULL;
 }
 
 DOTCONF_CB(exit_dhranges_context)
 {
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
     struct filesystem_configuration_s *fs_conf = NULL;
 
-    if (config_s->configuration_context != DATA_HANDLERANGES_CONFIG)
-    {
-        return("Error in context.  Cannot have "
-                   "/DataHandleRanges tag here.\n");
-    }
-
     fs_conf = (struct filesystem_configuration_s *)
         PINT_llist_head(config_s->file_systems);
     assert(fs_conf);
@@ -540,154 +912,106 @@ DOTCONF_CB(exit_dhranges_context)
     {
         return("No valid dhandle ranges added to file system.\n");
     }
-    config_s->configuration_context = FILESYSTEM_CONFIG;
+    config_s->configuration_context = CTX_FILESYSTEM;
     return NULL;
 }
 
 DOTCONF_CB(enter_distribution_context)
 {
-    if (config_s->configuration_context != GLOBAL_CONFIG)
-    {
-        return("Error in context.  Cannot have "
-                   "Distribution tag here.\n");
-    }
-    config_s->configuration_context = DISTRIBUTION_CONFIG;
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
+    config_s->configuration_context = CTX_DISTRIBUTION;
     return NULL;
 }
 
 DOTCONF_CB(exit_distribution_context)
 {
-    if (config_s->configuration_context != DISTRIBUTION_CONFIG)
-    {
-        return("Error in context.  Cannot have "
-                   "/Distribution tag here.\n");
-    }
-
-    config_s->configuration_context = GLOBAL_CONFIG;
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
+    config_s->configuration_context = CTX_GLOBAL;
     return NULL;
 }
 
 DOTCONF_CB(get_unexp_req)
 {
-    if ((config_s->configuration_context != DEFAULTS_CONFIG) &&
-        (config_s->configuration_context != GLOBAL_CONFIG))
-    {
-        return("UnexpectedRequests Tag can only be in a "
-                   "Defaults or Global block.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
     config_s->initial_unexpected_requests = cmd->data.value;
     return NULL;
 }
 
 DOTCONF_CB(get_server_job_bmi_timeout)
 {
-    if ((config_s->configuration_context != DEFAULTS_CONFIG) &&
-        (config_s->configuration_context != GLOBAL_CONFIG))
-    {
-        return("ServerJobBMITimeoutSecs Tag can only be in a "
-                   "Defaults or Global block.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
     config_s->server_job_bmi_timeout = cmd->data.value;
     return NULL;
 }
 
 DOTCONF_CB(get_server_job_flow_timeout)
 {
-    if ((config_s->configuration_context != DEFAULTS_CONFIG) &&
-        (config_s->configuration_context != GLOBAL_CONFIG))
-    {
-        return("ServerJobFlowTimeoutSecs Tag can only be in a "
-                   "Defaults or Global block.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
     config_s->server_job_flow_timeout = cmd->data.value;
     return NULL;
 }
 
 DOTCONF_CB(get_client_job_bmi_timeout)
 {
-    if ((config_s->configuration_context != DEFAULTS_CONFIG) &&
-        (config_s->configuration_context != GLOBAL_CONFIG))
-    {
-        return("ServerJobBMITimeoutSecs Tag can only be in a "
-                   "Defaults or Global block.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
     config_s->client_job_bmi_timeout = cmd->data.value;
     return NULL;
 }
 
 DOTCONF_CB(get_client_job_flow_timeout)
 {
-    if ((config_s->configuration_context != DEFAULTS_CONFIG) &&
-        (config_s->configuration_context != GLOBAL_CONFIG))
-    {
-        return("ServerJobFlowTimeoutSecs Tag can only be in a "
-                   "Defaults or Global block.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
     config_s->client_job_flow_timeout = cmd->data.value;
     return NULL;
 }
 
 DOTCONF_CB(get_client_retry_limit)
 {
-    if ((config_s->configuration_context != DEFAULTS_CONFIG) &&
-        (config_s->configuration_context != GLOBAL_CONFIG))
-    {
-        return("ClientRetryLimit Tag can only be in a "
-                   "Defaults or Global block.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
     config_s->client_retry_limit = cmd->data.value;
     return NULL;
 }
 
 DOTCONF_CB(get_client_retry_delay)
 {
-    if ((config_s->configuration_context != DEFAULTS_CONFIG) &&
-        (config_s->configuration_context != GLOBAL_CONFIG))
-    {
-        return("ClientRetryDelayMilliSecs Tag can only be in a "
-                   "Defaults or Global block.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
     config_s->client_retry_delay_ms = cmd->data.value;
     return NULL;
 }
 
 DOTCONF_CB(get_perf_update_interval)
 {
-    if ((config_s->configuration_context != DEFAULTS_CONFIG) &&
-        (config_s->configuration_context != GLOBAL_CONFIG))
-    {
-        return("PerfUpdateInterval Tag can only be in a "
-                   "Defaults or Global block.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
     config_s->perf_update_interval = cmd->data.value;
     return NULL;
 }
 
 DOTCONF_CB(get_logfile)
 {
-    if ((config_s->configuration_context != DEFAULTS_CONFIG) &&
-        (config_s->configuration_context != GLOBAL_CONFIG))
-    {
-        return("LogFile Tag can only be in a Defaults "
-                   "or Global block.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
     config_s->logfile = (cmd->data.str ? strdup(cmd->data.str) : NULL);
     return NULL;
 }
 
 DOTCONF_CB(get_event_logging_list)
 {
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
     int i = 0, len = 0;
     char buf[512] = {0};
     char *ptr = buf;
 
-    if ((config_s->configuration_context != DEFAULTS_CONFIG) &&
-        (config_s->configuration_context != GLOBAL_CONFIG))
-    {
-        return("EventLogging Tag can only be in a "
-                   "Defaults or Global block.\n");
-    }
-
     if (config_s->event_logging != NULL)
     {
         len = strlen(config_s->event_logging);
@@ -710,12 +1034,8 @@ DOTCONF_CB(get_flow_module_list)
     char buf[512] = {0};
     char *ptr = buf;
 
-    if ((config_s->configuration_context != DEFAULTS_CONFIG) &&
-        (config_s->configuration_context != GLOBAL_CONFIG))
-    {
-        return("FlowModules Tag can only be in a "
-                   "Defaults or Global block.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
 
     if (config_s->flow_modules != NULL)
     {
@@ -740,12 +1060,8 @@ DOTCONF_CB(get_bmi_module_list)
     char buf[512] = {0};
     char *ptr = buf;
 
-    if ((config_s->configuration_context != DEFAULTS_CONFIG) &&
-        (config_s->configuration_context != GLOBAL_CONFIG))
-    {
-        return("BMIModules Tag can only be in a "
-                   "Defaults or Global block.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
 
     if (config_s->bmi_modules != NULL)
     {
@@ -766,23 +1082,13 @@ DOTCONF_CB(get_bmi_module_list)
 DOTCONF_CB(get_handle_recycle_timeout_seconds)
 {
     struct filesystem_configuration_s *fs_conf = NULL;
-
-    if (config_s->configuration_context != STORAGEHINTS_CONFIG)
-    {
-        return("HandleRecycleTimeoutSecs Tag can only be in a "
-                   "StorageHints block.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
 
     fs_conf = (struct filesystem_configuration_s *)
         PINT_llist_head(config_s->file_systems);
     assert(fs_conf);
 
-    if (fs_conf->handle_recycle_timeout_sec.tv_sec)
-    {
-        gossip_err("WARNING: Overwriting %d with %d\n",
-                   (int)fs_conf->handle_recycle_timeout_sec.tv_sec,
-                   (int)cmd->data.value);
-    }
     fs_conf->handle_recycle_timeout_sec.tv_sec = (int)cmd->data.value;
     fs_conf->handle_recycle_timeout_sec.tv_usec = 0;
 
@@ -796,11 +1102,8 @@ DOTCONF_CB(get_attr_cache_keywords_list)
     char *ptr = buf;
     struct filesystem_configuration_s *fs_conf = NULL;
 
-    if (config_s->configuration_context != STORAGEHINTS_CONFIG)
-    {
-        return("AttrCacheKeywords Tag can only be in a "
-                   "Filesystem block.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
 
     fs_conf = (struct filesystem_configuration_s *)
         PINT_llist_head(config_s->file_systems);
@@ -831,22 +1134,13 @@ DOTCONF_CB(get_attr_cache_size)
 {
     struct filesystem_configuration_s *fs_conf = NULL;
 
-    if (config_s->configuration_context != STORAGEHINTS_CONFIG)
-    {
-        return("AttrCacheSize Tag can only be in a "
-                   "StorageHints block.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
 
     fs_conf = (struct filesystem_configuration_s *)
         PINT_llist_head(config_s->file_systems);
     assert(fs_conf);
 
-    if (fs_conf->attr_cache_size)
-    {
-        gossip_err("WARNING: Overwriting %d with %d\n",
-                   fs_conf->attr_cache_size,
-                   (int)cmd->data.value);
-    }
     fs_conf->attr_cache_size = (int)cmd->data.value;
     return NULL;
 }
@@ -854,23 +1148,13 @@ DOTCONF_CB(get_attr_cache_size)
 DOTCONF_CB(get_attr_cache_max_num_elems)
 {
     struct filesystem_configuration_s *fs_conf = NULL;
-
-    if (config_s->configuration_context != STORAGEHINTS_CONFIG)
-    {
-        return("AttrCacheMaxNumElems Tag can only be in a "
-                   "StorageHints block.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
 
     fs_conf = (struct filesystem_configuration_s *)
         PINT_llist_head(config_s->file_systems);
     assert(fs_conf);
 
-    if (fs_conf->attr_cache_max_num_elems)
-    {
-        gossip_err("WARNING: Overwriting %d with %d\n",
-                   fs_conf->attr_cache_max_num_elems,
-                   (int)cmd->data.value);
-    }
     fs_conf->attr_cache_max_num_elems = (int)cmd->data.value;
     return NULL;
 }
@@ -878,12 +1162,8 @@ DOTCONF_CB(get_attr_cache_max_num_elems)
 DOTCONF_CB(get_trove_sync_meta)
 {
     struct filesystem_configuration_s *fs_conf = NULL;
-
-    if (config_s->configuration_context != STORAGEHINTS_CONFIG)
-    {
-        return("TroveSyncMeta Tag can only be in a "
-                   "StorageHints block.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
 
     fs_conf = (struct filesystem_configuration_s *)
         PINT_llist_head(config_s->file_systems);
@@ -918,12 +1198,8 @@ DOTCONF_CB(get_trove_sync_meta)
 DOTCONF_CB(get_trove_sync_data)
 {
     struct filesystem_configuration_s *fs_conf = NULL;
-
-    if (config_s->configuration_context != STORAGEHINTS_CONFIG)
-    {
-        return("TroveSyncData Tag can only be in a "
-                   "StorageHints block.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
 
     fs_conf = (struct filesystem_configuration_s *)
         PINT_llist_head(config_s->file_systems);
@@ -950,11 +1226,9 @@ DOTCONF_CB(get_root_handle)
     struct filesystem_configuration_s *fs_conf = NULL;
     unsigned long long int tmp_var;
     int ret = -1;
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
 
-    if (config_s->configuration_context != FILESYSTEM_CONFIG)
-    {
-        return("RootHandle Tag can only be in a Filesystem block.\n");
-    }
     fs_conf = (struct filesystem_configuration_s *)
         PINT_llist_head(config_s->file_systems);
     assert(fs_conf);
@@ -969,7 +1243,9 @@ DOTCONF_CB(get_root_handle)
 
 DOTCONF_CB(get_name)
 {
-    if (config_s->configuration_context == FILESYSTEM_CONFIG)
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
+    if (config_s->configuration_context == CTX_FILESYSTEM)
     {
         struct filesystem_configuration_s *fs_conf = NULL;
 
@@ -983,7 +1259,7 @@ DOTCONF_CB(get_name)
         fs_conf->file_system_name =
             (cmd->data.str ? strdup(cmd->data.str) : NULL);
     }
-    else if (config_s->configuration_context == DISTRIBUTION_CONFIG)
+    else if (config_s->configuration_context == CTX_DISTRIBUTION)
     {
         if (0 == config_s->default_dist_config.name)
         {
@@ -996,21 +1272,15 @@ DOTCONF_CB(get_name)
             return "Only one distribution configuration is allowed.\n";
         }
     }
-    else
-    {
-        return "Name Tags may not appear in this context.\n";
-    }
     return NULL;
 }
 
 DOTCONF_CB(get_filesystem_collid)
 {
     struct filesystem_configuration_s *fs_conf = NULL;
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
 
-    if (config_s->configuration_context != FILESYSTEM_CONFIG)
-    {
-        return("ID Tags can only be within Filesystem tags.\n");
-    }
     fs_conf = (struct filesystem_configuration_s *)
         PINT_llist_head(config_s->file_systems);
     if (fs_conf->coll_id)
@@ -1022,16 +1292,31 @@ DOTCONF_CB(get_filesystem_collid)
     return NULL;
 }
 
+static int compare_aliases(void * vkey,
+                           void * valias2)
+{
+    char * hostaliaskey1 = (char *)vkey;
+    host_alias_s * alias2 = (host_alias_s *)valias2;
+    
+    return strcmp(hostaliaskey1, alias2->host_alias);
+}
+
 DOTCONF_CB(get_alias_list)
 {
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
     struct host_alias_s *cur_alias = NULL;
 
-    if (config_s->configuration_context != ALIASES_CONFIG)
+    assert(cmd->arg_count == 2);
+
+    /* prevent users from adding the same alias twice */
+    if(config_s->host_aliases &&
+       PINT_llist_search(config_s->host_aliases, 
+                      (void *)cmd->data.list[0],
+                      compare_aliases))
     {
-        return("Error in context.  Cannot have Alias "
-                   "outside of Aliases context.\n");
+        return "Error: alias already defined";
     }
-    assert(cmd->arg_count == 2);
 
     cur_alias = (host_alias_s *)
         malloc(sizeof(host_alias_s));
@@ -1042,6 +1327,7 @@ DOTCONF_CB(get_alias_list)
     {
         config_s->host_aliases = PINT_llist_new();
     }
+    
     PINT_llist_add_to_tail(config_s->host_aliases,(void *)cur_alias);
     return NULL;
 }
@@ -1052,20 +1338,15 @@ DOTCONF_CB(get_range_list)
     struct filesystem_configuration_s *fs_conf = NULL;
     struct host_handle_mapping_s *handle_mapping = NULL;
     PINT_llist **handle_range_list = NULL;
-
-    if ((config_s->configuration_context != META_HANDLERANGES_CONFIG) &&
-        (config_s->configuration_context != DATA_HANDLERANGES_CONFIG))
-    {
-        return("Error in context.  Cannot have Range keyword "
-                   "outside of [Meta|Data]HandleRanges context.\n");
-    }
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
 
     fs_conf = (struct filesystem_configuration_s *)
         PINT_llist_head(config_s->file_systems);
     assert(fs_conf);
 
     handle_range_list = ((config_s->configuration_context ==
-                          META_HANDLERANGES_CONFIG) ?
+                          CTX_METAHANDLERANGES) ?
                          &fs_conf->meta_handle_ranges :
                          &fs_conf->data_handle_ranges);
 
@@ -1076,7 +1357,7 @@ DOTCONF_CB(get_range_list)
 
     for(i = 0; i < cmd->arg_count; i += 2)
     {
-        if (is_valid_alias(cmd->data.list[i]))
+        if (is_valid_alias(config_s->host_aliases, cmd->data.list[i]))
         {
             i++;
             assert(cmd->data.list[i]);
@@ -1148,70 +1429,44 @@ DOTCONF_CB(get_range_list)
 
 DOTCONF_CB(get_param)
 {
-    if (config_s->configuration_context == DISTRIBUTION_CONFIG)
-    {
-        distribution_param_configuration* param =
-            malloc(sizeof(distribution_param_configuration));
-
-        if (NULL != param)
-        {
-            memset(param, 0, sizeof(param));
-            param->name = (cmd->data.str ? strdup(cmd->data.str) : NULL);
-            PINT_llist_add_to_tail(config_s->default_dist_config.param_list,
-                                   param);
-        }
-        else
-        {
-            return "Error allocating memory for Param Tag.\n";
-        }
-    }
-    else
-    {
-        return("Param Tag can only be in the DefaultDistribution context.\n");
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
+    distribution_param_configuration* param =
+        malloc(sizeof(distribution_param_configuration));
+
+    if (NULL != param)
+    {
+        memset(param, 0, sizeof(param));
+        param->name = (cmd->data.str ? strdup(cmd->data.str) : NULL);
+        PINT_llist_add_to_tail(config_s->default_dist_config.param_list,
+                               param);
     }
     return NULL;
 }
 
 DOTCONF_CB(get_value)
 {
-    if (config_s->configuration_context == DISTRIBUTION_CONFIG)
-    {
-        distribution_param_configuration* param;
-        param = (distribution_param_configuration*)PINT_llist_tail(
-            config_s->default_dist_config.param_list);
-        if (NULL != param)
-        {
-            param->value = (PVFS_size)cmd->data.value;
-        }
-        else
-        {
-            return "Value cannot appear without a parameter name.\n";
-        }
-    }
-    else
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
+    distribution_param_configuration* param;
+    param = (distribution_param_configuration*)PINT_llist_tail(
+        config_s->default_dist_config.param_list);
+    if (NULL != param)
     {
-        return("Value Tag can only be in the DefaultDistribution context.\n");
+        param->value = (PVFS_size)cmd->data.value;
     }
     return NULL;
 }
 
 DOTCONF_CB(get_default_num_dfiles)
 {
+    struct server_configuration_s *config_s = 
+        (struct server_configuration_s *)cmd->context;
     struct filesystem_configuration_s *fs_conf = NULL;
 
-    if (config_s->configuration_context != FILESYSTEM_CONFIG)
-    {
-        return("DefaultNumDFiles Tags can only be within Filesystem tags.\n");
-    }
     fs_conf = (struct filesystem_configuration_s *)
         PINT_llist_head(config_s->file_systems);
 
-    if (fs_conf->default_num_dfiles)
-    {
-        gossip_err("WARNING: Overwriting %d with %d\n",
-                   (int)fs_conf->default_num_dfiles,(int)cmd->data.value);
-    }
-
     fs_conf->default_num_dfiles = (int)cmd->data.value;
     return NULL;
 }
@@ -1301,7 +1556,7 @@ void PINT_config_release(struct server_c
     }
 }
 
-static int is_valid_alias(char *str)
+static int is_valid_alias(PINT_llist * host_aliases, char *str)
 {
     int ret = 0;
     PINT_llist *cur = NULL;
@@ -1309,7 +1564,7 @@ static int is_valid_alias(char *str)
 
     if (str)
     {
-        cur = config_s->host_aliases;
+        cur = host_aliases;
         while(cur)
         {
             cur_alias = PINT_llist_head(cur);
@@ -1366,7 +1621,7 @@ static int is_populated_filesystem_confi
              fs->meta_handle_ranges && fs->data_handle_ranges &&
              fs->root_handle) ? 1 : 0);
 }
-
+    
 static int is_root_handle_in_a_meta_range(
     struct server_configuration_s *config,
     struct filesystem_configuration_s *fs)
@@ -1993,6 +2248,7 @@ char *PINT_config_get_merged_handle_rang
   call should properly de-alloc all consumed memory.
 */
 static int cache_config_files(
+    struct server_configuration_s *config_s,
     char *global_config_filename,
     char *server_config_filename)
 {
@@ -2201,8 +2457,8 @@ int PINT_config_is_valid_configuration(
     PINT_llist *cur = NULL;
     struct filesystem_configuration_s *cur_fs = NULL;
     
-    if (config_s && config_s->logfile && config_s->event_logging &&
-        config_s->bmi_modules)
+    if (config_s && config_s->bmi_modules && config_s->event_logging &&
+        config_s->logfile)
     {
         cur = config_s->file_systems;
         while(cur)
@@ -2618,7 +2874,7 @@ int PINT_config_get_trove_sync_meta(
 
     if (config)
     {
-        fs_conf = PINT_config_find_fs_id(config_s, fs_id);
+        fs_conf = PINT_config_find_fs_id(config, fs_id);
     }
     return (fs_conf ? fs_conf->trove_sync_meta : TROVE_SYNC);
 }
@@ -2635,7 +2891,7 @@ int PINT_config_get_trove_sync_data(
 
     if (config)
     {
-        fs_conf = PINT_config_find_fs_id(config_s, fs_id);
+        fs_conf = PINT_config_find_fs_id(config, fs_id);
     }
     return (fs_conf ? fs_conf->trove_sync_data : TROVE_SYNC);
 }

Index: server-config.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/server-config.h,v
diff -p -u -r1.45 -r1.46
--- server-config.h	19 Jul 2005 21:12:46 -0000	1.45
+++ server-config.h	23 Aug 2005 18:44:17 -0000	1.46
@@ -15,16 +15,16 @@
 #include "trove.h"
 #endif
 
-enum 
+enum
 {
-    GLOBAL_CONFIG = 1,
-    FILESYSTEM_CONFIG = 2,
-    DEFAULTS_CONFIG = 3,
-    ALIASES_CONFIG = 4,
-    META_HANDLERANGES_CONFIG = 5,
-    DATA_HANDLERANGES_CONFIG = 6,
-    STORAGEHINTS_CONFIG = 7,
-    DISTRIBUTION_CONFIG = 8,
+    CTX_GLOBAL           = (1 << 1),
+    CTX_DEFAULTS         = (1 << 2),
+    CTX_ALIASES          = (1 << 3),
+    CTX_FILESYSTEM       = (1 << 4),
+    CTX_METAHANDLERANGES = (1 << 5),
+    CTX_DATAHANDLERANGES = (1 << 6),
+    CTX_STORAGEHINTS     = (1 << 7),
+    CTX_DISTRIBUTION     = (1 << 8)
 };
 
 typedef struct phys_server_desc

Index: state-machine-fns.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/state-machine-fns.h,v
diff -p -u -r1.15 -r1.16
--- state-machine-fns.h	28 Jul 2004 14:32:37 -0000	1.15
+++ state-machine-fns.h	23 Aug 2005 18:44:17 -0000	1.16
@@ -23,10 +23,9 @@
  * includes state-machine.h, because state-machine.h needs a key #define
  * before it can be included.
  *
- * The structure holding the table of PINT_OP_STATE structures also needs to
- * be declared; its name should be #defined as PINT_OP_STATE_TABLE.  If you
- * don't define this, you don't get the extern or the _locate function
- * (currently client might not need them?).
+ * The PINT_OP_STATE_TABLE has been replaced with a macro that must be #defined
+ * instead: PINT_OP_STATE_GET_MACHINE.  
+ * This allows the _locate function to be used in the client as well.
  *
  * A good example of this is the pvfs2-server.h in the src/server directory,
  * which includes state-machine.h at the bottom, and server-state-machine.c,
@@ -40,9 +39,7 @@
 /* Prototypes for functions defined in here */
 static inline int PINT_state_machine_halt(void);
 static inline int PINT_state_machine_next(struct PINT_OP_STATE *,job_status_s *r);
-#ifdef PINT_OP_STATE_TABLE
 static union PINT_state_array_values *PINT_state_machine_locate(struct PINT_OP_STATE *);
-#endif
 static inline union PINT_state_array_values *PINT_pop_state(struct PINT_OP_STATE *s);
 static inline void PINT_push_state(struct PINT_OP_STATE *s, union PINT_state_array_values *p);
 
@@ -143,7 +140,6 @@ static inline int PINT_state_machine_nex
     return retval;
 }
 
-#ifdef PINT_OP_STATE_TABLE
 /* Function: PINT_state_machine_locate(void)
    Params:  
    Returns:  Pointer to the start of the state machine indicated by
@@ -156,14 +152,14 @@ static union PINT_state_array_values *PI
     union PINT_state_array_values *current_tmp;
 
     /* check for valid inputs */
-    if (!s_op || s_op->op < 0 || s_op->op > PVFS_MAX_SERVER_OP)
+    if (!s_op || s_op->op < 0)
     {
 	gossip_err("State machine requested not valid\n");
 	return NULL;
     }
-    if (PINT_OP_STATE_TABLE[s_op->op].sm != NULL)
+    if (PINT_OP_STATE_GET_MACHINE(s_op->op) != NULL)
     {
-	current_tmp = PINT_OP_STATE_TABLE[s_op->op].sm->state_machine;
+	current_tmp = PINT_OP_STATE_GET_MACHINE(s_op->op)->state_machine;
 	/* handle the case in which the first state points to a nested
 	 * machine, rather than a simple function
 	 */
@@ -183,7 +179,6 @@ static union PINT_state_array_values *PI
     gossip_err("State machine not found for operation %d\n",s_op->op);
     return NULL;
 }
-#endif
 
 static inline union PINT_state_array_values *PINT_pop_state(struct PINT_OP_STATE *s)
 {

Index: str-utils.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/str-utils.c,v
diff -p -u -r1.16 -r1.17
--- str-utils.c	2 Aug 2004 17:29:23 -0000	1.16
+++ str-utils.c	23 Aug 2005 18:44:17 -0000	1.17
@@ -366,7 +366,7 @@ int PINT_split_string_list(char ***token
     }
 
     /* allocate pointers for each */
-    *tokens = (char **) malloc(sizeof(char **));
+    *tokens = (char **) malloc(sizeof(char *) * tokencount);
     if (!(*tokens))
     {
 	return 0;
@@ -375,7 +375,7 @@ int PINT_split_string_list(char ***token
     /* copy out all of the tokenized strings */
     holder = comma_list;
     end = comma_list + strlen(comma_list);
-    for (i = 0; i < tokencount; i++)
+    for (i = 0; i < tokencount && holder; i++)
     {
 	holder2 = index(holder, ',');
 	if (!holder2)
@@ -410,6 +410,27 @@ int PINT_split_string_list(char ***token
 	free(*tokens);
     }
     return (0);
+}
+
+/* PINT_free_string_list()
+ * 
+ * Free the string list allocated by PINT_split_string_list()
+ */
+void PINT_free_string_list(char ** list, int len)
+{
+    int i = 0;
+
+    if(list)
+    {
+        for(; i < len; ++i)
+        {
+            if(list[i])
+            {
+                free(list[i]);
+            }
+        }
+        free(list);
+    }
 }
 
 /* PINT_remove_base_dir()

Index: str-utils.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/str-utils.h,v
diff -p -u -r1.14 -r1.15
--- str-utils.h	2 Aug 2004 17:29:23 -0000	1.14
+++ str-utils.h	23 Aug 2005 18:44:17 -0000	1.15
@@ -36,6 +36,9 @@ int PINT_get_next_path(
 int PINT_split_string_list(
     char ***tokens,
     const char *comma_list);
+void PINT_free_string_list(
+    char ** list, 
+    int len);
 int PINT_remove_base_dir(
     char *pathname,
     char *out_dir,



More information about the PVFS2-CVS mailing list