From f7bf327ed4f468193062d32f7b6bb2cc4b521e9b Mon Sep 17 00:00:00 2001 From: phk Date: Sat, 29 Apr 1995 01:55:25 +0000 Subject: Sanitize and explain a little bit... Implement the first rules... --- lib/libdisk/libdisk.h | 105 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 80 insertions(+), 25 deletions(-) (limited to 'lib/libdisk/libdisk.h') diff --git a/lib/libdisk/libdisk.h b/lib/libdisk/libdisk.h index 04c5a2f..2946f90 100644 --- a/lib/libdisk/libdisk.h +++ b/lib/libdisk/libdisk.h @@ -1,13 +1,25 @@ +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp + * ---------------------------------------------------------------------------- + * + * $Id$ + * + */ typedef enum {whole, foo, fat, freebsd, extended, part, unused, reserved} chunk_e; + #define CHAR_N static char *chunk_n[] = { \ "whole","foo","fat","freebsd","extended","part","unused","reserved"}; struct disk { char *name; u_long flags; -#define DISK_ON_TRACK 1 -#define DISK_REAL_GEOM 2 +# define DISK_ON_TRACK 1 +# define DISK_REAL_GEOM 2 u_long real_cyl; u_long real_hd; u_long real_sect; @@ -26,36 +38,79 @@ struct chunk { char *name; chunk_e type; int subtype; -#define SUBTYPE_BSD_FS 1 -#define SUBTYPE_BSD_SWAP 2 -#define SUBTYPE_BSD_UNUSED 3 +# define SUBTYPE_BSD_FS 1 +# define SUBTYPE_BSD_SWAP 2 +# define SUBTYPE_BSD_UNUSED 3 u_long flags; -#define CHUNK_PAST_1024 1 - /* this chunk cannot be booted from */ -#define CHUNK_BSD_COMPAT 2 - /* this chunk is in the BSD-compatibility, and has a short name - * too, ie wd0s4f -> wd0f - */ -#define CHUNK_BAD144 4 - /* this chunk has bad144 mapping */ -#define CHUNK_ALIGN 8 +# define CHUNK_PAST_1024 1 + /* this chunk cannot be booted from */ +# define CHUNK_BSD_COMPAT 2 + /* this chunk is in the BSD-compatibility, and has a + * short name too, ie wd0s4f -> wd0f + */ +# define CHUNK_BAD144 4 + /* this chunk has bad144 mapping */ +# define CHUNK_ALIGN 8 }; -struct disk *Open_Disk(char *devname); -void Free_Disk(struct disk *disk); -void Debug_Disk(struct disk *disk); -struct disk *Clone_Disk(struct disk *disk); +struct disk * +Open_Disk(char *devname); + /* Will open the named disk, and return populated tree. + */ + +struct disk * +Clone_Disk(struct disk *disk); + /* Clone a copy of a tree. Useful for "Undo" functionality + */ + +void +Free_Disk(struct disk *disk); + /* Free a tree made with Open_Disk() or Clone_Disk() + */ + +void +Debug_Disk(struct disk *disk); + /* Print the content of the tree to stdout + */ + +struct disk * +Set_Phys_Geom(struct disk *disk, u_long cyl, u_long heads, u_long sects); + /* Use a different physical geometry. Makes sense for ST506 disks only. + * The tree returned is read from the disk, using this geometry. + */ + +void +Set_Bios_Geom(struct disk *disk, u_long cyl, u_long heads, u_long sects); + /* Set the geometry the bios uses. + */ + +int +Delete_Chunk(struct disk *disk, struct chunk *); + /* Free a chunk of disk_space + */ -struct disk *Set_Phys_Geom(struct disk *disk, u_long cyl, u_long heads, u_long sects); -void Set_Bios_Geom(struct disk *disk, u_long cyl, u_long heads, u_long sects); +void +Collapse_Disk(struct disk *disk); + /* Experimental, do not use. + */ +int +Collapse_Chunk(struct disk *disk, struct chunk *chunk); + /* Experimental, do not use. + */ -int Delete_Chunk(struct disk *disk, u_long offset, u_long end, chunk_e type); -void Collapse_Disk(struct disk *disk); -int Collapse_Chunk(struct disk *disk, struct chunk *chunk); +int +Create_Chunk(struct disk *disk, u_long offset, u_long size, chunk_e type, int subtype, u_long flags); + /* Create a chunk with the specified paramters + */ -int Create_Chunk(struct disk *disk, u_long offset, u_long size, chunk_e type, int subtype, u_long flags); +char * +CheckRules(struct disk *); + /* Return char* to warnings about broken design rules in this disklayout + */ -/* Implementation details */ +/* + * Implementation details >>> DO NOT USE <<< + */ struct disk *Int_Open_Disk(char *devname, u_long maxsize); -- cgit v1.1