summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorkuriyama <kuriyama@FreeBSD.org>2004-03-30 01:39:00 +0000
committerkuriyama <kuriyama@FreeBSD.org>2004-03-30 01:39:00 +0000
commit235cde4aca9550787d8ee19043ccf8472f4843ff (patch)
tree895afcef15d437786d0e970b9e3f4f554dedf20d /lib
parent7957bc47f658a1655bbf5ca4d9c750aa8bfd4c9b (diff)
downloadFreeBSD-src-235cde4aca9550787d8ee19043ccf8472f4843ff.zip
FreeBSD-src-235cde4aca9550787d8ee19043ccf8472f4843ff.tar.gz
Make libdisk WARNS=4 clean.
Glanced by: jhb
Diffstat (limited to 'lib')
-rw-r--r--lib/libdisk/Makefile2
-rw-r--r--lib/libdisk/disk.c4
-rw-r--r--lib/libdisk/libdisk.h1
-rw-r--r--lib/libdisk/open_disk.c12
-rw-r--r--lib/libdisk/rules.c8
-rw-r--r--lib/libdisk/write_i386_disk.c30
6 files changed, 31 insertions, 26 deletions
diff --git a/lib/libdisk/Makefile b/lib/libdisk/Makefile
index a978634..250e41f 100644
--- a/lib/libdisk/Makefile
+++ b/lib/libdisk/Makefile
@@ -12,7 +12,7 @@ SRCS= blocks.c ${_change} chunk.c create_chunk.c disk.c ${_open_disk} \
rules.c write_disk.c write_${MACHINE}_disk.c
INCS= libdisk.h
-WARNS?= 2
+WARNS?= 4
CFLAGS+= -I${.CURDIR}/../../sys/geom
diff --git a/lib/libdisk/disk.c b/lib/libdisk/disk.c
index 42eea97..8a60191 100644
--- a/lib/libdisk/disk.c
+++ b/lib/libdisk/disk.c
@@ -173,8 +173,8 @@ Collapse_Disk(struct disk *d)
static int
qstrcmp(const void* a, const void* b)
{
- char *str1 = *(char**)a;
- char *str2 = *(char**)b;
+ const char *str1 = *(char* const*)a;
+ const char *str2 = *(char* const*)b;
return strcmp(str1, str2);
}
diff --git a/lib/libdisk/libdisk.h b/lib/libdisk/libdisk.h
index 32ae5e7..891007a 100644
--- a/lib/libdisk/libdisk.h
+++ b/lib/libdisk/libdisk.h
@@ -273,6 +273,7 @@ struct disklabel;
void Fill_Disklabel(struct disklabel *, const struct disk *,
const struct chunk *);
void Debug_Chunk(struct chunk *);
+struct chunk *New_Chunk(void);
void Free_Chunk(struct chunk *);
struct chunk *Clone_Chunk(const struct chunk *);
int Add_Chunk(struct disk *, daddr_t, daddr_t, const char *, chunk_e, int,
diff --git a/lib/libdisk/open_disk.c b/lib/libdisk/open_disk.c
index b0d4ac7..b3a99f8 100644
--- a/lib/libdisk/open_disk.c
+++ b/lib/libdisk/open_disk.c
@@ -95,8 +95,9 @@ Int_Open_Disk(const char *name, char *conftxt)
d->sector_size = s;
len /= s; /* media size in number of sectors. */
- if (Add_Chunk(d, 0, len, name, whole, 0, 0, "-"))
+ if (Add_Chunk(d, 0, len, name, whole, 0, 0, "-")) {
DPRINT(("Failed to add 'whole' chunk"));
+ }
for (;;) {
a = strsep(&p, " ");
@@ -191,14 +192,16 @@ Int_Open_Disk(const char *name, char *conftxt)
o = d->chunks->size / (hd * sc);
o *= (hd * sc);
o -= alt * hd * sc;
- if (Add_Chunk(d, 0, o, name, freebsd, 0, 0, "-"))
+ if (Add_Chunk(d, 0, o, name, freebsd, 0, 0, "-")) {
DPRINT(("Failed to add 'freebsd' chunk"));
+ }
}
if (platform == p_alpha && !strcmp(t, "BSD") &&
d->chunks->part->part == NULL) {
if (Add_Chunk(d, 0, d->chunks->size, name, freebsd,
- 0, 0, "-"))
+ 0, 0, "-")) {
DPRINT(("Failed to add 'freebsd' chunk"));
+ }
}
if (!strcmp(t, "BSD") && i == RAW_PART)
continue;
@@ -268,8 +271,9 @@ Int_Open_Disk(const char *name, char *conftxt)
o = d->chunks->size / (hd * sc);
o *= (hd * sc);
o -= 2 * hd * sc;
- if (Add_Chunk(d, 0, o, name, freebsd, 0, 0, "-"))
+ if (Add_Chunk(d, 0, o, name, freebsd, 0, 0, "-")) {
DPRINT(("Failed to add 'freebsd' chunk"));
+ }
}
/* PLATFORM POLICY END --------------------------------------- */
diff --git a/lib/libdisk/rules.c b/lib/libdisk/rules.c
index 6c7f315..1f12f4c 100644
--- a/lib/libdisk/rules.c
+++ b/lib/libdisk/rules.c
@@ -103,7 +103,7 @@ Next_Cyl_Aligned(const struct disk *d, daddr_t offset)
* Only one of them can have the "active" flag
*/
static void
-Rule_000(const struct disk *d, const struct chunk *c, char *msg)
+Rule_000(__unused const struct disk *d, const struct chunk *c, char *msg)
{
#ifdef PC98
int i = 0;
@@ -180,7 +180,7 @@ Rule_001(const struct disk *d, const struct chunk *c, char *msg)
* Max one 'fat' as child of 'whole'
*/
static void
-Rule_002(const struct disk *d, const struct chunk *c, char *msg)
+Rule_002(__unused const struct disk *d, const struct chunk *c, char *msg)
{
int i;
struct chunk *c1;
@@ -203,7 +203,7 @@ Rule_002(const struct disk *d, const struct chunk *c, char *msg)
* Max one extended as child of 'whole'
*/
static void
-Rule_003(const struct disk *d, const struct chunk *c, char *msg)
+Rule_003(__unused const struct disk *d, const struct chunk *c, char *msg)
{
int i;
struct chunk *c1;
@@ -227,7 +227,7 @@ Rule_003(const struct disk *d, const struct chunk *c, char *msg)
* Max one CHUNK_IS_ROOT child per 'freebsd'
*/
static void
-Rule_004(const struct disk *d, const struct chunk *c, char *msg)
+Rule_004(__unused const struct disk *d, const struct chunk *c, char *msg)
{
int i = 0, k = 0;
struct chunk *c1;
diff --git a/lib/libdisk/write_i386_disk.c b/lib/libdisk/write_i386_disk.c
index f409ae4..e0cac80 100644
--- a/lib/libdisk/write_i386_disk.c
+++ b/lib/libdisk/write_i386_disk.c
@@ -69,14 +69,14 @@ Write_Int32(u_int32_t *p, u_int32_t v)
* Special install-time configuration for the i386 boot0 boot manager.
*/
static void
-Cfg_Boot_Mgr(u_char *mbr, int edd)
+Cfg_Boot_Mgr(u_char *mbrblk, int edd)
{
- if (mbr[0x1b0] == 0x66 && mbr[0x1b1] == 0xbb) {
+ if (mbrblk[0x1b0] == 0x66 && mbrblk[0x1b1] == 0xbb) {
if (edd)
- mbr[0x1bb] |= 0x80; /* Packet mode on */
+ mbrblk[0x1bb] |= 0x80; /* Packet mode on */
else
- mbr[0x1bb] &= 0x7f; /* Packet mode off */
+ mbrblk[0x1bb] &= 0x7f; /* Packet mode off */
}
}
@@ -88,7 +88,7 @@ Write_Disk(const struct disk *d1)
struct chunk *c1;
int ret = 0;
char device[64];
- u_char *mbr;
+ u_char *mbrblk;
struct dos_partition *dp,work[NDOSPART];
int s[4];
int need_edd = 0; /* Need EDD (packet interface) */
@@ -101,11 +101,11 @@ Write_Disk(const struct disk *d1)
return 1;
memset(s, 0, sizeof s);
- mbr = read_block(fd, 0, d1->sector_size);
- dp = (struct dos_partition *)(mbr + DOSPARTOFF);
+ mbrblk = read_block(fd, 0, d1->sector_size);
+ dp = (struct dos_partition *)(mbrblk + DOSPARTOFF);
memcpy(work, dp, sizeof work);
dp = work;
- free(mbr);
+ free(mbrblk);
for (c1 = d1->chunks->part; c1; c1 = c1->next) {
if (c1->type == unused)
continue;
@@ -178,15 +178,15 @@ Write_Disk(const struct disk *d1)
if (dp[i].dp_typ == 0xa5)
dp[i].dp_flag = 0x80;
- mbr = read_block(fd, 0, d1->sector_size);
+ mbrblk = read_block(fd, 0, d1->sector_size);
if (d1->bootmgr) {
- memcpy(mbr, d1->bootmgr, DOSPARTOFF);
- Cfg_Boot_Mgr(mbr, need_edd);
+ memcpy(mbrblk, d1->bootmgr, DOSPARTOFF);
+ Cfg_Boot_Mgr(mbrblk, need_edd);
}
- memcpy(mbr + DOSPARTOFF, dp, sizeof *dp * NDOSPART);
- mbr[512-2] = 0x55;
- mbr[512-1] = 0xaa;
- write_block(fd, 0, mbr, d1->sector_size);
+ memcpy(mbrblk + DOSPARTOFF, dp, sizeof *dp * NDOSPART);
+ mbrblk[512-2] = 0x55;
+ mbrblk[512-1] = 0xaa;
+ write_block(fd, 0, mbrblk, d1->sector_size);
if (d1->bootmgr && d1->bootmgr_size > d1->sector_size)
for (i = 1; i * d1->sector_size <= d1->bootmgr_size; i++)
write_block(fd, i, &d1->bootmgr[i * d1->sector_size],
OpenPOWER on IntegriCloud