2 * Copyright (c) 2007 The DragonFly Project. All rights reserved.
4 * This code is derived from software contributed to The DragonFly Project
5 * by Matthew Dillon <dillon@backplane.com>
7 * Redistribution and use in source and binary forms, with or without
8 * 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
15 * the documentation and/or other materials provided with the
17 * 3. Neither the name of The DragonFly Project nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific, prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * $DragonFly: src/sbin/newfs_hammer/newfs_hammer.h,v 1.1 2007/10/16 18:30:53 dillon Exp $
37 #include <sys/types.h>
38 #include <sys/diskslice.h>
39 #include <sys/diskmbr.h>
42 #include <vfs/hammer/hammer_alist.h>
43 #include <vfs/hammer/hammer_disk.h>
62 * These structures are used by newfs_hammer to track the filesystem
63 * buffers it constructs while building the filesystem. No attempt
64 * is made to try to make this efficient.
67 struct volume_info
*next
;
69 int64_t vol_cluster_off
;
76 struct hammer_alist_live alist
;
77 struct hammer_volume_ondisk
*ondisk
;
79 struct supercl_info
*supercl_base
;
80 struct cluster_info
*cluster_base
;
84 struct supercl_info
*next
;
88 struct volume_info
*volume
;
90 struct hammer_alist_live alist
;
91 struct hammer_supercl_ondisk
*ondisk
;
95 struct cluster_info
*next
;
99 struct supercl_info
*supercl
;
100 struct volume_info
*volume
;
102 struct hammer_alist_live alist_master
;
103 struct hammer_alist_live alist_btree
;
104 struct hammer_alist_live alist_record
;
105 struct hammer_alist_live alist_mdata
;
106 struct hammer_cluster_ondisk
*ondisk
;
108 struct buffer_info
*buffer_base
;
112 struct buffer_info
*next
;
116 struct cluster_info
*cluster
;
117 struct volume_info
*volume
;
119 struct hammer_alist_live alist
;
120 hammer_fsbuf_ondisk_t ondisk
;
123 extern struct hammer_alist_config Buf_alist_config
;
124 extern struct hammer_alist_config Vol_normal_alist_config
;
125 extern struct hammer_alist_config Vol_super_alist_config
;
126 extern struct hammer_alist_config Supercl_alist_config
;
127 extern struct hammer_alist_config Clu_master_alist_config
;
128 extern struct hammer_alist_config Clu_slave_alist_config
;
129 extern uuid_t Hammer_FSType
;
130 extern uuid_t Hammer_FSId
;
131 extern int32_t ClusterSize
;
132 extern int UsingSuperClusters
;
133 extern int NumVolumes
;
134 extern struct volume_info
*VolBase
;
136 uint32_t crc32(const void *buf
, size_t size
);
138 struct volume_info
*get_volume(int32_t vol_no
);
139 struct supercl_info
*get_supercl(struct volume_info
*vol
, int32_t scl_no
);
140 struct cluster_info
*get_cluster(struct volume_info
*vol
, int32_t clu_no
);
141 struct buffer_info
*get_buffer(struct cluster_info
*cl
, int32_t buf_no
,
143 void *alloc_btree_element(struct cluster_info
*cluster
, int32_t *offp
);
144 void *alloc_data_element(struct cluster_info
*cluster
,
145 int32_t bytes
, int32_t *offp
);
146 void *alloc_record_element(struct cluster_info
*cluster
, int32_t *offp
);
148 void flush_all_volumes(void);
149 void flush_volume(struct volume_info
*vol
);
150 void flush_supercl(struct supercl_info
*supercl
);
151 void flush_cluster(struct cluster_info
*cl
);
152 void flush_buffer(struct buffer_info
*buf
);
154 void hammer_super_alist_template(struct hammer_alist_config
*conf
);
155 void hammer_buffer_alist_template(struct hammer_alist_config
*conf
);