Re: [PATCH] PM / Hibernate : Use get_gendisk to verify partition if resume_file is integer format

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

 



On 05/13/2012 06:39 AM, Rafael J. Wysocki wrote:
> On Wednesday, May 09, 2012, Minho Ban wrote:
>>  	/* Check if the device is there */
>>  	swsusp_resume_device = name_to_dev_t(resume_file);
>> +
>> +	/*
>> +	 * name_to_dev_t is ineffective to verify parition if resume_file is in
>> +	 * integer format. (e.g. major:minor)
>> +	 */
>> +	if (isdigit(resume_file[0]) && resume_wait) {
>> +		int partno;
>> +		while (!get_gendisk(swsusp_resume_device, &partno))
>> +			msleep(10);
>> +	}
> 
> Hmm.  Wouldn't it be better to do:
> 
> 	if (isdigit(resume_file[0]) && resume_wait) {
> 		int partno;
> 		while (!get_gendisk(swsusp_resume_device, &partno))
> 			msleep(10);
> 	} else {
> 		swsusp_resume_device = name_to_dev_t(resume_file);
> 	}
> 
> ?

Do you want name_to_dev_t to be called again?  If not, swsusp_resume_device parameter 
in get_gendisk can not be used because it is not initialized yet.

> 
> Your new code will overwrite whatever swsusp_resume_device is set to by the
> preceding statement anyway.
> 

Sorry, I don't understand what will be overwritten by the new code. It would be very 
much appreciated if you point it again.

Regards,
Minho Ban
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux