diff options
author | Simon Glass <sjg@chromium.org> | 2021-10-14 12:47:57 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-11-11 19:02:14 -0500 |
commit | b1ead6b9087f1f96cb117d72e3e5cf0d5fb708f5 (patch) | |
tree | f25a8c8de5539f31d9fb5688ce3d0f10d41cad2e /cmd/pxe_utils.h | |
parent | fd3fa5c3941d4de0736d066f77d0158cf933e207 (diff) |
pxe: Move do_getfile() into the context
Rather than having a global variable, pass the function as part of the
context.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Artem Lapkin <email2tema@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Diffstat (limited to 'cmd/pxe_utils.h')
-rw-r--r-- | cmd/pxe_utils.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/cmd/pxe_utils.h b/cmd/pxe_utils.h index cd0d337176..ca2696f48b 100644 --- a/cmd/pxe_utils.h +++ b/cmd/pxe_utils.h @@ -77,16 +77,28 @@ struct pxe_menu { extern bool is_pxe; -extern int (*do_getfile)(struct cmd_tbl *cmdtp, const char *file_path, - char *file_addr); +struct pxe_context; +typedef int (*pxe_getfile_func)(struct pxe_context *ctx, const char *file_path, + char *file_addr); /** * struct pxe_context - context information for PXE parsing * * @cmdtp: Pointer to command table to use when calling other commands + * @getfile: Function called by PXE to read a file */ struct pxe_context { struct cmd_tbl *cmdtp; + /** + * getfile() - read a file + * + * @ctx: PXE context + * @file_path: Path to the file + * @file_addr: String containing the hex address to put the file in + * memory + * Return 0 if OK, -ve on error + */ + pxe_getfile_func getfile; }; /** @@ -179,7 +191,9 @@ int format_mac_pxe(char *outbuf, size_t outbuf_len); * * @ctx: Context to set up * @cmdtp: Command table entry which started this action + * @getfile: Function to call to read a file */ -void pxe_setup_ctx(struct pxe_context *ctx, struct cmd_tbl *cmdtp); +void pxe_setup_ctx(struct pxe_context *ctx, struct cmd_tbl *cmdtp, + pxe_getfile_func getfile); #endif /* __PXE_UTILS_H */ |