stand: Add dv_devfmt to return a string represenation of the device
Add a new pointer, dv_devfmt, to allow devices to format themselves. We will use this to simplify many of the fmtdev functions in the tree as they are all almost the same, or all are isomorphic to each other. Sponsored by: Netflix Reviewed by: tsoome (prior version) Differential Revision: https://reviews.freebsd.org/D35915
This commit is contained in:
parent
d2d4e1271b
commit
4d4b1a298c
@ -140,6 +140,8 @@ extern struct fs_ops efihttp_fsops;
|
|||||||
* Device switch
|
* Device switch
|
||||||
*/
|
*/
|
||||||
#define DEV_NAMLEN 8 /* Length of name of device class */
|
#define DEV_NAMLEN 8 /* Length of name of device class */
|
||||||
|
#define DEV_DEVLEN 128 /* Length of longest device instance name */
|
||||||
|
struct devdesc;
|
||||||
struct devsw {
|
struct devsw {
|
||||||
const char dv_name[DEV_NAMLEN];
|
const char dv_name[DEV_NAMLEN];
|
||||||
int dv_type; /* opaque type constant */
|
int dv_type; /* opaque type constant */
|
||||||
@ -157,6 +159,7 @@ struct devsw {
|
|||||||
int (*dv_ioctl)(struct open_file *f, u_long cmd, void *data);
|
int (*dv_ioctl)(struct open_file *f, u_long cmd, void *data);
|
||||||
int (*dv_print)(int verbose); /* print device information */
|
int (*dv_print)(int verbose); /* print device information */
|
||||||
void (*dv_cleanup)(void);
|
void (*dv_cleanup)(void);
|
||||||
|
char * (*dv_fmtdev)(struct devdesc *);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -177,6 +180,8 @@ struct devdesc {
|
|||||||
void *d_opendata;
|
void *d_opendata;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
char *devformat(struct devdesc *d);
|
||||||
|
|
||||||
struct open_file {
|
struct open_file {
|
||||||
int f_flags; /* see F_* below */
|
int f_flags; /* see F_* below */
|
||||||
struct devsw *f_dev; /* pointer to device operations */
|
struct devsw *f_dev; /* pointer to device operations */
|
||||||
|
Loading…
Reference in New Issue
Block a user