Lines Matching full:gen
92 * open a file generation according to the current settings of gen
98 FILEGEN * gen, in filegen_open() argument
113 len = strlen(gen->dir) + strlen(gen->fname) + 65; in filegen_open()
117 snprintf(filename, len, "%s%s", gen->dir, gen->fname); in filegen_open()
127 switch (gen->type) { in filegen_open()
133 gen->type, filename); in filegen_open()
134 gen->type = FILEGEN_NONE; in filegen_open()
142 gen->id_lo = getpid(); in filegen_open()
143 gen->id_hi = 0; in filegen_open()
145 SUFFIX_SEP, gen->id_lo); in filegen_open()
158 gen->id_lo = ntpcal_date_to_ntp(&cal); in filegen_open()
159 gen->id_hi = (u_int32)(gen->id_lo + SECSPERDAY); in filegen_open()
168 gen->id_lo = isocal_date_to_ntp(&iso); in filegen_open()
169 gen->id_hi = (u_int32)(gen->id_lo + 7 * SECSPERDAY); in filegen_open()
178 gen->id_lo = ntpcal_date_to_ntp(&cal); in filegen_open()
180 gen->id_hi = ntpcal_date_to_ntp(&cal); in filegen_open()
189 gen->id_lo = ntpcal_date_to_ntp(&cal); in filegen_open()
191 gen->id_hi = ntpcal_date_to_ntp(&cal); in filegen_open()
195 gen->id_lo = current_time - (current_time % SECSPERDAY); in filegen_open()
196 gen->id_hi = gen->id_lo + SECSPERDAY; in filegen_open()
198 SUFFIX_SEP, gen->id_lo); in filegen_open()
208 if (FILEGEN_NONE != gen->type) { in filegen_open()
283 gen->type, stamp, fullname)); in filegen_open()
300 if (NULL != gen->fp) { in filegen_open()
301 fclose(gen->fp); in filegen_open()
302 gen->fp = NULL; in filegen_open()
304 gen->fp = fp; in filegen_open()
306 if (gen->flag & FGEN_FLAG_LINK) { in filegen_open()
310 * gen->basename spanning directory levels in filegen_open()
340 * this function sets up gen->fp to point to the correct
349 FILEGEN * gen, in filegen_setup() argument
356 if (!(gen->flag & FGEN_FLAG_ENABLED)) { in filegen_setup()
357 if (NULL != gen->fp) { in filegen_setup()
358 fclose(gen->fp); in filegen_setup()
359 gen->fp = NULL; in filegen_setup()
364 switch (gen->type) { in filegen_setup()
372 current = ((int)gen->id_lo == getpid()); in filegen_setup()
376 current = (gen->id_lo <= current_time) && in filegen_setup()
377 (gen->id_hi > current_time); in filegen_setup()
384 current = (gen->id_lo <= now) && in filegen_setup()
385 (gen->id_hi > now); in filegen_setup()
392 if (NULL == gen->fp || !current) { in filegen_setup()
393 DPRINTF(1, ("filegen %0x %u\n", gen->type, now)); in filegen_setup()
395 filegen_open(gen, now, &pivot); in filegen_setup()
405 FILEGEN * gen, in filegen_config() argument
419 if (strcmp(dir, gen->dir) == 0 && strcmp(fname, gen->fname) == 0 in filegen_config()
420 && type == gen->type && flag == gen->flag) in filegen_config()
429 if (NULL != gen->fp) { in filegen_config()
430 fclose(gen->fp); in filegen_config()
431 gen->fp = NULL; in filegen_config()
442 gen->dir, dir, in filegen_config()
443 gen->fname, fname, in filegen_config()
444 gen->type, type, in filegen_config()
445 gen->flag, flag)); in filegen_config()
447 if (strcmp(gen->dir, dir) != 0) { in filegen_config()
448 free(gen->dir); in filegen_config()
449 gen->dir = estrdup(dir); in filegen_config()
452 if (strcmp(gen->fname, fname) != 0) { in filegen_config()
453 free(gen->fname); in filegen_config()
454 gen->fname = estrdup(fname); in filegen_config()
456 gen->type = (u_char)type; in filegen_config()
457 gen->flag = (u_char)flag; in filegen_config()
467 filegen_setup(gen, now.l_ui); in filegen_config()