Project

General

Profile

0003-disklabel64-8-Clean-up-unused-definitions-and-variab.patch

liweitianux, 11/08/2017 07:07 AM

Download (3.98 KB)

View differences:

sbin/disklabel64/disklabel64.c
1 1
/*
2 2
 * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
3
 * 
3
 *
4 4
 * This code is derived from software contributed to The DragonFly Project
5 5
 * by Matthew Dillon <dillon@backplane.com>
6
 * 
6
 *
7 7
 * Redistribution and use in source and binary forms, with or without
8 8
 * modification, are permitted provided that the following conditions
9 9
 * are met:
10
 * 
10
 *
11 11
 * 1. Redistributions of source code must retain the above copyright
12 12
 *    notice, this list of conditions and the following disclaimer.
13 13
 * 2. Redistributions in binary form must reproduce the above copyright
......
17 17
 * 3. Neither the name of The DragonFly Project nor the names of its
18 18
 *    contributors may be used to endorse or promote products derived
19 19
 *    from this software without specific, prior written permission.
20
 * 
20
 *
21 21
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 22
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 23
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
......
98 98

  
99 99
extern uint32_t crc32(const void *buf, size_t size);
100 100

  
101
/*
102
 * Disklabel64: read and write 64 bit disklabels.
103
 * The label is usually placed on one of the first sectors of the disk.
104
 * Many machines also place a bootstrap in the same area,
105
 * in which case the label is embedded in the bootstrap.
106
 * The bootstrap source must leave space at the proper offset
107
 * for the label on such machines.
108
 */
109

  
110
#define LABELSIZE	((sizeof(struct disklabel64) + 4095) & ~4095)
111
#define BOOTSIZE	32768
112

  
113
/* FIX!  These are too low, but are traditional */
114
#define DEFAULT_NEWFS_BLOCK  8192U
115
#define DEFAULT_NEWFS_FRAG   1024U
116
#define DEFAULT_NEWFS_CPG    16U
117

  
118
#define BIG_NEWFS_BLOCK  16384U
119
#define BIG_NEWFS_FRAG   2048U
120
#define BIG_NEWFS_CPG    64U
121

  
122 101
void	makelabel(const char *, const char *, struct disklabel64 *);
123 102
int	writelabel(int, struct disklabel64 *);
124 103
void	l_perror(const char *);
......
168 147
int	rflag;
169 148
int	Vflag;
170 149
int	disable_write;   /* set to disable writing to disk label */
171
u_int32_t slice_start_lba;
172 150

  
173 151
#ifdef DEBUG
174 152
int	debug;
......
440 418
				      sizeof(*lp) -
441 419
				      offsetof(struct disklabel64, d_magic));
442 420
			}
443
			
421

  
444 422
			/*
445 423
			 * write enable label sector before write
446 424
			 * (if necessary), disable after writing.
......
1303 1281

  
1304 1282
				size = pp->p_bsize;
1305 1283
				if (part_size_type[i] == '%') {
1306
					/* 
1284
					/*
1307 1285
					 * don't count %'s yet
1308 1286
					 */
1309 1287
					total_percent += size;
......
1379 1357
				seen_default_offset = 1;
1380 1358
			} else {
1381 1359
				/* allow them to be out of order for old-style tables */
1382
				if (pp->p_boffset < current_offset && 
1360
				if (pp->p_boffset < current_offset &&
1383 1361
				    seen_default_offset &&
1384 1362
				    pp->p_fstype != FS_VINUM) {
1385 1363
					fprintf(stderr,
......
1392 1370
					errors++;
1393 1371
				} else if (pp->p_boffset != current_offset &&
1394 1372
					   seen_default_offset) {
1395
					/* 
1396
					 * this may give unneeded warnings if 
1373
					/*
1374
					 * this may give unneeded warnings if
1397 1375
					 * partitions are out-of-order
1398 1376
					 */
1399 1377
					Warning(
......
1402 1380
					    (intmax_t)current_offset);
1403 1381
				}
1404 1382
			}
1405
			current_offset = pp->p_boffset + pp->p_bsize; 
1383
			current_offset = pp->p_boffset + pp->p_bsize;
1406 1384
		}
1407 1385
	}
1408 1386

  
1409
-