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