On Tue, Oct 13, 2015 at 06:26:25PM +0300, Maxim Perevedentsev wrote: Another couple of things ...
+ char pattern[] = "Estimated minimum size of the filesystem: ";
This should be 'const char *pattern'.
+ if ((p = strstr (lines[i], pattern))) { + if (sscanf (p + strlen(pattern), "%" SCNu64, &ret) != 1) + return -1; + return ret;
There's a case for multiplying the return size by the block size of the filesystem, thus returning the size in bytes. It might make the API easier to use. Not sure how hard that is, or whether it actually makes the API easier to use. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/