Пример #1
0
int era_dm_message0(const char *name, const char *message)
{
	struct dm_task *dmt;
	int rc = -1;

	if (!(dmt = dm_task_create(DM_DEVICE_TARGET_MSG)))
		return -1;

	if (!dm_task_set_name(dmt, name))
		goto out;

	if (!dm_task_set_sector(dmt, 0))
		goto out;

	if (!dm_task_set_message(dmt, message))
		goto out;

	if (!dm_task_run(dmt))
		goto out;

	rc = 0;
out:
	dm_task_destroy(dmt);
	return rc;
}
Пример #2
0
int
dm_message(const char * mapname, char * message)
{
	int r = 1;
	struct dm_task *dmt;

	if (!(dmt = dm_task_create(DM_DEVICE_TARGET_MSG)))
		return 1;

	if (!dm_task_set_name(dmt, mapname))
		goto out;

	if (!dm_task_set_sector(dmt, 0))
		goto out;

	if (!dm_task_set_message(dmt, message))
		goto out;

	dm_task_no_open_count(dmt);

	if (!dm_task_run(dmt))
		goto out;

	r = 0;
out:
	if (r)
		condlog(0, "DM message failed [%s]", message);

	dm_task_destroy(dmt);
	return r;
}
Пример #3
0
Файл: dm.c Проект: radii/dmsteg
int dm_message(char *path, char *message)
{
	struct dm_task *task;
	int e = -EIO;
	if(!path) {
		goto fail;
	}
	if(!(task = dm_task_create(DM_DEVICE_TARGET_MSG))) {
		goto fail;
	}
	if(!dm_task_set_name(task, path)) {
		goto fail;
	}
	if(!dm_task_set_sector(task, 0)) {
		goto fail;
	}
	if(!dm_task_set_message(task, message)) {
		goto fail;
	}
	if(!dm_task_run(task)) {
		e = -errno;
		goto fail;
	}
	e = 0;
	fail:
	dm_task_destroy(task);
	return e;
}
Пример #4
0
static int _dm_message(const char *name, const char *msg)
{
	int r = 0;
	struct dm_task *dmt;

	if (!(dmt = dm_task_create(DM_DEVICE_TARGET_MSG)))
		return 0;

	if (name && !dm_task_set_name(dmt, name))
		goto out;

	if (!dm_task_set_sector(dmt, (uint64_t) 0))
		goto out;

	if (!dm_task_set_message(dmt, msg))
		goto out;

	r = dm_task_run(dmt);

      out:
	dm_task_destroy(dmt);
	return r;
}