1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- * 2 * Copyright (C) 2007-2010 David Zeuthen <zeuthen@gmail.com> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 * 18 */ 19 20 #ifndef __UDISKS_DAEMON_TYPES_H__ 21 #define __UDISKS_DAEMON_TYPES_H__ 22 23 #include "config.h" 24 25 #include <gio/gio.h> 26 #include <polkit/polkit.h> 27 #include <udisks/udisks.h> 28 #include <gudev/gudev.h> 29 30 #include <sys/types.h> 31 32 struct _UDisksDaemon; 33 typedef struct _UDisksDaemon UDisksDaemon; 34 35 struct _UDisksLinuxProvider; 36 typedef struct _UDisksLinuxProvider UDisksLinuxProvider; 37 38 struct _UDisksLinuxBlockObject; 39 typedef struct _UDisksLinuxBlockObject UDisksLinuxBlockObject; 40 41 struct _UDisksLinuxBlock; 42 typedef struct _UDisksLinuxBlock UDisksLinuxBlock; 43 44 struct _UDisksLinuxDriveObject; 45 typedef struct _UDisksLinuxDriveObject UDisksLinuxDriveObject; 46 47 struct _UDisksLinuxDrive; 48 typedef struct _UDisksLinuxDrive UDisksLinuxDrive; 49 50 struct _UDisksLinuxDriveAta; 51 typedef struct _UDisksLinuxDriveAta UDisksLinuxDriveAta; 52 53 struct _UDisksLinuxMDRaidObject; 54 typedef struct _UDisksLinuxMDRaidObject UDisksLinuxMDRaidObject; 55 56 struct _UDisksLinuxMDRaid; 57 typedef struct _UDisksLinuxMDRaid UDisksLinuxMDRaid; 58 59 struct _UDisksBaseJob; 60 typedef struct _UDisksBaseJob UDisksBaseJob; 61 62 struct _UDisksSpawnedJob; 63 typedef struct _UDisksSpawnedJob UDisksSpawnedJob; 64 65 struct _UDisksThreadedJob; 66 typedef struct _UDisksThreadedJob UDisksThreadedJob; 67 68 struct _UDisksSimpleJob; 69 typedef struct _UDisksSimpleJob UDisksSimpleJob; 70 71 struct _UDisksMountMonitor; 72 typedef struct _UDisksMountMonitor UDisksMountMonitor; 73 74 struct _UDisksMount; 75 typedef struct _UDisksMount UDisksMount; 76 77 struct _UDisksProvider; 78 typedef struct _UDisksProvider UDisksProvider; 79 80 struct _UDisksLinuxFilesystem; 81 typedef struct _UDisksLinuxFilesystem UDisksLinuxFilesystem; 82 83 struct _UDisksLinuxEncrypted; 84 typedef struct _UDisksLinuxEncrypted UDisksLinuxEncrypted; 85 86 struct _UDisksLinuxLoop; 87 typedef struct _UDisksLinuxLoop UDisksLinuxLoop; 88 89 struct _UDisksLinuxManager; 90 typedef struct _UDisksLinuxManager UDisksLinuxManager; 91 92 struct _UDisksLinuxSwapspace; 93 typedef struct _UDisksLinuxSwapspace UDisksLinuxSwapspace; 94 95 struct _UDisksFstabEntry; 96 typedef struct _UDisksFstabEntry UDisksFstabEntry; 97 98 struct _UDisksCrypttabMonitor; 99 typedef struct _UDisksCrypttabMonitor UDisksCrypttabMonitor; 100 101 struct _UDisksCrypttabEntry; 102 typedef struct _UDisksCrypttabEntry UDisksCrypttabEntry; 103 104 #ifdef HAVE_LIBMOUNT_UTAB 105 struct _UDisksUtabMonitor; 106 typedef struct _UDisksUtabMonitor UDisksUtabMonitor; 107 108 struct _UDisksUtabEntry; 109 typedef struct _UDisksUtabEntry UDisksUtabEntry; 110 #endif 111 112 struct _UDisksLinuxPartition; 113 typedef struct _UDisksLinuxPartition UDisksLinuxPartition; 114 115 struct _UDisksLinuxPartitionTable; 116 typedef struct _UDisksLinuxPartitionTable UDisksLinuxPartitionTable; 117 118 struct UDisksInhibitCookie; 119 typedef struct UDisksInhibitCookie UDisksInhibitCookie; 120 121 struct _UDisksModuleManager; 122 typedef struct _UDisksModuleManager UDisksModuleManager; 123 124 typedef struct _UDisksConfigManager UDisksConfigManager; 125 typedef struct _UDisksConfigManagerClass UDisksConfigManagerClass; 126 127 /** 128 * UDisksThreadedJobFunc: 129 * @job: A #UDisksThreadedJob. 130 * @cancellable: A #GCancellable (never %NULL). 131 * @user_data: User data passed when creating @job. 132 * @error: Return location for error (never %NULL). 133 * 134 * Job function that runs in a separate thread. 135 * 136 * Long-running jobs should periodically check @cancellable to see if 137 * they have been cancelled. 138 * 139 * Returns: %TRUE if the job succeeded, %FALSE if @error is set. 140 */ 141 typedef gboolean (*UDisksThreadedJobFunc) (UDisksThreadedJob *job, 142 GCancellable *cancellable, 143 gpointer user_data, 144 GError **error); 145 146 struct _UDisksState; 147 typedef struct _UDisksState UDisksState; 148 149 /** 150 * UDisksMountType: 151 * @UDISKS_MOUNT_TYPE_FILESYSTEM: Object correspond to a mounted filesystem. 152 * @UDISKS_MOUNT_TYPE_SWAP: Object correspond to an in-use swap device. 153 * 154 * Types of a mount. 155 */ 156 typedef enum 157 { 158 UDISKS_MOUNT_TYPE_FILESYSTEM, 159 UDISKS_MOUNT_TYPE_SWAP 160 } UDisksMountType; 161 162 163 /** 164 * UDisksLogLevel: 165 * @UDISKS_LOG_LEVEL_DEBUG: Debug messages. 166 * @UDISKS_LOG_LEVEL_INFO: Informational messages. 167 * @UDISKS_LOG_LEVEL_NOTICE: Messages that the administrator should take notice of. 168 * @UDISKS_LOG_LEVEL_WARNING: Warning messages. 169 * @UDISKS_LOG_LEVEL_ERROR: Error messages. 170 * 171 * Logging levels. The level @UDISKS_LOG_LEVEL_NOTICE and above goes to syslog. 172 * 173 * Unlike g_warning() and g_error(), none of these logging levels causes the program to ever terminate. 174 */ 175 typedef enum 176 { 177 UDISKS_LOG_LEVEL_DEBUG = G_LOG_LEVEL_DEBUG, 178 UDISKS_LOG_LEVEL_INFO = G_LOG_LEVEL_INFO, 179 UDISKS_LOG_LEVEL_MESSAGE = G_LOG_LEVEL_MESSAGE, 180 UDISKS_LOG_LEVEL_WARNING = G_LOG_LEVEL_WARNING, 181 UDISKS_LOG_LEVEL_CRITICAL = G_LOG_LEVEL_CRITICAL, 182 UDISKS_LOG_LEVEL_ERROR = G_LOG_LEVEL_ERROR 183 } UDisksLogLevel; 184 185 struct _UDisksAtaCommandOutput; 186 typedef struct _UDisksAtaCommandOutput UDisksAtaCommandOutput; 187 188 struct _UDisksAtaCommandInput; 189 typedef struct _UDisksAtaCommandInput UDisksAtaCommandInput; 190 191 /** 192 * UDisksAtaCommandProtocol: 193 * @UDISKS_ATA_COMMAND_PROTOCOL_NONE: Non-data 194 * @UDISKS_ATA_COMMAND_PROTOCOL_DRIVE_TO_HOST: PIO Data-In 195 * @UDISKS_ATA_COMMAND_PROTOCOL_HOST_TO_DRIVE: PIO Data-Out 196 * 197 * Enumeration used to specify the protocol of an ATA command 198 */ 199 typedef enum 200 { 201 UDISKS_ATA_COMMAND_PROTOCOL_NONE, 202 UDISKS_ATA_COMMAND_PROTOCOL_DRIVE_TO_HOST, 203 UDISKS_ATA_COMMAND_PROTOCOL_HOST_TO_DRIVE 204 } UDisksAtaCommandProtocol; 205 206 struct _UDisksLinuxDevice; 207 typedef struct _UDisksLinuxDevice UDisksLinuxDevice; 208 209 /** 210 * UDISKS_DEFAULT_WAIT_TIMEOUT: 211 * 212 * Default timeout in seconds to wait for an object or uevent. 213 */ 214 #define UDISKS_DEFAULT_WAIT_TIMEOUT 20 /* seconds */ 215 216 /** 217 * UDisksObjectHasInterfaceFunc: 218 * @object: A #UDisksObject to consider. 219 * 220 * Function prototype that is used to determine whether the @object is applicable 221 * for carrying a particular D-Bus interface (determined by the callback function itself). 222 * 223 * Used typically over #UDisksLinuxBlockObject and #UDisksLinuxDriveObject 224 * objects for checking specific feature that leads to exporting extra D-Bus 225 * interface on the object. 226 * 227 * Returns: %TRUE if the @object is a valid candidate for the particular D-Bus interface, %FALSE otherwise. 228 */ 229 typedef gboolean (*UDisksObjectHasInterfaceFunc) (UDisksObject *object); 230 231 /** 232 * UDisksObjectConnectInterfaceFunc: 233 * @object: A #UDisksObject to perform connection operation onto. 234 * 235 * Function prototype that is used once a new D-Bus interface is created (meaning 236 * the #UDisksObjectHasInterfaceFunc call was successful) to perform optional 237 * additional tasks before the interface is exported on the @object. 238 * 239 * Used typically over #UDisksLinuxBlockObject and #UDisksLinuxDriveObject objects. 240 */ 241 typedef void (*UDisksObjectConnectInterfaceFunc) (UDisksObject *object); 242 243 /** 244 * UDisksObjectUpdateInterfaceFunc: 245 * @object: A #UDisksObject. 246 * @uevent_action: An uevent action string. 247 * @interface: Existing #GDBusInterface exported on the @object. 248 * 249 * Function prototype that is used on existing @interface on the @object to process 250 * incoming uevents. 251 * 252 * Used typically over #UDisksLinuxBlockObject and #UDisksLinuxDriveObject objects. 253 * 254 * Returns: %TRUE if configuration (properties) on the interface have changed, %FALSE otherwise. 255 */ 256 typedef gboolean (*UDisksObjectUpdateInterfaceFunc) (UDisksObject *object, 257 const gchar *uevent_action, 258 GDBusInterface *interface); 259 260 #endif /* __UDISKS_DAEMON_TYPES_H__ */ 261