autofs-5.0.9 - amd lookup use flags in map_source for format From: Ian Kent We will need to check the map format several times so add a flags field to the map_source struct so we don't need to use strcmp() every time. --- daemon/lookup.c | 2 ++ include/master.h | 3 +++ lib/master.c | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/daemon/lookup.c b/daemon/lookup.c index d6d9af9..bc6263b 100644 --- a/daemon/lookup.c +++ b/daemon/lookup.c @@ -476,6 +476,7 @@ static enum nsswitch_status read_map_source(struct nss_source *this, } this->source[4] = '\0'; + tmap.flags = map->flags; tmap.type = this->source; tmap.format = map->format; tmap.lookup = map->lookup; @@ -871,6 +872,7 @@ static enum nsswitch_status lookup_map_name(struct nss_source *this, } this->source[4] = '\0'; + tmap.flags = map->flags; tmap.type = this->source; tmap.format = map->format; tmap.mc = map->mc; diff --git a/include/master.h b/include/master.h index e77d5ba..8833ddf 100644 --- a/include/master.h +++ b/include/master.h @@ -20,7 +20,10 @@ #ifndef MASTER_H #define MASTER_H +#define MAP_FLAG_FORMAT_AMD 0x0001 + struct map_source { + unsigned int flags; char *type; char *format; time_t exp_timeout; /* Timeout for expiring mounts */ diff --git a/lib/master.c b/lib/master.c index ce6320e..4ac3c6a 100644 --- a/lib/master.c +++ b/lib/master.c @@ -178,6 +178,8 @@ master_add_map_source(struct master_mapent *entry, return NULL; } source->format = nformat; + if (!strcmp(nformat, "amd")) + source->flags |= MAP_FLAG_FORMAT_AMD; } source->age = age; @@ -430,6 +432,8 @@ master_add_source_instance(struct map_source *source, const char *type, const ch return NULL; } new->format = nformat; + if (!strcmp(nformat, "amd")) + new->flags |= MAP_FLAG_FORMAT_AMD; } new->age = age;