xref: /freebsd/sys/dev/vmm/vmm_param.h (revision 7377c87e467343e71b3e803708b98e04ea8e84bd)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2011 NetApp, Inc.
5  * All rights reserved.
6  */
7 
8 #ifndef _DEV_VMM_PARAM_H_
9 #define	_DEV_VMM_PARAM_H_
10 
11 /*
12  * The VM name has to fit into the pathname length constraints of devfs,
13  * governed primarily by SPECNAMELEN.  The length is the total number of
14  * characters in the full path, relative to the mount point and not
15  * including any leading '/' characters.
16  * A prefix and a suffix are added to the name specified by the user.
17  * The prefix is usually "vmm/" or "vmm.io/", but can be a few characters
18  * longer for future use.
19  * The suffix is a string that identifies a bootrom image or some similar
20  * image that is attached to the VM. A separator character gets added to
21  * the suffix automatically when generating the full path, so it must be
22  * accounted for, reducing the effective length by 1.
23  * The effective length of a VM name is 229 bytes for FreeBSD 13 and 37
24  * bytes for FreeBSD 12.  A minimum length is set for safety and supports
25  * a SPECNAMELEN as small as 32 on old systems.
26  */
27 #define	VM_MAX_PREFIXLEN	10
28 #define	VM_MAX_SUFFIXLEN	15
29 #define	VM_MIN_NAMELEN		6
30 #define	VM_MAX_NAMELEN		\
31 	(SPECNAMELEN - VM_MAX_PREFIXLEN - VM_MAX_SUFFIXLEN - 1)
32 
33 #endif /* !_DEV_VMM_PARAM_H_ */
34