From fdb8677388aef7aa481cb4cc2d84a38c606c0c7f Mon Sep 17 00:00:00 2001 From: Daniel Ottavio Date: Mon, 29 Aug 2005 03:42:31 +0000 Subject: [PATCH] * 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 --- ChangeLog | 8 +++++++ amd/amd.h | 2 -- amd/info_file.c | 55 --------------------------------------------- amd/mapc.c | 41 +-------------------------------- amd/sun_map_parse.y | 3 --- 5 files changed, 9 insertions(+), 100 deletions(-) diff --git a/ChangeLog b/ChangeLog index e98a616..c2c6bef 100644 --- 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 diff --git a/amd/amd.h b/amd/amd.h index b2b8915..8967323 100644 --- 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 *); diff --git a/amd/info_file.c b/amd/info_file.c index 44cd5e2..c672509 100644 --- a/amd/info_file.c +++ b/amd/info_file.c @@ -53,15 +53,10 @@ #include -/* 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 diff --git a/amd/mapc.c b/amd/mapc.c index 5155787..206287c 100644 --- a/amd/mapc.c +++ b/amd/mapc.c @@ -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); - } - } } } diff --git a/amd/sun_map_parse.y b/amd/sun_map_parse.y index 0ec3412..2ee7a8a 100644 --- a/amd/sun_map_parse.y +++ b/amd/sun_map_parse.y @@ -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 -- 2.43.0