This is the mail archive of the
cluster-cvs@sourceware.org
mailing list for the cluster.
gfs1-utils: master - gfs: fix most of the warnings spotted byparanoia-cflags
- From: "Fabio M. Di Nitto" <fabbione at fedoraproject dot org>
- To: cluster-cvs-relay at redhat dot com
- Date: Mon, 11 May 2009 08:09:24 +0000 (UTC)
- Subject: gfs1-utils: master - gfs: fix most of the warnings spotted byparanoia-cflags
Gitweb: http://git.fedorahosted.org/git/gfs1-utils.git?p=gfs1-utils.git;a=commitdiff;h=8665cd580e5b57ae81e858448993585e5bb8d031
Commit: 8665cd580e5b57ae81e858448993585e5bb8d031
Parent: 11d48bcee963fbff8e4a7124a376e23adb2cda35
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate: Mon May 11 10:09:10 2009 +0200
Committer: Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Mon May 11 10:09:10 2009 +0200
gfs: fix most of the warnings spotted by paranoia-cflags
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
gfs-kernel/src/gfs/gfs_ondisk.h | 38 +++++++++---------
gfs/gfs_debug/basic.c | 2 +-
gfs/gfs_debug/readfile.c | 2 +-
gfs/gfs_debug/util.c | 14 +++---
gfs/gfs_fsck/eattr.c | 2 +-
gfs/gfs_fsck/file.c | 6 ++-
gfs/gfs_fsck/fs_bits.c | 2 +-
gfs/gfs_fsck/fs_dir.c | 56 ++++++++++++++--------------
gfs/gfs_fsck/fs_inode.c | 6 +-
gfs/gfs_fsck/fs_inode.h | 2 +-
gfs/gfs_fsck/initialize.c | 2 +-
gfs/gfs_fsck/log.c | 4 +-
gfs/gfs_fsck/log.h | 2 +-
gfs/gfs_fsck/main.c | 12 +++--
gfs/gfs_fsck/metawalk.c | 32 ++++++++--------
gfs/gfs_fsck/ondisk.c | 34 ++++++++--------
gfs/gfs_fsck/pass1.c | 10 ++--
gfs/gfs_fsck/pass1b.c | 9 ++--
gfs/gfs_fsck/pass1c.c | 13 ++++--
gfs/gfs_fsck/pass2.c | 13 +++---
gfs/gfs_fsck/pass3.c | 2 +-
gfs/gfs_fsck/pass4.c | 4 +-
gfs/gfs_fsck/pass5.c | 6 +-
gfs/gfs_fsck/super.c | 12 +++---
gfs/gfs_fsck/util.c | 14 +++---
gfs/gfs_grow/main.c | 35 +++++++++++------
gfs/gfs_jadd/main.c | 39 ++++++++++++-------
gfs/gfs_mkfs/main.c | 8 ++--
gfs/gfs_mkfs/structures.c | 6 +-
gfs/gfs_quota/check.c | 34 +++++++++++++----
gfs/gfs_quota/gfs_quota.h | 4 ++
gfs/gfs_quota/layout.c | 25 ++++++------
gfs/gfs_quota/main.c | 45 +++++++++++++++++-----
gfs/gfs_tool/counters.c | 6 ++-
gfs/gfs_tool/df.c | 40 +++++++++++++-------
gfs/gfs_tool/gfs_tool.h | 6 +-
gfs/gfs_tool/layout.c | 57 +++++++++++++++-------------
gfs/gfs_tool/misc.c | 78 +++++++++++++++++++++++++-------------
gfs/gfs_tool/tune.c | 12 ++++-
gfs/gfs_tool/util.c | 10 +++--
gfs/libgfs/file.c | 6 ++-
gfs/libgfs/fs_bits.c | 2 +-
gfs/libgfs/fs_dir.c | 46 +++++++++++-----------
gfs/libgfs/fs_inode.c | 4 +-
gfs/libgfs/libgfs.h | 5 ++-
gfs/libgfs/log.c | 4 +-
gfs/libgfs/ondisk.c | 36 +++++++++---------
gfs/libgfs/super.c | 1 -
gfs/libgfs/util.c | 14 +++---
49 files changed, 476 insertions(+), 346 deletions(-)
diff --git a/gfs-kernel/src/gfs/gfs_ondisk.h b/gfs-kernel/src/gfs/gfs_ondisk.h
index 0648d28..eea9038 100644
--- a/gfs-kernel/src/gfs/gfs_ondisk.h
+++ b/gfs-kernel/src/gfs/gfs_ondisk.h
@@ -695,7 +695,7 @@ void gfs_rgrp_print(struct gfs_rgrp *rgrp);
void gfs_quota_print(struct gfs_quota *quota);
void gfs_dinode_print(struct gfs_dinode *dinode);
void gfs_indirect_print(struct gfs_indirect *indirect);
-void gfs_dirent_print(struct gfs_dirent *dirent, char *name);
+void gfs_dirent_print(struct gfs_dirent *dirent, const char *name);
void gfs_leaf_print(struct gfs_leaf *leaf);
void gfs_log_header_print(struct gfs_log_header *head);
void gfs_desc_print(struct gfs_log_descriptor *desc);
@@ -733,7 +733,7 @@ uint32_t gfs_dir_hash(const char *data, int len);
*/
static void
-print_array(char *title, char *buf, int count)
+print_array(const char *title, char *buf, int count)
{
int x;
@@ -1016,20 +1016,20 @@ gfs_jindex_print(struct gfs_jindex *ji)
*/
void
-gfs_rindex_in(struct gfs_rindex *rindex, char *buf)
+gfs_rindex_in(struct gfs_rindex *grindex, char *buf)
{
struct gfs_rindex *str = (struct gfs_rindex *)buf;
- CPIN_64(rindex, str, ri_addr);
- CPIN_32(rindex, str, ri_length);
- CPIN_32(rindex, str, ri_pad);
+ CPIN_64(grindex, str, ri_addr);
+ CPIN_32(grindex, str, ri_length);
+ CPIN_32(grindex, str, ri_pad);
- CPIN_64(rindex, str, ri_data1);
- CPIN_32(rindex, str, ri_data);
+ CPIN_64(grindex, str, ri_data1);
+ CPIN_32(grindex, str, ri_data);
- CPIN_32(rindex, str, ri_bitbytes);
+ CPIN_32(grindex, str, ri_bitbytes);
- CPIN_08(rindex, str, ri_reserved, 64);
+ CPIN_08(grindex, str, ri_reserved, 64);
}
/**
@@ -1040,20 +1040,20 @@ gfs_rindex_in(struct gfs_rindex *rindex, char *buf)
*/
void
-gfs_rindex_out(struct gfs_rindex *rindex, char *buf)
+gfs_rindex_out(struct gfs_rindex *grindex, char *buf)
{
struct gfs_rindex *str = (struct gfs_rindex *)buf;
- CPOUT_64(rindex, str, ri_addr);
- CPOUT_32(rindex, str, ri_length);
- CPOUT_32(rindex, str, ri_pad);
+ CPOUT_64(grindex, str, ri_addr);
+ CPOUT_32(grindex, str, ri_length);
+ CPOUT_32(grindex, str, ri_pad);
- CPOUT_64(rindex, str, ri_data1);
- CPOUT_32(rindex, str, ri_data);
+ CPOUT_64(grindex, str, ri_data1);
+ CPOUT_32(grindex, str, ri_data);
- CPOUT_32(rindex, str, ri_bitbytes);
+ CPOUT_32(grindex, str, ri_bitbytes);
- CPOUT_08(rindex, str, ri_reserved, 64);
+ CPOUT_08(grindex, str, ri_reserved, 64);
}
/**
@@ -1454,7 +1454,7 @@ gfs_dirent_out(struct gfs_dirent *dirent, char *buf)
*/
void
-gfs_dirent_print(struct gfs_dirent *de, char *name)
+gfs_dirent_print(struct gfs_dirent *de, const char *name)
{
char buf[GFS_FNAMESIZE + 1];
diff --git a/gfs/gfs_debug/basic.c b/gfs/gfs_debug/basic.c
index 0b5a517..8422767 100644
--- a/gfs/gfs_debug/basic.c
+++ b/gfs/gfs_debug/basic.c
@@ -171,7 +171,7 @@ print_bitmaps(char *data, unsigned int offset)
unsigned int bn = 0;
unsigned int bit;
unsigned char value;
- char *type;
+ const char *type;
printf("\n");
diff --git a/gfs/gfs_debug/readfile.c b/gfs/gfs_debug/readfile.c
index d1de13e..75e9c66 100644
--- a/gfs/gfs_debug/readfile.c
+++ b/gfs/gfs_debug/readfile.c
@@ -189,7 +189,7 @@ readfile(void)
static void
do_readdir(struct gfs_dinode *di, char *data,
- uint32_t index, uint32_t len, uint64_t leaf_no,
+ uint32_t lindex, uint32_t len, uint64_t leaf_no,
void *opaque)
{
struct gfs_leaf leaf;
diff --git a/gfs/gfs_debug/util.c b/gfs/gfs_debug/util.c
index 4dcc387..ab4f0ee 100644
--- a/gfs/gfs_debug/util.c
+++ b/gfs/gfs_debug/util.c
@@ -89,7 +89,7 @@ foreach_leaf(struct gfs_dinode *di,
struct gfs_leaf leaf;
uint32_t hsize, len;
uint32_t ht_offset, lp_offset, ht_offset_cur = -1;
- uint32_t index = 0;
+ uint32_t lindex = 0;
uint64_t lp[sd_hash_ptrs];
uint64_t leaf_no;
int error;
@@ -98,9 +98,9 @@ foreach_leaf(struct gfs_dinode *di,
if (hsize * sizeof(uint64_t) != di->di_size)
die("bad hash table size\n");
- while (index < hsize) {
- lp_offset = index % sd_hash_ptrs;
- ht_offset = index - lp_offset;
+ while (lindex < hsize) {
+ lp_offset = lindex % sd_hash_ptrs;
+ ht_offset = lindex - lp_offset;
if (ht_offset_cur != ht_offset) {
error = gfs_readi(di, (char *)lp, ht_offset * sizeof(uint64_t), sd_hash_bsize);
@@ -117,13 +117,13 @@ foreach_leaf(struct gfs_dinode *di,
gfs_leaf_in(&leaf, data);
len = 1 << (di->di_depth - leaf.lf_depth);
- lc(di, data, index, len, leaf_no, opaque);
+ lc(di, data, lindex, len, leaf_no, opaque);
free(data);
- index += len;
+ lindex += len;
}
- if (index != hsize)
+ if (lindex != hsize)
die("screwed up directory\n");
}
diff --git a/gfs/gfs_fsck/eattr.c b/gfs/gfs_fsck/eattr.c
index b88caf9..2891c33 100644
--- a/gfs/gfs_fsck/eattr.c
+++ b/gfs/gfs_fsck/eattr.c
@@ -1,7 +1,7 @@
#include <stdint.h>
#include "fsck_incore.h"
-
+#include "eattr.h"
static int clear_blk_nodup(struct fsck_sb *sbp, uint64_t block)
{
diff --git a/gfs/gfs_fsck/file.c b/gfs/gfs_fsck/file.c
index 366409c..1e6fddf 100644
--- a/gfs/gfs_fsck/file.c
+++ b/gfs/gfs_fsck/file.c
@@ -14,7 +14,7 @@
*
* Returns: The amount of data actually copied or the error
*/
-int readi(struct fsck_inode *ip, void *buf, uint64 offset, unsigned int size)
+int readi(struct fsck_inode *ip, void *bufin, uint64 offset, unsigned int size)
{
struct fsck_sb *sdp = ip->i_sbd;
osi_buf_t *bh;
@@ -25,6 +25,7 @@ int readi(struct fsck_inode *ip, void *buf, uint64 offset, unsigned int size)
int journaled = fs_is_jdata(ip);
int copied = 0;
int error = 0;
+ char *buf = bufin;
if (offset >= ip->i_di.di_size){
log_debug("readi: Offset (%"PRIu64") is >= "
@@ -110,7 +111,7 @@ int readi(struct fsck_inode *ip, void *buf, uint64 offset, unsigned int size)
*
* Returns: The number of bytes correctly written or error code
*/
-int writei(struct fsck_inode *ip, void *buf, uint64_t offset, unsigned int size)
+int writei(struct fsck_inode *ip, void *bufin, uint64_t offset, unsigned int size)
{
struct fsck_sb *sdp = ip->i_sbd;
osi_buf_t *dibh, *bh;
@@ -122,6 +123,7 @@ int writei(struct fsck_inode *ip, void *buf, uint64_t offset, unsigned int size)
const uint64_t start = offset;
int copied = 0;
int error = 0;
+ char *buf = bufin;
/* Bomb out on writing nothing.
Posix says we can't change the time here. */
diff --git a/gfs/gfs_fsck/fs_bits.c b/gfs/gfs_fsck/fs_bits.c
index 848931f..1662de4 100644
--- a/gfs/gfs_fsck/fs_bits.c
+++ b/gfs/gfs_fsck/fs_bits.c
@@ -32,7 +32,7 @@ static void fs_setbit(unsigned char *buffer, unsigned int buflen,
*byte |= new_state << bit;
}
-uint32_t fs_bitfit_core(struct fsck_sb *sbp, uint64_t goal, uint64_t start, uint64_t len,
+static uint32_t fs_bitfit_core(struct fsck_sb *sbp, uint64_t goal, uint64_t start, uint64_t len,
unsigned char old_state)
{
uint64_t block;
diff --git a/gfs/gfs_fsck/fs_dir.c b/gfs/gfs_fsck/fs_dir.c
index 27f559a..af221db 100644
--- a/gfs/gfs_fsck/fs_dir.c
+++ b/gfs/gfs_fsck/fs_dir.c
@@ -64,7 +64,7 @@ int dirent_first(osi_buf_t *bh, struct gfs_dirent **dent)
*
* Returns: 0 on success, error code otherwise
*/
-int dirent_next(osi_buf_t *bh, struct gfs_dirent **dent)
+static int dirent_next(osi_buf_t *bh, struct gfs_dirent **dent)
{
struct gfs_dirent *tmp, *cur;
char *bh_end;
@@ -208,18 +208,18 @@ static int get_leaf(struct fsck_inode *dip, uint64 leaf_no, osi_buf_t **bhp)
/**
* get_first_leaf - Get first leaf
* @dip: The GFS inode
- * @index:
+ * @lindex:
* @bh_out:
*
* Returns: 0 on success, error code otherwise
*/
-static int get_first_leaf(struct fsck_inode *dip, uint32 index, osi_buf_t **bh_out)
+static int get_first_leaf(struct fsck_inode *dip, uint32 lindex, osi_buf_t **bh_out)
{
uint64 leaf_no;
int error;
- error = get_leaf_nr(dip, index, &leaf_no);
+ error = get_leaf_nr(dip, lindex, &leaf_no);
if (!error)
error = get_leaf(dip, leaf_no, bh_out);
@@ -356,7 +356,7 @@ static int linked_leaf_search(struct fsck_inode *dip, identifier_t *id,
struct gfs_dirent **dent_prev, osi_buf_t **bh_out)
{
osi_buf_t *bh = NULL, *bh_next;
- uint32 hsize, index;
+ uint32 hsize, lindex;
uint32 hash;
int error = 0;
@@ -370,9 +370,9 @@ static int linked_leaf_search(struct fsck_inode *dip, identifier_t *id,
if(id->type == ID_FILENAME){
hash = dir_hash(id->filename);
- index = hash >> (32 - dip->i_di.di_depth);
+ lindex = hash >> (32 - dip->i_di.di_depth);
- error = get_first_leaf(dip, index, &bh_next);
+ error = get_first_leaf(dip, lindex, &bh_next);
if (error){
return error;
}
@@ -403,8 +403,8 @@ static int linked_leaf_search(struct fsck_inode *dip, identifier_t *id,
relse_buf(dip->i_sbd, bh);
} else if(id->type == ID_INUM){
- for(index=0; index < (1 << dip->i_di.di_depth); index++){
- error = get_first_leaf(dip, index, &bh_next);
+ for(lindex=0; lindex < (1 << dip->i_di.di_depth); lindex++){
+ error = get_first_leaf(dip, lindex, &bh_next);
if (error){
return error;
}
@@ -732,12 +732,12 @@ static int dir_make_exhash(struct fsck_inode *dip)
/**
* dir_split_leaf - Split a leaf block into two
* @dip: The GFS inode
- * @index:
+ * @lindex:
* @leaf_no:
*
* Returns: 0 on success, error code on failure
*/
-static int dir_split_leaf(struct fsck_inode *dip, uint32 index, uint64 leaf_no)
+static int dir_split_leaf(struct fsck_inode *dip, uint32 lindex, uint64 leaf_no)
{
struct fsck_sb *sdp = dip->i_sbd;
osi_buf_t *nbh, *obh, *dibh;
@@ -795,7 +795,7 @@ static int dir_split_leaf(struct fsck_inode *dip, uint32 index, uint64 leaf_no)
}
half_len = len >> 1;
- start = (index & ~(len - 1));
+ start = (lindex & ~(len - 1));
log_debug("Splitting leaf: len = %u, half_len = %u\n", len, half_len);
@@ -1071,7 +1071,7 @@ static int dir_double_exhash(struct fsck_inode *dip)
static int dir_e_del(struct fsck_inode *dip, osi_filename_t *filename){
- int index;
+ int lindex;
int error;
int found = 0;
uint64 leaf_no;
@@ -1083,10 +1083,10 @@ static int dir_e_del(struct fsck_inode *dip, osi_filename_t *filename){
id.filename = filename;
id.inum = NULL;
- index = (1 << (dip->i_di.di_depth))-1;
+ lindex = (1 << (dip->i_di.di_depth))-1;
- for(; (index >= 0) && !found; index--){
- error = get_leaf_nr(dip, index, &leaf_no);
+ for(; (lindex >= 0) && !found; lindex--){
+ error = get_leaf_nr(dip, lindex, &leaf_no);
if (error){
log_err("dir_e_del: Unable to get leaf number.\n");
return error;
@@ -1230,7 +1230,7 @@ static int dir_e_add(struct fsck_inode *dip, osi_filename_t *filename,
osi_buf_t *bh, *nbh, *dibh;
struct gfs_leaf *leaf, *nleaf;
struct gfs_dirent *dent;
- uint32 hsize, index;
+ uint32 hsize, lindex;
uint32 hash;
uint64 leaf_no, bn;
int error;
@@ -1248,10 +1248,10 @@ static int dir_e_add(struct fsck_inode *dip, osi_filename_t *filename,
/* Figure out the address of the leaf node. */
hash = dir_hash(filename);
- index = hash >> (32 - dip->i_di.di_depth);
+ lindex = hash >> (32 - dip->i_di.di_depth);
- error = get_leaf_nr(dip, index, &leaf_no);
+ error = get_leaf_nr(dip, lindex, &leaf_no);
if (error){
log_err("dir_e_add: Unable to get leaf number.\n");
return error;
@@ -1275,7 +1275,7 @@ static int dir_e_add(struct fsck_inode *dip, osi_filename_t *filename,
/* Can we split the leaf? */
relse_buf(sdp, bh);
- error = dir_split_leaf(dip, index, leaf_no);
+ error = dir_split_leaf(dip, lindex, leaf_no);
if (error){
log_err("dir_e_add: Unable to split leaf.\n");
return error;
@@ -1598,20 +1598,20 @@ int fs_dirent_alloc(struct fsck_inode *dip, osi_buf_t *bh,
/**
- * get_leaf_nr - Get a leaf number associated with the index
+ * get_leaf_nr - Get a leaf number associated with the lindex
* @dip: The GFS inode
- * @index:
+ * @lindex:
* @leaf_out:
*
* Returns: 0 on success, error code otherwise
*/
-int get_leaf_nr(struct fsck_inode *dip, uint32 index, uint64 *leaf_out)
+int get_leaf_nr(struct fsck_inode *dip, uint32 lindex, uint64 *leaf_out)
{
uint64 leaf_no;
int error = -1;
error = readi(dip, (char *)&leaf_no,
- index * sizeof(uint64), sizeof(uint64));
+ lindex * sizeof(uint64), sizeof(uint64));
if (error != sizeof(uint64)){
log_debug("get_leaf_nr: Bad internal read. (rtn = %d)\n",
error);
@@ -1625,15 +1625,15 @@ int get_leaf_nr(struct fsck_inode *dip, uint32 index, uint64 *leaf_out)
/**
- * put_leaf_nr - Put a leaf number associated with the index
+ * put_leaf_nr - Put a leaf number associated with the lindex
* @dip: The GFS inode
- * @index:
+ * @lindex:
* @leaf_out:
*
* Returns: 0 on success, error code otherwise
*/
-int put_leaf_nr(struct fsck_inode *dip, uint32 index, uint64 leaf_out)
+int put_leaf_nr(struct fsck_inode *dip, uint32 lindex, uint64 leaf_out)
{
uint64 leaf_no;
int error = -1;
@@ -1641,7 +1641,7 @@ int put_leaf_nr(struct fsck_inode *dip, uint32 index, uint64 leaf_out)
leaf_no = cpu_to_gfs64(leaf_out);
error = writei(dip, (char *)&leaf_no,
- index * sizeof(uint64), sizeof(uint64));
+ lindex * sizeof(uint64), sizeof(uint64));
if (error != sizeof(uint64)){
log_debug("put_leaf_nr: Bad internal write. (rtn = %d)\n",
error);
diff --git a/gfs/gfs_fsck/fs_inode.c b/gfs/gfs_fsck/fs_inode.c
index 828f092..57f3cb9 100644
--- a/gfs/gfs_fsck/fs_inode.c
+++ b/gfs/gfs_fsck/fs_inode.c
@@ -307,7 +307,7 @@ static int fs_lookupi(struct fsck_inode *dip, osi_filename_t *name,
return error;
}
-int fs_createi(struct fsck_inode *dip, osi_filename_t *name,
+static int fs_createi(struct fsck_inode *dip, osi_filename_t *name,
unsigned int type, unsigned int mode, osi_cred_t *cred,
int *new, struct fsck_inode **ipp)
{
@@ -492,7 +492,7 @@ int fs_createi(struct fsck_inode *dip, osi_filename_t *name,
*
* Returns: 0 on success, -1 on failure.
*/
-int fs_mkdir(struct fsck_inode *dip, char *new_dir, int mode, struct fsck_inode **nip){
+int fs_mkdir(struct fsck_inode *dip, const char *new_dir, int mode, struct fsck_inode **nip){
int error;
osi_cred_t creds;
osi_buf_t *dibh;
@@ -501,7 +501,7 @@ int fs_mkdir(struct fsck_inode *dip, char *new_dir, int mode, struct fsck_inode
struct fsck_inode *ip= NULL;
struct fsck_sb *sdp = dip->i_sbd;
osi_filename_t name;
- int new;
+ int new = 0;
name.name = (unsigned char *)new_dir;
name.len = strlen(new_dir);
diff --git a/gfs/gfs_fsck/fs_inode.h b/gfs/gfs_fsck/fs_inode.h
index d7aa904..d1d2c2b 100644
--- a/gfs/gfs_fsck/fs_inode.h
+++ b/gfs/gfs_fsck/fs_inode.h
@@ -5,7 +5,7 @@
int fs_copyin_dinode(struct fsck_inode *ip, osi_buf_t *bh);
int fs_copyout_dinode(struct fsck_inode *ip);
-int fs_mkdir(struct fsck_inode *dip, char *new_dir, int mode, struct fsck_inode **nip);
+int fs_mkdir(struct fsck_inode *dip, const char *new_dir, int mode, struct fsck_inode **nip);
int fs_remove(struct fsck_inode *ip);
static __inline__ int fs_is_stuffed(struct fsck_inode *ip)
diff --git a/gfs/gfs_fsck/initialize.c b/gfs/gfs_fsck/initialize.c
index 5136b42..ffd1e8f 100644
--- a/gfs/gfs_fsck/initialize.c
+++ b/gfs/gfs_fsck/initialize.c
@@ -18,7 +18,7 @@
*
* Go through journals and replay them - then clear them
*/
-int init_journals(struct fsck_sb *sbp)
+static int init_journals(struct fsck_sb *sbp)
{
if(!sbp->opts->no) {
diff --git a/gfs/gfs_fsck/log.c b/gfs/gfs_fsck/log.c
index 3730d41..5e65976 100644
--- a/gfs/gfs_fsck/log.c
+++ b/gfs/gfs_fsck/log.c
@@ -26,7 +26,7 @@ void decrease_verbosity(void)
_state.print_level--;
}
-void print_msg(int priority, char *file, int line, const char *format, va_list args) {
+static void print_msg(int priority, const char *file, int line, const char *format, va_list args) {
switch (priority) {
@@ -51,7 +51,7 @@ void print_msg(int priority, char *file, int line, const char *format, va_list a
}
-void print_fsck_log(int iif, int priority, char *file, int line, const char *format, ...)
+void print_fsck_log(int iif, int priority, const char *file, int line, const char *format, ...)
{
va_list args;
diff --git a/gfs/gfs_fsck/log.h b/gfs/gfs_fsck/log.h
index 358fc14..725d2ee 100644
--- a/gfs/gfs_fsck/log.h
+++ b/gfs/gfs_fsck/log.h
@@ -80,7 +80,7 @@ do { \
void increase_verbosity(void);
void decrease_verbosity(void);
-void print_fsck_log(int iif, int priority, char *file, int line, const char *format, ...);
+void print_fsck_log(int iif, int priority, const char *file, int line, const char *format, ...);
int query(struct fsck_sb *sbp, const char *format, ...);
diff --git a/gfs/gfs_fsck/main.c b/gfs/gfs_fsck/main.c
index 8e080ce..58f8b91 100644
--- a/gfs/gfs_fsck/main.c
+++ b/gfs/gfs_fsck/main.c
@@ -14,7 +14,8 @@ uint64_t last_fs_block, last_reported_block = -1;
int skip_this_pass = FALSE, fsck_abort = FALSE, fsck_query = FALSE;
const char *pass = "";
-void print_map(struct block_list *il, int count)
+#if 0
+static void print_map(struct block_list *il, int count)
{
int i, j;
struct block_query k;
@@ -36,20 +37,21 @@ void print_map(struct block_list *il, int count)
}
log_info("\n");
}
+#endif
-void usage(char *name)
+static void usage(char *name)
{
printf("Usage: %s [-hnqvVy] <device> \n", basename(name));
}
-void version(void)
+static void version(void)
{
printf("GFS fsck %s (built %s %s)\n",
RELEASE_VERSION, __DATE__, __TIME__);
printf("%s\n", REDHAT_COPYRIGHT);
}
-int read_cmdline(int argc, char **argv, struct options *opts)
+static int read_cmdline(int argc, char **argv, struct options *opts)
{
int c;
@@ -102,7 +104,7 @@ int read_cmdline(int argc, char **argv, struct options *opts)
return 0;
}
-void interrupt(int sig)
+static void interrupt(int sig)
{
fd_set rfds;
struct timeval tv;
diff --git a/gfs/gfs_fsck/metawalk.c b/gfs/gfs_fsck/metawalk.c
index 64bd519..104ab7e 100644
--- a/gfs/gfs_fsck/metawalk.c
+++ b/gfs/gfs_fsck/metawalk.c
@@ -8,7 +8,7 @@
#include "metawalk.h"
-int check_entries(struct fsck_inode *ip, osi_buf_t *bh, int index,
+static int check_entries(struct fsck_inode *ip, osi_buf_t *bh, int lindex,
int type, int *update, uint16_t *count,
struct metawalk_fxns *pass)
{
@@ -114,8 +114,8 @@ int check_entries(struct fsck_inode *ip, osi_buf_t *bh, int index,
/* so that they replace the bad ones. We have to hack up the old */
/* leaf a bit, but it's better than deleting the whole directory, */
/* which is what used to happen before. */
-void warn_and_patch(struct fsck_inode *ip, uint64_t *leaf_no,
- uint64_t *bad_leaf, uint64_t old_leaf, int index,
+static void warn_and_patch(struct fsck_inode *ip, uint64_t *leaf_no,
+ uint64_t *bad_leaf, uint64_t old_leaf, int lindex,
const char *msg)
{
if (*bad_leaf != *leaf_no) {
@@ -125,7 +125,7 @@ void warn_and_patch(struct fsck_inode *ip, uint64_t *leaf_no,
}
if (*leaf_no == *bad_leaf ||
query(ip->i_sbd, "Attempt to patch around it? (y/n) ")) {
- put_leaf_nr(ip, index, old_leaf);
+ put_leaf_nr(ip, lindex, old_leaf);
}
else
log_err("Bad leaf left in place.\n");
@@ -134,28 +134,28 @@ void warn_and_patch(struct fsck_inode *ip, uint64_t *leaf_no,
}
/* Checks exthash directory entries */
-int check_leaf(struct fsck_inode *ip, int *update, struct metawalk_fxns *pass)
+static int check_leaf(struct fsck_inode *ip, int *update, struct metawalk_fxns *pass)
{
int error;
struct gfs_leaf leaf, oldleaf;
uint64_t leaf_no, old_leaf, bad_leaf = -1;
osi_buf_t *lbh;
- int index;
+ int lindex;
struct fsck_sb *sbp = ip->i_sbd;
uint16_t count;
int ref_count = 0, exp_count = 0;
old_leaf = 0;
memset(&oldleaf, 0, sizeof(oldleaf));
- for(index = 0; index < (1 << ip->i_di.di_depth); index++) {
- if(get_leaf_nr(ip, index, &leaf_no)) {
+ for(lindex = 0; lindex < (1 << ip->i_di.di_depth); lindex++) {
+ if(get_leaf_nr(ip, lindex, &leaf_no)) {
log_err("Unable to get leaf block number in dir %"
PRIu64"\n"
"\tDepth = %u\n"
- "\tindex = %u\n",
+ "\tlindex = %u\n",
ip->i_num.no_addr,
ip->i_di.di_depth,
- index);
+ lindex);
return -1;
}
@@ -163,7 +163,7 @@ int check_leaf(struct fsck_inode *ip, int *update, struct metawalk_fxns *pass)
* until those extra pointers are needed, so skip the
* dups */
if (leaf_no == bad_leaf) {
- put_leaf_nr(ip, index, old_leaf); /* fill w/old leaf */
+ put_leaf_nr(ip, lindex, old_leaf); /* fill w/old leaf */
ref_count++;
continue;
}
@@ -208,7 +208,7 @@ int check_leaf(struct fsck_inode *ip, int *update, struct metawalk_fxns *pass)
"range for directory #%"PRIu64".\n",
leaf_no, ip->i_di.di_num.no_addr);
warn_and_patch(ip, &leaf_no, &bad_leaf,
- old_leaf, index,
+ old_leaf, lindex,
"that is out of range");
memcpy(&leaf, &oldleaf, sizeof(oldleaf));
break;
@@ -220,7 +220,7 @@ int check_leaf(struct fsck_inode *ip, int *update, struct metawalk_fxns *pass)
"directory #%"PRIu64".\n",
leaf_no, ip->i_di.di_num.no_addr);
warn_and_patch(ip, &leaf_no, &bad_leaf,
- old_leaf, index,
+ old_leaf, lindex,
"that cannot be read");
memcpy(&leaf, &oldleaf, sizeof(oldleaf));
relse_buf(sbp, lbh);
@@ -229,7 +229,7 @@ int check_leaf(struct fsck_inode *ip, int *update, struct metawalk_fxns *pass)
/* Make sure it's really a valid leaf block. */
if (check_meta(lbh, GFS_METATYPE_LF)) {
warn_and_patch(ip, &leaf_no, &bad_leaf,
- old_leaf, index,
+ old_leaf, lindex,
"that is not really a leaf");
memcpy(&leaf, &oldleaf, sizeof(oldleaf));
relse_buf(sbp, lbh);
@@ -246,7 +246,7 @@ int check_leaf(struct fsck_inode *ip, int *update, struct metawalk_fxns *pass)
ip->i_di.di_depth, leaf.lf_depth);
if(pass->check_dentry &&
ip->i_di.di_type == GFS_FILE_DIR) {
- error = check_entries(ip, lbh, index,
+ error = check_entries(ip, lbh, lindex,
DIR_EXHASH, update,
&count,
pass);
@@ -696,7 +696,7 @@ end:
/* Checks stuffed inode directories */
-int check_linear_dir(struct fsck_inode *ip, osi_buf_t *bh, int *update,
+static int check_linear_dir(struct fsck_inode *ip, osi_buf_t *bh, int *update,
struct metawalk_fxns *pass)
{
int error = 0;
diff --git a/gfs/gfs_fsck/ondisk.c b/gfs/gfs_fsck/ondisk.c
index 8d80173..d3a4938 100644
--- a/gfs/gfs_fsck/ondisk.c
+++ b/gfs/gfs_fsck/ondisk.c
@@ -41,7 +41,7 @@
*/
static void
-print_array(char *title, char *buf, int count, int console)
+print_array(const char *title, char *buf, int count, int console)
{
int x;
@@ -349,20 +349,20 @@ gfs_jindex_print(struct gfs_jindex *ji, int console)
*/
void
-gfs_rindex_in(struct gfs_rindex *rindex, char *buf)
+gfs_rindex_in(struct gfs_rindex *grindex, char *buf)
{
struct gfs_rindex *str = (struct gfs_rindex *) buf;
- CPIN_64(rindex, str, ri_addr);
- CPIN_32(rindex, str, ri_length);
- CPIN_32(rindex, str, ri_pad);
+ CPIN_64(grindex, str, ri_addr);
+ CPIN_32(grindex, str, ri_length);
+ CPIN_32(grindex, str, ri_pad);
- CPIN_64(rindex, str, ri_data1);
- CPIN_32(rindex, str, ri_data);
+ CPIN_64(grindex, str, ri_data1);
+ CPIN_32(grindex, str, ri_data);
- CPIN_32(rindex, str, ri_bitbytes);
+ CPIN_32(grindex, str, ri_bitbytes);
- CPIN_08(rindex, str, ri_reserved, 64);
+ CPIN_08(grindex, str, ri_reserved, 64);
}
@@ -374,20 +374,20 @@ gfs_rindex_in(struct gfs_rindex *rindex, char *buf)
*/
void
-gfs_rindex_out(struct gfs_rindex *rindex, char *buf)
+gfs_rindex_out(struct gfs_rindex *grindex, char *buf)
{
struct gfs_rindex *str = (struct gfs_rindex *) buf;
- CPOUT_64(rindex, str, ri_addr);
- CPOUT_32(rindex, str, ri_length);
- CPOUT_32(rindex, str, ri_pad);
+ CPOUT_64(grindex, str, ri_addr);
+ CPOUT_32(grindex, str, ri_length);
+ CPOUT_32(grindex, str, ri_pad);
- CPOUT_64(rindex, str, ri_data1);
- CPOUT_32(rindex, str, ri_data);
+ CPOUT_64(grindex, str, ri_data1);
+ CPOUT_32(grindex, str, ri_data);
- CPOUT_32(rindex, str, ri_bitbytes);
+ CPOUT_32(grindex, str, ri_bitbytes);
- CPOUT_08(rindex, str, ri_reserved, 64);
+ CPOUT_08(grindex, str, ri_reserved, 64);
}
diff --git a/gfs/gfs_fsck/pass1.c b/gfs/gfs_fsck/pass1.c
index 3768ebf..1b9d3ff 100644
--- a/gfs/gfs_fsck/pass1.c
+++ b/gfs/gfs_fsck/pass1.c
@@ -528,7 +528,7 @@ static int check_eattr_entries(struct fsck_inode *ip,
return 0;
}
-int clear_metalist(struct fsck_inode *ip, uint64_t block,
+static int clear_metalist(struct fsck_inode *ip, uint64_t block,
osi_buf_t **bh, void *private)
{
struct fsck_sb *sdp = ip->i_sbd;
@@ -547,7 +547,7 @@ int clear_metalist(struct fsck_inode *ip, uint64_t block,
return 0;
}
-int clear_data(struct fsck_inode *ip, uint64_t block, void *private)
+static int clear_data(struct fsck_inode *ip, uint64_t block, void *private)
{
struct fsck_sb *sdp = ip->i_sbd;
struct block_query q = {0};
@@ -564,7 +564,7 @@ int clear_data(struct fsck_inode *ip, uint64_t block, void *private)
}
-int clear_leaf(struct fsck_inode *ip, uint64_t block,
+static int clear_leaf(struct fsck_inode *ip, uint64_t block,
osi_buf_t *bh, void *private)
{
@@ -621,7 +621,7 @@ int add_to_dir_list(struct fsck_sb *sbp, uint64_t block)
}
-int handle_di(struct fsck_sb *sdp, osi_buf_t *bh, uint64_t block, int mfree)
+static int handle_di(struct fsck_sb *sdp, osi_buf_t *bh, uint64_t block, int mfree)
{
struct block_query q = {0};
struct fsck_inode *ip;
@@ -878,7 +878,7 @@ int handle_di(struct fsck_sb *sdp, osi_buf_t *bh, uint64_t block, int mfree)
}
-int scan_meta(struct fsck_sb *sdp, osi_buf_t *bh, uint64_t block, int mfree)
+static int scan_meta(struct fsck_sb *sdp, osi_buf_t *bh, uint64_t block, int mfree)
{
if (check_meta(bh, 0)) {
diff --git a/gfs/gfs_fsck/pass1b.c b/gfs/gfs_fsck/pass1b.c
index 9f32aa6..ec1b692 100644
--- a/gfs/gfs_fsck/pass1b.c
+++ b/gfs/gfs_fsck/pass1b.c
@@ -317,7 +317,7 @@ static int clear_eattr_extentry(struct fsck_inode *ip, uint64_t *ea_data_ptr,
}
/* Finds all references to duplicate blocks in the metadata */
-int find_block_ref(struct fsck_sb *sbp, uint64_t inode, struct blocks *b)
+static int find_block_ref(struct fsck_sb *sbp, uint64_t inode, struct blocks *b)
{
struct fsck_inode *ip;
struct fxn_info myfi = {b->block_no, 0, 1};
@@ -371,7 +371,7 @@ int find_block_ref(struct fsck_sb *sbp, uint64_t inode, struct blocks *b)
}
/* Finds all blocks marked in the duplicate block bitmap */
-int find_dup_blocks(struct fsck_sb *sbp)
+static int find_dup_blocks(struct fsck_sb *sbp)
{
uint64_t block_no = 0;
struct blocks *b;
@@ -396,7 +396,7 @@ int find_dup_blocks(struct fsck_sb *sbp)
-int handle_dup_blk(struct fsck_sb *sbp, struct blocks *b)
+static int handle_dup_blk(struct fsck_sb *sbp, struct blocks *b)
{
osi_list_t *tmp;
struct inode_with_dups *id;
@@ -462,9 +462,10 @@ int pass1b(struct fsck_sb *sbp)
struct block_query q;
osi_list_t *tmp;
struct metawalk_fxns find_dirents = {0};
- find_dirents.check_dentry = &find_dentry;
int rc = 0;
+ find_dirents.check_dentry = &find_dentry;
+
osi_list_init(&sbp->dup_list);
/* Shove all blocks marked as duplicated into a list */
log_info("Looking for duplicate blocks...\n");
diff --git a/gfs/gfs_fsck/pass1c.c b/gfs/gfs_fsck/pass1c.c
index e65b862..6c09aeb 100644
--- a/gfs/gfs_fsck/pass1c.c
+++ b/gfs/gfs_fsck/pass1c.c
@@ -15,9 +15,11 @@ static int remove_eattr_entry(struct fsck_sb *sdp, osi_buf_t *leaf_bh,
if(!prev){
curr->ea_type = GFS_EATYPE_UNUSED;
} else {
+ gfs32_to_cpu(curr->ea_rec_len);
+ gfs32_to_cpu(prev->ea_rec_len);
+
prev->ea_rec_len =
- cpu_to_gfs32(gfs32_to_cpu(curr->ea_rec_len) +
- gfs32_to_cpu(prev->ea_rec_len));
+ cpu_to_gfs32(curr->ea_rec_len + prev->ea_rec_len);
if (curr->ea_flags & GFS_EAFLAG_LAST)
prev->ea_flags |= GFS_EAFLAG_LAST;
}
@@ -29,7 +31,7 @@ static int remove_eattr_entry(struct fsck_sb *sdp, osi_buf_t *leaf_bh,
return 0;
}
-int check_eattr_indir(struct fsck_inode *ip, uint64_t block,
+static int check_eattr_indir(struct fsck_inode *ip, uint64_t block,
uint64_t parent, osi_buf_t **bh,
void *private)
{
@@ -65,7 +67,8 @@ int check_eattr_indir(struct fsck_inode *ip, uint64_t block,
*bh = indir_bh;
return 0;
}
-int check_eattr_leaf(struct fsck_inode *ip, uint64_t block,
+
+static int check_eattr_leaf(struct fsck_inode *ip, uint64_t block,
uint64_t parent, osi_buf_t **bh, void *private)
{
int *update = (int *) private;
@@ -198,7 +201,7 @@ static int check_eattr_entry(struct fsck_inode *ip,
return 0;
}
-int check_eattr_extentry(struct fsck_inode *ip, uint64_t *ea_ptr,
+static int check_eattr_extentry(struct fsck_inode *ip, uint64_t *ea_ptr,
osi_buf_t *leaf_bh,
struct gfs_ea_header *ea_hdr,
struct gfs_ea_header *ea_hdr_prev,
diff --git a/gfs/gfs_fsck/pass2.c b/gfs/gfs_fsck/pass2.c
index 450f26f..5c7aad6 100644
--- a/gfs/gfs_fsck/pass2.c
+++ b/gfs/gfs_fsck/pass2.c
@@ -25,7 +25,7 @@ struct dir_status {
/* Set children's parent inode in dir_info structure - ext2 does not set
* dotdot inode here, but instead in pass3 - should we? */
-int set_parent_dir(struct fsck_sb *sbp, uint64_t childblock,
+static int set_parent_dir(struct fsck_sb *sbp, uint64_t childblock,
uint64_t parentblock)
{
struct dir_info *di;
@@ -51,7 +51,7 @@ int set_parent_dir(struct fsck_sb *sbp, uint64_t childblock,
}
/* Set's the child's '..' directory inode number in dir_info structure */
-int set_dotdot_dir(struct fsck_sb *sbp, uint64_t childblock,
+static int set_dotdot_dir(struct fsck_sb *sbp, uint64_t childblock,
uint64_t parentblock)
{
struct dir_info *di;
@@ -142,7 +142,7 @@ static int check_file_type(uint16_t de_type, uint8_t block_type) {
/* FIXME: should maybe refactor this a bit - but need to deal with
* FIXMEs internally first */
-int check_dentry(struct fsck_inode *ip, struct gfs_dirent *dent,
+static int check_dentry(struct fsck_inode *ip, struct gfs_dirent *dent,
struct gfs_dirent *prev_de,
osi_buf_t *bh, char *filename, int *update,
uint16_t *count, void *priv)
@@ -501,7 +501,7 @@ struct metawalk_fxns pass2_fxns = {
-int build_rooti(struct fsck_sb *sbp)
+static int build_rooti(struct fsck_sb *sbp)
{
struct fsck_inode *ip;
osi_buf_t *bh;
@@ -553,7 +553,7 @@ int build_rooti(struct fsck_sb *sbp)
}
/* Check root inode and verify it's in the bitmap */
-int check_root_dir(struct fsck_sb *sbp)
+static int check_root_dir(struct fsck_sb *sbp)
{
uint64_t rootblock;
struct dir_status ds = {0};
@@ -730,11 +730,12 @@ int pass2(struct fsck_sb *sbp, struct options *opts)
osi_buf_t b, *bh = &b;
osi_filename_t filename;
char tmp_name[256];
+ int error = 0;
+
if(check_root_dir(sbp)) {
stack;
return -1;
}
- int error = 0;
log_info("Checking directory inodes.\n");
/* Grab each directory inode, and run checks on it */
diff --git a/gfs/gfs_fsck/pass3.c b/gfs/gfs_fsck/pass3.c
index 3991147..7194f3e 100644
--- a/gfs/gfs_fsck/pass3.c
+++ b/gfs/gfs_fsck/pass3.c
@@ -56,7 +56,7 @@ static int attach_dotdot_to(struct fsck_sb *sbp, uint64_t newdotdot,
return 0;
}
-struct dir_info *mark_and_return_parent(struct fsck_sb *sbp,
+static struct dir_info *mark_and_return_parent(struct fsck_sb *sbp,
struct dir_info *di)
{
struct dir_info *pdi;
diff --git a/gfs/gfs_fsck/pass4.c b/gfs/gfs_fsck/pass4.c
index bb9d61d..9fa33f8 100644
--- a/gfs/gfs_fsck/pass4.c
+++ b/gfs/gfs_fsck/pass4.c
@@ -9,7 +9,7 @@
/* Updates the link count of an inode to what the fsck has seen for
* link count */
-int fix_inode_count(struct fsck_sb *sbp, struct inode_info *ii,
+static int fix_inode_count(struct fsck_sb *sbp, struct inode_info *ii,
struct fsck_inode *ip)
{
log_info("Fixing inode count for %"PRIu64"\n",
@@ -26,7 +26,7 @@ int fix_inode_count(struct fsck_sb *sbp, struct inode_info *ii,
return 0;
}
-int scan_inode_list(struct fsck_sb *sbp, osi_list_t *list) {
+static int scan_inode_list(struct fsck_sb *sbp, osi_list_t *list) {
osi_list_t *tmp;
struct inode_info *ii;
struct fsck_inode *ip;
diff --git a/gfs/gfs_fsck/pass5.c b/gfs/gfs_fsck/pass5.c
index 86c9cc3..529244e 100644
--- a/gfs/gfs_fsck/pass5.c
+++ b/gfs/gfs_fsck/pass5.c
@@ -119,7 +119,7 @@ int count_bmaps(struct fsck_rgrp *rgp)
}
#endif /* DEBUG */
-int convert_mark(enum mark_block mark, uint32_t *count)
+static int convert_mark(enum mark_block mark, uint32_t *count)
{
switch(mark) {
@@ -163,7 +163,7 @@ int convert_mark(enum mark_block mark, uint32_t *count)
}
-int check_block_status(struct fsck_sb *sbp, char *buffer, unsigned int buflen,
+static int check_block_status(struct fsck_sb *sbp, char *buffer, unsigned int buflen,
uint64_t *rg_block, uint64_t rg_data, uint32_t *count)
{
unsigned char *byte, *end;
@@ -240,7 +240,7 @@ int check_block_status(struct fsck_sb *sbp, char *buffer, unsigned int buflen,
#define FREE_META_COUNT 16
#define CONVERT_FREEMETA_TO_FREE (FREE_COUNT | FREE_META_COUNT)
-int update_rgrp(struct fsck_rgrp *rgp, uint32_t *count, int rgcount)
+static int update_rgrp(struct fsck_rgrp *rgp, uint32_t *count, int rgcount)
{
uint32_t i;
fs_bitmap_t *bits;
diff --git a/gfs/gfs_fsck/super.c b/gfs/gfs_fsck/super.c
index cf01988..ed7228e 100644
--- a/gfs/gfs_fsck/super.c
+++ b/gfs/gfs_fsck/super.c
@@ -220,7 +220,7 @@ int ji_update(struct fsck_sb *sdp)
}
/* Print out debugging information in same format as gfs_edit. */
-int hexdump(uint64 startaddr, const unsigned char *lpBuffer, int len)
+static int hexdump(uint64 startaddr, const unsigned char *lpBuffer, int len)
{
const unsigned char *pointer, *ptr2;
int i;
@@ -264,7 +264,7 @@ int hexdump(uint64 startaddr, const unsigned char *lpBuffer, int len)
* Returns: the number of bitmap blocks
*/
-uint32 rgrplength2bitblocks(struct fsck_sb *sdp, uint32 length)
+static uint32 rgrplength2bitblocks(struct fsck_sb *sdp, uint32 length)
{
uint32 bitbytes;
uint32 old_blocks = 0, blocks;
@@ -342,7 +342,7 @@ uint32 rgrplength2bitblocks(struct fsck_sb *sdp, uint32 length)
* will have the same number of RGs as the second original subdevice.
* Other RGs found after that will be considered "extra."
*/
-int gfs_rgindex_rebuild(struct fsck_sb *sdp, osi_list_t *ret_list,
+static int gfs_rgindex_rebuild(struct fsck_sb *sdp, osi_list_t *ret_list,
unsigned int *num_rgs)
{
osi_buf_t *bh; /* buffer handle */
@@ -959,7 +959,7 @@ int gfs_rgindex_rebuild(struct fsck_sb *sdp, osi_list_t *ret_list,
* Sets: ret_list to a linked list of fsck_rgrp structs representing
* what we think the rgindex should really look like.
*/
-int gfs_rgindex_calculate(struct fsck_sb *sdp, osi_list_t *ret_list,
+static int gfs_rgindex_calculate(struct fsck_sb *sdp, osi_list_t *ret_list,
unsigned int *num_rgs)
{
osi_buf_t *bh; /* buffer handle */
@@ -1105,7 +1105,7 @@ int gfs_rgindex_calculate(struct fsck_sb *sdp, osi_list_t *ret_list,
/*
* ri_cleanup - free up the memory we previously allocated.
*/
-void ri_cleanup(osi_list_t *rglist)
+static void ri_cleanup(osi_list_t *rglist)
{
struct fsck_rgrp *rgd;
@@ -1144,7 +1144,7 @@ int ri_update(struct fsck_sb *sdp)
osi_list_t expected_rglist; /* List of expected resource groups */
osi_list_t *tmp;
struct gfs_rindex buf;
- unsigned int rg, calc_rg_count;
+ unsigned int rg, calc_rg_count = 0;
int error, count1 = 0, count2 = 0;
int fix_grow_problems = 0, grow_problems = 0;
enum rgindex_trust_level { /* how far can we trust our RG index? */
diff --git a/gfs/gfs_fsck/util.c b/gfs/gfs_fsck/util.c
index 7a3a515..a7130e0 100644
--- a/gfs/gfs_fsck/util.c
+++ b/gfs/gfs_fsck/util.c
@@ -90,13 +90,13 @@ int set_meta(osi_buf_t *bh, int type, int format){
*/
int check_meta(osi_buf_t *bh, int type){
uint32 check_magic = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_magic;
- uint32 check_type = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
+ uint32 check_metatype = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
check_magic = gfs32_to_cpu(check_magic);
- check_type = gfs32_to_cpu(check_type);
- if((check_magic != GFS_MAGIC) || (type && (check_type != type))){
+ check_metatype = gfs32_to_cpu(check_metatype);
+ if((check_magic != GFS_MAGIC) || (type && (check_metatype != type))){
log_debug("For %"PRIu64" Expected %X:%X - got %X:%X\n", BH_BLKNO(bh), GFS_MAGIC, type,
- check_magic, check_type);
+ check_magic, check_metatype);
return -1;
}
return 0;
@@ -111,11 +111,11 @@ int check_meta(osi_buf_t *bh, int type){
*/
int check_type(osi_buf_t *bh, int type){
uint32 check_magic = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_magic;
- uint32 check_type = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
+ uint32 check_metatype = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
check_magic = gfs32_to_cpu(check_magic);
- check_type = gfs32_to_cpu(check_type);
- if((check_magic != GFS_MAGIC) || (check_type != type)){
+ check_metatype = gfs32_to_cpu(check_metatype);
+ if((check_magic != GFS_MAGIC) || (check_metatype != type)){
return -1;
}
return 0;
diff --git a/gfs/gfs_grow/main.c b/gfs/gfs_grow/main.c
index 661d364..ecb8b36 100644
--- a/gfs/gfs_grow/main.c
+++ b/gfs/gfs_grow/main.c
@@ -68,7 +68,7 @@ static osi_list_decl(jilist_current);
*/
static uint64_t
-device_geometry(char *device)
+device_geometry(char *device_g)
{
int fd;
uint64_t bytes;
@@ -77,10 +77,10 @@ device_geometry(char *device)
if (override_device_size)
bytes = override_device_size;
else {
- fd = open(device, O_RDONLY);
+ fd = open(device_g, O_RDONLY);
if (fd < 0) {
fprintf(stderr, "gfs_grow: can't open %s: %s\n",
- device, strerror(errno));
+ device_g, strerror(errno));
exit(EXIT_FAILURE);
}
@@ -88,7 +88,7 @@ device_geometry(char *device)
if (error) {
fprintf(stderr,
"gfs_grow: can't determine size of %s: %s\n",
- device, strerror(errno));
+ device_g, strerror(errno));
exit(EXIT_FAILURE);
}
@@ -110,10 +110,13 @@ device_geometry(char *device)
*/
static int
-jread(int fd, char *file, void *buf, uint64_t size, uint64_t *offset)
+jread(int fd, const char *file, void *buf, uint64_t size, uint64_t *offset)
{
struct gfs_ioctl gi;
- char *argv[] = { "do_hfile_read", file };
+ char *argv[] = {
+ (char *)"do_hfile_read",
+ (char *)file
+ };
int error;
gi.gi_argc = 2;
@@ -141,10 +144,13 @@ jread(int fd, char *file, void *buf, uint64_t size, uint64_t *offset)
*/
static int
-jwrite(int fd, char *file, void *buf, uint64_t size, uint64_t *offset)
+jwrite(int fd, const char *file, void *buf, uint64_t size, uint64_t *offset)
{
struct gfs_ioctl gi;
- char *argv[] = { "do_hfile_write", file };
+ char *argv[] = {
+ (char *)"do_hfile_write",
+ (char *)file
+ };
int error;
gi.gi_argc = 2;
@@ -373,10 +379,13 @@ write_whole_rgrp(int fd, struct rglist_entry *rgl)
*/
static uint64_t
-get_length(int fd, char *file)
+get_length(int fd, const char *file)
{
struct gfs_ioctl gi;
- char *argv[] = { "get_hfile_stat", file };
+ char *argv[] = {
+ (char *)"get_hfile_stat",
+ (char *)file
+ };
struct gfs_dinode di;
int error;
@@ -540,7 +549,7 @@ gather_info(void)
{
int fd;
struct gfs_ioctl gi;
- char *argv[] = { "get_super" };
+ char *argv[] = { (char *)"get_super" };
int error;
fd = open(fspath, O_RDONLY);
@@ -653,7 +662,7 @@ print_info(void)
*
*/
-uint64_t
+static uint64_t
rgrp_length(uint64_t size)
{
uint64_t bitbytes = RGRP_BITMAP_BLKS(&fs_sb) + 1;
@@ -681,7 +690,7 @@ rgrp_length(uint64_t size)
* Returns: The end of the new resource group
*/
-uint64_t
+static uint64_t
make_rgrp(uint64_t offset, uint64_t size)
{
struct rglist_entry *rgl = malloc(sizeof(struct rglist_entry));
diff --git a/gfs/gfs_jadd/main.c b/gfs/gfs_jadd/main.c
index e4e4a9b..f295c86 100644
--- a/gfs/gfs_jadd/main.c
+++ b/gfs/gfs_jadd/main.c
@@ -76,7 +76,7 @@ static osi_list_decl(jilist_new);
*/
static uint64_t
-device_geometry(char *device)
+device_geometry(char *device_g)
{
int fd;
uint64_t bytes;
@@ -85,10 +85,10 @@ device_geometry(char *device)
if (override_device_size)
bytes = override_device_size;
else {
- fd = open(device, O_RDONLY);
+ fd = open(device_g, O_RDONLY);
if (fd < 0) {
fprintf(stderr, "gfs_jadd: can't open %s: %s\n",
- device, strerror(errno));
+ device_g, strerror(errno));
exit(EXIT_FAILURE);
}
@@ -96,7 +96,7 @@ device_geometry(char *device)
if (error) {
fprintf(stderr,
"gfs_grow: can't determine size of %s: %s\n",
- device, strerror(errno));
+ device_g, strerror(errno));
exit(EXIT_FAILURE);
}
@@ -117,11 +117,14 @@ device_geometry(char *device)
* Returns: Error code, or amount of data read
*/
-int
-jread(int fd, char *file, void *buf, uint64_t size, uint64_t *offset)
+static int
+jread(int fd, const char *file, void *buf, uint64_t size, uint64_t *offset)
{
struct gfs_ioctl gi;
- char *argv[] = { "do_hfile_read", file };
+ char *argv[] = {
+ (char *)"do_hfile_read",
+ (char *)file
+ };
int error;
gi.gi_argc = 2;
@@ -148,11 +151,14 @@ jread(int fd, char *file, void *buf, uint64_t size, uint64_t *offset)
* Returns: Error code, or the amount of data written
*/
-int
-jwrite(int fd, char *file, void *buf, uint64_t size, uint64_t *offset)
+static int
+jwrite(int fd, const char *file, void *buf, uint64_t size, uint64_t *offset)
{
struct gfs_ioctl gi;
- char *argv[] = { "do_hfile_write", file };
+ char *argv[] = {
+ (char *)"do_hfile_write",
+ (char *)file
+ };
int error;
gi.gi_argc = 2;
@@ -389,10 +395,13 @@ write_whole_journal(struct jilist_entry *jil)
*/
static uint64_t
-get_length(int fd, char *file)
+get_length(int fd, const char *file)
{
struct gfs_ioctl gi;
- char *argv[] = { "get_hfile_stat", file };
+ char *argv[] = {
+ (char *)"get_hfile_stat",
+ (char *)file
+ };
struct gfs_dinode di;
int error;
@@ -500,7 +509,9 @@ gather_info(void)
{
int fd;
struct gfs_ioctl gi;
- char *argv[] = { "get_super" };
+ char *argv[] = {
+ (char *)"get_super"
+ };
int error;
fd = open(fspath, O_RDONLY);
@@ -620,7 +631,7 @@ print_info(void)
*
*/
-uint64_t
+static uint64_t
make_journal(uint64_t offset, uint64_t size)
{
struct jilist_entry *jil = malloc(sizeof(struct jilist_entry));
diff --git a/gfs/gfs_mkfs/main.c b/gfs/gfs_mkfs/main.c
index f216b5c..e9d57de 100644
--- a/gfs/gfs_mkfs/main.c
+++ b/gfs/gfs_mkfs/main.c
@@ -34,7 +34,7 @@
*
*/
-static void print_usage()
+static void print_usage(void)
{
printf("Usage:\n");
printf("\n");
@@ -204,7 +204,7 @@ static void decode_arguments(int argc, char *argv[], commandline_t *comline)
*
*/
-void are_you_sure(commandline_t *comline)
+static void are_you_sure(commandline_t *comline)
{
char input[32];
struct volume_id *vid = NULL;
@@ -250,7 +250,7 @@ void are_you_sure(commandline_t *comline)
*
*/
-void check_mount(char *device)
+static void check_mount(char *device)
{
struct stat st_buf;
int fd;
@@ -281,7 +281,7 @@ void check_mount(char *device)
*
*/
-void print_results(commandline_t *comline)
+static void print_results(commandline_t *comline)
{
if (comline->quiet)
return;
diff --git a/gfs/gfs_mkfs/structures.c b/gfs/gfs_mkfs/structures.c
index 9a33d70..2376f27 100644
--- a/gfs/gfs_mkfs/structures.c
+++ b/gfs/gfs_mkfs/structures.c
@@ -365,7 +365,7 @@ void write_jindex(commandline_t *comline, osi_list_t *jlist)
static char *fill_rindex(commandline_t *comline, osi_list_t *rlist)
{
- struct gfs_rindex *ri, rindex;
+ struct gfs_rindex *ri, grindex;
rgrp_list_t *rl;
osi_list_t *tmp;
char *buf;
@@ -402,10 +402,10 @@ static char *fill_rindex(commandline_t *comline, osi_list_t *rlist)
printf("\nResource Index data:\n");
for (r = 0; r < comline->rgrps; r++) {
- gfs_rindex_in(&rindex, buf + r * sizeof(struct gfs_rindex));
+ gfs_rindex_in(&grindex, buf + r * sizeof(struct gfs_rindex));
printf("\n Resource index %d\n", r);
- gfs_rindex_print(&rindex);
+ gfs_rindex_print(&grindex);
}
}
return buf;
diff --git a/gfs/gfs_quota/check.c b/gfs/gfs_quota/check.c
index 5645263..a8fca14 100644
--- a/gfs/gfs_quota/check.c
+++ b/gfs/gfs_quota/check.c
@@ -195,7 +195,10 @@ read_quota_file(commandline_t *comline, osi_list_t *uid, osi_list_t *gid)
hidden_blocks = compute_hidden_blocks(comline, fd);
do {
- char *argv[] = { "do_hfile_read", "quota" };
+ char *argv[] = {
+ (char *)"do_hfile_read",
+ (char *)"quota"
+ };
gi.gi_argc = 2;
gi.gi_argv = argv;
@@ -238,7 +241,7 @@ read_quota_file(commandline_t *comline, osi_list_t *uid, osi_list_t *gid)
*/
static void
-print_list(char *str, osi_list_t *list)
+print_list(const char *str, osi_list_t *list)
{
#if 0
osi_list_t *tmp;
@@ -261,7 +264,7 @@ print_list(char *str, osi_list_t *list)
*/
static int
-do_compare(char *type, osi_list_t *fs_list, osi_list_t *qf_list)
+do_compare(const char *type, osi_list_t *fs_list, osi_list_t *qf_list)
{
osi_list_t *tmp1, *tmp2;
values_t *v1, *v2;
@@ -444,7 +447,10 @@ set_list(commandline_t *comline, int user, osi_list_t *list, int64_t multiplier)
value = cpu_to_gfs64(value);
{
- char *argv[] = { "do_hfile_write", "quota"};
+ char *argv[] = {
+ (char *)"do_hfile_write",
+ (char *)"quota"
+ };
gi.gi_argc = 2;
gi.gi_argv = argv;
@@ -463,7 +469,10 @@ set_list(commandline_t *comline, int user, osi_list_t *list, int64_t multiplier)
v->v_id);
{
- char *argv[] = { "do_quota_refresh", buf };
+ char *argv[] = {
+ (char *)"do_quota_refresh",
+ (char *)buf
+ };
gi.gi_argc = 2;
gi.gi_argv = argv;
@@ -507,7 +516,10 @@ add_hidden(commandline_t *comline)
for (;;) {
{
- char *argv[] = { "do_hfile_read", "quota" };
+ char *argv[] = {
+ (char *)"do_hfile_read",
+ (char *)"quota"
+ };
gi.gi_argc = 2;
gi.gi_argv = argv;
@@ -526,7 +538,10 @@ add_hidden(commandline_t *comline)
value = cpu_to_gfs64(value);
{
- char *argv[] = { "do_hfile_write", "quota" };
+ char *argv[] = {
+ (char *)"do_hfile_write",
+ (char *)"quota"
+ };
gi.gi_argc = 2;
gi.gi_argv = argv;
@@ -545,7 +560,10 @@ add_hidden(commandline_t *comline)
0);
{
- char *argv[] = { "do_quota_refresh", buf };
+ char *argv[] = {
+ (char *)"do_quota_refresh",
+ (char *)buf
+ };
gi.gi_argc = 2;
gi.gi_argv = argv;
diff --git a/gfs/gfs_quota/gfs_quota.h b/gfs/gfs_quota/gfs_quota.h
index a7a7670..ea224b1 100644
--- a/gfs/gfs_quota/gfs_quota.h
+++ b/gfs/gfs_quota/gfs_quota.h
@@ -77,6 +77,10 @@ void check_for_gfs(int fd, char *path);
void do_get_super(int fd, struct gfs_sb *sb);
void do_sync(commandline_t *comline);
uint64_t compute_hidden_blocks(commandline_t *comline, int fd);
+void print_quota(commandline_t *comline,
+ int user, uint32_t id,
+ struct gfs_quota *q,
+ struct gfs_sb *sb);
/* check.c */
diff --git a/gfs/gfs_quota/layout.c b/gfs/gfs_quota/layout.c
index 015a5a5..f629bbb 100644
--- a/gfs/gfs_quota/layout.c
+++ b/gfs/gfs_quota/layout.c
@@ -22,12 +22,6 @@
#define LAYOUT_DATA_QUANTUM (4194304)
-extern void
-print_quota(commandline_t *comline,
- int user, uint32_t id,
- struct gfs_quota *q,
- struct gfs_sb *sb);
-
struct extent {
osi_list_t list;
@@ -143,7 +137,7 @@ check_list(world_t *w)
osi_list_t *tmp;
buffer_t *b;
struct gfs_meta_header mh;
- char *type;
+ const char *type;
for (tmp = w->blist.next; tmp != &w->blist; tmp = tmp->next) {
b = osi_list_entry(tmp, buffer_t, list);
@@ -391,7 +385,7 @@ get_dblk_ranges(world_t *w)
*
*/
-void
+static void
compute_layout(char *path)
{
world_t w;
@@ -413,7 +407,9 @@ compute_layout(char *path)
check_for_gfs(fd, path);
{
- char *argv[] = { "get_super" };
+ char *argv[] = {
+ (char *)"get_super"
+ };
gi.gi_argc = 1;
gi.gi_argv = argv;
@@ -436,7 +432,9 @@ compute_layout(char *path)
w.hash_ptrs = w.hash_bsize / sizeof(uint64_t);
for (;;) {
- char *argv[] = { "get_file_meta_quota" };
+ char *argv[] = {
+ (char *)"get_file_meta_quota"
+ };
w.buf_data = malloc(w.buf_size);
if (!w.buf_data)
@@ -479,7 +477,7 @@ compute_layout(char *path)
* @argv:
*
*/
-void
+static void
print_quota_range(commandline_t *comline, int type, uint64_t start,
unsigned int len)
{
@@ -529,7 +527,10 @@ print_quota_range(commandline_t *comline, int type, uint64_t start,
hidden_blocks = compute_hidden_blocks(comline, fd);
do {
- char *argv[] = { "do_hfile_read", "quota" };
+ char *argv[] = {
+ (char *)"do_hfile_read",
+ (char *)"quota"
+ };
gi.gi_argc = 2;
gi.gi_argv = argv;
diff --git a/gfs/gfs_quota/main.c b/gfs/gfs_quota/main.c
index abdbeaf..0bc6d51 100644
--- a/gfs/gfs_quota/main.c
+++ b/gfs/gfs_quota/main.c
@@ -36,7 +36,7 @@ char *prog_name;
*/
static void
-print_usage()
+print_usage(void)
{
printf("Usage:\n");
printf("\n");
@@ -96,7 +96,9 @@ void
do_get_super(int fd, struct gfs_sb *sb)
{
struct gfs_ioctl gi;
- char *argv[] = { "get_super" };
+ char *argv[] = {
+ (char *)"get_super"
+ };
int error;
gi.gi_argc = 1;
@@ -260,7 +262,10 @@ compute_hidden_blocks(commandline_t *comline, int fd)
int error;
{
- char *argv[] = { "get_hfile_stat", "jindex" };
+ char *argv[] = {
+ (char *)"get_hfile_stat",
+ (char *)"jindex"
+ };
gi.gi_argc = 2;
gi.gi_argv = argv;
@@ -275,7 +280,10 @@ compute_hidden_blocks(commandline_t *comline, int fd)
}
{
- char *argv[] = { "get_hfile_stat", "rindex" };
+ char *argv[] = {
+ (char *)"get_hfile_stat",
+ (char *)"rindex"
+ };
gi.gi_argc = 2;
gi.gi_argv = argv;
@@ -290,7 +298,10 @@ compute_hidden_blocks(commandline_t *comline, int fd)
}
{
- char *argv[] = { "get_hfile_stat", "quota" };
+ char *argv[] = {
+ (char *)"get_hfile_stat",
+ (char *)"quota"
+ };
gi.gi_argc = 2;
gi.gi_argv = argv;
@@ -305,7 +316,10 @@ compute_hidden_blocks(commandline_t *comline, int fd)
}
{
- char *argv[] = { "get_hfile_stat", "license" };
+ char *argv[] = {
+ (char *)"get_hfile_stat",
+ (char *)"license"
+ };
gi.gi_argc = 2;
gi.gi_argv = argv;
@@ -402,7 +416,9 @@ static void
do_sync_one(char *filesystem)
{
int fd;
- char *argv[] = { "do_quota_sync" };
+ char *argv[] = {
+ (char *)"do_quota_sync"
+ };
struct gfs_ioctl gi;
int error;
@@ -485,7 +501,10 @@ do_get_one(commandline_t *comline, char *filesystem)
comline->id);
{
- char *argv[] = { "do_quota_read", buf };
+ char *argv[] = {
+ (char *)"do_quota_read",
+ (char *)buf
+ };
gi.gi_argc = 2;
gi.gi_argv = argv;
@@ -639,7 +658,10 @@ do_set(commandline_t *comline)
new_value = cpu_to_gfs64(new_value);
{
- char *argv[] = { "do_hfile_write", "quota" };
+ char *argv[] = {
+ (char *)"do_hfile_write",
+ (char *)"quota"
+ };
gi.gi_argc = 2;
gi.gi_argv = argv;
@@ -658,7 +680,10 @@ do_set(commandline_t *comline)
comline->id);
{
- char *argv[] = { "do_quota_refresh", buf };
+ char *argv[] = {
+ (char *)"do_quota_refresh",
+ (char *)buf
+ };
gi.gi_argc = 2;
gi.gi_argv = argv;
diff --git a/gfs/gfs_tool/counters.c b/gfs/gfs_tool/counters.c
index 641428a..80f3de3 100644
--- a/gfs/gfs_tool/counters.c
+++ b/gfs/gfs_tool/counters.c
@@ -172,12 +172,14 @@ print_counters(int argc, char **argv)
for (;;) {
struct gfs_ioctl gi;
- char *argv[] = { "get_counters" };
+ char *local_argv[] = {
+ (char *)"get_counters"
+ };
char data[SIZE];
int error;
gi.gi_argc = 1;
- gi.gi_argv = argv;
+ gi.gi_argv = local_argv;
gi.gi_data = data;
gi.gi_size = SIZE;
diff --git a/gfs/gfs_tool/df.c b/gfs/gfs_tool/df.c
index 9a1ffbb..2bedb11 100644
--- a/gfs/gfs_tool/df.c
+++ b/gfs/gfs_tool/df.c
@@ -40,28 +40,28 @@ static const char *anthropomorphize(uint64_t inhuman_value)
* printit - parse out and print values according to the output type
*/
static void printit(char *stat_gfs, const char *label, uint64_t used,
- uint64_t free, unsigned int percentage)
+ uint64_t free_space, unsigned int percentage)
{
uint64_t block_size = name2u64(stat_gfs, "bsize");
switch (output_type) {
case OUTPUT_BLOCKS:
printf(" %-15s%-15"PRIu64"%-15"PRIu64"%-15"PRIu64"%u%%\n",
- label, used + free, used, free, percentage);
+ label, used + free_space, used, free_space, percentage);
break;
case OUTPUT_K:
printf(" %-15s%-15"PRIu64"%-15"PRIu64"%-15"PRIu64"%u%%\n",
- label, ((used + free) * block_size) / 1024,
- (used * block_size) / 1024, (free * block_size) / 1024,
+ label, ((used + free_space) * block_size) / 1024,
+ (used * block_size) / 1024, (free_space * block_size) / 1024,
percentage);
break;
case OUTPUT_HUMAN:
/* Need to do three separate printfs here because function
anthropomorphize re-uses the same static space. */
printf(" %-15s%-15s", label,
- anthropomorphize((used + free) * block_size));
+ anthropomorphize((used + free_space) * block_size));
printf("%-15s", anthropomorphize(used * block_size));
- printf("%-15s%u%%\n", anthropomorphize(free * block_size),
+ printf("%-15s%u%%\n", anthropomorphize(free_space * block_size),
percentage);
break;
}
@@ -96,7 +96,9 @@ do_df_one(char *path)
{
- char *argv[] = { "get_stat_gfs" };
+ char *argv[] = {
+ (char *)"get_stat_gfs"
+ };
gi.gi_argc = 1;
gi.gi_argv = argv;
@@ -109,7 +111,9 @@ do_df_one(char *path)
error, strerror(errno));
}
{
- char *argv[] = { "get_super" };
+ char *argv[] = {
+ (char *)"get_super"
+ };
gi.gi_argc = 1;
gi.gi_argv = argv;
@@ -122,7 +126,9 @@ do_df_one(char *path)
error, strerror(errno));
}
{
- char *argv[] = { "get_args" };
+ char *argv[] = {
+ (char *)"get_args"
+ };
gi.gi_argc = 1;
gi.gi_argv = argv;
@@ -135,7 +141,9 @@ do_df_one(char *path)
error, strerror(errno));
}
{
- char *argv[] = { "get_lockstruct" };
+ char *argv[] = {
+ (char *)"get_lockstruct"
+ };
gi.gi_argc = 1;
gi.gi_argv = argv;
@@ -148,8 +156,10 @@ do_df_one(char *path)
error, strerror(errno));
}
{
- char *argv[] = { "get_hfile_stat",
- "jindex" };
+ char *argv[] = {
+ (char *)"get_hfile_stat",
+ (char *)"jindex"
+ };
gi.gi_argc = 2;
gi.gi_argv = argv;
@@ -162,8 +172,10 @@ do_df_one(char *path)
error, strerror(errno));
}
{
- char *argv[] = { "get_hfile_stat",
- "rindex" };
+ char *argv[] = {
+ (char *)"get_hfile_stat",
+ (char *)"rindex"
+ };
gi.gi_argc = 2;
gi.gi_argv = argv;
diff --git a/gfs/gfs_tool/gfs_tool.h b/gfs/gfs_tool/gfs_tool.h
index 025917e..db9cdf4 100644
--- a/gfs/gfs_tool/gfs_tool.h
+++ b/gfs/gfs_tool/gfs_tool.h
@@ -86,9 +86,9 @@ void check_for_gfs(int fd, char *path);
char *get_list(void);
char **str2lines(char *str);
char *mp2cookie(char *mp, int ioctl_ok);
-char *name2value(char *str, char *name);
-uint32_t name2u32(char *str, char *name);
-uint64_t name2u64(char *str, char *name);
+char *name2value(char *str, const char *name);
+uint32_t name2u32(char *str, const char *name);
+uint64_t name2u64(char *str, const char *name);
#endif /* __GFS_TOOL_DOT_H__ */
diff --git a/gfs/gfs_tool/layout.c b/gfs/gfs_tool/layout.c
index e86e8f8..ad6411d 100644
--- a/gfs/gfs_tool/layout.c
+++ b/gfs/gfs_tool/layout.c
@@ -106,7 +106,7 @@ check_list(world_t *w)
osi_list_t *tmp;
buffer_t *b;
struct gfs_meta_header mh;
- char *type;
+ const char *type;
for (tmp = w->blist.next; tmp != &w->blist; tmp = tmp->next) {
b = osi_list_entry(tmp, buffer_t, list);
@@ -321,7 +321,7 @@ foreach_leaf(world_t *w, leaf_call_t lc, void *data)
struct gfs_leaf leaf;
uint32_t hsize, len;
uint32_t ht_offset, lp_offset, ht_offset_cur = -1;
- uint32_t index = 0;
+ uint32_t lindex = 0;
uint64_t lp[w->hash_ptrs];
uint64_t leaf_no;
@@ -329,9 +329,9 @@ foreach_leaf(world_t *w, leaf_call_t lc, void *data)
if (hsize * sizeof(uint64_t) != w->di.di_size)
die("bad hash table size\n");
- while (index < hsize) {
- lp_offset = index % w->hash_ptrs;
- ht_offset = index - lp_offset;
+ while (lindex < hsize) {
+ lp_offset = lindex % w->hash_ptrs;
+ ht_offset = lindex - lp_offset;
if (ht_offset_cur != ht_offset) {
journaled_read(w, (char *) lp,
@@ -349,12 +349,12 @@ foreach_leaf(world_t *w, leaf_call_t lc, void *data)
len = 1 << (w->di.di_depth - leaf.lf_depth);
- lc(w, index, len, leaf_no, data);
+ lc(w, lindex, len, leaf_no, data);
- index += len;
+ lindex += len;
}
- if (index != hsize)
+ if (lindex != hsize)
die("screwed up directory\n");
}
@@ -461,7 +461,7 @@ print_file(world_t *w)
{
do_pf_t pf;
unsigned int h;
- char *type;
+ const char *type;
switch (w->di.di_type) {
case GFS_FILE_REG:
@@ -540,7 +540,7 @@ print_file(world_t *w)
*/
static void
-do_lc(world_t *w, uint32_t index, uint32_t len, uint64_t leaf_no, void *data)
+do_lc(world_t *w, uint32_t lindex, uint32_t len, uint64_t leaf_no, void *data)
{
buffer_t *b;
struct gfs_leaf leaf;
@@ -551,8 +551,8 @@ do_lc(world_t *w, uint32_t index, uint32_t len, uint64_t leaf_no, void *data)
gfs_leaf_in(&leaf, b->data);
printf(" %.8X %.8X %-20" PRIu64
- " %u\n", index << (32 - w->di.di_depth),
- ((index + len) << (32 - w->di.di_depth)) - 1, blk,
+ " %u\n", lindex << (32 - w->di.di_depth),
+ ((lindex + len) << (32 - w->di.di_depth)) - 1, blk,
leaf.lf_entries);
}
@@ -598,17 +598,16 @@ print_leaves(world_t *w)
sizeof(struct gfs_meta_header)))
static void
-print_eattr_data(world_t *w, uint64_t blkno, int *first)
+print_eattr_data(world_t *w, uint64_t eblkno, int *first)
{
- buffer_t *b = getbuf(w, blkno);
struct gfs_ea_header *ea;
- ea = GFS_EA_BH2FIRST(b);
+ ea = GFS_EA_BH2FIRST(getbuf(w, eblkno));
for (;;) {
if (!GFS_EA_IS_STUFFED(ea)) {
char name[300];
uint64_t *p, blkno;
- uint64_t b;
+ uint64_t d;
unsigned int l;
unsigned int x;
int c;
@@ -623,7 +622,6 @@ print_eattr_data(world_t *w, uint64_t blkno, int *first)
if (ea->ea_type == GFS_EATYPE_UNUSED)
strcpy(name, "unused");
else {
- unsigned int x;
switch (ea->ea_type) {
case GFS_EATYPE_USR:
strcpy(name, "user.");
@@ -641,31 +639,32 @@ print_eattr_data(world_t *w, uint64_t blkno, int *first)
name[x + ea->ea_name_len] = 0;
}
- b = 0;
+ d = 0;
l = 0;
+ x = 0;
c = FALSE;
p = GFS_EA2DATAPTRS(ea);
for (x = 0; x < ea->ea_num_ptrs; x++) {
blkno = gfs64_to_cpu(*p);
- if (b + l == blkno)
+ if (d + l == blkno)
l++;
else {
- if (b) {
+ if (d) {
printf(" %-20" PRIu64
- " %-10u %s\n", b, l,
+ " %-10u %s\n", d, l,
name);
if (!c) {
strcat(name, " (cont)");
c = TRUE;
}
}
- b = blkno;
+ d = blkno;
l = 1;
}
p++;
}
- printf(" %-20" PRIu64 " %-10u %s\n", b, l, name);
+ printf(" %-20" PRIu64 " %-10u %s\n", d, l, name);
}
if (GFS_EA_IS_LAST(ea))
break;
@@ -775,10 +774,12 @@ print_layout(int argc, char **argv)
check_for_gfs(fd, path);
{
- char *argv[] = { "get_super" };
+ char *local_argv[] = {
+ (char *)"get_super"
+ };
gi.gi_argc = 1;
- gi.gi_argv = argv;
+ gi.gi_argv = local_argv;
gi.gi_data = (char *)&w.sb;
gi.gi_size = sizeof(struct gfs_sb);
@@ -797,14 +798,16 @@ print_layout(int argc, char **argv)
w.hash_ptrs = w.hash_bsize / sizeof(uint64_t);
for (;;) {
- char *argv[] = { "get_file_meta" };
+ char *local_argv[] = {
+ (char *)"get_file_meta"
+ };
w.buf_data = malloc(w.buf_size);
if (!w.buf_data)
die("out of memory\n");
gi.gi_argc = 1;
- gi.gi_argv = argv;
+ gi.gi_argv = local_argv;
gi.gi_data = w.buf_data;
gi.gi_size = w.buf_size;
diff --git a/gfs/gfs_tool/misc.c b/gfs/gfs_tool/misc.c
index bd699f2..08b14d2 100644
--- a/gfs/gfs_tool/misc.c
+++ b/gfs/gfs_tool/misc.c
@@ -27,7 +27,9 @@
void
do_file_flush(int argc, char **argv)
{
- char *gi_argv[] = { "do_file_flush" };
+ char *gi_argv[] = {
+ (char *)"do_file_flush"
+ };
struct gfs_ioctl gi;
int fd;
int error;
@@ -250,7 +252,7 @@ void
set_flag(int argc, char **argv)
{
struct gfs_dinode di;
- char *set;
+ const char *set;
char *flag;
struct gfs_ioctl gi;
int fd;
@@ -273,9 +275,11 @@ set_flag(int argc, char **argv)
check_for_gfs(fd, argv[optind]);
{
- char *gi_argv[] = { "set_file_flag",
- set,
- flag };
+ char *gi_argv[] = {
+ (char *)"set_file_flag",
+ (char *)set,
+ (char *)flag
+ };
gi.gi_argc = 3;
gi.gi_argv = gi_argv;
@@ -299,7 +303,9 @@ void
print_stat(int argc, char **argv)
{
int fd;
- char *gi_argv[] = { "get_file_stat" };
+ char *gi_argv[] = {
+ (char *)"get_file_stat"
+ };
struct gfs_ioctl gi;
struct gfs_dinode di;
int error;
@@ -341,7 +347,9 @@ void
print_sb(int argc, char **argv)
{
int fd;
- char *gi_argv[] = { "get_super" };
+ char *gi_argv[] = {
+ (char *)"get_super"
+ };
struct gfs_ioctl gi;
struct gfs_sb sb;
int error;
@@ -398,12 +406,14 @@ print_jindex(int argc, char **argv)
{
- char *argv[] = { "get_hfile_stat",
- "jindex" };
+ char *local_argv[] = {
+ (char *)"get_hfile_stat",
+ (char *)"jindex"
+ };
struct gfs_dinode di;
gi.gi_argc = 2;
- gi.gi_argv = argv;
+ gi.gi_argv = local_argv;
gi.gi_data = (char *)&di;
gi.gi_size = sizeof(struct gfs_dinode);
@@ -417,13 +427,15 @@ print_jindex(int argc, char **argv)
for (offset = 0, x = 0; ; offset += sizeof(struct gfs_jindex), x++) {
- char *argv[] = { "do_hfile_read",
- "jindex" };
+ char *local_argv[] = {
+ (char *)"do_hfile_read",
+ (char *)"jindex"
+ };
char buf[sizeof(struct gfs_jindex)];
struct gfs_jindex ji;
gi.gi_argc = 2;
- gi.gi_argv = argv;
+ gi.gi_argv = local_argv;
gi.gi_data = buf;
gi.gi_size = sizeof(struct gfs_jindex);
gi.gi_offset = offset;
@@ -473,12 +485,14 @@ print_rindex(int argc, char **argv)
{
- char *argv[] = { "get_hfile_stat",
- "rindex" };
+ char *local_argv[] = {
+ (char *)"get_hfile_stat",
+ (char *)"rindex"
+ };
struct gfs_dinode di;
gi.gi_argc = 2;
- gi.gi_argv = argv;
+ gi.gi_argv = local_argv;
gi.gi_data = (char *)&di;
gi.gi_size = sizeof(struct gfs_dinode);
@@ -492,13 +506,15 @@ print_rindex(int argc, char **argv)
for (offset = 0, x = 0; ; offset += sizeof(struct gfs_rindex), x++) {
- char *argv[] = { "do_hfile_read",
- "rindex" };
+ char *local_argv[] = {
+ (char *)"do_hfile_read",
+ (char *)"rindex"
+ };
char buf[sizeof(struct gfs_rindex)];
struct gfs_rindex ri;
gi.gi_argc = 2;
- gi.gi_argv = argv;
+ gi.gi_argv = local_argv;
gi.gi_data = buf;
gi.gi_size = sizeof(struct gfs_rindex);
gi.gi_offset = offset;
@@ -548,12 +564,14 @@ print_quota(int argc, char **argv)
{
- char *argv[] = { "get_hfile_stat",
- "quota" };
+ char *local_argv[] = {
+ (char *)"get_hfile_stat",
+ (char *)"quota"
+ };
struct gfs_dinode di;
gi.gi_argc = 2;
- gi.gi_argv = argv;
+ gi.gi_argv = local_argv;
gi.gi_data = (char *)&di;
gi.gi_size = sizeof(struct gfs_dinode);
@@ -567,13 +585,15 @@ print_quota(int argc, char **argv)
for (offset = 0, x = 0; ; offset += sizeof(struct gfs_quota), x++) {
- char *argv[] = { "do_hfile_read",
- "quota" };
+ char *local_argv[] = {
+ (char *)"do_hfile_read",
+ (char *)"quota"
+ };
char buf[sizeof(struct gfs_quota)];
struct gfs_quota q;
gi.gi_argc = 2;
- gi.gi_argv = argv;
+ gi.gi_argv = local_argv;
gi.gi_data = buf;
gi.gi_size = sizeof(struct gfs_quota);
gi.gi_offset = offset;
@@ -624,7 +644,9 @@ void
reclaim_metadata(int argc, char **argv)
{
int fd;
- char *gi_argv[] = { "do_reclaim" };
+ char *gi_argv[] = {
+ (char *)"do_reclaim"
+ };
struct gfs_ioctl gi;
char buf[256];
@@ -671,7 +693,9 @@ void
do_shrink(int argc, char **argv)
{
int fd;
- char *gi_argv[] = { "do_shrink" };
+ char *gi_argv[] = {
+ (char *)"do_shrink"
+ };
struct gfs_ioctl gi;
if (optind == argc)
diff --git a/gfs/gfs_tool/tune.c b/gfs/gfs_tool/tune.c
index 85be170..9e3af67 100644
--- a/gfs/gfs_tool/tune.c
+++ b/gfs/gfs_tool/tune.c
@@ -29,7 +29,9 @@ void
get_tune(int argc, char **argv)
{
int fd;
- char *gi_argv[] = { "get_tune" };
+ char *gi_argv[] = {
+ (char *)"get_tune"
+ };
struct gfs_ioctl gi;
char str[SIZE], str2[SIZE];
char **lines, **l;
@@ -121,10 +123,14 @@ set_tune(int argc, char **argv)
}
{
- char *argv[] = { "set_tune", param, value };
+ char *local_argv[] = {
+ (char *)"set_tune",
+ (char *)param,
+ (char *)value
+ };
gi.gi_argc = 3;
- gi.gi_argv = argv;
+ gi.gi_argv = local_argv;
if (ioctl(fd, GFS_IOCTL_SUPER, &gi))
die("can't change tunable parameter %s: %s\n",
diff --git a/gfs/gfs_tool/util.c b/gfs/gfs_tool/util.c
index 653e258..f467b7e 100644
--- a/gfs/gfs_tool/util.c
+++ b/gfs/gfs_tool/util.c
@@ -170,7 +170,9 @@ mp2cookie(char *mp, int ioctl_ok)
if (ioctl_ok) {
struct gfs_ioctl gi;
- char *argv[] = { "get_cookie" };
+ char *argv[] = {
+ (char *)"get_cookie"
+ };
int fd;
gi.gi_argc = 1;
@@ -206,7 +208,7 @@ mp2cookie(char *mp, int ioctl_ok)
*/
char *
-name2value(char *str_in, char *name)
+name2value(char *str_in, const char *name)
{
char str[strlen(str_in) + 1];
static char value[256];
@@ -240,7 +242,7 @@ name2value(char *str_in, char *name)
*/
uint32_t
-name2u32(char *str, char *name)
+name2u32(char *str, const char *name)
{
char *value = name2value(str, name);
uint32_t x = 0;
@@ -259,7 +261,7 @@ name2u32(char *str, char *name)
*/
uint64_t
-name2u64(char *str, char *name)
+name2u64(char *str, const char *name)
{
char *value = name2value(str, name);
uint64_t x = 0;
diff --git a/gfs/libgfs/file.c b/gfs/libgfs/file.c
index ff1dd2a..7707cdf 100644
--- a/gfs/libgfs/file.c
+++ b/gfs/libgfs/file.c
@@ -11,7 +11,7 @@
*
* Returns: The amount of data actually copied or the error
*/
-int readi(int disk_fd, struct gfs_inode *ip, void *buf, uint64 offset,
+int readi(int disk_fd, struct gfs_inode *ip, void *bufin, uint64 offset,
unsigned int size)
{
struct gfs_sbd *sdp = ip->i_sbd;
@@ -23,6 +23,7 @@ int readi(int disk_fd, struct gfs_inode *ip, void *buf, uint64 offset,
int journaled = fs_is_jdata(ip);
int copied = 0;
int error = 0;
+ char *buf = bufin;
if (offset >= ip->i_di.di_size){
log_debug("readi: Offset (%"PRIu64") is >= "
@@ -109,7 +110,7 @@ int readi(int disk_fd, struct gfs_inode *ip, void *buf, uint64 offset,
*
* Returns: The number of bytes correctly written or error code
*/
-int writei(int disk_fd, struct gfs_inode *ip, void *buf, uint64_t offset,
+int writei(int disk_fd, struct gfs_inode *ip, void *bufin, uint64_t offset,
unsigned int size)
{
struct gfs_sbd *sdp = ip->i_sbd;
@@ -122,6 +123,7 @@ int writei(int disk_fd, struct gfs_inode *ip, void *buf, uint64_t offset,
const uint64_t start = offset;
int copied = 0;
int error = 0;
+ char *buf = bufin;
/* Bomb out on writing nothing.
Posix says we can't change the time here. */
diff --git a/gfs/libgfs/fs_bits.c b/gfs/libgfs/fs_bits.c
index 3509763..db6f36d 100644
--- a/gfs/libgfs/fs_bits.c
+++ b/gfs/libgfs/fs_bits.c
@@ -28,7 +28,7 @@ static void fs_setbit(unsigned char *buffer, unsigned int buflen,
*byte |= new_state << bit;
}
-uint32_t fs_bitfit_core(struct gfs_sbd *sbp, uint64_t goal, uint64_t start,
+static uint32_t fs_bitfit_core(struct gfs_sbd *sbp, uint64_t goal, uint64_t start,
uint64_t len, unsigned char old_state)
{
uint64_t block;
diff --git a/gfs/libgfs/fs_dir.c b/gfs/libgfs/fs_dir.c
index fe34b8a..63187a0 100644
--- a/gfs/libgfs/fs_dir.c
+++ b/gfs/libgfs/fs_dir.c
@@ -199,19 +199,19 @@ int get_leaf(int disk_fd, struct gfs_inode *dip, uint64 leaf_no,
/**
* get_first_leaf - Get first leaf
* @dip: The GFS inode
- * @index:
+ * @lindex:
* @bh_out:
*
* Returns: 0 on success, error code otherwise
*/
-int get_first_leaf(int disk_fd, struct gfs_inode *dip, uint32 index,
+int get_first_leaf(int disk_fd, struct gfs_inode *dip, uint32 lindex,
osi_buf_t **bh_out)
{
uint64 leaf_no;
int error;
- error = get_leaf_nr(disk_fd, dip, index, &leaf_no);
+ error = get_leaf_nr(disk_fd, dip, lindex, &leaf_no);
if (!error)
error = get_leaf(disk_fd, dip, leaf_no, bh_out);
@@ -348,7 +348,7 @@ static int linked_leaf_search(int disk_fd, struct gfs_inode *dip,
struct gfs_dirent **dent_prev, osi_buf_t **bh_out)
{
osi_buf_t *bh = NULL, *bh_next;
- uint32 hsize, index;
+ uint32 hsize, lindex;
uint32 hash;
int error = 0;
@@ -362,9 +362,9 @@ static int linked_leaf_search(int disk_fd, struct gfs_inode *dip,
if(id->type == ID_FILENAME){
hash = dir_hash(id->filename);
- index = hash >> (32 - dip->i_di.di_depth);
+ lindex = hash >> (32 - dip->i_di.di_depth);
- error = get_first_leaf(disk_fd, dip, index, &bh_next);
+ error = get_first_leaf(disk_fd, dip, lindex, &bh_next);
if (error){
return error;
}
@@ -395,8 +395,8 @@ static int linked_leaf_search(int disk_fd, struct gfs_inode *dip,
relse_buf(bh);
} else if(id->type == ID_INUM){
- for(index=0; index < (1 << dip->i_di.di_depth); index++){
- error = get_first_leaf(disk_fd, dip, index, &bh_next);
+ for(lindex=0; lindex < (1 << dip->i_di.di_depth); lindex++){
+ error = get_first_leaf(disk_fd, dip, lindex, &bh_next);
if (error){
return error;
}
@@ -728,12 +728,12 @@ static int dir_make_exhash(int disk_fd, struct gfs_inode *dip)
/**
* dir_split_leaf - Split a leaf block into two
* @dip: The GFS inode
- * @index:
+ * @lindex:
* @leaf_no:
*
* Returns: 0 on success, error code on failure
*/
-static int dir_split_leaf(int disk_fd, struct gfs_inode *dip, uint32 index,
+static int dir_split_leaf(int disk_fd, struct gfs_inode *dip, uint32 lindex,
uint64 leaf_no)
{
struct gfs_sbd *sdp = dip->i_sbd;
@@ -792,7 +792,7 @@ static int dir_split_leaf(int disk_fd, struct gfs_inode *dip, uint32 index,
}
half_len = len >> 1;
- start = (index & ~(len - 1));
+ start = (lindex & ~(len - 1));
log_debug("Splitting leaf: len = %u, half_len = %u\n", len, half_len);
@@ -1070,7 +1070,7 @@ static int dir_double_exhash(int disk_fd, struct gfs_inode *dip)
static int dir_e_del(int disk_fd, struct gfs_inode *dip, osi_filename_t *filename){
- int index;
+ int lindex;
int error;
int found = 0;
uint64 leaf_no;
@@ -1082,10 +1082,10 @@ static int dir_e_del(int disk_fd, struct gfs_inode *dip, osi_filename_t *filenam
id.filename = filename;
id.inum = NULL;
- index = (1 << (dip->i_di.di_depth))-1;
+ lindex = (1 << (dip->i_di.di_depth))-1;
- for(; (index >= 0) && !found; index--){
- error = get_leaf_nr(disk_fd, dip, index, &leaf_no);
+ for(; (lindex >= 0) && !found; lindex--){
+ error = get_leaf_nr(disk_fd, dip, lindex, &leaf_no);
if (error){
log_err("dir_e_del: Unable to get leaf number.\n");
return error;
@@ -1230,7 +1230,7 @@ static int dir_e_add(int disk_fd, struct gfs_inode *dip,
osi_buf_t *bh, *nbh, *dibh;
struct gfs_leaf *leaf, *nleaf;
struct gfs_dirent *dent;
- uint32 hsize, index;
+ uint32 hsize, lindex;
uint32 hash;
uint64 leaf_no, bn;
int error;
@@ -1248,10 +1248,10 @@ static int dir_e_add(int disk_fd, struct gfs_inode *dip,
/* Figure out the address of the leaf node. */
hash = dir_hash(filename);
- index = hash >> (32 - dip->i_di.di_depth);
+ lindex = hash >> (32 - dip->i_di.di_depth);
- error = get_leaf_nr(disk_fd, dip, index, &leaf_no);
+ error = get_leaf_nr(disk_fd, dip, lindex, &leaf_no);
if (error){
log_err("dir_e_add: Unable to get leaf number.\n");
return error;
@@ -1275,7 +1275,7 @@ static int dir_e_add(int disk_fd, struct gfs_inode *dip,
/* Can we split the leaf? */
relse_buf(bh);
- error = dir_split_leaf(disk_fd, dip, index, leaf_no);
+ error = dir_split_leaf(disk_fd, dip, lindex, leaf_no);
if (error){
log_err("dir_e_add: Unable to split leaf.\n");
return error;
@@ -1600,21 +1600,21 @@ int fs_dirent_alloc(int disk_fd, struct gfs_inode *dip, osi_buf_t *bh,
/**
- * get_leaf_nr - Get a leaf number associated with the index
+ * get_leaf_nr - Get a leaf number associated with the lindex
* @dip: The GFS inode
- * @index:
+ * @lindex:
* @leaf_out:
*
* Returns: 0 on success, error code otherwise
*/
-int get_leaf_nr(int disk_fd, struct gfs_inode *dip, uint32 index,
+int get_leaf_nr(int disk_fd, struct gfs_inode *dip, uint32 lindex,
uint64 *leaf_out)
{
uint64 leaf_no;
int error = -1;
error = readi(disk_fd, dip, (char *)&leaf_no,
- index * sizeof(uint64), sizeof(uint64));
+ lindex * sizeof(uint64), sizeof(uint64));
if (error != sizeof(uint64)){
log_debug("get_leaf_nr: Bad internal read. (rtn = %d)\n",
error);
diff --git a/gfs/libgfs/fs_inode.c b/gfs/libgfs/fs_inode.c
index 51f6e9b..2b8d2ca 100644
--- a/gfs/libgfs/fs_inode.c
+++ b/gfs/libgfs/fs_inode.c
@@ -173,7 +173,7 @@ static int fs_lookupi(int disk_fd, struct gfs_inode *dip,
return error;
}
-int fs_createi(int disk_fd, struct gfs_inode *dip, osi_filename_t *name,
+static int fs_createi(int disk_fd, struct gfs_inode *dip, osi_filename_t *name,
unsigned int type, unsigned int mode, osi_cred_t *cred,
int *new, struct gfs_inode **ipp)
{
@@ -369,7 +369,7 @@ int fs_mkdir(int disk_fd, struct gfs_inode *dip, char *new_dir,
struct gfs_inode *ip= NULL;
struct gfs_sbd *sdp = dip->i_sbd;
osi_filename_t name;
- int new;
+ int new = 0;
name.name = (unsigned char *)new_dir;
name.len = strlen(new_dir);
diff --git a/gfs/libgfs/libgfs.h b/gfs/libgfs/libgfs.h
index 803c3c0..d4e6237 100644
--- a/gfs/libgfs/libgfs.h
+++ b/gfs/libgfs/libgfs.h
@@ -202,7 +202,7 @@ do { \
void increase_verbosity(void);
void decrease_verbosity(void);
-void print_log_level(int iif, int priority, char *file, int line, const char *format, ...);
+void print_log_level(int iif, int priority, const char *file, int line, const char *format, ...);
int query(struct options *opts, const char *format, ...);
/* ------------------------------------------------------------------------- */
@@ -380,13 +380,16 @@ int get_leaf(int disk_fd, struct gfs_inode *dip, uint64 leaf_no,
/* ------------------------------------------------------------------------- */
/* formerly super.h: */
/* ------------------------------------------------------------------------- */
+int hexdump(uint64 startaddr, const unsigned char *lpBuffer, int len);
int read_sb(int disk_fd, struct gfs_sbd *sdp);
int ji_update(int disk_fd, struct gfs_sbd *sdp);
int ri_update(int disk_fd, struct gfs_sbd *sdp);
+void ri_cleanup(osi_list_t *rglist);
int write_sb(int disk_fd, struct gfs_sbd *sdp);
int set_block_ranges(int disk_fd, struct gfs_sbd *sdp);
int read_super_block(int disk_fd, struct gfs_sbd *sdp);
int compute_constants(struct gfs_sbd *sdp);
+uint32 rgrplength2bitblocks(struct gfs_sbd *sdp, uint32 length);
/* ------------------------------------------------------------------------- */
/* formerly rgrp.h: */
diff --git a/gfs/libgfs/log.c b/gfs/libgfs/log.c
index 52e0942..fe9e152 100644
--- a/gfs/libgfs/log.c
+++ b/gfs/libgfs/log.c
@@ -26,7 +26,7 @@ void decrease_verbosity(void)
_state.print_level--;
}
-void print_msg(int priority, char *file, int line, const char *format, va_list args) {
+static void print_msg(int priority, const char *file, int line, const char *format, va_list args) {
switch (priority) {
@@ -48,7 +48,7 @@ void print_msg(int priority, char *file, int line, const char *format, va_list a
return;
}
-void print_log_level(int iif, int priority, char *file, int line, const char *format, ...)
+void print_log_level(int iif, int priority, const char *file, int line, const char *format, ...)
{
va_list args;
diff --git a/gfs/libgfs/ondisk.c b/gfs/libgfs/ondisk.c
index 1bbd5ef..15ce0b5 100644
--- a/gfs/libgfs/ondisk.c
+++ b/gfs/libgfs/ondisk.c
@@ -37,7 +37,7 @@
*/
static void
-print_array(char *title, char *buf, int count)
+print_array(const char *title, char *buf, int count)
{
int x;
@@ -332,20 +332,20 @@ gfs_jindex_print(struct gfs_jindex *ji)
*/
void
-gfs_rindex_in(struct gfs_rindex *rindex, char *buf)
+gfs_rindex_in(struct gfs_rindex *grindex, char *buf)
{
struct gfs_rindex *str = (struct gfs_rindex *) buf;
- CPIN_64(rindex, str, ri_addr);
- CPIN_32(rindex, str, ri_length);
- CPIN_32(rindex, str, ri_pad);
+ CPIN_64(grindex, str, ri_addr);
+ CPIN_32(grindex, str, ri_length);
+ CPIN_32(grindex, str, ri_pad);
- CPIN_64(rindex, str, ri_data1);
- CPIN_32(rindex, str, ri_data);
+ CPIN_64(grindex, str, ri_data1);
+ CPIN_32(grindex, str, ri_data);
- CPIN_32(rindex, str, ri_bitbytes);
+ CPIN_32(grindex, str, ri_bitbytes);
- CPIN_08(rindex, str, ri_reserved, 64);
+ CPIN_08(grindex, str, ri_reserved, 64);
}
@@ -357,20 +357,20 @@ gfs_rindex_in(struct gfs_rindex *rindex, char *buf)
*/
void
-gfs_rindex_out(struct gfs_rindex *rindex, char *buf)
+gfs_rindex_out(struct gfs_rindex *grindex, char *buf)
{
struct gfs_rindex *str = (struct gfs_rindex *) buf;
- CPOUT_64(rindex, str, ri_addr);
- CPOUT_32(rindex, str, ri_length);
- CPOUT_32(rindex, str, ri_pad);
+ CPOUT_64(grindex, str, ri_addr);
+ CPOUT_32(grindex, str, ri_length);
+ CPOUT_32(grindex, str, ri_pad);
- CPOUT_64(rindex, str, ri_data1);
- CPOUT_32(rindex, str, ri_data);
+ CPOUT_64(grindex, str, ri_data1);
+ CPOUT_32(grindex, str, ri_data);
- CPOUT_32(rindex, str, ri_bitbytes);
+ CPOUT_32(grindex, str, ri_bitbytes);
- CPOUT_08(rindex, str, ri_reserved, 64);
+ CPOUT_08(grindex, str, ri_reserved, 64);
}
@@ -787,7 +787,7 @@ gfs_dirent_out(struct gfs_dirent *dirent, char *buf)
*/
void
-gfs_dirent_print(struct gfs_dirent *de, char *name)
+gfs_dirent_print(struct gfs_dirent *de, const char *name)
{
char buf[GFS_FNAMESIZE + 1];
diff --git a/gfs/libgfs/super.c b/gfs/libgfs/super.c
index c479c27..cf45e94 100644
--- a/gfs/libgfs/super.c
+++ b/gfs/libgfs/super.c
@@ -258,7 +258,6 @@ int hexdump(uint64 startaddr, const unsigned char *lpBuffer, int len)
return (len);
}
-
/**
* rgrplength2bitblocks - blerg - Stolen by Bob from gfs_mkfs. Good
* candidate for gfslib.
diff --git a/gfs/libgfs/util.c b/gfs/libgfs/util.c
index 6e1b34c..998396b 100644
--- a/gfs/libgfs/util.c
+++ b/gfs/libgfs/util.c
@@ -86,13 +86,13 @@ int set_meta(osi_buf_t *bh, int type, int format){
*/
int check_meta(osi_buf_t *bh, int type){
uint32 check_magic = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_magic;
- uint32 check_type = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
+ uint32 check_metatype = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
check_magic = gfs32_to_cpu(check_magic);
- check_type = gfs32_to_cpu(check_type);
- if((check_magic != GFS_MAGIC) || (type && (check_type != type))){
+ check_metatype = gfs32_to_cpu(check_metatype);
+ if((check_magic != GFS_MAGIC) || (type && (check_metatype != type))){
log_debug("For %"PRIu64" Expected %X:%X - got %X:%X\n", BH_BLKNO(bh), GFS_MAGIC, type,
- check_magic, check_type);
+ check_magic, check_metatype);
return -1;
}
return 0;
@@ -107,11 +107,11 @@ int check_meta(osi_buf_t *bh, int type){
*/
int check_type(osi_buf_t *bh, int type){
uint32 check_magic = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_magic;
- uint32 check_type = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
+ uint32 check_metatype = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
check_magic = gfs32_to_cpu(check_magic);
- check_type = gfs32_to_cpu(check_type);
- if((check_magic != GFS_MAGIC) || (check_type != type)){
+ check_metatype = gfs32_to_cpu(check_metatype);
+ if((check_magic != GFS_MAGIC) || (check_metatype != type)){
return -1;
}
return 0;