* 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
*/
#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 */
{
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);
}
err:
+ if (s_entry != NULL) {
+ XFREE(s_entry);
+ }
return retval;
}
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;
* 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();
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 {
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 {
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 {
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);
}
;
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 {
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);
}
;
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 {
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);
}
;
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);
}
;
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);
}
}
}
-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)
{