git: e6cafedf0991 - stable/13 - stand: Add dv_devfmt to return a string represenation of the device

From: Warner Losh <imp_at_FreeBSD.org>
Date: Tue, 24 Jan 2023 22:11:55 UTC
The branch stable/13 has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=e6cafedf0991fbe6f087a0a75f39ac07d8d4642a

commit e6cafedf0991fbe6f087a0a75f39ac07d8d4642a
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-08-11 15:05:34 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-01-24 21:49:30 +0000

    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
    
    (cherry picked from commit 4d4b1a298c84f2357c304583dfe78d0e4b8fa2f1)
---
 stand/libsa/stand.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/stand/libsa/stand.h b/stand/libsa/stand.h
index 5f87f96ce673..5ffff54c7ca7 100644
--- a/stand/libsa/stand.h
+++ b/stand/libsa/stand.h
@@ -140,6 +140,8 @@ 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[DEV_NAMLEN];
     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_print)(int verbose);	/* print device information */
     void	(*dv_cleanup)(void);
+    char *	(*dv_fmtdev)(struct devdesc *);
 };
 
 /*
@@ -177,6 +180,8 @@ struct devdesc {
     void		*d_opendata;
 };
 
+char *devformat(struct devdesc *d);
+
 struct open_file {
     int			f_flags;	/* see F_* below */
     struct devsw	*f_dev;		/* pointer to device operations */