public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] block/ltp_block_dev.c: Update tests for the newer kernel
Date: Mon, 11 Feb 2019 10:18:02 +0800	[thread overview]
Message-ID: <5C60DB5A.2030701@cn.fujitsu.com> (raw)
In-Reply-To: <20190208114833.GA26843@dell5510>

On 2019/02/08 19:48, Petr Vorel wrote:
> Hi Xiao,
>
>> The maximum major number is set to 511 since kernel commit 133d55c,
>> so register_blkdev() with a major number grater than the maximum(511)
>> will get failure instead of pass as expected.
>> 1) Update tests for the newer behavior of register_blkdev().
>> 2) Add more major numbers(i.e. 511 and 512) to test.
>> Note:
>> It is possible that specified major numbers have been used
>> by system, so we skip them if register_blkdev() returns EBUSY.
>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>> Reviewed-by: Petr Vorel<pvorel@suse.cz>
> Acked-by: Petr Vorel<pvorel@suse.cz>
> Thanks for your updates.
>
>> ---
>>   .../block/block_dev_kernel/ltp_block_dev.c         | 64 +++++++++++-----------
>>   1 file changed, 32 insertions(+), 32 deletions(-)
>> diff --git a/testcases/kernel/device-drivers/block/block_dev_kernel/ltp_block_dev.c b/testcases/kernel/device-drivers/block/block_dev_kernel/ltp_block_dev.c
> ...
>> @@ -225,18 +221,22 @@ static int tc04(void)
>>   static int tc05(void)
> ...
>
>> -	major = register_blkdev(UINT_MAX, BLK_DEV_NAME);
>> -	prk_debug("major = %i\n", major);
>> +	for (i = 0; i<  sizeof(test_major) / sizeof(unsigned int); i++) {
>> +		major = register_blkdev(test_major[i], BLK_DEV_NAME);
>> +		prk_debug("major = %i\n", major);
>> -	if (major == 0) {
>> -		unregister_blkdev(UINT_MAX, BLK_DEV_NAME);
>> -	} else {
>> -		prk_debug("reg blkdev with major %d failed with error %i\n",
>> -			UINT_MAX, major);
>> -		pass = 0;
>> +		if (major == 0) {
> In v1 this was major>= 0.
> It looks to me as well that major == 0 is correct.
Hi Petr,

Thanks for your ack. :-)

According to the comment of register_blkdev() at block/genhd.c in 
kernel,  i think register_blkdev() only
returns zero or a negative error if a positive major number(i.e. 
nonzero) is passed to register_blkdev().
---------------------------------------------------------------------------------------------------------------------------------

||

  *  - if a major device number was requested in range [1..BLKDEV_MAJOR_MAX-1]
  *    then the function returns zero on success, or a negative error code
  *  - if any unused major number was requested with @major = 0 parameter
  *    then the return value is the allocated major number in range
  *    [1..BLKDEV_MAJOR_MAX-1] or a negative error code otherwise

---------------------------------------------------------------------------------------------------------------------------------

So i perfer to use major == 0. :-)

Best Regards,
Xiao Yang
>> +			unregister_blkdev(test_major[i], BLK_DEV_NAME);
>> +			pass = 0;
>> +		} else {
>> +			prk_debug("register_blkdev() with major %u got error %i\n",
>> +				  test_major[i], major);
>> +		}
>>   	}
>>   	prk_info("Test Case Result: %s\n", result_str(pass));
>
> Kind regards,
> Petr
>
>
> .
>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190211/0df21593/attachment.html>

  reply	other threads:[~2019-02-11  2:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-28  7:03 [LTP] [PATCH] block/ltp_block_dev.c: Update tests for the newer kernel Xiao Yang
2019-02-06  7:06 ` Petr Vorel
2019-02-08  2:08   ` Xiao Yang
2019-02-08  3:37   ` [LTP] [PATCH v2] " Xiao Yang
2019-02-08 11:48     ` Petr Vorel
2019-02-11  2:18       ` Xiao Yang [this message]
2019-02-13 10:11       ` Xiao Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5C60DB5A.2030701@cn.fujitsu.com \
    --to=yangx.jy@cn.fujitsu.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox