diff options
author | joerg <joerg@FreeBSD.org> | 1996-03-24 18:55:39 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1996-03-24 18:55:39 +0000 |
commit | 18d2a8c9e5387edcde838e92ed58f3612eae5509 (patch) | |
tree | 80feac0531a85adb4f38e22d68a6af44b6835fcb /lib/libdisk/libdisk.h | |
parent | 4f2da6c6e432a586e31d4261f9c4110e109e428a (diff) | |
download | FreeBSD-src-18d2a8c9e5387edcde838e92ed58f3612eae5509.zip FreeBSD-src-18d2a8c9e5387edcde838e92ed58f3612eae5509.tar.gz |
Make libdisk C++ aware:
- add __BEGIN_DECLS and __END_DECLS,
- add a bunch of ``const'' qualifiers all over the place,
- rename the `private' struct member into `private_data' to avoid the
clash with the C++ keyword.
Diffstat (limited to 'lib/libdisk/libdisk.h')
-rw-r--r-- | lib/libdisk/libdisk.h | 221 |
1 files changed, 113 insertions, 108 deletions
diff --git a/lib/libdisk/libdisk.h b/lib/libdisk/libdisk.h index e277f87..1473e72 100644 --- a/lib/libdisk/libdisk.h +++ b/lib/libdisk/libdisk.h @@ -1,17 +1,17 @@ /* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <phk@login.dknet.dk> 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: libdisk.h,v 1.19.2.2 1995/10/13 08:19:12 jkh Exp $ - * - */ +* ---------------------------------------------------------------------------- +* "THE BEER-WARE LICENSE" (Revision 42): +* <phk@login.dknet.dk> 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: libdisk.h,v 1.20 1995/12/07 10:33:21 peter Exp $ +* +*/ #define MAX_NO_DISKS 20 - /* Max # of disks Disk_Names() will return */ +/* Max # of disks Disk_Names() will return */ typedef enum { whole, @@ -21,10 +21,9 @@ typedef enum { extended, part, unused, - } chunk_e; - -extern char *chunk_n[]; +} chunk_e; +__BEGIN_DECLS struct disk { char *name; u_long flags; @@ -52,185 +51,190 @@ struct chunk { u_long end; char *name; char *oname; - /* Used during Fixup_Names() to avoid renaming more than - * absolutely needed. - */ + /* Used during Fixup_Names() to avoid renaming more than + * absolutely needed. + */ chunk_e type; int subtype; u_long flags; # define CHUNK_PAST_1024 1 - /* this chunk cannot be booted from because it - * extends past cylinder 1024 - */ + /* this chunk cannot be booted from because it + * extends past cylinder 1024 + */ # define CHUNK_BSD_COMPAT 2 - /* this chunk is in the BSD-compatibility, and has a - * short name too, ie wd0s4f -> wd0f - */ + /* 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 */ + /* this chunk has bad144 mapping */ # define CHUNK_ALIGN 8 - /* This chunk should be aligned */ + /* This chunk should be aligned */ # define CHUNK_IS_ROOT 16 - /* This 'part' is a rootfs, allocate 'a' */ + /* This 'part' is a rootfs, allocate 'a' */ # define CHUNK_ACTIVE 32 - /* This is the active slice in the MBR */ + /* This is the active slice in the MBR */ # define CHUNK_FORCE_ALL 64 - /* Force a dedicated disk for FreeBSD, bypassing - * all BIOS geometry considerations - */ + /* Force a dedicated disk for FreeBSD, bypassing + * all BIOS geometry considerations + */ void (*private_free)(void*); void *(*private_clone)(void*); - void *private; - /* For data private to the application, and the management - * thereof. If the functions are not provided, no storage - * management is done, Cloning will just copy the pointer - * and freeing will just forget it. - */ + void *private_data; + /* For data private to the application, and the management + * thereof. If the functions are not provided, no storage + * management is done, Cloning will just copy the pointer + * and freeing will just forget it. + */ }; +extern const char *chunk_n[]; +extern const u_char *boot1, *boot2; + struct disk * -Open_Disk(char *devname); - /* Will open the named disk, and return populated tree. - */ +Open_Disk(const 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 - */ +/* 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() - */ +/* Free a tree made with Open_Disk() or Clone_Disk() + */ void Debug_Disk(struct disk *disk); - /* Print the content of the tree to stdout - */ +/* Print the content of the tree to stdout + */ #if 0 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. - */ +/* Use a different physical geometry. Makes sense for ST506 disks only. + * The tree returned is read from the disk, using this geometry. + */ #endif void Set_Bios_Geom(struct disk *disk, u_long cyl, u_long heads, u_long sects); - /* Set the geometry the bios uses. - */ +/* Set the geometry the bios uses. + */ int Delete_Chunk(struct disk *disk, struct chunk *); - /* Free a chunk of disk_space - */ +/* Free a chunk of disk_space + */ void Collapse_Disk(struct disk *disk); - /* Experimental, do not use. - */ +/* Experimental, do not use. + */ int Collapse_Chunk(struct disk *disk, struct chunk *chunk); - /* Experimental, do not use. - */ +/* Experimental, do not use. + */ 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 - */ +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 + */ void All_FreeBSD(struct disk *d, int force_all); - /* Make one FreeBSD chunk covering the entire disk; - * if force_all is set, bypass all BIOS geometry - * considerations. - */ +/* Make one FreeBSD chunk covering the entire disk; + * if force_all is set, bypass all BIOS geometry + * considerations. + */ char * CheckRules(struct disk *); - /* Return char* to warnings about broken design rules in this disklayout - */ +/* Return char* to warnings about broken design rules in this disklayout + */ char ** Disk_Names(); - /* Return char** with all disk's names (wd0, wd1 ...). You must free - * each pointer, as well as the array by hand - */ +/* Return char** with all disk's names (wd0, wd1 ...). You must free + * each pointer, as well as the array by hand + */ void -Set_Boot_Mgr(struct disk *d, u_char *bootmgr); - /* Use this boot-manager on this disk. Gets written when Write_Disk() - * is called - */ +Set_Boot_Mgr(struct disk *d, const u_char *bootmgr); +/* Use this boot-manager on this disk. Gets written when Write_Disk() + * is called + */ void -Set_Boot_Blocks(struct disk *d, u_char *boot1, u_char *boot2); - /* Use these boot-blocks on this disk. Gets written when Write_Disk() - * is called - */ +Set_Boot_Blocks(struct disk *d, const u_char *boot1, const u_char *boot2); +/* Use these boot-blocks on this disk. Gets written when Write_Disk() + * is called + */ int Write_Disk(struct disk *d); - /* Write all the MBRs, disklabels, bootblocks and boot managers - */ +/* Write all the MBRs, disklabels, bootblocks and boot managers + */ int Cyl_Aligned(struct disk *d, u_long offset); - /* Check if offset is aligned on a cylinder according to the - * bios geometry - */ +/* Check if offset is aligned on a cylinder according to the + * bios geometry + */ u_long Next_Cyl_Aligned(struct disk *d, u_long offset); - /* Round offset up to next cylinder according to the bios-geometry - */ +/* Round offset up to next cylinder according to the bios-geometry + */ u_long Prev_Cyl_Aligned(struct disk *d, u_long offset); - /* Round offset down to previous cylinder according to the bios- - * geometry - */ +/* Round offset down to previous cylinder according to the bios- + * geometry + */ int Track_Aligned(struct disk *d, u_long offset); - /* Check if offset is aligned on a track according to the - * bios geometry - */ +/* Check if offset is aligned on a track according to the + * bios geometry + */ u_long Next_Track_Aligned(struct disk *d, u_long offset); - /* Round offset up to next track according to the bios-geometry - */ +/* Round offset up to next track according to the bios-geometry + */ u_long Prev_Track_Aligned(struct disk *d, u_long offset); - /* Check if offset is aligned on a track according to the - * bios geometry - */ +/* Check if offset is aligned on a track according to the + * bios geometry + */ struct chunk * -Create_Chunk_DWIM(struct disk *d, struct chunk *parent , u_long size, chunk_e type, int subtype, u_long flags); - /* This one creates a partition inside the given parent of the given - * size, and returns a pointer to it. The first unused chunk big - * enough is used. - */ +Create_Chunk_DWIM(struct disk *d, struct chunk *parent , u_long size, + chunk_e type, int subtype, u_long flags); +/* This one creates a partition inside the given parent of the given + * size, and returns a pointer to it. The first unused chunk big + * enough is used. + */ int -MakeDev(struct chunk *c, char *path); +MakeDev(struct chunk *c, const char *path); int -MakeDevDisk(struct disk *d,char *path); - /* Make device nodes for all chunks on this disk */ +MakeDevDisk(struct disk *d, const char *path); +/* Make device nodes for all chunks on this disk */ char * ShowChunkFlags(struct chunk *c); - /* Return string to show flags. */ +/* Return string to show flags. */ char * ChunkCanBeRoot(struct chunk *c); - /* Return NULL if chunk can be /, explanation otherwise */ +/* Return NULL if chunk can be /, explanation otherwise */ /* * Implementation details >>> DO NOT USE <<< @@ -239,15 +243,16 @@ ChunkCanBeRoot(struct chunk *c); void Debug_Chunk(struct chunk *); void Free_Chunk(struct chunk *); struct chunk * Clone_Chunk(struct chunk *); -int Add_Chunk(struct disk *, long , u_long , char *, chunk_e, int , u_long); +int Add_Chunk(struct disk *, long, u_long, const char *, chunk_e, int, u_long); void Bios_Limit_Chunk(struct chunk *, u_long); -void * read_block(int, daddr_t ); +void * read_block(int, daddr_t); void write_block(int fd, daddr_t block, void *foo); struct disklabel * read_disklabel(int, daddr_t); u_short dkcksum(struct disklabel *); -struct chunk * Find_Mother_Chunk(struct chunk *, u_long , u_long , chunk_e); -struct disk * Int_Open_Disk(char *name, u_long size); +struct chunk * Find_Mother_Chunk(struct chunk *, u_long, u_long, chunk_e); +struct disk * Int_Open_Disk(const char *name, u_long size); void Fixup_Names(struct disk *); +__END_DECLS #define dprintf printf |