Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / pdisk / partition_map.h
blobb9c96a9c5e42842cb4c2384fff8e1d7019f1e24e
1 //
2 // partition_map.h - partition map routines
3 //
4 // Written by Eryk Vershen
5 //
7 /*
8 * Copyright 1996,1998 by Apple Computer, Inc.
9 * All Rights Reserved
11 * Permission to use, copy, modify, and distribute this software and
12 * its documentation for any purpose and without fee is hereby granted,
13 * provided that the above copyright notice appears in all copies and
14 * that both the copyright notice and this permission notice appear in
15 * supporting documentation.
17 * APPLE COMPUTER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
18 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
19 * FOR A PARTICULAR PURPOSE.
21 * IN NO EVENT SHALL APPLE COMPUTER BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
22 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
23 * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
24 * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
25 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
28 #ifndef __partition_map__
29 #define __partition_map__
31 #include "dpme.h"
32 #include "media.h"
36 // Defines
38 #define PBLOCK_SIZE 512
39 #define MAX_LINUX_MAP 15
43 // Types
45 struct partition_map_header {
46 MEDIA m;
47 char *name;
48 struct partition_map * disk_order;
49 struct partition_map * base_order;
50 Block0 *misc;
51 int writable;
52 int changed;
53 int written;
54 int physical_block; // must be == sbBlockSize
55 int logical_block; // must be <= physical_block
56 int blocks_in_map;
57 int maximum_in_map;
58 unsigned long media_size; // in logical_blocks
60 typedef struct partition_map_header partition_map_header;
62 struct partition_map {
63 struct partition_map * next_on_disk;
64 struct partition_map * prev_on_disk;
65 struct partition_map * next_by_base;
66 struct partition_map * prev_by_base;
67 long disk_address;
68 struct partition_map_header * the_map;
69 int contains_driver;
70 DPME *data;
71 int HFS_kind;
72 char *HFS_name;
74 typedef struct partition_map partition_map;
76 /* Identifies the HFS kind. */
77 enum {
78 kHFS_not = 0, // ' '
79 kHFS_std = 1, // 'h'
80 kHFS_embed = 2, // 'e'
81 kHFS_plus = 3 // '+'
86 // Global Constants
88 extern const char * kFreeType;
89 extern const char * kMapType;
90 extern const char * kUnixType;
91 extern const char * kHFSType;
92 extern const char * kFreeName;
93 extern const char * kPatchType;
97 // Global Variables
99 extern int rflag;
100 extern int interactive;
101 extern int dflag;
105 // Forward declarations
107 int add_partition_to_map(const char *name, const char *dptype, u32 base, u32 length, partition_map_header *map);
108 void close_partition_map(partition_map_header *map);
109 partition_map_header* create_partition_map(char *name, partition_map_header *oldmap);
110 void delete_partition_from_map(partition_map *entry);
111 partition_map* find_entry_by_disk_address(long, partition_map_header *);
112 partition_map* find_entry_by_type(const char *type_name, partition_map_header *map);
113 partition_map* find_entry_by_base(u32 base, partition_map_header *map);
114 partition_map_header* init_partition_map(char *name, partition_map_header* oldmap);
115 void move_entry_in_map(long, long, partition_map_header *);
116 partition_map_header* open_partition_map(char *name, int *valid_file, int ask_logical_size);
117 void resize_map(unsigned long new_size, partition_map_header *map);
118 void write_partition_map(partition_map_header *map);
119 void bzb_init_slice(BZB *bp, int slice);
120 void dpme_init_flags(DPME *data);
122 #endif /* __partition_map__ */