Lines Matching refs:map

31  *		specific to one NIS map.
34 * information about an individual map they are created (on the
35 * heap) when a map is opened and destroyed when it is closed.
39 * If two processes access the same map two map_ctrls will be
63 * map_id_list: hash table for map lists
65 * it is also used as the map ID for
81 * INPUTS: Fully qualified map name
91 map_ctrl *map;
93 map = (map_ctrl *)am(myself, sizeof (map_ctrl));
94 if (NULL == map) {
99 /* Clear new map (in case we have to free it) */
100 map->entries = NULL;
101 map->hash_val = 0;
102 map->map_name = NULL;
103 map->domain = NULL;
104 map->map_path = NULL;
105 map->ttl = NULL;
106 map->ttl_path = NULL;
107 map->trad_map_path = NULL;
108 map->key_data.dptr = NULL;
109 map->open_mode = 0;
110 map->open_flags = 0;
114 * can save a lot of work as map entries are accessed.
116 if (SUCCESS != map_ctrl_init(map, name)) {
119 free_map_ctrl(map);
123 return (map);
136 * Fully qualified name of the map
142 map_ctrl_init(map_ctrl *map, char *name)
147 /* Save map path for future reference */
148 map->map_path = (char *)strdup(name);
149 if (NULL == map->map_path) {
151 "Could not duplicate map path %s", map);
155 /* Work out map's unqualified name from path */
160 "Could not find separator in map path %s", map);
180 /* Save unqualified map name */
181 map->map_name = strdup(q);
182 if (NULL == map->map_name) {
184 "Could not duplicate map name %s", q);
188 /* Work out map's domain name from path */
194 "Could not find domain in map path %s", name);
198 map->domain = (char *)am(myself, p - q);
199 if (NULL == map->domain) {
204 (void) strncpy(map->domain, q + 1, p-q-1);
205 map->domain[p-q-1] = '\0';
214 map->trad_map_path = (char *)am(myself, strlen(map->map_name) +
216 if (NULL == map->trad_map_path) {
219 "traditional map path derived from %s", name);
223 strncpy(map->trad_map_path, name, p - name + 1);
224 map->trad_map_path[p - name + 1] = '\0';
225 strcat(map->trad_map_path, map->map_name);
226 strcat(map->trad_map_path, dbm_pag);
229 map->ttl_path = (char *)am(myself, strlen(map->map_path) +
231 if (NULL == map->ttl_path) {
238 strcpy(map->ttl_path, map->map_path);
239 strcat(map->ttl_path, TTL_POSTFIX);
243 map->hash_val = hash(name);
246 map->magic = MAP_MAGIC;
249 map->entries = NULL;
250 map->ttl = NULL;
253 map->key_data.dptr = NULL;
254 map->key_data.dsize = 0;
262 * DESCRIPTION: Find an existing map_ctrl for a map of a given DBM * (i.e.
302 * of the old map but on balance it is cleaner to just make a new one
310 /* If old map had open handles duplicate them */
335 free_map_ctrl(map_ctrl *map)
338 if (NULL != map->entries) {
339 dbm_close(map->entries);
340 map->entries = NULL;
343 if (NULL != map->map_name) {
344 sfree(map->map_name);
345 map->map_name = NULL;
348 if (NULL != map->map_path) {
349 sfree(map->map_path);
350 map->map_path = NULL;
353 if (NULL != map->domain) {
354 sfree(map->domain);
355 map->domain = NULL;
359 if (NULL != map->ttl) {
360 dbm_close(map->ttl);
361 map->ttl = NULL;
364 if (NULL != map->trad_map_path) {
365 sfree(map->trad_map_path);
366 map->trad_map_path = NULL;
369 if (NULL != map->ttl_path) {
370 sfree(map->ttl_path);
371 map->ttl_path = NULL;
374 if (NULL != map->key_data.dptr) {
375 sfree(map->key_data.dptr);
376 map->key_data.dptr = NULL;
377 map->key_data.dsize = 0;
381 map->magic = 0;
384 sfree(map);
391 * DESCRIPTION: Get the name of a map from its map_ctrl. This could be done
404 map_ctrl *map = (map_ctrl *)db;
406 if (NULL == map)
409 return (map->map_name);
424 set_key_data(map_ctrl *map, datum *data)
432 if (NULL != map->key_data.dptr) {
433 sfree(map->key_data.dptr);
434 map->key_data.dptr = NULL;
435 map->key_data.dsize = 0;
443 map->key_data.dptr = (char *)am(myself, data->dsize);
444 if (NULL == map->key_data.dptr) {
447 memcpy(map->key_data.dptr, data->dptr, data->dsize);
448 map->key_data.dsize = data->dsize;
452 data->dptr = map->key_data.dptr;
461 * DESCRIPTION: Opens both yptol files for a map. This is called both when a
462 * map is opened and when it is reopened as a result of an update
463 * operation. Must be called with map locked.
471 open_yptol_files(map_ctrl *map)
474 /* Open entries map */
475 map->entries = dbm_open(map->map_path, map->open_flags, map->open_mode);
477 if (NULL == map->entries) {
478 /* Maybe we were asked to open a non-existent map. No problem */
483 /* Open TTLs map. Must always be writable */
484 map->ttl = dbm_open(map->ttl_path, O_RDWR | O_CREAT, 0644);
485 if (NULL == map->ttl) {
487 "Cannot open TTL file %s", map->ttl_path);
488 dbm_close(map->entries);
489 map->entries = NULL;
500 * DESCRIPTION: add a map in map_id_list[]
502 * GIVEN : map name
503 * map unique ID
505 * RETURNS : SUCCESS = map added
506 * FAILURE = map not added
569 "no map for index %d", i);
652 /* get map list from mapping file */
655 /* no map for this domain in mapping file */
658 " found no map for domain %s",
674 "%s: no map in domain %s",
687 "%s: map name too long for %s",
702 "%s: failed to insert map %s",