• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: About partition scheme.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About partition scheme.


  • Subject: Re: About partition scheme.
  • From: "Li Flost.Dexiong" <email@hidden>
  • Date: Wed, 04 Jul 2012 20:17:16 +0800

Hi Phil,

Thanks for your response.
please see my comment below

在 2012-7-4,下午7:45, Phil Jordan 写道:

> On Wed, Jul 4, 2012 at 8:14 AM, Li Flost.Dexiong <email@hidden> wrote:
>> /dev/disk1
>>   #:                       TYPE NAME                    SIZE       IDENTIFIER
>>   0:                                                              *16.1 GB    disk1
>>   1:            new_testdisk                            16.1 GB    disk1s1
>>
>>
>> I'm wandering why there is a #0 on my disk, when and how does it create?
>
> "disk 0" is the whole disk that the partition scheme sits inside. Look
> at the IOMedia hierarchy in IORegistryExplorer and it'll make more
> sense.
>
>> Also, are there any reference about how the "disk1s1" string was generate and record on my system?
>
> The "1" is generated from the location you set on your newly created
> IOMedia object like so:
> newMedia->setLocation("1");
> This only happens if the IOMedia object isn't "whole". If it's whole,
> a new diskX node is generated.


[Flost]: I had once try to init my newMedia using true as the "isWhole" argument. but this will cause the system panic.

my init of this media call was(this will not panic. but the #0 was created.):

  8 #define UUIDLEN 16
  9 typedef struct mydisk{
 10         UInt32          DISKTYPE;
 11         UInt32          headerlength;
 12         UInt32          checksum;
 13         UInt32          version;
 14         UInt64          vollength;
 15         unsigned char   uuid[UUIDLEN];
 16 }__attribute__((packed)) mydisk_t;


552 IOMedia * My_Scheme::instantiateMediaObject(mydisk_t* partition)
553 {
554         IOMedia *media = getProvider();
555         UInt64   mediaBlockSize = media->getPreferredBlockSize();
556         IOMedia *newMedia;
557
558         newMedia = new IOMedia;
559         if (newMedia) {
560                 UInt64 partionBase, partionSize;
561                 partionBase = 0; //OSSwapLittleToHostInt64(partition->base) * mediaBlockSize;
562                 partionSize = partition->vollength; //OSSwapLittleToHostInt64(partition->size) * mediaBlockSize;
563
564                 if (newMedia->init(partionBase, partionSize, mediaBlockSize, media->getAttributes(),\
565                                         false, media->isWritable(), "new_testdisk")) {
566                         newMedia->setName("new_testdisk");
567                         char location[12];
568                         uuid_string_t uuid;
569                         uuid_unparse(partition->uuid, uuid);
570                         snprintf(location, sizeof(location), "%d", devcnt);
571                         newMedia->setProperty(kIOMediaPartitionIDKey, devcnt, 32);
572                         newMedia->setLocation(location);
573                             newMedia->setProperty(kIOMediaUUIDKey, uuid);
574                 } else {
575                         newMedia->release();
576                         newMedia = NULL;
577                 }
578         }
579         return newMedia;
580 }


on line 565, if i set the false to true, the system got panic when my disk was insert into the system.

the mydisk_t was write the the disk before hand. and read in probe() function. and make the bit-order swap when read.
this InstantiateMediaObject was call by start function.

Is there any property that i could set this media is a  whole?
or some way to prevent the #0 to be created?


>
> HTH
> phil

Best regards,
Flost.D.Li
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


  • Follow-Ups:
    • Re: About partition scheme.
      • From: Phil Jordan <email@hidden>
References: 
 >About partition scheme. (From: "Li Flost.Dexiong" <email@hidden>)
 >Re: About partition scheme. (From: Phil Jordan <email@hidden>)

  • Prev by Date: Re: About partition scheme.
  • Next by Date: Re: About partition scheme.
  • Previous by thread: Re: About partition scheme.
  • Next by thread: Re: About partition scheme.
  • Index(es):
    • Date
    • Thread