Lines Matching refs:map
29 * specific to one NIS map.
32 * information about an individual map they are created (on the
33 * heap) when a map is opened and destroyed when it is closed.
37 * If two processes access the same map two map_ctrls will be
61 * map_id_list: hash table for map lists
63 * it is also used as the map ID for
79 * INPUTS: Fully qualified map name
89 map_ctrl *map;
91 map = (map_ctrl *)am(myself, sizeof (map_ctrl));
92 if (NULL == map) {
97 /* Clear new map (in case we have to free it) */
98 map->entries = NULL;
99 map->hash_val = 0;
100 map->map_name = NULL;
101 map->domain = NULL;
102 map->map_path = NULL;
103 map->ttl = NULL;
104 map->ttl_path = NULL;
105 map->trad_map_path = NULL;
106 map->key_data.dptr = NULL;
107 map->open_mode = 0;
108 map->open_flags = 0;
112 * can save a lot of work as map entries are accessed.
114 if (SUCCESS != map_ctrl_init(map, name)) {
117 free_map_ctrl(map);
121 return (map);
134 * Fully qualified name of the map
140 map_ctrl_init(map_ctrl *map, char *name)
145 /* Save map path for future reference */
146 map->map_path = (char *)strdup(name);
147 if (NULL == map->map_path) {
149 "Could not duplicate map path %s", map);
153 /* Work out map's unqualified name from path */
158 "Could not find separator in map path %s", map);
178 /* Save unqualified map name */
179 map->map_name = strdup(q);
180 if (NULL == map->map_name) {
182 "Could not duplicate map name %s", q);
186 /* Work out map's domain name from path */
192 "Could not find domain in map path %s", name);
196 map->domain = (char *)am(myself, p - q);
197 if (NULL == map->domain) {
202 (void) strncpy(map->domain, q + 1, p-q-1);
203 map->domain[p-q-1] = '\0';
212 map->trad_map_path = (char *)am(myself, strlen(map->map_name) +
214 if (NULL == map->trad_map_path) {
217 "traditional map path derived from %s", name);
221 strncpy(map->trad_map_path, name, p - name + 1);
222 map->trad_map_path[p - name + 1] = '\0';
223 strcat(map->trad_map_path, map->map_name);
224 strcat(map->trad_map_path, dbm_pag);
227 map->ttl_path = (char *)am(myself, strlen(map->map_path) +
229 if (NULL == map->ttl_path) {
236 strcpy(map->ttl_path, map->map_path);
237 strcat(map->ttl_path, TTL_POSTFIX);
241 map->hash_val = hash(name);
244 map->magic = MAP_MAGIC;
247 map->entries = NULL;
248 map->ttl = NULL;
251 map->key_data.dptr = NULL;
252 map->key_data.dsize = 0;
260 * DESCRIPTION: Find an existing map_ctrl for a map of a given DBM * (i.e.
300 * of the old map but on balance it is cleaner to just make a new one
308 /* If old map had open handles duplicate them */
333 free_map_ctrl(map_ctrl *map)
336 if (NULL != map->entries) {
337 dbm_close(map->entries);
338 map->entries = NULL;
341 if (NULL != map->map_name) {
342 sfree(map->map_name);
343 map->map_name = NULL;
346 if (NULL != map->map_path) {
347 sfree(map->map_path);
348 map->map_path = NULL;
351 if (NULL != map->domain) {
352 sfree(map->domain);
353 map->domain = NULL;
357 if (NULL != map->ttl) {
358 dbm_close(map->ttl);
359 map->ttl = NULL;
362 if (NULL != map->trad_map_path) {
363 sfree(map->trad_map_path);
364 map->trad_map_path = NULL;
367 if (NULL != map->ttl_path) {
368 sfree(map->ttl_path);
369 map->ttl_path = NULL;
372 if (NULL != map->key_data.dptr) {
373 sfree(map->key_data.dptr);
374 map->key_data.dptr = NULL;
375 map->key_data.dsize = 0;
379 map->magic = 0;
382 sfree(map);
389 * DESCRIPTION: Get the name of a map from its map_ctrl. This could be done
402 map_ctrl *map = (map_ctrl *)db;
404 if (NULL == map)
407 return (map->map_name);
422 set_key_data(map_ctrl *map, datum *data)
430 if (NULL != map->key_data.dptr) {
431 sfree(map->key_data.dptr);
432 map->key_data.dptr = NULL;
433 map->key_data.dsize = 0;
441 map->key_data.dptr = (char *)am(myself, data->dsize);
442 if (NULL == map->key_data.dptr) {
445 memcpy(map->key_data.dptr, data->dptr, data->dsize);
446 map->key_data.dsize = data->dsize;
450 data->dptr = map->key_data.dptr;
459 * DESCRIPTION: Opens both yptol files for a map. This is called both when a
460 * map is opened and when it is reopened as a result of an update
461 * operation. Must be called with map locked.
469 open_yptol_files(map_ctrl *map)
472 /* Open entries map */
473 map->entries = dbm_open(map->map_path, map->open_flags, map->open_mode);
475 if (NULL == map->entries) {
476 /* Maybe we were asked to open a non-existent map. No problem */
481 /* Open TTLs map. Must always be writable */
482 map->ttl = dbm_open(map->ttl_path, O_RDWR | O_CREAT, 0644);
483 if (NULL == map->ttl) {
485 "Cannot open TTL file %s", map->ttl_path);
486 dbm_close(map->entries);
487 map->entries = NULL;
498 * DESCRIPTION: add a map in map_id_list[]
500 * GIVEN : map name
501 * map unique ID
503 * RETURNS : SUCCESS = map added
504 * FAILURE = map not added
567 "no map for index %d", i);
650 /* get map list from mapping file */
653 /* no map for this domain in mapping file */
656 " found no map for domain %s",
672 "%s: no map in domain %s",
685 "%s: map name too long for %s",
700 "%s: failed to insert map %s",