/* This function gets the structure containing partitioning information for the given device @devt.  */
struct gendisk* get_gendisk(dev_t devt, int *partno)
/* This function gets the structure containing partitioning information for the given device @devt.  */
struct gendisk* get_gendisk(dev_t devt, int *partno)
{
	struct gendisk *disk = NULL;
	if (MAJOR(devt) != BLOCK_EXT_MAJOR) {
		struct kobject *kobj;
		kobj = kobj_lookup(bdev_map, devt, partno);
		if (kobj)
			disk = dev_to_disk(kobj_to_dev(kobj));
	} else {
		struct hd_struct *part;
		mutex_lock(&ext_devt_mutex);
		part = idr_find(&ext_devt_idr, blk_mangle_minor(MINOR(devt)));
		if (part && get_disk(part_to_disk(part))) {
			*partno = part->partno;
			disk = part_to_disk(part);
		}
		mutex_unlock(&ext_devt_mutex);
	}
	return disk;
}