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 788927 - Expose better API for detecting ‘system’ mounts
Expose better API for detecting ‘system’ mounts
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
2.54.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2017-10-13 10:05 UTC by Philip Withnall
Modified: 2017-10-25 23:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gio: Add API for identifying system FS types and device paths (7.46 KB, patch)
2017-10-25 14:05 UTC, Philip Withnall
committed Details | Review
gio: Add autoptr declarations for GUnixMountEntry and GUnixMountPoint (1.17 KB, patch)
2017-10-25 14:21 UTC, Philip Withnall
none Details | Review
gio: Add autoptr declarations for GUnixMountEntry and GUnixMountPoint (1016 bytes, patch)
2017-10-25 14:23 UTC, Philip Withnall
committed Details | Review

Description Philip Withnall 2017-10-13 10:05:18 UTC
See bug #788880. We want to reduce the duplication of code between g-c-c, g-s-d and GLib for detecting ‘system’ mounts, which should not be used in disk space calculations.

Currently, there are three bits of similar code:
 • https://git.gnome.org/browse/glib/tree/gio/gunixmounts.chttps://git.gnome.org/browse/gnome-settings-daemon/tree/plugins/housekeeping/gsd-disk-space-helper.chttps://git.gnome.org/browse/gnome-control-center/tree/panels/info/gsd-disk-space-helper.c

Ideally we’d have an API like g_unix_mount_is_system_internal(), but which doesn’t factor in the result of g_unix_is_mount_path_system_internal() since that’s irrelevant in g-s-d’s case.

g_unix_mount_has_system_fs_type()?
and g_unix_mount_has_system_device_path()?
Comment 1 Bastien Nocera 2017-10-13 14:09:30 UTC
(In reply to Philip Withnall from comment #0)
> See bug #788880. We want to reduce the duplication of code between g-c-c,
> g-s-d and GLib for detecting ‘system’ mounts, which should not be used in
> disk space calculations.
> 
> Currently, there are three bits of similar code:
>  • https://git.gnome.org/browse/glib/tree/gio/gunixmounts.c
>  •
> https://git.gnome.org/browse/gnome-settings-daemon/tree/plugins/housekeeping/
> gsd-disk-space-helper.c
>  •
> https://git.gnome.org/browse/gnome-control-center/tree/panels/info/gsd-disk-
> space-helper.c

Those 2 last ones are copy/paste.

> 
> Ideally we’d have an API like g_unix_mount_is_system_internal(), but which
> doesn’t factor in the result of g_unix_is_mount_path_system_internal() since
> that’s irrelevant in g-s-d’s case.
> 
> g_unix_mount_has_system_fs_type()?

"is" system fs type.

> and g_unix_mount_has_system_device_path()?

Sure.
Comment 2 Philip Withnall 2017-10-25 14:05:24 UTC
Created attachment 362270 [details] [review]
gio: Add API for identifying system FS types and device paths

This is needed by gnome-control-center and gnome-settings-daemon; it
makes existing checks from gunixmounts.c public.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Comment 3 Philip Withnall 2017-10-25 14:08:00 UTC
I decided to make them functions, rather than methods of GUnixMountEntry, to match the existing g_unix_is_mount_path_system_internal().
Comment 4 Philip Withnall 2017-10-25 14:21:40 UTC
Created attachment 362272 [details] [review]
gio: Add autoptr declarations for GUnixMountEntry and GUnixMountPoint

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Comment 5 Philip Withnall 2017-10-25 14:23:53 UTC
Created attachment 362273 [details] [review]
gio: Add autoptr declarations for GUnixMountEntry and GUnixMountPoint

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Comment 6 Colin Walters 2017-10-25 16:58:48 UTC
Review of attachment 362270 [details] [review]:

Minor docstring suggestion, feel free to ignore/tweak.

::: gio/gunixmounts.c
@@ +289,3 @@
+ * used in implementation of the OS. This is primarily used for hiding
+ * mountable and mounted volumes that only are used in the OS and has little to
+ * no relevance to the casual user.

Maybe:

"mounted volumes that are intended as APIs for programs to read,
 and system administrators at a shell, rather than something that
 should e.g. appear in a GUI.  For example, the Linux `/proc` filesystem."

?
Comment 7 Colin Walters 2017-10-25 16:59:22 UTC
Review of attachment 362273 [details] [review]:

OK.
Comment 8 Philip Withnall 2017-10-25 23:20:05 UTC
Thanks for the review! Pushed with a slightly tweaked version of your suggested documentation.

Attachment 362270 [details] pushed as 1e4221a - gio: Add API for identifying system FS types and device paths
Attachment 362273 [details] pushed as 767296d - gio: Add autoptr declarations for GUnixMountEntry and GUnixMountPoint