2 .\" Copyright (c) 1996 Joerg Wunsch
4 .\" All rights reserved.
6 .\" This program is free software.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
17 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
18 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
21 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
50 .Nm Next_Cyl_Aligned ,
51 .Nm Prev_Cyl_Aligned ,
53 .Nm Next_Track_Aligned ,
54 .Nm Prev_Track_Aligned ,
55 .Nm Create_Chunk_DWIM ,
62 .Nd library interface to slice and partition labels
69 .Vt extern const char *chunk_n[] ;
71 .Fn slice_type_name "int type" "int subtype"
73 .Fn Open_Disk "const char *devname"
75 .Fn Clone_Disk "struct disk *disk"
77 .Fn Free_Disk "struct disk *disk"
79 .Fn Debug_Disk "struct disk *disk"
81 .Fn Set_Bios_Geom "struct disk *disk" "u_long cyl" "u_long heads" "u_long sects"
83 .Fn Delete_Chunk "struct disk *disk" "struct chunk *"
85 .Fn Collapse_Disk "struct disk *disk"
87 .Fn Collapse_Chunk "struct disk *disk" "struct chunk *chunk"
89 .Fn Create_Chunk "struct disk *disk" "u_long offset" "u_long size" "chunk_e type" "int subtype" "u_long flags"
91 .Fn All_FreeBSD "struct disk *d" "int force_all"
93 .Fn CheckRules "struct disk *"
97 .Fn Set_Boot_Mgr "struct disk *d" "const u_char *bootmgr" "const size_t bootmgr_size"
99 .Fn Set_Boot_Blocks "struct disk *d" "const u_char *boot1" "const u_char *boot2"
101 .Fn Write_Disk "struct disk *d"
103 .Fn Cyl_Aligned "struct disk *d" "u_long offset"
105 .Fn Next_Cyl_Aligned "struct disk *d" "u_long offset"
107 .Fn Prev_Cyl_Aligned "struct disk *d" "u_long offset"
109 .Fn Track_Aligned "struct disk *d" "u_long offset"
111 .Fn Next_Track_Aligned "struct disk *d" "u_long offset"
113 .Fn Prev_Track_Aligned "struct disk *d" "u_long offset"
115 .Fn Create_Chunk_DWIM "struct disk *d" "struct chunk *parent" "u_long size" "chunk_e type" "int subtype" "u_long flags"
117 .Fn MakeDev "struct chunk *c" "const char *path"
119 .Fn MakeDevDisk "struct disk *d" "const char *path"
121 .Fn ShowChunkFlags "struct chunk *c"
123 .Fn ChunkCanBeRoot "struct chunk *c"
126 provides an interface to the low-level disk slice and partition labels.
127 Most functions operate with arguments of the types
132 While both types are mostly opaque to the programmer, the internal
133 structure is mentioned below for the sake of completeness.
134 .Bd -literal -offset indent
144 struct chunk *chunks;
148 The only flag value by now is
150 meaning that this disk is handled by the On-Track Disk Manager.
152 .Bd -literal -offset indent
165 void (*private_free)(void*);
166 void *(*private_clone)(void*);
172 field can be one of the following values:
173 .Ql whole, unknown, fat, freebsd, extended, part, unused .
179 .Bl -tag -offset indent -width CHUNK_BSD_COMPATXX
181 This chunk cannot be booted from because it extends past cylinder 1024.
184 .Bx Ns -compatibility ,
185 and has a short name too, i.e.\&
188 This chunk should be aligned.
192 is a rootfs, allocate partition
195 This is the active slice in the MBR.
197 Force a dedicated disk for
199 bypassing all BIOS geometry considerations.
207 fields are for data private to the application, and the management
208 thereof. If the functions are not provided, no storage management is
209 done, cloning will just copy the pointer and freeing will just forget
213 will open the named disk, and return populated tree.
216 clones a copy of a tree. Useful for
221 frees a tree made with
227 prints the content of the tree to stdout.
230 sets the geometry the bios uses.
233 frees a chunk of disk_space.
238 are experimental, do not use.
241 creates a chunk with the specified parameters.
246 chunk covering the entire disk; if
248 is set, bypass all BIOS geometry considerations.
253 to warnings about broken design rules in this disklayout.
258 with all disk's names (wd0, wd1 ...). You must free each pointer, as
259 well as the array by hand.
262 sets this boot-manager for use on this disk. Gets written when
267 sets the boot-blocks for use on this disk. Gets written when
272 writes all the MBRs, disklabels, bootblocks and boot managers.
277 is aligned on a cylinder according to the BIOS geometry.
282 up to next cylinder according to the BIOS geometry.
287 down to previous cylinder according to the BIOS geometry.
292 is aligned on a track according to the BIOS geometry.
294 .Fn Next_Track_Aligned
297 up to next track according to the BIOS geometry.
299 .Fn Prev_Track_Aligned
302 is aligned on a track according to the BIOS geometry.
304 .Fn Create_Chunk_DWIM
305 creates a partition inside the given parent of the given size, and
306 returns a pointer to it. The first unused chunk big enough is used.
309 makes the device nodes for this chunk.
312 makes the device nodes for all chunks on this disk.
315 returns a string to show flags.
318 returns NULL if chunk can be
321 Chunk name strings can be accessed directly using the external array
325 returns the name strings associated with the specified
330 returns "unknown" for slices it isn't familiar with.
335 library was written by
336 .An Poul-Henning Kamp .
338 This manual page was written by