From 72bfeca4c52a61571ce54cc156e5d31f5c4ea230 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Fri, 20 Jan 2012 12:38:21 +0000 Subject: Implement a status message interface for bio(4) capable devices. --- sys/dev/biovar.h | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) (limited to 'sys/dev/biovar.h') diff --git a/sys/dev/biovar.h b/sys/dev/biovar.h index 5d2b2c4c81e..e2e5dfe7670 100644 --- a/sys/dev/biovar.h +++ b/sys/dev/biovar.h @@ -1,8 +1,9 @@ -/* $OpenBSD: biovar.h,v 1.41 2012/01/17 15:15:57 jsing Exp $ */ +/* $OpenBSD: biovar.h,v 1.42 2012/01/20 12:38:19 jsing Exp $ */ /* * Copyright (c) 2002 Niklas Hallqvist. All rights reserved. * Copyright (c) 2005 Marco Peereboom. All rights reserved. + * Copyright (c) 2012 Joel Sing . All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,8 +34,30 @@ #include +#define BIO_MSG_COUNT 5 +#define BIO_MSG_LEN 128 + +struct bio_msg { + int bm_type; +#define BIO_MSG_INFO 1 +#define BIO_MSG_WARN 2 +#define BIO_MSG_ERROR 3 + char bm_msg[BIO_MSG_LEN]; +}; + +struct bio_status { + char bs_controller[16]; + int bs_status; +#define BIO_STATUS_UNKNOWN 0 +#define BIO_STATUS_SUCCESS 1 +#define BIO_STATUS_ERROR 2 + int bs_msg_count; + struct bio_msg bs_msgs[BIO_MSG_COUNT]; +}; + struct bio { - void *bio_cookie; + void *bio_cookie; + struct bio_status bio_status; }; /* convert name to a cookie */ @@ -44,12 +67,6 @@ struct bio_locate { char *bl_name; }; -#ifdef _KERNEL -int bio_register(struct device *, int (*)(struct device *, u_long, - caddr_t)); -void bio_unregister(struct device *); -#endif - #define BIOCINQ _IOWR('B', 32, struct bioc_inq) struct bioc_inq { struct bio bi_bio; @@ -236,3 +253,16 @@ struct bioc_installboot { /* user space defines */ #define BIOC_DEVLIST 0x10000 + +#ifdef _KERNEL +int bio_register(struct device *, int (*)(struct device *, u_long, + caddr_t)); +void bio_unregister(struct device *); + +void bio_status_init(struct bio_status *, struct device *); +void bio_status(struct bio_status *, int, int, const char *, va_list *); + +void bio_info(struct bio_status *, int, const char *, ...); +void bio_warn(struct bio_status *, int, const char *, ...); +void bio_error(struct bio_status *, int, const char *, ...); +#endif -- cgit v1.2.3