gkdbus: Fix underflow and unreachable code bug
[platform/upstream/glib.git] / gio / gunixmounts.h
1 /* GIO - GLib Input, Output and Streaming Library
2  *
3  * Copyright (C) 2006-2007 Red Hat, Inc.
4  *
5  * SPDX-License-Identifier: LGPL-2.1-or-later
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General
18  * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
19  *
20  * Author: Alexander Larsson <alexl@redhat.com>
21  */
22
23 #ifndef __G_UNIX_MOUNTS_H__
24 #define __G_UNIX_MOUNTS_H__
25
26 #include <gio/gio.h>
27
28 G_BEGIN_DECLS
29
30 /**
31  * GUnixMountEntry:
32  *
33  * Defines a Unix mount entry (e.g. <filename>/media/cdrom</filename>).
34  * This corresponds roughly to a mtab entry.
35  **/
36 typedef struct _GUnixMountEntry GUnixMountEntry;
37
38 #define G_TYPE_UNIX_MOUNT_ENTRY (g_unix_mount_entry_get_type ())
39 GIO_AVAILABLE_IN_2_54
40 GType g_unix_mount_entry_get_type (void) G_GNUC_CONST;
41
42 /**
43  * GUnixMountPoint:
44  *
45  * Defines a Unix mount point (e.g. <filename>/dev</filename>).
46  * This corresponds roughly to a fstab entry.
47  **/
48 typedef struct _GUnixMountPoint GUnixMountPoint;
49
50 #define G_TYPE_UNIX_MOUNT_POINT (g_unix_mount_point_get_type ())
51 GIO_AVAILABLE_IN_2_54
52 GType g_unix_mount_point_get_type (void) G_GNUC_CONST;
53
54 /**
55  * GUnixMountMonitor:
56  *
57  * Watches #GUnixMounts for changes.
58  **/
59 typedef struct _GUnixMountMonitor      GUnixMountMonitor;
60 typedef struct _GUnixMountMonitorClass GUnixMountMonitorClass;
61
62 #define G_TYPE_UNIX_MOUNT_MONITOR        (g_unix_mount_monitor_get_type ())
63 #define G_UNIX_MOUNT_MONITOR(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_UNIX_MOUNT_MONITOR, GUnixMountMonitor))
64 #define G_UNIX_MOUNT_MONITOR_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_UNIX_MOUNT_MONITOR, GUnixMountMonitorClass))
65 #define G_IS_UNIX_MOUNT_MONITOR(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_UNIX_MOUNT_MONITOR))
66 #define G_IS_UNIX_MOUNT_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_UNIX_MOUNT_MONITOR))
67 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUnixMountMonitor, g_object_unref)
68
69 GIO_AVAILABLE_IN_ALL
70 void           g_unix_mount_free                    (GUnixMountEntry    *mount_entry);
71 GIO_AVAILABLE_IN_2_54
72 GUnixMountEntry *g_unix_mount_copy                  (GUnixMountEntry    *mount_entry);
73 GIO_AVAILABLE_IN_ALL
74 void           g_unix_mount_point_free              (GUnixMountPoint    *mount_point);
75 GIO_AVAILABLE_IN_2_54
76 GUnixMountPoint *g_unix_mount_point_copy            (GUnixMountPoint    *mount_point);
77 GIO_AVAILABLE_IN_ALL
78 gint           g_unix_mount_compare                 (GUnixMountEntry    *mount1,
79                                                      GUnixMountEntry    *mount2);
80 GIO_AVAILABLE_IN_ALL
81 const char *   g_unix_mount_get_mount_path          (GUnixMountEntry    *mount_entry);
82 GIO_AVAILABLE_IN_ALL
83 const char *   g_unix_mount_get_device_path         (GUnixMountEntry    *mount_entry);
84 GIO_AVAILABLE_IN_2_60
85 const char *   g_unix_mount_get_root_path           (GUnixMountEntry    *mount_entry);
86 GIO_AVAILABLE_IN_ALL
87 const char *   g_unix_mount_get_fs_type             (GUnixMountEntry    *mount_entry);
88 GIO_AVAILABLE_IN_2_58
89 const char *   g_unix_mount_get_options             (GUnixMountEntry    *mount_entry);
90 GIO_AVAILABLE_IN_ALL
91 gboolean       g_unix_mount_is_readonly             (GUnixMountEntry    *mount_entry);
92 GIO_AVAILABLE_IN_ALL
93 gboolean       g_unix_mount_is_system_internal      (GUnixMountEntry    *mount_entry);
94 GIO_AVAILABLE_IN_ALL
95 gboolean       g_unix_mount_guess_can_eject         (GUnixMountEntry    *mount_entry);
96 GIO_AVAILABLE_IN_ALL
97 gboolean       g_unix_mount_guess_should_display    (GUnixMountEntry    *mount_entry);
98 GIO_AVAILABLE_IN_ALL
99 char *         g_unix_mount_guess_name              (GUnixMountEntry    *mount_entry);
100 GIO_AVAILABLE_IN_ALL
101 GIcon *        g_unix_mount_guess_icon              (GUnixMountEntry    *mount_entry);
102 GIO_AVAILABLE_IN_ALL
103 GIcon *        g_unix_mount_guess_symbolic_icon     (GUnixMountEntry    *mount_entry);
104
105 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUnixMountEntry, g_unix_mount_free)
106 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUnixMountPoint, g_unix_mount_point_free)
107
108 GIO_AVAILABLE_IN_ALL
109 gint           g_unix_mount_point_compare           (GUnixMountPoint    *mount1,
110                                                      GUnixMountPoint    *mount2);
111 GIO_AVAILABLE_IN_ALL
112 const char *   g_unix_mount_point_get_mount_path    (GUnixMountPoint    *mount_point);
113 GIO_AVAILABLE_IN_ALL
114 const char *   g_unix_mount_point_get_device_path   (GUnixMountPoint    *mount_point);
115 GIO_AVAILABLE_IN_ALL
116 const char *   g_unix_mount_point_get_fs_type       (GUnixMountPoint    *mount_point);
117 GIO_AVAILABLE_IN_2_32
118 const char *   g_unix_mount_point_get_options       (GUnixMountPoint    *mount_point);
119 GIO_AVAILABLE_IN_ALL
120 gboolean       g_unix_mount_point_is_readonly       (GUnixMountPoint    *mount_point);
121 GIO_AVAILABLE_IN_ALL
122 gboolean       g_unix_mount_point_is_user_mountable (GUnixMountPoint    *mount_point);
123 GIO_AVAILABLE_IN_ALL
124 gboolean       g_unix_mount_point_is_loopback       (GUnixMountPoint    *mount_point);
125 GIO_AVAILABLE_IN_ALL
126 gboolean       g_unix_mount_point_guess_can_eject   (GUnixMountPoint    *mount_point);
127 GIO_AVAILABLE_IN_ALL
128 char *         g_unix_mount_point_guess_name        (GUnixMountPoint    *mount_point);
129 GIO_AVAILABLE_IN_ALL
130 GIcon *        g_unix_mount_point_guess_icon        (GUnixMountPoint    *mount_point);
131 GIO_AVAILABLE_IN_ALL
132 GIcon *        g_unix_mount_point_guess_symbolic_icon (GUnixMountPoint    *mount_point);
133
134
135 GIO_AVAILABLE_IN_ALL
136 GList *        g_unix_mount_points_get              (guint64            *time_read);
137 GIO_AVAILABLE_IN_2_66
138 GUnixMountPoint *g_unix_mount_point_at              (const char         *mount_path,
139                                                      guint64            *time_read);
140 GIO_AVAILABLE_IN_ALL
141 GList *        g_unix_mounts_get                    (guint64            *time_read);
142 GIO_AVAILABLE_IN_ALL
143 GUnixMountEntry *g_unix_mount_at                    (const char         *mount_path,
144                                                      guint64            *time_read);
145 GIO_AVAILABLE_IN_2_52
146 GUnixMountEntry *g_unix_mount_for                   (const char         *file_path,
147                                                      guint64            *time_read);
148 GIO_AVAILABLE_IN_ALL
149 gboolean       g_unix_mounts_changed_since          (guint64             time);
150 GIO_AVAILABLE_IN_ALL
151 gboolean       g_unix_mount_points_changed_since    (guint64             time);
152
153 GIO_AVAILABLE_IN_ALL
154 GType              g_unix_mount_monitor_get_type       (void) G_GNUC_CONST;
155 GIO_AVAILABLE_IN_2_44
156 GUnixMountMonitor *g_unix_mount_monitor_get            (void);
157 GIO_DEPRECATED_IN_2_44_FOR(g_unix_mount_monitor_get)
158 GUnixMountMonitor *g_unix_mount_monitor_new            (void);
159 GIO_DEPRECATED_IN_2_44
160 void               g_unix_mount_monitor_set_rate_limit (GUnixMountMonitor *mount_monitor,
161                                                         int                limit_msec);
162
163 GIO_AVAILABLE_IN_ALL
164 gboolean g_unix_is_mount_path_system_internal (const char *mount_path);
165 GIO_AVAILABLE_IN_2_56
166 gboolean g_unix_is_system_fs_type             (const char *fs_type);
167 GIO_AVAILABLE_IN_2_56
168 gboolean g_unix_is_system_device_path         (const char *device_path);
169
170 G_END_DECLS
171
172 #endif /* __G_UNIX_MOUNTS_H__ */