4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
33 #include <sys/types.h>
39 #include <libhal-storage.h>
45 RMM_EDBUS_CONNECT
, /* cannot connect to DBUS */
46 RMM_EHAL_CONNECT
/* cannot connect to HAL */
50 RMM_PRINT_MOUNTABLE
= 0x1,
51 RMM_PRINT_EJECTABLE
= 0x2
54 /* D-Bus timeout in milliseconds */
56 RMM_MOUNT_TIMEOUT
= 60000,
57 RMM_UNMOUNT_TIMEOUT
= 60000,
58 RMM_EJECT_TIMEOUT
= 60000,
59 RMM_CLOSETRAY_TIMEOUT
= 60000
62 #define HAL_BRANCH_LOCAL "/org/freedesktop/Hal/devices/local"
64 #define NELEM(a) (sizeof (a) / sizeof (*(a)))
66 extern char *progname
;
68 LibHalContext
*rmm_hal_init(LibHalDeviceAdded
, LibHalDeviceRemoved
,
69 LibHalDevicePropertyModified
, LibHalDeviceCondition
,
70 DBusError
*, rmm_error_t
*);
71 void rmm_hal_fini(LibHalContext
*hal_ctx
);
73 LibHalDrive
*rmm_hal_volume_find(LibHalContext
*, const char *,
74 DBusError
*, GSList
**);
75 LibHalDrive
*rmm_hal_volume_find_default(LibHalContext
*, DBusError
*,
76 const char **, GSList
**);
77 LibHalDrive
*rmm_hal_volume_findby(LibHalContext
*, const char *,
78 const char *, GSList
**);
79 LibHalDrive
*rmm_hal_volume_findby_nickname(LibHalContext
*, const char *,
81 void rmm_print_volume_nicknames(LibHalContext
*, DBusError
*, int);
82 void rmm_volumes_free(GSList
*);
84 boolean_t
rmm_hal_mount(LibHalContext
*, const char *,
85 char **, int, char *, DBusError
*);
86 boolean_t
rmm_hal_unmount(LibHalContext
*, const char *, DBusError
*);
87 boolean_t
rmm_hal_eject(LibHalContext
*, const char *, DBusError
*);
88 boolean_t
rmm_hal_closetray(LibHalContext
*, const char *, DBusError
*);
89 boolean_t
rmm_hal_rescan(LibHalContext
*, const char *, DBusError
*);
90 boolean_t
rmm_hal_claim_branch(LibHalContext
*, const char *);
91 boolean_t
rmm_hal_unclaim_branch(LibHalContext
*, const char *);
93 boolean_t
rmm_action(LibHalContext
*, const char *name
, action_t action
,
94 struct action_arg
*aap
, char **, int, char *);
95 boolean_t
rmm_rescan(LibHalContext
*, const char *, boolean_t
);
97 void rmm_update_vold_mountpoints(LibHalContext
*, const char *,
100 boolean_t
rmm_volume_aa_from_prop(LibHalContext
*, const char *,
101 LibHalVolume
*, struct action_arg
*);
102 void rmm_volume_aa_update_mountpoint(LibHalContext
*, const char *,
103 struct action_arg
*aap
);
104 void rmm_volume_aa_free(struct action_arg
*);
106 char *rmm_get_mnttab_mount_point(const char *);
107 const char *rmm_strerror(DBusError
*, int);
108 void rmm_dbus_error_free(DBusError
*);
110 char *rmm_vold_convert_volume_label(const char *name
, size_t len
);
111 int makepath(char *, mode_t
);
112 void dprintf(const char *, ...);
118 #endif /* _COMMON_H */