gunixmounts.h 7.18 KB
Newer Older
1
/* GIO - GLib Input, Output and Streaming Library
2
 *
3 4 5 6 7
 * Copyright (C) 2006-2007 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
8
 * version 2.1 of the License, or (at your option) any later version.
9 10 11 12 13 14 15
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General
16
 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 18 19 20 21 22 23
 *
 * Author: Alexander Larsson <alexl@redhat.com>
 */

#ifndef __G_UNIX_MOUNTS_H__
#define __G_UNIX_MOUNTS_H__

24
#include <gio/gio.h>
25 26 27

G_BEGIN_DECLS

28
/**
29
 * GUnixMountEntry:
30 31
 *
 * Defines a Unix mount entry (e.g. <filename>/media/cdrom</filename>).
32
 * This corresponds roughly to a mtab entry.
33
 **/
34
typedef struct _GUnixMountEntry GUnixMountEntry;
35

36 37 38 39
#define G_TYPE_UNIX_MOUNT_ENTRY (g_unix_mount_entry_get_type ())
GLIB_AVAILABLE_IN_2_54
GType g_unix_mount_entry_get_type (void) G_GNUC_CONST;

40 41
/**
 * GUnixMountPoint:
42
 *
43 44
 * Defines a Unix mount point (e.g. <filename>/dev</filename>).
 * This corresponds roughly to a fstab entry.
45
 **/
46 47
typedef struct _GUnixMountPoint GUnixMountPoint;

48 49 50 51
#define G_TYPE_UNIX_MOUNT_POINT (g_unix_mount_point_get_type ())
GLIB_AVAILABLE_IN_2_54
GType g_unix_mount_point_get_type (void) G_GNUC_CONST;

52 53
/**
 * GUnixMountMonitor:
54
 *
55
 * Watches #GUnixMounts for changes.
56
 **/
57
typedef struct _GUnixMountMonitor      GUnixMountMonitor;
58 59 60 61 62 63 64
typedef struct _GUnixMountMonitorClass GUnixMountMonitorClass;

#define G_TYPE_UNIX_MOUNT_MONITOR        (g_unix_mount_monitor_get_type ())
#define G_UNIX_MOUNT_MONITOR(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_UNIX_MOUNT_MONITOR, GUnixMountMonitor))
#define G_UNIX_MOUNT_MONITOR_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_UNIX_MOUNT_MONITOR, GUnixMountMonitorClass))
#define G_IS_UNIX_MOUNT_MONITOR(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_UNIX_MOUNT_MONITOR))
#define G_IS_UNIX_MOUNT_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_UNIX_MOUNT_MONITOR))
65
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUnixMountMonitor, g_object_unref)
66

67
GLIB_AVAILABLE_IN_ALL
68
void           g_unix_mount_free                    (GUnixMountEntry    *mount_entry);
69 70
GLIB_AVAILABLE_IN_2_54
GUnixMountEntry *g_unix_mount_copy                  (GUnixMountEntry    *mount_entry);
71
GLIB_AVAILABLE_IN_ALL
72
void           g_unix_mount_point_free              (GUnixMountPoint    *mount_point);
73 74
GLIB_AVAILABLE_IN_2_54
GUnixMountPoint *g_unix_mount_point_copy            (GUnixMountPoint    *mount_point);
75
GLIB_AVAILABLE_IN_ALL
76 77
gint           g_unix_mount_compare                 (GUnixMountEntry    *mount1,
						     GUnixMountEntry    *mount2);
78
GLIB_AVAILABLE_IN_ALL
79
const char *   g_unix_mount_get_mount_path          (GUnixMountEntry    *mount_entry);
80
GLIB_AVAILABLE_IN_ALL
81
const char *   g_unix_mount_get_device_path         (GUnixMountEntry    *mount_entry);
82 83
GLIB_AVAILABLE_IN_2_60
const char *   g_unix_mount_get_root_path           (GUnixMountEntry    *mount_entry);
84
GLIB_AVAILABLE_IN_ALL
85
const char *   g_unix_mount_get_fs_type             (GUnixMountEntry    *mount_entry);
86 87
GLIB_AVAILABLE_IN_2_58
const char *   g_unix_mount_get_options             (GUnixMountEntry    *mount_entry);
88
GLIB_AVAILABLE_IN_ALL
89
gboolean       g_unix_mount_is_readonly             (GUnixMountEntry    *mount_entry);
90
GLIB_AVAILABLE_IN_ALL
91
gboolean       g_unix_mount_is_system_internal      (GUnixMountEntry    *mount_entry);
92
GLIB_AVAILABLE_IN_ALL
93
gboolean       g_unix_mount_guess_can_eject         (GUnixMountEntry    *mount_entry);
94
GLIB_AVAILABLE_IN_ALL
95
gboolean       g_unix_mount_guess_should_display    (GUnixMountEntry    *mount_entry);
96
GLIB_AVAILABLE_IN_ALL
97
char *         g_unix_mount_guess_name              (GUnixMountEntry    *mount_entry);
98
GLIB_AVAILABLE_IN_ALL
99
GIcon *        g_unix_mount_guess_icon              (GUnixMountEntry    *mount_entry);
100
GLIB_AVAILABLE_IN_ALL
101 102
GIcon *        g_unix_mount_guess_symbolic_icon     (GUnixMountEntry    *mount_entry);

103 104
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUnixMountEntry, g_unix_mount_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUnixMountPoint, g_unix_mount_point_free)
105

106
GLIB_AVAILABLE_IN_ALL
107 108
gint           g_unix_mount_point_compare           (GUnixMountPoint    *mount1,
						     GUnixMountPoint    *mount2);
109
GLIB_AVAILABLE_IN_ALL
110
const char *   g_unix_mount_point_get_mount_path    (GUnixMountPoint    *mount_point);
111
GLIB_AVAILABLE_IN_ALL
112
const char *   g_unix_mount_point_get_device_path   (GUnixMountPoint    *mount_point);
113
GLIB_AVAILABLE_IN_ALL
114
const char *   g_unix_mount_point_get_fs_type       (GUnixMountPoint    *mount_point);
115
GLIB_AVAILABLE_IN_2_32
116
const char *   g_unix_mount_point_get_options       (GUnixMountPoint    *mount_point);
117
GLIB_AVAILABLE_IN_ALL
118
gboolean       g_unix_mount_point_is_readonly       (GUnixMountPoint    *mount_point);
119
GLIB_AVAILABLE_IN_ALL
120
gboolean       g_unix_mount_point_is_user_mountable (GUnixMountPoint    *mount_point);
121
GLIB_AVAILABLE_IN_ALL
122
gboolean       g_unix_mount_point_is_loopback       (GUnixMountPoint    *mount_point);
123
GLIB_AVAILABLE_IN_ALL
124
gboolean       g_unix_mount_point_guess_can_eject   (GUnixMountPoint    *mount_point);
125
GLIB_AVAILABLE_IN_ALL
126
char *         g_unix_mount_point_guess_name        (GUnixMountPoint    *mount_point);
127
GLIB_AVAILABLE_IN_ALL
128
GIcon *        g_unix_mount_point_guess_icon        (GUnixMountPoint    *mount_point);
129
GLIB_AVAILABLE_IN_ALL
130 131
GIcon *        g_unix_mount_point_guess_symbolic_icon (GUnixMountPoint    *mount_point);

132

133
GLIB_AVAILABLE_IN_ALL
134
GList *        g_unix_mount_points_get              (guint64            *time_read);
135
GLIB_AVAILABLE_IN_ALL
136
GList *        g_unix_mounts_get                    (guint64            *time_read);
137
GLIB_AVAILABLE_IN_ALL
138
GUnixMountEntry *g_unix_mount_at                    (const char         *mount_path,
139
						     guint64            *time_read);
140 141 142
GLIB_AVAILABLE_IN_2_52
GUnixMountEntry *g_unix_mount_for                   (const char         *file_path,
                                                     guint64            *time_read);
143
GLIB_AVAILABLE_IN_ALL
144
gboolean       g_unix_mounts_changed_since          (guint64             time);
145
GLIB_AVAILABLE_IN_ALL
146 147
gboolean       g_unix_mount_points_changed_since    (guint64             time);

148
GLIB_AVAILABLE_IN_ALL
149
GType              g_unix_mount_monitor_get_type       (void) G_GNUC_CONST;
150 151 152
GLIB_AVAILABLE_IN_2_44
GUnixMountMonitor *g_unix_mount_monitor_get            (void);
GLIB_DEPRECATED_IN_2_44_FOR(g_unix_mount_monitor_get)
153
GUnixMountMonitor *g_unix_mount_monitor_new            (void);
154
GLIB_DEPRECATED_IN_2_44
155 156
void               g_unix_mount_monitor_set_rate_limit (GUnixMountMonitor *mount_monitor,
                                                        int                limit_msec);
157

158
GLIB_AVAILABLE_IN_ALL
159
gboolean g_unix_is_mount_path_system_internal (const char *mount_path);
160 161 162 163
GLIB_AVAILABLE_IN_2_56
gboolean g_unix_is_system_fs_type             (const char *fs_type);
GLIB_AVAILABLE_IN_2_56
gboolean g_unix_is_system_device_path         (const char *device_path);
164

165 166 167
G_END_DECLS

#endif /* __G_UNIX_MOUNTS_H__ */