[glib/wip/oholy/gio-info-mount: 1/2] gio-tool-info: Print unix mount information where available
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/oholy/gio-info-mount: 1/2] gio-tool-info: Print unix mount information where available
- Date: Mon, 3 Feb 2020 10:58:30 +0000 (UTC)
commit b7083a35d28715da55ce27a5eae2838c4a3a3abd
Author: Simon McVittie <smcv collabora com>
Date: Tue Jan 8 13:43:18 2019 +0000
gio-tool-info: Print unix mount information where available
"gio info" output doesn't contain any information about mount points, but
that information can be useful when debugging issues in facilities that
depend on knowing about mount points, such as the trash API.
Signed-off-by: Simon McVittie <smcv collabora com>
Co-authored-by: Ondrej Holy <oholy redhat com>
gio/gio-tool-info.c | 37 ++++++++++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
---
diff --git a/gio/gio-tool-info.c b/gio/gio-tool-info.c
index d6fc6b46c..7fb8ece03 100644
--- a/gio/gio-tool-info.c
+++ b/gio/gio-tool-info.c
@@ -22,8 +22,11 @@
#include <gio/gio.h>
#include <gi18n.h>
-#include "gio-tool.h"
+#ifdef G_OS_UNIX
+#include <gio/gunixmounts.h>
+#endif
+#include "gio-tool.h"
static gboolean writable = FALSE;
static gboolean filesystem = FALSE;
@@ -120,6 +123,10 @@ show_info (GFile *file, GFileInfo *info)
const char *name, *type;
char *escaped, *uri;
goffset size;
+ const char *path;
+#ifdef G_OS_UNIX
+ GUnixMountEntry *entry;
+#endif
name = g_file_info_get_display_name (info);
if (name)
@@ -159,6 +166,34 @@ show_info (GFile *file, GFileInfo *info)
g_print (_("uri: %s\n"), uri);
g_free (uri);
+ path = g_file_peek_path (file);
+ if (path)
+ {
+ g_print (_("local path: %s\n"), path);
+
+#ifdef G_OS_UNIX
+ entry = g_unix_mount_at (path, NULL);
+ if (entry == NULL)
+ entry = g_unix_mount_for (path, NULL);
+ if (entry != NULL)
+ {
+ g_autofree gchar *device = NULL;
+ g_autofree gchar *mount = NULL;
+ g_autofree gchar *fs = NULL;
+ g_autofree gchar *options = NULL;
+
+ device = g_strescape (g_unix_mount_get_device_path (entry), NULL);
+ mount = g_strescape (g_unix_mount_get_mount_path (entry), NULL);
+ fs = g_strescape (g_unix_mount_get_fs_type (entry), NULL);
+ options = g_strescape (g_unix_mount_get_options (entry), NULL);
+
+ g_print (_("unix mount: %s %s %s %s\n"), device, mount, fs, options);
+
+ g_unix_mount_free (entry);
+ }
+#endif
+ }
+
show_attributes (info);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]