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 625751 - [PATCH] Add G_FILE_ATTRIBUTE_FILESYSTEM_USED
[PATCH] Add G_FILE_ATTRIBUTE_FILESYSTEM_USED
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Tomas Bzatek
gtkdev
Depends on:
Blocks: 559311
 
 
Reported: 2010-08-01 10:26 UTC by Marcus Carlson
Modified: 2012-01-10 02:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Improve readability by adding comments for #ifs and #ifdefs (3.17 KB, patch)
2010-08-01 10:27 UTC, Marcus Carlson
accepted-commit_now Details | Review
Adds G_FILE_ATTRIBUTE_FILESYSTEM_USED to get exact used space from fs (2.35 KB, patch)
2010-08-01 10:28 UTC, Marcus Carlson
accepted-commit_now Details | Review

Description Marcus Carlson 2010-08-01 10:26:39 UTC
To get the correct information of how many bytes is used in the file system it isn't enough to do total - free because of the (default) 5% reserved for root. Therefor I propose to add a new attribute, G_FILE_ATTRIBUTE_FILESYSTEM_USED, that uses statfs.f_bfree instead of statfs.f_bavail. This will help nautilus bug 559311 to report the same as the df command.
Comment 1 Marcus Carlson 2010-08-01 10:27:41 UTC
Created attachment 166913 [details] [review]
Improve readability by adding comments for #ifs and #ifdefs

But first a patch that's improve readability in the g_local_file_query_filesystem_info() function.
Comment 2 Marcus Carlson 2010-08-01 10:28:31 UTC
Created attachment 166914 [details] [review]
Adds G_FILE_ATTRIBUTE_FILESYSTEM_USED to get exact used space from fs
Comment 3 Phillip Susi 2011-06-13 14:10:39 UTC
So it has been 10 months now.  Did this patch ever get applied or has it just been ignored?
Comment 4 Marcus Carlson 2011-06-13 14:24:37 UTC
I haven't got any comment on this. Maybe one should ping Alex about it?
Comment 5 Phillip Susi 2011-12-15 20:34:44 UTC
Ping.
Comment 6 Matthias Clasen 2011-12-15 23:00:25 UTC
Tomas, can you take a look ?
Comment 7 Tomas Bzatek 2012-01-03 15:03:12 UTC
Review of attachment 166913 [details] [review]:

This one looks good, please commit.
Comment 8 Tomas Bzatek 2012-01-03 15:34:54 UTC
Review of attachment 166914 [details] [review]:

The patch looks good to me too, we use statfs_buffer.f_bavail (free blocks for unprivileged users) as a default way to retrieve real free space which is great.

Just a side note - please include link to this bugreport in patch comments to have a backwards reference.

::: gio/gfileinfo.h
@@ +736,3 @@
+ * %G_FILE_ATTRIBUTE_TYPE_UINT64.
+ **/
+#define G_FILE_ATTRIBUTE_FILESYSTEM_USED "filesystem::used"                       /* uint64 */

Would be useful to update docs in gfileattribute.c as well