• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GIO - GLib Input, Output and Streaming Library
2  *
3  * Copyright (C) 2006-2007 Red Hat, Inc.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General
16  * Public License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  * Boston, MA 02111-1307, USA.
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 /**
39  * GUnixMountPoint:
40  *
41  * Defines a Unix mount point (e.g. <filename>/dev</filename>).
42  * This corresponds roughly to a fstab entry.
43  **/
44 typedef struct _GUnixMountPoint GUnixMountPoint;
45 
46 /**
47  * GUnixMountMonitor:
48  *
49  * Watches #GUnixMount<!-- -->s for changes.
50  **/
51 typedef struct _GUnixMountMonitor      GUnixMountMonitor;
52 typedef struct _GUnixMountMonitorClass GUnixMountMonitorClass;
53 
54 #define G_TYPE_UNIX_MOUNT_MONITOR        (g_unix_mount_monitor_get_type ())
55 #define G_UNIX_MOUNT_MONITOR(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_UNIX_MOUNT_MONITOR, GUnixMountMonitor))
56 #define G_UNIX_MOUNT_MONITOR_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_UNIX_MOUNT_MONITOR, GUnixMountMonitorClass))
57 #define G_IS_UNIX_MOUNT_MONITOR(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_UNIX_MOUNT_MONITOR))
58 #define G_IS_UNIX_MOUNT_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_UNIX_MOUNT_MONITOR))
59 
60 void           g_unix_mount_free                    (GUnixMountEntry    *mount_entry);
61 void           g_unix_mount_point_free              (GUnixMountPoint    *mount_point);
62 gint           g_unix_mount_compare                 (GUnixMountEntry    *mount1,
63 						     GUnixMountEntry    *mount2);
64 const char *   g_unix_mount_get_mount_path          (GUnixMountEntry    *mount_entry);
65 const char *   g_unix_mount_get_device_path         (GUnixMountEntry    *mount_entry);
66 const char *   g_unix_mount_get_fs_type             (GUnixMountEntry    *mount_entry);
67 gboolean       g_unix_mount_is_readonly             (GUnixMountEntry    *mount_entry);
68 gboolean       g_unix_mount_is_system_internal      (GUnixMountEntry    *mount_entry);
69 gboolean       g_unix_mount_guess_can_eject         (GUnixMountEntry    *mount_entry);
70 gboolean       g_unix_mount_guess_should_display    (GUnixMountEntry    *mount_entry);
71 char *         g_unix_mount_guess_name              (GUnixMountEntry    *mount_entry);
72 GIcon *        g_unix_mount_guess_icon              (GUnixMountEntry    *mount_entry);
73 
74 gint           g_unix_mount_point_compare           (GUnixMountPoint    *mount1,
75 						     GUnixMountPoint    *mount2);
76 const char *   g_unix_mount_point_get_mount_path    (GUnixMountPoint    *mount_point);
77 const char *   g_unix_mount_point_get_device_path   (GUnixMountPoint    *mount_point);
78 const char *   g_unix_mount_point_get_fs_type       (GUnixMountPoint    *mount_point);
79 gboolean       g_unix_mount_point_is_readonly       (GUnixMountPoint    *mount_point);
80 gboolean       g_unix_mount_point_is_user_mountable (GUnixMountPoint    *mount_point);
81 gboolean       g_unix_mount_point_is_loopback       (GUnixMountPoint    *mount_point);
82 gboolean       g_unix_mount_point_guess_can_eject   (GUnixMountPoint    *mount_point);
83 char *         g_unix_mount_point_guess_name        (GUnixMountPoint    *mount_point);
84 GIcon *        g_unix_mount_point_guess_icon        (GUnixMountPoint    *mount_point);
85 
86 GList *        g_unix_mount_points_get              (guint64            *time_read);
87 GList *        g_unix_mounts_get                    (guint64            *time_read);
88 GUnixMountEntry *g_unix_mount_at                    (const char         *mount_path,
89 						     guint64            *time_read);
90 gboolean       g_unix_mounts_changed_since          (guint64             time);
91 gboolean       g_unix_mount_points_changed_since    (guint64             time);
92 
93 GType              g_unix_mount_monitor_get_type       (void) G_GNUC_CONST;
94 GUnixMountMonitor *g_unix_mount_monitor_new            (void);
95 void               g_unix_mount_monitor_set_rate_limit (GUnixMountMonitor *mount_monitor,
96                                                         int                limit_msec);
97 
98 gboolean g_unix_is_mount_path_system_internal (const char *mount_path);
99 
100 G_END_DECLS
101 
102 #endif /* __G_UNIX_MOUNTS_H__ */
103