summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorfei feng - Sun Microsystems - Beijing China <Fei.Feng@Sun.COM>2009-11-20 12:17:57 +0800
committerfei feng - Sun Microsystems - Beijing China <Fei.Feng@Sun.COM>2009-11-20 12:17:57 +0800
commit68e92846614d4b32eb1a814a5e8e77331cfaaa59 (patch)
treea93fc83228e37f3afccaf35ed55fe351235704c6 /usr/src
parent16d2251e8bfa8576e38e3c44e646c89b396b3ee2 (diff)
downloadillumos-joyent-68e92846614d4b32eb1a814a5e8e77331cfaaa59.tar.gz
6637820 /usr/bin/eject does not work with the device, only with nickname when no media is in the drive
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/rmvolmgr/rmm_common.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/usr/src/cmd/rmvolmgr/rmm_common.c b/usr/src/cmd/rmvolmgr/rmm_common.c
index e8a4e5e741..9eabde32f6 100644
--- a/usr/src/cmd/rmvolmgr/rmm_common.c
+++ b/usr/src/cmd/rmvolmgr/rmm_common.c
@@ -256,6 +256,7 @@ rmm_hal_volume_findby(LibHalContext *hal_ctx, const char *property,
char **udis;
int num_udis;
int i;
+ int i_drive = -1;
*volumes = NULL;
@@ -268,7 +269,7 @@ rmm_hal_volume_findby(LibHalContext *hal_ctx, const char *property,
return (NULL);
}
- /* find volumes among these devices */
+ /* find volumes and drives among these devices */
for (i = 0; i < num_udis; i++) {
rmm_dbus_error_free(&error);
if (libhal_device_query_capability(hal_ctx, udis[i], "volume",
@@ -277,11 +278,15 @@ rmm_hal_volume_findby(LibHalContext *hal_ctx, const char *property,
if (v != NULL) {
*volumes = g_slist_prepend(*volumes, v);
}
+ } else if ((*volumes == NULL) &&
+ libhal_device_query_capability(hal_ctx, udis[i], "storage",
+ &error)) {
+ i_drive = i;
}
}
- /* used prepend, preserve original order */
if (*volumes != NULL) {
+ /* used prepend, preserve original order */
*volumes = g_slist_reverse(*volumes);
v = (LibHalVolume *)(*volumes)->data;
@@ -291,6 +296,8 @@ rmm_hal_volume_findby(LibHalContext *hal_ctx, const char *property,
rmm_volumes_free (*volumes);
*volumes = NULL;
}
+ } else if (i_drive >= 0) {
+ drive = libhal_drive_from_udi(hal_ctx, udis[i_drive]);
}
libhal_free_string_array(udis);
@@ -949,14 +956,13 @@ rmm_action(LibHalContext *hal_ctx, const char *name, action_t action,
(void) vold_postprocess(hal_ctx, udi, aap);
}
- libhal_volume_free(v);
if (aap == &aa_local) {
rmm_volume_aa_free(aap);
}
}
out:
- g_slist_free(volumes);
+ rmm_volumes_free(volumes);
libhal_drive_free(d);
return (ret);