片段->partition check

linux 3.5.3

1 struct parsed_partitions *
2 check_partition(struct gendisk *hd, struct block_device *bdev)//--------分区检测
3 -->efi_partition,        /* this must come before msdos */    //intel的EFI
4 -->msdos_partition,                                           //microsoft的msdos

 

1 set_capacity(disk, 0);//-----set sectors = 0
2 static inline sector_t get_capacity(struct gendisk *disk)
3 {
4     return disk->part0.nr_sects;
5 }-----//return the real sectors of disk

 

 1 //结构转化--genhd.h---Generic hard disk header file 
 2 #define kobj_to_dev(k)        container_of((k), struct device, kobj)
 3 #define dev_to_disk(device)    container_of((device), struct gendisk, part0.__dev)
 4 #define dev_to_part(device)    container_of((device), struct hd_struct, __dev)
 5 #define disk_to_dev(disk)    (&(disk)->part0.__dev)
 6 #define part_to_dev(part)    (&((part)->__dev))
 7 
 8 static inline struct gendisk *part_to_disk(struct hd_struct *part)//-----part-->dev-->disk
 9 {
10     if (likely(part)) {
11         if (part->partno)
12             return dev_to_disk(part_to_dev(part)->parent);
13         else
14             return dev_to_disk(part_to_dev(part));
15     }
16     return NULL;
17 }
18 
19 
20 
21 static inline dev_t disk_devt(struct gendisk *disk)//------转化为major:minor形式
22 {
23     return disk_to_dev(disk)->devt;
24 }
25 
26 static inline dev_t part_devt(struct hd_struct *part))//------转化为major:minor形式
27 {
28     return part_to_dev(part)->devt;
29 }

 partitions check call stack

 1 <4>[    7.010712] -+-+-+-+-+-+-+-+-+-+-+-+-+-+
 2 (unwind_backtrace+0x0/0x12c) from [<c0185bc8>] (warn_slowpath_common+0x4c/0x64)
 3 (warn_slowpath_common+0x4c/0x64) from [<c0185bf8>] (warn_slowpath_null+0x18/0x1c)
 4 (warn_slowpath_null+0x18/0x1c) from [<c0273b68>] (rescan_partitions+0x24/0x4bc)
 5 (rescan_partitions+0x24/0x4bc) from [<c0256ae8>] (__blkdev_get+0x154/0x320)
 6 (__blkdev_get+0x154/0x320) from [<c0256e9c>] (blkdev_get+0x1e8/0x340)
 7 (blkdev_get+0x1e8/0x340) from [<c038009c>] (register_disk+0xdc/0x158)
 8 (register_disk+0xdc/0x158) from [<c03801fc>] (add_disk+0xe4/0x298)
 9 (add_disk+0xe4/0x298) from [<c063634c>] (mmc_add_disk+0x10/0x68)
10 (mmc_add_disk+0x10/0x68) from [<c06366a4>] (mmc_blk_probe+0x1a8/0x230)
11 (mmc_blk_probe+0x1a8/0x230) from [<c062b744>] (mmc_bus_probe+0x18/0x1c)
12 (mmc_bus_probe+0x18/0x1c) from [<c046e4e8>] (driver_probe_device+0x148/0x2f4)
13 (driver_probe_device+0x148/0x2f4) from [<c046d650>] (bus_for_each_drv+0x48/0x84)
14 (bus_for_each_drv+0x48/0x84) from [<c046e374>] (device_attach+0x74/0xa0)
15 (device_attach+0x74/0xa0) from [<c046d468>] (bus_probe_device+0x24/0x40)
16 (bus_probe_device+0x24/0x40) from [<c046c358>] (device_add+0x3f4/0x594)
17 (device_add+0x3f4/0x594) from [<c062b9a4>] (mmc_add_card+0x16c/0x1c8)
18 (mmc_add_card+0x16c/0x1c8) from [<c062dd78>] (mmc_attach_mmc+0x110/0x18c)
19 (mmc_attach_mmc+0x110/0x18c) from [<c062a3d8>] (mmc_rescan+0x2b4/0x314)
20 (mmc_rescan+0x2b4/0x314) from [<c019db30>] (process_one_work+0x27c/0x44c)
21 (process_one_work+0x27c/0x44c) from [<c019e0d8>] (worker_thread+0x220/0x3a0)
22 (worker_thread+0x220/0x3a0) from [<c01a39c4>] (kthread+0x80/0x88)
23 (kthread+0x80/0x88) from [<c0106fe4>] (kernel_thread_exit+0x0/0x8)
24 <4>[    7.537677] -+-+-+-+-+-+-+-+-+-+-+-+-+-+

 

 

posted on 2012-09-29 23:03  深眸远绿  阅读(487)  评论(0)    收藏  举报

导航