After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 766137 - use proper units in tracker_file_system_get_remaining_space
use proper units in tracker_file_system_get_remaining_space
Status: RESOLVED FIXED
Product: tracker
Classification: Core
Component: General
1.8.x
Other OpenBSD
: Normal normal
: ---
Assigned To: tracker-general
tracker-general
Depends on:
Blocks:
 
 
Reported: 2016-05-08 13:44 UTC by Antoine Jacoutot
Modified: 2016-05-10 08:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
use proper units in tracker_file_system_get_remaining_space (1.33 KB, patch)
2016-05-08 13:44 UTC, Antoine Jacoutot
committed Details | Review

Description Antoine Jacoutot 2016-05-08 13:44:39 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 1 Carlos Garnacho 2016-05-09 00:37:25 UTC
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.
Comment 2 Antoine Jacoutot 2016-05-10 05:54:04 UTC
All done (6c97d3df), thank you Carlos.