summaryrefslogtreecommitdiff
path: root/src/udisksdaemon.h
blob: 8cda8f08fe6bdce769b416d6ab1a002ef0f6e65a (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
97
98
99
100
101
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
 *
 * Copyright (C) 2007-2010 David Zeuthen <zeuthen@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

#ifndef __UDISKS_DAEMON_H__
#define __UDISKS_DAEMON_H__

#include "udisksdaemontypes.h"

G_BEGIN_DECLS

#define UDISKS_TYPE_DAEMON         (udisks_daemon_get_type ())
#define UDISKS_DAEMON(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), UDISKS_TYPE_DAEMON, UDisksDaemon))
#define UDISKS_IS_DAEMON(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), UDISKS_TYPE_DAEMON))

GType                     udisks_daemon_get_type             (void) G_GNUC_CONST;
UDisksDaemon             *udisks_daemon_new                   (GDBusConnection *connection);
GDBusConnection          *udisks_daemon_get_connection        (UDisksDaemon    *daemon);
GDBusObjectManagerServer *udisks_daemon_get_object_manager    (UDisksDaemon    *daemon);
UDisksMountMonitor       *udisks_daemon_get_mount_monitor     (UDisksDaemon    *daemon);
UDisksFstabMonitor       *udisks_daemon_get_fstab_monitor     (UDisksDaemon    *daemon);
UDisksCrypttabMonitor    *udisks_daemon_get_crypttab_monitor  (UDisksDaemon    *daemon);
UDisksLinuxProvider      *udisks_daemon_get_linux_provider    (UDisksDaemon    *daemon);
UDisksPersistentStore    *udisks_daemon_get_persistent_store  (UDisksDaemon    *daemon);
PolkitAuthority          *udisks_daemon_get_authority         (UDisksDaemon    *daemon);
UDisksCleanup            *udisks_daemon_get_cleanup           (UDisksDaemon    *daemon);

/**
 * UDisksDaemonWaitFunc:
 * @daemon: A #UDisksDaemon.
 * @object: A #UDisksObject to check.
 * @user_data: The #gpointer passed to udisks_daemon_wait_for_object_sync().
 *
 * Type for callback function used with udisks_daemon_wait_for_object_sync().
 *
 * Returns: %TRUE if the object is the one to wait for.
 */
typedef gboolean (*UDisksDaemonWaitFunc) (UDisksDaemon *daemon,
                                          UDisksObject *object,
                                          gpointer      user_data);

UDisksObject             *udisks_daemon_wait_for_object_sync  (UDisksDaemon         *daemon,
                                                               UDisksDaemonWaitFunc  wait_func,
                                                               gpointer              user_data,
                                                               GDestroyNotify        user_data_free_func,
                                                               guint                 timeout_seconds,
                                                               GError              **error);

UDisksObject             *udisks_daemon_find_block            (UDisksDaemon         *daemon,
                                                               dev_t                 block_device_number);

UDisksObject             *udisks_daemon_find_object           (UDisksDaemon         *daemon,
                                                               const gchar          *object_path);

UDisksBaseJob            *udisks_daemon_launch_simple_job     (UDisksDaemon    *daemon,
                                                               UDisksObject    *object,
                                                               GCancellable    *cancellable);
UDisksBaseJob            *udisks_daemon_launch_spawned_job    (UDisksDaemon    *daemon,
                                                               UDisksObject    *object,
                                                               GCancellable    *cancellable,
                                                               uid_t            run_as_uid,
                                                               uid_t            run_as_euid,
                                                               const gchar     *input_string,
                                                               const gchar     *command_line_format,
                                                               ...) G_GNUC_PRINTF (7, 8);
gboolean                  udisks_daemon_launch_spawned_job_sync (UDisksDaemon    *daemon,
                                                                 UDisksObject    *object,
                                                                 GCancellable    *cancellable,
                                                                 uid_t            run_as_uid,
                                                                 uid_t            run_as_euid,
                                                                 gint            *out_status,
                                                                 gchar          **out_message,
                                                                 const gchar     *input_string,
                                                                 const gchar     *command_line_format,
                                                                 ...) G_GNUC_PRINTF (9, 10);
UDisksBaseJob            *udisks_daemon_launch_threaded_job   (UDisksDaemon    *daemon,
                                                               UDisksObject    *object,
                                                               UDisksThreadedJobFunc job_func,
                                                               gpointer         user_data,
                                                               GDestroyNotify   user_data_free_func,
                                                               GCancellable    *cancellable);

G_END_DECLS

#endif /* __UDISKS_DAEMON_H__ */