eject: allow to address device by LABEL/UUID

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2012-05-18 12:01:10 +02:00
parent fa705b5441
commit 28094b1e3c
2 changed files with 8 additions and 3 deletions

View File

@ -19,7 +19,9 @@ multi-disc CD-ROM changers, the auto-eject feature supported by some devices,
and close the disc tray of some CD-ROM drives. and close the disc tray of some CD-ROM drives.
.PP .PP
The device corresponding to \fIdevice\fP or \fImountpoint\fP is ejected. If no The device corresponding to \fIdevice\fP or \fImountpoint\fP is ejected. If no
name is specified, the default name /dev/cdrom is used. name is specified, the default name /dev/cdrom is used. The device may be
addressed by device name (e.g. 'sda'), device path (e.g. '/dev/sda'),
UUID=<uuid> or LABEL=<label> tags.
.PP .PP
There are four different methods of ejecting, depending on whether the device There are four different methods of ejecting, depending on whether the device
is a CD-ROM, SCSI device, removable floppy, or tape. By default eject tries is a CD-ROM, SCSI device, removable floppy, or tape. By default eject tries

View File

@ -944,9 +944,12 @@ int main(int argc, char **argv)
/* figure out full device or mount point name */ /* figure out full device or mount point name */
p = find_device(device); p = find_device(device);
free(device); if (p)
free(device);
else
p = device;
device = mnt_resolve_path(p, NULL); device = mnt_resolve_spec(p, NULL);
free(p); free(p);
} }