Ejemplo n.º 1
0
int
jndex_tattle (void)
{
	char		buf[100];
	int		i;

	for (i = 0; i < n_ji_media; i++) {
		struct ndmmedia *	me = &ji_media[i];

		ndmmedia_to_str (me, buf);
		ndmjob_log (3, "ji me[%d] %s", i, buf);
	}

	for (i = 0; i < n_ji_environment; i++) {
		ndmp9_pval *		pv = &ji_environment[i];

		ndmjob_log (3, "ji env[%d] %s=%s", i, pv->name, pv->value);
	}

	for (i = 0; (i < n_file_arg) && (i < NDM_MAX_NLIST); i++) {
		if (nlist[i].fh_info.valid) {
			ndmjob_log (3, "ji fil[%d] fi=%lld %s",
				i, nlist[i].fh_info.value, file_arg[i]);
		} else {
			ndmjob_log (3, "ji fil[%d] not-found %s",
				i, file_arg[i]);
		}
	}

	return 0;
}
Ejemplo n.º 2
0
int
jndex_tattle (void)
{
	char			buf[100];
	struct ndmmedia *	me;
	struct ndm_env_entry *	nev;
	int			i;

	for (me = ji_media.head; me; me = me->next) {
		ndmmedia_to_str (me, buf);
		ndmjob_log (3, "ji me[%d] %s", i, buf);
	}

	for (nev = ji_environment.head; nev; nev = nev->next) {
		ndmjob_log (3, "ji env[%d] %s=%s", i, nev->pval.name, nev->pval.value);
	}

	for (i = 0; (i < n_file_arg) && (i < NDM_MAX_NLIST); i++) {
		if (nlist[i].fh_info.valid) {
			ndmjob_log (3, "ji fil[%d] fi=%lld %s",
				i, nlist[i].fh_info.value, file_arg[i]);
		} else {
			ndmjob_log (3, "ji fil[%d] not-found %s",
				i, file_arg[i]);
		}
	}

	return 0;
}
Ejemplo n.º 3
0
int
ndmmedia_pp (struct ndmmedia *me, int lineno, char *buf)
{
    switch (lineno) {
    case 0:
	ndmmedia_to_str (me, buf);
	break;

    case 1:
	sprintf (buf, "valid label=%s filemark=%s n_bytes=%s slot=%s",
		flag_yes_or_no (me->valid_label),
		flag_yes_or_no (me->valid_filemark),
		flag_yes_or_no (me->valid_n_bytes),
		flag_yes_or_no (me->valid_slot));
	break;

    case 2:
	sprintf (buf, "media used=%s written=%s eof=%s eom=%s io_error=%s",
		flag_yes_or_no (me->media_used),
		flag_yes_or_no (me->media_written),
		flag_yes_or_no (me->media_eof),
		flag_yes_or_no (me->media_eom),
		flag_yes_or_no (me->media_io_error));
	break;

    case 3:
	sprintf (buf, "label read=%s written=%s io_error=%s mismatch=%s",
		flag_yes_or_no (me->label_read),
		flag_yes_or_no (me->label_written),
		flag_yes_or_no (me->label_io_error),
		flag_yes_or_no (me->label_mismatch));
	break;

    case 4:
	sprintf (buf, "fm_error=%s nb_determined=%s nb_aligned=%s",
		flag_yes_or_no (me->fmark_error),
		flag_yes_or_no (me->nb_determined),
		flag_yes_or_no (me->nb_aligned));
	break;

    case 5:
	sprintf (buf, "slot empty=%s bad=%s missing=%s",
		flag_yes_or_no (me->slot_empty),
		flag_yes_or_no (me->slot_bad),
		flag_yes_or_no (me->slot_missing));
	break;

    default:
	strcpy (buf, "<<INVALID>>");
	break;
    }

    return 6;
}
Ejemplo n.º 4
0
int
jndex_merge_media (void)
{
	struct ndmmedia *	me;
	struct ndmmedia *	jme;
	int			i, j;

	for (j = 0; j < n_ji_media; j++) {
		jme = &ji_media[j];

		if (! jme->valid_label)
			continue;	/* can't match it up */

		for (i = 0; i < n_m_media; i++) {
			me = &m_media[i];

			if (! me->valid_label)
				continue;	/* can't match it up */

			if (strcmp (jme->label, me->label) != 0)
				continue;

			if (!jme->valid_slot &&  me->valid_slot) {
				jme->slot_addr = me->slot_addr;
				jme->valid_slot = 1;
			}
		}
	}

	for (i = 0; i < n_ji_media; i++) {
		m_media[i] = ji_media[i];
	}
	n_m_media = i;

	ndmjob_log (3, "After merging input -J index with -m entries");
	for (i = 0; i < n_m_media; i++) {
		char		buf[40];

		me = &m_media[i];
		ndmmedia_to_str (me, buf);
		ndmjob_log (3, "%d: -m %s", i+1, buf);
	}

	return 0;
}
Ejemplo n.º 5
0
int
jndex_merge_media (void)
{
	struct ndmmedia *	me;
	struct ndmmedia *	jme;
	int			i;

	for (jme = ji_media.head; jme; jme = jme->next) {
		if (! jme->valid_label)
			continue;	/* can't match it up */

		for (me = m_media.head; me; me = me->next) {
			if (! me->valid_label)
				continue;	/* can't match it up */

			if (strcmp (jme->label, me->label) != 0)
				continue;

			if (!jme->valid_slot &&  me->valid_slot) {
				jme->slot_addr = me->slot_addr;
				jme->valid_slot = 1;
			}
		}
	}

	ndmca_destroy_media_table (&m_media);
	m_media = ji_media;

	ndmjob_log (3, "After merging input -J index with -m entries");
	i = 0;
	for (me = m_media.head; me; me = me->next) {
		char		buf[40];

		ndmmedia_to_str (me, buf);
		ndmjob_log (3, "%d: -m %s", i + 1, buf);
		i++;
	}

	return 0;
}
Ejemplo n.º 6
0
int
ndmca_op_list_labels (struct ndm_session *sess)
{
    struct ndm_control_agent *ca = sess->control_acb;
    struct ndm_job_param *	job = &ca->job;
    struct ndm_media_table *mtab = &job->media_tab;
    int			n_media;
    char			labbuf[NDMMEDIA_LABEL_MAX];
    char			buf[200];
    struct ndmmedia *	me;
    int			rc;

    ca->tape_mode = NDMP9_TAPE_READ_MODE;
    ca->is_label_op = 1;

    rc = ndmca_op_robot_startup (sess, 0);
    if (rc) return rc;	/* already tattled */

    if (job->media_tab.n_media == 0) {
        if (job->have_robot) {
            rc = ndmca_robot_synthesize_media (sess);
            if (rc) return rc;	/* already tattled */
        } else {
            /*
             * No fixup. Should be done by now.
             * See ndma_job_auto_adjust()
             */
        }
    }

    if ((rc = ndmca_connect_tape_agent (sess)) != 0) {
        ndmconn_destruct (sess->plumb.tape);
        sess->plumb.tape = NULL;
        return rc;	/* already tattled */
    }

    n_media = mtab->n_media;

    for (me = mtab->head; me; me = me->next) {
        ca->cur_media_ix = me->index;

        rc = ndmca_media_load_current (sess);
        if (rc) {
            /* already tattled */
            continue;
        }

        rc = ndmca_media_read_label (sess, labbuf);
        if (rc == 'm' || rc == 'V') {
            strcpy (me->label, labbuf);
            me->valid_label = 1;
            ndmmedia_to_str (me, buf);
            ndmalogf (sess, "ME", 0, "%s", buf);
        } else {
            ndmalogf (sess, 0, 0, "failed label read");
        }
        ndmca_media_unload_current (sess);
    }

    return rc;
}