xref: /freebsd/sys/geom/part/g_part.h (revision 09c999b1557a8031d2b60435d71a0a5ed4f0f016)
11d3aed33SMarcel Moolenaar /*-
24d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
33728855aSPedro F. Giffuni  *
4f6aa3fccSMarcel Moolenaar  * Copyright (c) 2006-2008 Marcel Moolenaar
51d3aed33SMarcel Moolenaar  * All rights reserved.
61d3aed33SMarcel Moolenaar  *
71d3aed33SMarcel Moolenaar  * Redistribution and use in source and binary forms, with or without
81d3aed33SMarcel Moolenaar  * modification, are permitted provided that the following conditions
91d3aed33SMarcel Moolenaar  * are met:
101d3aed33SMarcel Moolenaar  *
111d3aed33SMarcel Moolenaar  * 1. Redistributions of source code must retain the above copyright
121d3aed33SMarcel Moolenaar  *    notice, this list of conditions and the following disclaimer.
131d3aed33SMarcel Moolenaar  * 2. Redistributions in binary form must reproduce the above copyright
141d3aed33SMarcel Moolenaar  *    notice, this list of conditions and the following disclaimer in the
151d3aed33SMarcel Moolenaar  *    documentation and/or other materials provided with the distribution.
161d3aed33SMarcel Moolenaar  *
171d3aed33SMarcel Moolenaar  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
181d3aed33SMarcel Moolenaar  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
191d3aed33SMarcel Moolenaar  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
201d3aed33SMarcel Moolenaar  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
211d3aed33SMarcel Moolenaar  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
221d3aed33SMarcel Moolenaar  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
231d3aed33SMarcel Moolenaar  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
241d3aed33SMarcel Moolenaar  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
251d3aed33SMarcel Moolenaar  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
261d3aed33SMarcel Moolenaar  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
271d3aed33SMarcel Moolenaar  */
281d3aed33SMarcel Moolenaar 
291d3aed33SMarcel Moolenaar #ifndef _GEOM_PART_H_
301d3aed33SMarcel Moolenaar #define	_GEOM_PART_H_
311d3aed33SMarcel Moolenaar 
321d3aed33SMarcel Moolenaar #define	G_PART_TRACE(args)	g_trace args
331d3aed33SMarcel Moolenaar 
341d3aed33SMarcel Moolenaar #define G_PART_PROBE_PRI_LOW	-10
351d3aed33SMarcel Moolenaar #define	G_PART_PROBE_PRI_NORM	-5
361d3aed33SMarcel Moolenaar #define	G_PART_PROBE_PRI_HIGH	0
371d3aed33SMarcel Moolenaar 
381d3aed33SMarcel Moolenaar enum g_part_alias {
39b42712a8SConrad Meyer 	G_PART_ALIAS_APPLE_APFS,	/* An Apple APFS partition. */
40f1317430SRui Paulo 	G_PART_ALIAS_APPLE_BOOT,	/* An Apple boot partition entry. */
419c0c355fSAllan Jude 	G_PART_ALIAS_APPLE_CORE_STORAGE,/* An Apple Core Storage partition. */
42f1317430SRui Paulo 	G_PART_ALIAS_APPLE_HFS,		/* An HFS+ file system entry. */
43f1317430SRui Paulo 	G_PART_ALIAS_APPLE_LABEL,	/* An Apple label partition entry. */
44f1317430SRui Paulo 	G_PART_ALIAS_APPLE_RAID,	/* An Apple RAID partition entry. */
45f1317430SRui Paulo 	G_PART_ALIAS_APPLE_RAID_OFFLINE,/* An Apple RAID (offline) part entry.*/
46f1317430SRui Paulo 	G_PART_ALIAS_APPLE_TV_RECOVERY,	/* An Apple TV recovery part entry. */
47f1317430SRui Paulo 	G_PART_ALIAS_APPLE_UFS,		/* An Apple UFS partition entry. */
48cb1480f8SConrad Meyer 	G_PART_ALIAS_APPLE_ZFS,		/* An Apple ZFS partition entry.
49cb1480f8SConrad Meyer 					   Also used for Solaris /usr partition. */
509c0c355fSAllan Jude 	G_PART_ALIAS_BIOS_BOOT,		/* A GRUB 2 boot partition entry. */
519c0c355fSAllan Jude 	G_PART_ALIAS_CHROMEOS_FIRMWARE,	/* A ChromeOS firmware part. entry. */
529c0c355fSAllan Jude 	G_PART_ALIAS_CHROMEOS_KERNEL,	/* A ChromeOS Kernel part. entry. */
539c0c355fSAllan Jude 	G_PART_ALIAS_CHROMEOS_RESERVED,	/* ChromeOS. Reserved for future use. */
549c0c355fSAllan Jude 	G_PART_ALIAS_CHROMEOS_ROOT,	/* A ChromeOS root part. entry. */
559c0c355fSAllan Jude 	G_PART_ALIAS_DFBSD,		/* A DfBSD label32 partition entry */
569c0c355fSAllan Jude 	G_PART_ALIAS_DFBSD64,		/* A DfBSD label64 partition entry */
579c0c355fSAllan Jude 	G_PART_ALIAS_DFBSD_CCD,		/* A DfBSD CCD partition entry */
589c0c355fSAllan Jude 	G_PART_ALIAS_DFBSD_HAMMER,	/* A DfBSD HAMMER FS partition entry */
599c0c355fSAllan Jude 	G_PART_ALIAS_DFBSD_HAMMER2,	/* A DfBSD HAMMER2 FS partition entry */
609c0c355fSAllan Jude 	G_PART_ALIAS_DFBSD_LEGACY,	/* A DfBSD legacy partition entry */
619c0c355fSAllan Jude 	G_PART_ALIAS_DFBSD_SWAP,	/* A DfBSD swap partition entry */
629c0c355fSAllan Jude 	G_PART_ALIAS_DFBSD_UFS,		/* A DfBSD UFS partition entry */
639c0c355fSAllan Jude 	G_PART_ALIAS_DFBSD_VINUM,	/* A DfBSD Vinum partition entry */
649c0c355fSAllan Jude 	G_PART_ALIAS_EBR,		/* A EBR partition entry. */
651d3aed33SMarcel Moolenaar 	G_PART_ALIAS_EFI,		/* A EFI system partition entry. */
661d3aed33SMarcel Moolenaar 	G_PART_ALIAS_FREEBSD,		/* A BSD labeled partition entry. */
67f352a0d4SJohn Baldwin 	G_PART_ALIAS_FREEBSD_BOOT,	/* A FreeBSD boot partition entry. */
68f24a8224SMarcel Moolenaar 	G_PART_ALIAS_FREEBSD_NANDFS,	/* A FreeBSD nandfs partition entry. */
691d3aed33SMarcel Moolenaar 	G_PART_ALIAS_FREEBSD_SWAP,	/* A swap partition entry. */
701d3aed33SMarcel Moolenaar 	G_PART_ALIAS_FREEBSD_UFS,	/* A UFS/UFS2 file system entry. */
711d3aed33SMarcel Moolenaar 	G_PART_ALIAS_FREEBSD_VINUM,	/* A Vinum partition entry. */
72a1fedf91SMarcel Moolenaar 	G_PART_ALIAS_FREEBSD_ZFS,	/* A ZFS file system entry. */
739c296a21SEd Maste 	G_PART_ALIAS_HIFIVE_FSBL,	/* HiFive First Stage Bootloader */
749c296a21SEd Maste 	G_PART_ALIAS_HIFIVE_BBL,	/* HiFive Second Stage Bootloader */
75f1317430SRui Paulo 	G_PART_ALIAS_LINUX_DATA,	/* A Linux data partition entry. */
76f1317430SRui Paulo 	G_PART_ALIAS_LINUX_LVM,		/* A Linux LVM partition entry. */
77f1317430SRui Paulo 	G_PART_ALIAS_LINUX_RAID,	/* A Linux RAID partition entry. */
78f1317430SRui Paulo 	G_PART_ALIAS_LINUX_SWAP,	/* A Linux swap partition entry. */
799c0c355fSAllan Jude 	G_PART_ALIAS_MBR,		/* A MBR (extended) partition entry. */
8033f7a412SRui Paulo 	G_PART_ALIAS_MS_BASIC_DATA,	/* A Microsoft Data part. entry. */
819c0c355fSAllan Jude 	G_PART_ALIAS_MS_FAT16,		/* A Microsoft FAT16 partition entry. */
829c0c355fSAllan Jude 	G_PART_ALIAS_MS_FAT32,		/* A Microsoft FAT32 partition entry. */
83b525a10aSEd Maste 	G_PART_ALIAS_MS_FAT32LBA,	/* A Microsoft FAT32 LBA partition entry */
8433f7a412SRui Paulo 	G_PART_ALIAS_MS_LDM_DATA,	/* A Microsoft LDM Data part. entry. */
8533f7a412SRui Paulo 	G_PART_ALIAS_MS_LDM_METADATA,	/* A Microsoft LDM Metadata entry. */
86c6b2b6fcSRui Paulo 	G_PART_ALIAS_MS_NTFS,		/* A Microsoft NTFS partition entry */
879c0c355fSAllan Jude 	G_PART_ALIAS_MS_RECOVERY,	/* A Microsoft recovery part. entry. */
889c0c355fSAllan Jude 	G_PART_ALIAS_MS_RESERVED,	/* A Microsoft Reserved part. entry. */
899c0c355fSAllan Jude 	G_PART_ALIAS_MS_SPACES,		/* A Microsoft Spaces part. entry. */
9033f7a412SRui Paulo 	G_PART_ALIAS_NETBSD_CCD,	/* A NetBSD CCD partition entry. */
9133f7a412SRui Paulo 	G_PART_ALIAS_NETBSD_CGD,	/* A NetBSD CGD partition entry. */
9233f7a412SRui Paulo 	G_PART_ALIAS_NETBSD_FFS,	/* A NetBSD FFS partition entry. */
939c0c355fSAllan Jude 	G_PART_ALIAS_NETBSD_LFS,	/* A NetBSD LFS partition entry. */
9433f7a412SRui Paulo 	G_PART_ALIAS_NETBSD_RAID,	/* A NetBSD RAID partition entry. */
9533f7a412SRui Paulo 	G_PART_ALIAS_NETBSD_SWAP,	/* A NetBSD swap partition entry. */
969c0c355fSAllan Jude 	G_PART_ALIAS_OPENBSD_DATA,	/* An OpenBSD data partition entry. */
979c0c355fSAllan Jude 	G_PART_ALIAS_PREP_BOOT,		/* A PREP/CHRP boot partition entry. */
98cb1480f8SConrad Meyer 	G_PART_ALIAS_SOLARIS_BOOT,	/* A Solaris boot partition entry. */
99cb1480f8SConrad Meyer 	G_PART_ALIAS_SOLARIS_ROOT,	/* A Solaris root partition entry. */
100cb1480f8SConrad Meyer 	G_PART_ALIAS_SOLARIS_SWAP,	/* A Solaris swap partition entry. */
101cb1480f8SConrad Meyer 	G_PART_ALIAS_SOLARIS_BACKUP,	/* A Solaris backup partition entry. */
102cb1480f8SConrad Meyer 	G_PART_ALIAS_SOLARIS_VAR,	/* A Solaris /var partition entry. */
103cb1480f8SConrad Meyer 	G_PART_ALIAS_SOLARIS_HOME,	/* A Solaris /home partition entry. */
104cb1480f8SConrad Meyer 	G_PART_ALIAS_SOLARIS_ALTSEC,	/* A Solaris alternate sector partition entry. */
105cb1480f8SConrad Meyer 	G_PART_ALIAS_SOLARIS_RESERVED,	/* A Solaris reserved partition entry. */
106b162fc3fSJessica Clarke 	G_PART_ALIAS_U_BOOT_ENV,	/* A U-Boot environment partition entry. */
107b20e4de3SDmitry Morozovsky 	G_PART_ALIAS_VMFS,		/* A VMware VMFS partition entry */
108b20e4de3SDmitry Morozovsky 	G_PART_ALIAS_VMKDIAG,		/* A VMware vmkDiagnostic partition entry */
109b20e4de3SDmitry Morozovsky 	G_PART_ALIAS_VMRESERVED,	/* A VMware reserved partition entry */
1105cc596c4SDmitry Morozovsky 	G_PART_ALIAS_VMVSANHDR,		/* A VMware vSAN header partition entry */
1111d3aed33SMarcel Moolenaar 	/* Keep the following last */
1121d3aed33SMarcel Moolenaar 	G_PART_ALIAS_COUNT
1131d3aed33SMarcel Moolenaar };
1141d3aed33SMarcel Moolenaar 
1151d3aed33SMarcel Moolenaar const char *g_part_alias_name(enum g_part_alias);
1161d3aed33SMarcel Moolenaar 
1171d3aed33SMarcel Moolenaar /* G_PART scheme (KOBJ class). */
1181d3aed33SMarcel Moolenaar struct g_part_scheme {
1191d3aed33SMarcel Moolenaar 	KOBJ_CLASS_FIELDS;
1201d3aed33SMarcel Moolenaar 	size_t		gps_entrysz;
121*09c999b1SWarner Losh 	int		gps_minent;		/* Minimum number of entries possible */
122*09c999b1SWarner Losh 	int		gps_defent;		/* Default number of entries to create */
123*09c999b1SWarner Losh 	int		gps_maxent;		/* Maximum number of entries possible */
1244d32fcb4SMarcel Moolenaar 	int		gps_bootcodesz;
1254ffca444SMarcel Moolenaar 	TAILQ_ENTRY(g_part_scheme) scheme_list;
1261d3aed33SMarcel Moolenaar };
1271d3aed33SMarcel Moolenaar 
1281d3aed33SMarcel Moolenaar struct g_part_entry {
1291d3aed33SMarcel Moolenaar 	LIST_ENTRY(g_part_entry) gpe_entry;
1301d3aed33SMarcel Moolenaar 	struct g_provider *gpe_pp;	/* Corresponding provider. */
1311d3aed33SMarcel Moolenaar 	off_t		gpe_offset;	/* Byte offset. */
1321d3aed33SMarcel Moolenaar 	quad_t		gpe_start;	/* First LBA of partition. */
1331d3aed33SMarcel Moolenaar 	quad_t		gpe_end;	/* Last LBA of partition. */
1341d3aed33SMarcel Moolenaar 	int		gpe_index;
13500172f34SEd Maste 	bool		gpe_created:1;	/* Entry is newly created. */
13600172f34SEd Maste 	bool		gpe_deleted:1;	/* Entry has been deleted. */
13700172f34SEd Maste 	bool		gpe_modified:1;	/* Entry has been modified. */
13800172f34SEd Maste 	bool		gpe_internal:1;	/* Entry is not a used entry. */
1391d3aed33SMarcel Moolenaar };
1401d3aed33SMarcel Moolenaar 
1411d3aed33SMarcel Moolenaar /* G_PART table (KOBJ instance). */
1421d3aed33SMarcel Moolenaar struct g_part_table {
1431d3aed33SMarcel Moolenaar 	KOBJ_FIELDS;
1441d3aed33SMarcel Moolenaar 	struct g_part_scheme *gpt_scheme;
1451d3aed33SMarcel Moolenaar 	struct g_geom	*gpt_gp;
1461d3aed33SMarcel Moolenaar 	LIST_HEAD(, g_part_entry) gpt_entry;
1471d3aed33SMarcel Moolenaar 	quad_t		gpt_first;	/* First allocatable LBA */
1481d3aed33SMarcel Moolenaar 	quad_t		gpt_last;	/* Last allocatable LBA */
1491d3aed33SMarcel Moolenaar 	int		gpt_entries;
1501d3aed33SMarcel Moolenaar 	/*
1511d3aed33SMarcel Moolenaar 	 * gpt_smhead and gpt_smtail are bitmaps representing the first
1521d3aed33SMarcel Moolenaar 	 * 32 sectors on the disk (gpt_smhead) and the last 32 sectors
1531d3aed33SMarcel Moolenaar 	 * on the disk (gpt_smtail). These maps are used by the commit
1541d3aed33SMarcel Moolenaar 	 * verb to clear sectors previously used by a scheme after the
1551d3aed33SMarcel Moolenaar 	 * partitioning scheme has been destroyed.
1561d3aed33SMarcel Moolenaar 	 */
1571d3aed33SMarcel Moolenaar 	uint32_t	gpt_smhead;
1581d3aed33SMarcel Moolenaar 	uint32_t	gpt_smtail;
1590081f96eSMarcel Moolenaar 	/*
1600081f96eSMarcel Moolenaar 	 * gpt_sectors and gpt_heads are the fixed or synchesized number
1610081f96eSMarcel Moolenaar 	 * of sectors per track and heads (resp) that make up a disks
1620081f96eSMarcel Moolenaar 	 * geometry. This is to support partitioning schemes as well as
1630081f96eSMarcel Moolenaar 	 * file systems that work on a geometry. The MBR scheme and the
1640081f96eSMarcel Moolenaar 	 * MS-DOS (FAT) file system come to mind.
1650081f96eSMarcel Moolenaar 	 * We keep track of whether the geometry is fixed or synchesized
1660081f96eSMarcel Moolenaar 	 * so that a partitioning scheme can correct the synthesized
1670081f96eSMarcel Moolenaar 	 * geometry, based on the on-disk metadata.
1680081f96eSMarcel Moolenaar 	 */
1690081f96eSMarcel Moolenaar 	uint32_t	gpt_sectors;
1700081f96eSMarcel Moolenaar 	uint32_t	gpt_heads;
1711d3aed33SMarcel Moolenaar 
1721d3aed33SMarcel Moolenaar 	int		gpt_depth;	/* Sub-partitioning level. */
17300172f34SEd Maste 	bool		gpt_isleaf:1;	/* Cannot be sub-partitioned. */
17400172f34SEd Maste 	bool		gpt_created:1;	/* Newly created. */
17500172f34SEd Maste 	bool		gpt_modified:1;	/* Table changes have been made. */
17600172f34SEd Maste 	bool		gpt_opened:1;	/* Permissions obtained. */
17700172f34SEd Maste 	bool		gpt_fixgeom:1;	/* Geometry is fixed. */
17800172f34SEd Maste 	bool		gpt_corrupt:1;	/* Table is corrupt. */
1791d3aed33SMarcel Moolenaar };
1801d3aed33SMarcel Moolenaar 
1811d3aed33SMarcel Moolenaar struct g_part_entry *g_part_new_entry(struct g_part_table *, int, quad_t,
1821d3aed33SMarcel Moolenaar     quad_t);
1831d3aed33SMarcel Moolenaar 
1847ca4fa83SMarcel Moolenaar enum g_part_ctl {
1857ca4fa83SMarcel Moolenaar 	G_PART_CTL_NONE,
1867ca4fa83SMarcel Moolenaar 	G_PART_CTL_ADD,
1877ca4fa83SMarcel Moolenaar 	G_PART_CTL_BOOTCODE,
1887ca4fa83SMarcel Moolenaar 	G_PART_CTL_COMMIT,
1897ca4fa83SMarcel Moolenaar 	G_PART_CTL_CREATE,
1907ca4fa83SMarcel Moolenaar 	G_PART_CTL_DELETE,
1917ca4fa83SMarcel Moolenaar 	G_PART_CTL_DESTROY,
1927ca4fa83SMarcel Moolenaar 	G_PART_CTL_MODIFY,
1937ca4fa83SMarcel Moolenaar 	G_PART_CTL_MOVE,
1947ca4fa83SMarcel Moolenaar 	G_PART_CTL_RECOVER,
1957ca4fa83SMarcel Moolenaar 	G_PART_CTL_RESIZE,
1967ca4fa83SMarcel Moolenaar 	G_PART_CTL_SET,
1977ca4fa83SMarcel Moolenaar 	G_PART_CTL_UNDO,
1987ca4fa83SMarcel Moolenaar 	G_PART_CTL_UNSET
1997ca4fa83SMarcel Moolenaar };
2007ca4fa83SMarcel Moolenaar 
2011d3aed33SMarcel Moolenaar /* G_PART ctlreq parameters. */
2021d3aed33SMarcel Moolenaar #define	G_PART_PARM_ENTRIES	0x0001
2031d3aed33SMarcel Moolenaar #define	G_PART_PARM_FLAGS	0x0002
2041d3aed33SMarcel Moolenaar #define	G_PART_PARM_GEOM	0x0004
2051d3aed33SMarcel Moolenaar #define	G_PART_PARM_INDEX	0x0008
2061d3aed33SMarcel Moolenaar #define	G_PART_PARM_LABEL	0x0010
207d287f590SMarcel Moolenaar #define	G_PART_PARM_OUTPUT	0x0020
208d287f590SMarcel Moolenaar #define	G_PART_PARM_PROVIDER	0x0040
209d287f590SMarcel Moolenaar #define	G_PART_PARM_SCHEME	0x0080
210d287f590SMarcel Moolenaar #define	G_PART_PARM_SIZE	0x0100
211d287f590SMarcel Moolenaar #define	G_PART_PARM_START	0x0200
212d287f590SMarcel Moolenaar #define	G_PART_PARM_TYPE	0x0400
213d287f590SMarcel Moolenaar #define	G_PART_PARM_VERSION	0x0800
2144d32fcb4SMarcel Moolenaar #define	G_PART_PARM_BOOTCODE	0x1000
215f6aa3fccSMarcel Moolenaar #define	G_PART_PARM_ATTRIB	0x2000
216e7926a37SAndrey V. Elsukov #define	G_PART_PARM_FORCE	0x4000
217cdd2df88SDag-Erling Smørgrav #define G_PART_PARM_SKIP_DSN	0x8000
2181d3aed33SMarcel Moolenaar 
2191d3aed33SMarcel Moolenaar struct g_part_parms {
2201d3aed33SMarcel Moolenaar 	unsigned int	gpp_parms;
2211d3aed33SMarcel Moolenaar 	unsigned int	gpp_entries;
2221d3aed33SMarcel Moolenaar 	const char	*gpp_flags;
2231d3aed33SMarcel Moolenaar 	struct g_geom	*gpp_geom;
2241d3aed33SMarcel Moolenaar 	unsigned int	gpp_index;
2251d3aed33SMarcel Moolenaar 	const char	*gpp_label;
2261d3aed33SMarcel Moolenaar 	struct g_provider *gpp_provider;
2271d3aed33SMarcel Moolenaar 	struct g_part_scheme *gpp_scheme;
2281d3aed33SMarcel Moolenaar 	quad_t		gpp_size;
2291d3aed33SMarcel Moolenaar 	quad_t		gpp_start;
2301d3aed33SMarcel Moolenaar 	const char	*gpp_type;
231d287f590SMarcel Moolenaar 	unsigned int	gpp_version;
2324d32fcb4SMarcel Moolenaar 	const void	*gpp_codeptr;
2334d32fcb4SMarcel Moolenaar 	unsigned int	gpp_codesize;
234f6aa3fccSMarcel Moolenaar 	const char	*gpp_attrib;
235e7926a37SAndrey V. Elsukov 	unsigned int	gpp_force;
236cdd2df88SDag-Erling Smørgrav 	unsigned int	gpp_skip_dsn;
2371d3aed33SMarcel Moolenaar };
2381d3aed33SMarcel Moolenaar 
2390081f96eSMarcel Moolenaar void g_part_geometry_heads(off_t, u_int, off_t *, u_int *);
2400081f96eSMarcel Moolenaar 
2414ffca444SMarcel Moolenaar int g_part_modevent(module_t, int, struct g_part_scheme *);
2424ffca444SMarcel Moolenaar 
2432006d590SEdward Tomasz Napierala extern char g_part_separator[];
2442006d590SEdward Tomasz Napierala 
2454ffca444SMarcel Moolenaar #define	G_PART_SCHEME_DECLARE(name)				\
2464ffca444SMarcel Moolenaar     static int name##_modevent(module_t mod, int tp, void *d)	\
2474ffca444SMarcel Moolenaar     {								\
2484ffca444SMarcel Moolenaar 	return (g_part_modevent(mod, tp, d));			\
2494ffca444SMarcel Moolenaar     }								\
2504ffca444SMarcel Moolenaar     static moduledata_t name##_mod = {				\
2514ffca444SMarcel Moolenaar 	#name,							\
2524ffca444SMarcel Moolenaar 	name##_modevent,					\
2534ffca444SMarcel Moolenaar 	&name##_scheme						\
2544ffca444SMarcel Moolenaar     };								\
2555284aff5SAndrey V. Elsukov     DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_ANY); \
2565284aff5SAndrey V. Elsukov     MODULE_DEPEND(name, g_part, 0, 0, 0)
2574ffca444SMarcel Moolenaar 
2581d3aed33SMarcel Moolenaar #endif /* !_GEOM_PART_H_ */
259