Lines Matching defs:dmv
188 dm_dev_t *dmv;
207 if ((dmv = dm_dev_lookup(name, uuid, -1)) != NULL) {
209 dm_dev_unbusy(dmv);
213 if ((dmv = dm_dev_alloc()) == NULL)
222 dm_dev_free(dmv);
229 strncpy(dmv->uuid, uuid, DM_UUID_LEN);
231 dmv->uuid[0] = '\0';
234 strlcpy(dmv->name, name, DM_NAME_LEN);
236 dmv->minor = cf->cf_unit;
237 dmv->flags = 0; /* device flags are set when needed */
238 dmv->ref_cnt = 0;
239 dmv->event_nr = 0;
240 dmv->devt = devt;
242 dm_table_head_init(&dmv->table_head);
244 mutex_init(&dmv->dev_mtx, MUTEX_DEFAULT, IPL_NONE);
245 mutex_init(&dmv->diskp_mtx, MUTEX_DEFAULT, IPL_NONE);
246 cv_init(&dmv->dev_cv, "dm_dev");
249 dmv->flags |= DM_READONLY_FLAG;
251 prop_dictionary_set_uint32(dm_dict, DM_IOCTL_MINOR, dmv->minor);
253 disk_init(dmv->diskp, device_xname(devt), &dmdkdriver);
254 disk_attach(dmv->diskp);
256 dmv->diskp->dk_info = NULL;
258 if ((r = dm_dev_insert(dmv)) != 0)
259 dm_dev_free(dmv);
320 dm_dev_t *dmv;
344 if ((dmv = dm_dev_rem(name, uuid, minor)) == NULL) {
354 strlcpy(dmv->name, n_name, DM_NAME_LEN);
356 prop_dictionary_set_uint32(dm_dict, DM_IOCTL_OPEN, dmv->table_head.io_cnt);
357 prop_dictionary_set_uint32(dm_dict, DM_IOCTL_MINOR, dmv->minor);
358 prop_dictionary_set_string(dm_dict, DM_IOCTL_UUID, dmv->uuid);
360 dm_dev_insert(dmv);
374 dm_dev_t *dmv;
395 if ((dmv = dm_dev_lookup(name, uuid, minor)) == NULL) {
399 devt = dmv->devt;
401 dm_dev_unbusy(dmv);
420 dm_dev_t *dmv;
433 if ((dmv = dm_dev_lookup(name, uuid, minor)) == NULL) {
437 dm_dbg_print_flags(dmv->flags);
439 prop_dictionary_set_uint32(dm_dict, DM_IOCTL_OPEN, dmv->table_head.io_cnt);
440 prop_dictionary_set_uint32(dm_dict, DM_IOCTL_MINOR, dmv->minor);
441 prop_dictionary_set_string(dm_dict, DM_IOCTL_UUID, dmv->uuid);
443 if (dmv->flags & DM_SUSPEND_FLAG)
450 if ((j = dm_table_get_target_count(&dmv->table_head, DM_TABLE_ACTIVE)))
457 if (dm_table_get_target_count(&dmv->table_head, DM_TABLE_INACTIVE))
462 dm_dev_unbusy(dmv);
474 dm_dev_t *dmv;
487 if ((dmv = dm_dev_lookup(name, uuid, minor)) == NULL) {
491 atomic_or_32(&dmv->flags, DM_SUSPEND_FLAG);
493 dm_dbg_print_flags(dmv->flags);
495 prop_dictionary_set_uint32(dm_dict, DM_IOCTL_OPEN, dmv->table_head.io_cnt);
496 prop_dictionary_set_uint32(dm_dict, DM_IOCTL_FLAGS, dmv->flags);
497 prop_dictionary_set_uint32(dm_dict, DM_IOCTL_MINOR, dmv->minor);
499 dm_dev_unbusy(dmv);
501 /* Add flags to dictionary flag after dmv -> dict copy */
514 dm_dev_t *dmv;
533 if ((dmv = dm_dev_lookup(name, uuid, minor)) == NULL) {
539 if (dmv->flags & DM_INACTIVE_PRESENT_FLAG)
540 dm_table_switch_tables(&dmv->table_head);
542 atomic_and_32(&dmv->flags, ~(DM_SUSPEND_FLAG | DM_INACTIVE_PRESENT_FLAG));
543 atomic_or_32(&dmv->flags, DM_ACTIVE_PRESENT_FLAG);
547 dmgetproperties(dmv->diskp, &dmv->table_head);
549 prop_dictionary_set_uint32(dm_dict, DM_IOCTL_OPEN, dmv->table_head.io_cnt);
551 prop_dictionary_set_uint32(dm_dict, DM_IOCTL_MINOR, dmv->minor);
553 dm_dev_unbusy(dmv);
556 dm_table_destroy(&dmv->table_head, DM_TABLE_INACTIVE);
574 dm_dev_t *dmv;
591 if ((dmv = dm_dev_lookup(name, uuid, minor)) == NULL) {
596 dm_table_destroy(&dmv
598 atomic_and_32(&dmv->flags, ~DM_INACTIVE_PRESENT_FLAG);
600 dm_dev_unbusy(dmv);
615 dm_dev_t *dmv;
636 if ((dmv = dm_dev_lookup(name, uuid, minor)) == NULL) {
640 prop_dictionary_set_uint32(dm_dict, DM_IOCTL_MINOR, dmv->minor);
641 prop_dictionary_set_string(dm_dict, DM_IOCTL_NAME, dmv->name);
642 prop_dictionary_set_string(dm_dict, DM_IOCTL_UUID, dmv->uuid);
644 aprint_debug("Getting table deps for device: %s\n", dmv->name);
655 tbl = dm_table_get_entry(&dmv->table_head, table_type);
660 dm_table_release(&dmv->table_head, table_type);
661 dm_dev_unbusy(dmv);
711 dm_dev_t *dmv;
742 if ((dmv = dm_dev_lookup(name, uuid, minor)) == NULL) {
748 dmv->table_head.cur_active_table);
754 if (dmv->flags & DM_INACTIVE_PRESENT_FLAG)
755 dm_table_destroy(&dmv->table_head, DM_TABLE_INACTIVE);
757 dm_dbg_print_flags(dmv->flags);
758 tbl = dm_table_get_entry(&dmv->table_head, DM_TABLE_INACTIVE);
760 aprint_debug("dmv->name = %s\n", dmv->name);
762 prop_dictionary_set_uint32(dm_dict, DM_IOCTL_MINOR, dmv->minor);
778 dm_table_release(&dmv->table_head, DM_TABLE_INACTIVE);
779 dm_dev_unbusy(dmv);
790 table_en->dm_dev = dmv;
816 dm_table_release(&dmv->table_head, DM_TABLE_INACTIVE);
817 dm_table_destroy(&dmv->table_head, DM_TABLE_INACTIVE);
822 dm_dev_unbusy(dmv);
833 atomic_or_32(&dmv->flags, DM_INACTIVE_PRESENT_FLAG);
835 dm_table_release(&dmv->table_head, DM_TABLE_INACTIVE);
836 dm_dev_unbusy(dmv);
901 dm_dev_t *dmv;
923 if ((dmv = dm_dev_lookup(name, uuid, minor)) == NULL) {
936 if (dm_table_get_target_count(&dmv->table_head, DM_TABLE_ACTIVE)) {
941 if (dm_table_get_target_count(&dmv->table_head, DM_TABLE_INACTIVE))
947 if (dmv->flags & DM_SUSPEND_FLAG)
950 prop_dictionary_set_uint32(dm_dict, DM_IOCTL_MINOR, dmv->minor);
953 name, dmv->table_head.cur_active_table);
955 tbl = dm_table_get_entry(&dmv->table_head, table_type);
976 dmv->table_head.cur_active_table);
1004 dm_table_release(&dmv->table_head, table_type);
1005 dm_dev_unbusy(dmv);