ia64/xen-unstable

changeset 16189:24c2745f939f

vt-d: Fix PCI=device parsing.
Signed-off-by: Weidong Han <weidong.han@intel.com>
author Keir Fraser <keir@xensource.com>
date Mon Oct 22 14:26:45 2007 +0100 (2007-10-22)
parents 368f563f2fd0
children d105b8c30b7d 118a21c66fd5
files tools/ioemu/hw/pass-through.c tools/python/xen/lowlevel/xc/xc.c
line diff
     1.1 --- a/tools/ioemu/hw/pass-through.c	Mon Oct 22 14:22:39 2007 +0100
     1.2 +++ b/tools/ioemu/hw/pass-through.c	Mon Oct 22 14:26:45 2007 +0100
     1.3 @@ -39,11 +39,10 @@ static int next_bdf(char **str, int *seg
     1.4  {
     1.5      char *token;
     1.6  
     1.7 -    token = strchr(*str, ',');
     1.8 -    if ( !token )
     1.9 +    if ( !(*str) || !strchr(*str, ',') )
    1.10          return 0;
    1.11 -    token++;
    1.12  
    1.13 +    token = *str;
    1.14      *seg  = token_value(token);
    1.15      token = strchr(token, ',') + 1;
    1.16      *bus  = token_value(token);
    1.17 @@ -51,8 +50,9 @@ static int next_bdf(char **str, int *seg
    1.18      *dev  = token_value(token);
    1.19      token = strchr(token, ',') + 1;
    1.20      *func  = token_value(token);
    1.21 +    token = strchr(token, ',');
    1.22 +    *str = token ? token + 1 : NULL;
    1.23  
    1.24 -    *str = token;
    1.25      return 1;
    1.26  }
    1.27  
     2.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Mon Oct 22 14:22:39 2007 +0100
     2.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Mon Oct 22 14:26:45 2007 +0100
     2.3 @@ -543,11 +543,10 @@ static int next_bdf(char **str, int *seg
     2.4  {
     2.5      char *token;
     2.6  
     2.7 -    token = strchr(*str, ',');
     2.8 -    if ( !token )
     2.9 +    if ( !(*str) || !strchr(*str, ',') )
    2.10          return 0;
    2.11 -    token++;
    2.12  
    2.13 +    token = *str;
    2.14      *seg  = token_value(token);
    2.15      token = strchr(token, ',') + 1;
    2.16      *bus  = token_value(token);
    2.17 @@ -555,8 +554,9 @@ static int next_bdf(char **str, int *seg
    2.18      *dev  = token_value(token);
    2.19      token = strchr(token, ',') + 1;
    2.20      *func  = token_value(token);
    2.21 +    token = strchr(token, ',');
    2.22 +    *str = token ? token + 1 : NULL;
    2.23  
    2.24 -    *str = token;
    2.25      return 1;
    2.26  }
    2.27