Lines Matching refs:dev_desc
29 static struct part_driver *part_driver_lookup_type(struct blk_desc *dev_desc) in part_driver_lookup_type() argument
36 if (dev_desc->part_type == PART_TYPE_UNKNOWN) { in part_driver_lookup_type()
40 ret = entry->test(dev_desc); in part_driver_lookup_type()
42 dev_desc->part_type = entry->part_type; in part_driver_lookup_type()
48 if (dev_desc->part_type == entry->part_type) in part_driver_lookup_type()
60 struct blk_desc *dev_desc; in get_dev_hwpart() local
63 dev_desc = blk_get_devnum_by_typename(ifname, dev); in get_dev_hwpart()
64 if (!dev_desc) { in get_dev_hwpart()
69 ret = blk_dselect_hwpart(dev_desc, hwpart); in get_dev_hwpart()
76 return dev_desc; in get_dev_hwpart()
123 void dev_print (struct blk_desc *dev_desc) in dev_print() argument
127 if (dev_desc->type == DEV_TYPE_UNKNOWN) { in dev_print()
132 switch (dev_desc->if_type) { in dev_print()
135 dev_desc->target,dev_desc->lun, in dev_print()
136 dev_desc->vendor, in dev_print()
137 dev_desc->product, in dev_print()
138 dev_desc->revision); in dev_print()
144 dev_desc->vendor, in dev_print()
145 dev_desc->revision, in dev_print()
146 dev_desc->product); in dev_print()
155 dev_desc->vendor, in dev_print()
156 dev_desc->revision, in dev_print()
157 dev_desc->product); in dev_print()
160 printf("%s VirtIO Block Device\n", dev_desc->vendor); in dev_print()
169 printf("Unhandled device type: %i\n", dev_desc->if_type); in dev_print()
173 if (dev_desc->removable) in dev_print()
175 switch (dev_desc->type & 0x1F) { in dev_print()
189 printf ("# %02X #", dev_desc->type & 0x1F); in dev_print()
193 if (dev_desc->lba > 0L && dev_desc->blksz > 0L) { in dev_print()
197 lba = dev_desc->lba; in dev_print()
199 lba512 = (lba * (dev_desc->blksz/512)); in dev_print()
211 if (dev_desc->lba48) in dev_print()
219 dev_desc->blksz); in dev_print()
225 dev_desc->blksz); in dev_print()
235 void part_init(struct blk_desc *dev_desc) in part_init() argument
242 blkcache_invalidate(dev_desc->if_type, dev_desc->devnum); in part_init()
244 dev_desc->part_type = PART_TYPE_UNKNOWN; in part_init()
248 ret = entry->test(dev_desc); in part_init()
251 dev_desc->part_type = entry->part_type; in part_init()
257 static void print_part_header(const char *type, struct blk_desc *dev_desc) in print_part_header() argument
265 switch (dev_desc->if_type) { in print_part_header()
304 dev_desc->devnum, type); in print_part_header()
308 void part_print(struct blk_desc *dev_desc) in part_print() argument
312 drv = part_driver_lookup_type(dev_desc); in part_print()
315 dev_desc->part_type); in part_print()
320 print_part_header(drv->name, dev_desc); in part_print()
322 drv->print(dev_desc); in part_print()
327 int part_get_info(struct blk_desc *dev_desc, int part, in part_get_info() argument
341 drv = part_driver_lookup_type(dev_desc); in part_get_info()
344 dev_desc->part_type); in part_get_info()
352 if (drv->get_info(dev_desc, part, info) == 0) { in part_get_info()
361 int part_get_info_whole_disk(struct blk_desc *dev_desc, in part_get_info_whole_disk() argument
365 info->size = dev_desc->lba; in part_get_info_whole_disk()
366 info->blksz = dev_desc->blksz; in part_get_info_whole_disk()
381 struct blk_desc **dev_desc) in blk_get_device_by_str() argument
417 *dev_desc = get_dev_hwpart(ifname, dev, hwpart); in blk_get_device_by_str()
418 if (!(*dev_desc) || ((*dev_desc)->type == DEV_TYPE_UNKNOWN)) { in blk_get_device_by_str()
430 part_init(*dev_desc); in blk_get_device_by_str()
441 struct blk_desc **dev_desc, in blk_get_device_part_str() argument
460 *dev_desc = NULL; in blk_get_device_part_str()
489 *dev_desc = NULL; in blk_get_device_part_str()
524 dev = blk_get_device_by_str(ifname, dev_str, dev_desc); in blk_get_device_part_str()
554 if (((*dev_desc)->part_type == PART_TYPE_UNKNOWN) || in blk_get_device_part_str()
556 if (!(*dev_desc)->lba) { in blk_get_device_part_str()
575 (*dev_desc)->log2blksz = LOG2((*dev_desc)->blksz); in blk_get_device_part_str()
577 part_get_info_whole_disk(*dev_desc, info); in blk_get_device_part_str()
595 ret = part_get_info(*dev_desc, part, info); in blk_get_device_part_str()
607 ret = part_get_info(*dev_desc, p, info); in blk_get_device_part_str()
651 (*dev_desc)->log2blksz = LOG2((*dev_desc)->blksz); in blk_get_device_part_str()
661 int part_get_info_by_name_type(struct blk_desc *dev_desc, const char *name, in part_get_info_by_name_type() argument
668 part_drv = part_driver_lookup_type(dev_desc); in part_get_info_by_name_type()
672 ret = part_drv->get_info(dev_desc, i, info); in part_get_info_by_name_type()
686 int part_get_info_by_name(struct blk_desc *dev_desc, const char *name, in part_get_info_by_name() argument
689 return part_get_info_by_name_type(dev_desc, name, info, PART_TYPE_ALL); in part_get_info_by_name()
709 struct blk_desc **dev_desc, in part_get_info_by_dev_and_name() argument
727 ret = blk_get_device_by_str(dev_iface, dev_str, dev_desc); in part_get_info_by_dev_and_name()
731 ret = part_get_info_by_name(*dev_desc, part_str, part_info); in part_get_info_by_dev_and_name()
742 struct blk_desc **dev_desc, in part_get_info_by_dev_and_name_or_num() argument
750 dev_desc, part_info); in part_get_info_by_dev_and_name_or_num()
758 dev_desc, part_info, allow_whole_dev); in part_get_info_by_dev_and_name_or_num()
765 void part_set_generic_name(const struct blk_desc *dev_desc, in part_set_generic_name() argument
770 switch (dev_desc->if_type) { in part_set_generic_name()
794 sprintf(name, "%s%c%d", devtype, 'a' + dev_desc->devnum, part_num); in part_set_generic_name()