GNOME Bugzilla – Bug 788927
Expose better API for detecting ‘system’ mounts
Last modified: 2017-10-25 23:20:14 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.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 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()?
(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.
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>
I decided to make them functions, rather than methods of GUnixMountEntry, to match the existing g_unix_is_mount_path_system_internal().
Created attachment 362272 [details] [review] gio: Add autoptr declarations for GUnixMountEntry and GUnixMountPoint Signed-off-by: Philip Withnall <withnall@endlessm.com>
Created attachment 362273 [details] [review] gio: Add autoptr declarations for GUnixMountEntry and GUnixMountPoint Signed-off-by: Philip Withnall <withnall@endlessm.com>
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." ?
Review of attachment 362273 [details] [review]: OK.
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