summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorlukem <lukem@NetBSD.org>2009-03-16 00:08:10 +0000
committerlukem <lukem@NetBSD.org>2009-03-16 00:08:10 +0000
commitbb15c5ac367efc3d0ecfee1e134b77b17e7ae055 (patch)
tree67ae5ae83f005c6a6230d7fdc3d03853d38dd28f /libexec
parentf3479fb8e498069896cfa4988676ab6df2d71329 (diff)
fix WARNS=3 issues;
* sprinkle const * avoid tests < 0 on unsigned types * test fwrite() returns nmemb not <0
Diffstat (limited to 'libexec')
-rw-r--r--libexec/lfs_cleanerd/cleaner.h2
-rw-r--r--libexec/lfs_cleanerd/coalesce.c6
-rw-r--r--libexec/lfs_cleanerd/lfs_cleanerd.c20
3 files changed, 15 insertions, 13 deletions
diff --git a/libexec/lfs_cleanerd/cleaner.h b/libexec/lfs_cleanerd/cleaner.h
index 3dab72f1ebe..7404fa5dc7b 100644
--- a/libexec/lfs_cleanerd/cleaner.h
+++ b/libexec/lfs_cleanerd/cleaner.h
@@ -49,7 +49,7 @@ __BEGIN_DECLS
void pwarn(const char *, ...);
void calc_cb(struct clfs *, int, struct clfs_seguse *);
int clean_fs(struct clfs *, CLEANERINFO *);
-void dlog(char *, ...);
+void dlog(const char *, ...);
void handle_error(struct clfs **, int);
int init_fs(struct clfs *, char *);
int invalidate_segment(struct clfs *, int);
diff --git a/libexec/lfs_cleanerd/coalesce.c b/libexec/lfs_cleanerd/coalesce.c
index 49503bc6ad9..cd74c29b844 100644
--- a/libexec/lfs_cleanerd/coalesce.c
+++ b/libexec/lfs_cleanerd/coalesce.c
@@ -1,4 +1,4 @@
-/* $NetBSD: coalesce.c,v 1.16 2008/05/16 09:21:59 hannken Exp $ */
+/* $NetBSD: coalesce.c,v 1.17 2009/03/16 00:08:10 lukem Exp $ */
/*-
* Copyright (c) 2002, 2005 The NetBSD Foundation, Inc.
@@ -87,7 +87,7 @@ enum coalesce_returncodes {
COALESCE_MAXERROR
};
-char *coalesce_return[] = {
+const char *coalesce_return[] = {
"Successfully coalesced",
"File not in use or inode not found",
"Not large enough to coalesce",
@@ -167,11 +167,13 @@ clean_inode(struct clfs *fs, ino_t ino)
}
/* Sanity checks */
+#if 0 /* di_size is uint64_t -- this is a noop */
if (dip->di_size < 0) {
dlog("ino %d, negative size (%" PRId64 ")", ino, dip->di_size);
free(dip);
return COALESCE_BADSIZE;
}
+#endif
if (nb > dip->di_blocks) {
dlog("ino %d, computed blocks %d > held blocks %d", ino, nb,
dip->di_blocks);
diff --git a/libexec/lfs_cleanerd/lfs_cleanerd.c b/libexec/lfs_cleanerd/lfs_cleanerd.c
index d80b792fab1..101322e0ba7 100644
--- a/libexec/lfs_cleanerd/lfs_cleanerd.c
+++ b/libexec/lfs_cleanerd/lfs_cleanerd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.16 2009/03/15 23:56:24 lukem Exp $ */
+/* $NetBSD: lfs_cleanerd.c,v 1.17 2009/03/16 00:08:10 lukem Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -99,7 +99,7 @@ void pwarn(const char *unused, ...) { /* Does nothing */ };
* Log a message if debugging is turned on.
*/
void
-dlog(char *fmt, ...)
+dlog(const char *fmt, ...)
{
va_list ap;
@@ -599,7 +599,7 @@ log_segment_read(struct clfs *fs, int sn)
fp = fopen(copylog_filename, "ab");
if (fp != NULL) {
- if (fwrite(cp, (size_t)fs->lfs_ssize, 1, fp) < 0) {
+ if (fwrite(cp, (size_t)fs->lfs_ssize, 1, fp) != 1) {
perror("writing segment to copy log");
}
}
@@ -684,7 +684,7 @@ calc_cb(struct clfs *fs, int sn, struct clfs_seguse *t)
return;
}
- if (t->nbytes < 0 || t->nbytes > fs->lfs_ssize) {
+ if (t->nbytes > fs->lfs_ssize) {
/* Another type of error */
syslog(LOG_WARNING, "segment %d: bad seguse count %d",
sn, t->nbytes);
@@ -725,10 +725,10 @@ calc_cb(struct clfs *fs, int sn, struct clfs_seguse *t)
static int
bi_comparator(const void *va, const void *vb)
{
- BLOCK_INFO *a, *b;
+ const BLOCK_INFO *a, *b;
- a = (BLOCK_INFO *)va;
- b = (BLOCK_INFO *)vb;
+ a = (const BLOCK_INFO *)va;
+ b = (const BLOCK_INFO *)vb;
/* Check for out-of-place block */
if (a->bi_segcreate == a->bi_daddr &&
@@ -765,10 +765,10 @@ bi_comparator(const void *va, const void *vb)
static int
cb_comparator(const void *va, const void *vb)
{
- struct clfs_seguse *a, *b;
+ const struct clfs_seguse *a, *b;
- a = *(struct clfs_seguse **)va;
- b = *(struct clfs_seguse **)vb;
+ a = *(const struct clfs_seguse * const *)va;
+ b = *(const struct clfs_seguse * const *)vb;
return a->priority > b->priority ? -1 : 1;
}