[LTP] [PATCH v5 11/16] Add statmount05 test

Andrea Cervesato andrea.cervesato@suse.com
Tue Oct 8 16:11:56 CEST 2024


On 10/8/24 15:57, Andrea Cervesato wrote:
> Hi,
>
> On 10/8/24 14:03, Cyril Hrubis wrote:
>> Hi!
>>> +static void test_mount_root(void)
>>> +{
>>> +    tst_res(TINFO, "Testing STATMOUNT_MNT_ROOT");
>>> +
>>> +    char *last_root;
>>> +
>>> +    memset(st_mount, 0, SM_SIZE);
>>> +
>>> +    TST_EXP_PASS(statmount(root_id, STATMOUNT_MNT_ROOT, st_mount,
>>> +        SM_SIZE, 0));
>>> +
>>> +    if (!TST_PASS)
>>> +        return;
>>> +
>>> +    last_root = strrchr(mnt_root, '/');
>> Wouldn't last_root = strrchr(DIRA, '/') produce the same result?
>>
>> I'm just wondering why MNT_ROOT is relative and MNT_POINT is absolute
>> here.
> Because STATMOUNT_MNT_ROOT returns the root folder and 
> STATMOUNT_MNT_POINT returns the mount point folder, relative to the 
> root folder.
That seems like the way statmount() is working by the way. Also in the 
kselftests root folder is given with a relative path, while mount point 
is containing the absolute path.
>>> +    TST_EXP_EQ_LI(st_mount->mask, STATMOUNT_MNT_ROOT);
>>> +    TST_EXP_EQ_STR(st_mount->str + st_mount->mnt_root, last_root);
>>> +}
>> Otherwise:
>> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
>>
> Andrea


More information about the ltp mailing list