From patchwork Tue Sep 16 00:23:45 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandra Seetharaman X-Patchwork-Id: 22975 Return-Path: X-Original-To: yaboot-devel@ozlabs.org Delivered-To: yaboot-devel@ozlabs.org Received: from e6.ny.us.ibm.com (e6.ny.us.ibm.com [32.97.182.146]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e6.ny.us.ibm.com", Issuer "Equifax" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 7667FDDE17 for ; Tue, 16 Sep 2008 10:24:47 +1000 (EST) Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e6.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id m8G0RCZq005155 for ; Mon, 15 Sep 2008 20:27:12 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id m8G0OOUY182810 for ; Mon, 15 Sep 2008 20:24:24 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m8G0OOYO024032 for ; Mon, 15 Sep 2008 20:24:24 -0400 Received: from [127.0.1.1] (chandra-ubuntu.beaverton.ibm.com [9.47.17.98]) by d01av02.pok.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m8G0ONXl023990; Mon, 15 Sep 2008 20:24:23 -0400 From: Chandra Seetharaman To: yaboot devel Date: Mon, 15 Sep 2008 17:23:45 -0700 Message-Id: <20080916002345.21364.16183.sendpatchset@chandra-ubuntu> In-Reply-To: <20080916002327.21364.99723.sendpatchset@chandra-ubuntu> References: <20080916002327.21364.99723.sendpatchset@chandra-ubuntu> Subject: [PATCH 3/4] move the extract arguments functionality out X-BeenThere: yaboot-devel@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Technical and development discussion regarding yaboot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Sep 2008 00:24:48 -0000 This patch just extracts the ipv4 arguments extraction into a separate function. No fucntional change. This is just in preparation for the next patch which adds supports for ipv6. Signed-off-by: Chandra Seetharaman --- second/file.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) Index: yaboot.git_head/second/file.c =================================================================== --- yaboot.git_head.orig/second/file.c +++ yaboot.git_head/second/file.c @@ -62,19 +62,14 @@ scopy(char **dest, char **source) } /* - * Extract all the arguments provided in the imagepath and fill it in result. + * Extract all the ipv4 arguments from the bootpath provided and fill result * Returns 1 on success, 0 on failure. */ static int -extract_args_from_netdev_path(char *imagepath, struct boot_fspec_t *result) +extract_ipv4_args(char *imagepath, struct boot_fspec_t *result) { char *tmp, *args, *str, *start; - DEBUG_F("imagepath = %s\n", imagepath); - - if (!imagepath) - return 1; - args = strrchr(imagepath, ':'); if (!args) return 1; @@ -133,6 +128,24 @@ extract_args_from_netdev_path(char *imag if (!result->addl_params) return 0; } + return 1; +} + +/* + * Extract all the arguments provided in the imagepath and fill it in result. + * Returns 1 on success, 0 on failure. + */ +static int +extract_args_from_netdev_path(char *imagepath, struct boot_fspec_t *result) +{ + int ret; + + DEBUG_F("imagepath = %s\n", imagepath); + + if (!imagepath) + return 1; + + ret = extract_ipv4_args(imagepath, result); DEBUG_F("siaddr = <%s>\n", result->siaddr); DEBUG_F("file = <%s>\n", result->file); @@ -141,7 +154,7 @@ extract_args_from_netdev_path(char *imag DEBUG_F("bootp_retries = <%s>\n", result->bootp_retries); DEBUG_F("tftp_retries = <%s>\n", result->tftp_retries); DEBUG_F("addl_params = <%s>\n", result->addl_params); - return 1; + return ret; } static char *netdev_path_to_dev(const char *path)