• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ dm_task_create函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中dm_task_create函数的典型用法代码示例。如果您正苦于以下问题:C++ dm_task_create函数的具体用法?C++ dm_task_create怎么用?C++ dm_task_create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了dm_task_create函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: dm_dev_t

static int
dm_dev_t (const char * mapname, char * dev_t, int len)
{
	int r = 1;
	struct dm_task *dmt;
	struct dm_info info;

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

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

	if (!dm_task_run(dmt))
		goto out;

	if (!dm_task_get_info(dmt, &info) || !info.exists)
		goto out;

	if (snprintf(dev_t, len, "%i:%i", info.major, info.minor) > len)
		goto out;

	r = 0;
out:
	dm_task_destroy(dmt);
	return r;
}
开发者ID:cathay4t,项目名称:multipath-tools,代码行数:27,代码来源:devmapper.c


示例2: dm_get_minor

int
dm_get_minor (char * mapname)
{
	int r = -1;
	struct dm_task *dmt;
	struct dm_info info;

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

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

	if (!dm_task_run(dmt))
		goto out;

	if (!dm_task_get_info(dmt, &info))
		goto out;

	if (!info.exists)
		goto out;

	r = info.minor;
out:
	dm_task_destroy(dmt);
	return r;
}
开发者ID:cathay4t,项目名称:multipath-tools,代码行数:27,代码来源:devmapper.c


示例3: dm_get_status

extern int
dm_get_status(char * name, char * outstatus)
{
	int r = 1;
	struct dm_task *dmt;
	uint64_t start, length;
	char *target_type;
	char *status;

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

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

	dm_task_no_open_count(dmt);

	if (!dm_task_run(dmt))
		goto out;

	/* Fetch 1st target */
	dm_get_next_target(dmt, NULL, &start, &length,
			   &target_type, &status);

	if (snprintf(outstatus, PARAMS_SIZE, "%s", status) <= PARAMS_SIZE)
		r = 0;
out:
	if (r)
		condlog(0, "%s: error getting map status string", name);

	dm_task_destroy(dmt);
	return r;
}
开发者ID:cathay4t,项目名称:multipath-tools,代码行数:33,代码来源:devmapper.c


示例4: dm_type

/*
 * returns:
 *    1 : match
 *    0 : no match
 *   -1 : empty map
 */
extern int
dm_type(const char * name, char * type)
{
	int r = 0;
	struct dm_task *dmt;
	uint64_t start, length;
	char *target_type = NULL;
	char *params;

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

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

	dm_task_no_open_count(dmt);

	if (!dm_task_run(dmt))
		goto out;

	/* Fetch 1st target */
	dm_get_next_target(dmt, NULL, &start, &length,
			   &target_type, &params);

	if (!target_type)
		r = -1;
	else if (!strcmp(target_type, type))
		r = 1;

out:
	dm_task_destroy(dmt);
	return r;
}
开发者ID:cathay4t,项目名称:multipath-tools,代码行数:39,代码来源:devmapper.c


示例5: era_dm_list

int era_dm_list(int (*cb)(void *arg, const char *name), void *cbarg)
{
	struct dm_task *dmt;
	struct dm_names *names;
	unsigned next = 0;

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

	if (!dm_task_run(dmt))
		goto out;

	if (!(names = dm_task_get_names(dmt)))
		goto out;

	if (names->dev)
	{
		do {
			names = (struct dm_names *)((char *)names + next);
			if (cb(cbarg, names->name))
				goto out;
			next = names->next;
		} while(next);
	}

	dm_task_destroy(dmt);
	return 0;
out:
	dm_task_destroy(dmt);
	return -1;
}
开发者ID:004helix,项目名称:erasetup,代码行数:31,代码来源:era_dm.c


示例6: virStorageBackendGetMinorNumber

static int
virStorageBackendGetMinorNumber(const char *dev_name, uint32_t *minor)
{
    int ret = -1;
    struct dm_task *dmt;
    struct dm_info info;

    if (!(dmt = dm_task_create(DM_DEVICE_INFO)))
        goto out;

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

    if (!dm_task_run(dmt))
        goto out;

    if (!dm_task_get_info(dmt, &info))
        goto out;

    *minor = info.minor;
    ret = 0;

 out:
    if (dmt != NULL)
        dm_task_destroy(dmt);

    return ret;
}
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:28,代码来源:storage_backend_mpath.c


示例7: dm_geteventnr

int
dm_geteventnr (char *name)
{
	struct dm_task *dmt;
	struct dm_info info;
	int event = -1;

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

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

	dm_task_no_open_count(dmt);

	if (!dm_task_run(dmt))
		goto out;

	if (!dm_task_get_info(dmt, &info))
		goto out;

	if (info.exists)
		event = info.event_nr;

out:
	dm_task_destroy(dmt);

	return event;
}
开发者ID:cathay4t,项目名称:multipath-tools,代码行数:29,代码来源:devmapper.c


示例8: dm_get_info

static
int
dm_get_info(const char *name, struct dm_info *dmi)
{
	struct dm_task *dmt = NULL;
	int error = -1;

	if ((dmt = dm_task_create(DM_DEVICE_INFO)) == NULL)
		goto out;

	if ((dm_task_set_name(dmt, name)) == 0)
		goto out;

	if ((dm_task_run(dmt)) == 0)
		goto out;

	if ((dm_task_get_info(dmt, dmi)) == 0)
		goto out;

	error = 0;

out:
	if (dmt)
		dm_task_destroy(dmt);

	return error;
}
开发者ID:GDXN,项目名称:tc-play,代码行数:27,代码来源:tcplay.c


示例9: _dm_check_versions

static int _dm_check_versions(void)
{
	struct dm_task *dmt;
	struct dm_versions *target, *last_target;

	if (_dm_crypt_checked)
		return 1;

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

	if (!dm_task_run(dmt)) {
		dm_task_destroy(dmt);
		return 0;
	}

	target = dm_task_get_versions(dmt);
	do {
		last_target = target;
		if (!strcmp(DM_CRYPT_TARGET, target->name)) {
			_dm_set_crypt_compat((int)target->version[0],
					     (int)target->version[1],
					     (int)target->version[2]);
		}
		target = (void *) target + target->next;
	} while (last_target != target);

	dm_task_destroy(dmt);
	return 1;
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:30,代码来源:libdevmapper.c


示例10: run_task

/* Create a task, set its name and run it. */
static int
run_task(struct lib_context *lc, struct raid_set *rs, char *table, int type, char *name)
{
	/*
	 * DM_UUID_LEN is defined in dm-ioctl.h as 129 characters;
	 * though not all 129 must be used (md uses just 16 from 
	 * a quick review of md.c. 
	 * We will be using: (len vol grp name)
	 */
	char uuid[DM_UUID_LEN];
	int ret;
	struct dm_task *dmt;

	_init_dm();
	ret = (dmt = dm_task_create(type)) && dm_task_set_name(dmt, name);
	if (ret && table)
		ret = parse_table(lc, dmt, table);

	if (ret) {
		if (DM_DEVICE_CREATE == type) {
			ret = dmraid_uuid(lc, rs, uuid, DM_UUID_LEN, name) &&
				dm_task_set_uuid(dmt, uuid) && dm_task_run(dmt);
		} else
			ret = dm_task_run(dmt);
	}

	_exit_dm(dmt);
	return ret;
}
开发者ID:Distrotech,项目名称:dmraid,代码行数:30,代码来源:devmapper.c


示例11: _error_device

static int _error_device(const char *name, size_t size)
{
	struct dm_task *dmt;
	int r = 0;

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

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

	if (!dm_task_add_target(dmt, UINT64_C(0), size, "error", ""))
		goto error;

	if (!dm_task_set_ro(dmt))
		goto error;

	if (!dm_task_no_open_count(dmt))
		goto error;

	if (!dm_task_run(dmt))
		goto error;

	if (!_dm_simple(DM_DEVICE_RESUME, name, 1)) {
		_dm_simple(DM_DEVICE_CLEAR, name, 0);
		goto error;
	}

	r = 1;

error:
	dm_task_destroy(dmt);
	return r;
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:34,代码来源:libdevmapper.c


示例12: _dm_simple

/* DM helpers */
static int _dm_simple(int task, const char *name, int udev_wait)
{
	int r = 0;
	struct dm_task *dmt;
	uint32_t cookie = 0;

	if (!_dm_use_udev())
		udev_wait = 0;

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

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

	if (udev_wait && !dm_task_set_cookie(dmt, &cookie, 0))
		goto out;

	r = dm_task_run(dmt);

	if (udev_wait)
		(void)dm_udev_wait(cookie);

      out:
	dm_task_destroy(dmt);
	return r;
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:28,代码来源:libdevmapper.c


示例13: dm_mount_aspect

int dm_mount_aspect(substrate_t *substrate, u64 header_offset, u8 *header_key, char *name)
{
	char *params;
	struct dm_task *task;
	task = dm_task_create(DM_DEVICE_CREATE);
	if(!task) {
		die("dm_task_create");
	}
	if(!dm_task_set_name(task, name)) {
		die("dm_task_set_name");
	}
	if(!dm_task_set_uuid(task, name)) {
		die("dm_task_set_uuid");
	}
	params = steg_malloc(strlen(substrate->filename) + 4096);
	sprintf(params, "%s %zu ", substrate->filename, header_offset);
	sprint_hex(params + strlen(params), header_key, KEY_BYTES);
	if(!dm_task_add_target(task, 0, substrate->bytes, "steg", params)) {
		die("dm_task_add_target");
	}
	if(!dm_task_run(task)) {
		die("dm_task_run");
	}
	dm_task_destroy(task);
	steg_free(params);
	return 0;
}
开发者ID:radii,项目名称:dmsteg,代码行数:27,代码来源:dm.c


示例14: dm_message

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;
}
开发者ID:radii,项目名称:dmsteg,代码行数:28,代码来源:dm.c


示例15: _lookup_dev_name

static int _lookup_dev_name(uint64_t dev, char *buf, size_t len)
{
	struct dm_names *names;
	unsigned next = 0;
	struct dm_task *dmt;
	int r = 0;
 
	if (!(dmt = dm_task_create(DM_DEVICE_LIST)))
		return 0;
 
	if (!dm_task_run(dmt))
		goto out;

	if (!(names = dm_task_get_names(dmt)))
		goto out;
 
	if (!names->dev)
		goto out;
 
	do {
		names = (void *) names + next;
		if (names->dev == dev) {
			strncpy(buf, names->name, len);
			r = 1;
			break;
		}
		next = names->next;
	} while (next);

      out:
	dm_task_destroy(dmt);
	return r;
}
开发者ID:SteamMOD,项目名称:android_bootable_steam_device-mapper,代码行数:33,代码来源:libdm-iface.c


示例16: dm_message

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;
}
开发者ID:cathay4t,项目名称:multipath-tools,代码行数:31,代码来源:devmapper.c


示例17: dm_map_present

extern int
dm_map_present (const char * str)
{
	int r = 0;
	struct dm_task *dmt;
	struct dm_info info;

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

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

	dm_task_no_open_count(dmt);

	if (!dm_task_run(dmt))
		goto out;

	if (!dm_task_get_info(dmt, &info))
		goto out;

	if (info.exists)
		r = 1;
out:
	dm_task_destroy(dmt);
	return r;
}
开发者ID:cathay4t,项目名称:multipath-tools,代码行数:27,代码来源:devmapper.c


示例18: era_dm_message0

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;
}
开发者ID:004helix,项目名称:erasetup,代码行数:25,代码来源:era_dm.c


示例19: dm_get_prefixed_uuid

static int
dm_get_prefixed_uuid(const char *name, char *uuid)
{
	struct dm_task *dmt;
	const char *uuidtmp;
	int r = 1;

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

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

	if (!dm_task_run(dmt))
		goto uuidout;

	uuidtmp = dm_task_get_uuid(dmt);
	if (uuidtmp)
		strcpy(uuid, uuidtmp);
	else
		uuid[0] = '\0';

	r = 0;
uuidout:
	dm_task_destroy(dmt);
	return r;
}
开发者ID:cathay4t,项目名称:multipath-tools,代码行数:28,代码来源:devmapper.c


示例20: _dm_simple

static int _dm_simple(int task, int wait, const char *name)
{
	struct dm_task *dmt;
	uint32_t cookie = 0;
	int rc;

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

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

	if (wait && !dm_task_set_cookie(dmt, &cookie, 0))
		goto out;

	rc = dm_task_run(dmt);

	if (wait)
		(void) dm_udev_wait(cookie);

	dm_task_destroy(dmt);
	return rc ? 0 : -1;
out:
	dm_task_destroy(dmt);
	return -1;
}
开发者ID:004helix,项目名称:erasetup,代码行数:26,代码来源:era_dm.c



注:本文中的dm_task_create函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ dm_task_destroy函数代码示例发布时间:2022-05-30
下一篇:
C++ dm_register函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap