1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
2  *
3  * Copyright (C) 2008-2010 David Zeuthen <zeuthen@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program 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
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  *
19  */
20 
21 #ifndef __UDISKS_STATE_H__
22 #define __UDISKS_STATE_H__
23 
24 #include "udisksdaemontypes.h"
25 
26 G_BEGIN_DECLS
27 
28 #define UDISKS_TYPE_STATE         (udisks_state_get_type ())
29 #define UDISKS_STATE(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), UDISKS_TYPE_STATE, UDisksState))
30 #define UDISKS_IS_STATE(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), UDISKS_TYPE_STATE))
31 
32 GType          udisks_state_get_type             (void) G_GNUC_CONST;
33 UDisksState   *udisks_state_new                  (UDisksDaemon  *daemon);
34 UDisksDaemon  *udisks_state_get_daemon           (UDisksState   *state);
35 void           udisks_state_start_cleanup        (UDisksState   *state);
36 void           udisks_state_stop_cleanup         (UDisksState   *state);
37 void           udisks_state_check                (UDisksState   *state);
38 void           udisks_state_check_sync           (UDisksState   *state);
39 void           udisks_state_check_block          (UDisksState   *state,
40                                                   dev_t          block_device);
41 /* mounted-fs */
42 void           udisks_state_add_mounted_fs       (UDisksState   *state,
43                                                   const gchar   *mount_point,
44                                                   dev_t          block_device,
45                                                   uid_t          uid,
46                                                   gboolean       fstab_mount,
47                                                   gboolean       persistent);
48 gchar         *udisks_state_find_mounted_fs      (UDisksState   *state,
49                                                   dev_t          block_device,
50                                                   uid_t         *out_uid,
51                                                   gboolean      *out_fstab_mount);
52 /* unlocked-crypto-dev */
53 void           udisks_state_add_unlocked_crypto_dev    (UDisksState   *state,
54                                                         dev_t          cleartext_device,
55                                                         dev_t          crypto_device,
56                                                         const gchar   *dm_uuid,
57                                                         uid_t          uid);
58 dev_t            udisks_state_find_unlocked_crypto_dev (UDisksState   *state,
59                                                         dev_t          crypto_device,
60                                                         uid_t         *out_uid);
61 /* loop */
62 void             udisks_state_add_loop           (UDisksState   *state,
63                                                   const gchar   *device_file,
64                                                   const gchar   *backing_file,
65                                                   dev_t          backing_file_device,
66                                                   uid_t          uid);
67 gboolean         udisks_state_has_loop           (UDisksState   *state,
68                                                   const gchar   *device_file,
69                                                   uid_t         *out_uid);
70 /* mdraid */
71 void             udisks_state_add_mdraid         (UDisksState   *state,
72                                                   dev_t          raid_device,
73                                                   uid_t          uid);
74 gboolean         udisks_state_has_mdraid         (UDisksState   *state,
75                                                   dev_t          raid_device,
76                                                   uid_t         *out_uid);
77 
78 /* modules */
79 void             udisks_state_add_module         (UDisksState   *state,
80                                                   const gchar   *module_name);
81 void             udisks_state_clear_modules      (UDisksState   *state);
82 gchar          **udisks_state_get_modules        (UDisksState   *state);
83 
84 G_END_DECLS
85 
86 #endif /* __UDISKS_STATE_H__ */
87