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.
28 .\" $FreeBSD: src/lib/libdisk/libdisk.3,v 1.11.2.10 2001/12/17 10:08:29 ru Exp $
29 .\" $DragonFly: src/lib/libdisk/Attic/libdisk.3,v 1.3 2004/03/11 12:28:52 hmp Exp $
51 .Nm Next_Cyl_Aligned ,
52 .Nm Prev_Cyl_Aligned ,
54 .Nm Next_Track_Aligned ,
55 .Nm Prev_Track_Aligned ,
56 .Nm Create_Chunk_DWIM ,
63 .Nd library interface to slice and partition labels
70 .Vt extern const char *chunk_n[] ;
72 .Fn slice_type_name "int type" "int subtype"
74 .Fn Open_Disk "const char *devname"
76 .Fn Clone_Disk "struct disk *disk"
78 .Fn Free_Disk "struct disk *disk"
80 .Fn Debug_Disk "struct disk *disk"
82 .Fn Set_Bios_Geom "struct disk *disk" "u_long cyl" "u_long heads" "u_long sects"
84 .Fn Delete_Chunk "struct disk *disk" "struct chunk *"
86 .Fn Collapse_Disk "struct disk *disk"
88 .Fn Collapse_Chunk "struct disk *disk" "struct chunk *chunk"
90 .Fn Create_Chunk "struct disk *disk" "u_long offset" "u_long size" "chunk_e type" "int subtype" "u_long flags"
92 .Fn All_FreeBSD "struct disk *d" "int force_all"
94 .Fn CheckRules "struct disk *"
98 .Fn Set_Boot_Mgr "struct disk *d" "const u_char *bootmgr" "const size_t bootmgr_size"
100 .Fn Set_Boot_Blocks "struct disk *d" "const u_char *boot1" "const u_char *boot2"
102 .Fn Write_Disk "struct disk *d"
104 .Fn Cyl_Aligned "struct disk *d" "u_long offset"
106 .Fn Next_Cyl_Aligned "struct disk *d" "u_long offset"
108 .Fn Prev_Cyl_Aligned "struct disk *d" "u_long offset"
110 .Fn Track_Aligned "struct disk *d" "u_long offset"
112 .Fn Next_Track_Aligned "struct disk *d" "u_long offset"
114 .Fn Prev_Track_Aligned "struct disk *d" "u_long offset"
116 .Fn Create_Chunk_DWIM "struct disk *d" "struct chunk *parent" "u_long size" "chunk_e type" "int subtype" "u_long flags"
118 .Fn MakeDev "struct chunk *c" "const char *path"
120 .Fn MakeDevDisk "struct disk *d" "const char *path"
122 .Fn ShowChunkFlags "struct chunk *c"
124 .Fn ChunkCanBeRoot "struct chunk *c"
127 provides an interface to the low-level disk slice and partition labels.
128 Most functions operate with arguments of the types
133 While both types are mostly opaque to the programmer, the internal
134 structure is mentioned below for the sake of completeness.
135 .Bd -literal -offset indent
145 struct chunk *chunks;
149 The only flag value by now is
151 meaning that this disk is handled by the On-Track Disk Manager.
153 .Bd -literal -offset indent
166 void (*private_free)(void*);
167 void *(*private_clone)(void*);
173 field can be one of the following values:
174 .Ql whole, unknown, fat, freebsd, extended, part, unused .
180 .Bl -tag -offset indent -width CHUNK_BSD_COMPATXX
182 This chunk cannot be booted from because it extends past cylinder 1024.
185 .Bx Ns -compatibility ,
186 and has a short name too, i.e.\&
189 This chunk should be aligned.
193 is a rootfs, allocate partition
196 This is the active slice in the MBR.
198 Force a dedicated disk for
200 bypassing all BIOS geometry considerations.
208 fields are for data private to the application, and the management
209 thereof. If the functions are not provided, no storage management is
210 done, cloning will just copy the pointer and freeing will just forget
214 will open the named disk, and return populated tree.
217 clones a copy of a tree. Useful for
222 frees a tree made with
228 prints the content of the tree to stdout.
231 sets the geometry the bios uses.
234 frees a chunk of disk_space.
239 are experimental, do not use.
242 creates a chunk with the specified parameters.
247 chunk covering the entire disk; if
249 is set, bypass all BIOS geometry considerations.
254 to warnings about broken design rules in this disklayout.
259 with all disk's names (wd0, wd1 ...). You must free each pointer, as
260 well as the array by hand.
263 sets this boot-manager for use on this disk. Gets written when
268 sets the boot-blocks for use on this disk. Gets written when
273 writes all the MBRs, disklabels, bootblocks and boot managers.
278 is aligned on a cylinder according to the BIOS geometry.
283 up to next cylinder according to the BIOS geometry.
288 down to previous cylinder according to the BIOS geometry.
293 is aligned on a track according to the BIOS geometry.
295 .Fn Next_Track_Aligned
298 up to next track according to the BIOS geometry.
300 .Fn Prev_Track_Aligned
303 is aligned on a track according to the BIOS geometry.
305 .Fn Create_Chunk_DWIM
306 creates a partition inside the given parent of the given size, and
307 returns a pointer to it. The first unused chunk big enough is used.
310 makes the device nodes for this chunk.
313 makes the device nodes for all chunks on this disk.
316 returns a string to show flags.
319 returns NULL if chunk can be
322 Chunk name strings can be accessed directly using the external array
326 returns the name strings associated with the specified
331 returns "unknown" for slices it isn't familiar with.
336 library was written by
337 .An Poul-Henning Kamp .
339 This manual page was written by