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., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 * 20 * Author: Alexander Larsson <alexl@redhat.com> 21 */ 22 23 #ifndef __G_MOUNT_SPEC_H__ 24 #define __G_MOUNT_SPEC_H__ 25 26 #include <glib.h> 27 #include <gio/gio.h> 28 29 G_BEGIN_DECLS 30 31 typedef struct { 32 char *key; 33 char *value; 34 } GMountSpecItem; 35 36 typedef struct { 37 volatile int ref_count; 38 GArray *items; 39 char *mount_prefix; 40 gboolean is_unique; 41 } GMountSpec; 42 43 GMountSpec *g_mount_spec_new (const char *type); 44 GMountSpec *g_mount_spec_new_from_data (GArray *items, 45 char *mount_prefix); 46 GMountSpec *g_mount_spec_ref (GMountSpec *spec); 47 void g_mount_spec_unref (GMountSpec *spec); 48 GMountSpec *g_mount_spec_get_unique_for (GMountSpec *spec); 49 GMountSpec *g_mount_spec_copy (GMountSpec *spec); 50 GMountSpec *g_mount_spec_from_dbus (GVariant *value); 51 GVariant *g_mount_spec_to_dbus (GMountSpec *spec); 52 GVariant *g_mount_spec_to_dbus_with_path (GMountSpec *spec, 53 const char *path); 54 void g_mount_spec_set_mount_prefix (GMountSpec *spec, 55 const char *mount_prefix); 56 void g_mount_spec_set (GMountSpec *spec, 57 const char *key, 58 const char *value); 59 void g_mount_spec_take (GMountSpec *spec, 60 const char *key, 61 char *value); 62 void g_mount_spec_set_with_len (GMountSpec *spec, 63 const char *key, 64 const char *value, 65 int value_len); 66 guint g_mount_spec_hash (gconstpointer mount); 67 gboolean g_mount_spec_equal (GMountSpec *mount1, 68 GMountSpec *mount2); 69 gboolean g_mount_spec_match (GMountSpec *mount, 70 GMountSpec *path); 71 gboolean g_mount_spec_match_with_path (GMountSpec *mount, 72 GMountSpec *spec, 73 const char *path); 74 const char *g_mount_spec_get (GMountSpec *spec, 75 const char *key); 76 const char *g_mount_spec_get_type (GMountSpec *spec); 77 78 char * g_mount_spec_to_string (GMountSpec *spec); 79 80 GMountSpec *g_mount_spec_new_from_string (const gchar *str, 81 GError **error); 82 83 char * g_mount_spec_canonicalize_path (const char *path); 84 85 86 #define G_TYPE_MOUNT_SPEC (g_type_mount_spec_get_gtype ()) 87 GType g_type_mount_spec_get_gtype (void) G_GNUC_CONST; 88 89 G_END_DECLS 90 91 92 #endif /* __G_MOUNT_SPEC_H__ */ 93