<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Cyril Hrubis <<a href="mailto:chrubis@suse.cz">chrubis@suse.cz</a>> wrote:<br></div></div><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br>
> +static char *limit_tmpfs_mount_size(const char *mnt_data,<br>
> +                     char *buf, size_t buf_size, const char *fs_type)<br>
> +{<br>
> +     int fd;<br>
> +     uint64_t dev_size;<br>
> +<br>
> +     if (strcmp(fs_type, "tmpfs"))<br>
> +             return mnt_data;<br>
> +<br>
> +     fd = SAFE_OPEN(<a href="http://tdev.dev" rel="noreferrer" target="_blank">tdev.dev</a>, O_RDONLY);<br>
> +     SAFE_IOCTL(fd, BLKGETSIZE64, &dev_size);<br>
> +     SAFE_CLOSE(fd);<br>
<br>
We can as well add size to the struct tst_device and fill it in when<br>
device is created, that would be a slightly cleaner solution.<br></blockquote><div><br></div><div><br></div><div class="gmail_default" style="font-size:small">That should be fine. But I'm afraid we have to change the return type</div><div class="gmail_default" style="font-size:small">for many functions in tst_device.c, because currently most of them</div><div class="gmail_default" style="font-size:small">only return a path to the test device. And that will affect more tests.</div><div class="gmail_default" style="font-size:small"></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Or, maybe just create a function to get the device size and pass it</div><div class="gmail_default" style="font-size:small">to tdev.size simply?</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>