Functions

is_mount_path_system_internal (mount_path)

is_system_device_path (device_path)

is_system_fs_type (fs_type)

mount_at (mount_path)

mount_compare (mount1, mount2)

mount_copy (mount_entry)

mount_entries_changed_since (time)

mount_entries_get ()

mount_entries_get_from_file (table_path)

mount_entry_at (mount_path)

mount_entry_for (file_path)

mount_for (file_path)

mount_free (mount_entry)

mount_get_device_path (mount_entry)

mount_get_fs_type (mount_entry)

mount_get_mount_path (mount_entry)

mount_get_options (mount_entry)

mount_get_root_path (mount_entry)

mount_guess_can_eject (mount_entry)

mount_guess_icon (mount_entry)

mount_guess_name (mount_entry)

mount_guess_should_display (mount_entry)

mount_guess_symbolic_icon (mount_entry)

mount_is_readonly (mount_entry)

mount_is_system_internal (mount_entry)

mount_point_at (mount_path)

mount_points_changed_since (time)

mount_points_get ()

mount_points_get_from_file (table_path)

mounts_changed_since (time)

mounts_get ()

mounts_get_from_file (table_path)

Details

GioUnix.is_mount_path_system_internal(mount_path)
Parameters:

mount_path (str) – a mount path, e.g. /media/disk or /usr

Returns:

true if mount_path is considered an implementation detail of the OS; false otherwise

Return type:

bool

Determines if mount_path is considered an 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.

GioUnix.is_system_device_path(device_path)
Parameters:

device_path (str) – a device path, e.g. /dev/loop0 or nfsd

Returns:

true if device_path is considered an implementation detail of the OS; false otherwise

Return type:

bool

Determines if device_path is considered a block device path which is only used in implementation of the OS.

This is primarily used for hiding mounted volumes that are intended as APIs for programs to read, and system administrators at a shell; rather than something that should, for example, appear in a GUI. For example, the Linux /proc filesystem.

The list of device paths considered ‘system’ ones may change over time.

New in version 2.56.

GioUnix.is_system_fs_type(fs_type)
Parameters:

fs_type (str) – a file system type, e.g. procfs or tmpfs

Returns:

true if fs_type is considered an implementation detail of the OS; false otherwise

Return type:

bool

Determines if fs_type is considered a type of file system which is only used in implementation of the OS.

This is primarily used for hiding mounted volumes that are intended as APIs for programs to read, and system administrators at a shell; rather than something that should, for example, appear in a GUI. For example, the Linux /proc filesystem.

The list of file system types considered ‘system’ ones may change over time.

New in version 2.56.

GioUnix.mount_at(mount_path)
Parameters:

mount_path (str) – path for a possible Unix mount

Returns:

a [struct`GioUnix`.MountEntry]

time_read:

return location for a timestamp

Return type:

(GioUnix.MountEntry or None, time_read: int)

Gets a [struct`GioUnix`.MountEntry] for a given mount path.

If time_read is set, it will be filled with a Unix timestamp for checking if the mounts have changed since with [func`GioUnix`.mount_entries_changed_since].

If more mounts have the same mount path, the last matching mount is returned.

This will return NULL if there is no mount point at mount_path.

Deprecated since version 2.84: Use [func`GioUnix`.MountEntry.at] instead.

GioUnix.mount_compare(mount1, mount2)
Parameters:
Returns:

1, 0 or -1 if mount1 is greater than, equal to, or less than mount2, respectively

Return type:

int

Compares two Unix mounts.

Deprecated since version 2.84: Use [method`GioUnix`.MountEntry.compare] instead.

GioUnix.mount_copy(mount_entry)
Parameters:

mount_entry (GioUnix.MountEntry) – a [struct`GioUnix`.MountEntry]

Returns:

a new [struct`GioUnix`.MountEntry]

Return type:

GioUnix.MountEntry

Makes a copy of mount_entry.

New in version 2.54.

Deprecated since version 2.84: Use [method`GioUnix`.MountEntry.copy] instead.

GioUnix.mount_entries_changed_since(time)
Parameters:

time (int) – a timestamp

Returns:

true if the mounts have changed since time; false otherwise

Return type:

bool

Checks if the Unix mounts have changed since a given Unix time.

This can only work reliably if a [class`GioUnix`.MountMonitor] is running in the process, otherwise changes in the mount entries file (such as /proc/self/mountinfo on Linux) cannot be detected and, as a result, this function has to conservatively always return TRUE.

It is more efficient to use [signal`GioUnix`.MountMonitor::mounts-changed] to be signalled of changes to the mount entries, rather than polling using this function. This function is more appropriate for infrequently determining cache validity.

GioUnix.mount_entries_get()
Returns:

a list of the Unix mounts

time_read:

return location for a timestamp

Return type:

([GioUnix.MountEntry], time_read: int)

Gets a list of [struct`GioUnix`.MountEntry] instances representing the Unix mounts.

If time_read is set, it will be filled with the mount timestamp, allowing for checking if the mounts have changed with [func`GioUnix`.mount_entries_changed_since].

New in version 2.84.

GioUnix.mount_entries_get_from_file(table_path)
Parameters:

table_path (str) – path to the mounts table file (for example /proc/self/mountinfo)

Returns:

mount entries, or NULL if there was an error loading them

time_read_out:

return location for the modification time of table_path

Return type:

([GioUnix.MountEntry] or None, time_read_out: int)

Gets an array of [struct`GioUnix`.MountEntry]s containing the Unix mounts listed in table_path.

This is a generalized version of [func`GioUnix`.mount_entries_get], mainly intended for internal testing use. Note that [func`GioUnix`.mount_entries_get] may parse multiple hierarchical table files, so this function is not a direct superset of its functionality.

If there is an error reading or parsing the file, NULL will be returned and both out parameters will be set to 0.

New in version 2.84.

GioUnix.mount_entry_at(mount_path)
Parameters:

mount_path (str) – path for a possible Unix mount

Returns:

a [struct`GioUnix`.MountEntry]

time_read:

return location for a timestamp

Return type:

(GioUnix.MountEntry or None, time_read: int)

Gets a [struct`GioUnix`.MountEntry] for a given mount path.

If time_read is set, it will be filled with a Unix timestamp for checking if the mounts have changed since with [func`GioUnix`.mount_entries_changed_since].

If more mounts have the same mount path, the last matching mount is returned.

This will return NULL if there is no mount point at mount_path.

New in version 2.84.

GioUnix.mount_entry_for(file_path)
Parameters:

file_path (str) – file path on some Unix mount

Returns:

a [struct`GioUnix`.MountEntry]

time_read:

return location for a timestamp

Return type:

(GioUnix.MountEntry or None, time_read: int)

Gets a [struct`GioUnix`.MountEntry] for a given file path.

If time_read is set, it will be filled with a Unix timestamp for checking if the mounts have changed since with [func`GioUnix`.mount_entries_changed_since].

If more mounts have the same mount path, the last matching mount is returned.

This will return NULL if looking up the mount entry fails, if file_path doesn’t exist or there is an I/O error.

New in version 2.84.

GioUnix.mount_for(file_path)
Parameters:

file_path (str) – file path on some Unix mount

Returns:

a [struct`GioUnix`.MountEntry]

time_read:

return location for a timestamp

Return type:

(GioUnix.MountEntry or None, time_read: int)

Gets a [struct`GioUnix`.MountEntry] for a given file path.

If time_read is set, it will be filled with a Unix timestamp for checking if the mounts have changed since with [func`GioUnix`.mount_entries_changed_since].

If more mounts have the same mount path, the last matching mount is returned.

This will return NULL if looking up the mount entry fails, if file_path doesn’t exist or there is an I/O error.

New in version 2.52.

Deprecated since version 2.84: Use [func`GioUnix`.MountEntry.for] instead.

GioUnix.mount_free(mount_entry)
Parameters:

mount_entry (GioUnix.MountEntry) – a [struct`GioUnix`.MountEntry]

Frees a Unix mount.

Deprecated since version 2.84: Use [method`GioUnix`.MountEntry.free] instead.

GioUnix.mount_get_device_path(mount_entry)
Parameters:

mount_entry (GioUnix.MountEntry) – a [struct`GioUnix`.MountEntry]

Returns:

a string containing the device path

Return type:

str

Gets the device path for a Unix mount.

Deprecated since version 2.84: Use [method`GioUnix`.MountEntry.get_device_path] instead.

GioUnix.mount_get_fs_type(mount_entry)
Parameters:

mount_entry (GioUnix.MountEntry) – a [struct`GioUnix`.MountEntry]

Returns:

a string containing the file system type

Return type:

str

Gets the filesystem type for the Unix mount.

Deprecated since version 2.84: Use [method`GioUnix`.MountEntry.get_fs_type] instead.

GioUnix.mount_get_mount_path(mount_entry)
Parameters:

mount_entry (GioUnix.MountEntry) – a [struct`GioUnix`.MountEntry] to get the mount path for

Returns:

the mount path for mount_entry

Return type:

str

Gets the mount path for a Unix mount.

Deprecated since version 2.84: Use [method`GioUnix`.MountEntry.get_mount_path] instead.

GioUnix.mount_get_options(mount_entry)
Parameters:

mount_entry (GioUnix.MountEntry) – a [struct`GioUnix`.MountEntry]

Returns:

a string containing the options, or NULL if not available.

Return type:

str or None

Gets a comma separated list of mount options for the Unix mount.

For example: rw,relatime,seclabel,data=ordered.

This is similar to [method`GioUnix`.MountPoint.get_options], but it takes a [struct`GioUnix`.MountEntry] as an argument.

New in version 2.58.

Deprecated since version 2.84: Use [method`GioUnix`.MountEntry.get_options] instead.

GioUnix.mount_get_root_path(mount_entry)
Parameters:

mount_entry (GioUnix.MountEntry) – a [struct`GioUnix`.MountEntry]

Returns:

a string containing the root, or NULL if not supported

Return type:

str or None

Gets the root of the mount within the filesystem.

This is useful e.g. for mounts created by bind operation, or btrfs subvolumes.

For example, the root path is equal to / for a mount created by mount /dev/sda1 /mnt/foo and /bar for mount --bind /mnt/foo/bar /mnt/bar.

New in version 2.60.

Deprecated since version 2.84: Use [method`GioUnix`.MountEntry.get_root_path] instead.

GioUnix.mount_guess_can_eject(mount_entry)
Parameters:

mount_entry (GioUnix.MountEntry) – a [struct`GioUnix`.MountEntry]

Returns:

true if mount_entry is deemed to be ejectable; false otherwise

Return type:

bool

Guesses whether a Unix mount entry can be ejected.

Deprecated since version 2.84: Use [method`GioUnix`.MountEntry.guess_can_eject] instead.

GioUnix.mount_guess_icon(mount_entry)
Parameters:

mount_entry (GioUnix.MountEntry) – a [struct`GioUnix`.MountEntry]

Returns:

a [iface`Gio`.Icon]

Return type:

Gio.Icon

Guesses the icon of a Unix mount entry.

Deprecated since version 2.84: Use [method`GioUnix`.MountEntry.guess_icon] instead.

GioUnix.mount_guess_name(mount_entry)
Parameters:

mount_entry (GioUnix.MountEntry) – a [struct`GioUnix`.MountEntry]

Returns:

a newly allocated translated string

Return type:

str

Guesses the name of a Unix mount entry.

The result is a translated string.

Deprecated since version 2.84: Use [method`GioUnix`.MountEntry.guess_name] instead.

GioUnix.mount_guess_should_display(mount_entry)
Parameters:

mount_entry (GioUnix.MountEntry) – a [struct`GioUnix`.MountEntry]

Returns:

true if mount_entry is deemed to be displayable; false otherwise

Return type:

bool

Guesses whether a Unix mount entry should be displayed in the UI.

Deprecated since version 2.84: Use [method`GioUnix`.MountEntry.guess_should_display] instead.

GioUnix.mount_guess_symbolic_icon(mount_entry)
Parameters:

mount_entry (GioUnix.MountEntry) – a [struct`GioUnix`.MountEntry]

Returns:

a [iface`Gio`.Icon]

Return type:

Gio.Icon

Guesses the symbolic icon of a Unix mount entry.

New in version 2.34.

Deprecated since version 2.84: Use [method`GioUnix`.MountEntry.guess_symbolic_icon] instead.

GioUnix.mount_is_readonly(mount_entry)
Parameters:

mount_entry (GioUnix.MountEntry) – a [struct`GioUnix`.MountEntry]

Returns:

true if mount_entry is read only; false otherwise

Return type:

bool

Checks if a Unix mount is mounted read only.

Deprecated since version 2.84: Use [method`GioUnix`.MountEntry.is_readonly] instead.

GioUnix.mount_is_system_internal(mount_entry)
Parameters:

mount_entry (GioUnix.MountEntry) – a [struct`GioUnix`.MountEntry]

Returns:

true if the Unix mount is for a system path; false otherwise

Return type:

bool

Checks if a Unix mount is a system mount.

This is the Boolean OR of [func`GioUnix`.is_system_fs_type], [func`GioUnix`.is_system_device_path] and [func`GioUnix`.is_mount_path_system_internal] on mount_entry’s properties.

The definition of what a ‘system’ mount entry is may change over time as new file system types and device paths are ignored.

Deprecated since version 2.84: Use [method`GioUnix`.MountEntry.is_system_internal] instead.

GioUnix.mount_point_at(mount_path)
Parameters:

mount_path (str) – path for a possible Unix mount point

Returns:

a [struct`GioUnix`.MountPoint], or NULL if no match is found

time_read:

return location for a timestamp

Return type:

(GioUnix.MountPoint or None, time_read: int)

Gets a [struct`GioUnix`.MountPoint] for a given mount path.

If time_read is set, it will be filled with a Unix timestamp for checking if the mount points have changed since with [func`GioUnix`.mount_points_changed_since].

If more mount points have the same mount path, the last matching mount point is returned.

New in version 2.66.

GioUnix.mount_points_changed_since(time)
Parameters:

time (int) – a timestamp

Returns:

true if the mount points have changed since time; false otherwise

Return type:

bool

Checks if the Unix mount points have changed since a given Unix time.

Unlike [func`GioUnix`.mount_entries_changed_since], this function can work reliably without a [class`GioUnix`.MountMonitor] running, as it accesses the static mount point information (such as /etc/fstab on Linux), which has a valid modification time.

It is more efficient to use [signal`GioUnix`.MountMonitor::mountpoints-changed] to be signalled of changes to the mount points, rather than polling using this function. This function is more appropriate for infrequently determining cache validity.

GioUnix.mount_points_get()
Returns:

a list of the Unix mount points

time_read:

return location for a timestamp

Return type:

([GioUnix.MountPoint], time_read: int)

Gets a list of [struct`GioUnix`.MountPoint] instances representing the Unix mount points.

If time_read is set, it will be filled with the mount timestamp, allowing for checking if the mounts have changed with [func`GioUnix`.mount_points_changed_since].

GioUnix.mount_points_get_from_file(table_path)
Parameters:

table_path (str) – path to the mount points table file (for example /etc/fstab)

Returns:

mount points, or NULL if there was an error loading them

time_read_out:

return location for the modification time of table_path

Return type:

([GioUnix.MountPoint] or None, time_read_out: int)

Gets an array of [struct`GioUnix`.MountPoint]s containing the Unix mount points listed in table_path.

This is a generalized version of [func`GioUnix`.mount_points_get], mainly intended for internal testing use. Note that [func`GioUnix`.mount_points_get] may parse multiple hierarchical table files, so this function is not a direct superset of its functionality.

If there is an error reading or parsing the file, NULL will be returned and both out parameters will be set to 0.

New in version 2.82.

GioUnix.mounts_changed_since(time)
Parameters:

time (int) – a timestamp

Returns:

true if the mounts have changed since time; false otherwise

Return type:

bool

Checks if the Unix mounts have changed since a given Unix time.

Deprecated since version 2.84: Use [func`GioUnix`.mount_entries_changed_since] instead.

GioUnix.mounts_get()
Returns:

a list of the Unix mounts

time_read:

return location for a timestamp

Return type:

([GioUnix.MountEntry], time_read: int)

Gets a list of [struct`GioUnix`.MountEntry] instances representing the Unix mounts.

If time_read is set, it will be filled with the mount timestamp, allowing for checking if the mounts have changed with [func`GioUnix`.mount_entries_changed_since].

Deprecated since version 2.84: Use [func`GioUnix`.mount_entries_get] instead.

GioUnix.mounts_get_from_file(table_path)
Parameters:

table_path (str) – path to the mounts table file (for example /proc/self/mountinfo)

Returns:

mount entries, or NULL if there was an error loading them

time_read_out:

return location for the modification time of table_path

Return type:

([GioUnix.MountEntry] or None, time_read_out: int)

Gets an array of [struct`GioUnix`.MountEntry]s containing the Unix mounts listed in table_path.

This is a generalized version of [func`GioUnix`.mount_entries_get], mainly intended for internal testing use. Note that [func`GioUnix`.mount_entries_get] may parse multiple hierarchical table files, so this function is not a direct superset of its functionality.

If there is an error reading or parsing the file, NULL will be returned and both out parameters will be set to 0.

New in version 2.82.

Deprecated since version 2.84: Use [func`GioUnix`.mount_entries_get_from_file] instead.