Skip to content

Commit

Permalink
blockdev: New drive_get_by_index()
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
  • Loading branch information
Markus Armbruster authored and kevmw committed Jan 31, 2011
1 parent 505a7fb commit f1bd51a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions blockdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit)
return NULL;
}

DriveInfo *drive_get_by_index(BlockInterfaceType type, int index)
{
return drive_get(type,
drive_index_to_bus_id(type, index),
drive_index_to_unit_id(type, index));
}

int drive_get_max_bus(BlockInterfaceType type)
{
int max_bus;
Expand Down
1 change: 1 addition & 0 deletions blockdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct DriveInfo {
};

DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit);
DriveInfo *drive_get_by_index(BlockInterfaceType type, int index);
int drive_get_max_bus(BlockInterfaceType type);
DriveInfo *drive_get_next(BlockInterfaceType type);
void drive_uninit(DriveInfo *dinfo);
Expand Down

0 comments on commit f1bd51a

Please sign in to comment.