WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

Re: [XenPPC] [pushed] [ppc] OF write method does not handle carriage ret

To: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
Subject: Re: [XenPPC] [pushed] [ppc] OF write method does not handle carriage return
From: Hollis Blanchard <hollisb@xxxxxxxxxx>
Date: Tue, 25 Apr 2006 14:53:17 -0500
Cc: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 25 Apr 2006 12:52:25 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <E1FYS37-0007XP-6E@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: IBM Linux Technology Center
References: <E1FYS37-0007XP-6E@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Tue, 2006-04-25 at 14:14 -0400, Jimi Xenidis wrote:
> changeset:   9945:89fe455f6461cbc0ae0c346dcdf010659ed6ec30
> user:        jimix@xxxxxxxxxxxxxxxxxxxxx
> date:        Tue Apr 18 13:04:01 2006 -0400
> files:       xen/arch/ppc/boot_of.c
> description:
> [ppc] OF write method does not handle carriage return
> 
> 
> diff -r e0f71307b61dca9087d0dfb22b4d64b470f9bc5f -r 
> 89fe455f6461cbc0ae0c346dcdf010659ed6ec30 xen/arch/ppc/boot_of.c
> --- a/xen/arch/ppc/boot_of.c  Tue Apr 11 11:51:04 2006 -0400
> +++ b/xen/arch/ppc/boot_of.c  Tue Apr 18 13:04:01 2006 -0400
> @@ -94,14 +94,48 @@ static int __init of_call(
>  }
>  
>  /* popular OF methods */
> +static int __init _of_write(int ih, const char *addr, u32 len)
> +{
> +    int rets[1] = { OF_FAILURE };
> +    if (of_call("write", 3, 1, rets, ih, addr, len) == OF_FAILURE) {
> +        return OF_FAILURE;
> +    }
> +    return rets[0];
> +}
> +
> +/* popular OF methods */
>  static int __init of_write(int ih, const char *addr, u32 len)
>  {
> -    int rets[1] = { OF_FAILURE };
> -
> -    if (of_call("write", 3, 1, rets, ih, addr, len) == OF_FAILURE) {
> -        return OF_FAILURE;
> -    }
> -    return rets[0];
> +    int rc;
> +    int i = 0;
> +    int sum = 0;
> +
> +    while (i < len) {
> +        if (addr[i] == '\n') {
> +            int l = len - i - 1;
> +            if (l > 0) {
> +                rc = _of_write(ih, addr, len - i - 1);
> +                if (rc == OF_FAILURE) return rc;

Please add a newline after the conditional.

> +                sum += rc;
> +            }
> +            rc = _of_write(ih, "\r\n", 2);
> +            if (rc == OF_FAILURE) return rc;

Again.

> +            sum += rc;
> +            i++;
> +            addr += i;
> +            len -= i;
> +            i = 0;
> +            continue;
> +        }
> +        i++;
> +    }
> +    if (len > 0) {
> +        rc = _of_write(ih, addr, len);
> +        if (rc == OF_FAILURE) return rc;

Again.

> +        sum += rc;
> +    }
> +            
> +    return sum;
>  }
>  
>  static int of_printf(const char *fmt, ...)
> 
> 
> 
> _______________________________________________
> Xen-ppc-devel mailing list
> Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-ppc-devel
-- 
Hollis Blanchard
IBM Linux Technology Center


_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel