This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-sparse
in repository gfs2-utils.
commit 113aed8a17295837b0576bcb0e86226ecaf4d065
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Jun 9 14:19:09 2021 +0100
libgfs2: Endianness improvements for gfs2_inum and gfs2_dirent
The uses of structs gfs2_inum and gfs2_dirent are tightly coupled so
these changes had to be made at the same time. Introduce native-endian
structs lgfs2_inum and lgfs2_dirent and conversion functions for them.
Convert users as appropriate.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/convert/gfs2_convert.c | 64 +++----
gfs2/fsck/afterpass1_common.c | 8 +-
gfs2/fsck/fs_recovery.c | 20 +--
gfs2/fsck/fsck.h | 8 +-
gfs2/fsck/initialize.c | 51 +++---
gfs2/fsck/inode_hash.c | 12 +-
gfs2/fsck/inode_hash.h | 2 +-
gfs2/fsck/link.c | 43 +++--
gfs2/fsck/link.h | 3 +-
gfs2/fsck/lost_n_found.c | 46 ++---
gfs2/fsck/metawalk.c | 61 ++++---
gfs2/fsck/pass1.c | 48 +++--
gfs2/fsck/pass2.c | 407 +++++++++++++++++++-----------------------
gfs2/fsck/pass3.c | 115 +++++-------
gfs2/fsck/pass4.c | 25 ++-
gfs2/fsck/util.c | 14 +-
gfs2/libgfs2/fs_ops.c | 56 +++---
gfs2/libgfs2/libgfs2.h | 33 +++-
gfs2/libgfs2/ondisk.c | 71 +++-----
gfs2/libgfs2/structures.c | 14 +-
gfs2/mkfs/main_mkfs.c | 6 +-
21 files changed, 522 insertions(+), 585 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index c8ebfe3b..9c703e4c 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -1106,19 +1106,19 @@ static int inode_renumber(struct gfs2_sbd *sbp, uint64_t
root_inode_addr, osi_li
return 0;
}/* inode_renumber */
-/* ------------------------------------------------------------------------- */
-/* fetch_inum - fetch an inum entry from disk, given its block */
-/* ------------------------------------------------------------------------- */
+/**
+ * fetch_inum - fetch an inum entry from disk, given its block
+ */
static int fetch_inum(struct gfs2_sbd *sbp, uint64_t iblock,
- struct gfs2_inum *inum, uint64_t *eablk)
+ struct lgfs2_inum *inum, uint64_t *eablk)
{
struct gfs2_inode *fix_inode;
fix_inode = lgfs2_inode_read(sbp, iblock);
if (fix_inode == NULL)
return 1;
- inum->no_formal_ino = fix_inode->i_formal_ino;
- inum->no_addr = fix_inode->i_addr;
+ inum->in_formal_ino = fix_inode->i_formal_ino;
+ inum->in_addr = fix_inode->i_addr;
if (eablk)
*eablk = fix_inode->i_eattr;
@@ -1150,7 +1150,7 @@ static int process_dirent_info(struct gfs2_inode *dip, struct
gfs2_sbd *sbp,
/* Go through every dirent in the buffer and process it. */
/* Turns out you can't trust dir_entries is correct. */
for (de = 0; ; de++) {
- struct gfs2_inum inum;
+ struct lgfs2_inum inum;
int dent_was_gfs1;
if (dentmod) {
@@ -1174,17 +1174,17 @@ static int process_dirent_info(struct gfs2_inode *dip, struct
gfs2_sbd *sbp,
fflush(stdout);
}
/* fix the dirent's inode number based on the inode */
- gfs2_inum_in(&inum, (char *)&dent->de_inum);
+ lgfs2_inum_in(&inum, &dent->de_inum);
dent_was_gfs1 = (dent->de_inum.no_addr == dent->de_inum.no_formal_ino);
- if (inum.no_formal_ino) { /* if not a sentinel (placeholder) */
- error = fetch_inum(sbp, inum.no_addr, &inum, NULL);
+ if (inum.in_formal_ino) { /* if not a sentinel (placeholder) */
+ error = fetch_inum(sbp, inum.in_addr, &inum, NULL);
if (error) {
- log_crit(_("Error retrieving inode 0x%llx\n"),
- (unsigned long long)inum.no_addr);
+ log_crit(_("Error retrieving inode 0x%"PRIx64"\n"),
+ inum.in_addr);
break;
}
/* fix the dirent's inode number from the fetched inum. */
- dent->de_inum.no_formal_ino = cpu_to_be64(inum.no_formal_ino);
+ dent->de_inum.no_formal_ino = cpu_to_be64(inum.in_formal_ino);
}
/* Fix the dirent's filename hash: They are the same as gfs1 */
/* dent->de_hash = cpu_to_be32(gfs2_disk_hash((char *)(dent + 1), */
@@ -1231,7 +1231,7 @@ static int process_dirent_info(struct gfs2_inode *dip, struct
gfs2_sbd *sbp,
struct inode_dir_block *fix;
osi_list_foreach(tmp, &cdpns_to_fix.list) {
fix = osi_list_entry(tmp, struct inode_dir_block, list);
- if (fix->di_addr == inum.no_addr)
+ if (fix->di_addr == inum.in_addr)
fix->di_paddr = dip->i_addr;
}
}
@@ -1392,7 +1392,7 @@ static int fix_cdpn_symlinks(struct gfs2_sbd *sbp, osi_list_t
*cdpn_to_fix)
cdpns_fixed = 0;
osi_list_foreach_safe(tmp, cdpn_to_fix, x) {
- struct gfs2_inum fix, dir;
+ struct lgfs2_inum fix, dir;
struct inode_dir_block *l_fix;
struct gfs2_buffer_head *bh = NULL;
struct gfs2_inode *fix_inode;
@@ -1588,7 +1588,7 @@ static int init(struct gfs2_sbd *sbp, struct gfs2_options *opts)
{
struct gfs2_buffer_head *bh;
int rgcount;
- struct gfs2_inum inum;
+ struct lgfs2_inum inum;
memset(sbp, 0, sizeof(struct gfs2_sbd));
if ((sbp->device_fd = open(opts->device, O_RDWR)) < 0) {
@@ -1667,15 +1667,15 @@ static int init(struct gfs2_sbd *sbp, struct gfs2_options *opts)
exit(-1);
}
/* get gfs1 rindex inode - gfs1's rindex inode ptr became __pad2 */
- gfs2_inum_in(&inum, (char *)&gfs1_sb.sb_rindex_di);
- sbp->md.riinode = lgfs2_gfs_inode_read(sbp, inum.no_addr);
+ lgfs2_inum_in(&inum, &gfs1_sb.sb_rindex_di);
+ sbp->md.riinode = lgfs2_gfs_inode_read(sbp, inum.in_addr);
if (sbp->md.riinode == NULL) {
log_crit(_("Could not read resource group index: %s\n"), strerror(errno));
exit(-1);
}
/* get gfs1 jindex inode - gfs1's journal index inode ptr became master */
- gfs2_inum_in(&inum, (char *)&gfs1_sb.sb_jindex_di);
- sbp->md.jiinode = lgfs2_inode_read(sbp, inum.no_addr);
+ lgfs2_inum_in(&inum, &gfs1_sb.sb_jindex_di);
+ sbp->md.jiinode = lgfs2_inode_read(sbp, inum.in_addr);
if (sbp->md.jiinode == NULL) {
log_crit(_("Could not read journal index: %s\n"), strerror(errno));
exit(-1);
@@ -1958,25 +1958,25 @@ static void write_statfs_file(struct gfs2_sbd *sdp)
/* ------------------------------------------------------------------------- */
static void remove_obsolete_gfs1(struct gfs2_sbd *sbp)
{
- struct gfs2_inum inum;
+ struct lgfs2_inum inum;
log_notice(_("Removing obsolete GFS1 file system structures.\n"));
fflush(stdout);
/* Delete the old gfs1 Journal index: */
- gfs2_inum_in(&inum, (char *)&gfs1_sb.sb_jindex_di);
- gfs2_freedi(sbp, inum.no_addr);
+ lgfs2_inum_in(&inum, &gfs1_sb.sb_jindex_di);
+ gfs2_freedi(sbp, inum.in_addr);
/* Delete the old gfs1 rgindex: */
- gfs2_inum_in(&inum, (char *)&gfs1_sb.sb_rindex_di);
- gfs2_freedi(sbp, inum.no_addr);
+ lgfs2_inum_in(&inum, &gfs1_sb.sb_rindex_di);
+ gfs2_freedi(sbp, inum.in_addr);
/* Delete the old gfs1 Quota file: */
- gfs2_inum_in(&inum, (char *)&gfs1_sb.sb_quota_di);
- gfs2_freedi(sbp, inum.no_addr);
+ lgfs2_inum_in(&inum, &gfs1_sb.sb_quota_di);
+ gfs2_freedi(sbp, inum.in_addr);
/* Delete the old gfs1 License file: */
- gfs2_inum_in(&inum, (char *)&gfs1_sb.sb_license_di);
- gfs2_freedi(sbp, inum.no_addr);
+ lgfs2_inum_in(&inum, &gfs1_sb.sb_license_di);
+ gfs2_freedi(sbp, inum.in_addr);
}
/* ------------------------------------------------------------------------- */
@@ -2116,7 +2116,7 @@ static int check_fit(struct gfs2_sbd *sdp)
*/
static void copy_quotas(struct gfs2_sbd *sdp)
{
- struct gfs2_inum inum;
+ struct lgfs2_inum inum;
struct gfs2_inode *oq_ip, *nq_ip;
int err;
@@ -2126,8 +2126,8 @@ static void copy_quotas(struct gfs2_sbd *sdp)
exit(1);
}
- gfs2_inum_in(&inum, (char *)&gfs1_sb.sb_quota_di);
- oq_ip = lgfs2_inode_read(sdp, inum.no_addr);
+ lgfs2_inum_in(&inum, (char *)&gfs1_sb.sb_quota_di);
+ oq_ip = lgfs2_inode_read(sdp, inum.in_addr);
if (oq_ip == NULL) {
fprintf(stderr, _("Couldn't lookup old quota file: %s\n"),
strerror(errno));
exit(1);
diff --git a/gfs2/fsck/afterpass1_common.c b/gfs2/fsck/afterpass1_common.c
index 301986f0..c216a5da 100644
--- a/gfs2/fsck/afterpass1_common.c
+++ b/gfs2/fsck/afterpass1_common.c
@@ -118,13 +118,11 @@ static int remove_dentry(struct gfs2_inode *ip, struct gfs2_dirent
*dent,
/* the metawalk_fxn's private field must be set to the dentry
* block we want to clear */
uint64_t *dentryblock = (uint64_t *) private;
- struct gfs2_dirent dentry, *de;
+ struct lgfs2_dirent d;
- memset(&dentry, 0, sizeof(struct gfs2_dirent));
- gfs2_dirent_in(&dentry, (char *)dent);
- de = &dentry;
+ lgfs2_dirent_in(&d, dent);
- if (de->de_inum.no_addr == *dentryblock)
+ if (d.dr_inum.in_addr == *dentryblock)
dirent2_del(ip, bh, prev_de, dent);
else
(*count)++;
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
index e9d3c849..130e9854 100644
--- a/gfs2/fsck/fs_recovery.c
+++ b/gfs2/fsck/fs_recovery.c
@@ -823,27 +823,25 @@ static int check_jindex_dent(struct gfs2_inode *ip, struct
gfs2_dirent *dent,
struct gfs2_buffer_head *bh, char *filename,
uint32_t *count, int *lindex, void *priv)
{
- struct gfs2_dirent dentry, *de;
+ struct lgfs2_dirent d;
int i;
- memset(&dentry, 0, sizeof(struct gfs2_dirent));
- gfs2_dirent_in(&dentry, (char *)dent);
- de = &dentry;
+ lgfs2_dirent_in(&d, dent);
- if (de->de_name_len == 1 && filename[0] == '.')
+ if (d.dr_name_len == 1 && filename[0] == '.')
goto dirent_good;
- if (de->de_name_len == 2 && filename[0] == '.' && filename[1]
== '.')
+ if (d.dr_name_len == 2 && filename[0] == '.' && filename[1] ==
'.')
goto dirent_good;
- if ((de->de_name_len >= 11) || /* "journal9999" */
- (de->de_name_len <= 7) ||
+ if ((d.dr_name_len >= 11) || /* "journal9999" */
+ (d.dr_name_len <= 7) ||
(strncmp(filename, "journal", 7))) {
- bad_journalname(filename, de->de_name_len);
+ bad_journalname(filename, d.dr_name_len);
return -1;
}
- for (i = 7; i < de->de_name_len; i++) {
+ for (i = 7; i < d.dr_name_len; i++) {
if (filename[i] < '0' || filename[i] > '9') {
- bad_journalname(filename, de->de_name_len);
+ bad_journalname(filename, d.dr_name_len);
return -2;
}
}
diff --git a/gfs2/fsck/fsck.h b/gfs2/fsck/fsck.h
index bc706860..55f5abe8 100644
--- a/gfs2/fsck/fsck.h
+++ b/gfs2/fsck/fsck.h
@@ -36,7 +36,7 @@ struct gfs2_bmap {
struct inode_info
{
struct osi_node node;
- struct gfs2_inum di_num;
+ struct lgfs2_inum num;
uint32_t di_nlink; /* the number of links the inode
* thinks it has */
uint32_t counted_links; /* the number of links we've found */
@@ -45,9 +45,9 @@ struct inode_info
struct dir_info
{
struct osi_node node;
- struct gfs2_inum dinode;
+ struct lgfs2_inum dinode;
uint64_t treewalk_parent;
- struct gfs2_inum dotdot_parent;
+ struct lgfs2_inum dotdot_parent;
uint32_t di_nlink;
uint32_t counted_links;
uint8_t checked:1;
@@ -133,7 +133,7 @@ extern void dirtree_delete(struct dir_info *b);
/* FIXME: Hack to get this going for pass2 - this should be pulled out
* of pass1 and put somewhere else... */
-struct dir_info *dirtree_insert(struct gfs2_inum inum);
+struct dir_info *dirtree_insert(struct lgfs2_inum inum);
struct gfs2_options {
char *device;
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index 35599fb4..c2a8029d 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -453,7 +453,7 @@ static void check_rgrps_integrity(struct gfs2_sbd *sdp)
*/
static int rebuild_master(struct gfs2_sbd *sdp)
{
- struct gfs2_inum inum;
+ struct lgfs2_inum inum;
struct gfs2_buffer_head *bh = NULL;
int err = 0;
@@ -463,8 +463,8 @@ static int rebuild_master(struct gfs2_sbd *sdp)
return -1;
}
log_err(_("Trying to rebuild the master directory.\n"));
- inum.no_formal_ino = sdp->md.next_inum++;
- inum.no_addr = sdp->sd_meta_dir.no_addr;
+ inum.in_formal_ino = sdp->md.next_inum++;
+ inum.in_addr = sdp->sd_meta_dir.no_addr;
err = init_dinode(sdp, &bh, &inum, S_IFDIR | 0755, GFS2_DIF_SYSTEM, &inum);
if (err != 0)
return -1;
@@ -476,8 +476,8 @@ static int rebuild_master(struct gfs2_sbd *sdp)
sdp->master_dir->bh_owned = 1;
if (fix_md.jiinode) {
- inum.no_formal_ino = sdp->md.next_inum++;
- inum.no_addr = fix_md.jiinode->i_addr;
+ inum.in_formal_ino = sdp->md.next_inum++;
+ inum.in_addr = fix_md.jiinode->i_addr;
err = dir_add(sdp->master_dir, "jindex", 6, &inum,
IF2DT(S_IFDIR | 0700));
if (err) {
@@ -494,8 +494,8 @@ static int rebuild_master(struct gfs2_sbd *sdp)
}
if (fix_md.pinode) {
- inum.no_formal_ino = sdp->md.next_inum++;
- inum.no_addr = fix_md.pinode->i_addr;
+ inum.in_formal_ino = sdp->md.next_inum++;
+ inum.in_addr = fix_md.pinode->i_addr;
err = dir_add(sdp->master_dir, "per_node", 8, &inum,
IF2DT(S_IFDIR | 0700));
if (err) {
@@ -514,8 +514,8 @@ static int rebuild_master(struct gfs2_sbd *sdp)
}
if (fix_md.inum) {
- inum.no_formal_ino = sdp->md.next_inum++;
- inum.no_addr = fix_md.inum->i_addr;
+ inum.in_formal_ino = sdp->md.next_inum++;
+ inum.in_addr = fix_md.inum->i_addr;
err = dir_add(sdp->master_dir, "inum", 4, &inum,
IF2DT(S_IFREG | 0600));
if (err) {
@@ -532,8 +532,8 @@ static int rebuild_master(struct gfs2_sbd *sdp)
}
if (fix_md.statfs) {
- inum.no_formal_ino = sdp->md.next_inum++;
- inum.no_addr = fix_md.statfs->i_addr;
+ inum.in_formal_ino = sdp->md.next_inum++;
+ inum.in_addr = fix_md.statfs->i_addr;
err = dir_add(sdp->master_dir, "statfs", 6, &inum,
IF2DT(S_IFREG | 0600));
if (err) {
@@ -550,8 +550,8 @@ static int rebuild_master(struct gfs2_sbd *sdp)
}
if (fix_md.riinode) {
- inum.no_formal_ino = sdp->md.next_inum++;
- inum.no_addr = fix_md.riinode->i_addr;
+ inum.in_formal_ino = sdp->md.next_inum++;
+ inum.in_addr = fix_md.riinode->i_addr;
err = dir_add(sdp->master_dir, "rindex", 6, &inum,
IF2DT(S_IFREG | 0600));
if (err) {
@@ -567,8 +567,8 @@ static int rebuild_master(struct gfs2_sbd *sdp)
}
if (fix_md.qinode) {
- inum.no_formal_ino = sdp->md.next_inum++;
- inum.no_addr = fix_md.qinode->i_addr;
+ inum.in_formal_ino = sdp->md.next_inum++;
+ inum.in_addr = fix_md.qinode->i_addr;
err = dir_add(sdp->master_dir, "quota", 5, &inum,
IF2DT(S_IFREG | 0600));
if (err) {
@@ -987,7 +987,7 @@ static int is_journal_copy(struct gfs2_inode *ip)
static void peruse_system_dinode(struct gfs2_sbd *sdp, struct gfs2_inode *ip)
{
struct gfs2_inode *child_ip;
- struct gfs2_inum inum;
+ struct lgfs2_inum inum;
int error;
if (ip->i_formal_ino == 2) {
@@ -1032,10 +1032,10 @@ static void peruse_system_dinode(struct gfs2_sbd *sdp, struct
gfs2_inode *ip)
ip->i_addr);
fix_md.pinode = ip;
error = dir_search(ip, "..", 2, NULL, &inum);
- if (!error && inum.no_addr) {
- sdp->sd_meta_dir.no_addr = inum.no_addr;
+ if (!error && inum.in_addr) {
+ sdp->sd_meta_dir.no_addr = inum.in_addr;
log_warn(_("From per_node's '..' master directory backtracked to:
"
- "0x%"PRIx64"\n"), inum.no_addr);
+ "0x%"PRIx64"\n"), inum.in_addr);
}
return;
}
@@ -1076,7 +1076,7 @@ out_discard_ip:
static void peruse_user_dinode(struct gfs2_sbd *sdp, struct gfs2_inode *ip)
{
struct gfs2_inode *parent_ip;
- struct gfs2_inum inum;
+ struct lgfs2_inum inum;
int error;
if (sdp->sd_root_dir.no_addr) /* if we know the root dinode */
@@ -1126,8 +1126,8 @@ static void peruse_user_dinode(struct gfs2_sbd *sdp, struct
gfs2_inode *ip)
ip = parent_ip;
}
error = dir_search(ip, "..", 2, NULL, &inum);
- if (!error && inum.no_addr && inum.no_addr < possible_root) {
- possible_root = inum.no_addr;
+ if (!error && inum.in_addr && inum.in_addr < possible_root) {
+ possible_root = inum.in_addr;
log_debug(_("Found a possible root at: 0x%"PRIx64"\n"),
possible_root);
}
@@ -1278,8 +1278,6 @@ static int sb_repair(struct gfs2_sbd *sdp)
return -1;
}
if (!sdp->sd_root_dir.no_addr) {
- struct gfs2_inum inum;
-
log_err(_("Unable to locate the root directory.\n"));
if (possible_root == HIGHEST_BLOCK) {
/* Take advantage of the fact that mkfs.gfs2
@@ -1294,6 +1292,7 @@ static int sb_repair(struct gfs2_sbd *sdp)
sdp->md.rooti = lgfs2_inode_read(sdp, possible_root);
if (!sdp->md.rooti || sdp->md.rooti->i_magic != GFS2_MAGIC) {
struct gfs2_buffer_head *bh = NULL;
+ struct lgfs2_inum inum;
log_err(_("The root dinode block is destroyed.\n"));
log_err(_("At this point I recommend "
@@ -1306,8 +1305,8 @@ static int sb_repair(struct gfs2_sbd *sdp)
"reinitialized; aborting.\n"));
return -1;
}
- inum.no_formal_ino = 1;
- inum.no_addr = possible_root;
+ inum.in_formal_ino = 1;
+ inum.in_addr = possible_root;
error = init_dinode(sdp, &bh, &inum, S_IFDIR | 0755, 0, &inum);
if (error != 0)
return -1;
diff --git a/gfs2/fsck/inode_hash.c b/gfs2/fsck/inode_hash.c
index 09303d73..a1e67b23 100644
--- a/gfs2/fsck/inode_hash.c
+++ b/gfs2/fsck/inode_hash.c
@@ -19,9 +19,9 @@ struct inode_info *inodetree_find(uint64_t block)
while (node) {
struct inode_info *data = (struct inode_info *)node;
- if (block < data->di_num.no_addr)
+ if (block < data->num.in_addr)
node = node->osi_left;
- else if (block > data->di_num.no_addr)
+ else if (block > data->num.in_addr)
node = node->osi_right;
else
return data;
@@ -29,7 +29,7 @@ struct inode_info *inodetree_find(uint64_t block)
return NULL;
}
-struct inode_info *inodetree_insert(struct gfs2_inum di_num)
+struct inode_info *inodetree_insert(struct lgfs2_inum no)
{
struct osi_node **newn = &inodetree.osi_node, *parent = NULL;
struct inode_info *data;
@@ -39,9 +39,9 @@ struct inode_info *inodetree_insert(struct gfs2_inum di_num)
struct inode_info *cur = (struct inode_info *)*newn;
parent = *newn;
- if (di_num.no_addr < cur->di_num.no_addr)
+ if (no.in_addr < cur->num.in_addr)
newn = &((*newn)->osi_left);
- else if (di_num.no_addr > cur->di_num.no_addr)
+ else if (no.in_addr > cur->num.in_addr)
newn = &((*newn)->osi_right);
else
return cur;
@@ -53,7 +53,7 @@ struct inode_info *inodetree_insert(struct gfs2_inum di_num)
return NULL;
}
/* Add new node and rebalance tree. */
- data->di_num = di_num;
+ data->num = no;
osi_link_node(&data->node, parent, newn);
osi_insert_color(&data->node, &inodetree);
diff --git a/gfs2/fsck/inode_hash.h b/gfs2/fsck/inode_hash.h
index ba18ab22..da9d15ce 100644
--- a/gfs2/fsck/inode_hash.h
+++ b/gfs2/fsck/inode_hash.h
@@ -4,7 +4,7 @@
struct inode_info;
extern struct inode_info *inodetree_find(uint64_t block);
-extern struct inode_info *inodetree_insert(struct gfs2_inum di_num);
+extern struct inode_info *inodetree_insert(struct lgfs2_inum no);
extern void inodetree_delete(struct inode_info *b);
#endif /* _INODE_HASH_H */
diff --git a/gfs2/fsck/link.c b/gfs2/fsck/link.c
index 1c5ec3d2..43dd6df4 100644
--- a/gfs2/fsck/link.c
+++ b/gfs2/fsck/link.c
@@ -60,9 +60,9 @@ int set_di_nlink(struct gfs2_inode *ip)
/* If the list has entries, look for one that matches inode_no */
ii = inodetree_find(ip->i_addr);
if (!ii) {
- struct gfs2_inum no = {
- .no_addr = ip->i_addr,
- .no_formal_ino = ip->i_formal_ino
+ struct lgfs2_inum no = {
+ .in_addr = ip->i_addr,
+ .in_formal_ino = ip->i_formal_ino
};
ii = inodetree_insert(no);
}
@@ -81,48 +81,47 @@ int set_di_nlink(struct gfs2_inode *ip)
(unsigned long long)referenced_from, counted_links, \
(unsigned long long)no_addr, why);
-int incr_link_count(struct gfs2_inum no, struct gfs2_inode *ip,
- const char *why)
+int incr_link_count(struct lgfs2_inum no, struct gfs2_inode *ip, const char *why)
{
struct inode_info *ii = NULL;
uint64_t referenced_from = ip ? ip->i_addr : 0;
struct dir_info *di;
struct gfs2_inode *link_ip;
- di = dirtree_find(no.no_addr);
+ di = dirtree_find(no.in_addr);
if (di) {
- if (di->dinode.no_formal_ino != no.no_formal_ino)
+ if (di->dinode.in_formal_ino != no.in_formal_ino)
return INCR_LINK_INO_MISMATCH;
di->counted_links++;
- whyincr(no.no_addr, why, referenced_from, di->counted_links);
+ whyincr(no.in_addr, why, referenced_from, di->counted_links);
return INCR_LINK_GOOD;
}
- ii = inodetree_find(no.no_addr);
+ ii = inodetree_find(no.in_addr);
/* If the list has entries, look for one that matches inode_no */
if (ii) {
- if (ii->di_num.no_formal_ino != no.no_formal_ino)
+ if (ii->num.in_formal_ino != no.in_formal_ino)
return INCR_LINK_INO_MISMATCH;
ii->counted_links++;
- whyincr(no.no_addr, why, referenced_from, ii->counted_links);
+ whyincr(no.in_addr, why, referenced_from, ii->counted_links);
return INCR_LINK_GOOD;
}
- if (link1_type(&clink1map, no.no_addr) != 1) {
- link1_set(&clink1map, no.no_addr, 1);
- whyincr(no.no_addr, why, referenced_from, 1);
+ if (link1_type(&clink1map, no.in_addr) != 1) {
+ link1_set(&clink1map, no.in_addr, 1);
+ whyincr(no.in_addr, why, referenced_from, 1);
return INCR_LINK_GOOD;
}
- link_ip = fsck_load_inode(ip->i_sbd, no.no_addr);
+ link_ip = fsck_load_inode(ip->i_sbd, no.in_addr);
/* Check formal ino against dinode before adding to inode tree. */
- if (no.no_formal_ino != link_ip->i_formal_ino) {
+ if (no.in_formal_ino != link_ip->i_formal_ino) {
fsck_inode_put(&link_ip);
return INCR_LINK_INO_MISMATCH; /* inode mismatch */
}
/* Move it from the link1 maps to a real inode tree entry */
- link1_set(&nlink1map, no.no_addr, 0);
- link1_set(&clink1map, no.no_addr, 0);
+ link1_set(&nlink1map, no.in_addr, 0);
+ link1_set(&clink1map, no.in_addr, 0);
/* If no match was found, it must be a hard link. In theory, it can't
be a duplicate because those were resolved in pass1b. Add a new
@@ -132,17 +131,17 @@ int incr_link_count(struct gfs2_inum no, struct gfs2_inode *ip,
log_debug( _("Ref: (0x%llx) Error incrementing link for "
"(0x%llx)!\n"),
(unsigned long long)referenced_from,
- (unsigned long long)no.no_addr);
+ (unsigned long long)no.in_addr);
fsck_inode_put(&link_ip);
return INCR_LINK_BAD;
}
- ii->di_num.no_addr = link_ip->i_addr;
- ii->di_num.no_formal_ino = link_ip->i_formal_ino;
+ ii->num.in_addr = link_ip->i_addr;
+ ii->num.in_formal_ino = link_ip->i_formal_ino;
fsck_inode_put(&link_ip);
ii->di_nlink = 1; /* Must be 1 or it wouldn't have gotten into the
nlink1map */
ii->counted_links = 2;
- whyincr(no.no_addr, why, referenced_from, ii->counted_links);
+ whyincr(no.in_addr, why, referenced_from, ii->counted_links);
/* We transitioned a dentry link count from 1 to 2, and we know it's
not a directory. But the new reference has the correct formal
inode number, so the first reference is suspect: we need to
diff --git a/gfs2/fsck/link.h b/gfs2/fsck/link.h
index 0b300225..98872d7b 100644
--- a/gfs2/fsck/link.h
+++ b/gfs2/fsck/link.h
@@ -13,8 +13,7 @@ enum {
int link1_set(struct gfs2_bmap *bmap, uint64_t bblock, int mark);
int set_di_nlink(struct gfs2_inode *ip);
-int incr_link_count(struct gfs2_inum no, struct gfs2_inode *ip,
- const char *why);
+int incr_link_count(struct lgfs2_inum no, struct gfs2_inode *ip, const char *why);
int decr_link_count(uint64_t inode_no, uint64_t referenced_from, int gfs1,
const char *why);
diff --git a/gfs2/fsck/lost_n_found.c b/gfs2/fsck/lost_n_found.c
index 59df4c05..4e543fb1 100644
--- a/gfs2/fsck/lost_n_found.c
+++ b/gfs2/fsck/lost_n_found.c
@@ -22,7 +22,7 @@ static void add_dotdot(struct gfs2_inode *ip)
{
struct gfs2_sbd *sdp = ip->i_sbd;
struct dir_info *di;
- struct gfs2_inum no;
+ struct lgfs2_inum no;
int err;
log_info(_("Adding .. entry to directory %"PRIu64"
(0x%"PRIx64") pointing back to lost+found\n"),
@@ -31,14 +31,14 @@ static void add_dotdot(struct gfs2_inode *ip)
/* If there's a pre-existing .. directory entry, we have to
back out the links. */
di = dirtree_find(ip->i_addr);
- if (di && valid_block(sdp, di->dotdot_parent.no_addr)) {
+ if (di && valid_block(sdp, di->dotdot_parent.in_addr)) {
struct gfs2_inode *dip;
log_debug(_("Directory (0x%"PRIx64") already had a '..' link to
(0x%"PRIx64").\n"),
- ip->i_addr, di->dotdot_parent.no_addr);
- dip = fsck_load_inode(sdp, di->dotdot_parent.no_addr);
- if (dip->i_formal_ino == di->dotdot_parent.no_formal_ino) {
- decr_link_count(di->dotdot_parent.no_addr, ip->i_addr, sdp->gfs1,
+ ip->i_addr, di->dotdot_parent.in_addr);
+ dip = fsck_load_inode(sdp, di->dotdot_parent.in_addr);
+ if (dip->i_formal_ino == di->dotdot_parent.in_formal_ino) {
+ decr_link_count(di->dotdot_parent.in_addr, ip->i_addr, sdp->gfs1,
_(".. unlinked, moving to lost+found"));
if (dip->i_nlink > 0) {
dip->i_nlink--;
@@ -59,8 +59,8 @@ static void add_dotdot(struct gfs2_inode *ip)
log_debug(_("Directory (0x%"PRIx64")'s link to parent "
"(0x%"PRIx64") had a formal inode discrepancy: "
"was 0x%"PRIx64", expected 0x%"PRIx64"\n"),
- ip->i_addr, di->dotdot_parent.no_addr,
- di->dotdot_parent.no_formal_ino,
+ ip->i_addr, di->dotdot_parent.in_addr,
+ di->dotdot_parent.in_formal_ino,
dip->i_formal_ino);
log_debug(_("The parent directory was not changed.\n"));
}
@@ -71,7 +71,7 @@ static void add_dotdot(struct gfs2_inode *ip)
log_debug(_("Couldn't find a valid '..' entry "
"for orphan directory (0x%"PRIx64"): "
"'..' = 0x%"PRIx64"\n"),
- ip->i_addr, di->dotdot_parent.no_addr);
+ ip->i_addr, di->dotdot_parent.in_addr);
else
log_debug(_("Couldn't find directory (0x%"PRIx64") "
"in directory tree.\n"),
@@ -81,8 +81,8 @@ static void add_dotdot(struct gfs2_inode *ip)
log_warn( _("add_inode_to_lf: Unable to remove "
"\"..\" directory entry.\n"));
- no.no_addr = lf_dip->i_addr;
- no.no_formal_ino = lf_dip->i_formal_ino;
+ no.in_addr = lf_dip->i_addr;
+ no.in_formal_ino = lf_dip->i_formal_ino;
err = dir_add(ip, "..", 2, &no, (sdp->gfs1 ? GFS_FILE_DIR : DT_DIR));
if (err) {
log_crit(_("Error adding .. directory: %s\n"),
@@ -127,9 +127,9 @@ void make_sure_lf_exists(struct gfs2_inode *ip)
set_di_nlink(sdp->md.rooti);
if (sdp->md.rooti->i_entries > root_entries) {
- struct gfs2_inum no = {
- .no_addr = lf_dip->i_addr,
- .no_formal_ino = lf_dip->i_formal_ino
+ struct lgfs2_inum no = {
+ .in_addr = lf_dip->i_addr,
+ .in_formal_ino = lf_dip->i_formal_ino
};
lf_was_created = 1;
/* This is a new lost+found directory, so set its block type
@@ -143,12 +143,12 @@ void make_sure_lf_exists(struct gfs2_inode *ip)
the rgrp counts properly. */
fsck_bitmap_set(ip, lf_dip->i_addr, _("lost+found dinode"),
GFS2_BLKST_DINODE);
/* root inode links to lost+found */
- no.no_addr = sdp->md.rooti->i_addr;
- no.no_formal_ino = sdp->md.rooti->i_formal_ino;
+ no.in_addr = sdp->md.rooti->i_addr;
+ no.in_formal_ino = sdp->md.rooti->i_formal_ino;
incr_link_count(no, lf_dip, _("root"));
/* lost+found link for '.' from itself */
- no.no_addr = lf_dip->i_addr;
- no.no_formal_ino = lf_dip->i_formal_ino;
+ no.in_addr = lf_dip->i_addr;
+ no.in_formal_ino = lf_dip->i_formal_ino;
incr_link_count(no, lf_dip, "\".\"");
/* lost+found link for '..' back to root */
incr_link_count(no, sdp->md.rooti, "\"..\"");
@@ -178,7 +178,7 @@ int add_inode_to_lf(struct gfs2_inode *ip){
char tmp_name[256];
__be32 inode_type;
struct gfs2_sbd *sdp = ip->i_sbd;
- struct gfs2_inum no;
+ struct lgfs2_inum no;
int err = 0;
uint32_t mode;
@@ -229,8 +229,8 @@ int add_inode_to_lf(struct gfs2_inode *ip){
break;
}
- no.no_addr = ip->i_addr;
- no.no_formal_ino = ip->i_formal_ino;
+ no.in_addr = ip->i_addr;
+ no.in_formal_ino = ip->i_formal_ino;
err = dir_add(lf_dip, tmp_name, strlen(tmp_name), &no, inode_type);
if (err) {
log_crit(_("Error adding directory %s: %s\n"),
@@ -242,8 +242,8 @@ int add_inode_to_lf(struct gfs2_inode *ip){
incr_link_count(no, lf_dip, _("from lost+found"));
/* If it's a directory, lost+found is back-linked to it via .. */
if (mode == S_IFDIR) {
- no.no_addr = lf_dip->i_addr;
- no.no_formal_ino = lf_dip->i_formal_ino;
+ no.in_addr = lf_dip->i_addr;
+ no.in_formal_ino = lf_dip->i_formal_ino;
incr_link_count(no, ip, _("to lost+found"));
}
log_notice(_("Added inode #%"PRIu64" (0x%"PRIx64") to
lost+found\n"),
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index b699ca8d..d915b085 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -304,7 +304,7 @@ void fsck_inode_put(struct gfs2_inode **ip_in)
/**
* dirent_repair - attempt to repair a corrupt directory entry.
* @bh - The buffer header that contains the bad dirent
- * @de - The directory entry in native format
+ * @dh - The directory entry in native format
* @dent - The directory entry in on-disk format
* @type - Type of directory (DIR_LINEAR or DIR_EXHASH)
* @first - TRUE if this is the first dirent in the buffer
@@ -313,19 +313,19 @@ void fsck_inode_put(struct gfs2_inode **ip_in)
* know at this point is that the length field is wrong.
*/
static int dirent_repair(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
- struct gfs2_dirent *de, struct gfs2_dirent *dent,
+ struct lgfs2_dirent *d, struct gfs2_dirent *dent,
int type, int first)
{
char *bh_end, *p;
int calc_de_name_len = 0;
-
+
/* If this is a sentinel, just fix the length and move on */
- if (first && !de->de_inum.no_formal_ino) { /* Is it a sentinel? */
+ if (first && !d->dr_inum.in_formal_ino) { /* Is it a sentinel? */
if (type == DIR_LINEAR)
- de->de_rec_len = ip->i_sbd->sd_bsize -
+ d->dr_rec_len = ip->i_sbd->sd_bsize -
sizeof(struct gfs2_dinode);
else
- de->de_rec_len = ip->i_sbd->sd_bsize -
+ d->dr_rec_len = ip->i_sbd->sd_bsize -
sizeof(struct gfs2_leaf);
} else {
bh_end = bh->b_data + ip->i_sbd->sd_bsize;
@@ -342,12 +342,12 @@ static int dirent_repair(struct gfs2_inode *ip, struct
gfs2_buffer_head *bh,
/* There can often be noise at the end, so only */
/* Trust the shorter of the two in case we have too much */
/* Or rather, only trust ours if it's shorter. */
- if (!de->de_name_len || de->de_name_len > NAME_MAX ||
- calc_de_name_len < de->de_name_len) /* if dent is hosed */
- de->de_name_len = calc_de_name_len; /* use ours */
- de->de_rec_len = GFS2_DIRENT_SIZE(de->de_name_len);
+ if (!d->dr_name_len || d->dr_name_len > NAME_MAX ||
+ calc_de_name_len < d->dr_name_len) /* if dent is hosed */
+ d->dr_name_len = calc_de_name_len; /* use ours */
+ d->dr_rec_len = GFS2_DIRENT_SIZE(d->dr_name_len);
}
- gfs2_dirent_out(de, (char *)dent);
+ lgfs2_dirent_out(d, dent);
bmodified(bh);
return 0;
}
@@ -359,14 +359,14 @@ static void dirblk_truncate(struct gfs2_inode *ip, struct
gfs2_dirent *fixb,
struct gfs2_buffer_head *bh)
{
char *bh_end;
- struct gfs2_dirent de;
+ struct lgfs2_dirent d;
bh_end = bh->b_data + ip->i_sbd->sd_bsize;
/* truncate the block to save the most dentries. To do this we
have to patch the previous dent. */
- gfs2_dirent_in(&de, (char *)fixb);
- de.de_rec_len = bh_end - (char *)fixb;
- gfs2_dirent_out(&de, (char *)fixb);
+ lgfs2_dirent_in(&d, fixb);
+ d.dr_rec_len = bh_end - (char *)fixb;
+ lgfs2_dirent_out(&d, fixb);
bmodified(bh);
}
@@ -387,8 +387,8 @@ static int check_entries(struct gfs2_inode *ip, struct
gfs2_buffer_head *bh,
int type, uint32_t *count, int lindex,
struct metawalk_fxns *pass)
{
- struct gfs2_dirent *dent;
- struct gfs2_dirent de, *prev;
+ struct gfs2_dirent *dent, *prev;
+ struct lgfs2_dirent d;
int error = 0;
char *bh_end;
char *filename;
@@ -412,20 +412,19 @@ static int check_entries(struct gfs2_inode *ip, struct
gfs2_buffer_head *bh,
while (1) {
if (skip_this_pass || fsck_abort)
return FSCK_OK;
- memset(&de, 0, sizeof(struct gfs2_dirent));
- gfs2_dirent_in(&de, (char *)dent);
+ lgfs2_dirent_in(&d, dent);
filename = (char *)dent + sizeof(struct gfs2_dirent);
- if (de.de_rec_len < sizeof(struct gfs2_dirent) +
- de.de_name_len ||
- (de.de_inum.no_formal_ino && !de.de_name_len && !first)) {
+ if (d.dr_rec_len < sizeof(struct gfs2_dirent) +
+ d.dr_name_len ||
+ (d.dr_inum.in_formal_ino && !d.dr_name_len && !first)) {
log_err(_("Directory block %"PRIu64" (0x%"PRIx64"), "
"entry %d of directory %"PRIu64" (0x%"PRIx64")
"
"is corrupt.\n"),
bh->b_blocknr, bh->b_blocknr, (*count) + 1,
ip->i_addr, ip->i_addr);
if (query( _("Attempt to repair it? (y/n) "))) {
- if (dirent_repair(ip, bh, &de, dent, type,
+ if (dirent_repair(ip, bh, &d, dent, type,
first)) {
if (first) /* make a new sentinel */
dirblk_truncate(ip, dent, bh);
@@ -448,8 +447,8 @@ static int check_entries(struct gfs2_inode *ip, struct
gfs2_buffer_head *bh,
return 0;
}
}
- if (!de.de_inum.no_formal_ino){
- if (first){
+ if (!d.dr_inum.in_formal_ino) {
+ if (first) {
log_debug( _("First dirent is a sentinel (place holder).\n"));
first = 0;
} else {
@@ -471,12 +470,12 @@ static int check_entries(struct gfs2_inode *ip, struct
gfs2_buffer_head *bh,
return 0;
}
} else {
- if (!de.de_inum.no_addr && first) { /* reverse sentinel */
+ if (!d.dr_inum.in_addr && first) { /* reverse sentinel */
log_debug( _("First dirent is a Sentinel (place holder).\n"));
/* Swap the two to silently make it a proper sentinel */
- de.de_inum.no_addr = de.de_inum.no_formal_ino;
- de.de_inum.no_formal_ino = 0;
- gfs2_dirent_out(&de, (char *)dent);
+ d.dr_inum.in_addr = d.dr_inum.in_formal_ino;
+ d.dr_inum.in_formal_ino = 0;
+ lgfs2_dirent_out(&d, dent);
bmodified(bh);
/* Mark dirent buffer as modified */
first = 0;
@@ -492,7 +491,7 @@ static int check_entries(struct gfs2_inode *ip, struct
gfs2_buffer_head *bh,
}
}
- if ((char *)dent + de.de_rec_len >= bh_end){
+ if ((char *)dent + d.dr_rec_len >= bh_end){
log_debug(_("Last entry processed for %"PRIu64"->%"PRIu64
"(0x%"PRIx64"->0x%"PRIx64"),
di_blocks=%"PRIu64".\n"),
ip->i_addr, bh->b_blocknr, ip->i_addr,
@@ -505,7 +504,7 @@ static int check_entries(struct gfs2_inode *ip, struct
gfs2_buffer_head *bh,
if (!error || first)
prev = dent;
first = 0;
- dent = (struct gfs2_dirent *)((char *)dent + de.de_rec_len);
+ dent = (struct gfs2_dirent *)((char *)dent + d.dr_rec_len);
}
return 0;
}
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 047a96b0..bd3c360a 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -231,18 +231,16 @@ static int resuscitate_dentry(struct gfs2_inode *ip, struct
gfs2_dirent *dent,
uint32_t *count, int *lindex, void *priv)
{
struct gfs2_sbd *sdp = ip->i_sbd;
- struct gfs2_dirent dentry, *de;
+ struct lgfs2_dirent d;
char tmp_name[PATH_MAX];
uint64_t block;
- memset(&dentry, 0, sizeof(struct gfs2_dirent));
- gfs2_dirent_in(&dentry, (char *)dent);
- de = &dentry;
- block = de->de_inum.no_addr;
+ lgfs2_dirent_in(&d, dent);
+ block = d.dr_inum.in_addr;
/* Start of checks */
memset(tmp_name, 0, sizeof(tmp_name));
- if (de->de_name_len < sizeof(tmp_name))
- strncpy(tmp_name, filename, de->de_name_len);
+ if (d.dr_name_len < sizeof(tmp_name))
+ strncpy(tmp_name, filename, d.dr_name_len);
else
strncpy(tmp_name, filename, sizeof(tmp_name) - 1);
if (!valid_block_ip(ip, block)) {
@@ -1214,7 +1212,7 @@ struct metawalk_fxns eattr_undo_fxns = {
static int set_ip_blockmap(struct gfs2_inode *ip)
{
uint64_t block = ip->i_bh->b_blocknr;
- struct gfs2_inum no;
+ struct lgfs2_inum no;
uint32_t mode;
const char *ty;
@@ -1248,8 +1246,8 @@ static int set_ip_blockmap(struct gfs2_inode *ip)
default:
return -EINVAL;
}
- no.no_addr = ip->i_addr;
- no.no_formal_ino = ip->i_formal_ino;
+ no.in_addr = ip->i_addr;
+ no.in_formal_ino = ip->i_formal_ino;
if (fsck_blockmap_set(ip, block, ty, GFS2_BLKST_DINODE) ||
(mode == S_IFDIR && !dirtree_insert(no))) {
stack;
@@ -1599,9 +1597,9 @@ static int check_system_inode(struct gfs2_sbd *sdp,
filename, GFS2_BLKST_DINODE);
ds.q = GFS2_BLKST_DINODE;
if (isdir) {
- struct gfs2_inum no = {
- .no_addr = (*sysinode)->i_addr,
- .no_formal_ino = (*sysinode)->i_formal_ino
+ struct lgfs2_inum no = {
+ .in_addr = (*sysinode)->i_addr,
+ .in_formal_ino = (*sysinode)->i_formal_ino
};
dirtree_insert(no);
}
@@ -1652,9 +1650,9 @@ static int check_system_inode(struct gfs2_sbd *sdp,
filename, GFS2_BLKST_DINODE);
ds.q = GFS2_BLKST_DINODE;
if (isdir) {
- struct gfs2_inum no = {
- .no_addr = (*sysinode)->i_addr,
- .no_formal_ino = (*sysinode)->i_formal_ino
+ struct lgfs2_inum no = {
+ .in_addr = (*sysinode)->i_addr,
+ .in_formal_ino = (*sysinode)->i_formal_ino
};
dirtree_insert(no);
}
@@ -1769,21 +1767,21 @@ static int check_system_inodes(struct gfs2_sbd *sdp)
journal_count = sdp->md.journals;
/* gfs1's journals aren't dinode, they're just a bunch of blocks. */
if (sdp->gfs1) {
- struct gfs2_inum no;
+ struct lgfs2_inum no;
/* gfs1 has four dinodes that are set in the superblock and
therefore not linked to anything else. We need to adjust
the link counts so pass4 doesn't get confused. */
- no.no_addr = sdp->md.statfs->i_addr;
- no.no_formal_ino = sdp->md.statfs->i_formal_ino;
+ no.in_addr = sdp->md.statfs->i_addr;
+ no.in_formal_ino = sdp->md.statfs->i_formal_ino;
incr_link_count(no, NULL, _("gfs1 statfs inode"));
- no.no_addr = sdp->md.jiinode->i_addr;
- no.no_formal_ino = sdp->md.jiinode->i_formal_ino;
+ no.in_addr = sdp->md.jiinode->i_addr;
+ no.in_formal_ino = sdp->md.jiinode->i_formal_ino;
incr_link_count(no, NULL, _("gfs1 jindex inode"));
- no.no_addr = sdp->md.riinode->i_addr;
- no.no_formal_ino = sdp->md.riinode->i_formal_ino;
+ no.in_addr = sdp->md.riinode->i_addr;
+ no.in_formal_ino = sdp->md.riinode->i_formal_ino;
incr_link_count(no, NULL, _("gfs1 rindex inode"));
- no.no_addr = sdp->md.qinode->i_addr;
- no.no_formal_ino = sdp->md.qinode->i_formal_ino;
+ no.in_addr = sdp->md.qinode->i_addr;
+ no.in_formal_ino = sdp->md.qinode->i_formal_ino;
incr_link_count(no, NULL, _("gfs1 quota inode"));
return 0;
}
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index d8d08056..f3fdd4cb 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -32,48 +32,37 @@ struct metawalk_fxns delete_eattrs = {
/* Set children's parent inode in dir_info structure - ext2 does not set
* dotdot inode here, but instead in pass3 - should we? */
-static int set_parent_dir(struct gfs2_sbd *sdp, struct gfs2_inum child,
- struct gfs2_inum parent)
+static int set_parent_dir(struct gfs2_sbd *sdp, struct lgfs2_inum child, struct
lgfs2_inum parent)
{
struct dir_info *di;
- di = dirtree_find(child.no_addr);
+ di = dirtree_find(child.in_addr);
if (!di) {
- log_err( _("Unable to find block %llu (0x%llx"
- ") in dir_info list\n"),
- (unsigned long long)child.no_addr,
- (unsigned long long)child.no_addr);
+ log_err(_("Unable to find block %"PRIu64" (0x%"PRIx64") in
dir_info list\n"),
+ child.in_addr, child.in_addr);
return -1;
}
- if (di->dinode.no_addr == child.no_addr &&
- di->dinode.no_formal_ino == child.no_formal_ino) {
+ if (di->dinode.in_addr == child.in_addr &&
+ di->dinode.in_formal_ino == child.in_formal_ino) {
if (di->treewalk_parent) {
- log_err( _("Another directory at block %lld (0x%llx) "
- "already contains this child %lld (0x%llx)"
- " - checking parent %lld (0x%llx)\n"),
- (unsigned long long)di->treewalk_parent,
- (unsigned long long)di->treewalk_parent,
- (unsigned long long)child.no_addr,
- (unsigned long long)child.no_addr,
- (unsigned long long)parent.no_addr,
- (unsigned long long)parent.no_addr);
+ log_err(_("Another directory at block %"PRIu64" (0x%"PRIx64")
"
+ "already contains this child %"PRIu64"
(0x%"PRIx64")"
+ " - checking parent %"PRIu64"
(0x%"PRIx64")\n"),
+ di->treewalk_parent, di->treewalk_parent, child.in_addr,
+ child.in_addr, parent.in_addr, parent.in_addr);
return 1;
}
- log_debug( _("Child %lld (0x%llx) has parent %lld (0x%llx)\n"),
- (unsigned long long)child.no_addr,
- (unsigned long long)child.no_addr,
- (unsigned long long)parent.no_addr,
- (unsigned long long)parent.no_addr);
- di->treewalk_parent = parent.no_addr;
+ log_debug(_("Child %"PRIu64" (0x%"PRIx64") has parent
%"PRIu64" (0x%"PRIx64")\n"),
+ child.in_addr, child.in_addr, parent.in_addr, parent.in_addr);
+ di->treewalk_parent = parent.in_addr;
}
return 0;
}
/* Set's the child's '..' directory inode number in dir_info structure
*/
-static int set_dotdot_dir(struct gfs2_sbd *sdp, uint64_t childblock,
- struct gfs2_inum parent)
+static int set_dotdot_dir(struct gfs2_sbd *sdp, uint64_t childblock, struct lgfs2_inum
parent)
{
struct dir_info *di;
@@ -83,30 +72,25 @@ static int set_dotdot_dir(struct gfs2_sbd *sdp, uint64_t childblock,
") in dir_info tree\n"), childblock, childblock);
return -1;
}
- if (di->dinode.no_addr != childblock) {
+ if (di->dinode.in_addr != childblock) {
log_debug("'..' doesn't point to what we found: childblock "
- "(0x%llx) != dinode (0x%llx)\n",
- (unsigned long long)childblock,
- (unsigned long long)di->dinode.no_addr);
+ "(0x%"PRIx64") != dinode (0x%"PRIx64")\n",
+ childblock, di->dinode.in_addr);
return -1;
}
/* Special case for root inode because we set it earlier */
- if (di->dotdot_parent.no_addr &&
- sdp->md.rooti->i_addr != di->dinode.no_addr) {
+ if (di->dotdot_parent.in_addr &&
+ sdp->md.rooti->i_addr != di->dinode.in_addr) {
/* This should never happen */
- log_crit( _("Dotdot parent already set for block %llu (0x%llx)"
- "-> %llu (0x%llx)\n"),
- (unsigned long long)childblock,
- (unsigned long long)childblock,
- (unsigned long long)di->dotdot_parent.no_addr,
- (unsigned long long)di->dotdot_parent.no_addr);
+ log_crit(_("Dotdot parent already set for block %"PRIu64"
(0x%"PRIx64") "
+ "-> %"PRIu64" (0x%"PRIx64")\n"),
+ childblock, childblock, di->dotdot_parent.in_addr,
di->dotdot_parent.in_addr);
return -1;
}
- log_debug("Setting '..' for directory block (0x%llx) to parent "
- "(0x%llx)\n", (unsigned long long)childblock,
- (unsigned long long)parent.no_addr);
- di->dotdot_parent.no_addr = parent.no_addr;
- di->dotdot_parent.no_formal_ino = parent.no_formal_ino;
+ log_debug("Setting '..' for directory block (0x%"PRIx64") to
parent (0x%"PRIx64")\n",
+ childblock, parent.in_addr);
+ di->dotdot_parent.in_addr = parent.in_addr;
+ di->dotdot_parent.in_formal_ino = parent.in_formal_ino;
return 0;
}
@@ -176,42 +160,41 @@ struct metawalk_fxns pass2_fxns_delete = {
* 1 if the caller should delete the dirent
*/
static int bad_formal_ino(struct gfs2_inode *ip, struct gfs2_dirent *dent,
- struct gfs2_inum entry, const char *tmp_name,
- int q, struct gfs2_dirent *de,
+ struct lgfs2_inum entry, const char *tmp_name,
+ int q, struct lgfs2_dirent *d,
struct gfs2_buffer_head *bh)
{
struct inode_info *ii;
struct dir_info *di = NULL;
struct gfs2_inode *child_ip;
- struct gfs2_inum childs_dotdot;
+ struct lgfs2_inum childs_dotdot;
struct gfs2_sbd *sdp = ip->i_sbd;
int error;
- struct gfs2_inum inum = { 0 };
+ struct lgfs2_inum inum = {0};
- ii = inodetree_find(entry.no_addr);
+ ii = inodetree_find(entry.in_addr);
if (ii)
- inum = ii->di_num;
+ inum = ii->num;
else {
- di = dirtree_find(entry.no_addr);
+ di = dirtree_find(entry.in_addr);
if (di)
inum = di->dinode;
- else if (link1_type(&clink1map, entry.no_addr) == 1) {
+ else if (link1_type(&clink1map, entry.in_addr) == 1) {
struct gfs2_inode *dent_ip;
- dent_ip = fsck_load_inode(ip->i_sbd, entry.no_addr);
- inum.no_addr = dent_ip->i_addr;
- inum.no_formal_ino = dent_ip->i_formal_ino;
+ dent_ip = fsck_load_inode(ip->i_sbd, entry.in_addr);
+ inum.in_addr = dent_ip->i_addr;
+ inum.in_formal_ino = dent_ip->i_formal_ino;
fsck_inode_put(&dent_ip);
}
}
log_err(_("Directory entry '%s' pointing to block %"PRIu64"
(0x%"PRIx64") in "
"directory %"PRIu64" (0x%"PRIx64") has the wrong
'formal' inode number.\n"),
- tmp_name, entry.no_addr, entry.no_addr, ip->i_addr, ip->i_addr);
- log_err(_("The directory entry has %llu (0x%llx) but the inode has "
- "%llu (0x%llx)\n"), (unsigned long long)entry.no_formal_ino,
- (unsigned long long)entry.no_formal_ino,
- (unsigned long long)inum.no_formal_ino,
- (unsigned long long)inum.no_formal_ino);
+ tmp_name, entry.in_addr, entry.in_addr, ip->i_addr, ip->i_addr);
+ log_err(_("The directory entry has %"PRIu64" (0x%"PRIx64")
"
+ "but the inode has %"PRIu64" (0x%"PRIx64")\n"),
+ entry.in_formal_ino, entry.in_formal_ino,
+ inum.in_formal_ino, inum.in_formal_ino);
if (q != GFS2_BLKST_DINODE || !strcmp("..", tmp_name)) {
if (query( _("Remove the corrupt directory entry? (y/n) ")))
return 1;
@@ -221,21 +204,21 @@ static int bad_formal_ino(struct gfs2_inode *ip, struct gfs2_dirent
*dent,
/* We have a directory pointing to another directory, but the
formal inode number still doesn't match. If that directory
has a '..' pointing back, just fix up the no_formal_ino. */
- child_ip = lgfs2_inode_read(sdp, entry.no_addr);
+ child_ip = lgfs2_inode_read(sdp, entry.in_addr);
error = dir_search(child_ip, "..", 2, NULL, &childs_dotdot);
- if (!error && childs_dotdot.no_addr == ip->i_addr) {
+ if (!error && childs_dotdot.in_addr == ip->i_addr) {
log_err( _("The entry points to another directory with intact "
"linkage.\n"));
if (query( _("Fix the bad directory entry? (y/n) "))) {
- struct gfs2_inum no;
+ struct lgfs2_inum no;
log_err( _("Fixing the corrupt directory entry.\n"));
- entry.no_formal_ino = inum.no_formal_ino;
- de->de_inum.no_formal_ino = entry.no_formal_ino;
- gfs2_dirent_out(de, (char *)dent);
+ entry.in_formal_ino = inum.in_formal_ino;
+ d->dr_inum.in_formal_ino = entry.in_formal_ino;
+ lgfs2_dirent_out(d, dent);
bmodified(bh);
incr_link_count(entry, ip, _("fixed reference"));
- no.no_addr = ip->i_addr;
- no.no_formal_ino = ip->i_formal_ino;
+ no.in_addr = ip->i_addr;
+ no.in_formal_ino = ip->i_formal_ino;
set_parent_dir(sdp, entry, no);
} else {
log_err( _("Directory entry not fixed.\n"));
@@ -309,11 +292,11 @@ static int check_leaf_depth(struct gfs2_inode *ip, uint64_t
leaf_no,
* Returns: 1 if the dirent is to be removed, 0 if it needs to be kept,
* or -1 on error
*/
-static int wrong_leaf(struct gfs2_inode *ip, struct gfs2_inum *entry,
+static int wrong_leaf(struct gfs2_inode *ip, struct lgfs2_inum *entry,
const char *tmp_name, int *lindex, int lindex_max,
int hash_index, struct gfs2_buffer_head *bh,
struct dir_status *ds, struct gfs2_dirent *dent,
- struct gfs2_dirent *de, struct gfs2_dirent *prev_de,
+ struct lgfs2_dirent *d, struct gfs2_dirent *prev_de,
uint32_t *count, int q)
{
struct gfs2_sbd *sdp = ip->i_sbd;
@@ -323,10 +306,8 @@ static int wrong_leaf(struct gfs2_inode *ip, struct gfs2_inum
*entry,
uint64_t *tbl;
int di_depth;
- log_err(_("Directory entry '%s' at block %lld (0x%llx) is on the "
- "wrong leaf block.\n"), tmp_name,
- (unsigned long long)entry->no_addr,
- (unsigned long long)entry->no_addr);
+ log_err(_("Directory entry '%s' at block %"PRIu64"
(0x%"PRIx64") is on the wrong leaf block.\n"),
+ tmp_name, entry->in_addr, entry->in_addr);
log_err(_("Leaf index is: 0x%x. The range for this leaf block is "
"0x%x - 0x%x\n"), hash_index, *lindex, lindex_max);
if (!query( _("Move the misplaced directory entry to "
@@ -361,7 +342,7 @@ static int wrong_leaf(struct gfs2_inode *ip, struct gfs2_inum *entry,
free(tbl);
/* check if it's already on the correct leaf block */
- error = dir_search(ip, tmp_name, de->de_name_len, NULL, &de->de_inum);
+ error = dir_search(ip, tmp_name, d->dr_name_len, NULL, &d->dr_inum);
if (!error) {
log_err(_("The misplaced directory entry already appears on "
"the correct leaf block.\n"));
@@ -371,8 +352,7 @@ static int wrong_leaf(struct gfs2_inode *ip, struct gfs2_inum *entry,
}
di_depth = ip->i_depth;
- if (dir_add(ip, tmp_name, de->de_name_len, &de->de_inum,
- de->de_type) == 0) {
+ if (dir_add(ip, tmp_name, d->dr_name_len, &d->dr_inum, d->dr_type) == 0) {
log_err(_("The misplaced directory entry was moved to a "
"valid leaf block.\n"));
if (ip->i_depth > di_depth) {
@@ -406,12 +386,12 @@ static int wrong_leaf(struct gfs2_inode *ip, struct gfs2_inum
*entry,
leaf, but that leaf has already been processed. So we have
to nuke the dent from this leaf when we return, but we
still need to do the "good dent" accounting. */
- if (de->de_type == (sdp->gfs1 ? GFS_FILE_DIR : DT_DIR)) {
- struct gfs2_inum no = {
- .no_addr = ip->i_addr,
- .no_formal_ino = ip->i_formal_ino
+ if (d->dr_type == (sdp->gfs1 ? GFS_FILE_DIR : DT_DIR)) {
+ struct lgfs2_inum no = {
+ .in_addr = ip->i_addr,
+ .in_formal_ino = ip->i_formal_ino
};
- error = set_parent_dir(sdp, de->de_inum, no);
+ error = set_parent_dir(sdp, d->dr_inum, no);
if (error > 0)
/* This is a bit of a kludge, but returning 0
in this case causes the caller to go through
@@ -419,10 +399,9 @@ static int wrong_leaf(struct gfs2_inode *ip, struct gfs2_inum
*entry,
deal properly with the hard link. */
return 0;
}
- error = incr_link_count(*entry, ip,
- _("moved valid reference"));
+ error = incr_link_count(*entry, ip, _("moved valid reference"));
if (error > 0 &&
- bad_formal_ino(ip, dent, *entry, tmp_name, q, de, bh) == 1)
+ bad_formal_ino(ip, dent, *entry, tmp_name, q, d, bh) == 1)
return 1; /* nuke it */
/* You cannot do this:
@@ -451,8 +430,8 @@ static int wrong_leaf(struct gfs2_inode *ip, struct gfs2_inum *entry,
* Returns: 1 means corruption, nuke the dentry, 0 means checks pass
*/
static int basic_dentry_checks(struct gfs2_inode *ip, struct gfs2_dirent *dent,
- struct gfs2_inum *entry, const char *tmp_name,
- uint32_t *count, struct gfs2_dirent *de,
+ struct lgfs2_inum *entry, const char *tmp_name,
+ uint32_t *count, struct lgfs2_dirent *d,
struct dir_status *ds, int *q,
struct gfs2_buffer_head *bh, int *isdir)
{
@@ -462,10 +441,10 @@ static int basic_dentry_checks(struct gfs2_inode *ip, struct
gfs2_dirent *dent,
int error;
struct inode_info *ii;
struct dir_info *di = NULL;
- struct gfs2_inum inum = { 0 };
+ struct lgfs2_inum inum = {0};
*isdir = 0;
- if (!valid_block_ip(ip, entry->no_addr)) {
+ if (!valid_block_ip(ip, entry->in_addr)) {
log_err(_("Block # referenced by directory entry %s in inode %"PRIu64
" (0x%"PRIx64") is invalid\n"),
tmp_name, ip->i_addr, ip->i_addr);
@@ -481,11 +460,11 @@ static int basic_dentry_checks(struct gfs2_inode *ip, struct
gfs2_dirent *dent,
}
}
- if (de->de_rec_len < GFS2_DIRENT_SIZE(de->de_name_len) ||
- de->de_name_len > GFS2_FNAMESIZE) {
+ if (d->dr_rec_len < GFS2_DIRENT_SIZE(d->dr_name_len) ||
+ d->dr_name_len > GFS2_FNAMESIZE) {
log_err( _("Dir entry with bad record or name length\n"
"\tRecord length = %u\n\tName length = %u\n"),
- de->de_rec_len, de->de_name_len);
+ d->dr_rec_len, d->dr_name_len);
if (!query( _("Clear the directory entry? (y/n) "))) {
log_err( _("Directory entry not fixed.\n"));
return 0;
@@ -500,29 +479,29 @@ static int basic_dentry_checks(struct gfs2_inode *ip, struct
gfs2_dirent *dent,
return 1;
}
- calculated_hash = gfs2_disk_hash(tmp_name, de->de_name_len);
- if (de->de_hash != calculated_hash){
+ calculated_hash = gfs2_disk_hash(tmp_name, d->dr_name_len);
+ if (d->dr_hash != calculated_hash){
log_err( _("Dir entry with bad hash or name length\n"
"\tHash found = %u (0x%x)\n"
"\tFilename = %s\n"),
- de->de_hash, de->de_hash, tmp_name);
+ d->dr_hash, d->dr_hash, tmp_name);
log_err( _("\tName length found = %u\n"
"\tHash expected = %u (0x%x)\n"),
- de->de_name_len, calculated_hash, calculated_hash);
+ d->dr_name_len, calculated_hash, calculated_hash);
if (!query( _("Fix directory hash for %s? (y/n) "),
tmp_name)) {
log_err( _("Directory entry hash for %s not "
"fixed.\n"), tmp_name);
return 0;
}
- de->de_hash = calculated_hash;
- gfs2_dirent_out(de, (char *)dent);
+ d->dr_hash = calculated_hash;
+ lgfs2_dirent_out(d, dent);
bmodified(bh);
log_err( _("Directory entry hash for %s fixed.\n"),
tmp_name);
}
- *q = bitmap_type(sdp, entry->no_addr);
+ *q = bitmap_type(sdp, entry->in_addr);
/* Get the status of the directory inode */
/**
* 1. Blocks marked "invalid" were invalidated due to duplicate
@@ -539,7 +518,7 @@ static int basic_dentry_checks(struct gfs2_inode *ip, struct
gfs2_dirent *dent,
if (*q != GFS2_BLKST_DINODE) {
log_err(_("Directory entry '%s' referencing inode %"PRIu64"
(0x%"PRIx64") "
"in dir inode %"PRIu64" (0x%"PRIx64") block type %d:
%s.\n"),
- tmp_name, entry->no_addr, entry->no_addr, ip->i_addr, ip->i_addr,
+ tmp_name, entry->in_addr, entry->in_addr, ip->i_addr, ip->i_addr,
*q, *q == GFS2_BLKST_FREE ?
_("was previously marked invalid") :
_("was deleted or is not an inode"));
@@ -568,32 +547,30 @@ static int basic_dentry_checks(struct gfs2_inode *ip, struct
gfs2_dirent *dent,
return 1;
}
- error = check_file_type(entry->no_addr, de->de_type, *q, sdp->gfs1,
- isdir);
+ error = check_file_type(entry->in_addr, d->dr_type, *q, sdp->gfs1, isdir);
if (error < 0) {
log_err(_("Error: directory entry type is incompatible with block type at block
%"PRIu64
" (0x%"PRIx64") in directory inode %"PRIu64"
(0x%"PRIx64").\n"),
- entry->no_addr, entry->no_addr, ip->i_addr, ip->i_addr);
+ entry->in_addr, entry->in_addr, ip->i_addr, ip->i_addr);
log_err( _("Directory entry type is %d, block type is %d.\n"),
- de->de_type, *q);
+ d->dr_type, *q);
stack;
return -1;
}
if (error > 0) {
- log_err( _("Type '%s' in dir entry (%s, %llu/0x%llx) conflicts"
+ log_err( _("Type '%s' in dir entry (%s,
%"PRIu64"/0x%"PRIx64") conflicts"
" with type '%s' in dinode. (Dir entry is stale.)\n"),
- de_type_string(de->de_type), tmp_name,
- (unsigned long long)entry->no_addr,
- (unsigned long long)entry->no_addr,
+ de_type_string(d->dr_type), tmp_name,
+ entry->in_addr, entry->in_addr,
block_type_string(*q));
if (!query( _("Clear stale directory entry? (y/n) "))) {
log_err( _("Stale directory entry remains\n"));
return 0;
}
- if (ip->i_addr == entry->no_addr)
+ if (ip->i_addr == entry->in_addr)
entry_ip = ip;
else
- entry_ip = fsck_load_inode(sdp, entry->no_addr);
+ entry_ip = fsck_load_inode(sdp, entry->in_addr);
check_inode_eattr(entry_ip, &delete_eattrs);
if (entry_ip != ip)
fsck_inode_put(&entry_ip);
@@ -601,28 +578,28 @@ static int basic_dentry_checks(struct gfs2_inode *ip, struct
gfs2_dirent *dent,
}
/* We need to verify the formal inode number matches. If it doesn't,
it needs to be deleted. */
- ii = inodetree_find(entry->no_addr);
+ ii = inodetree_find(entry->in_addr);
if (ii)
- inum = ii->di_num;
+ inum = ii->num;
else {
- di = dirtree_find(entry->no_addr);
+ di = dirtree_find(entry->in_addr);
if (di)
inum = di->dinode;
- else if (link1_type(&nlink1map, entry->no_addr) == 1) {
+ else if (link1_type(&nlink1map, entry->in_addr) == 1) {
/* Since we don't have ii or di, the only way to
validate formal_ino is to read in the inode, which
would kill performance. So skip it for now. */
return 0;
}
}
- if (inum.no_formal_ino != entry->no_formal_ino) {
+ if (inum.in_formal_ino != entry->in_formal_ino) {
log_err(_("Directory entry '%s' pointing to block %"PRIu64"
(0x%"PRIx64") "
"in directory %"PRIu64" (0x%"PRIx64") has the wrong
'formal' inode number.\n"),
- tmp_name, entry->no_addr, entry->no_addr, ip->i_addr, ip->i_addr);
+ tmp_name, entry->in_addr, entry->in_addr, ip->i_addr, ip->i_addr);
log_err(_("The directory entry has %"PRIu64" (0x%"PRIx64") but
the "
"inode has %"PRIu64" (0x%"PRIx64")\n"),
- entry->no_formal_ino, entry->no_formal_ino,
- inum.no_formal_ino, inum.no_formal_ino);
+ entry->in_formal_ino, entry->in_formal_ino,
+ inum.in_formal_ino, inum.in_formal_ino);
return 1;
}
/* Check for a special case where a (bad) GFS1 dirent points to what
@@ -632,12 +609,12 @@ static int basic_dentry_checks(struct gfs2_inode *ip, struct
gfs2_dirent *dent,
if (ii == NULL && di == NULL && sdp->gfs1) {
struct gfs2_buffer_head *tbh;
- tbh = bread(sdp, entry->no_addr);
+ tbh = bread(sdp, entry->in_addr);
if (gfs2_check_meta(tbh->b_data, GFS2_METATYPE_DI)) { /* not dinode */
log_err(_("Directory entry '%s' pointing to block %"PRIu64
" (0x%"PRIx64") in directory %"PRIu64"
(0x%"PRIx64") "
"is not really a GFS1 dinode.\n"), tmp_name,
- entry->no_addr, entry->no_addr, ip->i_addr, ip->i_addr);
+ entry->in_addr, entry->in_addr, ip->i_addr, ip->i_addr);
brelse(tbh);
return 1;
}
@@ -653,42 +630,40 @@ static int dirref_find(struct gfs2_inode *ip, struct gfs2_dirent
*dent,
{
/* the metawalk_fxn's private field must be set to the dentry
* block we want to clear */
- struct gfs2_inum *entry = (struct gfs2_inum *)private;
- struct gfs2_dirent dentry, *de;
+ struct lgfs2_inum *entry = private;
+ struct lgfs2_dirent dentry, *de;
char fn[MAX_FILENAME];
- memset(&dentry, 0, sizeof(struct gfs2_dirent));
- gfs2_dirent_in(&dentry, (char *)dent);
+ memset(&dentry, 0, sizeof(dentry));
+ lgfs2_dirent_in(&dentry, dent);
de = &dentry;
- if (de->de_inum.no_addr != entry->no_addr) {
+ if (de->dr_inum.in_addr != entry->in_addr) {
(*count)++;
return 0;
}
- if (de->de_inum.no_formal_ino == dent->de_inum.no_formal_ino) {
+ if (de->dr_inum.in_formal_ino == be64_to_cpu(dent->de_inum.no_formal_ino)) {
log_debug("Formal inode number matches; must be a hard "
"link.\n");
goto out;
}
log_err(_("The original reference to inode %"PRIu64"
(0x%"PRIx64") from "
"directory %"PRIu64" (0x%"PRIx64") has the wrong
'formal' inode "
- "number.\n"), entry->no_addr, entry->no_addr, ip->i_addr,
ip->i_addr);
+ "number.\n"), entry->in_addr, entry->in_addr, ip->i_addr,
ip->i_addr);
memset(fn, 0, sizeof(fn));
- if (de->de_name_len < MAX_FILENAME)
- strncpy(fn, filename, de->de_name_len);
+ if (de->dr_name_len < MAX_FILENAME)
+ strncpy(fn, filename, de->dr_name_len);
else
strncpy(fn, filename, MAX_FILENAME - 1);
- log_err(_("The bad reference '%s' had formal inode number: %lld "
- "(0x%llx) but the correct value is: %lld (0x%llx)\n"),
- fn, (unsigned long long)de->de_inum.no_formal_ino,
- (unsigned long long)de->de_inum.no_formal_ino,
- (unsigned long long)entry->no_formal_ino,
- (unsigned long long)entry->no_formal_ino);
+ log_err(_("The bad reference '%s' had formal inode number: %"PRIu64
+ " (0x%"PRIx64") but the correct value is: %"PRIu64"
(0x%"PRIx64")\n"),
+ fn, de->dr_inum.in_formal_ino, de->dr_inum.in_formal_ino,
+ entry->in_formal_ino, entry->in_formal_ino);
if (!query(_("Delete the bad directory entry? (y/n) "))) {
log_err(_("The corrupt directory entry was not fixed.\n"));
goto out;
}
- decr_link_count(entry->no_addr, ip->i_addr, ip->i_sbd->gfs1,
+ decr_link_count(entry->in_addr, ip->i_addr, ip->i_sbd->gfs1,
_("bad original reference"));
dirent2_del(ip, bh, prev, dent);
log_err(_("The corrupt directory entry '%s' was deleted.\n"), fn);
@@ -713,7 +688,7 @@ out:
* dentry, since we failed to detect the problem earlier.
*/
static int check_suspicious_dirref(struct gfs2_sbd *sdp,
- struct gfs2_inum *entry)
+ struct lgfs2_inum *entry)
{
struct osi_node *tmp, *next = NULL;
struct dir_info *dt;
@@ -721,17 +696,17 @@ static int check_suspicious_dirref(struct gfs2_sbd *sdp,
uint64_t dirblk;
int error = FSCK_OK;
struct metawalk_fxns dirref_hunt = {
- .private = (void *)entry,
+ .private = entry,
.check_dentry = dirref_find,
};
log_debug("This dentry is good, but since this is a second "
- "reference to block 0x%llx, we need to check the "
- "original.\n", (unsigned long long)entry->no_addr);
+ "reference to block 0x%"PRIx64", we need to check the "
+ "original.\n", entry->in_addr);
for (tmp = osi_first(&dirtree); tmp; tmp = next) {
next = osi_next(tmp);
dt = (struct dir_info *)tmp;
- dirblk = dt->dinode.no_addr;
+ dirblk = dt->dinode.in_addr;
if (skip_this_pass || fsck_abort) /* asked to skip the rest */
break;
ip = fsck_load_inode(sdp, dirblk);
@@ -760,30 +735,28 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent
*dent,
struct gfs2_sbd *sdp = ip->i_sbd;
int q = 0;
char tmp_name[MAX_FILENAME];
- struct gfs2_inum entry, no;
+ struct lgfs2_inum entry, no;
struct dir_status *ds = (struct dir_status *) priv;
int error;
struct gfs2_inode *entry_ip = NULL;
- struct gfs2_dirent dentry, *de;
+ struct lgfs2_dirent d;
int hash_index; /* index into the hash table based on the hash */
int lindex_max; /* largest acceptable hash table index for hash */
int isdir;
- memset(&dentry, 0, sizeof(struct gfs2_dirent));
- gfs2_dirent_in(&dentry, (char *)dent);
- de = &dentry;
+ lgfs2_dirent_in(&d, dent);
- entry.no_addr = de->de_inum.no_addr;
- entry.no_formal_ino = de->de_inum.no_formal_ino;
+ entry.in_addr = d.dr_inum.in_addr;
+ entry.in_formal_ino = d.dr_inum.in_formal_ino;
/* Start of checks */
memset(tmp_name, 0, MAX_FILENAME);
- if (de->de_name_len < MAX_FILENAME)
- strncpy(tmp_name, filename, de->de_name_len);
+ if (d.dr_name_len < MAX_FILENAME)
+ strncpy(tmp_name, filename, d.dr_name_len);
else
strncpy(tmp_name, filename, MAX_FILENAME - 1);
- error = basic_dentry_checks(ip, dent, &entry, tmp_name, count, de,
+ error = basic_dentry_checks(ip, dent, &entry, tmp_name, count, &d,
ds, &q, bh, &isdir);
if (error)
goto nuke_dentry;
@@ -801,10 +774,10 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent
*dent,
* and check the rest of the '.' entry? */
goto dentry_is_valid;
}
- if (ip->i_addr == entry.no_addr)
+ if (ip->i_addr == entry.in_addr)
entry_ip = ip;
else
- entry_ip = fsck_load_inode(sdp, entry.no_addr);
+ entry_ip = fsck_load_inode(sdp, entry.in_addr);
check_inode_eattr(entry_ip, &delete_eattrs);
if (entry_ip != ip)
fsck_inode_put(&entry_ip);
@@ -815,11 +788,11 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent
*dent,
* location */
/* check that '.' refers to this inode */
- if (entry.no_addr != ip->i_addr) {
+ if (entry.in_addr != ip->i_addr) {
log_err(_("'.' entry's value incorrect in directory
%"PRIu64" (0x%"PRIx64")."
" Points to %"PRIu64" (0x%"PRIx64") when it should
point to %"PRIu64
" (0x%"PRIx64").\n"),
- entry.no_addr, entry.no_addr, entry.no_addr, entry.no_addr,
+ entry.in_addr, entry.in_addr, entry.in_addr, entry.in_addr,
ip->i_addr, ip->i_addr);
if (!query( _("Remove '.' reference? (y/n) "))) {
log_err( _("Invalid '.' reference remains\n"));
@@ -827,10 +800,10 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent
*dent,
* this '.' entry is invalid */
goto dentry_is_valid;
}
- if (ip->i_addr == entry.no_addr)
+ if (ip->i_addr == entry.in_addr)
entry_ip = ip;
else
- entry_ip = fsck_load_inode(sdp, entry.no_addr);
+ entry_ip = fsck_load_inode(sdp, entry.in_addr);
check_inode_eattr(entry_ip, &delete_eattrs);
if (entry_ip != ip)
fsck_inode_put(&entry_ip);
@@ -854,10 +827,10 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent
*dent,
goto dentry_is_valid;
}
- if (ip->i_addr == entry.no_addr)
+ if (ip->i_addr == entry.in_addr)
entry_ip = ip;
else
- entry_ip = fsck_load_inode(sdp, entry.no_addr);
+ entry_ip = fsck_load_inode(sdp, entry.in_addr);
check_inode_eattr(entry_ip, &delete_eattrs);
if (entry_ip != ip)
fsck_inode_put(&entry_ip);
@@ -872,10 +845,10 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent
*dent,
log_err( _("Bad '..' directory entry remains\n"));
goto dentry_is_valid;
}
- if (ip->i_addr == entry.no_addr)
+ if (ip->i_addr == entry.in_addr)
entry_ip = ip;
else
- entry_ip = fsck_load_inode(sdp, entry.no_addr);
+ entry_ip = fsck_load_inode(sdp, entry.in_addr);
check_inode_eattr(entry_ip, &delete_eattrs);
if (entry_ip != ip)
fsck_inode_put(&entry_ip);
@@ -898,14 +871,14 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent
*dent,
/* If this is an exhash directory, make sure the dentries in the leaf
block have a hash table index that fits */
if (ip->i_flags & GFS2_DIF_EXHASH) {
- hash_index = hash_table_index(de->de_hash, ip);
+ hash_index = hash_table_index(d.dr_hash, ip);
lindex_max = hash_table_max(*lindex, ip, bh);
if (hash_index < *lindex || hash_index > lindex_max) {
int nuke_dent;
nuke_dent = wrong_leaf(ip, &entry, tmp_name, lindex,
lindex_max, hash_index, bh, ds,
- dent, de, prev_de, count, q);
+ dent, &d, prev_de, count, q);
if (nuke_dent)
goto nuke_dentry;
}
@@ -913,22 +886,18 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent
*dent,
/* After this point we're only concerned with directories */
if (!isdir) {
- log_debug( _("Found non-dir inode dentry pointing to %lld "
- "(0x%llx)\n"),
- (unsigned long long)entry.no_addr,
- (unsigned long long)entry.no_addr);
+ log_debug(_("Found non-dir inode dentry pointing to %"PRIu64"
(0x%"PRIx64")\n"),
+ entry.in_addr, entry.in_addr);
goto dentry_is_valid;
}
/*log_debug( _("Found plain directory dentry\n"));*/
- no.no_addr = ip->i_addr;
- no.no_formal_ino = ip->i_formal_ino;
+ no.in_addr = ip->i_addr;
+ no.in_formal_ino = ip->i_formal_ino;
error = set_parent_dir(sdp, entry, no);
if (error > 0) {
- log_err( _("%s: Hard link to block %llu (0x%llx"
- ") detected.\n"), tmp_name,
- (unsigned long long)entry.no_addr,
- (unsigned long long)entry.no_addr);
+ log_err(_("%s: Hard link to block %"PRIu64" (0x%"PRIx64")
detected.\n"),
+ tmp_name, entry.in_addr, entry.in_addr);
if (query( _("Clear hard link to directory? (y/n) ")))
goto nuke_dentry;
@@ -947,7 +916,7 @@ dentry_is_valid:
error = check_suspicious_dirref(sdp, &entry);
} else if (error == INCR_LINK_INO_MISMATCH) {
log_err("incr_link_count err=%d.\n", error);
- if (bad_formal_ino(ip, dent, entry, tmp_name, q, de, bh) == 1)
+ if (bad_formal_ino(ip, dent, entry, tmp_name, q, &d, bh) == 1)
goto nuke_dentry;
}
(*count)++;
@@ -1120,7 +1089,8 @@ static int lost_leaf(struct gfs2_inode *ip, uint64_t *tbl, uint64_t
leafno,
{
char *filename;
char *bh_end = bh->b_data + ip->i_sbd->sd_bsize;
- struct gfs2_dirent de, *dent;
+ struct gfs2_dirent *dent;
+ struct lgfs2_dirent de;
int error;
int isdir = 0;
@@ -1138,28 +1108,28 @@ static int lost_leaf(struct gfs2_inode *ip, uint64_t *tbl,
uint64_t leafno,
char tmp_name[PATH_MAX];
memset(&de, 0, sizeof(struct gfs2_dirent));
- gfs2_dirent_in(&de, (char *)dent);
+ lgfs2_dirent_in(&de, dent);
filename = (char *)dent + sizeof(struct gfs2_dirent);
memset(tmp_name, 0, sizeof(tmp_name));
- if (de.de_name_len > sizeof(filename)) {
+ if (de.dr_name_len > sizeof(filename)) {
log_debug(_("Encountered bad filename length; "
"stopped processing.\n"));
break;
}
- memcpy(tmp_name, filename, de.de_name_len);
- if ((de.de_name_len == 1 && filename[0] == '.')) {
+ memcpy(tmp_name, filename, de.dr_name_len);
+ if ((de.dr_name_len == 1 && filename[0] == '.')) {
log_debug(_("Skipping entry '.'\n"));
- } else if (de.de_name_len == 2 && filename[0] == '.' &&
+ } else if (de.dr_name_len == 2 && filename[0] == '.' &&
filename[1] == '.') {
log_debug(_("Skipping entry '..'\n"));
- } else if (!de.de_inum.no_formal_ino) { /* sentinel */
+ } else if (!de.dr_inum.in_formal_ino) { /* sentinel */
log_debug(_("Skipping sentinel '%s'\n"), tmp_name);
} else {
uint32_t count;
struct dir_status ds = {0};
int q = 0;
- error = basic_dentry_checks(ip, dent, &de.de_inum,
+ error = basic_dentry_checks(ip, dent, &de.dr_inum,
tmp_name, &count, &de,
&ds, &q, bh, &isdir);
if (error) {
@@ -1168,8 +1138,8 @@ static int lost_leaf(struct gfs2_inode *ip, uint64_t *tbl, uint64_t
leafno,
} else {
error = dir_add(lf_dip, filename,
- de.de_name_len, &de.de_inum,
- de.de_type);
+ de.dr_name_len, &de.dr_inum,
+ de.dr_type);
if (error && error != -EEXIST) {
log_err(_("Error %d encountered while "
"trying to relocate \"%s\" "
@@ -1178,27 +1148,24 @@ static int lost_leaf(struct gfs2_inode *ip, uint64_t *tbl,
uint64_t leafno,
return error;
}
/* This inode is linked from lost+found */
- incr_link_count(de.de_inum, lf_dip,
+ incr_link_count(de.dr_inum, lf_dip,
_("from lost+found"));
/* If it's a directory, lost+found is
back-linked to it via .. */
if (isdir) {
- struct gfs2_inum no = {
- .no_addr = lf_dip->i_addr,
- .no_formal_ino = lf_dip->i_formal_ino
+ struct lgfs2_inum no = {
+ .in_addr = lf_dip->i_addr,
+ .in_formal_ino = lf_dip->i_formal_ino
};
incr_link_count(no, NULL, _("to lost+found"));
}
- log_err(_("Relocated \"%s\", block %llu "
- "(0x%llx) to lost+found.\n"),
- tmp_name,
- (unsigned long long)de.de_inum.no_addr,
- (unsigned long long)de.de_inum.no_addr);
+ log_err(_("Relocated \"%s\", block %"PRIu64"
(0x%"PRIx64") to lost+found.\n"),
+ tmp_name, de.dr_inum.in_addr, de.dr_inum.in_addr);
}
}
- if ((char *)dent + de.de_rec_len >= bh_end)
+ if ((char *)dent + de.dr_rec_len >= bh_end)
break;
- dent = (struct gfs2_dirent *)((char *)dent + de.de_rec_len);
+ dent = (struct gfs2_dirent *)((char *)dent + de.dr_rec_len);
}
log_err(_("Directory entries from misplaced leaf block were relocated "
"to lost+found.\n"));
@@ -1221,23 +1188,23 @@ static int basic_check_dentry(struct gfs2_inode *ip, struct
gfs2_dirent *dent,
{
int q = 0;
char tmp_name[MAX_FILENAME];
- struct gfs2_inum entry;
+ struct lgfs2_inum entry;
struct dir_status *ds = (struct dir_status *) priv;
- struct gfs2_dirent dentry, *de;
+ struct lgfs2_dirent dentry, *de;
int error;
int isdir;
memset(&dentry, 0, sizeof(struct gfs2_dirent));
- gfs2_dirent_in(&dentry, (char *)dent);
+ lgfs2_dirent_in(&dentry, dent);
de = &dentry;
- entry.no_addr = de->de_inum.no_addr;
- entry.no_formal_ino = de->de_inum.no_formal_ino;
+ entry.in_addr = de->dr_inum.in_addr;
+ entry.in_formal_ino = de->dr_inum.in_formal_ino;
/* Start of checks */
memset(tmp_name, 0, MAX_FILENAME);
- if (de->de_name_len < MAX_FILENAME)
- strncpy(tmp_name, filename, de->de_name_len);
+ if (de->dr_name_len < MAX_FILENAME)
+ strncpy(tmp_name, filename, de->dr_name_len);
else
strncpy(tmp_name, filename, MAX_FILENAME - 1);
@@ -1342,8 +1309,9 @@ static int fix_hashtable(struct gfs2_inode *ip, uint64_t *tbl,
unsigned hsize,
int len, int *proper_len, int factor)
{
struct gfs2_buffer_head *lbh;
+ struct lgfs2_dirent dentry;
struct gfs2_leaf leaf;
- struct gfs2_dirent dentry, *de;
+ struct gfs2_dirent *de;
int changes = 0, error, i, extras, hash_index;
uint64_t new_leaf_blk;
uint64_t leaf_no;
@@ -1379,12 +1347,11 @@ static int fix_hashtable(struct gfs2_inode *ip, uint64_t *tbl,
unsigned hsize,
memset(&dentry, 0, sizeof(struct gfs2_dirent));
de = (struct gfs2_dirent *)(lbh->b_data + sizeof(struct gfs2_leaf));
- gfs2_dirent_in(&dentry, (char *)de);
+ lgfs2_dirent_in(&dentry, de);
/* If this is an empty leaf, we can just delete it and pad. */
- if ((dentry.de_rec_len == cpu_to_be16(ip->i_sbd->sd_bsize -
- sizeof(struct gfs2_leaf))) &&
- (dentry.de_inum.no_formal_ino == 0)) {
+ if ((dentry.dr_rec_len == ip->i_sbd->sd_bsize - sizeof(struct gfs2_leaf))
&&
+ (dentry.dr_inum.in_formal_ino == 0)) {
brelse(lbh);
gfs2_free_block(ip->i_sbd, leafblk);
log_err(_("Out of place leaf block %llu (0x%llx) had no "
@@ -1401,7 +1368,7 @@ static int fix_hashtable(struct gfs2_inode *ip, uint64_t *tbl,
unsigned hsize,
/* Look at the first dirent and check its hash value to see if it's
at the proper starting offset. */
- hash_index = hash_table_index(dentry.de_hash, ip);
+ hash_index = hash_table_index(dentry.dr_hash, ip);
/* Need to use len here, not *proper_len because the leaf block may
be valid within the range, but starts too soon in the hash table. */
if (hash_index < lindex || hash_index > lindex + len) {
@@ -1523,7 +1490,8 @@ static int check_hash_tbl_dups(struct gfs2_inode *ip, uint64_t
*tbl,
uint64_t leafblk, leaf_no;
struct gfs2_buffer_head *lbh;
struct gfs2_leaf leaf;
- struct gfs2_dirent dentry, *de;
+ struct lgfs2_dirent dentry;
+ struct gfs2_dirent *de;
int hash_index; /* index into the hash table based on the hash */
leafblk = be64_to_cpu(tbl[lindex]);
@@ -1561,10 +1529,9 @@ static int check_hash_tbl_dups(struct gfs2_inode *ip, uint64_t
*tbl,
}
memset(&dentry, 0, sizeof(struct gfs2_dirent));
- de = (struct gfs2_dirent *)(lbh->b_data +
- sizeof(struct gfs2_leaf));
- gfs2_dirent_in(&dentry, (char *)de);
- hash_index = hash_table_index(dentry.de_hash, ip);
+ de = (struct gfs2_dirent *)(lbh->b_data + sizeof(struct gfs2_leaf));
+ lgfs2_dirent_in(&dentry, de);
+ hash_index = hash_table_index(dentry.dr_hash, ip);
brelse(lbh);
/* check the duplicate ref first */
if (hash_index < l || hash_index > l + len2) {
@@ -1983,9 +1950,9 @@ static int check_system_dir(struct gfs2_inode *sysinode, const char
*dirname,
if (!ds.dotdir) {
log_err( _("No '.' entry found for %s directory.\n"), dirname);
if (query( _("Is it okay to add '.' entry? (y/n) "))) {
- struct gfs2_inum no = {
- .no_addr = sysinode->i_addr,
- .no_formal_ino = sysinode->i_formal_ino
+ struct lgfs2_inum no = {
+ .in_addr = sysinode->i_addr,
+ .in_formal_ino = sysinode->i_formal_ino
};
log_warn( _("Adding '.' entry\n"));
error = dir_add(sysinode, ".", 1, &no,
@@ -2108,9 +2075,9 @@ static int pass2_check_dir(struct gfs2_sbd *sdp, struct gfs2_inode
*ip)
(unsigned long long)dirblk, (unsigned long long)dirblk);
if (query( _("Is it okay to add '.' entry? (y/n) "))) {
- struct gfs2_inum no = {
- .no_addr = ip->i_addr,
- .no_formal_ino = ip->i_formal_ino
+ struct lgfs2_inum no = {
+ .in_addr = ip->i_addr,
+ .in_formal_ino = ip->i_formal_ino
};
error = dir_add(ip, ".", 1, &no,
(sdp->gfs1 ? GFS_FILE_DIR : DT_DIR));
@@ -2194,7 +2161,7 @@ int pass2(struct gfs2_sbd *sdp)
next = osi_next(tmp);
dt = (struct dir_info *)tmp;
- dirblk = dt->dinode.no_addr;
+ dirblk = dt->dinode.in_addr;
warm_fuzzy_stuff(dirblk);
if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
return FSCK_OK;
diff --git a/gfs2/fsck/pass3.c b/gfs2/fsck/pass3.c
index 8b8b19bc..f96881f5 100644
--- a/gfs2/fsck/pass3.c
+++ b/gfs2/fsck/pass3.c
@@ -25,7 +25,7 @@ static int attach_dotdot_to(struct gfs2_sbd *sdp, uint64_t newdotdot,
int filename_len = 2;
int err;
struct gfs2_inode *ip, *pip;
- struct gfs2_inum no;
+ struct lgfs2_inum no;
ip = fsck_load_inode(sdp, block);
pip = fsck_load_inode(sdp, newdotdot);
@@ -40,8 +40,8 @@ static int attach_dotdot_to(struct gfs2_sbd *sdp, uint64_t newdotdot,
log_warn( _("Unable to remove \"..\" directory entry.\n"));
else
decr_link_count(olddotdot, block, sdp->gfs1, _("old \"..\""));
- no.no_addr = pip->i_addr;
- no.no_formal_ino = pip->i_formal_ino;
+ no.in_addr = pip->i_addr;
+ no.in_formal_ino = pip->i_formal_ino;
err = dir_add(ip, filename, filename_len, &no,
(sdp->gfs1 ? GFS_FILE_DIR : DT_DIR));
if (err) {
@@ -68,29 +68,23 @@ static struct dir_info *mark_and_return_parent(struct gfs2_sbd *sdp,
if (!di->treewalk_parent)
return NULL;
- if (di->dotdot_parent.no_addr == di->treewalk_parent) {
- q_dotdot = bitmap_type(sdp, di->dotdot_parent.no_addr);
+ if (di->dotdot_parent.in_addr == di->treewalk_parent) {
+ q_dotdot = bitmap_type(sdp, di->dotdot_parent.in_addr);
if (q_dotdot != GFS2_BLKST_DINODE) {
- log_err( _("Orphaned directory at block %llu (0x%llx) "
- "moved to lost+found\n"),
- (unsigned long long)di->dinode.no_addr,
- (unsigned long long)di->dinode.no_addr);
+ log_err(_("Orphaned directory at block %"PRIu64"
(0x%"PRIx64") "
+ "moved to lost+found\n"),
+ di->dinode.in_addr, di->dinode.in_addr);
return NULL;
}
goto out;
}
- log_warn( _("Directory '..' and treewalk connections disagree for "
- "inode %llu (0x%llx)\n"),
- (unsigned long long)di->dinode.no_addr,
- (unsigned long long)di->dinode.no_addr);
- log_notice( _("'..' has %llu (0x%llx), treewalk has %llu
(0x%llx)\n"),
- (unsigned long long)di->dotdot_parent.no_addr,
- (unsigned long long)di->dotdot_parent.no_addr,
- (unsigned long long)di->treewalk_parent,
- (unsigned long long)di->treewalk_parent);
- q_dotdot = bitmap_type(sdp, di->dotdot_parent.no_addr);
- dt_dotdot = dirtree_find(di->dotdot_parent.no_addr);
+ log_warn(_("Directory '..' and treewalk connections disagree for inode
%"PRIu64" (0x%"PRIx64")\n"),
+ di->dinode.in_addr, di->dinode.in_addr);
+ log_notice(_("'..' has %"PRIu64" (0x%"PRIx64"),
treewalk has %"PRIu64" (0x%"PRIx64")\n"),
+ di->dotdot_parent.in_addr, di->dotdot_parent.in_addr,
di->treewalk_parent, di->treewalk_parent);
+ q_dotdot = bitmap_type(sdp, di->dotdot_parent.in_addr);
+ dt_dotdot = dirtree_find(di->dotdot_parent.in_addr);
q_treewalk = bitmap_type(sdp, di->treewalk_parent);
dt_treewalk = dirtree_find(di->treewalk_parent);
/* if the dotdot entry isn't a directory, but the
@@ -111,9 +105,9 @@ static struct dir_info *mark_and_return_parent(struct gfs2_sbd *sdp,
(unsigned long long)di->treewalk_parent,
(unsigned long long)di->treewalk_parent);
attach_dotdot_to(sdp, di->treewalk_parent,
- di->dotdot_parent.no_addr,
- di->dinode.no_addr);
- di->dotdot_parent.no_addr = di->treewalk_parent;
+ di->dotdot_parent.in_addr,
+ di->dinode.in_addr);
+ di->dotdot_parent.in_addr = di->treewalk_parent;
}
goto out;
}
@@ -121,9 +115,9 @@ static struct dir_info *mark_and_return_parent(struct gfs2_sbd *sdp,
log_err( _("Both .. and treewalk parents are directories, "
"going with treewalk...\n"));
attach_dotdot_to(sdp, di->treewalk_parent,
- di->dotdot_parent.no_addr,
- di->dinode.no_addr);
- di->dotdot_parent.no_addr = di->treewalk_parent;
+ di->dotdot_parent.in_addr,
+ di->dinode.in_addr);
+ di->dotdot_parent.in_addr = di->treewalk_parent;
goto out;
}
log_warn( _(".. parent is valid, but treewalk is bad - reattaching to "
@@ -131,35 +125,30 @@ static struct dir_info *mark_and_return_parent(struct gfs2_sbd
*sdp,
/* FIXME: add a dinode for this entry instead? */
- if (!query( _("Remove directory entry for bad inode %llu (0x%llx) in "
- "%llu (0x%llx)? (y/n)"),
- (unsigned long long)di->dinode.no_addr,
- (unsigned long long)di->dinode.no_addr,
- (unsigned long long)di->treewalk_parent,
- (unsigned long long)di->treewalk_parent)) {
+ if (!query(_("Remove directory entry for bad inode %"PRIu64"
(0x%"PRIx64") "
+ "in %"PRIu64" (0x%"PRIx64")? (y/n)"),
+ di->dinode.in_addr, di->dinode.in_addr,
+ di->treewalk_parent, di->treewalk_parent)) {
log_err( _("Directory entry to invalid inode remains\n"));
return NULL;
}
- error = remove_dentry_from_dir(sdp, di->treewalk_parent,
- di->dinode.no_addr);
+ error = remove_dentry_from_dir(sdp, di->treewalk_parent, di->dinode.in_addr);
if (error < 0) {
stack;
return NULL;
}
if (error > 0)
- log_warn( _("Unable to find dentry for block %llu"
- " (0x%llx) in %llu (0x%llx)\n"),
- (unsigned long long)di->dinode.no_addr,
- (unsigned long long)di->dinode.no_addr,
- (unsigned long long)di->treewalk_parent,
- (unsigned long long)di->treewalk_parent);
+ log_warn(_("Unable to find dentry for block %"PRIu64"
(0x%"PRIx64") "
+ "in %"PRIu64" (0x%"PRIx64")\n"),
+ di->dinode.in_addr, di->dinode.in_addr,
+ di->treewalk_parent, di->treewalk_parent);
log_warn( _("Directory entry removed\n"));
log_info( _("Marking directory unlinked\n"));
return NULL;
out:
- pdi = dirtree_find(di->dotdot_parent.no_addr);
+ pdi = dirtree_find(di->dotdot_parent.in_addr);
return pdi;
}
@@ -233,31 +222,26 @@ int pass3(struct gfs2_sbd *sdp)
tdi = mark_and_return_parent(sdp, di);
if (tdi) {
- log_debug( _("Directory at block %llu "
- "(0x%llx) connected\n"),
- (unsigned long long)di->dinode.no_addr,
- (unsigned long long)di->dinode.no_addr);
+ log_debug(_("Directory at block %"PRIu64" (0x%"PRIx64")
connected\n"),
+ di->dinode.in_addr, di->dinode.in_addr);
di = tdi;
continue;
}
- q = bitmap_type(sdp, di->dinode.no_addr);
- ip = fsck_load_inode(sdp, di->dinode.no_addr);
+ q = bitmap_type(sdp, di->dinode.in_addr);
+ ip = fsck_load_inode(sdp, di->dinode.in_addr);
if (q == GFS2_BLKST_FREE) {
log_err( _("Found unlinked directory "
- "containing bad block at block %llu"
- " (0x%llx)\n"),
- (unsigned long long)di->dinode.no_addr,
- (unsigned long long)di->dinode.no_addr);
+ "containing bad block at block %"PRIu64
+ " (0x%"PRIx64")\n"),
+ di->dinode.in_addr, di->dinode.in_addr);
if (query(_("Clear unlinked directory "
"with bad blocks? (y/n) "))) {
- log_warn( _("inode %lld (0x%llx) is "
- "now marked as free\n"),
- (unsigned long long)
- di->dinode.no_addr,
- (unsigned long long)
- di->dinode.no_addr);
+ log_warn(_("inode %"PRIu64" (0x%"PRIx64") is "
+ "now marked as free\n"),
+ di->dinode.in_addr,
+ di->dinode.in_addr);
check_n_fix_bitmap(sdp, ip->i_rgd,
- di->dinode.no_addr,
+ di->dinode.in_addr,
0, GFS2_BLKST_FREE);
fsck_inode_put(&ip);
break;
@@ -274,29 +258,26 @@ int pass3(struct gfs2_sbd *sdp)
fsck_inode_put(&ip);
break;
}
- log_warn( _("inode %lld (0x%llx) is now "
+ log_warn( _("inode %"PRIu64" (0x%"PRIx64") is now "
"marked as free\n"),
- (unsigned long long)di->dinode.no_addr,
- (unsigned long long)di->dinode.no_addr);
+ di->dinode.in_addr, di->dinode.in_addr);
check_n_fix_bitmap(sdp, ip->i_rgd,
- di->dinode.no_addr, 0,
+ di->dinode.in_addr, 0,
GFS2_BLKST_FREE);
log_err( _("The block was cleared\n"));
fsck_inode_put(&ip);
break;
}
- log_err( _("Found unlinked directory at block %llu"
- " (0x%llx)\n"),
- (unsigned long long)di->dinode.no_addr,
- (unsigned long long)di->dinode.no_addr);
+ log_err(_("Found unlinked directory at block %"PRIu64"
(0x%"PRIx64")\n"),
+ di->dinode.in_addr, di->dinode.in_addr);
/* Don't skip zero size directories with eattrs */
if (!ip->i_size && !ip->i_eattr){
log_err( _("Unlinked directory has zero "
"size.\n"));
if (query( _("Remove zero-size unlinked "
"directory? (y/n) "))) {
- fsck_bitmap_set(ip, di->dinode.no_addr,
+ fsck_bitmap_set(ip, di->dinode.in_addr,
_("zero-sized unlinked inode"),
GFS2_BLKST_FREE);
fsck_inode_put(&ip);
diff --git a/gfs2/fsck/pass4.c b/gfs2/fsck/pass4.c
index 42892da1..4deac26c 100644
--- a/gfs2/fsck/pass4.c
+++ b/gfs2/fsck/pass4.c
@@ -186,22 +186,22 @@ static int scan_inode_list(struct gfs2_sbd *sdp)
ii = (struct inode_info *)tmp;
/* Don't check reference counts on the special gfs files */
if (sdp->gfs1 &&
- ((ii->di_num.no_addr == sdp->md.riinode->i_addr) ||
- (ii->di_num.no_addr == sdp->md.qinode->i_addr) ||
- (ii->di_num.no_addr == sdp->md.statfs->i_addr)))
+ ((ii->num.in_addr == sdp->md.riinode->i_addr) ||
+ (ii->num.in_addr == sdp->md.qinode->i_addr) ||
+ (ii->num.in_addr == sdp->md.statfs->i_addr)))
continue;
if (ii->counted_links == 0) {
- if (handle_unlinked(sdp, ii->di_num.no_addr,
+ if (handle_unlinked(sdp, ii->num.in_addr,
&ii->counted_links, &lf_addition))
continue;
} /* if (ii->counted_links == 0) */
else if (ii->di_nlink != ii->counted_links) {
- handle_inconsist(sdp, ii->di_num.no_addr,
+ handle_inconsist(sdp, ii->num.in_addr,
&ii->di_nlink, ii->counted_links);
}
log_debug( _("block %llu (0x%llx) has link count %d\n"),
- (unsigned long long)ii->di_num.no_addr,
- (unsigned long long)ii->di_num.no_addr, ii->di_nlink);
+ (unsigned long long)ii->num.in_addr,
+ (unsigned long long)ii->num.in_addr, ii->di_nlink);
} /* osi_list_foreach(tmp, list) */
return adjust_lf_links(lf_addition);
@@ -222,19 +222,18 @@ static int scan_dir_list(struct gfs2_sbd *sdp)
di = (struct dir_info *)tmp;
/* Don't check reference counts on the special gfs files */
if (sdp->gfs1 &&
- di->dinode.no_addr == sdp->md.jiinode->i_addr)
+ di->dinode.in_addr == sdp->md.jiinode->i_addr)
continue;
if (di->counted_links == 0) {
- if (handle_unlinked(sdp, di->dinode.no_addr,
+ if (handle_unlinked(sdp, di->dinode.in_addr,
&di->counted_links, &lf_addition))
continue;
} else if (di->di_nlink != di->counted_links) {
- handle_inconsist(sdp, di->dinode.no_addr,
+ handle_inconsist(sdp, di->dinode.in_addr,
&di->di_nlink, di->counted_links);
}
- log_debug( _("block %llu (0x%llx) has link count %d\n"),
- (unsigned long long)di->dinode.no_addr,
- (unsigned long long)di->dinode.no_addr, di->di_nlink);
+ log_debug(_("block %"PRIu64" (0x%"PRIx64") has link count
%d\n"),
+ di->dinode.in_addr, di->dinode.in_addr, di->di_nlink);
} /* osi_list_foreach(tmp, list) */
return adjust_lf_links(lf_addition);
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c
index 962ec1e0..29b3ce81 100644
--- a/gfs2/fsck/util.c
+++ b/gfs2/fsck/util.c
@@ -427,7 +427,7 @@ int add_duplicate_ref(struct gfs2_inode *ip, uint64_t block,
return META_IS_GOOD;
}
-struct dir_info *dirtree_insert(struct gfs2_inum inum)
+struct dir_info *dirtree_insert(struct lgfs2_inum inum)
{
struct osi_node **newn = &dirtree.osi_node, *parent = NULL;
struct dir_info *data;
@@ -437,9 +437,9 @@ struct dir_info *dirtree_insert(struct gfs2_inum inum)
struct dir_info *cur = (struct dir_info *)*newn;
parent = *newn;
- if (inum.no_addr < cur->dinode.no_addr)
+ if (inum.in_addr < cur->dinode.in_addr)
newn = &((*newn)->osi_left);
- else if (inum.no_addr > cur->dinode.no_addr)
+ else if (inum.in_addr > cur->dinode.in_addr)
newn = &((*newn)->osi_right);
else
return cur;
@@ -451,8 +451,8 @@ struct dir_info *dirtree_insert(struct gfs2_inum inum)
return NULL;
}
/* Add new node and rebalance tree. */
- data->dinode.no_addr = inum.no_addr;
- data->dinode.no_formal_ino = inum.no_formal_ino;
+ data->dinode.in_addr = inum.in_addr;
+ data->dinode.in_formal_ino = inum.in_formal_ino;
osi_link_node(&data->node, parent, newn);
osi_insert_color(&data->node, &dirtree);
@@ -466,9 +466,9 @@ struct dir_info *dirtree_find(uint64_t block)
while (node) {
struct dir_info *data = (struct dir_info *)node;
- if (block < data->dinode.no_addr)
+ if (block < data->dinode.in_addr)
node = node->osi_left;
- else if (block > data->dinode.no_addr)
+ else if (block > data->dinode.in_addr)
node = node->osi_right;
else
return data;
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index f7205393..4cc9b275 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -1135,7 +1135,7 @@ static int get_next_leaf(struct gfs2_inode *dip,struct
gfs2_buffer_head *bh_in,
}
static int dir_e_add(struct gfs2_inode *dip, const char *filename, int len,
- struct gfs2_inum *inum, unsigned int type)
+ struct lgfs2_inum *inum, unsigned int type)
{
struct gfs2_buffer_head *bh, *nbh;
struct gfs2_leaf *leaf, *nleaf;
@@ -1211,7 +1211,7 @@ restart:
}
}
- gfs2_inum_out(inum, (char *)&dent->de_inum);
+ lgfs2_inum_out(inum, &dent->de_inum);
dent->de_hash = cpu_to_be32(hash);
dent->de_type = cpu_to_be16(type);
memcpy((char *)(dent + 1), filename, len);
@@ -1292,7 +1292,7 @@ static void dir_make_exhash(struct gfs2_inode *dip)
}
static int dir_l_add(struct gfs2_inode *dip, const char *filename, int len,
- struct gfs2_inum *inum, unsigned int type)
+ struct lgfs2_inum *inum, unsigned int type)
{
struct gfs2_dirent *dent;
int err = 0;
@@ -1303,7 +1303,7 @@ static int dir_l_add(struct gfs2_inode *dip, const char *filename,
int len,
return err;
}
- gfs2_inum_out(inum, (char *)&dent->de_inum);
+ lgfs2_inum_out(inum, &dent->de_inum);
dent->de_hash = gfs2_disk_hash(filename, len);
dent->de_hash = cpu_to_be32(dent->de_hash);
dent->de_type = cpu_to_be16(type);
@@ -1313,7 +1313,7 @@ static int dir_l_add(struct gfs2_inode *dip, const char *filename,
int len,
}
int dir_add(struct gfs2_inode *dip, const char *filename, int len,
- struct gfs2_inum *inum, unsigned int type)
+ struct lgfs2_inum *inum, unsigned int type)
{
int err = 0;
if (dip->i_flags & GFS2_DIF_EXHASH)
@@ -1323,8 +1323,8 @@ int dir_add(struct gfs2_inode *dip, const char *filename, int len,
return err;
}
-static int __init_dinode(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhp, struct
gfs2_inum *inum,
- unsigned int mode, uint32_t flags, struct gfs2_inum *parent, int
gfs1)
+static int __init_dinode(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhp, struct
lgfs2_inum *inum,
+ unsigned int mode, uint32_t flags, struct lgfs2_inum *parent,
int gfs1)
{
struct gfs2_buffer_head *bh;
struct gfs2_dinode *di;
@@ -1340,7 +1340,7 @@ static int __init_dinode(struct gfs2_sbd *sdp, struct
gfs2_buffer_head **bhp, st
return 1;
if (*bhp == NULL) {
- *bhp = bget(sdp, inum->no_addr);
+ *bhp = bget(sdp, inum->in_addr);
if (*bhp == NULL)
return 1;
}
@@ -1352,8 +1352,8 @@ static int __init_dinode(struct gfs2_sbd *sdp, struct
gfs2_buffer_head **bhp, st
di->di_header.mh_magic = cpu_to_be32(GFS2_MAGIC);
di->di_header.mh_type = cpu_to_be32(GFS2_METATYPE_DI);
di->di_header.mh_format = cpu_to_be32(GFS2_FORMAT_DI);
- di->di_num.no_formal_ino = cpu_to_be64(inum->no_formal_ino);
- di->di_num.no_addr = cpu_to_be64(inum->no_addr);
+ di->di_num.no_formal_ino = cpu_to_be64(inum->in_formal_ino);
+ di->di_num.no_addr = cpu_to_be64(inum->in_addr);
di->di_mode = cpu_to_be32(mode);
di->di_nlink = cpu_to_be32(1);
di->di_blocks = cpu_to_be64(1);
@@ -1380,8 +1380,8 @@ static int __init_dinode(struct gfs2_sbd *sdp, struct
gfs2_buffer_head **bhp, st
hash = gfs2_disk_hash("..", 2);
len = sdp->sd_bsize - (p - bh->b_data);
- de.de_inum.no_formal_ino = cpu_to_be64(parent->no_formal_ino);
- de.de_inum.no_addr = cpu_to_be64(parent->no_addr);
+ de.de_inum.no_formal_ino = cpu_to_be64(parent->in_formal_ino);
+ de.de_inum.no_addr = cpu_to_be64(parent->in_addr);
de.de_hash = cpu_to_be32(hash);
de.de_rec_len = cpu_to_be16(len);
de.de_name_len = cpu_to_be16(2);
@@ -1401,8 +1401,8 @@ static int __init_dinode(struct gfs2_sbd *sdp, struct
gfs2_buffer_head **bhp, st
return 0;
}
-int init_dinode(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhp, struct gfs2_inum
*inum,
- unsigned int mode, uint32_t flags, struct gfs2_inum *parent)
+int init_dinode(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhp, struct lgfs2_inum
*inum,
+ unsigned int mode, uint32_t flags, struct lgfs2_inum *parent)
{
return __init_dinode(sdp, bhp, inum, mode, flags, parent, 0);
}
@@ -1482,7 +1482,7 @@ static struct gfs2_inode *__createi(struct gfs2_inode *dip,
{
struct gfs2_sbd *sdp = dip->i_sbd;
uint64_t bn;
- struct gfs2_inum inum;
+ struct lgfs2_inum inum;
struct gfs2_buffer_head *bh = NULL;
struct gfs2_inode *ip;
int err = 0;
@@ -1490,19 +1490,19 @@ static struct gfs2_inode *__createi(struct gfs2_inode *dip,
gfs2_lookupi(dip, filename, strlen(filename), &ip);
if (!ip) {
- struct gfs2_inum parent = {
- .no_formal_ino = dip->i_formal_ino,
- .no_addr = dip->i_addr,
+ struct lgfs2_inum parent = {
+ .in_formal_ino = dip->i_formal_ino,
+ .in_addr = dip->i_addr,
};
err = lgfs2_dinode_alloc(sdp, 1, &bn);
if (err != 0)
return NULL;
if (if_gfs1)
- inum.no_formal_ino = bn;
+ inum.in_formal_ino = bn;
else
- inum.no_formal_ino = sdp->md.next_inum++;
- inum.no_addr = bn;
+ inum.in_formal_ino = sdp->md.next_inum++;
+ inum.in_addr = bn;
err = dir_add(dip, filename, strlen(filename), &inum, IF2DT(mode));
if (err)
@@ -1692,7 +1692,7 @@ static int linked_leaf_search(struct gfs2_inode *dip, const char
*filename,
* Returns:
*/
static int dir_e_search(struct gfs2_inode *dip, const char *filename,
- int len, unsigned int *type, struct gfs2_inum *inum)
+ int len, unsigned int *type, struct lgfs2_inum *inum)
{
struct gfs2_buffer_head *bh = NULL;
struct gfs2_dirent *dent;
@@ -1702,7 +1702,7 @@ static int dir_e_search(struct gfs2_inode *dip, const char
*filename,
if (error)
return error;
- gfs2_inum_in(inum, (char *)&dent->de_inum);
+ lgfs2_inum_in(inum, &dent->de_inum);
if (type)
*type = be16_to_cpu(dent->de_type);
@@ -1721,7 +1721,7 @@ static int dir_e_search(struct gfs2_inode *dip, const char
*filename,
* Returns:
*/
static int dir_l_search(struct gfs2_inode *dip, const char *filename,
- int len, unsigned int *type, struct gfs2_inum *inum)
+ int len, unsigned int *type, struct lgfs2_inum *inum)
{
struct gfs2_dirent *dent;
int error;
@@ -1731,7 +1731,7 @@ static int dir_l_search(struct gfs2_inode *dip, const char
*filename,
error = leaf_search(dip, dip->i_bh, filename, len, &dent, NULL);
if (!error) {
- gfs2_inum_in(inum, (char *)&dent->de_inum);
+ lgfs2_inum_in(inum, &dent->de_inum);
if(type)
*type = be16_to_cpu(dent->de_type);
}
@@ -1752,7 +1752,7 @@ static int dir_l_search(struct gfs2_inode *dip, const char
*filename,
* Returns: 0 if found, -1 on failure, -ENOENT if not found.
*/
int dir_search(struct gfs2_inode *dip, const char *filename, int len,
- unsigned int *type, struct gfs2_inum *inum)
+ unsigned int *type, struct lgfs2_inum *inum)
{
int error;
@@ -1868,7 +1868,7 @@ int gfs2_lookupi(struct gfs2_inode *dip, const char *filename, int
len,
{
struct gfs2_sbd *sdp = dip->i_sbd;
int error = 0;
- struct gfs2_inum inum;
+ struct lgfs2_inum inum;
*ipp = NULL;
@@ -1880,7 +1880,7 @@ int gfs2_lookupi(struct gfs2_inode *dip, const char *filename, int
len,
}
error = dir_search(dip, filename, len, NULL, &inum);
if (!error)
- *ipp = lgfs2_inode_read(sdp, inum.no_addr);
+ *ipp = lgfs2_inode_read(sdp, inum.in_addr);
return error;
}
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 7fae35c3..6e5172cd 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -370,6 +370,11 @@ struct gfs2_sbd {
int gfs1;
};
+struct lgfs2_inum {
+ uint64_t in_formal_ino;
+ uint64_t in_addr;
+};
+
struct lgfs2_log_header {
uint64_t lh_sequence;
uint32_t lh_flags;
@@ -382,6 +387,16 @@ struct lgfs2_log_header {
int64_t lh_local_dinodes;
};
+struct lgfs2_dirent {
+ struct lgfs2_inum dr_inum;
+ uint32_t dr_hash;
+ uint16_t dr_rec_len;
+ uint16_t dr_name_len;
+ uint16_t dr_type;
+ uint16_t dr_rahead;
+ uint32_t dr_cookie;
+};
+
struct metapath {
unsigned int mp_list[GFS2_MAX_META_HEIGHT];
};
@@ -495,8 +510,8 @@ extern int gfs2_readi(struct gfs2_inode *ip, void *buf, uint64_t
offset,
__gfs2_writei(ip, buf, offset, size, 1)
extern int __gfs2_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
unsigned int size, int resize);
-extern int init_dinode(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhp, struct
gfs2_inum *inum,
- unsigned int mode, uint32_t flags, struct gfs2_inum *parent);
+extern int init_dinode(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhp, struct
lgfs2_inum *inum,
+ unsigned int mode, uint32_t flags, struct lgfs2_inum *parent);
extern struct gfs2_inode *createi(struct gfs2_inode *dip, const char *filename,
unsigned int mode, uint32_t flags);
extern struct gfs2_inode *gfs_createi(struct gfs2_inode *dip,
@@ -505,11 +520,11 @@ extern struct gfs2_inode *gfs_createi(struct gfs2_inode *dip,
extern void dirent2_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
struct gfs2_dirent *prev, struct gfs2_dirent *cur);
extern int dir_search(struct gfs2_inode *dip, const char *filename, int len,
- unsigned int *type, struct gfs2_inum *inum);
+ unsigned int *type, struct lgfs2_inum *inum);
extern int gfs2_lookupi(struct gfs2_inode *dip, const char *filename, int len,
struct gfs2_inode **ipp);
extern int dir_add(struct gfs2_inode *dip, const char *filename, int len,
- struct gfs2_inum *inum, unsigned int type);
+ struct lgfs2_inum *inum, unsigned int type);
extern int gfs2_dirent_del(struct gfs2_inode *dip, const char *filename,
int filename_len);
extern void block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
@@ -748,7 +763,7 @@ extern int lgfs2_sb_write(const struct gfs2_sbd *sdp, int fd);
extern int build_journal(struct gfs2_sbd *sdp, int j,
struct gfs2_inode *jindex);
extern int build_jindex(struct gfs2_sbd *sdp);
-extern int lgfs2_build_jindex(struct gfs2_inode *master, struct gfs2_inum *jnls, size_t
nmemb);
+extern int lgfs2_build_jindex(struct gfs2_inode *master, struct lgfs2_inum *jnls, size_t
nmemb);
extern int build_per_node(struct gfs2_sbd *sdp);
extern int build_inum(struct gfs2_sbd *sdp);
extern int build_statfs(struct gfs2_sbd *sdp);
@@ -777,8 +792,8 @@ extern void print_it(const char *label, const char *fmt, const char
*fmt2, ...)
/* Translation functions */
-extern void gfs2_inum_in(struct gfs2_inum *no, char *buf);
-extern void gfs2_inum_out(const struct gfs2_inum *no, char *buf);
+extern void lgfs2_inum_in(struct lgfs2_inum *i, void *inp);
+extern void lgfs2_inum_out(struct lgfs2_inum *i, void *inp);
extern void gfs2_meta_header_in(struct gfs2_meta_header *mh, const char *buf);
extern void gfs2_meta_header_out(const struct gfs2_meta_header *mh, char *buf);
extern void lgfs2_sb_in(struct gfs2_sbd *sdp, void *buf);
@@ -789,8 +804,8 @@ extern void lgfs2_rgrp_in(lgfs2_rgrp_t rg, void *buf);
extern void lgfs2_rgrp_out(const lgfs2_rgrp_t rg, void *buf);
extern void lgfs2_dinode_in(struct gfs2_inode *ip, char *buf);
extern void lgfs2_dinode_out(struct gfs2_inode *ip, char *buf);
-extern void gfs2_dirent_in(struct gfs2_dirent *de, char *buf);
-extern void gfs2_dirent_out(struct gfs2_dirent *de, char *buf);
+extern void lgfs2_dirent_in(struct lgfs2_dirent *d, void *dep);
+extern void lgfs2_dirent_out(struct lgfs2_dirent *d, void *dep);
extern void gfs2_leaf_in(struct gfs2_leaf *lf, char *buf);
extern void gfs2_leaf_out(struct gfs2_leaf *lf, char *buf);
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index 77798993..4526fa20 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -38,33 +38,20 @@
#define CPIN_64(s1, s2, member) {(s1->member) = be64_to_cpu((s2->member));}
#define CPOUT_64(s1, s2, member) {(s2->member) = cpu_to_be64((s1->member));}
-/*
- * gfs2_xxx_in - read in an xxx struct
- * first arg: the cpu-order structure
- * buf: the disk-order block data
- *
- * gfs2_xxx_out - write out an xxx struct
- * first arg: the cpu-order structure
- * buf: the disk-order block data
- *
- * gfs2_xxx_print - print out an xxx struct
- * first arg: the cpu-order structure
- */
-
-void gfs2_inum_in(struct gfs2_inum *no, char *buf)
+void lgfs2_inum_in(struct lgfs2_inum *i, void *inp)
{
- struct gfs2_inum *str = (struct gfs2_inum *)buf;
+ struct gfs2_inum *in = inp;
- CPIN_64(no, str, no_formal_ino);
- CPIN_64(no, str, no_addr);
+ i->in_formal_ino = be64_to_cpu(in->no_formal_ino);
+ i->in_addr = be64_to_cpu(in->no_addr);
}
-void gfs2_inum_out(const struct gfs2_inum *no, char *buf)
+void lgfs2_inum_out(struct lgfs2_inum *i, void *inp)
{
- struct gfs2_inum *str = (struct gfs2_inum *)buf;
+ struct gfs2_inum *in = inp;
- CPOUT_64(no, str, no_formal_ino);
- CPOUT_64(no, str, no_addr);
+ in->no_formal_ino = cpu_to_be64(i->in_formal_ino);
+ in->no_addr = cpu_to_be64(i->in_addr);
}
void lgfs2_inum_print(void *nop)
@@ -375,32 +362,30 @@ void lgfs2_dinode_print(void *dip)
printbe64(di, di_eattr);
}
-void gfs2_dirent_in(struct gfs2_dirent *de, char *buf)
+void lgfs2_dirent_in(struct lgfs2_dirent *d, void *dep)
{
- struct gfs2_dirent *str = (struct gfs2_dirent *)buf;
-
- gfs2_inum_in(&de->de_inum, buf);
- CPIN_32(de, str, de_hash);
- CPIN_16(de, str, de_rec_len);
- CPIN_16(de, str, de_name_len);
- CPIN_16(de, str, de_type);
- CPIN_16(de, str, de_rahead);
- CPIN_32(de, str, de_cookie);
- CPIN_08(de, str, pad3, 8);
+ struct gfs2_dirent *de = dep;
+
+ lgfs2_inum_in(&d->dr_inum, &de->de_inum);
+ d->dr_hash = be32_to_cpu(de->de_hash);
+ d->dr_rec_len = be16_to_cpu(de->de_rec_len);
+ d->dr_name_len = be16_to_cpu(de->de_name_len);
+ d->dr_type = be16_to_cpu(de->de_type);
+ d->dr_rahead = be16_to_cpu(de->de_rahead);
+ d->dr_cookie = be32_to_cpu(de->de_cookie);
}
-void gfs2_dirent_out(struct gfs2_dirent *de, char *buf)
+void lgfs2_dirent_out(struct lgfs2_dirent *d, void *dep)
{
- struct gfs2_dirent *str = (struct gfs2_dirent *)buf;
-
- gfs2_inum_out(&de->de_inum, buf);
- CPOUT_32(de, str, de_hash);
- CPOUT_16(de, str, de_rec_len);
- CPOUT_16(de, str, de_name_len);
- CPOUT_16(de, str, de_type);
- CPOUT_16(de, str, de_rahead);
- CPOUT_32(de, str, de_cookie);
- CPOUT_08(de, str, pad3, 8);
+ struct gfs2_dirent *de = dep;
+
+ lgfs2_inum_out(&d->dr_inum, &de->de_inum);
+ de->de_hash = cpu_to_be32(d->dr_hash);
+ de->de_rec_len = cpu_to_be16(d->dr_rec_len);
+ de->de_name_len = cpu_to_be16(d->dr_name_len);
+ de->de_type = cpu_to_be16(d->dr_type);
+ de->de_rahead = cpu_to_be16(d->dr_rahead);
+ de->de_cookie = cpu_to_be32(d->dr_cookie);
}
void gfs2_leaf_in(struct gfs2_leaf *lf, char *buf)
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index 0957e5ad..f0eb8832 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -19,7 +19,7 @@
int build_master(struct gfs2_sbd *sdp)
{
- struct gfs2_inum inum;
+ struct lgfs2_inum inum;
uint64_t bn;
struct gfs2_buffer_head *bh = NULL;
int err = lgfs2_dinode_alloc(sdp, 1, &bn);
@@ -27,8 +27,8 @@ int build_master(struct gfs2_sbd *sdp)
if (err != 0)
return -1;
- inum.no_formal_ino = sdp->md.next_inum++;
- inum.no_addr = bn;
+ inum.in_formal_ino = sdp->md.next_inum++;
+ inum.in_addr = bn;
err = init_dinode(sdp, &bh, &inum, S_IFDIR | 0755, GFS2_DIF_SYSTEM, &inum);
if (err != 0)
@@ -255,7 +255,7 @@ int build_journal(struct gfs2_sbd *sdp, int j, struct gfs2_inode
*jindex)
* nmemb: The number of entries in the list (number of journals).
* Returns 0 on success or non-zero on error with errno set.
*/
-int lgfs2_build_jindex(struct gfs2_inode *master, struct gfs2_inum *jnls, size_t nmemb)
+int lgfs2_build_jindex(struct gfs2_inode *master, struct lgfs2_inum *jnls, size_t nmemb)
{
char fname[GFS2_FNAMESIZE + 1];
struct gfs2_inode *jindex;
@@ -559,7 +559,7 @@ int build_quota(struct gfs2_sbd *sdp)
int build_root(struct gfs2_sbd *sdp)
{
- struct gfs2_inum inum;
+ struct lgfs2_inum inum;
uint64_t bn;
struct gfs2_buffer_head *bh = NULL;
int err = lgfs2_dinode_alloc(sdp, 1, &bn);
@@ -567,8 +567,8 @@ int build_root(struct gfs2_sbd *sdp)
if (err != 0)
return -1;
- inum.no_formal_ino = sdp->md.next_inum++;
- inum.no_addr = bn;
+ inum.in_formal_ino = sdp->md.next_inum++;
+ inum.in_addr = bn;
err = init_dinode(sdp, &bh, &inum, S_IFDIR | 0755, 0, &inum);
if (err != 0)
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index bf9e0d6d..551261b9 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -160,7 +160,7 @@ static void opts_init(struct mkfs_opts *opts)
opts->format = GFS2_FORMAT_FS;
}
-struct gfs2_inum *mkfs_journals = NULL;
+struct lgfs2_inum *mkfs_journals = NULL;
#ifndef BLKDISCARD
#define BLKDISCARD _IO(0x12,119)
@@ -901,8 +901,8 @@ static int place_journals(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs,
struct mkfs_o
fprintf(stderr, _("Failed to write data blocks for journal %u\n"), j);
return result;
}
- mkfs_journals[j].no_addr = in.i_addr;
- mkfs_journals[j].no_formal_ino = in.i_formal_ino;
+ mkfs_journals[j].in_addr = in.i_addr;
+ mkfs_journals[j].in_formal_ino = in.i_formal_ino;
}
gfs2_progress_close(&progress, _("Done\n"));
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.