For years, the fsck.gfs2 tool used two different variable names to refer to the
same structure: sdp and sbp. This patch changes them all to sdp so they are now
consistent with the kernel code.
diff --git a/gfs2/fsck/fsck.h b/gfs2/fsck/fsck.h
index bc14b88..25bc3b9 100644
--- a/gfs2/fsck/fsck.h
+++ b/gfs2/fsck/fsck.h
@@ -92,21 +92,21 @@ enum rgindex_trust_level { /* how far can we trust our RG index? */
must have been converted from gfs2_convert. */
};
-extern int initialize(struct gfs2_sbd *sbp, int force_check, int preen,
+extern int initialize(struct gfs2_sbd *sdp, int force_check, int preen,
int *all_clean);
-extern void destroy(struct gfs2_sbd *sbp);
-extern int pass1(struct gfs2_sbd *sbp);
-extern int pass1b(struct gfs2_sbd *sbp);
-extern int pass1c(struct gfs2_sbd *sbp);
-extern int pass2(struct gfs2_sbd *sbp);
-extern int pass3(struct gfs2_sbd *sbp);
-extern int pass4(struct gfs2_sbd *sbp);
-extern int pass5(struct gfs2_sbd *sbp);
+extern void destroy(struct gfs2_sbd *sdp);
+extern int pass1(struct gfs2_sbd *sdp);
+extern int pass1b(struct gfs2_sbd *sdp);
+extern int pass1c(struct gfs2_sbd *sdp);
+extern int pass2(struct gfs2_sbd *sdp);
+extern int pass3(struct gfs2_sbd *sdp);
+extern int pass4(struct gfs2_sbd *sdp);
+extern int pass5(struct gfs2_sbd *sdp);
extern int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *rg_count,
int *sane);
extern void gfs2_dup_free(void);
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index 5a6fc6e..ff620c0 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -36,26 +36,26 @@ static struct master_dir fix_md;
* Change the lock protocol so nobody can mount the fs
*
*/
-static int block_mounters(struct gfs2_sbd *sbp, int block_em)
+static int block_mounters(struct gfs2_sbd *sdp, int block_em)
{
if(block_em) {
/* verify it starts with lock_ */
- if(!strncmp(sbp->sd_sb.sb_lockproto, "lock_", 5)) {
+ if(!strncmp(sdp->sd_sb.sb_lockproto, "lock_", 5)) {
/* Change lock_ to fsck_ */
- memcpy(sbp->sd_sb.sb_lockproto, "fsck_", 5);
+ memcpy(sdp->sd_sb.sb_lockproto, "fsck_", 5);
}
/* FIXME: Need to do other verification in the else
* case */
} else {
/* verify it starts with fsck_ */
/* verify it starts with lock_ */
- if(!strncmp(sbp->sd_sb.sb_lockproto, "fsck_", 5)) {
+ if(!strncmp(sdp->sd_sb.sb_lockproto, "fsck_", 5)) {
/* Change fsck_ to lock_ */
- memcpy(sbp->sd_sb.sb_lockproto, "lock_", 5);
+ memcpy(sdp->sd_sb.sb_lockproto, "lock_", 5);
}
}
- if(write_sb(sbp)) {
+ if(write_sb(sdp)) {
stack;
return -1;
}
@@ -1093,7 +1093,7 @@ static int fill_super_block(struct gfs2_sbd *sdp)
* initialize - initialize superblock pointer
*
*/
-int initialize(struct gfs2_sbd *sbp, int force_check, int preen,
+int initialize(struct gfs2_sbd *sdp, int force_check, int preen,
int *all_clean)
{
int clean_journals = 0, open_flag;
@@ -1105,8 +1105,8 @@ int initialize(struct gfs2_sbd *sbp, int force_check, int preen,
else
open_flag = O_RDWR | O_EXCL;
- sbp->device_fd = open(opts.device, open_flag);
- if (sbp->device_fd < 0) {
+ sdp->device_fd = open(opts.device, open_flag);
+ if (sdp->device_fd < 0) {
int is_mounted, ro;
if (open_flag == O_RDONLY || errno != EBUSY) {
@@ -1120,10 +1120,10 @@ int initialize(struct gfs2_sbd *sbp, int force_check, int preen,
allow it.) We use is_pathname_mounted here even though
we're specifying a device name, not a path name. The
function checks for device as well. */
- strncpy(sbp->device_name, opts.device,
- sizeof(sbp->device_name));
- sbp->path_name = sbp->device_name; /* This gets overwritten */
- is_mounted = is_pathname_mounted(sbp, &ro);
+ strncpy(sdp->device_name, opts.device,
+ sizeof(sdp->device_name));
+ sdp->path_name = sdp->device_name; /* This gets overwritten */
+ is_mounted = is_pathname_mounted(sdp, &ro);
/* If the device is busy, but not because it's mounted, fail.
This protects against cases where the file system is LVM
and perhaps mounted on a different node. */
@@ -1138,49 +1138,49 @@ int initialize(struct gfs2_sbd *sbp, int force_check, int preen,
/* The device is mounted RO, so it's likely our own root
file system. We can only do so much to protect the users
from themselves. Try opening without O_EXCL. */
- if ((sbp->device_fd = open(opts.device, O_RDWR)) < 0)
+ if ((sdp->device_fd = open(opts.device, O_RDWR)) < 0)
goto mount_fail;
was_mounted_ro = 1;
}
/* read in sb from disk */
- if (fill_super_block(sbp))
+ if (fill_super_block(sdp))
return FSCK_ERROR;
/* Change lock protocol to be fsck_* instead of lock_* */
- if(!opts.no && preen_is_safe(sbp, preen, force_check)) {
- if(block_mounters(sbp, 1)) {
+ if(!opts.no && preen_is_safe(sdp, preen, force_check)) {
+ if(block_mounters(sdp, 1)) {
log_err( _("Unable to block other mounters
"));
return FSCK_USAGE;
}
}
/* Look up the "per_node" inode. If there are journals missing, we
need to figure out what's missing from per_node. And we need all
our journals to be there before we can replay them. */
- lookup_per_node(sbp, 0);
+ lookup_per_node(sdp, 0);
if (!opts.no && errors_corrected)
log_notice( _("Writing changes to disk
"));
- fsync(sbp->device_fd);
- destroy(sbp);
- log_notice( _("gfs2_fsck complete
"));
+ fsync(sdp->device_fd);
+ destroy(sdp);
+ log_notice( _("gfs2_fsck complete
"));
if (!error) {
if (!errors_found)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index cffff8a..0e443fa 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -181,14 +181,14 @@ struct gfs2_inode *fsck_system_inode(struct gfs2_sbd *sdp, uint64_t block)
/* fsck_load_inode - same as gfs2_load_inode() in libgfs2 but system inodes
get special treatment. */
-struct gfs2_inode *fsck_load_inode(struct gfs2_sbd *sbp, uint64_t block)
+struct gfs2_inode *fsck_load_inode(struct gfs2_sbd *sdp, uint64_t block)
{
struct gfs2_inode *ip = NULL;
- ip = fsck_system_inode(sbp, block);
+ ip = fsck_system_inode(sdp, block);
if (ip)
return ip;
- return inode_read(sbp, block);
+ return inode_read(sdp, block);
}
/* fsck_inode_get - same as inode_get() in libgfs2 but system inodes
@@ -596,7 +596,7 @@ static int check_leaf_blks(struct gfs2_inode *ip, struct metawalk_fxns *pass)
uint64_t first_ok_leaf;
struct gfs2_buffer_head *lbh;
int lindex;
- struct gfs2_sbd *sbp = ip->i_sbd;
+ struct gfs2_sbd *sdp = ip->i_sbd;
uint16_t count;
int ref_count = 0, exp_count = 0;
- log_debug( _("Removing dentry %" PRIu64 " (0x%" PRIx64 ") from directory %"
- PRIu64" (0x%" PRIx64 ")
"), dentryblock, dentryblock, dir, dir);
- if(gfs2_check_range(sbp, dir)) {
+ log_debug( _("Removing dentry %llu (0x%llx) from directory %llu"
+ " (0x%llx)
"), (unsigned long long)dentryblock,
+ (unsigned long long)dentryblock,
+ (unsigned long long)dir, (unsigned long long)dir);
+ if(gfs2_check_range(sdp, dir)) {
log_err( _("Parent directory out of range
"));
return 1;
}
@@ -1448,7 +1450,7 @@ int remove_dentry_from_dir(struct gfs2_sbd *sbp, uint64_t dir,
}
/* Need to run check_dir with a private var of dentryblock,
* and fxns that remove that dentry if found */
- error = check_dir(sbp, dir, &remove_dentry_fxns);
+ error = check_dir(sdp, dir, &remove_dentry_fxns);
return error;
}
diff --git a/gfs2/fsck/metawalk.h b/gfs2/fsck/metawalk.h
index 3ee12fe..c1e61fb 100644
--- a/gfs2/fsck/metawalk.h
+++ b/gfs2/fsck/metawalk.h
@@ -9,11 +9,11 @@ struct metawalk_fxns;
extern int check_inode_eattr(struct gfs2_inode *ip,
struct metawalk_fxns *pass);
extern int check_metatree(struct gfs2_inode *ip, struct metawalk_fxns *pass);
-extern int check_dir(struct gfs2_sbd *sbp, uint64_t block,
+extern int check_dir(struct gfs2_sbd *sdp, uint64_t block,
struct metawalk_fxns *pass);
extern int check_linear_dir(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
struct metawalk_fxns *pass);
-extern int remove_dentry_from_dir(struct gfs2_sbd *sbp, uint64_t dir,
+extern int remove_dentry_from_dir(struct gfs2_sbd *sdp, uint64_t dir,
uint64_t dentryblock);
extern int delete_block(struct gfs2_inode *ip, uint64_t block,
struct gfs2_buffer_head **bh, const char *btype,
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index a7eb96d..ef2714f 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -1187,7 +1187,7 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh)
static int check_system_inode(struct gfs2_sbd *sdp,
struct gfs2_inode **sysinode,
const char *filename,
- int builder(struct gfs2_sbd *sbp),
+ int builder(struct gfs2_sbd *sdp),
enum gfs2_mark_block mark)
{
uint64_t iblock = 0;
@@ -1375,7 +1375,7 @@ static int check_system_inodes(struct gfs2_sbd *sdp)
* inodes size
* dir info
*/
-int pass1(struct gfs2_sbd *sbp)
+int pass1(struct gfs2_sbd *sdp)
{
struct gfs2_buffer_head *bh;
osi_list_t *tmp;
@@ -1394,7 +1394,7 @@ int pass1(struct gfs2_sbd *sbp)
* the sweeps start that we won't find otherwise? */
/* Make sure the system inodes are okay & represented in the bitmap. */
- check_system_inodes(sbp);
+ check_system_inodes(sdp);
/* So, do we do a depth first search starting at the root
* inode, or use the rg bitmaps, or just read every fs block
@@ -1405,7 +1405,7 @@ int pass1(struct gfs2_sbd *sbp)
* uses the rg bitmaps, so maybe that's the best way to start
* things - we can change the method later if necessary.
*/
- for (tmp = sbp->rglist.next; tmp != &sbp->rglist;
+ for (tmp = sdp->rglist.next; tmp != &sdp->rglist;
tmp = tmp->next, rg_count++) {
log_debug( _("Checking metadata in Resource Group #%" PRIu64 "
"),
rg_count);
@@ -1421,7 +1421,7 @@ int pass1(struct gfs2_sbd *sbp)
}
/* rgrps and bitmaps don't have bits to represent
their blocks, so don't do this:
- check_n_fix_bitmap(sbp, rgd->ri.ri_addr + i,
+ check_n_fix_bitmap(sdp, rgd->ri.ri_addr + i,
gfs2_meta_rgrp);*/
}
@@ -1444,7 +1444,7 @@ int pass1(struct gfs2_sbd *sbp)
skip_this_pass = FALSE;
fflush(stdout);
}
- if (fsck_system_inode(sbp, block)) {
+ if (fsck_system_inode(sdp, block)) {
log_debug(_("Already processed system inode "
"%lld (0x%llx)
"),
(unsigned long long)block,
@@ -1452,7 +1452,7 @@ int pass1(struct gfs2_sbd *sbp)
first = 0;
continue;
}
- bh = bread(sbp, block);
+ bh = bread(sdp, block);
/* Finds all references to duplicate blocks in the metadata */
-static int find_block_ref(struct gfs2_sbd *sbp, uint64_t inode)
+static int find_block_ref(struct gfs2_sbd *sdp, uint64_t inode)
{
struct gfs2_inode *ip;
int error = 0;
- ip = fsck_load_inode(sbp, inode); /* bread, inode_get */
- /*log_debug( _("Checking inode %" PRIu64 " (0x%" PRIx64 ")'s "
- "metatree for references to duplicate blocks)
"),
- inode, inode);*/
+ ip = fsck_load_inode(sdp, inode); /* bread, inode_get */
/* double-check the meta header just to be sure it's metadata */
if (ip->i_di.di_header.mh_magic != GFS2_MAGIC ||
ip->i_di.di_header.mh_type != GFS2_METATYPE_DI) {
@@ -386,7 +383,7 @@ static void log_inode_reference(struct duptree *b, osi_list_t *tmp, int inval)
(unsigned long long)b->block, reftypestring);
}
-static int clear_a_reference(struct gfs2_sbd *sbp, struct duptree *b,
+static int clear_a_reference(struct gfs2_sbd *sdp, struct duptree *b,
osi_list_t *ref_list, struct dup_handler *dh,
int inval)
{
@@ -423,7 +420,7 @@ static int clear_a_reference(struct gfs2_sbd *sbp, struct duptree *b,
(unsigned long long)id->block_no);
clear_dup_fxns.private = (void *) dh;
/* Clear the EAs for the inode first */
- ip = fsck_load_inode(sbp, id->block_no);
+ ip = fsck_load_inode(sdp, id->block_no);
check_inode_eattr(ip, &clear_dup_fxns);
/* If the dup wasn't only in the EA, clear the inode */
if (id->reftypecount[ref_as_data] ||
@@ -444,7 +441,7 @@ static int clear_a_reference(struct gfs2_sbd *sbp, struct duptree *b,
return 0;
}
if (last_reference && !osi_list_empty(&b->ref_inode_list)) {
@@ -556,7 +553,7 @@ static int handle_dup_blk(struct gfs2_sbd *sbp, struct duptree *b)
"reference in inode %lld (0x%llx).
"),
(unsigned long long)id->block_no,
(unsigned long long)id->block_no);
- ip = fsck_load_inode(sbp, id->block_no);
+ ip = fsck_load_inode(sdp, id->block_no);
q = block_type(id->block_no);
if (q == gfs2_inode_invalid) {
@@ -597,7 +594,7 @@ static int handle_dup_blk(struct gfs2_sbd *sbp, struct duptree *b)
/* Pass 1b handles finding the previous inode for a duplicate block
* When found, store the inodes pointing to the duplicate block for
* use in pass2 */
-int pass1b(struct gfs2_sbd *sbp)
+int pass1b(struct gfs2_sbd *sdp)
{
struct duptree *b;
uint64_t i;
@@ -641,7 +638,7 @@ int pass1b(struct gfs2_sbd *sbp)
(unsigned long long)i);
warm_fuzzy_stuff(i);
- if (find_block_ref(sbp, i) < 0) {
+ if (find_block_ref(sdp, i) < 0) {
stack;
rc = FSCK_ERROR;
goto out;
@@ -656,7 +653,7 @@ out:
next = osi_next(n);
b = (struct duptree *)n;
if (!skip_this_pass && !rc) /* no error & not asked to skip the rest */
- handle_dup_blk(sbp, b);
+ handle_dup_blk(sdp, b);
/* Do not attempt to free the dup_blocks list or its parts
here because any func that calls check_metatree needs
to check duplicate status based on this linked list.
diff --git a/gfs2/fsck/pass1c.c b/gfs2/fsck/pass1c.c
index 10b92ed..2a86e14 100644
--- a/gfs2/fsck/pass1c.c
+++ b/gfs2/fsck/pass1c.c
@@ -71,11 +71,11 @@ static int check_eattr_indir(struct gfs2_inode *ip, uint64_t block,
uint64_t parent, struct gfs2_buffer_head **bh,
void *private)
{
- struct gfs2_sbd *sbp = ip->i_sbd;
+ struct gfs2_sbd *sdp = ip->i_sbd;
uint8_t q;
struct gfs2_buffer_head *indir_bh = NULL;
/* Go over all inodes with extended attributes and verify the EAs are
* valid */
-int pass1c(struct gfs2_sbd *sbp)
+int pass1c(struct gfs2_sbd *sdp)
{
uint64_t block_no = 0;
struct gfs2_buffer_head *bh;
@@ -236,19 +236,20 @@ int pass1c(struct gfs2_sbd *sbp)
pass1c_fxns.private = NULL;
- ip = fsck_load_inode(sbp, block);
- pip = fsck_load_inode(sbp, newdotdot);
+ ip = fsck_load_inode(sdp, block);
+ pip = fsck_load_inode(sdp, newdotdot);
/* FIXME: Need to add some interactive
* options here and come up with a
* good default for non-interactive */
@@ -68,7 +68,7 @@ static int attach_dotdot_to(struct gfs2_sbd *sbp, uint64_t newdotdot,
return 0;
}
/* Reconcile RG bitmaps with fsck bitmap */
- for(tmp = sbp->rglist.next; tmp != &sbp->rglist; tmp = tmp->next){
+ for(tmp = sdp->rglist.next; tmp != &sdp->rglist; tmp = tmp->next){
if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
return FSCK_OK;
log_info( _("Verifying Resource Group #%" PRIu64 "
"), rg_count);
@@ -208,7 +208,7 @@ int pass5(struct gfs2_sbd *sbp)
rg_count++;
/* Compare the bitmaps and report the differences */
- update_rgrp(sbp, rgp, count);
+ update_rgrp(sdp, rgp, count);
}
/* Fix up superblock info based on this - don't think there's
* anything to do here... */
--
1.7.7.5