* amd/amd.h : oops, reverting bad changes
authorDaniel Ottavio <ottavio@fsl.cs.sunysb.edu>
Mon, 29 Aug 2005 03:42:31 +0000 (03:42 +0000)
committerDaniel Ottavio <ottavio@fsl.cs.sunysb.edu>
Mon, 29 Aug 2005 03:42:31 +0000 (03:42 +0000)
* amd/info_file.c : oops, reverting bad changes

* amd/mapc.c : oops, reverting bad changes

* amd/sun_map_parse.y : oops, reverting bad changes

ChangeLog
amd/amd.h
amd/info_file.c
amd/mapc.c
amd/sun_map_parse.y

index e98a6167185817eb1704a783fdd6462dcf47b898..c2c6bef9cf3c4bcb397eb2d1546fe0f4b4432592 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,14 @@
 
        * amd/sun_map.c (sun_entry2amd) : Wipe out any trailing white
        spaces or '\n' before passing strings to the parser.
+
+       * amd/amd.h : oops, reverting bad changes
+
+       * amd/info_file.c : oops, reverting bad changes
+
+       * amd/mapc.c : oops, reverting bad changes
+
+       * amd/sun_map_parse.y : oops, reverting bad changes
        
 2005-08-27  Erez Zadok  <ezk@cs.sunysb.edu>
 
index b2b891502c824961323226350c8dd7986d9e0911..8967323c014e22764382a23b5d94550312835454 100644 (file)
--- a/amd/amd.h
+++ b/amd/amd.h
@@ -351,7 +351,6 @@ struct mnt_map {
   kv *kvhash[NKVHASH];          /* Cached data */
   cf_map_t *cfm;               /* pointer to per-map amd.conf opts, if any */
   void *map_data;               /* Map data black box */
-  mnt_map *include;             /* list of included maps */            
 };
 
 /*
@@ -573,7 +572,6 @@ extern int  background(void);
 extern void deslashify(char *);
 extern void do_task_notify(void);
 extern int  eval_fs_opts(am_opts *, char *, char *, char *, char *, char *);
-extern char **file_search_include(char *);
 extern int  file_read_line(char *, int, FILE *);
 extern void forcibly_timeout_mp(am_node *);
 extern void free_map(am_node *);
index 44cd5e28bca7f50f25aa2482641acbe001369f9e..c672509349862f938f1f478455709029f2a0388a 100644 (file)
 #include <sun_map.h>
 
 
-/* max number of include lines a map file can have */
-#define MAX_INCLUDE_LINES   16
-
-
 /* forward declarations */
 int file_init_or_mtime(mnt_map *m, char *map, time_t *tp);
 int file_reload(mnt_map *m, char *map, void (*fn) (mnt_map *, char *, char *));
 int file_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp);
-static FILE *file_open(char *map, time_t *tp);
 
 
 int
@@ -95,55 +90,6 @@ file_read_line(char *buf, int size, FILE *fp)
   return done;
 }
 
-char **
-file_search_include(char *map) {
-  
-  char line_buff[INFO_MAX_LINE_LEN];
-  FILE *mapf = NULL;
-  char **retval = NULL, *tmp;
-  int count = 0;
-  size_t len = 0;
-
-  if ((mapf = fopen(map, "r")) == NULL) {
-    plog(XLOG_ERROR, "could not read file %s", map);
-    goto err;
-  }
-  
-  len = MAX_INCLUDE_LINES * sizeof(char*);
-  retval = (char **)xmalloc(len);
-  memset(retval, 0, len);
-  
-  memset(line_buff, 0, sizeof(line_buff));  
-  
-  while ((len = file_read_line(line_buff, sizeof(line_buff), mapf)) > 0) {
-    if (line_buff[0] == '+') {
-      if(count <= MAX_INCLUDE_LINES) {
-       tmp = &line_buff[1];
-       if(*tmp) {
-         /* remove any trailing white spaces and '\n' */
-         int ws = strlen(tmp) - 1;
-         while (ws >= 0 && (isspace(tmp[ws]) || tmp[ws] == '\n')) {
-           tmp[ws--] = '\0';
-         } 
-         
-         retval[count++] = strdup(tmp);
-       }
-      }
-      else {
-       plog(XLOG_WARNING, "too many include lines in map %s", map);
-      }
-    }
-    memset(line_buff, 0, sizeof(line_buff));
-  }
-  
-  if(count == 0) {
-    /* If there are no include lines, pass back NULL */
-    XFREE(retval);
-  }
-  
- err:
-  return retval;
-}
 
 /*
  * Try to locate a key in a file
@@ -214,7 +160,6 @@ file_search_or_reload(mnt_map *m,
         * Return a copy of the data
         */
        char *dc;
-       printf("key :%s\n", kp);
        if (m->cfm->cfm_flags & CFM_SUN_MAP_SYNTAX)
          dc = sun_entry2amd(kp, cp);
        else
index 51557876a8659b4d29d83cdc57541f3210cc4c7f..206287c4727b73fc7137d972d69e49d6a8bb2bed 100644 (file)
@@ -541,16 +541,6 @@ search_map(mnt_map *m, char *key, char **valp)
       plog(XLOG_MAP, "Re-synchronizing cache for map %s", m->map_name);
       mapc_sync(m);
     }
-    if (rc < 0) {
-      /* Try to search any included maps. */
-      mnt_map *inc;
-      for (inc = m->include; inc != NULL; inc = NEXT(mnt_map, inc)) {
-       rc = (*inc->search) (m, m->map_name, key, valp, &m->modify);
-       if (rc > 0) {
-         break;
-       }
-      }
-    }
   } while (rc < 0);
 
   return rc;
@@ -585,7 +575,7 @@ mapc_reload_map(mnt_map *m)
   int error;
   kv *maphash[NKVHASH], *tmphash[NKVHASH];
   time_t t;
-  
+
   error = (*m->mtime) (m, m->map_name, &t);
   if (error) {
     t = m->modify;
@@ -1011,35 +1001,6 @@ mapc_sync(mnt_map *m)
        */
       mapc_find_wildcard(m);
     }
-
-    if (strchr(m->map_name, (int)'/') != NULL) {
-      /*
-       * Look for include lines in the map file.  If the map name
-       * contains a '/' than we assume that it is a file map type.
-       */
-      char **include;
-      int k;
-      
-      /* serch for a list of include lines */
-      include = file_search_include(m->map_name);
-      if (include != NULL) {
-       /* 
-        * For each include line create a mnt_map and add it to the
-        * list of included maps.
-        */
-       mnt_map *map;
-       for (k = 0; include[k] != NULL; k++) {
-         map = mapc_create(include[k], 
-                           "mapdefault", 
-                           "file", 
-                           m->cfm->cfm_dir);
-         /* Add the new map to the list of included maps. */
-         ((qelem *)map)->q_forw = (qelem *)(m->include);
-         m->include = map;
-       }
-       XFREE(include);
-      } 
-    }
   }
 }
 
index 0ec34125b9ed3a2c797e0451a63f29a78b1acb2d..2ee7a8aef9ad3e1fcbe56de22b97118a2fdc102d 100644 (file)
@@ -219,9 +219,6 @@ entry : locations {
   /* Add this entry to the entry list. */
   sun_list_add(get_sun_entry_list(), (qelem *)entry);
 }
-
-/* We need to allow include lines, but we do not handle them here. */
-| '+' WORD
 ;
 
 mountpoints : mountpoint