From 6ab12830921c1de4eb90a0d471bf5f4677af734c Mon Sep 17 00:00:00 2001 From: Joe Hershberger Date: Tue, 3 Jul 2018 19:36:43 -0500 Subject: net: Consolidate the parsing of bootfile The same basic parsing was implemented in tftp and nfs, so add a helper function to do the work once. Signed-off-by: Joe Hershberger --- include/net.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/net.h') diff --git a/include/net.h b/include/net.h index de2d7bba19d..62f82c4dca7 100644 --- a/include/net.h +++ b/include/net.h @@ -842,6 +842,17 @@ void copy_filename(char *dst, const char *src, int size); /* check if serverip is specified in filename from the command line */ int is_serverip_in_cmd(void); +/** + * net_parse_bootfile - Parse the bootfile env var / cmd line param + * + * @param ipaddr - a pointer to the ipaddr to populate if included in bootfile + * @param filename - a pointer to the string to save the filename part + * @param max_len - The longest - 1 that the filename part can be + * + * return 1 if parsed, 0 if bootfile is empty + */ +int net_parse_bootfile(struct in_addr *ipaddr, char *filename, int max_len); + /* get a random source port */ unsigned int random_port(void); -- cgit v1.2.3