This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit e84bce321352f8b3521bb3a1756a0887966b4120
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Jun 14 17:58:44 2021 +0100
fsck.gfs2: Fix remaining endianness sparse warnings
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/afterpass1_common.c | 2 +-
gfs2/fsck/afterpass1_common.h | 2 +-
gfs2/fsck/fs_recovery.c | 16 ++++------
gfs2/fsck/initialize.c | 72 ++++++++++++++++---------------------------
gfs2/fsck/lost_n_found.c | 2 +-
gfs2/fsck/metawalk.c | 35 +++++++++++----------
gfs2/fsck/metawalk.h | 8 ++---
gfs2/fsck/pass1.c | 6 ++--
gfs2/fsck/pass1b.c | 12 ++++----
gfs2/fsck/pass2.c | 19 ++++++------
gfs2/fsck/util.c | 4 +--
gfs2/fsck/util.h | 2 +-
gfs2/libgfs2/gfs1.c | 4 +--
gfs2/libgfs2/libgfs2.h | 2 +-
14 files changed, 82 insertions(+), 104 deletions(-)
diff --git a/gfs2/fsck/afterpass1_common.c b/gfs2/fsck/afterpass1_common.c
index 9b849316..6e5fbe0c 100644
--- a/gfs2/fsck/afterpass1_common.c
+++ b/gfs2/fsck/afterpass1_common.c
@@ -279,7 +279,7 @@ int delete_eattr_entry(struct gfs2_inode *ip, struct gfs2_buffer_head *leaf_bh,
return 0;
}
-int delete_eattr_extentry(struct gfs2_inode *ip, int i, uint64_t *ea_data_ptr,
+int delete_eattr_extentry(struct gfs2_inode *ip, int i, __be64 *ea_data_ptr,
struct gfs2_buffer_head *leaf_bh, uint32_t tot_ealen,
struct gfs2_ea_header *ea_hdr,
struct gfs2_ea_header *ea_hdr_prev, void *private)
diff --git a/gfs2/fsck/afterpass1_common.h b/gfs2/fsck/afterpass1_common.h
index e12ed96e..51cb2140 100644
--- a/gfs2/fsck/afterpass1_common.h
+++ b/gfs2/fsck/afterpass1_common.h
@@ -20,7 +20,7 @@ extern int delete_eattr_entry(struct gfs2_inode *ip,
struct gfs2_ea_header *ea_hdr_prev,
void *private);
extern int delete_eattr_extentry(struct gfs2_inode *ip, int i,
- uint64_t *ea_data_ptr,
+ __be64 *ea_data_ptr,
struct gfs2_buffer_head *leaf_bh,
uint32_t tot_ealen,
struct gfs2_ea_header *ea_hdr,
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
index b62f7a65..12b8d704 100644
--- a/gfs2/fsck/fs_recovery.c
+++ b/gfs2/fsck/fs_recovery.c
@@ -138,7 +138,7 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
gfs2_replay_incr_blk(ip, &start);
for (; blks; gfs2_replay_incr_blk(ip, &start), blks--) {
- uint32_t check_magic;
+ struct gfs2_meta_header *mhp;
sd_found_metablocks++;
@@ -162,10 +162,8 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
}
memcpy(bh_ip->b_data, bh_log->b_data, sdp->sd_bsize);
- check_magic = ((struct gfs2_meta_header *)
- (bh_ip->b_data))->mh_magic;
- check_magic = be32_to_cpu(check_magic);
- if (check_magic != GFS2_MAGIC) {
+ mhp = (struct gfs2_meta_header *)bh_ip->b_data;
+ if (be32_to_cpu(mhp->mh_magic) != GFS2_MAGIC) {
log_err(_("Journal corruption detected at block #"
"%lld (0x%llx) for journal+0x%x.\n"),
(unsigned long long)blkno, (unsigned long long)blkno,
@@ -322,15 +320,13 @@ static int foreach_descriptor(struct gfs2_inode *ip, unsigned int start,
offset &= ~(sizeof(__be64) - 1);
while (start != end) {
- uint32_t check_magic;
+ struct gfs2_meta_header *mhp;
error = gfs2_replay_read_block(ip, start, &bh);
if (error)
return error;
- check_magic = ((struct gfs2_meta_header *)
- (bh->b_data))->mh_magic;
- check_magic = be32_to_cpu(check_magic);
- if (check_magic != GFS2_MAGIC) {
+ mhp = (struct gfs2_meta_header *)bh->b_data;
+ if (be32_to_cpu(mhp->mh_magic) != GFS2_MAGIC) {
bmodified(bh);
brelse(bh);
return -EIO;
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index 4bc7eef6..9ba4bc89 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -788,7 +788,7 @@ static int fetch_rgrps(struct gfs2_sbd *sdp)
*/
static int init_system_inodes(struct gfs2_sbd *sdp)
{
- uint64_t inumbuf = 0;
+ __be64 inumbuf = 0;
char *buf;
int err;
@@ -1143,8 +1143,6 @@ static int find_rgs_for_bsize(struct gfs2_sbd *sdp, uint64_t startblock,
uint64_t blk, max_rg_size, rb_addr;
struct gfs2_buffer_head *bh, *rb_bh;
uint32_t bsize, bsize2;
- uint32_t chk;
- char *p;
int found_rg;
sdp->sd_bsize = GFS2_DEFAULT_BSIZE;
@@ -1154,14 +1152,13 @@ static int find_rgs_for_bsize(struct gfs2_sbd *sdp, uint64_t startblock,
for (blk = startblock; blk < startblock + max_rg_size; blk++) {
bh = bread(sdp, blk);
found_rg = 0;
- for (bsize = 0; bsize < GFS2_DEFAULT_BSIZE;
- bsize += GFS2_BASIC_BLOCK) {
- p = bh->b_data + bsize;
- chk = ((struct gfs2_meta_header *)p)->mh_magic;
- if (be32_to_cpu(chk) != GFS2_MAGIC)
+ for (bsize = 0; bsize < GFS2_DEFAULT_BSIZE; bsize += GFS2_BASIC_BLOCK) {
+ struct gfs2_meta_header *mhp;
+
+ mhp = (struct gfs2_meta_header *)(bh->b_data + bsize);
+ if (be32_to_cpu(mhp->mh_magic) != GFS2_MAGIC)
continue;
- chk = ((struct gfs2_meta_header *)p)->mh_type;
- if (be32_to_cpu(chk) == GFS2_METATYPE_RG) {
+ if (be32_to_cpu(mhp->mh_type) == GFS2_METATYPE_RG) {
found_rg = 1;
break;
}
@@ -1382,23 +1379,6 @@ static int fill_super_block(struct gfs2_sbd *sdp)
return 0;
}
-static void gfs_log_header_out(struct gfs_log_header *head, char *buf)
-{
- struct gfs_log_header *str = (struct gfs_log_header *) buf;
-
- str->lh_header.mh_magic = cpu_to_be32(head->lh_header.mh_magic);
- str->lh_header.mh_type = cpu_to_be32(head->lh_header.mh_type);
- str->lh_header.mh_format = cpu_to_be32(head->lh_header.mh_format);
- str->lh_header.__pad0 = cpu_to_be32(head->lh_header.__pad0);
-
- str->lh_flags = cpu_to_be32(head->lh_flags);
- str->lh_pad = cpu_to_be32(head->lh_pad);
- str->lh_first = cpu_to_be64(head->lh_first);
- str->lh_sequence = cpu_to_be64(head->lh_sequence);
- str->lh_tail = cpu_to_be64(head->lh_tail);
- str->lh_last_dump = cpu_to_be64(head->lh_last_dump);
-}
-
/*
* reconstruct_single_journal - write a fresh GFS1 journal
* @sdp: superblock
@@ -1413,31 +1393,33 @@ static void gfs_log_header_out(struct gfs_log_header *head, char *buf)
static int reconstruct_single_journal(struct gfs2_sbd *sdp, int jnum,
uint32_t ji_nsegment)
{
- struct gfs_log_header lh;
- uint32_t seg, sequence;
+ uint64_t first = sdp->md.journal[jnum]->i_num.in_addr;
struct gfs2_buffer_head *bh;
+ uint64_t sequence;
srandom(time(NULL));
sequence = ji_nsegment / (RAND_MAX + 1.0) * random();
log_info(_("Clearing journal %d\n"), jnum);
- for (seg = 0; seg < ji_nsegment; seg++){
- memset(&lh, 0, sizeof(struct gfs_log_header));
-
- lh.lh_header.mh_magic = GFS2_MAGIC;
- lh.lh_header.mh_type = GFS2_METATYPE_LH;
- lh.lh_header.mh_format = GFS2_FORMAT_LH;
- lh.lh_header.__pad0 = 0x101674; /* mh_generation */
- lh.lh_flags = GFS2_LOG_HEAD_UNMOUNT;
- lh.lh_first = sdp->md.journal[jnum]->i_num.in_addr + (seg * sdp->sd_seg_size);
- lh.lh_sequence = sequence;
-
- bh = bget(sdp, lh.lh_first * sdp->sd_bsize);
- memset(bh->b_data, 0, sdp->sd_bsize);
- gfs_log_header_out(&lh, bh->b_data);
- gfs_log_header_out(&lh, bh->b_data + GFS2_BASIC_BLOCK -
- sizeof(struct gfs_log_header));
+ for (int seg = 0; seg < ji_nsegment; seg++, first += sdp->sd_seg_size){
+ struct gfs_log_header *lh;
+ char *p;
+
+ bh = bget(sdp, first); /* Zeroes the block */
+ lh = (struct gfs_log_header *)bh->b_data;
+
+ lh->lh_header.mh_magic = cpu_to_be32(GFS2_MAGIC);
+ lh->lh_header.mh_type = cpu_to_be32(GFS2_METATYPE_LH);
+ lh->lh_header.mh_format = cpu_to_be32(GFS2_FORMAT_LH);
+ lh->lh_header.__pad0 = cpu_to_be64(0x101674); /* mh_generation */
+ lh->lh_flags = cpu_to_be32(GFS2_LOG_HEAD_UNMOUNT);
+ lh->lh_first = cpu_to_be64(first);
+ lh->lh_sequence = cpu_to_be64(sequence);
+
+ p = bh->b_data + GFS2_BASIC_BLOCK - sizeof(struct gfs_log_header);
+ memcpy(p, bh->b_data, sizeof(struct gfs_log_header));
+ bmodified(bh);
brelse(bh);
if (++sequence == ji_nsegment)
diff --git a/gfs2/fsck/lost_n_found.c b/gfs2/fsck/lost_n_found.c
index a9ff85bd..338f2a0a 100644
--- a/gfs2/fsck/lost_n_found.c
+++ b/gfs2/fsck/lost_n_found.c
@@ -172,7 +172,7 @@ void make_sure_lf_exists(struct gfs2_inode *ip)
*/
int add_inode_to_lf(struct gfs2_inode *ip){
char tmp_name[256];
- __be32 inode_type;
+ unsigned inode_type;
struct gfs2_sbd *sdp = ip->i_sbd;
struct lgfs2_inum no;
int err = 0;
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index edeaed88..4f36fe63 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -663,7 +663,7 @@ static int u64cmp(const void *p1, const void *p2)
return 0;
}
-static void dir_leaf_reada(struct gfs2_inode *ip, uint64_t *tbl, unsigned hsize)
+static void dir_leaf_reada(struct gfs2_inode *ip, __be64 *tbl, unsigned hsize)
{
uint64_t *t = alloca(hsize * sizeof(uint64_t));
uint64_t leaf_no;
@@ -692,7 +692,7 @@ int check_leaf_blks(struct gfs2_inode *ip, struct metawalk_fxns *pass)
int lindex;
struct gfs2_sbd *sdp = ip->i_sbd;
int ref_count, orig_ref_count, orig_di_depth, orig_di_height;
- uint64_t *tbl;
+ __be64 *tbl;
int chained_leaf, tbl_valid;
tbl = get_dir_hash(ip);
@@ -846,7 +846,7 @@ static int check_eattr_entries(struct gfs2_inode *ip,
struct metawalk_fxns *pass)
{
struct gfs2_ea_header *ea_hdr, *ea_hdr_prev = NULL;
- uint64_t *ea_data_ptr = NULL;
+ __be64 *ea_data_ptr = NULL;
int i;
int error = 0, err;
uint32_t offset = (uint32_t)sizeof(struct gfs2_meta_header);
@@ -873,7 +873,7 @@ static int check_eattr_entries(struct gfs2_inode *ip,
uint32_t tot_ealen = 0;
struct gfs2_sbd *sdp = ip->i_sbd;
- ea_data_ptr = ((uint64_t *)((char *)ea_hdr +
+ ea_data_ptr = ((__be64 *)((char *)ea_hdr +
sizeof(struct gfs2_ea_header) +
((ea_hdr->ea_name_len + 7) & ~7)));
@@ -962,7 +962,7 @@ static int check_indirect_eattr(struct gfs2_inode *ip, uint64_t indirect,
struct metawalk_fxns *pass)
{
int error = 0, err;
- uint64_t *ea_leaf_ptr, *end;
+ __be64 *ea_leaf_ptr, *end;
uint64_t block;
struct gfs2_sbd *sdp = ip->i_sbd;
int first_ea_is_bad = 0;
@@ -970,7 +970,7 @@ static int check_indirect_eattr(struct gfs2_inode *ip, uint64_t indirect,
uint64_t offset = ip->i_sbd->gfs1 ? sizeof(struct gfs_indirect) : sizeof(struct gfs2_meta_header);
int leaf_pointers = 0, leaf_pointer_errors = 0;
- ea_leaf_ptr = (uint64_t *)(indirect_buf->b_data + offset);
+ ea_leaf_ptr = (__be64 *)(indirect_buf->b_data + offset);
end = ea_leaf_ptr + ((sdp->sd_bsize - offset) / 8);
while (*ea_leaf_ptr && (ea_leaf_ptr < end)){
@@ -1112,11 +1112,12 @@ static void file_ra(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
int head_size, int maxptrs, int h)
{
struct gfs2_sbd *sdp = ip->i_sbd;
- uint64_t *p, sblock = 0, block;
+ uint64_t sblock = 0, block;
int extlen = 0;
+ __be64 *p;
if (h + 2 == ip->i_height) {
- p = (uint64_t *)(bh->b_data + head_size);
+ p = (__be64 *)(bh->b_data + head_size);
if (*p && *(p + 1)) {
sblock = be64_to_cpu(*p);
p++;
@@ -1132,8 +1133,8 @@ static void file_ra(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
}
extlen = 0;
}
- for (p = (uint64_t *)(bh->b_data + head_size);
- p < (uint64_t *)(bh->b_data + sdp->sd_bsize); p++) {
+ for (p = (__be64 *)(bh->b_data + head_size);
+ p < (__be64 *)(bh->b_data + sdp->sd_bsize); p++) {
if (*p) {
if (!sblock) {
sblock = be64_to_cpu(*p);
@@ -1225,9 +1226,9 @@ static int build_and_check_metalist(struct gfs2_inode *ip, osi_list_t *mlp,
uint32_t height = ip->i_height;
struct gfs2_buffer_head *metabh = ip->i_bh;
osi_list_t *prev_list, *cur_list, *tmp;
- struct iptr iptr = { .ipt_ip = ip, 0};
+ struct iptr iptr = { .ipt_ip = ip, NULL, 0};
int h, head_size, iblk_type;
- uint64_t *undoptr;
+ __be64 *undoptr;
int maxptrs;
int error;
@@ -1308,7 +1309,7 @@ error_undo: /* undo what we've done so far for this block */
log_info(_("Undoing the work we did before the error on block %"PRIu64" (0x%"PRIx64").\n"),
iptr.ipt_bh->b_blocknr, iptr.ipt_bh->b_blocknr);
- for (undoptr = (uint64_t *)(iptr_buf(iptr) + head_size);
+ for (undoptr = (__be64 *)(iptr_buf(iptr) + head_size);
undoptr < iptr_ptr(iptr) && undoptr < iptr_endptr(iptr);
undoptr++) {
uint64_t block = be64_to_cpu(*undoptr);
@@ -1398,8 +1399,8 @@ static int metawalk_check_data(struct gfs2_inode *ip, struct metawalk_fxns *pass
{
int error = 0, rc = 0;
uint64_t block;
- __be64 *ptr_start = (uint64_t *)(bh->b_data + hdr_size(bh, height));
- __be64 *ptr_end = (uint64_t *)(bh->b_data + ip->i_sbd->sd_bsize);
+ __be64 *ptr_start = (__be64 *)(bh->b_data + hdr_size(bh, height));
+ __be64 *ptr_end = (__be64 *)(bh->b_data + ip->i_sbd->sd_bsize);
__be64 *ptr;
uint64_t metablock = bh->b_blocknr;
@@ -1464,8 +1465,8 @@ static int undo_check_data(struct gfs2_inode *ip, struct metawalk_fxns *pass,
struct gfs2_buffer_head *bh, unsigned int height,
struct error_block *error_blk, int error)
{
- __be64 *ptr_start = (uint64_t *)(bh->b_data + hdr_size(bh, height));
- __be64 *ptr_end = (uint64_t *)(bh->b_data + ip->i_sbd->sd_bsize);
+ __be64 *ptr_start = (__be64 *)(bh->b_data + hdr_size(bh, height));
+ __be64 *ptr_end = (__be64 *)(bh->b_data + ip->i_sbd->sd_bsize);
__be64 *ptr;
uint64_t metablock = bh->b_blocknr;
int rc = 0;
diff --git a/gfs2/fsck/metawalk.h b/gfs2/fsck/metawalk.h
index a1038854..6e4bcad6 100644
--- a/gfs2/fsck/metawalk.h
+++ b/gfs2/fsck/metawalk.h
@@ -48,9 +48,9 @@ struct iptr {
unsigned ipt_off;
};
-#define iptr_ptr(i) ((uint64_t *)(i.ipt_bh->b_data + i.ipt_off))
+#define iptr_ptr(i) ((__be64 *)(i.ipt_bh->b_data + i.ipt_off))
#define iptr_block(i) be64_to_cpu(*iptr_ptr(i))
-#define iptr_endptr(i) ((uint64_t *)(iptr.ipt_bh->b_data + i.ipt_ip->i_sbd->sd_bsize))
+#define iptr_endptr(i) ((__be64 *)(iptr.ipt_bh->b_data + i.ipt_ip->i_sbd->sd_bsize))
#define iptr_buf(i) (i.ipt_bh->b_data)
/* metawalk_fxns: function pointers to check various parts of the fs
@@ -114,7 +114,7 @@ struct metawalk_fxns {
struct gfs2_ea_header *ea_hdr_prev,
void *private);
int (*check_eattr_extentry) (struct gfs2_inode *ip, int i,
- uint64_t *ea_data_ptr,
+ __be64 *ea_data_ptr,
struct gfs2_buffer_head *leaf_bh,
uint32_t tot_ealen,
struct gfs2_ea_header *ea_hdr,
@@ -123,7 +123,7 @@ struct metawalk_fxns {
int (*finish_eattr_indir) (struct gfs2_inode *ip, int leaf_pointers,
int leaf_pointer_errors, void *private);
void (*big_file_msg) (struct gfs2_inode *ip, uint64_t blks_checked);
- int (*check_hash_tbl) (struct gfs2_inode *ip, uint64_t *tbl,
+ int (*check_hash_tbl) (struct gfs2_inode *ip, __be64 *tbl,
unsigned hsize, void *private);
int (*repair_leaf) (struct gfs2_inode *ip, uint64_t *leaf_no,
int lindex, int ref_count, const char *msg);
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 465cbceb..b283c752 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -60,7 +60,7 @@ static int check_eattr_entries(struct gfs2_inode *ip,
struct gfs2_ea_header *ea_hdr_prev,
void *private);
static int check_extended_leaf_eattr(struct gfs2_inode *ip, int i,
- uint64_t *data_ptr,
+ __be64 *data_ptr,
struct gfs2_buffer_head *leaf_bh,
uint32_t tot_ealen,
struct gfs2_ea_header *ea_hdr,
@@ -817,7 +817,7 @@ static int check_ealeaf_block(struct gfs2_inode *ip, uint64_t block, int btype,
* Returns: 0 if correct[able], -1 if removal is needed
*/
static int check_extended_leaf_eattr(struct gfs2_inode *ip, int i,
- uint64_t *data_ptr,
+ __be64 *data_ptr,
struct gfs2_buffer_head *leaf_bh,
uint32_t tot_ealen,
struct gfs2_ea_header *ea_hdr,
@@ -1705,7 +1705,7 @@ static int pass1_process_bitmap(struct gfs2_sbd *sdp, struct rgrp_tree *rgd, uin
for (i = 0; i < n; i++) {
int is_inode;
- uint32_t check_magic;
+ __be32 check_magic;
block = ibuf[i];
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index dd7653b9..ad997b56 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -43,7 +43,7 @@ struct meta_blk_ref {
static int clone_data(struct gfs2_inode *ip, uint64_t metablock,
uint64_t block, void *private,
- struct gfs2_buffer_head *bh, uint64_t *ptr);
+ struct gfs2_buffer_head *bh, __be64 *ptr);
static void log_inode_reference(struct duptree *dt, osi_list_t *tmp, int inval)
{
@@ -85,7 +85,7 @@ static int findref_data(struct gfs2_inode *ip, uint64_t metablock,
if (block == mbr->block) {
mbr->metablock = bh->b_blocknr;
- mbr->off = (ptr - (uint64_t *)bh->b_data);
+ mbr->off = (ptr - (__be64 *)bh->b_data);
log_debug("Duplicate data reference located on metadata "
"block 0x%llx, offset 0x%x\n",
(unsigned long long)mbr->metablock, mbr->off);
@@ -105,7 +105,7 @@ static void clone_data_block(struct gfs2_sbd *sdp, struct duptree *dt,
struct clone_target clone = {.dup_block = dt->block,};
struct gfs2_inode *ip;
struct gfs2_buffer_head *bh;
- uint64_t *ptr;
+ __be64 *ptr;
if (!(query(_("Okay to clone data block %lld (0x%llx) for inode "
"%lld (0x%llx)? (y/n) "),
@@ -125,7 +125,7 @@ static void clone_data_block(struct gfs2_sbd *sdp, struct duptree *dt,
bh = bread(sdp, metaref.metablock);
else
bh = ip->i_bh;
- ptr = (uint64_t *)bh->b_data + metaref.off;
+ ptr = (__be64 *)bh->b_data + metaref.off;
clone_data(ip, 0, dt->block, &clone, bh, ptr);
if (metaref.metablock != id->block_no)
brelse(bh);
@@ -644,7 +644,7 @@ static int handle_dup_blk(struct gfs2_sbd *sdp, struct duptree *dt)
osi_list_t *tmp;
struct dup_handler dh = {0};
struct gfs2_buffer_head *bh;
- uint32_t cmagic, ctype;
+ __be32 cmagic, ctype;
enum dup_ref_type acceptable_ref;
uint64_t dup_blk;
@@ -836,7 +836,7 @@ static int check_eattr_entry_refs(struct gfs2_inode *ip,
}
static int check_eattr_extentry_refs(struct gfs2_inode *ip, int i,
- uint64_t *ea_data_ptr,
+ __be64 *ea_data_ptr,
struct gfs2_buffer_head *leaf_bh,
uint32_t tot_ealen,
struct gfs2_ea_header *ea_hdr,
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 6592edaf..67833491 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -300,7 +300,7 @@ static int wrong_leaf(struct gfs2_inode *ip, struct lgfs2_inum *entry,
struct gfs2_buffer_head *dest_lbh;
uint64_t planned_leaf, real_leaf;
int li, dest_ref, error;
- uint64_t *tbl;
+ __be64 *tbl;
int di_depth;
log_err(_("Directory entry '%s' at block %"PRIu64" (0x%"PRIx64") is on the wrong leaf block.\n"),
@@ -938,12 +938,11 @@ static int write_new_leaf(struct gfs2_inode *dip, int start_lindex,
struct gfs2_dirent *dent;
int count, i;
int factor = 0, pad_size;
- uint64_t *cpyptr;
- char *padbuf;
+ __be64 *padbuf, *cpyptr;
int divisor = num_copies;
int end_lindex = start_lindex + num_copies;
- padbuf = malloc(num_copies * sizeof(uint64_t));
+ padbuf = calloc(num_copies, sizeof(__be64));
/* calculate the depth needed for the new leaf */
while (divisor > 1) {
factor++;
@@ -992,7 +991,7 @@ static int write_new_leaf(struct gfs2_inode *dip, int start_lindex,
brelse(nbh);
/* pad the hash table with the new leaf block */
- cpyptr = (uint64_t *)padbuf;
+ cpyptr = padbuf;
for (i = start_lindex; i < end_lindex; i++) {
*cpyptr = cpu_to_be64(*bn);
cpyptr++;
@@ -1024,7 +1023,7 @@ static int write_new_leaf(struct gfs2_inode *dip, int start_lindex,
* @lindex: index location within the hash table to pad
* @len: number of pointers to be padded
*/
-static void pad_with_leafblks(struct gfs2_inode *ip, uint64_t *tbl,
+static void pad_with_leafblks(struct gfs2_inode *ip, __be64 *tbl,
int lindex, int len)
{
int new_len, i;
@@ -1075,7 +1074,7 @@ static void pad_with_leafblks(struct gfs2_inode *ip, uint64_t *tbl,
* directory entries to lost+found so we don't overwrite the good leaf. Then
* we need to pad the gap we leave.
*/
-static int lost_leaf(struct gfs2_inode *ip, uint64_t *tbl, uint64_t leafno,
+static int lost_leaf(struct gfs2_inode *ip, __be64 *tbl, uint64_t leafno,
int ref_count, int lindex, struct gfs2_buffer_head *bh)
{
char *filename;
@@ -1292,7 +1291,7 @@ static struct metawalk_fxns leafck_fxns = {
*
* Returns: 0 - no changes made, or X if changes were made
*/
-static int fix_hashtable(struct gfs2_inode *ip, uint64_t *tbl, unsigned hsize,
+static int fix_hashtable(struct gfs2_inode *ip, __be64 *tbl, unsigned hsize,
uint64_t leafblk, int lindex, uint32_t proper_start,
int len, int *proper_len, int factor)
{
@@ -1471,7 +1470,7 @@ static int fix_hashtable(struct gfs2_inode *ip, uint64_t *tbl, unsigned hsize,
}
/* check_hash_tbl_dups - check for the same leaf in multiple places */
-static int check_hash_tbl_dups(struct gfs2_inode *ip, uint64_t *tbl,
+static int check_hash_tbl_dups(struct gfs2_inode *ip, __be64 *tbl,
unsigned hsize, int lindex, int len)
{
int l, len2;
@@ -1590,7 +1589,7 @@ static int check_hash_tbl_dups(struct gfs2_inode *ip, uint64_t *tbl,
* we may need to reference leaf blocks to fix it, which means we need
* to check and/or fix a leaf block along the way.
*/
-static int check_hash_tbl(struct gfs2_inode *ip, uint64_t *tbl,
+static int check_hash_tbl(struct gfs2_inode *ip, __be64 *tbl,
unsigned hsize, void *private)
{
int error = 0;
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c
index 762266df..7ea2dfb8 100644
--- a/gfs2/fsck/util.c
+++ b/gfs2/fsck/util.c
@@ -575,11 +575,11 @@ uint64_t find_free_blk(struct gfs2_sbd *sdp)
return 0;
}
-uint64_t *get_dir_hash(struct gfs2_inode *ip)
+__be64 *get_dir_hash(struct gfs2_inode *ip)
{
unsigned hsize = (1 << ip->i_depth) * sizeof(uint64_t);
int ret;
- uint64_t *tbl = malloc(hsize);
+ __be64 *tbl = malloc(hsize);
if (tbl == NULL)
return NULL;
diff --git a/gfs2/fsck/util.h b/gfs2/fsck/util.h
index d56bb24b..88b6aa35 100644
--- a/gfs2/fsck/util.h
+++ b/gfs2/fsck/util.h
@@ -128,7 +128,7 @@ extern char generic_interrupt(const char *caller, const char *where,
const char *answers);
extern char gfs2_getch(void);
extern uint64_t find_free_blk(struct gfs2_sbd *sdp);
-extern uint64_t *get_dir_hash(struct gfs2_inode *ip);
+extern __be64 *get_dir_hash(struct gfs2_inode *ip);
extern void delete_all_dups(struct gfs2_inode *ip);
extern void print_pass_duration(const char *name, struct timeval *start);
diff --git a/gfs2/libgfs2/gfs1.c b/gfs2/libgfs2/gfs1.c
index 272f5572..850d7217 100644
--- a/gfs2/libgfs2/gfs1.c
+++ b/gfs2/libgfs2/gfs1.c
@@ -163,7 +163,7 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
brelse(bh);
}
-int gfs1_writei(struct gfs2_inode *ip, char *buf, uint64_t offset,
+int gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
unsigned int size)
{
struct gfs2_sbd *sdp = ip->i_sbd;
@@ -222,7 +222,7 @@ int gfs1_writei(struct gfs2_inode *ip, char *buf, uint64_t offset,
memcpy(bh->b_data, &mh, sizeof(mh));
}
- memcpy(bh->b_data + offset, buf + copied, amount);
+ memcpy(bh->b_data + offset, (char *)buf + copied, amount);
bmodified(bh);
if (bh != ip->i_bh)
brelse(bh);
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index c8ec05aa..41f83b94 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -732,7 +732,7 @@ extern void gfs1_lookup_block(struct gfs2_inode *ip,
int create, int *new, uint64_t *block);
extern void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
uint64_t *dblock, uint32_t *extlen, int prealloc);
-extern int gfs1_writei(struct gfs2_inode *ip, char *buf, uint64_t offset,
+extern int gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
unsigned int size);
extern struct gfs2_inode *lgfs2_gfs_inode_get(struct gfs2_sbd *sdp, char *buf);
extern struct gfs2_inode *lgfs2_gfs_inode_read(struct gfs2_sbd *sdp, uint64_t di_addr);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.