summaryrefslogtreecommitdiff
path: root/util/nvmutil/nvmutil.h
diff options
context:
space:
mode:
Diffstat (limited to 'util/nvmutil/nvmutil.h')
-rw-r--r--util/nvmutil/nvmutil.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/util/nvmutil/nvmutil.h b/util/nvmutil/nvmutil.h
index 831c161a..ce38772c 100644
--- a/util/nvmutil/nvmutil.h
+++ b/util/nvmutil/nvmutil.h
@@ -4,6 +4,11 @@
* Copyright (c) 2022-2026 Leah Rowe <leah@libreboot.org>
*/
+/* Use this shorthand in cmd helpers. e.g.
+ in cmd_setmac function:
+ check_cmd(cmd_helper_cat);
+*/
+
#ifndef NVMUTIL_H
#define NVMUTIL_H
@@ -66,6 +71,10 @@
#define EXIT_SUCCESS 0
#endif
+#ifndef O_ACCMODE
+#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
+#endif
+
#ifndef O_BINARY
#define O_BINARY 0
#endif
@@ -286,6 +295,10 @@ struct xstate {
/* store size of a struct here.
(can be used to copy old state) */
unsigned long xsize;
+
+ /* Cat commands set this.
+ the cat cmd helpers check it */
+ int cat;
};
@@ -311,7 +324,7 @@ int xstrxcmp(const char *a, const char *b, unsigned long maxlen);
* Prep files for reading
*/
void open_gbe_file(void);
-int lock_file(int fd);
+int lock_file(int fd, int flags);
void xopen(int *fd, const char *path, int flags, struct stat *st);
/*
@@ -370,8 +383,14 @@ void cmd_helper_copy(void);
* cat, cat16 and cat128
*/
void cmd_helper_cat(void);
+void cmd_helper_cat16(void);
+void cmd_helper_cat128(void);
+void cat(unsigned long nff);
void cat_buf(unsigned char *b);
+void check_cmd(void (*fn)(void), const char *name);
+void cmd_helper_err(void);
+
/*
* After command processing, write
* the modified GbE file back.