pxe: Add a userdata field to the context
Allow the caller to provide some info which is passed back to the
readfile() method.
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>
diff --git a/cmd/pxe_utils.h b/cmd/pxe_utils.h
index ca2696f..921455f 100644
--- a/cmd/pxe_utils.h
+++ b/cmd/pxe_utils.h
@@ -86,6 +86,7 @@
*
* @cmdtp: Pointer to command table to use when calling other commands
* @getfile: Function called by PXE to read a file
+ * @userdata: Data the caller requires for @getfile
*/
struct pxe_context {
struct cmd_tbl *cmdtp;
@@ -99,6 +100,8 @@
* Return 0 if OK, -ve on error
*/
pxe_getfile_func getfile;
+
+ void *userdata;
};
/**
@@ -192,8 +195,9 @@
* @ctx: Context to set up
* @cmdtp: Command table entry which started this action
* @getfile: Function to call to read a file
+ * @userdata: Data the caller requires for @getfile - stored in ctx->userdata
*/
void pxe_setup_ctx(struct pxe_context *ctx, struct cmd_tbl *cmdtp,
- pxe_getfile_func getfile);
+ pxe_getfile_func getfile, void *userdata);
#endif /* __PXE_UTILS_H */