summaryrefslogtreecommitdiffstats
path: root/src/gdu/gdu-pool.h
blob: 6a5909af8f99a0027fa0a84efa926558b08ccb5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/* gdu-pool.h
 *
 * Copyright (C) 2007 David Zeuthen
 *
 * 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 version 2 of
 * the License, or (at your option) any later version.
 *
 * 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 Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 */

#if !defined (__GDU_INSIDE_GDU_H) && !defined (GDU_COMPILATION)
#error "Only <gdu/gdu.h> can be included directly, this file may disappear or change contents."
#endif

#ifndef __GDU_POOL_H
#define __GDU_POOL_H

#include <gdu/gdu-types.h>
#include <gdu/gdu-callbacks.h>

G_BEGIN_DECLS

#define GDU_TYPE_POOL         (gdu_pool_get_type ())
#define GDU_POOL(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GDU_TYPE_POOL, GduPool))
#define GDU_POOL_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), GDU_POOL,  GduPoolClass))
#define GDU_IS_POOL(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDU_TYPE_POOL))
#define GDU_IS_POOL_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GDU_TYPE_POOL))
#define GDU_POOL_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((k), GDU_TYPE_POOL, GduPoolClass))

typedef struct _GduPoolClass       GduPoolClass;
typedef struct _GduPoolPrivate     GduPoolPrivate;

struct _GduPool
{
        GObject parent;

        /* private */
        GduPoolPrivate *priv;
};

struct _GduPoolClass
{
        GObjectClass parent_class;

        /* signals */
        void (*device_added) (GduPool *pool, GduDevice *device);
        void (*device_removed) (GduPool *pool, GduDevice *device);
        void (*device_changed) (GduPool *pool, GduDevice *device);
        void (*device_job_changed) (GduPool *pool, GduDevice *device);
        void (*presentable_added) (GduPool *pool, GduPresentable *presentable);
        void (*presentable_removed) (GduPool *pool, GduPresentable *presentable);
        void (*presentable_changed) (GduPool *pool, GduPresentable *presentable);
        void (*presentable_job_changed) (GduPool *pool, GduPresentable *presentable);
};

GType       gdu_pool_get_type           (void);
GduPool    *gdu_pool_new                (void);

char       *gdu_pool_get_daemon_version (GduPool *pool);
gboolean    gdu_pool_is_daemon_inhibited (GduPool *pool);
gboolean    gdu_pool_supports_luks_devices (GduPool *pool);
GList      *gdu_pool_get_known_filesystems (GduPool *pool);
GduKnownFilesystem *gdu_pool_get_known_filesystem_by_id (GduPool *pool, const char *id);

GduDevice  *gdu_pool_get_by_object_path (GduPool *pool, const char *object_path);
GduDevice  *gdu_pool_get_by_device_file (GduPool *pool, const char *device_file);
GduPresentable *gdu_pool_get_volume_by_device      (GduPool *pool, GduDevice *device);
GduPresentable *gdu_pool_get_drive_by_device       (GduPool *pool, GduDevice *device);

GduPresentable *gdu_pool_get_presentable_by_id     (GduPool *pool, const gchar *id);

GList      *gdu_pool_get_devices               (GduPool *pool);
GList      *gdu_pool_get_presentables          (GduPool *pool);
GList      *gdu_pool_get_enclosed_presentables (GduPool *pool, GduPresentable *presentable);

/* ---------------------------------------------------------------------------------------------------- */

void gdu_pool_op_linux_md_start (GduPool *pool,
                                 GPtrArray *component_objpaths,
                                 GduPoolLinuxMdStartCompletedFunc callback,
                                 gpointer user_data);

G_END_DECLS

#endif /* __GDU_POOL_H */