1
0
mirror of https://gitlab.gnome.org/GNOME/glib.git synced 2025-07-17 23:47:52 +02:00

Merge branch '2726-fuse-remote' into 'main'

glocalfile: Support marking fuse.sshfs filesystems as remote

Closes 

See merge request 
This commit is contained in:
Philip Withnall
2022-10-17 16:17:30 +00:00

@@ -787,6 +787,7 @@ get_mount_info (GFileInfo *fs_info,
dev_t *dev; dev_t *dev;
GUnixMountEntry *mount; GUnixMountEntry *mount;
guint64 cache_time; guint64 cache_time;
gboolean is_remote = FALSE;
if (g_lstat (path, &buf) != 0) if (g_lstat (path, &buf) != 0)
return; return;
@@ -823,6 +824,8 @@ get_mount_info (GFileInfo *fs_info,
{ {
if (g_unix_mount_is_readonly (mount)) if (g_unix_mount_is_readonly (mount))
mount_info |= MOUNT_INFO_READONLY; mount_info |= MOUNT_INFO_READONLY;
if (is_remote_fs_type (g_unix_mount_get_fs_type (mount)))
is_remote = TRUE;
g_unix_mount_free (mount); g_unix_mount_free (mount);
} }
@@ -838,8 +841,14 @@ get_mount_info (GFileInfo *fs_info,
G_UNLOCK (mount_info_hash); G_UNLOCK (mount_info_hash);
} }
if (mount_info & MOUNT_INFO_READONLY) if (mount_info & MOUNT_INFO_READONLY &&
g_file_attribute_matcher_matches (matcher,
G_FILE_ATTRIBUTE_FILESYSTEM_READONLY))
g_file_info_set_attribute_boolean (fs_info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY, TRUE); g_file_info_set_attribute_boolean (fs_info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY, TRUE);
if (g_file_attribute_matcher_matches (matcher,
G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE))
g_file_info_set_attribute_boolean (fs_info, G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE, is_remote);
} }
#endif #endif
@@ -1085,7 +1094,9 @@ g_local_file_query_filesystem_info (GFile *file,
#endif /* G_OS_WIN32 */ #endif /* G_OS_WIN32 */
if (g_file_attribute_matcher_matches (attribute_matcher, if (g_file_attribute_matcher_matches (attribute_matcher,
G_FILE_ATTRIBUTE_FILESYSTEM_READONLY)) G_FILE_ATTRIBUTE_FILESYSTEM_READONLY) ||
g_file_attribute_matcher_matches (attribute_matcher,
G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE))
{ {
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
get_filesystem_readonly (info, local->filename); get_filesystem_readonly (info, local->filename);
@@ -1094,13 +1105,6 @@ g_local_file_query_filesystem_info (GFile *file,
#endif /* G_OS_WIN32 */ #endif /* G_OS_WIN32 */
} }
#ifndef G_OS_WIN32
if (g_file_attribute_matcher_matches (attribute_matcher,
G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE))
g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE,
is_remote_fs_type (fstype));
#endif
g_file_attribute_matcher_unref (attribute_matcher); g_file_attribute_matcher_unref (attribute_matcher);
return info; return info;
@@ -2603,6 +2607,8 @@ is_remote_fs_type (const gchar *fsname)
return TRUE; return TRUE;
if (strcmp (fsname, "smb2") == 0) if (strcmp (fsname, "smb2") == 0)
return TRUE; return TRUE;
if (strcmp (fsname, "fuse.sshfs") == 0)
return TRUE;
} }
return FALSE; return FALSE;