Пример #1
0
char *
get_last_reusable_tape_label(
     int skip)
{
    tape_t *tp = lookup_last_reusable_tape(skip);
    return (tp != NULL) ? tp->label : NULL;
}
Пример #2
0
void
confirm(GSList *datestamp_list)
{
    tape_t *tp;
    char *tpchanger;
    GSList *datestamp;
    int ch;
    char *extra;

    g_printf(_("\nToday is: %s\n"),amflush_datestamp);
    g_printf(_("Flushing dumps from"));
    extra = "";
    for(datestamp = datestamp_list; datestamp != NULL; datestamp = datestamp->next) {
	g_printf("%s %s", extra, (char *)datestamp->data);
	extra = ",";
    }
    tpchanger = getconf_str(CNF_TPCHANGER);
    if(*tpchanger != '\0') {
	g_printf(_(" using tape changer \"%s\".\n"), tpchanger);
    } else {
	g_printf(_(" to tape drive \"%s\".\n"), getconf_str(CNF_TAPEDEV));
    }

    g_printf(_("Expecting "));
    tp = lookup_last_reusable_tape(0);
    if(tp != NULL)
	g_printf(_("tape %s or "), tp->label);
    g_printf(_("a new tape."));
    tp = lookup_tapepos(1);
    if(tp != NULL)
	g_printf(_("  (The last dumps were to tape %s)"), tp->label);

    while (1) {
	g_printf(_("\nAre you sure you want to do this [yN]? "));
	if((ch = get_letter_from_user()) == 'Y') {
	    return;
	} else if (ch == 'N' || ch == '\0' || ch == EOF) {
	    if (ch == EOF) {
		putchar('\n');
	    }
	    break;
	}
    }

    g_printf(_("Ok, quitting.  Run amflush again when you are ready.\n"));
    log_add(L_INFO, "pid-done %ld", (long)getpid());
    exit(1);
}
Пример #3
0
char *
get_last_reusable_tape_label(
    const char *l_template,
    const char *tapepool,
    const char *storage,
    int   retention_tapes,
    int   retention_days,
    int   retention_recover,
    int   retention_full,
    int   skip)
{
    tape_t *tp;
    tp = lookup_last_reusable_tape(l_template, tapepool, storage,
					   retention_tapes,
					   retention_days, retention_recover,
					   retention_full, skip);
    return (tp != NULL) ? tp->label : NULL;
}
Пример #4
0
int taper_scan(char* wantlabel,
               char** gotlabel, char** timestamp, char** tapedev,
               taper_scan_tracker_t * tracker,
               TaperscanOutputFunctor output_functor,
               void *output_data,
               TaperscanProlongFunctor prolong_functor,
               void *prolong_data) {
    char *error_message = NULL;
    int result;
    *gotlabel = *timestamp = NULL;

    if (wantlabel == NULL) {
        tape_t *tmp;
        tmp = lookup_last_reusable_tape(0);
        if (tmp != NULL) {
            wantlabel = tmp->label;
        }
    }

    if (changer_init()) {
        result =  changer_taper_scan(wantlabel, gotlabel, timestamp,
                                     tapedev, tracker,
                                     output_functor, output_data,
                                     prolong_functor, prolong_data);
    } else {
        /* Note that the tracker is not used in this case. */
        *tapedev = stralloc(getconf_str(CNF_TAPEDEV));
        if (*tapedev == NULL) {
            result = -1;
            output_functor(output_data, _("No tapedev specified"));
        } else {
            result =  scan_read_label(*tapedev, NULL, wantlabel, gotlabel,
                                      timestamp, &error_message);
            output_functor(output_data, error_message);
            amfree(error_message);
        }
    }

    return result;
}