GNOME Bugzilla – Bug 766137
use proper units in tracker_file_system_get_remaining_space
Last modified: 2016-05-10 08:33:02 UTC
Created attachment 327470 [details] [review] use proper units in tracker_file_system_get_remaining_space Hi. According to POSIX: fsblkcnt_t f_blocks Total number of blocks on file system in units of f_frsize And the fields of type fsblkcnt_t are reported in units of: f_frsize for statvfs() f_bsize for statfs() statfs() is only used within an idef __linux__ so other OSes end up using statvfs which on OpenBSD yelds to: $ tracker status ... Remaining space on database partition: 114.1 GB (114056953856 bytes) (8.95%) $ df -h |grep /home /dev/sd1i 148G 128G 13.3G 91% /home That patch seems to fix it and should not introduce regression on Linux (code is unchanged, we're just using the __bsize local define instead): $ tracker status ... Remaining space on database partition: 14.3 GB (8.95%) Thank you.
Comment on attachment 327470 [details] [review] use proper units in tracker_file_system_get_remaining_space Thanks for the patch, it looks fine to me. I just have two minor nits: - The __bsize defines could probably be done outside the 64/32 bit preprocessor branches, so we avoid repeating those. - Would be great to have a comment before the return, mentioning that __bsize is a platform dependent #define above, will surely save some head scratching in the future. I won't pick up too hard on the former, but please adress the latter :). Feel free to push and close this bug afterwards.
All done (6c97d3df), thank you Carlos.