“What is the kernel die message”的版本间的差异

来自个人维基
跳转至: 导航搜索
 
(未显示1个用户的14个中间版本)
第1行: 第1行:
 +
error
  
These messages come from static int __die(const char *str, int err, struct pt_regs *regs) in arch/arm64kernel/traps.c
 
So let's see what they mean.
 
 
<source lang="c">
 
<source lang="c">
[    0.811029] Internal error: <reason in string>: <error code> [#<die_count>] PREEMPT SMP //
 
[    0.816251] Modules linked in: //print_modules()
 
[    0.819383] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.14.0-rc7-linaro-hikey960+ #1
 
  
[    0.827174] Hardware name: HiKey960 (DT) //m
+
(XEN) *** LOADING DOMAIN 0 ***
__show_regs
+
(XEN) Loading d0 kernel from boot module @ 00000000b936c000
[    0.831162] task: ffff8000dc910000 task.stack: ffff000008068000
+
(XEN) Allocating 1:1 mappings totalling 512MB for dom0:
[    0.837164] PC is at amba_device_try_add+0xe8/0x268
+
(XEN) BANK[0] 0x000000c0000000-0x000000e0000000 (512MB)
[   0.842089] LR is at amba_device_try_add+0xcc/0x268
+
(XEN) Grant table range: 0x000000b921c000-0x000000b925c000
 +
(XEN) Allocating PPI 16 for event channel interrupt
 +
(XEN) Loading zImage from 00000000b936c000 to 00000000c0080000-00000000c1187200
 +
(XEN) Loading d0 DTB to 0x00000000c8000000-0x00000000c800a813
 +
...
 +
[    0.000000] Booting Linux on physical CPU 0x0
 +
[    0.000000] Boot CPU: AArch64 Processor [410fd034]
 +
[    0.000000] Machine model: HiKey960
 +
[    0.000000] Xen 4.13 support found
 +
[    0.000000] Kernel command line: console=tty0 console=hvc0 root=/dev/sdd10 rw efi=noruntime
 +
[    0.000000] PID hash table entries: 2048 (order: 2, 16384 bytes)
 +
[    0.000000] Memory: 456156K/525312K available (10364K kernel code, 1180K rwdata, 4664K rodata, 1152K init, 405K bss, 52772K reserved, 16384K cma-reserved)
 +
...
 +
[    7.067414] --CJ  enter prepare_namespace: root_delay=0
 +
[    7.294633] ufshcd-hi3660 ff3b0000.ufs: ufshcd_query_flag: Sending flag query for idn 3 failed, err = -11
 +
[    7.683146] xhci-hcd xhci-hcd.0.auto: USB bus 2 deregistered
 +
[    7.688722] xhci-hcd xhci-hcd.0.auto: remove, state 1
 +
...
 +
[  14.998578] ufshcd-hi3660 ff3b0000.ufs: ufshcd_init_icc_levels: Failed reading power descriptor.len = 98 ret = -11
 +
[   36.480083] ufshcd-hi3660 ff3b0000.ufs: ufshcd_print_pwr_info:[RX, TX]: gear=[1, 1], lane[1, 1], pwr[SLOWAUTO_MODE, SLOWAUTO_MODE], rate = 0
 +
[  36.493073] ufshcd-hi3660 ff3b0000.ufs: UPIU[0] - issue time 14654573 us
 +
...
 +
[  36.755689] ufshcd-hi3660 ff3b0000.ufs: ufshcd_print_pwr_info:[RX, TX]: gear=[3, 3], lane[2, 2], pwr[FAST MODE, FAST MODE], rate = 2
 +
[  36.767798] --CJ in mount_root: entering mount_block_root(/dev/root, 0x8000)
 +
[  36.774793] --CJ mount_block_root: name=/dev/root, fs_names =
 +
[  36.862337] -CJ do_mount_root (/dev/root, ext3)
  
[   0.847031] pc : [<ffff0000084f5320>] lr : [<ffff0000084f5304>] pstate: 40000045 //PC, LR, PSTATE
+
[   36.866925] VFS: Cannot open root device "sdd10" or unknown-block(0,0): error -6 //ENXIO = /* No such device or address */
[   0.854489] sp : ffff00000806bbe0 //SP
+
[  36.874332] Please append a correct "root=" boot option; here are the available partitions:
 +
[  36.882734] --CJ printk_all_partitions:
 +
[  36.886730] -- -- CJ loop 1
 +
[  36.889578] -- -- CJ loop 1
 +
[  36.892442] -- -- CJ loop 1
 +
[  36.895304] -- -- CJ loop 1
 +
[  36.898157] -- -- CJ loop 1
 +
[  36.901025] -- -- CJ loop 1
 +
[  36.903889] -- -- CJ loop 1
 +
[  36.906751] -- -- CJ loop 1
 +
[  36.909613] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
 +
[  36.930939] Call trace:
 +
[  36.933464] [<ffff000008088be0>] dump_backtrace+0x0/0x370
 +
[  36.938925] [<ffff000008088f64>] show_stack+0x14/0x20
 +
[  36.944037] [<ffff000008a71200>] dump_stack+0x9c/0xbc
 +
[   36.949159] [<ffff0000080c78d8>] panic+0x11c/0x28c
 +
[  36.954011] [<ffff000008f41184>] mount_block_root+0x1bc/0x290
 +
[  36.959817] [<ffff000008f41384>] mount_root+0x12c/0x144
 +
[  36.965107] [<ffff000008f414e4>] prepare_namespace+0x148/0x190
 +
[  36.971005] [<ffff000008f40d8c>] kernel_init_freeable+0x208/0x22c
 +
[  36.977163] [<ffff000008a836e8>] kernel_init+0x10/0x100
 +
[  36.982451] [<ffff000008084b58>] ret_from_fork+0x10/0x18
 +
[  36.987832] SMP: stopping secondary CPUs
  
[    0.857868] x29: ffff00000806bbe0 x28: ffff000009040588
+
</source>
[    0.863246] x27: 0000000000000004 x26: 0000000000000000
+
[    0.868622] x25: ffff8000defe5088 x24: 0000000000000000
+
[    0.873999] x23: ffff00000944d000 x22: 0000000000001000
+
[    0.879380] x21: ffff8000dc21a6f8 x20: 0000000000000000
+
[    0.884752] x19: ffff8000dc21a400 x18: 0000000000000020
+
[    0.890133] x17: 0000000000000001 x16: 00000000deadbeef
+
[    0.895505] x15: ffffffffffffffff x14: ffffffffffffffff
+
[    0.900882] x13: 0000000000000020 x12: 0101010101010101
+
[    0.906258] x11: 0000000000000028 x10: 0101010101010101
+
[    0.911635] x9 : 0000000000000000 x8 : ffff8000dc203d80
+
[    0.917011] x7 : 0000000000000000 x6 : 000000000000003f
+
[    0.922388] x5 : 0000000000000000 x4 : ffff0000091d4190
+
[    0.927765] x3 : 0000000000000000 x2 : ffff00000944dfe0
+
[    0.933141] x1 : 0000000000000000 x0 : 0000000000000000
+
[    0.938519] Process swapper/0 (pid: 1, stack limit = 0xffff000008068000) //line236
+
[    0.945285] Call trace:
+
[    0.947798] Exception stack(0xffff00000806baa0 to 0xffff00000806bbe0)
+
[    0.954304] baa0: 0000000000000000 0000000000000000 ffff00000944dfe0 0000000000000000
+
[    0.962196] bac0: ffff0000091d4190 0000000000000000 000000000000003f 0000000000000000
+
[    0.970091] bae0: ffff8000dc203d80 0000000000000000 0101010101010101 0000000000000028
+
[    0.977979] bb00: 0101010101010101 0000000000000020 ffffffffffffffff ffffffffffffffff
+
[    0.985869] bb20: 00000000deadbeef 0000000000000001 0000000000000020 ffff8000dc21a400
+
[    0.993761] bb40: 0000000000000000 ffff8000dc21a6f8 0000000000001000 ffff00000944d000
+
[    1.001653] bb60: 0000000000000000 ffff8000defe5088 0000000000000000 0000000000000004
+
[    1.009548] bb80: ffff000009040588 ffff00000806bbe0 ffff0000084f5304 ffff00000806bbe0
+
[    1.017435] bba0: ffff0000084f5320 0000000040000045 ffff00000806bbe0 ffff0000084f5304
+
[    1.025327] bbc0: ffffffffffffffff 00000000fffffffe ffff00000806bbe0 ffff0000084f5320
+
[    1.033221] [<ffff0000084f5320>] amba_device_try_add+0xe8/0x268
+
[    1.039201] [<ffff0000084f5588>] amba_device_add+0x18/0xe0
+
[    1.044762] [<ffff000008922fc8>] of_platform_bus_create+0x2b8/0x320
+
[    1.051082] [<ffff000008922e74>] of_platform_bus_create+0x164/0x320
+
[    1.057413] [<ffff0000089231a0>] of_platform_populate+0x70/0xd0
+
[    1.063404] [<ffff000008f8e218>] of_platform_default_populate_init+0x64/0x78
+
[    1.070513] [<ffff000008083980>] do_one_initcall+0x38/0x120
+
[    1.076150] [<ffff000008f40d0c>] kernel_init_freeable+0x188/0x22c
+
[    1.082305] [<ffff000008a82268>] kernel_init+0x10/0x100
+
[    1.087590] [<ffff000008084b58>] ret_from_fork+0x10/0x18
+
[    1.092969] Code: f9001fb8 8b0202e2 52800001 52800018 (b9400040)
+
[    1.099148] ---[ end trace 0af73e04a0d75c0a ]---
+
[    1.103845] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
+
[    1.103845]
+
[    1.113090] SMP: stopping secondary CPUs
+
[    1.117094] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
+
[    1.117094]
+
  
 +
init\do_mount.c
 +
<source lang="c">
 +
void __init prepare_namespace(void)
 +
{
 +
        ROOT_DEV = name_to_dev_t(root_device_name);
 +
        root_device_name += 5; //remove /dev/
 +
mount_root();
 +
}
 +
 +
void __init mount_root(void)
 +
{
 +
int err = create_dev("/dev/root", ROOT_DEV); (= mknod (/dev/root->ROOT_DEV)
 +
mount_block_root("/dev/root", root_mountflags/=0x8000/);
 +
}
 +
 +
void __init mount_block_root(char *name, int flags) //name shouldn't be sdd10
 +
for (p = fs_names; *p; p += strlen(p)+1) {
 +
int err = do_mount_root(name, p, flags, root_mount_data);
 +
                //SYS_MOUNT("/dev/root", "/root","ext3") error = -6
 +
 +
__bdevname(ROOT_DEV, b); //ROOT_DEV=0
 +
printk("VFS: Cannot open root device \"%s\" or %s: error %d\n",
 +
root_device_name, b, err);
 +
//VFS: Cannot open root device "sdd10" or unknown-block(0,0): error -6
 +
//root_device_name = sdd10 跟 /dev/root 有什麼關係?
 +
//why ROOT_DEV = 0,0: node created but not mount
 +
 +
printk("Please append a correct \"root=\" boot option; here are the available partitions:\n");
 +
printk_all_partitions();//NO OUTPUT
 +
panic("VFS: Unable to mount root fs on %s", b);
 +
                // VFS: Unable to mount root fs on unknown-block(0,0)
 +
}
 +
 +
}
 +
 +
static int __init do_mount_root(char *name, char *fs, int flags, void *data)
 +
{
 +
struct super_block *s;
 +
int err = sys_mount(name, "/root", fs, flags, data);
 +
if (err)
 +
return err;
 +
 +
sys_chdir("/root");
 +
s = current->fs->pwd.dentry->d_sb;
 +
ROOT_DEV = s->s_dev;
 +
printk(KERN_INFO
 +
      "VFS: Mounted root (%s filesystem)%s on device %u:%u.\n",
 +
      s->s_type->name,
 +
      sb_rdonly(s) ? " readonly" : "",
 +
      MAJOR(ROOT_DEV), MINOR(ROOT_DEV));
 +
return 0;
 +
}
 +
 +
 +
 +
dev_t name_to_dev_t(const char *name)
 +
{
 +
char s[32];
 +
char *p;
 +
dev_t res = 0;
 +
int part;
 +
 +
strcpy(s, name);
 +
for (p = s; *p; p++)
 +
if (*p == '/')
 +
*p = '!';
 +
printk("--- blk_lookup_edvt(%s)\n", s);//s="sdd10"
 +
res = blk_lookup_devt(s, 0);
 +
if (res)
 +
goto done;
 +
 +
/*
 +
* try non-existent, but valid partition, which may only exist
 +
* after revalidating the disk, like partitioned md devices
 +
*/
 +
while (p > s && isdigit(p[-1]))
 +
p--;
 +
if (p == s || !*p || *p == '0')
 +
goto fail;
 +
 +
/* try disk name without <part number> */
 +
part = simple_strtoul(p, NULL, 10);
 +
*p = '\0';
 +
printk("--CJ 2nd blk_lookup_dvt(%s)\n", s);//s=sdd, part=10
 +
res = blk_lookup_devt(s, part);
 +
if (res)
 +
goto done;
 +
 +
/* try disk name without p<part number> */
 +
if (p < s + 2 || !isdigit(p[-2]) || p[-1] != 'p')
 +
goto fail;
 +
p[-1] = '\0';
 +
printk("--CJ 3rd bLk_lookup %s\n", s);
 +
res = blk_lookup_devt(s, part);
 +
if (res)
 +
goto done;
 +
 +
fail:
 +
return 0;
 +
done:
 +
return res;
 +
}
 +
 +
</source>
 +
./block/genhd.c
 +
<source lang="c">
 +
void __init printk_all_partitions(void)
 +
{
 +
struct class_dev_iter iter;
 +
struct device *dev;
 +
printk("--CJ printk_all_partitions: \n");
 +
class_dev_iter_init(&iter, &block_class, NULL, &disk_type);
 +
while ((dev = class_dev_iter_next(&iter))) {
 +
struct gendisk *disk = dev_to_disk(dev);
 +
struct disk_part_iter piter;
 +
struct hd_struct *part;
 +
char name_buf[BDEVNAME_SIZE];
 +
char devt_buf[BDEVT_SIZE];
 +
printk("-- -- CJ loop 1\n");
 +
/*
 +
* Don't show empty devices or things that have been
 +
* suppressed
 +
*/
 +
if (get_capacity(disk) == 0 ||
 +
    (disk->flags & GENHD_FL_SUPPRESS_PARTITION_INFO))
 +
continue;
 +
 +
/*
 +
* Note, unlike /proc/partitions, I am showing the
 +
* numbers in hex - the same format as the root=
 +
* option takes.
 +
*/
 +
disk_part_iter_init(&piter, disk, DISK_PITER_INCL_PART0);
 +
while ((part = disk_part_iter_next(&piter))) {
 +
bool is_part0 = part == &disk->part0;
 +
 +
printk("%s%s %10llu %s %s", is_part0 ? "" : "  ",
 +
      bdevt_str(part_devt(part), devt_buf),
 +
      (unsigned long long)part_nr_sects_read(part) >> 1
 +
      , disk_name(disk, part->partno, name_buf),
 +
      part->info ? part->info->uuid : "");
 +
if (is_part0) {
 +
if (dev->parent && dev->parent->driver)
 +
printk(" driver: %s\n",
 +
      dev->parent->driver->name);
 +
else
 +
printk(" (driver?)\n");
 +
} else
 +
printk("\n");
 +
}
 +
disk_part_iter_exit(&piter);
 +
}
 +
class_dev_iter_exit(&iter);
 +
}
 +
dev_t blk_lookup_devt(const char *name, int partno)
 +
{
 +
dev_t devt = MKDEV(0, 0);
 +
struct class_dev_iter iter;
 +
struct device *dev;
 +
 +
class_dev_iter_init(&iter, &block_class, NULL, &disk_type);
 +
while ((dev = class_dev_iter_next(&iter))) {
 +
struct gendisk *disk = dev_to_disk(dev);
 +
struct hd_struct *part;
 +
 +
if (strcmp(dev_name(dev), name))
 +
continue;
 +
 +
if (partno < disk->minors) {
 +
/* We need to return the right devno, even
 +
* if the partition doesn't exist yet.
 +
*/
 +
devt = MKDEV(MAJOR(dev->devt),
 +
    MINOR(dev->devt) + partno);
 +
break;
 +
}
 +
part = disk_get_part(disk, partno);
 +
if (part) {
 +
devt = part_devt(part);
 +
disk_put_part(part);
 +
break;
 +
}
 +
disk_put_part(part);
 +
}
 +
class_dev_iter_exit(&iter);
 +
return devt;
 +
}
 
</source>
 
</source>

2019年11月21日 (四) 10:25的最后版本

error

(XEN) *** LOADING DOMAIN 0 ***
(XEN) Loading d0 kernel from boot module @ 00000000b936c000
(XEN) Allocating 1:1 mappings totalling 512MB for dom0:
(XEN) BANK[0] 0x000000c0000000-0x000000e0000000 (512MB)
(XEN) Grant table range: 0x000000b921c000-0x000000b925c000
(XEN) Allocating PPI 16 for event channel interrupt
(XEN) Loading zImage from 00000000b936c000 to 00000000c0080000-00000000c1187200
(XEN) Loading d0 DTB to 0x00000000c8000000-0x00000000c800a813
...
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Boot CPU: AArch64 Processor [410fd034]
[    0.000000] Machine model: HiKey960
[    0.000000] Xen 4.13 support found
[    0.000000] Kernel command line: console=tty0 console=hvc0 root=/dev/sdd10 rw efi=noruntime
[    0.000000] PID hash table entries: 2048 (order: 2, 16384 bytes)
[    0.000000] Memory: 456156K/525312K available (10364K kernel code, 1180K rwdata, 4664K rodata, 1152K init, 405K bss, 52772K reserved, 16384K cma-reserved)
...
[    7.067414] --CJ  enter prepare_namespace: root_delay=0
[    7.294633] ufshcd-hi3660 ff3b0000.ufs: ufshcd_query_flag: Sending flag query for idn 3 failed, err = -11
[    7.683146] xhci-hcd xhci-hcd.0.auto: USB bus 2 deregistered
[    7.688722] xhci-hcd xhci-hcd.0.auto: remove, state 1
...
[   14.998578] ufshcd-hi3660 ff3b0000.ufs: ufshcd_init_icc_levels: Failed reading power descriptor.len = 98 ret = -11
[   36.480083] ufshcd-hi3660 ff3b0000.ufs: ufshcd_print_pwr_info:[RX, TX]: gear=[1, 1], lane[1, 1], pwr[SLOWAUTO_MODE, SLOWAUTO_MODE], rate = 0
[   36.493073] ufshcd-hi3660 ff3b0000.ufs: UPIU[0] - issue time 14654573 us
...
[   36.755689] ufshcd-hi3660 ff3b0000.ufs: ufshcd_print_pwr_info:[RX, TX]: gear=[3, 3], lane[2, 2], pwr[FAST MODE, FAST MODE], rate = 2
[   36.767798] --CJ in mount_root: entering mount_block_root(/dev/root, 0x8000)
[   36.774793] --CJ mount_block_root: name=/dev/root, fs_names = 
[   36.862337] -CJ do_mount_root (/dev/root, ext3)
 
[   36.866925] VFS: Cannot open root device "sdd10" or unknown-block(0,0): error -6 //ENXIO = /* No such device or address */
[   36.874332] Please append a correct "root=" boot option; here are the available partitions:
[   36.882734] --CJ printk_all_partitions: 
[   36.886730] -- -- CJ loop 1
[   36.889578] -- -- CJ loop 1
[   36.892442] -- -- CJ loop 1
[   36.895304] -- -- CJ loop 1
[   36.898157] -- -- CJ loop 1
[   36.901025] -- -- CJ loop 1
[   36.903889] -- -- CJ loop 1
[   36.906751] -- -- CJ loop 1
[   36.909613] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[   36.930939] Call trace:
[   36.933464] [<ffff000008088be0>] dump_backtrace+0x0/0x370
[   36.938925] [<ffff000008088f64>] show_stack+0x14/0x20
[   36.944037] [<ffff000008a71200>] dump_stack+0x9c/0xbc
[   36.949159] [<ffff0000080c78d8>] panic+0x11c/0x28c
[   36.954011] [<ffff000008f41184>] mount_block_root+0x1bc/0x290
[   36.959817] [<ffff000008f41384>] mount_root+0x12c/0x144
[   36.965107] [<ffff000008f414e4>] prepare_namespace+0x148/0x190
[   36.971005] [<ffff000008f40d8c>] kernel_init_freeable+0x208/0x22c
[   36.977163] [<ffff000008a836e8>] kernel_init+0x10/0x100
[   36.982451] [<ffff000008084b58>] ret_from_fork+0x10/0x18
[   36.987832] SMP: stopping secondary CPUs

init\do_mount.c

void __init prepare_namespace(void)
{
        ROOT_DEV = name_to_dev_t(root_device_name);
        root_device_name += 5; //remove /dev/
	mount_root();
}
 
void __init mount_root(void)
{
		int err = create_dev("/dev/root", ROOT_DEV); (= mknod (/dev/root->ROOT_DEV)
		mount_block_root("/dev/root", root_mountflags/=0x8000/);
}
 
void __init mount_block_root(char *name, int flags) //name shouldn't be sdd10
	for (p = fs_names; *p; p += strlen(p)+1) {
		int err = do_mount_root(name, p, flags, root_mount_data);
                //SYS_MOUNT("/dev/root", "/root","ext3") error = -6
 
		__bdevname(ROOT_DEV, b); //ROOT_DEV=0
		printk("VFS: Cannot open root device \"%s\" or %s: error %d\n",
				root_device_name, b, err);
//VFS: Cannot open root device "sdd10" or unknown-block(0,0): error -6
//root_device_name = sdd10 跟 /dev/root 有什麼關係?
//why ROOT_DEV = 0,0: node created but not mount 
 
		printk("Please append a correct \"root=\" boot option; here are the available partitions:\n");
		printk_all_partitions();//NO OUTPUT
		panic("VFS: Unable to mount root fs on %s", b);
                // VFS: Unable to mount root fs on unknown-block(0,0)
	}
 
}
 
static int __init do_mount_root(char *name, char *fs, int flags, void *data)
{
	struct super_block *s;
	int err = sys_mount(name, "/root", fs, flags, data);
	if (err)
		return err;
 
	sys_chdir("/root");
	s = current->fs->pwd.dentry->d_sb;
	ROOT_DEV = s->s_dev;
	printk(KERN_INFO
	       "VFS: Mounted root (%s filesystem)%s on device %u:%u.\n",
	       s->s_type->name,
	       sb_rdonly(s) ? " readonly" : "",
	       MAJOR(ROOT_DEV), MINOR(ROOT_DEV));
	return 0;
}
 
 
 
dev_t name_to_dev_t(const char *name)
{
	char s[32];
	char *p;
	dev_t res = 0;
	int part;
 
	strcpy(s, name);
	for (p = s; *p; p++)
		if (*p == '/')
			*p = '!';
printk("--- blk_lookup_edvt(%s)\n", s);//s="sdd10"
	res = blk_lookup_devt(s, 0);
	if (res)
		goto done;
 
	/*
	 * try non-existent, but valid partition, which may only exist
	 * after revalidating the disk, like partitioned md devices
	 */
	while (p > s && isdigit(p[-1]))
		p--;
	if (p == s || !*p || *p == '0')
		goto fail;
 
	/* try disk name without <part number> */
	part = simple_strtoul(p, NULL, 10);
	*p = '\0';
printk("--CJ 2nd blk_lookup_dvt(%s)\n", s);//s=sdd, part=10
	res = blk_lookup_devt(s, part);
	if (res)
		goto done;
 
	/* try disk name without p<part number> */
	if (p < s + 2 || !isdigit(p[-2]) || p[-1] != 'p')
		goto fail;
	p[-1] = '\0';
printk("--CJ 3rd bLk_lookup %s\n", s);
	res = blk_lookup_devt(s, part);
	if (res)
		goto done;
 
fail:
	return 0;
done:
	return res;
}

./block/genhd.c

void __init printk_all_partitions(void)
{
	struct class_dev_iter iter;
	struct device *dev;
printk("--CJ printk_all_partitions: \n");
	class_dev_iter_init(&iter, &block_class, NULL, &disk_type);
	while ((dev = class_dev_iter_next(&iter))) {
		struct gendisk *disk = dev_to_disk(dev);
		struct disk_part_iter piter;
		struct hd_struct *part;
		char name_buf[BDEVNAME_SIZE];
		char devt_buf[BDEVT_SIZE];
printk("-- -- CJ loop 1\n");
		/*
		 * Don't show empty devices or things that have been
		 * suppressed
		 */
		if (get_capacity(disk) == 0 ||
		    (disk->flags & GENHD_FL_SUPPRESS_PARTITION_INFO))
			continue;
 
		/*
		 * Note, unlike /proc/partitions, I am showing the
		 * numbers in hex - the same format as the root=
		 * option takes.
		 */
		disk_part_iter_init(&piter, disk, DISK_PITER_INCL_PART0);
		while ((part = disk_part_iter_next(&piter))) {
			bool is_part0 = part == &disk->part0;
 
			printk("%s%s %10llu %s %s", is_part0 ? "" : "  ",
			       bdevt_str(part_devt(part), devt_buf),
			       (unsigned long long)part_nr_sects_read(part) >> 1
			       , disk_name(disk, part->partno, name_buf),
			       part->info ? part->info->uuid : "");
			if (is_part0) {
				if (dev->parent && dev->parent->driver)
					printk(" driver: %s\n",
					      dev->parent->driver->name);
				else
					printk(" (driver?)\n");
			} else
				printk("\n");
		}
		disk_part_iter_exit(&piter);
	}
	class_dev_iter_exit(&iter);
}
dev_t blk_lookup_devt(const char *name, int partno)
{
	dev_t devt = MKDEV(0, 0);
	struct class_dev_iter iter;
	struct device *dev;
 
	class_dev_iter_init(&iter, &block_class, NULL, &disk_type);
	while ((dev = class_dev_iter_next(&iter))) {
		struct gendisk *disk = dev_to_disk(dev);
		struct hd_struct *part;
 
		if (strcmp(dev_name(dev), name))
			continue;
 
		if (partno < disk->minors) {
			/* We need to return the right devno, even
			 * if the partition doesn't exist yet.
			 */
			devt = MKDEV(MAJOR(dev->devt),
				     MINOR(dev->devt) + partno);
			break;
		}
		part = disk_get_part(disk, partno);
		if (part) {
			devt = part_devt(part);
			disk_put_part(part);
			break;
		}
		disk_put_part(part);
	}
	class_dev_iter_exit(&iter);
	return devt;
}