[LTP] [PATCH] tst_device: Scan /sys/block/* for stat file

Petr Vorel pvorel@suse.cz
Wed Jan 15 11:39:51 CET 2020


Hi,

...
> > > +int find_stat_file(const char *dev, char *path, size_t path_len)
> > > +{
> > > +	const char *devname = strrchr(dev, '/') + 1;
> > > +
> > > +	snprintf(path, path_len, "/sys/block/%s/stat", devname);
> > > +
> > > +	if (!access(path, F_OK))
> > > +		return 1;
> > > +
> > > +	DIR *dir = SAFE_OPENDIR(NULL, "/sys/block/");
> > > +	struct dirent *ent;
> > > +
> > > +	while ((ent = readdir(dir))) {
> > > +		snprintf(path, path_len, "/sys/block/%s/%s/stat", ent->d_name, devname);
> > > +
> > > +		fprintf(stderr, "%s\n", path);
> > > +
> > It will make many noise when using .all_filesystem and we can remove it. 
> > Other than, it looks good to me.

> That's forgotten debug print, I should have removed that before sending.

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr


More information about the ltp mailing list