diff options
Diffstat (limited to 'stand/libsa/stand.h')
-rw-r--r-- | stand/libsa/stand.h | 80 |
1 files changed, 70 insertions, 10 deletions
diff --git a/stand/libsa/stand.h b/stand/libsa/stand.h index 097d8ba28d0b..260defa3a33d 100644 --- a/stand/libsa/stand.h +++ b/stand/libsa/stand.h @@ -22,8 +22,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ * From $NetBSD: stand.h,v 1.22 1997/06/26 19:17:40 drochner Exp $ */ @@ -54,15 +52,12 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)stand.h 8.1 (Berkeley) 6/11/93 */ #ifndef STAND_H #define STAND_H #include <sys/types.h> -#include <sys/cdefs.h> #include <sys/stat.h> #include <sys/dirent.h> #include <sys/queue.h> @@ -90,6 +85,8 @@ /* Partial signal emulation for sig_atomic_t */ #include <machine/signal.h> +__BEGIN_DECLS + struct open_file; /* @@ -139,9 +136,12 @@ extern struct fs_ops efihttp_fsops; /* * Device switch */ +#define DEV_NAMLEN 8 /* Length of name of device class */ +#define DEV_DEVLEN 128 /* Length of longest device instance name */ +struct devdesc; struct devsw { - const char dv_name[8]; - int dv_type; /* opaque type constant, arch-dependant */ + const char dv_name[DEV_NAMLEN]; + int dv_type; /* opaque type constant */ #define DEVT_NONE 0 #define DEVT_DISK 1 #define DEVT_NET 2 @@ -156,6 +156,9 @@ struct devsw { int (*dv_ioctl)(struct open_file *f, u_long cmd, void *data); int (*dv_print)(int verbose); /* print device information */ void (*dv_cleanup)(void); + char * (*dv_fmtdev)(struct devdesc *); + int (*dv_parsedev)(struct devdesc **, const char *, const char **); + bool (*dv_match)(struct devsw *, const char *); }; /* @@ -166,9 +169,14 @@ extern struct devsw netdev; extern int errno; /* - * Generic device specifier; architecture-dependent - * versions may be larger, but should be allowed to - * overlap. + * Generic device specifier; architecture-dependent versions may be larger, but + * should be allowed to overlap. The larger device specifiers store more data + * than can fit in the generic one that's gleaned after parsing the device + * string, or used in some cases to indicate wildcards that match a variety of + * situations based on what's on the drive itself rather than what the progammer + * might know in advance. Information about open files is stored in d_opendata, + * though what's passed into the open routine may differ from what's present + * after the open on some configurations. */ struct devdesc { struct devsw *d_dev; @@ -176,6 +184,11 @@ struct devdesc { void *d_opendata; }; +char *devformat(struct devdesc *d); +int devparse(struct devdesc **, const char *, const char **); +int devinit(void); +void dev_cleanup(void); + struct open_file { int f_flags; /* see F_* below */ struct devsw *f_dev; /* pointer to device operations */ @@ -300,6 +313,7 @@ extern int close(int); extern void closeall(void); extern ssize_t read(int, void *, size_t); extern ssize_t write(int, const void *, size_t); +extern int ioctl(int, u_long, void *); extern struct dirent *readdirfd(int); extern void preload(int); @@ -480,9 +494,53 @@ extern void *reallocf(void *, size_t); */ caddr_t ptov(uintptr_t); +/* features.c */ +typedef void (feature_iter_fn)(void *, const char *, const char *, bool); + +extern void feature_enable(uint32_t); +extern bool feature_name_is_enabled(const char *); +extern void feature_iter(feature_iter_fn *, void *); + +/* + * Note that these should also be added to the mapping table in features.c, + * which the interpreter may query to provide details from. The name with + * FEATURE_ removed is assumed to be the name we'll provide in the loader + * features table, just to simplify reasoning about these. + */ +#define FEATURE_EARLY_ACPI 0x0001 + /* hexdump.c */ void hexdump(caddr_t region, size_t len); +/* nvstore.c */ +typedef int (nvstore_getter_cb_t)(void *, const char *, void **); +typedef int (nvstore_setter_cb_t)(void *, int, const char *, + const void *, size_t); +typedef int (nvstore_setter_str_cb_t)(void *, const char *, const char *, + const char *); +typedef int (nvstore_unset_cb_t)(void *, const char *); +typedef int (nvstore_print_cb_t)(void *, void *); +typedef int (nvstore_iterate_cb_t)(void *, int (*)(void *, void *)); + +typedef struct nvs_callbacks { + nvstore_getter_cb_t *nvs_getter; + nvstore_setter_cb_t *nvs_setter; + nvstore_setter_str_cb_t *nvs_setter_str; + nvstore_unset_cb_t *nvs_unset; + nvstore_print_cb_t *nvs_print; + nvstore_iterate_cb_t *nvs_iterate; +} nvs_callbacks_t; + +int nvstore_init(const char *, nvs_callbacks_t *, void *); +int nvstore_fini(const char *); +void *nvstore_get_store(const char *); +int nvstore_print(void *); +int nvstore_get_var(void *, const char *, void **); +int nvstore_set_var(void *, int, const char *, void *, size_t); +int nvstore_set_var_from_string(void *, const char *, const char *, + const char *); +int nvstore_unset_var(void *, const char *); + /* tslog.c */ #define TSRAW(a, b, c) tslog(a, b, c) #define TSENTER() TSRAW("ENTER", __func__, NULL) @@ -493,4 +551,6 @@ void tslog(const char *, const char *, const char *); void tslog_setbuf(void * buf, size_t len); void tslog_getbuf(void ** buf, size_t * len); +__END_DECLS + #endif /* STAND_H */ |