本文整理汇总了C++中dm_task_destroy函数的典型用法代码示例。如果您正苦于以下问题:C++ dm_task_destroy函数的具体用法?C++ dm_task_destroy怎么用?C++ dm_task_destroy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dm_task_destroy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: 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
示例2: _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
示例3: _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
示例4: _dm_create
static int _dm_create(int task, int wait,
const char *name, const char *uuid,
uint64_t start, uint64_t length,
const char *target, const char *table,
struct era_dm_info *info)
{
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 (uuid && !dm_task_set_uuid(dmt, uuid))
goto out;
if (target && !dm_task_add_target(dmt, start, length, target, table))
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);
if (rc && info)
{
struct dm_info dmi;
if (!dm_task_get_info(dmt, &dmi))
goto out;
info->target_count = dmi.target_count;
info->open_count = dmi.open_count;
info->suspended = dmi.suspended;
info->exists = dmi.exists;
info->major = dmi.major;
info->minor = dmi.minor;
}
dm_task_destroy(dmt);
return rc ? 0 : -1;
out:
dm_task_destroy(dmt);
return -1;
}
开发者ID:004helix,项目名称:erasetup,代码行数:52,代码来源:era_dm.c
示例5: main
int main(int argc, char** argv) {
/*
* Dump a devices table. First arg should be the device name.
*
*/
char* name;
if (argc < 2) {
printf("usage: dump_table <device name>\n");
return 1;
} else {
name = argv[1];
}
struct dm_task *dmt;
struct dm_info info;
struct dm_names *names;
uint64_t start, length;
char* params, * target_type;
void* next = NULL;
if (!(dmt = dm_task_create(DM_DEVICE_TABLE))) {
printf("could not create dm task\n");
return 1;
}
if (!_set_task_device(dmt, name, 0)) {
printf("device %s may not exist -?\n", name);
}
if (!dm_task_run(dmt)) {
printf("error running task\n");
dm_task_destroy(dmt);
return 1;
}
if (!dm_task_get_info(dmt, &info) || !info.exists) {
printf("could not get info for %s\n", name);
return 1;
}
/* not sure about this bit */
do {
next = dm_get_next_target(dmt, next, &start, &length, &target_type, ¶ms);
printf("%" PRIu64 " %" PRIu64 " %s %s\n", start, length, target_type, params);
} while(next);
dm_task_destroy(dmt);
return 0;
}
开发者ID:vemek,项目名称:software-maid,代码行数:50,代码来源:dump_table.c
示例6: 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
示例7: dm_flush_maps
extern int
dm_flush_maps (void)
{
int r = 0;
struct dm_task *dmt;
struct dm_names *names;
unsigned next = 0;
if (!(dmt = dm_task_create (DM_DEVICE_LIST)))
return 0;
dm_task_no_open_count(dmt);
if (!dm_task_run (dmt))
goto out;
if (!(names = dm_task_get_names (dmt)))
goto out;
if (!names->dev)
goto out;
do {
r |= dm_suspend_and_flush_map(names->name);
next = names->next;
names = (void *) names + next;
} while (next);
out:
dm_task_destroy (dmt);
return r;
}
开发者ID:cathay4t,项目名称:multipath-tools,代码行数:32,代码来源:devmapper.c
示例8: 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
示例9: 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
示例10: 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, ¶ms);
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
示例11: _info_run
static int _info_run(const char *name, const char *dlid, struct dm_info *info,
uint32_t *read_ahead, int mknodes, int with_open_count,
int with_read_ahead, uint32_t major, uint32_t minor)
{
int r = 0;
struct dm_task *dmt;
int dmtask;
dmtask = mknodes ? DM_DEVICE_MKNODES : DM_DEVICE_INFO;
if (!(dmt = _setup_task(mknodes ? name : NULL, dlid, 0, dmtask, major, minor)))
return_0;
if (!with_open_count)
if (!dm_task_no_open_count(dmt))
log_error("Failed to disable open_count");
if (!dm_task_run(dmt))
goto_out;
if (!dm_task_get_info(dmt, info))
goto_out;
if (with_read_ahead && info->exists) {
if (!dm_task_get_read_ahead(dmt, read_ahead))
goto_out;
} else if (read_ahead)
*read_ahead = DM_READ_AHEAD_NONE;
r = 1;
out:
dm_task_destroy(dmt);
return r;
}
开发者ID:ystk,项目名称:debian-lvm2,代码行数:35,代码来源:dev_manager.c
示例12: 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
示例13: 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
示例14: _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
示例15: _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
示例16: 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
示例17: 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
示例18: 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
示例19: 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
示例20: dm_event_unregister_handler
int dm_event_unregister_handler(const struct dm_event_handler *dmevh)
{
int ret = 1, err;
const char *uuid;
struct dm_task *dmt;
struct dm_event_daemon_message msg = { 0, 0, NULL };
if (!(dmt = _get_device_info(dmevh))) {
stack;
return 0;
}
uuid = dm_task_get_uuid(dmt);
if ((err = _do_event(DM_EVENT_CMD_UNREGISTER_FOR_EVENT, dmevh->dmeventd_path, &msg,
dmevh->dso, uuid, dmevh->mask, dmevh->timeout)) < 0) {
log_error("%s: event deregistration failed: %s",
dm_task_get_name(dmt),
msg.data ? msg.data : strerror(-err));
ret = 0;
}
dm_free(msg.data);
dm_task_destroy(dmt);
return ret;
}
开发者ID:SteamMOD,项目名称:android_bootable_steam_device-mapper,代码行数:28,代码来源:libdevmapper-event.c
注:本文中的dm_task_destroy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论