[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] Add drive_get_by_id
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] Add drive_get_by_id |
Date: |
Tue, 19 Oct 2010 11:29:02 +0100 |
On Mon, Oct 18, 2010 at 11:17 PM, Ryan Harper <address@hidden> wrote:
> Add a function to find a drive by id string.
>
> Signed-off-by: Ryan Harper <address@hidden>
> ---
> blockdev.c | 12 ++++++++++++
> blockdev.h | 1 +
> 2 files changed, 13 insertions(+), 0 deletions(-)
>
> diff --git a/blockdev.c b/blockdev.c
> index ff7602b..a00b3fa 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -75,6 +75,18 @@ DriveInfo *drive_get(BlockInterfaceType type, int bus, int
> unit)
> return NULL;
> }
>
> +DriveInfo *drive_get_by_id(const char *id)
> +{
> + DriveInfo *dinfo;
> +
> + QTAILQ_FOREACH(dinfo, &drives, next) {
> + if (strcmp(id, dinfo->id))
> + continue;
QEMU coding style uses curly braces even for 1-line if statements:
if (strcmp(id, dinfo->id)) {
continue;
}
Stefan