Exemplo n.º 1
0
int
ndmca_monitor_get_post_backup_env (struct ndm_session *sess)
{
	struct ndm_control_agent *ca = sess->control_acb;
	struct ndmlog *		ixlog = &ca->job.index_log;
	struct ndm_env_entry *	entry;
	int			rc;

	rc = ndmca_data_get_env (sess);
	if (rc && ca->data_state.error == NDMP9_ILLEGAL_STATE_ERR) {
		ndmalogf (sess, 0, 2, "fetch post backup env failed");
		return 0;
	}
	if (rc) {
		ndmalogf (sess, 0, 0, "fetch post backup env failed");
		return -1;
	}

	/*
	 * Only print the data when a deliver function was defined.
	 */
	if (ixlog->deliver) {
		for (entry = ca->job.result_env_tab.head; entry; entry = entry->next) {
			ndmlogf (ixlog, "DE", 0, "%s=%s", entry->pval.name, entry->pval.value);
		}
	}

	return 0;
}
Exemplo n.º 2
0
int
ndmca_media_capture_mover_window (struct ndm_session *sess)
{
	struct ndm_control_agent *ca = sess->control_acb;
	struct ndmlog *		ixlog = &ca->job.index_log;
	struct ndm_job_param *	job = &ca->job;
	struct ndmmedia *	me;
	ndmp9_mover_state	ms = ca->mover_state.state;
	ndmp9_mover_pause_reason pr = ca->mover_state.pause_reason;
	char			buf[100];
	uint64_t		wlen;

	for (me = job->media_tab.head; me; me = me->next) {
		if (me->index == ca->cur_media_ix)
			break;
	}

	if (!me) {
		return -1;
	}

	if (ms == NDMP9_MOVER_STATE_PAUSED) {
		if (pr == NDMP9_MOVER_PAUSE_SEEK) {
			/* end-of-window */
		} else if (pr == NDMP9_MOVER_PAUSE_EOM) {
			me->media_eom = 1;	/* tape full */
		} else if (pr == NDMP9_MOVER_PAUSE_EOF) {
			me->media_eof = 1;
		} else if (pr == NDMP9_MOVER_PAUSE_MEDIA_ERROR) {
			me->media_io_error = 1;
		} else {
			/* what */
		}
	} else if (ms == NDMP9_MOVER_STATE_HALTED) {
		/* if tape_mode == READ, this may not actually be the window */
	/* TODO: should STATE_LISTEN be considered? */
	} else {
		ndmalogf (sess, 0, 1,
			"Warning: capturing offset w/o quiescent mover");
	}

	wlen = ca->mover_state.record_num;
	wlen *= job->record_size;
	wlen -= job->last_w_offset;	/* want the size of this image */

	me->valid_n_bytes = 1;
	me->nb_determined = 1;
	me->n_bytes = wlen;

	/*
	 * Only print the data when a deliver function was defined.
	 */
	if (ixlog->deliver) {
		ndmmedia_pp (me, 0, buf);
		ndmlogf (ixlog, "CM", 0, "%02d %s", ca->cur_media_ix, buf);
	}

	return 0;
}
Exemplo n.º 3
0
int
ndmfhdb_add_dirnode_root (struct ndmlog *ixlog, int tagc,
  ndmp9_u_quad root_node)
{
	char		prefix[8];

	strcpy (prefix, "DHr");
	prefix[0] = tagc;

	ndmlogf (ixlog, prefix, 0, "%llu", root_node);

	return 0;
}
Exemplo n.º 4
0
int
ndmfhdb_add_node (struct ndmlog *ixlog, int tagc,
  ndmp9_u_quad node, ndmp9_file_stat *fstat)
{
	char		prefix[8];
	char		statbuf[100];

	strcpy (prefix, "DHn");
	prefix[0] = tagc;

	ndm_fstat_to_str (fstat, statbuf);

	ndmlogf (ixlog, prefix, 0, "%llu UNIX %s", node, statbuf);

	return 0;
}
Exemplo n.º 5
0
int
ndmfhdb_add_dir (struct ndmlog *ixlog, int tagc,
  char *raw_name, ndmp9_u_quad dir_node, ndmp9_u_quad node)
{
	char		prefix[8];
	char		namebuf[NDMOS_CONST_PATH_MAX];

	strcpy (prefix, "DHd");
	prefix[0] = tagc;

	ndmcstr_from_str (raw_name, namebuf, sizeof namebuf);

	ndmlogf (ixlog, prefix, 0, "%llu %s UNIX %llu",
		dir_node, namebuf, node);

	return 0;
}
Exemplo n.º 6
0
int
ndmfhdb_add_file (struct ndmlog *ixlog, int tagc,
  char *raw_name, ndmp9_file_stat *fstat)
{
	char		prefix[8];
	char		statbuf[100];
	char		namebuf[NDMOS_CONST_PATH_MAX];

	strcpy (prefix, "DHf");
	prefix[0] = tagc;

	ndm_fstat_to_str (fstat, statbuf);

	ndmcstr_from_str (raw_name, namebuf, sizeof namebuf);

	ndmlogf (ixlog, prefix, 0, "%s UNIX %s", namebuf, statbuf);

	return 0;
}