2005-08-15 Erez Zadok <ezk@cs.sunysb.edu>
+ * amd/mapc.c (mapc_create): mapc find takes 4th arg, the mount
+ point. Now, we can properly initialize the cfm structure of the
+ mnt_map, so we can have access to the flags (e.g., SUN_MAP_SYNTAX)
+ inside each info_*.c file.
+ (mapc_find): takes 4rd arg (mntpt) and passes it to calls to
+ mapc_create.
+ (root_newmap): pass NULL as 4th arg (mntpt).
+
+ * amd/amfs_generic.c (amfs_parse_defaults): remove ugly hack to
+ initialize map cfm structure (including flags) so late.
+
+ * amd/autil.c (amfs_mkcacheref): pass mount point as 4th arg to
+ mapc_find.
+
+ * amd/amfs_root.c (amfs_root_mount): pass NULL as new 4th arg to
+ mapc_find.
+
+ * amd/amd.h: extern for mapc_find changed to pass the mount point.
+
* libamu/xutil.c: debug_flags should be unsigned.
(dbg_opt): fix comments for updated debug_flags, add "defaults".
(debug_option): Don't allow "immutable" (D_IMMUTABLE) flags to be
extern void make_root_node(void);
extern void map_flush_srvr(fserver *);
extern void mapc_add_kv(mnt_map *, char *, char *);
-extern mnt_map *mapc_find(char *, char *, const char *);
+extern mnt_map *mapc_find(char *, char *, const char *, const char *);
extern void mapc_free(opaque_t);
extern int mapc_keyiter(mnt_map *, key_fun, opaque_t);
extern void mapc_reload(void);
/*
* Find out if amd.conf overrode any map-specific /defaults.
- *
- * HACK ALERT: there's no easy way to find out what the map mount point is
- * at this point, so I am forced to initialize the mnt_map->cfm field here
- * for the first time, upon the very first search for a /defaults entry in
- * this map. This initialization is much better done in mapc_create(),
- * but it's impossible to do that there with the current code structure.
*/
- if (mm->cfm == NULL) { /* then initialize it for first time */
- mm->cfm = find_cf_map(mf->mf_mount);
- }
if (mm->cfm && mm->cfm->cfm_defaults) {
dlog("map %s map_defaults override: %s", mf->mf_mount, mm->cfm->cfm_defaults);
dflts = strdup(mm->cfm->cfm_defaults);
amfs_root_mount(am_node *mp, mntfs *mf)
{
mf->mf_mount = strealloc(mf->mf_mount, pid_fsname);
- mf->mf_private = (opaque_t) mapc_find(mf->mf_info, "", NULL);
+ mf->mf_private = (opaque_t) mapc_find(mf->mf_info, "", NULL, NULL);
mf->mf_prfree = mapc_free;
return 0;
cache = mf->mf_fo->opt_cache;
else
cache = "none";
- mf->mf_private = (opaque_t) mapc_find(mf->mf_info, cache,
- mf->mf_fo->opt_maptype);
+ mf->mf_private = (opaque_t) mapc_find(mf->mf_info,
+ cache,
+ mf->mf_fo->opt_maptype,
+ mf->mf_mount);
mf->mf_prfree = mapc_free;
}
* Create a new map
*/
static mnt_map *
-mapc_create(char *map, char *opt, const char *type)
+mapc_create(char *map, char *opt, const char *type, const char *mntpt)
{
mnt_map *m = ALLOC(struct mnt_map);
map_type *mt;
m->refc = 1;
m->wildcard = NULL;
m->reloads = 0;
- /* Unfortunately with current code structure, this cannot be initialized here */
- m->cfm = NULL;
+ /* initialize per-map information (flags, etc.) */
+ m->cfm = find_cf_map(mntpt);
/*
* synchronize cache with reality
* Find a map, or create one if it does not exist
*/
mnt_map *
-mapc_find(char *map, char *opt, const char *maptype)
+mapc_find(char *map, char *opt, const char *maptype, const char *mntpt)
{
mnt_map *m;
ITER(m, mnt_map, &map_list_head)
if (STREQ(m->map_name, map))
return mapc_dup(m);
- m = mapc_create(map, opt, maptype);
+ m = mapc_create(map, opt, maptype, mntpt);
ins_que(&m->hdr, &map_list_head);
return m;
* First make sure we have a root map to talk about...
*/
if (!root_map)
- root_map = mapc_find(ROOT_MAP, "mapdefault", NULL);
+ root_map = mapc_find(ROOT_MAP, "mapdefault", NULL, NULL);
/*
* Then add the entry...