bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ped_disk_new(). why needs_clobber is set while reading the partition tab


From: rahul dev
Subject: ped_disk_new(). why needs_clobber is set while reading the partition table ?
Date: Fri, 5 Aug 2011 11:45:35 +0530 (IST)

Guys,

  I had a look at the latest version of libparted. Here also in function 
ped_disk_new(), disk->needs_clobber is set to 0 after type->ops->read(disk). 
Why do we want to keep need_clobber set to 1 while reading the partition table 
? I think needs_clobber should be set to 0 before partition table is read.

Please see the code below:

PedDisk*
ped_disk_new (PedDevice* dev)
{
..
..

         disk = ped_disk_new_fresh (dev, type);
        if (!disk)
                goto error_close_dev;
                                         <-- disk->needs_clobber should be
                                             set to 0 here.
        if (!type->ops->read (disk))
                goto error_destroy_disk;
        disk->needs_clobber = 0;        
        
..
..
}

gpt_read() tries to correct the partition table in case primary or secondary is 
corrupted. If needs_clobber is set, gpt_read() will try to clobber the 
partition table signatures which is incorrect (in case write_back is set).
Why do we need to remove other partition table signatures while reading a 
partition table ?

thanks,
rahul



reply via email to

[Prev in Thread] Current Thread [Next in Thread]