Deleted Added
full compact
gpt.c (268236) gpt.c (271881)
1/*-
2 * Copyright (c) 2014 Juniper Networks, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2014 Juniper Networks, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/usr.bin/mkimg/gpt.c 268236 2014-07-03 20:31:43Z marcel $");
28__FBSDID("$FreeBSD: head/usr.bin/mkimg/gpt.c 271881 2014-09-19 23:16:02Z marcel $");
29
30#include <sys/types.h>
31#include <sys/diskmbr.h>
32#include <sys/endian.h>
33#include <sys/errno.h>
34#include <sys/gpt.h>
35#include <stddef.h>
36#include <stdint.h>

--- 111 unchanged lines hidden (view full) ---

148gpt_tblsz(void)
149{
150 u_int ents;
151
152 ents = secsz / sizeof(struct gpt_ent);
153 return ((nparts + ents - 1) / ents);
154}
155
29
30#include <sys/types.h>
31#include <sys/diskmbr.h>
32#include <sys/endian.h>
33#include <sys/errno.h>
34#include <sys/gpt.h>
35#include <stddef.h>
36#include <stdint.h>

--- 111 unchanged lines hidden (view full) ---

148gpt_tblsz(void)
149{
150 u_int ents;
151
152 ents = secsz / sizeof(struct gpt_ent);
153 return ((nparts + ents - 1) / ents);
154}
155
156static u_int
157gpt_metadata(u_int where)
156static lba_t
157gpt_metadata(u_int where, lba_t blk)
158{
158{
159 u_int secs;
160
159
161 if (where != SCHEME_META_IMG_START && where != SCHEME_META_IMG_END)
162 return (0);
163
164 secs = gpt_tblsz();
165 secs += (where == SCHEME_META_IMG_START) ? 2 : 1;
166 return (secs);
160 if (where == SCHEME_META_IMG_START || where == SCHEME_META_IMG_END) {
161 blk += gpt_tblsz();
162 blk += (where == SCHEME_META_IMG_START) ? 2 : 1;
163 }
164 return (round_block(blk));
167}
168
169static int
170gpt_write_pmbr(lba_t blks, void *bootcode)
171{
172 u_char *pmbr;
173 uint32_t secs;
174 int error;

--- 136 unchanged lines hidden ---
165}
166
167static int
168gpt_write_pmbr(lba_t blks, void *bootcode)
169{
170 u_char *pmbr;
171 uint32_t secs;
172 int error;

--- 136 unchanged lines hidden ---