* amd/sun_map.c: Clean up #defines
authorDaniel Ottavio <ottavio@fsl.cs.sunysb.edu>
Sat, 20 Aug 2005 19:20:29 +0000 (19:20 +0000)
committerDaniel Ottavio <ottavio@fsl.cs.sunysb.edu>
Sat, 20 Aug 2005 19:20:29 +0000 (19:20 +0000)
(sun_entry2amd) : Verify that the key and entry values passed are
not NULL.  Free the Sun entry struct when done.

* amd/sun_map.h: Add some "not implemented yet" comments to the
map and mmap structures.

* amd/sun_map_parse.y: Removed automap include functionality, it
will need to be re-implemented using a pre-processor.
Clean up fucntion calls.

ChangeLog
amd/sun_map.c
amd/sun_map.h
amd/sun_map_parse.y

index 16659c7c226c6b46d6a52295738962a8bfa3741f..8659eff95c91aaaa8bd5d54acebab63ebc2445ac 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2005-08-20  Daniel P. Ottavio  <dottavio@ic.sunysb.edu>
+
+       * amd/sun_map.c: Clean up #defines
+       (sun_entry2amd) : Verify that the key and entry values passed are
+       not NULL.  Free the Sun entry struct when done.
+
+       * amd/sun_map.h: Add some "not implemented yet" comments to the
+       map and mmap structures.
+
+       * amd/sun_map_parse.y: Removed automap include functionality, it
+       will need to be re-implemented using a pre-processor.
+       Clean up fucntion calls.
+       
 2005-08-16  Daniel P. Ottavio  <dottavio@ic.sunysb.edu>
 
        * amd/sun2amd.c (sun2amd_convert): If the input line is too long
index ce2ff0fdfca0a994cf2d06205606745d2e736ce9..d65a6c73a9496567fbe5e79f1ac5b92704cf0fbe 100644 (file)
@@ -76,14 +76,6 @@ sun_list_add(struct sun_list *list, qelem *item)
  * Sun2Amd conversion routines
  */
 
-/*
- * A set of string Sun fstypes.
- */
-#define SUN_NFS_TYPE     "nfs"
-#define SUN_HSFS_TYPE    "hsfs" /* CD fs */
-#define SUN_AUTOFS_TYPE  "autofs"
-#define SUN_CACHEFS_TYPE "cachefs"
-
 /*
  * AMD entry keywords
  */
@@ -98,6 +90,13 @@ sun_list_add(struct sun_list *list, qelem *item)
 #define AMD_MAP_FS_KW    "fs:=${map};" /* set the mount map as current map */
 #define AMD_MAP_PREF_KW  "pref:=${key};" /* set the mount map as current map */
 
+/*
+ * A set of string Sun fstypes.
+ */
+#define SUN_NFS_TYPE     "nfs"
+#define SUN_HSFS_TYPE    "hsfs" /* CD fs */
+#define SUN_AUTOFS_TYPE  "autofs"
+#define SUN_CACHEFS_TYPE "cachefs"
 
 #define SUN_KEY_SUB      "&"         /* Sun key subsitution */
 
@@ -527,7 +526,18 @@ sun_entry2amd(const char *key, const char *s_entry_str)
 {
   char *retval = NULL;
   char line_buff[INFO_MAX_LINE_LEN];
-  struct sun_entry *s_entry;
+  struct sun_entry *s_entry = NULL;
+
+  /* For now the key should no be NULL. */
+  if (key == NULL) {
+    plog(XLOG_ERROR,"Sun key value was null");
+    goto err;
+  }
+  /* The Sun entry string should never be NULL. */
+  if (s_entry == NULL) {
+    plog(XLOG_ERROR,"Sun entry value was null");
+    goto err;
+  }
 
   /* Parse the sun entry line. */
   s_entry = sun_map_parse_read(s_entry_str);
@@ -584,5 +594,8 @@ sun_entry2amd(const char *key, const char *s_entry_str)
   }
 
  err:
+  if (s_entry != NULL) {
+    XFREE(s_entry);
+  }
   return retval;
 }
index bbd04da083bd500caf1e45d3f4b25421e022fa4f..8c8b527d3ee58227cca8bf4219e5d34750a6d8fd 100644 (file)
@@ -83,7 +83,11 @@ struct sun_entry {
   struct sun_mountpt  *mountpt_list;  /* list of mount points */
 };
 
-/* automount map file */
+/* 
+ * automount map file 
+ *
+ * XXX: Only a place holder structure, not implemented yet.
+ */
 struct sun_map {
   qelem head;                     /* link-list header */
   char *path;                     /* directory path of the map file */
@@ -95,7 +99,11 @@ struct sun_map {
   struct sun_entry *entry_list;   /* list of 'struct s2a_entry' */
 };
 
-/* master map file */
+/* 
+ * master map file 
+ *
+ * XXX: Only a place holder structure, not implemented yet.
+ */
 struct sun_mmap {
   qelem head;                   /* link-list header */
   struct sun_opt *include_list; /* list of included master maps */
index dfad387d27d58b35d521ec5b982c6507f3590330..86fa7cd4c1b5cb7fcc030962ed96099ad3c7e398 100644 (file)
@@ -62,7 +62,6 @@ extern int sun_map_parse(void);
 struct sun_entry *sun_map_parse_read(const char *);
 
 static struct sun_list *sun_entry_list = NULL;
-static struct sun_list *sun_include_list = NULL;
 static struct sun_list *sun_opt_list = NULL;
 static struct sun_list *sun_host_list = NULL;
 static struct sun_list *sun_location_list = NULL;
@@ -75,7 +74,6 @@ static char *tmpFsType = NULL;
  * list structure.  If the structure is NULL than a new instance is
  * returned.
  */
-static struct sun_list *get_sun_include_list();
 static struct sun_list *get_sun_opt_list();
 static struct sun_list *get_sun_host_list();
 static struct sun_list *get_sun_location_list();
@@ -127,7 +125,7 @@ entry : locations {
   sun_location_list = NULL;
 
    /* Add this entry to the entry list. */
-  sun_list_add(get_sun_entry_list(),(qelem *)entry);
+  sun_list_add(get_sun_entry_list(), (qelem *)entry);
 }
 
 | '-' options WSPACE locations {
@@ -162,7 +160,7 @@ entry : locations {
   sun_opt_list = NULL;
 
   /* Add this entry to the entry list. */
-  sun_list_add(get_sun_entry_list(),(qelem *)entry);
+  sun_list_add(get_sun_entry_list(), (qelem *)entry);
 }
 
 | mountpoints {
@@ -183,7 +181,7 @@ entry : locations {
   mountpt_list = NULL;
 
   /* Add this entry to the entry list. */
-  sun_list_add(get_sun_entry_list(),(qelem *)entry);
+  sun_list_add(get_sun_entry_list(), (qelem *)entry);
 }
 
 | '-' options WSPACE mountpoints {
@@ -219,15 +217,7 @@ entry : locations {
   sun_opt_list = NULL;
 
   /* Add this entry to the entry list. */
-  sun_list_add(get_sun_entry_list(),(qelem *)entry);
-}
-
-| '+' WORD {
-
-  struct sun_opt *include = CALLOC(struct sun_opt);
-  include->str = strdup($2);
-
-  sun_list_add(get_sun_include_list(),(qelem *)include);
+  sun_list_add(get_sun_entry_list(), (qelem *)entry);
 }
 ;
 
@@ -255,7 +245,7 @@ mountpoint : WORD WSPACE location {
   mountpt->path = strdup($1);
 
   /* Add this mountpt to the mountpt list. */
-  sun_list_add(get_mountpt_list(),(qelem *)mountpt);
+  sun_list_add(get_mountpt_list(), (qelem *)mountpt);
 }
 
 | WORD WSPACE '-' options WSPACE location {
@@ -287,7 +277,7 @@ mountpoint : WORD WSPACE location {
   mountpt->path = strdup($1);
 
   /* Add this mountpt to the mountpt list. */
-  sun_list_add(get_mountpt_list(),(qelem *)mountpt);
+  sun_list_add(get_mountpt_list(), (qelem *)mountpt);
 }
 ;
 
@@ -315,7 +305,7 @@ location : hosts ':' WORD {
   location->path = strdup($3);
 
   /* Add this location to the location list. */
-  sun_list_add(get_sun_location_list(),(qelem *)location);
+  sun_list_add(get_sun_location_list(), (qelem *)location);
 }
 
 | ':' WORD {
@@ -328,7 +318,7 @@ location : hosts ':' WORD {
   location->path = strdup($2);
 
   /* Add this location to the location list. */
-  sun_list_add(get_sun_location_list(),(qelem *)location);
+  sun_list_add(get_sun_location_list(), (qelem *)location);
 }
 ;
 
@@ -371,7 +361,7 @@ weight : '(' WORD ')' {
   host->weight = val;
 
   /* Add this host to the host list. */
-  sun_list_add(get_sun_host_list(),(qelem *)host);
+  sun_list_add(get_sun_host_list(), (qelem *)host);
 }
 ;
 
@@ -403,7 +393,7 @@ option : WORD {
     struct sun_opt *opt = CALLOC(struct sun_opt);
     opt->str = strdup($1);
     /* Add this opt to the opt list. */
-    sun_list_add(get_sun_opt_list(),(qelem *)opt);
+    sun_list_add(get_sun_opt_list(), (qelem *)opt);
   }
 }
 
@@ -451,16 +441,6 @@ sun_map_parse_read(const char *map_data)
 }
 
 
-static struct sun_list *
-get_sun_include_list(void)
-{
-  if (sun_include_list == NULL) {
-    sun_include_list = CALLOC(struct sun_list);
-  }
-  return sun_include_list;
-}
-
-
 static struct sun_list *
 get_sun_entry_list(void)
 {