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
64 .Fd #include <sys/types.h>
65 .Fd #include <libdisk.h>
66 .\" What is the correct way to cause a single line break ???
68 .Dv 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"
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;
147 The only flag value by now is
149 meaning that this disk is handled by the On-Track Disk Manager.
151 .Bd -literal -offset indent
164 void (*private_free)(void*);
165 void *(*private_clone)(void*);
171 field can be one of the following values:
172 .Ql whole, unknown, fat, freebsd, extended, part, unused .
178 .Bl -tag -offset indent -width CHUNK_BSD_COMPATXX
180 This chunk cannot be booted from because it extends past cylinder 1024.
182 This chunk is in the BSD-compatibility, and has a short name too, i.e.
185 This chunk has bad144 mapping.
187 This chunk should be aligned.
191 is a rootfs, allocate partition
194 This is the active slice in the MBR.
196 Force a dedicated disk for FreeBSD, bypassing all BIOS geometry
205 fields are for data private to the application, and the management
206 thereof. If the functions are not provided, no storage management is
207 done, cloning will just copy the pointer and freeing will just forget
211 will open the named disk, and return populated tree.
214 clones a copy of a tree. Useful for
219 frees a tree made with
225 prints the content of the tree to stdout.
228 sets the geometry the bios uses.
231 frees a chunk of disk_space.
236 are experimental, do not use.
239 creates a chunk with the specified parameters.
242 makes one FreeBSD chunk covering the entire disk; if
244 is set, bypass all BIOS geometry considerations.
249 to warnings about broken design rules in this disklayout.
254 with all disk's names (wd0, wd1 ...). You must free each pointer, as
255 well as the array by hand.
258 sets this boot-manager for use on this disk. Gets written when
263 sets the boot-blocks for use on this disk. Gets written when
268 writes all the MBRs, disklabels, bootblocks and boot managers.
273 is aligned on a cylinder according to the BIOS.
279 up to next cylinder according to the BIOS geometry.
284 down to previous cylinder according to the BIOS geometry.
289 is aligned on a track according to the BIOS geometry.
291 .Fn Next_Track_Aligned
294 up to next track according to the BIOS geometry.
296 .Fn Prev_Track_Aligned
299 is aligned on a track according to the BIOS geometry.
301 .Fn Create_Chunk_DWIM
302 creates a partition inside the given parent of the given size, and
303 returns a pointer to it. The first unused chunk big enough is used.
306 makes the device nodes for this chunk.
309 makes the device nodes for all chunks on this disk.
312 returns a string to show flags.
315 returns NULL if chunk can be
317 Chunk name strings can be accessed directly using the external array
321 returns the name strings associated with the specified
326 returns "unknown" for slices it isn't familiar with.
331 .An Poul-Henning Kamp .
334 .ie t J\(:org Wunsch.