Re: About partition scheme.
Re: About partition scheme.
- Subject: Re: About partition scheme.
- From: Sid Moore <email@hidden>
- Date: Thu, 05 Jul 2012 10:13:31 +0800
On Wed, Jul 4, 2012 at 8:34 PM, Phil Jordan <email@hidden> wrote:
> On Wed, Jul 4, 2012 at 2:17 PM, Li Flost.Dexiong <email@hidden> wrote:
>> [Flost]: I had once try to init my newMedia using true as the "isWhole" argument. but this will cause the system panic.
>
> I've successfully written drivers which pass true for the isWhole
> argument. It works. Your panic is probably caused by multiple
> instances of your partition scheme stacking on top of each other:
>
> - disk1 is inserted and starts matching
> - your partition scheme matches on disk1
> - the condition in your probe() is fulfilled by disk1
> - your partition scheme start()s and creates a new "whole" IOMedia object, disk2
> - disk2 appears and starts matching
> - your partition scheme matches on disk2
> - the condition in your probe() is fulfilled by disk2
> - your partition scheme start()s and creates a new "whole" IOMedia object, disk3
>
> etc. etc.
>
> Until you run out of some resource.
Yes, Phil's analysis is able to exactly depict this panic. I think
What Flost need is that his own driver class can take over the whole
disk and all the request to his disks should pass through his driver
code. So, I guess his own driver class should inherit from
IOBlockStorageDevice and make IOBlockStorageDriver as its provider?
Am I correct?
>
> Basically, your probe() shouldn't succeed for disk2, but it does.
> That's where your bug is (one of them anyway).
>
>> on line 565, if i set the false to true, the system got panic when my disk was insert into the system.
>
> The panic probably doesn't happen on line 565 itself. I suggest using
> 2-machine debugging and synchronous kprintf logging. It really helps.
>
>> or some way to prevent the #0 to be created?
>
> Let's assume the disk you are inserting is a USB stick. When you
> insert it, the USB storage driver creates a new storage object, which
> generates a IOMedia object named "disk1". This is the "#0" you are
> seeing. Your driver hasn't even loaded at this point. When your filter
> scheme matches on disk1, you have 2 options for creating IOMedia
> objects:
>
> isWhole = true: your IOMedia objects will be named "disk2", "disk3",
> etc. and look like "whole" physical devices.
> isWhole = false: your IOMedia objects will be named "disk1s1",
> "disk1s2", etc. and look like partitions.
>
> You can't just "get rid of" disk1 as that's not generated in your
> code, and is in fact the provider to your filter scheme. You NEED it
> to exist.
>
> HTH
> phil
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-kernel mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden