[gfs2-utils] 12/21: libgfs2: Namespace improvements -
device_geometry.c
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch main
in repository gfs2-utils.
commit c2db5019be54b4c7f230781d06c20874a18edf1d
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Jan 17 21:08:09 2022 +0000
libgfs2: Namespace improvements - device_geometry.c
Use the lgfs2_ prefix in libgfs2 interface names.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/hexedit.c | 2 +-
gfs2/fsck/rgrepair.c | 2 +-
gfs2/libgfs2/device_geometry.c | 2 +-
gfs2/libgfs2/gfs2l.c | 2 +-
gfs2/libgfs2/libgfs2.h | 2 +-
gfs2/mkfs/main_grow.c | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index fc1b5f4f..3415b41f 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -909,7 +909,7 @@ static void read_superblock(int fd)
else {
block = starting_blk = 0;
}
- fix_device_geometry(&sbd);
+ lgfs2_fix_device_geometry(&sbd);
if(sbd.gfs1) {
sbd.sd_inptrs = (sbd.sd_bsize - sizeof(struct gfs_indirect)) /
sizeof(uint64_t);
diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c
index 333a77a5..37d20aed 100644
--- a/gfs2/fsck/rgrepair.c
+++ b/gfs2/fsck/rgrepair.c
@@ -818,7 +818,7 @@ static int gfs2_rindex_calculate(struct gfs2_sbd *sdp, int *num_rgs)
*num_rgs = sdp->md.riinode->i_size / sizeof(struct gfs2_rindex);
rgcalc.osi_node = NULL;
- fix_device_geometry(sdp);
+ lgfs2_fix_device_geometry(sdp);
/* Try all possible rgrp sizes: 2048, 1024, 512, 256, 128, 64, 32 */
for (sdp->rgsize = GFS2_DEFAULT_RGSIZE; sdp->rgsize >= 32;
diff --git a/gfs2/libgfs2/device_geometry.c b/gfs2/libgfs2/device_geometry.c
index cb1ed6d5..86ad84bd 100644
--- a/gfs2/libgfs2/device_geometry.c
+++ b/gfs2/libgfs2/device_geometry.c
@@ -92,7 +92,7 @@ size_check:
*
*/
-void fix_device_geometry(struct gfs2_sbd *sdp)
+void lgfs2_fix_device_geometry(struct gfs2_sbd *sdp)
{
struct device *device = &sdp->device;
diff --git a/gfs2/libgfs2/gfs2l.c b/gfs2/libgfs2/gfs2l.c
index a247bed2..b8c4ca41 100644
--- a/gfs2/libgfs2/gfs2l.c
+++ b/gfs2/libgfs2/gfs2l.c
@@ -130,7 +130,7 @@ static int openfs(const char *path, struct gfs2_sbd *sdp)
perror("Failed to gather device info");
return 1;
}
- fix_device_geometry(sdp);
+ lgfs2_fix_device_geometry(sdp);
ret = lgfs2_read_sb(sdp);
if (ret != 0) {
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index d091e180..39097e68 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -473,7 +473,7 @@ extern uint32_t lgfs2_get_block_type(const char *buf);
/* device_geometry.c */
extern int lgfs2_get_dev_info(int fd, struct lgfs2_dev_info *i);
-extern void fix_device_geometry(struct gfs2_sbd *sdp);
+extern void lgfs2_fix_device_geometry(struct gfs2_sbd *sdp);
/* fs_bits.c */
#define BFITNOENT (0xFFFFFFFF)
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
index 298ba2a6..b2959285 100644
--- a/gfs2/mkfs/main_grow.c
+++ b/gfs2/mkfs/main_grow.c
@@ -406,7 +406,7 @@ int main(int argc, char *argv[])
fprintf(stderr, _("cannot grow gfs1 filesystem\n"));
exit(EXIT_FAILURE);
}
- fix_device_geometry(sdp);
+ lgfs2_fix_device_geometry(sdp);
mfs.context = copy_context_opt(mnt);
if (mount_gfs2_meta(&mfs, mnt->mnt_dir, (print_level > MSG_NOTICE))) {
perror(_("Failed to mount GFS2 meta file system"));
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 3 months
[gfs2-utils] 11/21: libgfs2: Namespace improvements - recovery.c
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch main
in repository gfs2-utils.
commit 168dda5d7bd3c0b6b812c89e626f98fa294fd351
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Jan 17 20:55:08 2022 +0000
libgfs2: Namespace improvements - recovery.c
Use the lgfs2_ prefix in libgfs2 interface names.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/fs_recovery.c | 22 +++++++++++-----------
gfs2/libgfs2/libgfs2.h | 4 ++--
gfs2/libgfs2/recovery.c | 8 ++++----
3 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
index 5bd46301..4a2d1259 100644
--- a/gfs2/fsck/fs_recovery.c
+++ b/gfs2/fsck/fs_recovery.c
@@ -135,9 +135,9 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
if (pass != 1 || be32_to_cpu(ld->ld_type) != GFS2_LOG_DESC_METADATA)
return 0;
- gfs2_replay_incr_blk(ip, &start);
+ lgfs2_replay_incr_blk(ip, &start);
- for (; blks; gfs2_replay_incr_blk(ip, &start), blks--) {
+ for (; blks; lgfs2_replay_incr_blk(ip, &start), blks--) {
struct gfs2_meta_header *mhp;
sd_found_metablocks++;
@@ -147,7 +147,7 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
if (revoke_check(sdp, blkno, start))
continue;
- error = gfs2_replay_read_block(ip, start, &bh_log);
+ error = lgfs2_replay_read_block(ip, start, &bh_log);
if (error)
return error;
@@ -200,8 +200,8 @@ static int revoke_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
offset = sizeof(struct gfs2_log_descriptor);
- for (; blks; gfs2_replay_incr_blk(ip, &start), blks--) {
- error = gfs2_replay_read_block(ip, start, &bh);
+ for (; blks; lgfs2_replay_incr_blk(ip, &start), blks--) {
+ error = lgfs2_replay_read_block(ip, start, &bh);
if (error)
return error;
@@ -246,8 +246,8 @@ static int databuf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
if (pass != 1 || be32_to_cpu(ld->ld_type) != GFS2_LOG_DESC_JDATA)
return 0;
- gfs2_replay_incr_blk(ip, &start);
- for (; blks; gfs2_replay_incr_blk(ip, &start), blks--) {
+ lgfs2_replay_incr_blk(ip, &start);
+ for (; blks; lgfs2_replay_incr_blk(ip, &start), blks--) {
blkno = be64_to_cpu(*ptr);
ptr++;
esc = be64_to_cpu(*ptr);
@@ -258,7 +258,7 @@ static int databuf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
if (revoke_check(sdp, blkno, start))
continue;
- error = gfs2_replay_read_block(ip, start, &bh_log);
+ error = lgfs2_replay_read_block(ip, start, &bh_log);
if (error)
return error;
@@ -313,7 +313,7 @@ static int foreach_descriptor(struct gfs2_inode *ip, unsigned int start,
while (start != end) {
struct gfs2_meta_header *mhp;
- error = gfs2_replay_read_block(ip, start, &bh);
+ error = lgfs2_replay_read_block(ip, start, &bh);
if (error)
return error;
mhp = (struct gfs2_meta_header *)bh->b_data;
@@ -330,7 +330,7 @@ static int foreach_descriptor(struct gfs2_inode *ip, unsigned int start,
error = lgfs2_get_log_header(ip, start, &lh);
if (!error) {
- gfs2_replay_incr_blk(ip, &start);
+ lgfs2_replay_incr_blk(ip, &start);
lgfs2_bmodified(bh);
lgfs2_brelse(bh);
continue;
@@ -369,7 +369,7 @@ static int foreach_descriptor(struct gfs2_inode *ip, unsigned int start,
}
while (length--)
- gfs2_replay_incr_blk(ip, &start);
+ lgfs2_replay_incr_blk(ip, &start);
lgfs2_bmodified(bh);
lgfs2_brelse(bh);
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index e9e0c184..d091e180 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -730,8 +730,8 @@ extern int lgfs2_open_mnt_dev(const char *path, int flags, struct mntent **mnt);
extern int lgfs2_open_mnt_dir(const char *path, int flags, struct mntent **mnt);
/* recovery.c */
-extern void gfs2_replay_incr_blk(struct gfs2_inode *ip, unsigned int *blk);
-extern int gfs2_replay_read_block(struct gfs2_inode *ip, unsigned int blk,
+extern void lgfs2_replay_incr_blk(struct gfs2_inode *ip, unsigned int *blk);
+extern int lgfs2_replay_read_block(struct gfs2_inode *ip, unsigned int blk,
struct gfs2_buffer_head **bh);
extern int lgfs2_get_log_header(struct gfs2_inode *ip, unsigned int blk,
struct lgfs2_log_header *head);
diff --git a/gfs2/libgfs2/recovery.c b/gfs2/libgfs2/recovery.c
index 3984e1e3..483661e4 100644
--- a/gfs2/libgfs2/recovery.c
+++ b/gfs2/libgfs2/recovery.c
@@ -14,7 +14,7 @@
#include <string.h>
#include "libgfs2.h"
-void gfs2_replay_incr_blk(struct gfs2_inode *ip, unsigned int *blk)
+void lgfs2_replay_incr_blk(struct gfs2_inode *ip, unsigned int *blk)
{
uint32_t jd_blocks = ip->i_size / ip->i_sbd->sd_bsize;
@@ -22,7 +22,7 @@ void gfs2_replay_incr_blk(struct gfs2_inode *ip, unsigned int *blk)
*blk = 0;
}
-int gfs2_replay_read_block(struct gfs2_inode *ip, unsigned int blk,
+int lgfs2_replay_read_block(struct gfs2_inode *ip, unsigned int blk,
struct gfs2_buffer_head **bh)
{
int new = 0;
@@ -77,7 +77,7 @@ int lgfs2_get_log_header(struct gfs2_inode *ip, unsigned int blk,
uint32_t crc;
int error;
- error = gfs2_replay_read_block(ip, blk, &bh);
+ error = lgfs2_replay_read_block(ip, blk, &bh);
if (error)
return error;
@@ -240,7 +240,7 @@ int lgfs2_clean_journal(struct gfs2_inode *ip, struct lgfs2_log_header *head)
uint64_t dblock;
lblock = head->lh_blkno;
- gfs2_replay_incr_blk(ip, &lblock);
+ lgfs2_replay_incr_blk(ip, &lblock);
lgfs2_block_map(ip, lblock, &new, &dblock, NULL, 0);
if (!dblock)
return -EIO;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 3 months
[gfs2-utils] 10/21: libgfs2: Remove revoke function declarations from
libgfs2.h
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch main
in repository gfs2-utils.
commit c9f68cc898cdf6bd8b86a6dd1b373ddbdc031b70
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Jan 17 20:48:16 2022 +0000
libgfs2: Remove revoke function declarations from libgfs2.h
These functions are actually defined in fsck.gfs2 code and can be made
static.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/fs_recovery.c | 14 +++++++-------
gfs2/libgfs2/libgfs2.h | 4 ----
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
index bd0fd731..5bd46301 100644
--- a/gfs2/fsck/fs_recovery.c
+++ b/gfs2/fsck/fs_recovery.c
@@ -33,7 +33,7 @@ struct gfs2_revoke_replay {
unsigned int rr_where;
};
-int gfs2_revoke_add(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where)
+static int revoke_add(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where)
{
osi_list_t *tmp, *head = &sd_revoke_list;
struct gfs2_revoke_replay *rr;
@@ -62,7 +62,7 @@ int gfs2_revoke_add(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where)
return 1;
}
-int gfs2_revoke_check(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where)
+static int revoke_check(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where)
{
osi_list_t *tmp;
struct gfs2_revoke_replay *rr;
@@ -86,7 +86,7 @@ int gfs2_revoke_check(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where)
return (wrap) ? (a || b) : (a && b);
}
-void gfs2_revoke_clean(struct gfs2_sbd *sdp)
+static void revoke_clean(struct gfs2_sbd *sdp)
{
osi_list_t *head = &sd_revoke_list;
struct gfs2_revoke_replay *rr;
@@ -144,7 +144,7 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
blkno = be64_to_cpu(*ptr);
ptr++;
- if (gfs2_revoke_check(sdp, blkno, start))
+ if (revoke_check(sdp, blkno, start))
continue;
error = gfs2_replay_read_block(ip, start, &bh_log);
@@ -213,7 +213,7 @@ static int revoke_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
blkno = be64_to_cpu(*(__be64 *)(bh->b_data + offset));
log_info(_("Journal replay processing revoke for block #%"PRIu64" (0x%"PRIx64") for journal+0x%x\n"),
blkno, blkno, start);
- error = gfs2_revoke_add(sdp, blkno, start);
+ error = revoke_add(sdp, blkno, start);
if (error < 0)
return error;
else if (error)
@@ -255,7 +255,7 @@ static int databuf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
sd_found_jblocks++;
- if (gfs2_revoke_check(sdp, blkno, start))
+ if (revoke_check(sdp, blkno, start))
continue;
error = gfs2_replay_read_block(ip, start, &bh_log);
@@ -578,7 +578,7 @@ static int gfs2_recover_journal(struct gfs2_inode *ip, int j, int preen,
}
}
log_info( _("jid=%u: Found %u revoke tags\n"), j, sd_found_revokes);
- gfs2_revoke_clean(sdp);
+ revoke_clean(sdp);
error = lgfs2_clean_journal(ip, &head);
if (error)
goto out;
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 5c2f1aa7..e9e0c184 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -733,10 +733,6 @@ extern int lgfs2_open_mnt_dir(const char *path, int flags, struct mntent **mnt);
extern void gfs2_replay_incr_blk(struct gfs2_inode *ip, unsigned int *blk);
extern int gfs2_replay_read_block(struct gfs2_inode *ip, unsigned int blk,
struct gfs2_buffer_head **bh);
-extern int gfs2_revoke_add(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where);
-extern int gfs2_revoke_check(struct gfs2_sbd *sdp, uint64_t blkno,
- unsigned int where);
-extern void gfs2_revoke_clean(struct gfs2_sbd *sdp);
extern int lgfs2_get_log_header(struct gfs2_inode *ip, unsigned int blk,
struct lgfs2_log_header *head);
extern int lgfs2_find_jhead(struct gfs2_inode *ip, struct lgfs2_log_header *head);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 3 months
[gfs2-utils] 09/21: libgfs2: Namespace improvements -
gfs2_disk_hash.c
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch main
in repository gfs2-utils.
commit f2f00a9a3b7ba9256742597a38d5e7b2e2e77bea
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Jan 17 20:21:04 2022 +0000
libgfs2: Namespace improvements - gfs2_disk_hash.c
Use the lgfs2_ prefix in libgfs2 interface names.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/pass2.c | 2 +-
gfs2/libgfs2/fs_ops.c | 12 ++++++------
gfs2/libgfs2/gfs2_disk_hash.c | 5 ++---
gfs2/libgfs2/libgfs2.h | 7 +++----
gfs2/libgfs2/rgrp.c | 4 ++--
gfs2/libgfs2/structures.c | 2 +-
6 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 3d732772..d394f6bf 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -470,7 +470,7 @@ static int basic_dentry_checks(struct gfs2_inode *ip, struct gfs2_dirent *dent,
return 1;
}
- calculated_hash = gfs2_disk_hash(tmp_name, d->dr_name_len);
+ calculated_hash = lgfs2_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"
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index 4e10ab4f..4e3736ca 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -1148,7 +1148,7 @@ static int dir_e_add(struct gfs2_inode *dip, const char *filename, int len,
uint64_t leaf_no, bn;
int err = 0;
- hash = gfs2_disk_hash(filename, len);
+ hash = lgfs2_disk_hash(filename, len);
restart:
/* Have to kludge because (hash >> 32) gives hash for some reason. */
if (dip->i_depth)
@@ -1313,7 +1313,7 @@ static int dir_l_add(struct gfs2_inode *dip, const char *filename, int len,
}
lgfs2_inum_out(inum, &dent->de_inum);
- de_hash = gfs2_disk_hash(filename, len);
+ de_hash = lgfs2_disk_hash(filename, len);
dent->de_hash = cpu_to_be32(de_hash);
dent->de_type = cpu_to_be16(type);
memcpy((char *)(dent + 1), filename, len);
@@ -1376,7 +1376,7 @@ static int __init_dinode(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhp, st
uint32_t hash;
uint16_t len;
- hash = gfs2_disk_hash(".", 1);
+ hash = lgfs2_disk_hash(".", 1);
len = GFS2_DIRENT_SIZE(1);
de.de_inum = di->di_num;
de.de_hash = cpu_to_be32(hash);
@@ -1387,7 +1387,7 @@ static int __init_dinode(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhp, st
p[sizeof(de)] = '.';
p += len;
- hash = gfs2_disk_hash("..", 2);
+ hash = lgfs2_disk_hash("..", 2);
len = sdp->sd_bsize - (p - bh->b_data);
de.de_inum.no_formal_ino = cpu_to_be64(parent->in_formal_ino);
de.de_inum.no_addr = cpu_to_be64(parent->in_addr);
@@ -1598,7 +1598,7 @@ static int leaf_search(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
else
return -1;
- hash = gfs2_disk_hash(filename, len);
+ hash = lgfs2_disk_hash(filename, len);
do{
if (!dent->de_inum.no_formal_ino){
@@ -1650,7 +1650,7 @@ static int linked_leaf_search(struct gfs2_inode *dip, const char *filename,
/* Figure out the address of the leaf node. */
- hash = gfs2_disk_hash(filename, len);
+ hash = lgfs2_disk_hash(filename, len);
lindex = hash >> (32 - dip->i_depth);
error = get_first_leaf(dip, lindex, &bh_next);
diff --git a/gfs2/libgfs2/gfs2_disk_hash.c b/gfs2/libgfs2/gfs2_disk_hash.c
index 959f5ddc..07632a28 100644
--- a/gfs2/libgfs2/gfs2_disk_hash.c
+++ b/gfs2/libgfs2/gfs2_disk_hash.c
@@ -40,7 +40,7 @@ static const uint32_t crc_32_tab[] =
};
/**
- * gfs2_disk_hash - hash an array of data
+ * lgfs2_disk_hash - hash an array of data
* @data: the data to be hashed
* @len: the length of data to be hashed
*
@@ -59,7 +59,7 @@ static const uint32_t crc_32_tab[] =
* Returns: the hash
*/
-uint32_t gfs2_disk_hash(const char *data, int len)
+uint32_t lgfs2_disk_hash(const char *data, int len)
{
uint32_t hash = 0xFFFFFFFF;
@@ -71,4 +71,3 @@ uint32_t gfs2_disk_hash(const char *data, int len)
return hash;
}
-
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index aede5cda..5c2f1aa7 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -783,11 +783,10 @@ extern int lgfs2_read_sb(struct gfs2_sbd *sdp);
extern int lgfs2_rindex_read(struct gfs2_sbd *sdp, uint64_t *rgcount, int *ok);
extern int lgfs2_write_sb(struct gfs2_sbd *sdp);
-/* ondisk.c */
-extern uint32_t gfs2_disk_hash(const char *data, int len);
-
-/* Translation functions */
+/* gfs2_disk_hash.c */
+extern uint32_t lgfs2_disk_hash(const char *data, int len);
+/* ondisk.c */
extern void lgfs2_inum_in(struct lgfs2_inum *i, void *inp);
extern void lgfs2_inum_out(const struct lgfs2_inum *i, void *inp);
extern void lgfs2_sb_in(struct gfs2_sbd *sdp, void *buf);
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index a359f2fe..78b6812a 100644
--- a/gfs2/libgfs2/rgrp.c
+++ b/gfs2/libgfs2/rgrp.c
@@ -163,7 +163,7 @@ int lgfs2_rgrp_crc_check(char *buf)
return 0;
rg->rg_crc = 0;
- if (be32_to_cpu(crc) != gfs2_disk_hash(buf, sizeof(struct gfs2_rgrp)))
+ if (be32_to_cpu(crc) != lgfs2_disk_hash(buf, sizeof(struct gfs2_rgrp)))
ret = 1;
rg->rg_crc = crc;
return ret;
@@ -178,7 +178,7 @@ void lgfs2_rgrp_crc_set(char *buf)
uint32_t crc;
rg->rg_crc = 0;
- crc = gfs2_disk_hash(buf, sizeof(struct gfs2_rgrp));
+ crc = lgfs2_disk_hash(buf, sizeof(struct gfs2_rgrp));
rg->rg_crc = cpu_to_be32(crc);
}
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index fc0a59cc..a0de2477 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -81,7 +81,7 @@ uint32_t lgfs2_log_header_hash(char *buf)
/* lh_hash only CRCs the fields in the old lh, which ends where lh_crc is now */
const off_t v1_end = offsetof(struct gfs2_log_header, lh_hash) + 4;
- return gfs2_disk_hash(buf, v1_end);
+ return lgfs2_disk_hash(buf, v1_end);
}
uint32_t lgfs2_log_header_crc(char *buf, unsigned bsize)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 3 months
[gfs2-utils] 08/21: libgfs2: Namespace improvements - super.c
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch main
in repository gfs2-utils.
commit f7538c765f0bb73548294a24d9ca723b361f20e0
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Jan 17 19:34:50 2022 +0000
libgfs2: Namespace improvements - super.c
Use the lgfs2_ prefix in libgfs2 interface names.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/convert/gfs2_convert.c | 2 +-
gfs2/edit/hexedit.c | 2 +-
gfs2/edit/savemeta.c | 2 +-
gfs2/fsck/initialize.c | 6 +++---
gfs2/fsck/rgrepair.c | 2 +-
gfs2/libgfs2/gfs2l.c | 4 ++--
gfs2/libgfs2/libgfs2.h | 8 ++++----
gfs2/libgfs2/super.c | 14 +++++++-------
gfs2/mkfs/main_grow.c | 2 +-
tests/nukerg.c | 2 +-
10 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 1608b1ad..c6b388a6 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -1526,7 +1526,7 @@ static int gfs1_ri_update(struct gfs2_sbd *sdp, int *rgcount, int quiet)
struct osi_node *n, *next = NULL;
int ok;
- if (rindex_read(sdp, &count1, &ok))
+ if (lgfs2_rindex_read(sdp, &count1, &ok))
goto fail;
for (n = osi_first(&sdp->rgtree); n; n = next) {
next = osi_next(n);
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index b0f110c1..fc1b5f4f 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -939,7 +939,7 @@ static int read_rindex(void)
sbd.fssize = sbd.device.length;
if (sbd.md.riinode) /* If we found the rindex */
- rindex_read(&sbd, &count, &ok);
+ lgfs2_rindex_read(&sbd, &count, &ok);
if (!OSI_EMPTY_ROOT(&sbd.rgtree)) {
struct rgrp_tree *rg = (struct rgrp_tree *)osi_last(&sbd.rgtree);
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 21c67989..ffb11342 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -1254,7 +1254,7 @@ static int restore_super(struct metafd *mfd, void *buf, int printonly)
int ret;
lgfs2_sb_in(&sbd, buf);
- ret = check_sb(buf);
+ ret = lgfs2_check_sb(buf);
if (ret < 0) {
fprintf(stderr, "Error: Invalid superblock in metadata file.\n");
return -1;
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index 18522a35..2740fa7d 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -721,7 +721,7 @@ static int fetch_rgrps_level(struct gfs2_sbd *sdp, enum rgindex_trust_level lvl,
if (rindex_repair(sdp, lvl, ok) != 0)
goto fail;
- if (rindex_read(sdp, count, ok) != 0 || !*ok)
+ if (lgfs2_rindex_read(sdp, count, ok) != 0 || !*ok)
goto fail;
ret = read_rgrps(sdp, *count);
@@ -1345,12 +1345,12 @@ static int fill_super_block(struct gfs2_sbd *sdp)
log_crit("%s\n", _("Failed to compute file system constants"));
return FSCK_ERROR;
}
- ret = read_sb(sdp);
+ ret = lgfs2_read_sb(sdp);
if (ret < 0) {
if (sb_repair(sdp) != 0)
return -1; /* unrepairable, so exit */
/* Now that we've tried to repair it, re-read it. */
- ret = read_sb(sdp);
+ ret = lgfs2_read_sb(sdp);
if (ret < 0)
return FSCK_ERROR;
}
diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c
index 8c2dd35d..333a77a5 100644
--- a/gfs2/fsck/rgrepair.c
+++ b/gfs2/fsck/rgrepair.c
@@ -999,7 +999,7 @@ int rindex_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok)
}
/* Read in the rindex */
sdp->rgtree.osi_node = NULL; /* Just to be safe */
- rindex_read(sdp, &sdp->rgrps, ok);
+ lgfs2_rindex_read(sdp, &sdp->rgrps, ok);
if (sdp->md.riinode->i_size % sizeof(struct gfs2_rindex)) {
log_warn( _("WARNING: rindex file has an invalid size.\n"));
if (!query( _("Truncate the rindex size? (y/n)"))) {
diff --git a/gfs2/libgfs2/gfs2l.c b/gfs2/libgfs2/gfs2l.c
index 2ec4a1a1..a247bed2 100644
--- a/gfs2/libgfs2/gfs2l.c
+++ b/gfs2/libgfs2/gfs2l.c
@@ -132,7 +132,7 @@ static int openfs(const char *path, struct gfs2_sbd *sdp)
}
fix_device_geometry(sdp);
- ret = read_sb(sdp);
+ ret = lgfs2_read_sb(sdp);
if (ret != 0) {
perror("Could not read sb");
return 1;
@@ -142,7 +142,7 @@ static int openfs(const char *path, struct gfs2_sbd *sdp)
lgfs2_lookupi(sdp->master_dir, "rindex", 6, &sdp->md.riinode);
sdp->fssize = sdp->device.length;
if (sdp->md.riinode) {
- rindex_read(sdp, &count, &ok);
+ lgfs2_rindex_read(sdp, &count, &ok);
} else {
perror("Failed to look up rindex");
return 1;
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index b204b763..aede5cda 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -778,10 +778,10 @@ extern struct gfs2_inode *lgfs2_build_statfs_change(struct gfs2_inode *per_node,
extern struct gfs2_inode *lgfs2_build_quota_change(struct gfs2_inode *per_node, unsigned int j);
/* super.c */
-extern int check_sb(void *sbp);
-extern int read_sb(struct gfs2_sbd *sdp);
-extern int rindex_read(struct gfs2_sbd *sdp, uint64_t *rgcount, int *ok);
-extern int write_sb(struct gfs2_sbd *sdp);
+extern int lgfs2_check_sb(void *sbp);
+extern int lgfs2_read_sb(struct gfs2_sbd *sdp);
+extern int lgfs2_rindex_read(struct gfs2_sbd *sdp, uint64_t *rgcount, int *ok);
+extern int lgfs2_write_sb(struct gfs2_sbd *sdp);
/* ondisk.c */
extern uint32_t gfs2_disk_hash(const char *data, int len);
diff --git a/gfs2/libgfs2/super.c b/gfs2/libgfs2/super.c
index da605ded..c8186b20 100644
--- a/gfs2/libgfs2/super.c
+++ b/gfs2/libgfs2/super.c
@@ -13,7 +13,7 @@
#include "osi_list.h"
/**
- * check_sb - Check superblock
+ * lgfs2_check_sb - Check superblock
* @sb: The superblock
*
* Checks the version code of the FS is one that we understand how to
@@ -22,7 +22,7 @@
*
* Returns: -1 on failure, 1 if this is gfs (gfs1), 2 if this is gfs2
*/
-int check_sb(void *sbp)
+int lgfs2_check_sb(void *sbp)
{
struct gfs2_sb *sb = sbp;
@@ -48,7 +48,7 @@ int check_sb(void *sbp)
/*
- * read_sb: read the super block from disk
+ * lgfs2_read_sb: read the super block from disk
* sdp: in-core super block
*
* This function reads in the super block from disk and
@@ -58,7 +58,7 @@ int check_sb(void *sbp)
* Returns: 0 on success, -1 on failure
* sdp->gfs1 will be set if this is gfs (gfs1)
*/
-int read_sb(struct gfs2_sbd *sdp)
+int lgfs2_read_sb(struct gfs2_sbd *sdp)
{
struct gfs2_buffer_head *bh;
uint64_t space = 0;
@@ -67,7 +67,7 @@ int read_sb(struct gfs2_sbd *sdp)
bh = lgfs2_bread(sdp, GFS2_SB_ADDR >> sdp->sd_fsb2bb_shift);
- ret = check_sb(bh->b_data);
+ ret = lgfs2_check_sb(bh->b_data);
if (ret < 0) {
lgfs2_brelse(bh);
return ret;
@@ -191,14 +191,14 @@ static int good_on_disk(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
}
/**
- * rindex_read - read in the rg index file
+ * lgfs2_rindex_read - read in the rg index file
* @sdp: the incore superblock pointer
* @rgcount: return count of the rgs.
* @ok: return whether rindex is consistent
*
* Returns: 0 on success, -1 on failure
*/
-int rindex_read(struct gfs2_sbd *sdp, uint64_t *rgcount, int *ok)
+int lgfs2_rindex_read(struct gfs2_sbd *sdp, uint64_t *rgcount, int *ok)
{
unsigned int rg;
int error;
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
index 4ce24c90..298ba2a6 100644
--- a/gfs2/mkfs/main_grow.c
+++ b/gfs2/mkfs/main_grow.c
@@ -398,7 +398,7 @@ int main(int argc, char *argv[])
log_crit("%s\n", _("Failed to compute file system constants"));
exit(EXIT_FAILURE);
}
- if (read_sb(sdp) < 0) {
+ if (lgfs2_read_sb(sdp) < 0) {
fprintf(stderr, _("Error reading superblock.\n"));
exit(EXIT_FAILURE);
}
diff --git a/tests/nukerg.c b/tests/nukerg.c
index 49bbda74..e24151ef 100644
--- a/tests/nukerg.c
+++ b/tests/nukerg.c
@@ -284,7 +284,7 @@ static int fill_super_block(struct gfs2_sbd *sdp)
fprintf(stderr, "Failed to compute file system constants.\n");
return 1;
}
- if (read_sb(sdp) != 0) {
+ if (lgfs2_read_sb(sdp) != 0) {
perror("Failed to read superblock\n");
return 1;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 3 months
[gfs2-utils] 07/21: libgfs2: Namespace improvements - rgrp.c
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch main
in repository gfs2-utils.
commit c03a30d83c28b19f6db97006395959ef06940886
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Jan 17 19:26:57 2022 +0000
libgfs2: Namespace improvements - rgrp.c
Use the lgfs2_ prefix in libgfs2 interface names.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/convert/gfs2_convert.c | 10 +++----
gfs2/edit/hexedit.c | 60 +++++++++++++++++++++---------------------
gfs2/edit/journal.c | 2 +-
gfs2/edit/savemeta.c | 2 +-
gfs2/fsck/fs_recovery.c | 2 +-
gfs2/fsck/fsck.h | 2 +-
gfs2/fsck/initialize.c | 6 ++---
gfs2/fsck/metawalk.c | 2 +-
gfs2/fsck/pass1.c | 2 +-
gfs2/fsck/pass5.c | 4 +--
gfs2/fsck/rgrepair.c | 64 ++++++++++++++++++++++-----------------------
gfs2/fsck/util.h | 2 +-
gfs2/libgfs2/fs_bits.c | 2 +-
gfs2/libgfs2/fs_ops.c | 8 +++---
gfs2/libgfs2/gfs2l.c | 2 +-
gfs2/libgfs2/lang.c | 6 ++---
gfs2/libgfs2/libgfs2.h | 22 ++++++----------
gfs2/libgfs2/rgrp.c | 22 ++++++++--------
gfs2/libgfs2/super.c | 4 +--
19 files changed, 109 insertions(+), 115 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 90964ae1..1608b1ad 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -1532,7 +1532,7 @@ static int gfs1_ri_update(struct gfs2_sbd *sdp, int *rgcount, int quiet)
next = osi_next(n);
rgd = (struct rgrp_tree *)n;
/* Read resource group header */
- errblock = gfs2_rgrp_read(sdp, rgd);
+ errblock = lgfs2_rgrp_read(sdp, rgd);
if (errblock)
return errblock;
count2++;
@@ -1552,7 +1552,7 @@ static int gfs1_ri_update(struct gfs2_sbd *sdp, int *rgcount, int quiet)
return 0;
fail:
- gfs2_rgrp_free(sdp, &sdp->rgtree);
+ lgfs2_rgrp_free(sdp, &sdp->rgtree);
return -1;
}
@@ -1848,7 +1848,7 @@ static int journ_space_to_rg(struct gfs2_sbd *sdp)
ji_addr, rgdhigh->rt_addr);
ri_addr = ji_addr;
/* Allocate a new rgd entry which includes rg and ri. */
- rgd = rgrp_insert(&sdp->rgtree, ri_addr);
+ rgd = lgfs2_rgrp_insert(&sdp->rgtree, ri_addr);
/* convert the gfs1 rgrp into a new gfs2 rgrp */
size = ji_nsegs * be32_to_cpu(gfs1_sb.sb_seg_size);
rgd->rt_flags = 0;
@@ -1866,7 +1866,7 @@ static int journ_space_to_rg(struct gfs2_sbd *sdp)
rgd->rt_free = rgd->rt_data;
rgd->rt_bitbytes = rgd->rt_data / GFS2_NBBY;
- if (gfs2_compute_bitstructs(sdp->sd_bsize, rgd)) {
+ if (lgfs2_compute_bitstructs(sdp->sd_bsize, rgd)) {
log_crit(_("gfs2_convert: Error converting bitmaps.\n"));
exit(-1);
}
@@ -2382,7 +2382,7 @@ int main(int argc, char **argv)
fsync(sb2.device_fd); /* write the buffers to disk */
/* Now free all the in memory */
- gfs2_rgrp_free(&sb2, &sb2.rgtree);
+ lgfs2_rgrp_free(&sb2, &sb2.rgtree);
log_notice(_("Committing changes to disk.\n"));
fflush(stdout);
/* Set filesystem type in superblock to gfs2. We do this at the */
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index ffb714bf..b0f110c1 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -350,9 +350,9 @@ int display_block_type(char *buf, uint64_t addr, int from_restore)
int type;
struct rgrp_tree *rgd;
- rgd = gfs2_blk2rgrpd(&sbd, block);
+ rgd = lgfs2_blk2rgrpd(&sbd, block);
if (rgd) {
- gfs2_rgrp_read(&sbd, rgd);
+ lgfs2_rgrp_read(&sbd, rgd);
if ((be32_to_cpu(mh->mh_type) == GFS2_METATYPE_RG) ||
(be32_to_cpu(mh->mh_type) == GFS2_METATYPE_RB))
type = 4;
@@ -428,7 +428,7 @@ int display_block_type(char *buf, uint64_t addr, int from_restore)
}
}
if (rgd)
- gfs2_rgrp_relse(&sbd, rgd);
+ lgfs2_rgrp_relse(&sbd, rgd);
}
if (block == sbd.sd_root_dir.in_addr)
print_gfs2("--------------- Root directory ------------------");
@@ -693,7 +693,7 @@ static void rgcount(void)
printf("%"PRId64" RGs in this file system.\n",
sbd.md.riinode->i_size / sizeof(struct gfs2_rindex));
lgfs2_inode_put(&sbd.md.riinode);
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
exit(EXIT_SUCCESS);
}
@@ -1154,7 +1154,7 @@ static uint64_t find_metablockoftype_slow(uint64_t startblk, int metatype, int p
else
printf("%"PRIu64"\n", blk);
}
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
if (print)
exit(0);
return blk;
@@ -1216,13 +1216,13 @@ static uint64_t find_metablockoftype_rg(uint64_t startblk, int metatype, int pri
if (!rgd) {
if (print)
printf("0\n");
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
if (print)
exit(-1);
}
for (; !found && next; next = osi_next(next)){
rgd = (struct rgrp_tree *)next;
- errblk = gfs2_rgrp_read(&sbd, rgd);
+ errblk = lgfs2_rgrp_read(&sbd, rgd);
if (errblk)
continue;
@@ -1230,7 +1230,7 @@ static uint64_t find_metablockoftype_rg(uint64_t startblk, int metatype, int pri
if (found)
break;
- gfs2_rgrp_relse(&sbd, rgd);
+ lgfs2_rgrp_relse(&sbd, rgd);
}
if (!found)
@@ -1241,7 +1241,7 @@ static uint64_t find_metablockoftype_rg(uint64_t startblk, int metatype, int pri
else
printf("%"PRIu64"\n", blk);
}
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
if (print)
exit(0);
return blk;
@@ -1275,7 +1275,7 @@ static uint64_t find_metablockoftype(const char *strtype, int print)
"specified: must be one of:\n");
fprintf(stderr, "sb rg rb di in lf jd lh ld"
" ea ed lb 13 qc\n");
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
exit(-1);
}
return blk;
@@ -1589,7 +1589,7 @@ static void find_print_block_type(void)
type = get_block_type(lbh->b_data);
print_block_type(tblock, type);
lgfs2_brelse(lbh);
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
exit(0);
}
@@ -1606,7 +1606,7 @@ static void find_print_block_rg(int bitmap)
if (rblock == LGFS2_SB_ADDR(&sbd))
printf("0 (the superblock is not in the bitmap)\n");
else {
- rgd = gfs2_blk2rgrpd(&sbd, rblock);
+ rgd = lgfs2_blk2rgrpd(&sbd, rblock);
if (rgd) {
rgblock = rgd->rt_addr;
if (bitmap) {
@@ -1632,7 +1632,7 @@ static void find_print_block_rg(int bitmap)
printf("-1 (block invalid or part of an rgrp).\n");
}
}
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
exit(0);
}
@@ -1653,16 +1653,16 @@ static void find_change_block_alloc(int *newval)
*newval);
for (i = GFS2_BLKST_FREE; i <= GFS2_BLKST_DINODE; i++)
printf("%d - %s\n", i, allocdesc[sbd.gfs1][i]);
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
exit(-1);
}
ablock = blockstack[blockhist % BLOCK_STACK_SIZE].block;
if (ablock == LGFS2_SB_ADDR(&sbd))
printf("3 (the superblock is not in the bitmap)\n");
else {
- rgd = gfs2_blk2rgrpd(&sbd, ablock);
+ rgd = lgfs2_blk2rgrpd(&sbd, ablock);
if (rgd) {
- gfs2_rgrp_read(&sbd, rgd);
+ lgfs2_rgrp_read(&sbd, rgd);
if (newval) {
if (lgfs2_set_bitmap(rgd, ablock, *newval))
printf("-1 (block invalid or part of an rgrp).\n");
@@ -1677,14 +1677,14 @@ static void find_change_block_alloc(int *newval)
}
printf("%d (%s)\n", type, allocdesc[sbd.gfs1][type]);
}
- gfs2_rgrp_relse(&sbd, rgd);
+ lgfs2_rgrp_relse(&sbd, rgd);
} else {
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
printf("-1 (block invalid or part of an rgrp).\n");
exit(-1);
}
}
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
if (newval)
fsync(sbd.device_fd);
exit(0);
@@ -2184,8 +2184,8 @@ static void rg_repair(void)
/* Walk through the resource groups saving everything within */
for (n = osi_first(&sbd.rgtree); n; n = osi_next(n)) {
rgd = (struct rgrp_tree *)n;
- if (gfs2_rgrp_read(&sbd, rgd) == 0) { /* was read in okay */
- gfs2_rgrp_relse(&sbd, rgd);
+ if (lgfs2_rgrp_read(&sbd, rgd) == 0) { /* was read in okay */
+ lgfs2_rgrp_relse(&sbd, rgd);
continue; /* ignore it */
}
/* If we get here, it's because we have an rgrp in the rindex
@@ -2374,7 +2374,7 @@ static void process_parameters(int argc, char *argv[], int pass)
printf("Error: field not specified.\n");
printf("Format is: %s -p <block> field "
"<field> [newvalue]\n", argv[0]);
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
exit(EXIT_FAILURE);
}
process_field(argv[i], argv[i + 1]);
@@ -2407,7 +2407,7 @@ static void process_parameters(int argc, char *argv[], int pass)
printf("Error: rg # not specified.\n");
printf("Format is: %s rgflags rgnum"
"[newvalue]\n", argv[0]);
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
exit(EXIT_FAILURE);
}
if (argv[i][0]=='0' && argv[i][1]=='x')
@@ -2424,7 +2424,7 @@ static void process_parameters(int argc, char *argv[], int pass)
new_flags = atoi(argv[i]);
}
set_rgrp_flags(rg, new_flags, set, FALSE);
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
exit(EXIT_SUCCESS);
} else if (!strcmp(argv[i], "rg")) {
int rg;
@@ -2433,7 +2433,7 @@ static void process_parameters(int argc, char *argv[], int pass)
if (i >= argc - 1) {
printf("Error: rg # not specified.\n");
printf("Format is: %s rg rgnum\n", argv[0]);
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
exit(EXIT_FAILURE);
}
rg = atoi(argv[i]);
@@ -2442,7 +2442,7 @@ static void process_parameters(int argc, char *argv[], int pass)
push_block(temp_blk);
} else {
set_rgrp_flags(rg, 0, FALSE, TRUE);
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
exit(EXIT_SUCCESS);
}
} else if (!strcmp(argv[i], "rgbitmaps")) {
@@ -2455,15 +2455,15 @@ static void process_parameters(int argc, char *argv[], int pass)
printf("Error: rg # not specified.\n");
printf("Format is: %s rgbitmaps rgnum\n",
argv[0]);
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
exit(EXIT_FAILURE);
}
rg = atoi(argv[i]);
rgblk = get_rg_addr(rg);
- rgd = gfs2_blk2rgrpd(&sbd, rgblk);
+ rgd = lgfs2_blk2rgrpd(&sbd, rgblk);
if (rgd == NULL) {
printf("Error: rg # is invalid.\n");
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
exit(EXIT_FAILURE);
}
for (bmap = 0; bmap < rgd->rt_length; bmap++)
@@ -2574,7 +2574,7 @@ int main(int argc, char *argv[])
close(fd);
if (indirect)
free(indirect);
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
exit(EXIT_SUCCESS);
}
#endif /* UNITTESTS */
diff --git a/gfs2/edit/journal.c b/gfs2/edit/journal.c
index 91d0a925..2bc94514 100644
--- a/gfs2/edit/journal.c
+++ b/gfs2/edit/journal.c
@@ -546,7 +546,7 @@ void dump_journal(const char *journal, uint64_t tblk)
if (tblk) {
uint64_t wp;
- rgd = gfs2_blk2rgrpd(&sbd, tblk);
+ rgd = lgfs2_blk2rgrpd(&sbd, tblk);
if (!rgd) {
print_gfs2("Can't locate the rgrp for block 0x%"PRIx64,
tblk);
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 1d22df2e..21c67989 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -1207,7 +1207,7 @@ void savemeta(char *out_fn, int saveoption, int gziplevel)
close(sbd.device_fd);
destroy_per_node_lookup();
free(indirect);
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
exit(0);
}
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
index 6f186c92..bd0fd731 100644
--- a/gfs2/fsck/fs_recovery.c
+++ b/gfs2/fsck/fs_recovery.c
@@ -167,7 +167,7 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
error = -EIO;
} else {
lgfs2_bmodified(bh_ip);
- rgd = gfs2_blk2rgrpd(sdp, blkno);
+ rgd = lgfs2_blk2rgrpd(sdp, blkno);
if (rgd && blkno < rgd->rt_data0)
refresh_rgrp(sdp, rgd, bh_ip, blkno);
}
diff --git a/gfs2/fsck/fsck.h b/gfs2/fsck/fsck.h
index 7b991614..055ae975 100644
--- a/gfs2/fsck/fsck.h
+++ b/gfs2/fsck/fsck.h
@@ -183,7 +183,7 @@ static inline int valid_block_ip(struct gfs2_inode *ip, uint64_t blk)
if (blk <= LGFS2_SB_ADDR(sdp))
return 0;
if (rgd == NULL || !rgrp_contains_block(rgd, blk)) {
- rgd = gfs2_blk2rgrpd(sdp, blk);
+ rgd = lgfs2_blk2rgrpd(sdp, blk);
if (rgd == NULL)
return 0;
}
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index f1586374..18522a35 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -112,7 +112,7 @@ static void gfs2_inodetree_free(void)
static void empty_super_block(struct gfs2_sbd *sdp)
{
log_info( _("Freeing buffers.\n"));
- gfs2_rgrp_free(sdp, &sdp->rgtree);
+ lgfs2_rgrp_free(sdp, &sdp->rgtree);
gfs2_inodetree_free();
gfs2_dirtree_free();
@@ -675,7 +675,7 @@ static int read_rgrps(struct gfs2_sbd *sdp, uint64_t expected)
if (ra_window < RA_WINDOW/2)
ra_window = gfs2_rgrp_reada(sdp, ra_window, n);
/* Read resource group header */
- errblock = gfs2_rgrp_read(sdp, rgd);
+ errblock = lgfs2_rgrp_read(sdp, rgd);
if (errblock)
return errblock;
ra_window--;
@@ -693,7 +693,7 @@ static int read_rgrps(struct gfs2_sbd *sdp, uint64_t expected)
fail:
posix_fadvise(sdp->device_fd, 0, 0, POSIX_FADV_NORMAL);
- gfs2_rgrp_free(sdp, &sdp->rgtree);
+ lgfs2_rgrp_free(sdp, &sdp->rgtree);
return -1;
}
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index a401e792..2612b0cb 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -44,7 +44,7 @@ int check_n_fix_bitmap(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
if (prevrgd && rgrp_contains_block(prevrgd, blk)) {
rgd = prevrgd;
} else if (rgd == NULL || !rgrp_contains_block(rgd, blk)) {
- rgd = gfs2_blk2rgrpd(sdp, blk);
+ rgd = lgfs2_blk2rgrpd(sdp, blk);
prevrgd = rgd;
}
old_state = lgfs2_get_bitmap(sdp, blk, rgd);
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 2b3379a7..f747a7a5 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -430,7 +430,7 @@ static int undo_reference(struct gfs2_inode *ip, uint64_t block, int meta,
}
}
if (!meta) {
- rgd = gfs2_blk2rgrpd(ip->i_sbd, block);
+ rgd = lgfs2_blk2rgrpd(ip->i_sbd, block);
old_bitmap_state = lgfs2_get_bitmap(ip->i_sbd, block, rgd);
if (old_bitmap_state == GFS2_BLKST_DINODE)
return -1;
diff --git a/gfs2/fsck/pass5.c b/gfs2/fsck/pass5.c
index 976c8641..9aba38e6 100644
--- a/gfs2/fsck/pass5.c
+++ b/gfs2/fsck/pass5.c
@@ -68,7 +68,7 @@ static int check_block_status(struct gfs2_sbd *sdp, struct gfs2_bmap *bl,
block, block);
if (query(_("Do you want to reclaim the block? "
"(y/n) "))) {
- lgfs2_rgrp_t rg = gfs2_blk2rgrpd(sdp, block);
+ lgfs2_rgrp_t rg = lgfs2_blk2rgrpd(sdp, block);
if (lgfs2_set_bitmap(rg, block, GFS2_BLKST_FREE))
log_err(_("Unlinked block %"PRIu64" (0x%"PRIx64") bitmap not fixed.\n"),
block, block);
@@ -93,7 +93,7 @@ static int check_block_status(struct gfs2_sbd *sdp, struct gfs2_bmap *bl,
if (query(_("Fix bitmap for block %"PRIu64" (0x%"PRIx64")? (y/n) "),
block, block)) {
- lgfs2_rgrp_t rg = gfs2_blk2rgrpd(sdp, block);
+ lgfs2_rgrp_t rg = lgfs2_blk2rgrpd(sdp, block);
if (lgfs2_set_bitmap(rg, block, q))
log_err( _("Repair failed.\n"));
else
diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c
index 6f15d2d4..8c2dd35d 100644
--- a/gfs2/fsck/rgrepair.c
+++ b/gfs2/fsck/rgrepair.c
@@ -557,7 +557,7 @@ static int rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs, int gfs_grow)
rg_was_fnd = (!lgfs2_check_meta(bh->b_data, GFS2_METATYPE_RG));
lgfs2_brelse(bh);
/* Allocate a new RG and index. */
- calc_rgd = rgrp_insert(&rgcalc, blk);
+ calc_rgd = lgfs2_rgrp_insert(&rgcalc, blk);
if (!calc_rgd) {
log_crit( _("Can't allocate memory for rgrp repair.\n"));
goto out;
@@ -597,7 +597,7 @@ static int rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs, int gfs_grow)
if (prev_rgd) {
uint32_t rgblocks;
- prev_rgd->rt_length = rgblocks2bitblocks(sdp->sd_bsize, block_bump, &rgblocks);
+ prev_rgd->rt_length = lgfs2_rgblocks2bitblocks(sdp->sd_bsize, block_bump, &rgblocks);
prev_rgd->rt_data = rgblocks;
prev_rgd->rt_data0 = prev_rgd->rt_addr +
prev_rgd->rt_length;
@@ -657,7 +657,7 @@ static int rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs, int gfs_grow)
if (prev_rgd && !prev_rgd->rt_data) {
uint32_t rgblocks;
- prev_rgd->rt_length = rgblocks2bitblocks(sdp->sd_bsize, block_bump, &rgblocks);
+ prev_rgd->rt_length = lgfs2_rgblocks2bitblocks(sdp->sd_bsize, block_bump, &rgblocks);
prev_rgd->rt_data0 = prev_rgd->rt_addr + prev_rgd->rt_length;
prev_rgd->rt_data = rgblocks;
prev_rgd->rt_data -= prev_rgd->rt_data % GFS2_NBBY;
@@ -705,9 +705,9 @@ static uint64_t how_many_rgrps(struct gfs2_sbd *sdp, struct device *dev)
nrgrp = DIV_RU(dev->length, (sdp->rgsize << 20) / sdp->sd_bsize);
/* check to see if the rg length overflows max # bitblks */
- bitblocksn = rgblocks2bitblocks(sdp->sd_bsize, dev->length / nrgrp, &rgblocksn);
+ bitblocksn = lgfs2_rgblocks2bitblocks(sdp->sd_bsize, dev->length / nrgrp, &rgblocksn);
/* calculate size of the first rgrp */
- bitblocks1 = rgblocks2bitblocks(sdp->sd_bsize, dev->length - (nrgrp - 1) * (dev->length / nrgrp),
+ bitblocks1 = lgfs2_rgblocks2bitblocks(sdp->sd_bsize, dev->length - (nrgrp - 1) * (dev->length / nrgrp),
&rgblocks1);
if (bitblocks1 <= 2149 && bitblocksn <= 2149)
break;
@@ -749,11 +749,11 @@ static struct osi_root compute_rgrp_layout(struct gfs2_sbd *sdp)
for (; rgrp < nrgrp; rgrp++) {
if (rgrp) {
rgaddr = rlast->rt_addr + rlast->rt_skip;
- rl = rgrp_insert(&rgtree, rgaddr);
+ rl = lgfs2_rgrp_insert(&rgtree, rgaddr);
rl->rt_skip = rglength;
} else {
rgaddr = LGFS2_SB_ADDR(sdp) + 1;
- rl = rgrp_insert(&rgtree, rgaddr);
+ rl = lgfs2_rgrp_insert(&rgtree, rgaddr);
rl->rt_skip = dev->length -
(nrgrp - 1) * (dev->length / nrgrp);
}
@@ -774,7 +774,7 @@ static int calc_rgrps(struct gfs2_sbd *sdp)
next = osi_next(n);
rl = (struct rgrp_tree *)n;
- bitblocks = rgblocks2bitblocks(sdp->sd_bsize, rl->rt_skip, &rgblocks);
+ bitblocks = lgfs2_rgblocks2bitblocks(sdp->sd_bsize, rl->rt_skip, &rgblocks);
rl->rt_length = bitblocks;
rl->rt_data0 = rl->rt_addr + bitblocks;
@@ -782,7 +782,7 @@ static int calc_rgrps(struct gfs2_sbd *sdp)
rl->rt_bitbytes = rgblocks / GFS2_NBBY;
rl->rt_free = rgblocks;
- if (gfs2_compute_bitstructs(sdp->sd_bsize, rl))
+ if (lgfs2_compute_bitstructs(sdp->sd_bsize, rl))
return -1;
sdp->blks_total += rgblocks;
@@ -911,7 +911,7 @@ static int expect_rindex_sanity(struct gfs2_sbd *sdp, int *num_rgs)
for (n = osi_first(&sdp->rgtree); n; n = next) {
next = osi_next(n);
rgd = (struct rgrp_tree *)n;
- exp = rgrp_insert(&rgcalc, rgd->rt_addr);
+ exp = lgfs2_rgrp_insert(&rgcalc, rgd->rt_addr);
if (exp == NULL) {
fprintf(stderr, "Out of memory in %s\n", __FUNCTION__);
exit(-1);
@@ -926,7 +926,7 @@ static int expect_rindex_sanity(struct gfs2_sbd *sdp, int *num_rgs)
exp->rt_dinodes = rgd->rt_dinodes;
exp->rt_skip = rgd->rt_skip;
exp->bits = NULL;
- gfs2_compute_bitstructs(sdp->sd_bsize, exp);
+ lgfs2_compute_bitstructs(sdp->sd_bsize, exp);
}
sdp->rgrps = *num_rgs;
return 0;
@@ -955,7 +955,7 @@ int rindex_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok)
if (trust_lvl == YE_OF_LITTLE_FAITH) { /* if rindex seems sane */
/* Don't free previous incarnations in memory, if any.
* We need them to copy in the next function:
- * gfs2_rgrp_free(&sdp->rglist); */
+ * lgfs2_rgrp_free(&sdp->rglist); */
if (!(*ok)) {
log_err(_("The rindex file does not meet our "
"expectations.\n"));
@@ -963,37 +963,37 @@ int rindex_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok)
}
error = expect_rindex_sanity(sdp, &calc_rg_count);
if (error) {
- gfs2_rgrp_free(sdp, &rgcalc);
+ lgfs2_rgrp_free(sdp, &rgcalc);
return error;
}
} else if (trust_lvl == OPEN_MINDED) { /* If we can't trust RG index */
/* Free previous incarnations in memory, if any. */
- gfs2_rgrp_free(sdp, &sdp->rgtree);
+ lgfs2_rgrp_free(sdp, &sdp->rgtree);
/* Calculate our own RG index for comparison */
error = gfs2_rindex_calculate(sdp, &calc_rg_count);
if (error) { /* If calculated RGs don't match the fs */
- gfs2_rgrp_free(sdp, &rgcalc);
+ lgfs2_rgrp_free(sdp, &rgcalc);
return -1;
}
} else if (trust_lvl == DISTRUST) { /* If we can't trust RG index */
/* Free previous incarnations in memory, if any. */
- gfs2_rgrp_free(sdp, &sdp->rgtree);
+ lgfs2_rgrp_free(sdp, &sdp->rgtree);
error = rindex_rebuild(sdp, &calc_rg_count, 0);
if (error) {
log_crit( _("Error rebuilding rgrp list.\n"));
- gfs2_rgrp_free(sdp, &rgcalc);
+ lgfs2_rgrp_free(sdp, &rgcalc);
return -1;
}
} else if (trust_lvl == INDIGNATION) { /* If we can't trust anything */
/* Free previous incarnations in memory, if any. */
- gfs2_rgrp_free(sdp, &sdp->rgtree);
+ lgfs2_rgrp_free(sdp, &sdp->rgtree);
error = rindex_rebuild(sdp, &calc_rg_count, 1);
if (error) {
log_crit( _("Error rebuilding rgrp list.\n"));
- gfs2_rgrp_free(sdp, &rgcalc);
+ lgfs2_rgrp_free(sdp, &rgcalc);
return -1;
}
}
@@ -1004,8 +1004,8 @@ int rindex_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok)
log_warn( _("WARNING: rindex file has an invalid size.\n"));
if (!query( _("Truncate the rindex size? (y/n)"))) {
log_err(_("The rindex was not repaired.\n"));
- gfs2_rgrp_free(sdp, &rgcalc);
- gfs2_rgrp_free(sdp, &sdp->rgtree);
+ lgfs2_rgrp_free(sdp, &rgcalc);
+ lgfs2_rgrp_free(sdp, &sdp->rgtree);
return -1;
}
sdp->md.riinode->i_size /= sizeof(struct gfs2_rindex);
@@ -1028,8 +1028,8 @@ int rindex_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok)
then try again with a little more DISTRUST. */
if ((trust_lvl < DISTRUST) ||
!query( _("Attempt to use what rgrps we can? (y/n)"))) {
- gfs2_rgrp_free(sdp, &rgcalc);
- gfs2_rgrp_free(sdp, &sdp->rgtree);
+ lgfs2_rgrp_free(sdp, &rgcalc);
+ lgfs2_rgrp_free(sdp, &sdp->rgtree);
log_err(_("The rindex was not repaired.\n"));
return -1;
}
@@ -1094,8 +1094,8 @@ int rindex_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok)
log_warn( _("%d out of %d rgrps (%d percent) did not "
"match what was expected.\n"),
discrepancies, rg, percent);
- gfs2_rgrp_free(sdp, &rgcalc);
- gfs2_rgrp_free(sdp, &sdp->rgtree);
+ lgfs2_rgrp_free(sdp, &rgcalc);
+ lgfs2_rgrp_free(sdp, &sdp->rgtree);
return -1;
}
}
@@ -1124,7 +1124,7 @@ int rindex_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok)
expected->rt_addr < actual->rt_addr) {
log_err(_("Entry missing from rindex: 0x%"PRIx64"\n"),
expected->rt_addr);
- actual = rgrp_insert(&sdp->rgtree, expected->rt_addr);
+ actual = lgfs2_rgrp_insert(&sdp->rgtree, expected->rt_addr);
if (!actual) {
log_err(_("Out of memory!\n"));
break;
@@ -1152,7 +1152,7 @@ int rindex_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok)
actual->rt_data = expected->rt_data;
actual->rt_bitbytes = expected->rt_bitbytes;
/* If our rindex was hosed, ri_length is bad */
- /* Therefore, gfs2_compute_bitstructs might */
+ /* Therefore, lgfs2_compute_bitstructs might */
/* have malloced the wrong length for bitmap */
/* buffers. So we have to redo it. */
if (actual->bits) {
@@ -1162,7 +1162,7 @@ int rindex_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok)
}
else
log_err( _("rindex not fixed.\n"));
- gfs2_compute_bitstructs(sdp->sd_bsize, actual);
+ lgfs2_compute_bitstructs(sdp->sd_bsize, actual);
rindex_modified = 0;
}
e = enext;
@@ -1186,21 +1186,21 @@ int rindex_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok)
i = 0;
do {
rgd = (struct rgrp_tree *)n;
- errblock = gfs2_rgrp_read(sdp, rgd);
+ errblock = lgfs2_rgrp_read(sdp, rgd);
if (errblock) {
if (errblock == prev_err)
break;
prev_err = errblock;
rewrite_rg_block(sdp, rgd, errblock);
} else {
- gfs2_rgrp_relse(sdp, rgd);
+ lgfs2_rgrp_relse(sdp, rgd);
break;
}
i++;
} while (i < rgd->rt_length);
}
- gfs2_rgrp_free(sdp, &rgcalc);
- gfs2_rgrp_free(sdp, &sdp->rgtree);
+ lgfs2_rgrp_free(sdp, &rgcalc);
+ lgfs2_rgrp_free(sdp, &sdp->rgtree);
/* We shouldn't need to worry about getting the user's permission to
make changes here. If b_modified is true, they already gave their
permission. */
diff --git a/gfs2/fsck/util.h b/gfs2/fsck/util.h
index ae654bf4..278ac139 100644
--- a/gfs2/fsck/util.h
+++ b/gfs2/fsck/util.h
@@ -68,7 +68,7 @@ static inline int bitmap_type(struct gfs2_sbd *sdp, uint64_t bblock)
{
struct rgrp_tree *rgd;
- rgd = gfs2_blk2rgrpd(sdp, bblock);
+ rgd = lgfs2_blk2rgrpd(sdp, bblock);
return lgfs2_get_bitmap(sdp, bblock, rgd);
}
diff --git a/gfs2/libgfs2/fs_bits.c b/gfs2/libgfs2/fs_bits.c
index 940ebf3c..db5e2772 100644
--- a/gfs2/libgfs2/fs_bits.c
+++ b/gfs2/libgfs2/fs_bits.c
@@ -183,7 +183,7 @@ int lgfs2_get_bitmap(struct gfs2_sbd *sdp, uint64_t blkno, struct rgrp_tree *rgd
struct gfs2_bitmap *bi;
if (rgd == NULL) {
- rgd = gfs2_blk2rgrpd(sdp, blkno);
+ rgd = lgfs2_blk2rgrpd(sdp, blkno);
if(rgd == NULL)
return -1;
}
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index 1d5ef8e6..4e10ab4f 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -178,7 +178,7 @@ static int block_alloc(struct gfs2_sbd *sdp, const uint64_t blksreq, int state,
return -1;
if (rgt->bits[0].bi_data == NULL) {
- if (gfs2_rgrp_read(sdp, rgt))
+ if (lgfs2_rgrp_read(sdp, rgt))
return -1;
release = 1;
}
@@ -186,7 +186,7 @@ static int block_alloc(struct gfs2_sbd *sdp, const uint64_t blksreq, int state,
bn = find_free_block(rgt);
ret = blk_alloc_in_rg(sdp, state, rgt, bn, dinode);
if (release)
- gfs2_rgrp_relse(sdp, rgt);
+ lgfs2_rgrp_relse(sdp, rgt);
*blkno = bn;
return ret;
}
@@ -1900,7 +1900,7 @@ void lgfs2_free_block(struct gfs2_sbd *sdp, uint64_t block)
struct rgrp_tree *rgd;
/* Adjust the free space count for the freed block */
- rgd = gfs2_blk2rgrpd(sdp, block); /* find the rg for indir block */
+ rgd = lgfs2_blk2rgrpd(sdp, block); /* find the rg for indir block */
if (rgd) {
lgfs2_set_bitmap(rgd, block, GFS2_BLKST_FREE);
rgd->rt_free++; /* adjust the free count */
@@ -1967,7 +1967,7 @@ int lgfs2_freedi(struct gfs2_sbd *sdp, uint64_t diblock)
}
}
}
- rgd = gfs2_blk2rgrpd(sdp, diblock);
+ rgd = lgfs2_blk2rgrpd(sdp, diblock);
lgfs2_set_bitmap(rgd, diblock, GFS2_BLKST_FREE);
lgfs2_inode_put(&ip);
/* lgfs2_inode_put deallocated the extra block used by the disk inode, */
diff --git a/gfs2/libgfs2/gfs2l.c b/gfs2/libgfs2/gfs2l.c
index c31748b0..2ec4a1a1 100644
--- a/gfs2/libgfs2/gfs2l.c
+++ b/gfs2/libgfs2/gfs2l.c
@@ -190,7 +190,7 @@ int main(int argc, char *argv[])
lgfs2_lang_result_free(&result);
}
- gfs2_rgrp_free(&sbd, &sbd.rgtree);
+ lgfs2_rgrp_free(&sbd, &sbd.rgtree);
lgfs2_inode_put(&sbd.md.riinode);
lgfs2_inode_put(&sbd.master_dir);
lgfs2_lang_free(&state);
diff --git a/gfs2/libgfs2/lang.c b/gfs2/libgfs2/lang.c
index 57849e60..e1c5aba0 100644
--- a/gfs2/libgfs2/lang.c
+++ b/gfs2/libgfs2/lang.c
@@ -365,13 +365,13 @@ static int ast_get_bitstate(uint64_t bn, struct gfs2_sbd *sbd)
{
int ret = 0;
int state = 0;
- struct rgrp_tree *rgd = gfs2_blk2rgrpd(sbd, bn);
+ struct rgrp_tree *rgd = lgfs2_blk2rgrpd(sbd, bn);
if (rgd == NULL) {
fprintf(stderr, "Could not find resource group for block %"PRIu64"\n", bn);
return -1;
}
- ret = gfs2_rgrp_read(sbd, rgd);
+ ret = lgfs2_rgrp_read(sbd, rgd);
if (ret != 0) {
fprintf(stderr, "Failed to read resource group for block %"PRIu64": %d\n", bn, ret);
return -1;
@@ -383,7 +383,7 @@ static int ast_get_bitstate(uint64_t bn, struct gfs2_sbd *sbd)
return -1;
}
- gfs2_rgrp_relse(sbd, rgd);
+ lgfs2_rgrp_relse(sbd, rgd);
return state;
}
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 5eb08baf..b204b763 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -490,9 +490,6 @@ extern int lgfs2_check_range(struct gfs2_sbd *sdp, uint64_t blkno);
extern int lgfs2_get_bitmap(struct gfs2_sbd *sdp, uint64_t blkno, struct rgrp_tree *rgd);
extern int lgfs2_set_bitmap(lgfs2_rgrp_t rg, uint64_t blkno, int state);
-extern uint32_t rgblocks2bitblocks(const unsigned int bsize, const uint32_t rgblocks,
- uint32_t *ri_data) __attribute__((nonnull(3)));
-
/* fs_ops.c */
#define IS_LEAF (1)
#define IS_DINODE (2)
@@ -746,20 +743,17 @@ extern int lgfs2_find_jhead(struct gfs2_inode *ip, struct lgfs2_log_header *head
extern int lgfs2_clean_journal(struct gfs2_inode *ip, struct lgfs2_log_header *head);
/* rgrp.c */
-extern int gfs2_compute_bitstructs(const uint32_t bsize, struct rgrp_tree *rgd);
-extern struct rgrp_tree *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, uint64_t blk);
+extern uint32_t lgfs2_rgblocks2bitblocks(const unsigned int bsize, const uint32_t rgblocks,
+ uint32_t *ri_data) __attribute__((nonnull(3)));
+extern int lgfs2_compute_bitstructs(const uint32_t bsize, struct rgrp_tree *rgd);
+extern struct rgrp_tree *lgfs2_blk2rgrpd(struct gfs2_sbd *sdp, uint64_t blk);
extern int lgfs2_rgrp_crc_check(char *buf);
extern void lgfs2_rgrp_crc_set(char *buf);
-extern uint64_t gfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_tree *rgd);
-extern void gfs2_rgrp_relse(struct gfs2_sbd *sdp, struct rgrp_tree *rgd);
-extern struct rgrp_tree *rgrp_insert(struct osi_root *rgtree,
+extern uint64_t lgfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_tree *rgd);
+extern void lgfs2_rgrp_relse(struct gfs2_sbd *sdp, struct rgrp_tree *rgd);
+extern struct rgrp_tree *lgfs2_rgrp_insert(struct osi_root *rgtree,
uint64_t rgblock);
-extern void gfs2_rgrp_free(struct gfs2_sbd *sdp, struct osi_root *rgrp_tree);
-/* figure out the size of the given resource group, in blocks */
-static inline unsigned int rgrp_size(struct rgrp_tree *rgrp)
-{
- return rgrp->rt_data + rgrp->rt_length;
-}
+extern void lgfs2_rgrp_free(struct gfs2_sbd *sdp, struct osi_root *rgrp_tree);
/* structures.c */
extern int lgfs2_build_master(struct gfs2_sbd *sdp);
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index 39b8b69b..a359f2fe 100644
--- a/gfs2/libgfs2/rgrp.c
+++ b/gfs2/libgfs2/rgrp.c
@@ -30,12 +30,12 @@ static void compute_bitmaps(lgfs2_rgrp_t rg, const unsigned bsize)
}
/**
- * gfs2_compute_bitstructs - Compute the bitmap sizes
+ * lgfs2_compute_bitstructs - Compute the bitmap sizes
* bsize: Block size
* rgd: The resource group descriptor
* Returns: 0 on success, -1 on error
*/
-int gfs2_compute_bitstructs(const uint32_t bsize, struct rgrp_tree *rgd)
+int lgfs2_compute_bitstructs(const uint32_t bsize, struct rgrp_tree *rgd)
{
uint32_t length = rgd->rt_length;
uint32_t bytes_left;
@@ -86,7 +86,7 @@ errbits:
*
* Returns: Ths resource group, or NULL if not found
*/
-struct rgrp_tree *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, uint64_t blk)
+struct rgrp_tree *lgfs2_blk2rgrpd(struct gfs2_sbd *sdp, uint64_t blk)
{
struct rgrp_tree *rgd = (struct rgrp_tree *)sdp->rgtree.osi_node;
while (rgd) {
@@ -183,11 +183,11 @@ void lgfs2_rgrp_crc_set(char *buf)
}
/**
- * gfs2_rgrp_read - read in the resource group information from disk.
+ * lgfs2_rgrp_read - read in the resource group information from disk.
* @rgd - resource group structure
* returns: 0 if no error, otherwise the block number that failed
*/
-uint64_t gfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
+uint64_t lgfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
{
unsigned length = rgd->rt_length * sdp->sd_bsize;
off_t offset = rgd->rt_addr * sdp->sd_bsize;
@@ -227,7 +227,7 @@ uint64_t gfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
return 0;
}
-void gfs2_rgrp_relse(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
+void lgfs2_rgrp_relse(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
{
if (rgd->bits == NULL)
return;
@@ -250,7 +250,7 @@ void gfs2_rgrp_relse(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
rgd->bits[i].bi_data = NULL;
}
-struct rgrp_tree *rgrp_insert(struct osi_root *rgtree, uint64_t rgblock)
+struct rgrp_tree *lgfs2_rgrp_insert(struct osi_root *rgtree, uint64_t rgblock)
{
struct osi_node **newn = &rgtree->osi_node, *parent = NULL;
struct rgrp_tree *data;
@@ -279,7 +279,7 @@ struct rgrp_tree *rgrp_insert(struct osi_root *rgtree, uint64_t rgblock)
return data;
}
-void gfs2_rgrp_free(struct gfs2_sbd *sdp, struct osi_root *rgrp_tree)
+void lgfs2_rgrp_free(struct gfs2_sbd *sdp, struct osi_root *rgrp_tree)
{
struct rgrp_tree *rgd;
struct osi_node *n;
@@ -289,7 +289,7 @@ void gfs2_rgrp_free(struct gfs2_sbd *sdp, struct osi_root *rgrp_tree)
while ((n = osi_first(rgrp_tree))) {
rgd = (struct rgrp_tree *)n;
- gfs2_rgrp_relse(sdp, rgd);
+ lgfs2_rgrp_relse(sdp, rgd);
free(rgd->bits);
rgd->bits = NULL;
osi_erase(&rgd->node, rgrp_tree);
@@ -523,7 +523,7 @@ void lgfs2_rgrps_free(lgfs2_rgrps_t *rgs)
* needed for bitmaps. Also calculate the adjusted number of free data blocks
* in the resource group and store it in *ri_data.
*/
-uint32_t rgblocks2bitblocks(const unsigned int bsize, const uint32_t rgblocks, uint32_t *ri_data)
+uint32_t lgfs2_rgblocks2bitblocks(const unsigned int bsize, const uint32_t rgblocks, uint32_t *ri_data)
{
uint32_t mappable = 0;
uint32_t bitblocks = 0;
@@ -579,7 +579,7 @@ uint64_t lgfs2_rindex_entry_new(lgfs2_rgrps_t rgs, struct gfs2_rindex *ri, uint6
if (addr + len > rgs->sdp->device.length)
return 0;
- ri_length = rgblocks2bitblocks(rgs->sdp->sd_bsize, len, &ri_data);
+ ri_length = lgfs2_rgblocks2bitblocks(rgs->sdp->sd_bsize, len, &ri_data);
ri->ri_addr = cpu_to_be64(addr);
ri->ri_length = cpu_to_be32(ri_length);
ri->ri_data = cpu_to_be32(ri_data);
diff --git a/gfs2/libgfs2/super.c b/gfs2/libgfs2/super.c
index 15f89a30..da605ded 100644
--- a/gfs2/libgfs2/super.c
+++ b/gfs2/libgfs2/super.c
@@ -228,7 +228,7 @@ int rindex_read(struct gfs2_sbd *sdp, uint64_t *rgcount, int *ok)
continue;
addr = prev_rgd->rt_data0 + prev_rgd->rt_data;
}
- rgd = rgrp_insert(&sdp->rgtree, addr);
+ rgd = lgfs2_rgrp_insert(&sdp->rgtree, addr);
rgd->rt_length = be32_to_cpu(ri.ri_length);
rgd->rt_data0 = be64_to_cpu(ri.ri_data0);
rgd->rt_data = be32_to_cpu(ri.ri_data);
@@ -248,7 +248,7 @@ int rindex_read(struct gfs2_sbd *sdp, uint64_t *rgcount, int *ok)
prev_length = rgd->rt_addr - prev_rgd->rt_addr;
}
- if(gfs2_compute_bitstructs(sdp->sd_bsize, rgd))
+ if(lgfs2_compute_bitstructs(sdp->sd_bsize, rgd))
*ok = 0;
(*rgcount)++;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 3 months
[gfs2-utils] 06/21: libgfs2: Namespace improvements - misc.c
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch main
in repository gfs2-utils.
commit 3652f2a98e9f3160e67618a3e59a92291b0f68fc
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Jan 17 18:17:22 2022 +0000
libgfs2: Namespace improvements - misc.c
Use the lgfs2_ prefix in libgfs2 interface names.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/convert/gfs2_convert.c | 12 ++++++------
gfs2/edit/hexedit.c | 2 +-
gfs2/fsck/initialize.c | 2 +-
gfs2/libgfs2/check_rgrp.c | 2 +-
gfs2/libgfs2/gfs2l.c | 2 +-
gfs2/libgfs2/libgfs2.h | 4 ++--
gfs2/libgfs2/misc.c | 8 ++++----
gfs2/mkfs/main_grow.c | 2 +-
gfs2/mkfs/main_jadd.c | 2 +-
gfs2/mkfs/main_mkfs.c | 2 +-
tests/nukerg.c | 2 +-
11 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 9bf92ed4..90964ae1 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -1585,7 +1585,7 @@ static int init(struct gfs2_sbd *sbp, struct gfs2_options *opts)
sbp->dinodes_alloced = 0; /* dinodes allocated - total them up later */
sbp->sd_bsize = GFS2_DEFAULT_BSIZE;
sbp->rgtree.osi_node = NULL;
- if (compute_constants(sbp)) {
+ if (lgfs2_compute_constants(sbp)) {
log_crit("%s\n", _("Failed to compute file system constants"));
exit(-1);
}
@@ -1605,13 +1605,13 @@ static int init(struct gfs2_sbd *sbp, struct gfs2_options *opts)
sizeof(uint64_t);
sbp->sd_jbsize = sbp->sd_bsize - sizeof(struct gfs2_meta_header);
lgfs2_brelse(bh);
- if (compute_heightsize(sbp->sd_bsize, sbp->sd_heightsize, &sbp->sd_max_height,
+ if (lgfs2_compute_heightsize(sbp->sd_bsize, sbp->sd_heightsize, &sbp->sd_max_height,
sbp->sd_bsize, sbp->sd_diptrs, sbp->sd_inptrs)) {
log_crit("%s\n", _("Failed to compute file system constants"));
exit(-1);
}
- if (compute_heightsize(sbp->sd_bsize, sbp->sd_jheightsize, &sbp->sd_max_jheight,
+ if (lgfs2_compute_heightsize(sbp->sd_bsize, sbp->sd_jheightsize, &sbp->sd_max_jheight,
sbp->sd_jbsize, sbp->sd_diptrs, sbp->sd_inptrs)) {
log_crit("%s\n", _("Failed to compute file system constants"));
exit(-1);
@@ -1622,13 +1622,13 @@ static int init(struct gfs2_sbd *sbp, struct gfs2_options *opts)
gfs2_inptrs = (sbp->sd_bsize - sizeof(struct gfs2_meta_header)) /
sizeof(uint64_t); /* How many ptrs can we fit on a block? */
memset(gfs2_heightsize, 0, sizeof(gfs2_heightsize));
- if (compute_heightsize(sbp->sd_bsize, gfs2_heightsize, &gfs2_max_height,
+ if (lgfs2_compute_heightsize(sbp->sd_bsize, gfs2_heightsize, &gfs2_max_height,
sbp->sd_bsize, sbp->sd_diptrs, gfs2_inptrs)) {
log_crit("%s\n", _("Failed to compute file system constants"));
exit(-1);
}
memset(gfs2_jheightsize, 0, sizeof(gfs2_jheightsize));
- if (compute_heightsize(sbp->sd_bsize, gfs2_jheightsize, &gfs2_max_jheight,
+ if (lgfs2_compute_heightsize(sbp->sd_bsize, gfs2_jheightsize, &gfs2_max_jheight,
sbp->sd_jbsize, sbp->sd_diptrs, gfs2_inptrs)) {
log_crit("%s\n", _("Failed to compute file system constants"));
exit(-1);
@@ -2299,7 +2299,7 @@ int main(int argc, char **argv)
int jreduce = 0;
/* Now we've got to treat it as a gfs2 file system */
- if (compute_constants(&sb2)) {
+ if (lgfs2_compute_constants(&sb2)) {
log_crit("%s\n", _("Failed to compute file system constants"));
exit(-1);
}
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index ab5fa933..ffb714bf 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -899,7 +899,7 @@ static void read_superblock(int fd)
perror(device);
exit(-1);
}
- if(compute_constants(&sbd)) {
+ if(lgfs2_compute_constants(&sbd)) {
fprintf(stderr, "Failed to compute constants.\n");
exit(-1);
}
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index 63024a87..f1586374 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -1341,7 +1341,7 @@ static int fill_super_block(struct gfs2_sbd *sdp)
sdp->rgtree.osi_node = NULL;
sdp->sd_bsize = GFS2_DEFAULT_BSIZE;
- if (compute_constants(sdp)) {
+ if (lgfs2_compute_constants(sdp)) {
log_crit("%s\n", _("Failed to compute file system constants"));
return FSCK_ERROR;
}
diff --git a/gfs2/libgfs2/check_rgrp.c b/gfs2/libgfs2/check_rgrp.c
index 2dc2e7be..d2e7b4fb 100644
--- a/gfs2/libgfs2/check_rgrp.c
+++ b/gfs2/libgfs2/check_rgrp.c
@@ -35,7 +35,7 @@ static void mockup_rgrps(void)
ck_assert(ftruncate(sdp->device_fd, MOCK_DEV_SIZE) == 0);
sdp->sd_bsize = 4096;
- compute_constants(sdp);
+ lgfs2_compute_constants(sdp);
rgs = lgfs2_rgrps_init(sdp, 0, 0);
ck_assert(rgs != NULL);
diff --git a/gfs2/libgfs2/gfs2l.c b/gfs2/libgfs2/gfs2l.c
index 12862507..c31748b0 100644
--- a/gfs2/libgfs2/gfs2l.c
+++ b/gfs2/libgfs2/gfs2l.c
@@ -120,7 +120,7 @@ static int openfs(const char *path, struct gfs2_sbd *sdp)
memset(sdp, 0, sizeof(*sdp));
sdp->sd_bsize = GFS2_BASIC_BLOCK;
sdp->device_fd = fd;
- ret = compute_constants(sdp);
+ ret = lgfs2_compute_constants(sdp);
if (ret != 0) {
perror("Bad constants");
return 1;
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index e74918ab..5eb08baf 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -725,9 +725,9 @@ extern void lgfs2_gfs_rgrp_in(const lgfs2_rgrp_t rg, void *buf);
extern void lgfs2_gfs_rgrp_out(const lgfs2_rgrp_t rg, void *buf);
/* misc.c */
-extern int compute_heightsize(unsigned bsize, uint64_t *heightsize,
+extern int lgfs2_compute_heightsize(unsigned bsize, uint64_t *heightsize,
uint32_t *maxheight, uint32_t bsize1, int diptrs, int inptrs);
-extern int compute_constants(struct gfs2_sbd *sdp);
+extern int lgfs2_compute_constants(struct gfs2_sbd *sdp);
extern int lgfs2_open_mnt(const char *path, int dirflags, int *dirfd, int devflags, int *devfd, struct mntent **mnt);
extern int lgfs2_open_mnt_dev(const char *path, int flags, struct mntent **mnt);
extern int lgfs2_open_mnt_dir(const char *path, int flags, struct mntent **mnt);
diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
index 8f1014ea..6092fa5c 100644
--- a/gfs2/libgfs2/misc.c
+++ b/gfs2/libgfs2/misc.c
@@ -12,7 +12,7 @@
#define PAGE_SIZE (4096)
#define DIV_RU(x, y) (((x) + (y) - 1) / (y))
-int compute_heightsize(unsigned bsize, uint64_t *heightsize,
+int lgfs2_compute_heightsize(unsigned bsize, uint64_t *heightsize,
uint32_t *maxheight, uint32_t bsize1, int diptrs, int inptrs)
{
heightsize[0] = bsize - sizeof(struct gfs2_dinode);
@@ -36,7 +36,7 @@ int compute_heightsize(unsigned bsize, uint64_t *heightsize,
return 0;
}
-int compute_constants(struct gfs2_sbd *sdp)
+int lgfs2_compute_constants(struct gfs2_sbd *sdp)
{
sdp->md.next_inum = 1;
@@ -55,11 +55,11 @@ int compute_constants(struct gfs2_sbd *sdp)
sdp->sd_blocks_per_bitmap = (sdp->sd_bsize - sizeof(struct gfs2_meta_header))
* GFS2_NBBY;
- if (compute_heightsize(sdp->sd_bsize, sdp->sd_heightsize, &sdp->sd_max_height,
+ if (lgfs2_compute_heightsize(sdp->sd_bsize, sdp->sd_heightsize, &sdp->sd_max_height,
sdp->sd_bsize, sdp->sd_diptrs, sdp->sd_inptrs)) {
return -1;
}
- if (compute_heightsize(sdp->sd_bsize, sdp->sd_jheightsize, &sdp->sd_max_jheight,
+ if (lgfs2_compute_heightsize(sdp->sd_bsize, sdp->sd_jheightsize, &sdp->sd_max_jheight,
sdp->sd_jbsize, sdp->sd_diptrs, sdp->sd_inptrs)) {
return -1;
}
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
index 9690021b..4ce24c90 100644
--- a/gfs2/mkfs/main_grow.c
+++ b/gfs2/mkfs/main_grow.c
@@ -394,7 +394,7 @@ int main(int argc, char *argv[])
}
sdp->sd_bsize = GFS2_DEFAULT_BSIZE;
sdp->sd_bsize = sdp->sd_bsize;
- if (compute_constants(sdp)) {
+ if (lgfs2_compute_constants(sdp)) {
log_crit("%s\n", _("Failed to compute file system constants"));
exit(EXIT_FAILURE);
}
diff --git a/gfs2/mkfs/main_jadd.c b/gfs2/mkfs/main_jadd.c
index 0a7f1f33..e11b63f6 100644
--- a/gfs2/mkfs/main_jadd.c
+++ b/gfs2/mkfs/main_jadd.c
@@ -679,7 +679,7 @@ int main(int argc, char *argv[])
goto umount_meta;
}
- if ((ret = compute_constants(sdp))) {
+ if ((ret = lgfs2_compute_constants(sdp))) {
perror(_("Failed to compute file system constants"));
goto free_paths;
}
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 3b0f5b4e..5a8ede04 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -1064,7 +1064,7 @@ static int sbd_init(struct gfs2_sbd *sdp, struct mkfs_opts *opts, unsigned bsize
sdp->sd_bsize_shift = ffs(bsize) - 1;
uuid_generate(sdp->sd_uuid);
- if (compute_constants(sdp)) {
+ if (lgfs2_compute_constants(sdp)) {
perror(_("Failed to compute file system constants"));
return -1;
}
diff --git a/tests/nukerg.c b/tests/nukerg.c
index 81424e17..49bbda74 100644
--- a/tests/nukerg.c
+++ b/tests/nukerg.c
@@ -280,7 +280,7 @@ static int fill_super_block(struct gfs2_sbd *sdp)
{
sdp->sd_bsize = GFS2_BASIC_BLOCK;
- if (compute_constants(sdp) != 0) {
+ if (lgfs2_compute_constants(sdp) != 0) {
fprintf(stderr, "Failed to compute file system constants.\n");
return 1;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 3 months
[gfs2-utils] 05/21: libgfs2: Namespace improvements - gfs1.c
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch main
in repository gfs2-utils.
commit 05d0ba53f6b0ab21ac2791ef496074411636d3a0
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Jan 17 18:10:09 2022 +0000
libgfs2: Namespace improvements - gfs1.c
Use the lgfs2_ prefix in libgfs2 interface names.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/pass1.c | 2 +-
gfs2/fsck/pass2.c | 2 +-
gfs2/fsck/util.h | 2 +-
gfs2/libgfs2/fs_ops.c | 12 ++++++------
gfs2/libgfs2/gfs1.c | 16 ++++++++--------
gfs2/libgfs2/libgfs2.h | 8 ++++----
6 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index c2d6cae4..2b3379a7 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -152,7 +152,7 @@ static int pass1_repair_leaf(struct gfs2_inode *ip, uint64_t *leaf_no,
" (0x%"PRIx64") at index: 0x%x for 0x%x pointers.\n"),
ip->i_num.in_addr, ip->i_num.in_addr, lindex, ref_count);
if (ip->i_sbd->gfs1)
- gfs1_writei(ip, padbuf, lindex * sizeof(uint64_t), pad_size);
+ lgfs2_gfs1_writei(ip, padbuf, lindex * sizeof(uint64_t), pad_size);
else
lgfs2_writei(ip, padbuf, lindex * sizeof(uint64_t), pad_size);
free(padbuf);
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 71e10e96..3d732772 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -1000,7 +1000,7 @@ static int write_new_leaf(struct gfs2_inode *dip, int start_lindex,
dip->i_num.in_addr, dip->i_num.in_addr,
start_lindex, (unsigned long)pad_size / sizeof(uint64_t));
if (dip->i_sbd->gfs1)
- count = gfs1_writei(dip, padbuf, start_lindex *
+ count = lgfs2_gfs1_writei(dip, padbuf, start_lindex *
sizeof(uint64_t), pad_size);
else
count = lgfs2_writei(dip, padbuf, start_lindex *
diff --git a/gfs2/fsck/util.h b/gfs2/fsck/util.h
index 5f9c488b..ae654bf4 100644
--- a/gfs2/fsck/util.h
+++ b/gfs2/fsck/util.h
@@ -82,7 +82,7 @@ static const inline char *block_type_string(int q)
static inline int is_dir(struct gfs2_inode *ip, int gfs1)
{
- if (gfs1 && is_gfs_dir(ip))
+ if (gfs1 && lgfs2_is_gfs_dir(ip))
return 1;
if (S_ISDIR(ip->i_mode))
return 1;
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index 077677a4..1d5ef8e6 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -235,7 +235,7 @@ void lgfs2_unstuff_dinode(struct gfs2_inode *ip)
struct gfs2_sbd *sdp = ip->i_sbd;
struct gfs2_buffer_head *bh;
uint64_t block = 0;
- int isdir = S_ISDIR(ip->i_mode) || is_gfs_dir(ip);
+ int isdir = S_ISDIR(ip->i_mode) || lgfs2_is_gfs_dir(ip);
if (ip->i_size) {
if (lgfs2_meta_alloc(ip, &block))
@@ -612,7 +612,7 @@ int lgfs2_readi(struct gfs2_inode *ip, void *buf, uint64_t offset, unsigned int
if (!extlen) {
if (sdp->gfs1)
- gfs1_block_map(ip, lblock, ¬_new, &dblock,
+ lgfs2_gfs1_block_map(ip, lblock, ¬_new, &dblock,
&extlen, 0);
else
lgfs2_block_map(ip, lblock, ¬_new, &dblock,
@@ -935,7 +935,7 @@ void lgfs2_dir_split_leaf(struct gfs2_inode *dip, uint32_t start, uint64_t leaf_
lp[x] = cpu_to_be64(bn);
if (dip->i_sbd->gfs1)
- count = gfs1_writei(dip, (char *)lp, start * sizeof(uint64_t),
+ count = lgfs2_gfs1_writei(dip, (char *)lp, start * sizeof(uint64_t),
half_len * sizeof(uint64_t));
else
count = lgfs2_writei(dip, (char *)lp, start * sizeof(uint64_t),
@@ -1043,7 +1043,7 @@ static void dir_double_exhash(struct gfs2_inode *dip)
}
if (sdp->gfs1)
- count = gfs1_writei(dip, (char *)buf +
+ count = lgfs2_gfs1_writei(dip, (char *)buf +
sdp->sd_hash_bsize,
block * sdp->sd_bsize, sdp->sd_bsize);
else
@@ -1763,7 +1763,7 @@ int lgfs2_dir_search(struct gfs2_inode *dip, const char *filename, int len,
{
int error;
- if(!S_ISDIR(dip->i_mode) && !is_gfs_dir(dip))
+ if(!S_ISDIR(dip->i_mode) && !lgfs2_is_gfs_dir(dip))
return -1;
if (dip->i_flags & GFS2_DIF_EXHASH)
@@ -1851,7 +1851,7 @@ int lgfs2_dirent_del(struct gfs2_inode *dip, const char *filename, int len)
{
int error;
- if(!S_ISDIR(dip->i_mode) && !is_gfs_dir(dip))
+ if(!S_ISDIR(dip->i_mode) && !lgfs2_is_gfs_dir(dip))
return -1;
if (dip->i_flags & GFS2_DIF_EXHASH)
diff --git a/gfs2/libgfs2/gfs1.c b/gfs2/libgfs2/gfs1.c
index 5cee3df8..2b864137 100644
--- a/gfs2/libgfs2/gfs1.c
+++ b/gfs2/libgfs2/gfs1.c
@@ -31,14 +31,14 @@ gfs1_metapointer(char *buf, unsigned int height, struct metapath *mp)
return ((__be64 *)(buf + head_size)) + mp->mp_list[height];
}
-int is_gfs_dir(struct gfs2_inode *ip)
+int lgfs2_is_gfs_dir(struct gfs2_inode *ip)
{
if (ip->i_di_type == GFS_FILE_DIR)
return 1;
return 0;
}
-void gfs1_lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
+void lgfs2_gfs1_lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
unsigned int height, struct metapath *mp,
int create, int *new, uint64_t *block)
{
@@ -67,7 +67,7 @@ void gfs1_lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
*new = 1;
}
-void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
+void lgfs2_gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
uint64_t *dblock, uint32_t *extlen, int prealloc)
{
struct gfs2_sbd *sdp = ip->i_sbd;
@@ -109,7 +109,7 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
bh = ip->i_bh;
for (x = 0; x < end_of_metadata; x++) {
- gfs1_lookup_block(ip, bh, x, &mp, create, new, dblock);
+ lgfs2_gfs1_lookup_block(ip, bh, x, &mp, create, new, dblock);
if (bh != ip->i_bh)
lgfs2_brelse(bh);
if (!*dblock)
@@ -133,7 +133,7 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
}
if (!prealloc)
- gfs1_lookup_block(ip, bh, end_of_metadata, &mp, create, new,
+ lgfs2_gfs1_lookup_block(ip, bh, end_of_metadata, &mp, create, new,
dblock);
if (extlen && *dblock) {
@@ -147,7 +147,7 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
nptrs = (end_of_metadata) ? sdp->sd_inptrs : sdp->sd_diptrs;
while (++mp.mp_list[end_of_metadata] < nptrs) {
- gfs1_lookup_block(ip, bh, end_of_metadata, &mp,
+ lgfs2_gfs1_lookup_block(ip, bh, end_of_metadata, &mp,
0, &tmp_new,
&tmp_dblock);
@@ -163,7 +163,7 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
lgfs2_brelse(bh);
}
-int gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
+int lgfs2_gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
unsigned int size)
{
struct gfs2_sbd *sdp = ip->i_sbd;
@@ -203,7 +203,7 @@ int gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
if (!extlen){
new = 1;
- gfs1_block_map(ip, lblock, &new, &dblock, &extlen, 0);
+ lgfs2_gfs1_block_map(ip, lblock, &new, &dblock, &extlen, 0);
if (!dblock)
return -1;
}
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index c6f0fb9e..e74918ab 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -710,14 +710,14 @@ struct gfs_log_descriptor {
uint8_t ld_reserved[64];
};
-extern int is_gfs_dir(struct gfs2_inode *ip);
-extern void gfs1_lookup_block(struct gfs2_inode *ip,
+extern int lgfs2_is_gfs_dir(struct gfs2_inode *ip);
+extern void lgfs2_gfs1_lookup_block(struct gfs2_inode *ip,
struct gfs2_buffer_head *bh,
unsigned int height, struct metapath *mp,
int create, int *new, uint64_t *block);
-extern void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
+extern void lgfs2_gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
uint64_t *dblock, uint32_t *extlen, int prealloc);
-extern int gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
+extern int lgfs2_gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
unsigned int size);
extern struct gfs2_inode *lgfs2_gfs_inode_get(struct gfs2_sbd *sdp, char *buf);
extern struct gfs2_inode *lgfs2_gfs_inode_read(struct gfs2_sbd *sdp, uint64_t di_addr);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 3 months
[gfs2-utils] 04/21: libgfs2: Namespace improvements - fs_bits.c
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch main
in repository gfs2-utils.
commit 22024c4d4a26b2c9732195db9a32c6cbddc64f08
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Jan 17 17:42:53 2022 +0000
libgfs2: Namespace improvements - fs_bits.c
Use the lgfs2_ prefix in libgfs2 interface names.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/convert/gfs2_convert.c | 2 +-
gfs2/edit/hexedit.c | 2 +-
gfs2/edit/savemeta.c | 4 ++--
gfs2/fsck/metawalk.c | 2 +-
gfs2/fsck/pass5.c | 4 ++--
gfs2/fsck/rgrepair.c | 2 +-
gfs2/libgfs2/check_rgrp.c | 2 +-
gfs2/libgfs2/fs_bits.c | 22 +++++++++++-----------
gfs2/libgfs2/fs_ops.c | 8 ++++----
gfs2/libgfs2/lang.c | 2 +-
gfs2/libgfs2/libgfs2.h | 9 +++------
gfs2/libgfs2/rgrp.c | 8 ++++----
gfs2/libgfs2/structures.c | 2 +-
gfs2/libgfs2/super.c | 2 +-
14 files changed, 34 insertions(+), 37 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index bef0cf6f..9bf92ed4 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -968,7 +968,7 @@ static int next_rg_meta(struct rgrp_tree *rgd, uint64_t *block, int first)
}
for (; i < length; i++){
bits = &rgd->bits[i];
- blk = gfs2_bitfit((uint8_t *)bits->bi_data + bits->bi_offset,
+ blk = lgfs2_bitfit((uint8_t *)bits->bi_data + bits->bi_offset,
bits->bi_len, blk, GFS2_BLKST_DINODE);
if(blk != BFITNOENT){
*block = blk + (bits->bi_start * GFS2_NBBY) + rgd->rt_data0;
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 22e70830..ab5fa933 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -1664,7 +1664,7 @@ static void find_change_block_alloc(int *newval)
if (rgd) {
gfs2_rgrp_read(&sbd, rgd);
if (newval) {
- if (gfs2_set_bitmap(rgd, ablock, *newval))
+ if (lgfs2_set_bitmap(rgd, ablock, *newval))
printf("-1 (block invalid or part of an rgrp).\n");
else
printf("%d\n", *newval);
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 3b2152df..1d22df2e 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -804,7 +804,7 @@ static int save_leaf_chain(struct metafd *mfd, struct gfs2_sbd *sdp, char *buf)
uint64_t blk = be64_to_cpu(leaf->lf_next);
ssize_t r;
- if (gfs2_check_range(sdp, blk) != 0)
+ if (lgfs2_check_range(sdp, blk) != 0)
return 0;
r = pread(sdp->device_fd, buf, sdp->sd_bsize, sdp->sd_bsize * blk);
@@ -1041,7 +1041,7 @@ static char *rgrp_read(struct gfs2_sbd *sdp, uint64_t addr, unsigned blocks)
off_t off = addr * sdp->sd_bsize;
char *buf;
- if (blocks == 0 || gfs2_check_range(sdp, addr))
+ if (blocks == 0 || lgfs2_check_range(sdp, addr))
return NULL;
buf = calloc(1, len);
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index a5b3fe36..a401e792 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -77,7 +77,7 @@ int check_n_fix_bitmap(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
bitmap state was free (and therefore it no longer is) we have to
subtract to the free space. If the type changed from dinode to
data or data to dinode, no change in free space. */
- gfs2_set_bitmap(rgd, blk, new_state);
+ lgfs2_set_bitmap(rgd, blk, new_state);
if (new_state == GFS2_BLKST_FREE) {
rgd->rt_free++;
rewrite_rgrp = 1;
diff --git a/gfs2/fsck/pass5.c b/gfs2/fsck/pass5.c
index 9b8f8375..976c8641 100644
--- a/gfs2/fsck/pass5.c
+++ b/gfs2/fsck/pass5.c
@@ -69,7 +69,7 @@ static int check_block_status(struct gfs2_sbd *sdp, struct gfs2_bmap *bl,
if (query(_("Do you want to reclaim the block? "
"(y/n) "))) {
lgfs2_rgrp_t rg = gfs2_blk2rgrpd(sdp, block);
- if (gfs2_set_bitmap(rg, block, GFS2_BLKST_FREE))
+ if (lgfs2_set_bitmap(rg, block, GFS2_BLKST_FREE))
log_err(_("Unlinked block %"PRIu64" (0x%"PRIx64") bitmap not fixed.\n"),
block, block);
else {
@@ -94,7 +94,7 @@ static int check_block_status(struct gfs2_sbd *sdp, struct gfs2_bmap *bl,
if (query(_("Fix bitmap for block %"PRIu64" (0x%"PRIx64")? (y/n) "),
block, block)) {
lgfs2_rgrp_t rg = gfs2_blk2rgrpd(sdp, block);
- if (gfs2_set_bitmap(rg, block, q))
+ if (lgfs2_set_bitmap(rg, block, q))
log_err( _("Repair failed.\n"));
else
log_err( _("Fixed.\n"));
diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c
index 825a6398..6f15d2d4 100644
--- a/gfs2/fsck/rgrepair.c
+++ b/gfs2/fsck/rgrepair.c
@@ -429,7 +429,7 @@ static uint64_t hunt_and_peck(struct gfs2_sbd *sdp, uint64_t blk,
/* Skip ahead the previous amount: we might get lucky.
If we're close to the end of the device, take the rest. */
- if (gfs2_check_range(sdp, blk + last_bump))
+ if (lgfs2_check_range(sdp, blk + last_bump))
return sdp->fssize - blk;
bh = lgfs2_bread(sdp, blk + last_bump);
diff --git a/gfs2/libgfs2/check_rgrp.c b/gfs2/libgfs2/check_rgrp.c
index 5178c7a7..2dc2e7be 100644
--- a/gfs2/libgfs2/check_rgrp.c
+++ b/gfs2/libgfs2/check_rgrp.c
@@ -118,7 +118,7 @@ START_TEST(test_rbm_find_lastblock)
memset(rg->bits[i].bi_data, 0xff, rgs->sdp->sd_bsize);
/* ...except the final one */
- err = gfs2_set_bitmap(rg, rg->rt_data0 + rg->rt_data - 1, GFS2_BLKST_FREE);
+ err = lgfs2_set_bitmap(rg, rg->rt_data0 + rg->rt_data - 1, GFS2_BLKST_FREE);
ck_assert_int_eq(err, 0);
err = lgfs2_rbm_find(&rbm, GFS2_BLKST_FREE, &minext);
diff --git a/gfs2/libgfs2/fs_bits.c b/gfs2/libgfs2/fs_bits.c
index 8399e486..940ebf3c 100644
--- a/gfs2/libgfs2/fs_bits.c
+++ b/gfs2/libgfs2/fs_bits.c
@@ -21,7 +21,7 @@
#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
/**
- * gfs2_bit_search
+ * bit_search
* @ptr: Pointer to bitmap data
* @mask: Mask to use (normally 0x55555.... but adjusted for search start)
* @state: The state we are searching for
@@ -38,7 +38,7 @@
* single test (on 64 bit arches).
*/
-static inline uint64_t gfs2_bit_search(const __le64 *ptr,
+static inline uint64_t bit_search(const __le64 *ptr,
unsigned long long mask,
uint8_t state)
{
@@ -56,7 +56,7 @@ static inline uint64_t gfs2_bit_search(const __le64 *ptr,
}
/**
- * gfs2_bitfit - Find a free block in the bitmaps
+ * lgfs2_bitfit - Find a free block in the bitmaps
* @buffer: the buffer that holds the bitmaps
* @buflen: the length (in bytes) of the buffer
* @goal: the block to try to allocate
@@ -64,7 +64,7 @@ static inline uint64_t gfs2_bit_search(const __le64 *ptr,
*
* Return: the block number that was allocated
*/
-unsigned long gfs2_bitfit(const unsigned char *buf, const unsigned int len,
+unsigned long lgfs2_bitfit(const unsigned char *buf, const unsigned int len,
unsigned long goal, unsigned char state)
{
uint32_t spoint = (goal << 1) & ((8 * sizeof(uint64_t)) - 1);
@@ -79,10 +79,10 @@ unsigned long gfs2_bitfit(const unsigned char *buf, const unsigned int len,
/* Mask off bits we don't care about at the start of the search */
mask <<= spoint;
- tmp = gfs2_bit_search(ptr, mask, state);
+ tmp = bit_search(ptr, mask, state);
ptr++;
while(tmp == 0 && ptr < end) {
- tmp = gfs2_bit_search(ptr, 0x5555555555555555ULL, state);
+ tmp = bit_search(ptr, 0x5555555555555555ULL, state);
ptr++;
}
/* Mask off any bits which are more than len bytes from the start */
@@ -99,13 +99,13 @@ unsigned long gfs2_bitfit(const unsigned char *buf, const unsigned int len,
}
/*
- * check_range - check if blkno is within FS limits
+ * lgfs2_check_range - check if blkno is within FS limits
* @sdp: super block
* @blkno: block number
*
* Returns: 0 if ok, -1 if out of bounds
*/
-int gfs2_check_range(struct gfs2_sbd *sdp, uint64_t blkno)
+int lgfs2_check_range(struct gfs2_sbd *sdp, uint64_t blkno)
{
if((blkno > sdp->fssize) || (blkno <= LGFS2_SB_ADDR(sdp)))
return -1;
@@ -113,7 +113,7 @@ int gfs2_check_range(struct gfs2_sbd *sdp, uint64_t blkno)
}
/*
- * gfs2_set_bitmap
+ * lgfs2_set_bitmap
* @sdp: super block
* @blkno: block number relative to file system
* @state: one of three possible states
@@ -123,7 +123,7 @@ int gfs2_check_range(struct gfs2_sbd *sdp, uint64_t blkno)
*
* Returns: 0 on success, -1 on error
*/
-int gfs2_set_bitmap(lgfs2_rgrp_t rgd, uint64_t blkno, int state)
+int lgfs2_set_bitmap(lgfs2_rgrp_t rgd, uint64_t blkno, int state)
{
int buf;
uint32_t rgrp_block;
@@ -160,7 +160,7 @@ int gfs2_set_bitmap(lgfs2_rgrp_t rgd, uint64_t blkno, int state)
}
/*
- * gfs2_get_bitmap - get value of FS bitmap
+ * lgfs2_get_bitmap - get value of FS bitmap
* @sdp: super block
* @blkno: block number relative to file system
*
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index 432031e1..077677a4 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -121,7 +121,7 @@ static uint64_t find_free_block(struct rgrp_tree *rgd)
unsigned long blk = 0;
struct gfs2_bitmap *bits = &rgd->bits[bm];
- blk = gfs2_bitfit((uint8_t *)bits->bi_data + bits->bi_offset,
+ blk = lgfs2_bitfit((uint8_t *)bits->bi_data + bits->bi_offset,
bits->bi_len, blk, GFS2_BLKST_FREE);
if (blk != BFITNOENT) {
blkno = blk + (bits->bi_start * GFS2_NBBY) + rgd->rt_data0;
@@ -136,7 +136,7 @@ static int blk_alloc_in_rg(struct gfs2_sbd *sdp, unsigned state, struct rgrp_tre
if (blkno == 0)
return -1;
- if (gfs2_set_bitmap(rgd, blkno, state))
+ if (lgfs2_set_bitmap(rgd, blkno, state))
return -1;
if (state == GFS2_BLKST_DINODE) {
@@ -1902,7 +1902,7 @@ void lgfs2_free_block(struct gfs2_sbd *sdp, uint64_t block)
/* Adjust the free space count for the freed block */
rgd = gfs2_blk2rgrpd(sdp, block); /* find the rg for indir block */
if (rgd) {
- gfs2_set_bitmap(rgd, block, GFS2_BLKST_FREE);
+ lgfs2_set_bitmap(rgd, block, GFS2_BLKST_FREE);
rgd->rt_free++; /* adjust the free count */
if (sdp->gfs1)
lgfs2_gfs_rgrp_out(rgd, rgd->bits[0].bi_data);
@@ -1968,7 +1968,7 @@ int lgfs2_freedi(struct gfs2_sbd *sdp, uint64_t diblock)
}
}
rgd = gfs2_blk2rgrpd(sdp, diblock);
- gfs2_set_bitmap(rgd, diblock, GFS2_BLKST_FREE);
+ lgfs2_set_bitmap(rgd, diblock, GFS2_BLKST_FREE);
lgfs2_inode_put(&ip);
/* lgfs2_inode_put deallocated the extra block used by the disk inode, */
/* so adjust it in the superblock struct */
diff --git a/gfs2/libgfs2/lang.c b/gfs2/libgfs2/lang.c
index 6b5d4449..57849e60 100644
--- a/gfs2/libgfs2/lang.c
+++ b/gfs2/libgfs2/lang.c
@@ -266,7 +266,7 @@ static uint64_t ast_lookup_block_num(struct ast_node *ast, struct gfs2_sbd *sbd)
bn = ast_lookup_block_num(ast->ast_left, sbd) + ast->ast_num;
break;
case AST_EX_ADDRESS:
- if (gfs2_check_range(sbd, ast->ast_num))
+ if (lgfs2_check_range(sbd, ast->ast_num))
break;
bn = ast->ast_num;
break;
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index d4f232ce..c6f0fb9e 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -479,19 +479,16 @@ extern void fix_device_geometry(struct gfs2_sbd *sdp);
#define BFITNOENT (0xFFFFFFFF)
/* functions with blk #'s that are buffer relative */
-extern unsigned long gfs2_bitfit(const unsigned char *buffer,
+extern unsigned long lgfs2_bitfit(const unsigned char *buffer,
const unsigned int buflen,
unsigned long goal, unsigned char old_state);
/* functions with blk #'s that are rgrp relative */
-extern uint32_t gfs2_blkalloc_internal(struct rgrp_tree *rgd, uint32_t goal,
- unsigned char old_state,
- unsigned char new_state, int do_it);
-extern int gfs2_check_range(struct gfs2_sbd *sdp, uint64_t blkno);
+extern int lgfs2_check_range(struct gfs2_sbd *sdp, uint64_t blkno);
/* functions with blk #'s that are file system relative */
extern int lgfs2_get_bitmap(struct gfs2_sbd *sdp, uint64_t blkno, struct rgrp_tree *rgd);
-extern int gfs2_set_bitmap(lgfs2_rgrp_t rg, uint64_t blkno, int state);
+extern int lgfs2_set_bitmap(lgfs2_rgrp_t rg, uint64_t blkno, int state);
extern uint32_t rgblocks2bitblocks(const unsigned int bsize, const uint32_t rgblocks,
uint32_t *ri_data) __attribute__((nonnull(3)));
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index 4a522546..39b8b69b 100644
--- a/gfs2/libgfs2/rgrp.c
+++ b/gfs2/libgfs2/rgrp.c
@@ -193,7 +193,7 @@ uint64_t gfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
off_t offset = rgd->rt_addr * sdp->sd_bsize;
char *buf;
- if (length == 0 || gfs2_check_range(sdp, rgd->rt_addr))
+ if (length == 0 || lgfs2_check_range(sdp, rgd->rt_addr))
return -1;
buf = calloc(1, length);
@@ -951,7 +951,7 @@ int lgfs2_rbm_find(struct lgfs2_rbm *rbm, uint8_t state, uint32_t *minext)
if ((rbm->rgd->rt_free < *minext) && (state == GFS2_BLKST_FREE))
goto next_bitmap;
- offset = gfs2_bitfit(buf, bi->bi_len, rbm->offset, state);
+ offset = lgfs2_bitfit(buf, bi->bi_len, rbm->offset, state);
if (offset == BFITNOENT)
goto next_bitmap;
@@ -1009,13 +1009,13 @@ unsigned lgfs2_alloc_extent(const struct lgfs2_rbm *rbm, int state, const unsign
const uint64_t block = lgfs2_rbm_to_block(rbm);
unsigned len;
- gfs2_set_bitmap(rbm->rgd, block, state);
+ lgfs2_set_bitmap(rbm->rgd, block, state);
for (len = 1; len < elen; len++) {
int ret = lgfs2_rbm_from_block(&pos, block + len);
if (ret || lgfs2_testbit(&pos) != GFS2_BLKST_FREE)
break;
- gfs2_set_bitmap(pos.rgd, block + len, GFS2_BLKST_USED);
+ lgfs2_set_bitmap(pos.rgd, block + len, GFS2_BLKST_USED);
}
return len;
}
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index ff4c5522..fc0a59cc 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -504,7 +504,7 @@ unsigned lgfs2_bm_scan(struct rgrp_tree *rgd, unsigned idx, uint64_t *buf, uint8
uint32_t blk = 0;
while(blk < (bi->bi_len * GFS2_NBBY)) {
- blk = gfs2_bitfit((uint8_t *)bi->bi_data + bi->bi_offset,
+ blk = lgfs2_bitfit((uint8_t *)bi->bi_data + bi->bi_offset,
bi->bi_len, blk, state);
if (blk == BFITNOENT)
break;
diff --git a/gfs2/libgfs2/super.c b/gfs2/libgfs2/super.c
index b32c89c9..15f89a30 100644
--- a/gfs2/libgfs2/super.c
+++ b/gfs2/libgfs2/super.c
@@ -222,7 +222,7 @@ int rindex_read(struct gfs2_sbd *sdp, uint64_t *rgcount, int *ok)
return -1;
addr = be64_to_cpu(ri.ri_addr);
- if (gfs2_check_range(sdp, addr) != 0) {
+ if (lgfs2_check_range(sdp, addr) != 0) {
*ok = 0;
if (prev_rgd == NULL)
continue;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 3 months
[gfs2-utils] 03/21: libgfs2: Namespace improvements - fs_ops.c
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch main
in repository gfs2-utils.
commit 161251b626c4438e335fb4b9b6287706cc0c8114
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Jan 17 17:28:36 2022 +0000
libgfs2: Namespace improvements - fs_ops.c
Use the lgfs2_ prefix in libgfs2 interface names.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/convert/gfs2_convert.c | 100 +++++++++++++-------------
gfs2/edit/extended.c | 24 +++----
gfs2/edit/hexedit.c | 8 +--
gfs2/edit/journal.c | 10 +--
gfs2/edit/savemeta.c | 6 +-
gfs2/fsck/afterpass1_common.c | 2 +-
gfs2/fsck/fs_recovery.c | 24 +++----
gfs2/fsck/initialize.c | 82 ++++++++++-----------
gfs2/fsck/lost_n_found.c | 14 ++--
gfs2/fsck/main.c | 22 +++---
gfs2/fsck/metawalk.c | 6 +-
gfs2/fsck/pass1.c | 28 ++++----
gfs2/fsck/pass2.c | 46 ++++++------
gfs2/fsck/pass3.c | 4 +-
gfs2/fsck/rgrepair.c | 10 +--
gfs2/fsck/util.c | 2 +-
gfs2/glocktop/glocktop.c | 8 +--
gfs2/libgfs2/fs_ops.c | 161 +++++++++++++++++++++---------------------
gfs2/libgfs2/gfs1.c | 8 +--
gfs2/libgfs2/gfs2l.c | 6 +-
gfs2/libgfs2/lang.c | 6 +-
gfs2/libgfs2/libgfs2.h | 55 +++++++--------
gfs2/libgfs2/recovery.c | 4 +-
gfs2/libgfs2/rgrp.c | 2 +-
gfs2/libgfs2/structures.c | 52 +++++++-------
gfs2/libgfs2/super.c | 2 +-
gfs2/mkfs/main_mkfs.c | 24 +++----
tests/nukerg.c | 8 +--
28 files changed, 361 insertions(+), 363 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 5bfe8acd..bef0cf6f 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -183,7 +183,7 @@ static int convert_rgs(struct gfs2_sbd *sbp)
/* ------------------------------------------------------------------------- */
/* calc_gfs2_tree_height - calculate new dinode height as if this is gfs2 */
/* */
-/* This is similar to calc_tree_height in libgfs2 but at the point this */
+/* This is similar to lgfs2_calc_tree_height in libgfs2 but at the point this */
/* function is called, I have the wrong (gfs1 not gfs2) constants in place. */
/* ------------------------------------------------------------------------- */
static unsigned int calc_gfs2_tree_height(struct gfs2_inode *ip, uint64_t size)
@@ -254,7 +254,7 @@ static void mp_gfs1_to_gfs2(struct gfs2_sbd *sbp, int gfs1_h, int gfs2_h,
/* ------------------------------------------------------------------------- */
/* fix_metatree - Fix up the metatree to match the gfs2 metapath info */
-/* Similar to gfs2_writei in libgfs2 but we're only */
+/* Similar to lgfs2_writei in libgfs2 but we're only */
/* interested in rearranging the metadata while leaving the */
/* actual data blocks intact. */
/* ------------------------------------------------------------------------- */
@@ -273,7 +273,7 @@ static void fix_metatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
mh.mh_type = cpu_to_be32(GFS2_METATYPE_IN);
mh.mh_format = cpu_to_be32(GFS2_FORMAT_IN);
if (!ip->i_height)
- unstuff_dinode(ip);
+ lgfs2_unstuff_dinode(ip);
ptramt = blk->mp.mp_list[blk->height] * sizeof(uint64_t);
amount = size;
@@ -283,7 +283,7 @@ static void fix_metatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
/* First, build up the metatree */
for (h = 0; h < blk->height; h++) {
new = 0;
- lookup_block(ip, bh, h, &blk->mp, 1, &new, &block);
+ lgfs2_lookup_block(ip, bh, h, &blk->mp, 1, &new, &block);
if (bh != ip->i_bh)
lgfs2_brelse(bh);
if (!block)
@@ -431,7 +431,7 @@ static uint64_t fix_jdatatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
mh.mh_format = cpu_to_be32(GFS2_FORMAT_IN);
if (!ip->i_height)
- unstuff_dinode(ip);
+ lgfs2_unstuff_dinode(ip);
ptramt = blk->mp.mp_list[blk->height];
amount = size;
@@ -441,7 +441,7 @@ static uint64_t fix_jdatatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
/* First, build up the metatree */
for (h = 0; h < blk->height; h++) {
new = 0;
- lookup_block(ip, bh, h, &blk->mp, 1, &new, &block);
+ lgfs2_lookup_block(ip, bh, h, &blk->mp, 1, &new, &block);
if (bh != ip->i_bh)
lgfs2_brelse(bh);
if (!block)
@@ -563,7 +563,7 @@ static int get_inode_metablocks(struct gfs2_sbd *sbp, struct gfs2_inode *ip, str
/* Free the block so we can reuse it. This allows us to
convert a "full" file system. */
ip->i_blocks--;
- gfs2_free_block(sbp, block);
+ lgfs2_free_block(sbp, block);
}
}
return 0;
@@ -665,7 +665,7 @@ static int fix_ind_jdata(struct gfs2_sbd *sbp, struct gfs2_inode *ip, uint32_t d
/* Free the block so we can reuse it. This allows us to
convert a "full" file system */
ip->i_blocks--;
- gfs2_free_block(sbp, block);
+ lgfs2_free_block(sbp, block);
len = bufsize;
jdata_mp_gfs1_to_gfs2(sbp, di_height, gfs2_hgt, &newblk->mp, &gfs2mp,
@@ -941,11 +941,11 @@ static int adjust_inode(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh)
}
lgfs2_bmodified(inode->i_bh);
- inode_put(&inode); /* does gfs2_dinode_out if modified */
+ lgfs2_inode_put(&inode); /* does gfs2_dinode_out if modified */
sbp->md.next_inum++; /* update inode count */
return 0;
err_freei:
- inode_put(&inode);
+ lgfs2_inode_put(&inode);
return -1;
} /* adjust_inode */
@@ -1112,7 +1112,7 @@ static int fetch_inum(struct gfs2_sbd *sbp, uint64_t iblock,
if (eablk)
*eablk = fix_inode->i_eattr;
- inode_put(&fix_inode);
+ lgfs2_inode_put(&fix_inode);
return 0;
}/* fetch_inum */
@@ -1131,7 +1131,7 @@ static int process_dirent_info(struct gfs2_inode *dip, struct gfs2_sbd *sbp,
struct gfs2_dirent *dent;
int de; /* directory entry index */
- error = gfs2_dirent_first(dip, bh, &dent);
+ error = lgfs2_dirent_first(dip, bh, &dent);
if (error != IS_LEAF && error != IS_DINODE) {
log_crit(_("Error retrieving directory.\n"));
return -1;
@@ -1226,7 +1226,7 @@ static int process_dirent_info(struct gfs2_inode *dip, struct gfs2_sbd *sbp,
}
skip_next:
- error = gfs2_dirent_next(dip, bh, &dent);
+ error = lgfs2_dirent_next(dip, bh, &dent);
if (error) {
if (error == -ENOENT) /* beyond the end of this bh */
error = 0;
@@ -1257,7 +1257,7 @@ static int fix_one_directory_exhash(struct gfs2_sbd *sbp, struct gfs2_inode *dip
struct gfs2_leaf *leaf;
__be64 buf;
- error = gfs2_readi(dip, (char *)&buf, leaf_num * sizeof(uint64_t),
+ error = lgfs2_readi(dip, (char *)&buf, leaf_num * sizeof(uint64_t),
sizeof(uint64_t));
if (!error) /* end of file */
return 0; /* success */
@@ -1276,7 +1276,7 @@ static int fix_one_directory_exhash(struct gfs2_sbd *sbp, struct gfs2_inode *dip
prev_leaf_block = leaf_block;
/* read the leaf buffer in */
- error = gfs2_get_leaf(dip, leaf_block, &bh_leaf);
+ error = lgfs2_get_leaf(dip, leaf_block, &bh_leaf);
if (error) {
log_crit(_("Error reading leaf %"PRIu64"\n"), leaf_block);
break;
@@ -1308,19 +1308,19 @@ static int process_directory(struct gfs2_sbd *sbp, uint64_t dirblock, uint64_t d
if (dip->i_flags & GFS2_DIF_EXHASH) {
if (fix_one_directory_exhash(sbp, dip, dentmod)) {
log_crit(_("Error fixing exhash directory.\n"));
- inode_put(&dip);
+ lgfs2_inode_put(&dip);
return -1;
}
} else {
error = process_dirent_info(dip, sbp, dip->i_bh, dip->i_entries, dentmod);
if (error && error != -EISDIR) {
log_crit(_("Error fixing linear directory.\n"));
- inode_put(&dip);
+ lgfs2_inode_put(&dip);
return -1;
}
}
lgfs2_bmodified(dip->i_bh);
- inode_put(&dip);
+ lgfs2_inode_put(&dip);
return 0;
}
/* ------------------------------------------------------------------------- */
@@ -1404,7 +1404,7 @@ static int fix_cdpn_symlinks(struct gfs2_sbd *sbp, osi_list_t *cdpn_to_fix)
}
/* initialize the symlink inode to be a directory */
- error = init_dinode(sbp, &bh, &fix, S_IFDIR | 0755, 0, &dir);
+ error = lgfs2_init_dinode(sbp, &bh, &fix, S_IFDIR | 0755, 0, &dir);
if (error != 0)
return -1;
@@ -1412,7 +1412,7 @@ static int fix_cdpn_symlinks(struct gfs2_sbd *sbp, osi_list_t *cdpn_to_fix)
if (fix_inode == NULL)
return -1;
fix_inode->i_eattr = eablk; /*fix extended attribute */
- inode_put(&fix_inode);
+ lgfs2_inode_put(&fix_inode);
lgfs2_bmodified(bh);
lgfs2_brelse(bh);
@@ -1455,7 +1455,7 @@ static int read_gfs1_jiindex(struct gfs2_sbd *sdp)
return -1;
}
/* ugly hack
- * Faking the gfs1_jindex inode as a directory to gfs2_readi
+ * Faking the gfs1_jindex inode as a directory to lgfs2_readi
* so it skips the metaheader struct in the data blocks
* in the inode. gfs2_jindex inode doesn't have metaheaders
* in the data blocks */
@@ -1465,7 +1465,7 @@ static int read_gfs1_jiindex(struct gfs2_sbd *sdp)
for (j = 0; ; j++) {
uint32_t nseg;
- error = gfs2_readi(ip, buf, j * sizeof(struct gfs_jindex),
+ error = lgfs2_readi(ip, buf, j * sizeof(struct gfs_jindex),
sizeof(struct gfs_jindex));
if(!error)
break;
@@ -1674,8 +1674,8 @@ static int init(struct gfs2_sbd *sbp, struct gfs2_options *opts)
}
printf("\n");
fflush(stdout);
- inode_put(&sbp->md.riinode);
- inode_put(&sbp->md.jiinode);
+ lgfs2_inode_put(&sbp->md.riinode);
+ lgfs2_inode_put(&sbp->md.jiinode);
log_debug(_("%d rgs found.\n"), rgcount);
return 0;
}/* fill_super_block */
@@ -1901,7 +1901,7 @@ static void update_inode_file(struct gfs2_sbd *sdp)
int count;
buf = cpu_to_be64(sdp->md.next_inum);
- count = gfs2_writei(ip, &buf, 0, sizeof(uint64_t));
+ count = lgfs2_writei(ip, &buf, 0, sizeof(uint64_t));
if (count != sizeof(uint64_t)) {
fprintf(stderr, "update_inode_file\n");
exit(1);
@@ -1923,7 +1923,7 @@ static void write_statfs_file(struct gfs2_sbd *sdp)
sc.sc_free = cpu_to_be64(sdp->blks_total - sdp->blks_alloced);
sc.sc_dinodes = cpu_to_be64(sdp->dinodes_alloced);
- count = gfs2_writei(ip, &sc, 0, sizeof(sc));
+ count = lgfs2_writei(ip, &sc, 0, sizeof(sc));
if (count != sizeof(sc)) {
fprintf(stderr, "Failed to write statfs file\n");
exit(1);
@@ -1941,19 +1941,19 @@ static void remove_obsolete_gfs1(struct gfs2_sbd *sbp)
fflush(stdout);
/* Delete the old gfs1 Journal index: */
lgfs2_inum_in(&inum, &gfs1_sb.sb_jindex_di);
- gfs2_freedi(sbp, inum.in_addr);
+ lgfs2_freedi(sbp, inum.in_addr);
/* Delete the old gfs1 rgindex: */
lgfs2_inum_in(&inum, &gfs1_sb.sb_rindex_di);
- gfs2_freedi(sbp, inum.in_addr);
+ lgfs2_freedi(sbp, inum.in_addr);
/* Delete the old gfs1 Quota file: */
lgfs2_inum_in(&inum, &gfs1_sb.sb_quota_di);
- gfs2_freedi(sbp, inum.in_addr);
+ lgfs2_freedi(sbp, inum.in_addr);
/* Delete the old gfs1 License file: */
lgfs2_inum_in(&inum, &gfs1_sb.sb_license_di);
- gfs2_freedi(sbp, inum.in_addr);
+ lgfs2_freedi(sbp, inum.in_addr);
}
/* ------------------------------------------------------------------------- */
@@ -1963,7 +1963,7 @@ static int conv_build_jindex(struct gfs2_sbd *sdp)
{
unsigned int j;
- sdp->md.jiinode = createi(sdp->master_dir, "jindex", S_IFDIR | 0700,
+ sdp->md.jiinode = lgfs2_createi(sdp->master_dir, "jindex", S_IFDIR | 0700,
GFS2_DIF_SYSTEM);
if (sdp->md.jiinode == NULL) {
return errno;
@@ -1980,17 +1980,17 @@ static int conv_build_jindex(struct gfs2_sbd *sdp)
printf(_("Writing journal #%d..."), j + 1);
fflush(stdout);
sprintf(name, "journal%u", j);
- sdp->md.journal[j] = createi(sdp->md.jiinode, name, S_IFREG |
+ sdp->md.journal[j] = lgfs2_createi(sdp->md.jiinode, name, S_IFREG |
0600, GFS2_DIF_SYSTEM);
lgfs2_write_journal(sdp->md.journal[j], sdp->sd_bsize,
sdp->jsize << 20 >> sdp->sd_bsize_shift);
- inode_put(&sdp->md.journal[j]);
+ lgfs2_inode_put(&sdp->md.journal[j]);
printf(_("done.\n"));
fflush(stdout);
}
free(sdp->md.journal);
- inode_put(&sdp->md.jiinode);
+ lgfs2_inode_put(&sdp->md.jiinode);
return 0;
}
@@ -2091,7 +2091,7 @@ static int build_per_node(struct gfs2_sbd *sdp)
struct gfs2_inode *per_node;
unsigned int j;
- per_node = createi(sdp->master_dir, "per_node", S_IFDIR | 0700,
+ per_node = lgfs2_createi(sdp->master_dir, "per_node", S_IFDIR | 0700,
GFS2_DIF_SYSTEM);
if (per_node == NULL) {
log_crit(_("Error building '%s': %s\n"), "per_node", strerror(errno));
@@ -2106,7 +2106,7 @@ static int build_per_node(struct gfs2_sbd *sdp)
strerror(errno));
return 1;
}
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
ip = lgfs2_build_statfs_change(per_node, j);
if (ip == NULL) {
@@ -2114,7 +2114,7 @@ static int build_per_node(struct gfs2_sbd *sdp)
strerror(errno));
return 1;
}
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
ip = lgfs2_build_quota_change(per_node, j);
if (ip == NULL) {
@@ -2122,9 +2122,9 @@ static int build_per_node(struct gfs2_sbd *sdp)
strerror(errno));
return 1;
}
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
}
- inode_put(&per_node);
+ lgfs2_inode_put(&per_node);
return 0;
}
@@ -2139,7 +2139,7 @@ static void copy_quotas(struct gfs2_sbd *sdp)
struct gfs2_inode *oq_ip, *nq_ip;
int err;
- err = gfs2_lookupi(sdp->master_dir, "quota", 5, &nq_ip);
+ err = lgfs2_lookupi(sdp->master_dir, "quota", 5, &nq_ip);
if (err) {
fprintf(stderr, _("Couldn't lookup new quota file: %d\n"), err);
exit(1);
@@ -2163,10 +2163,10 @@ static void copy_quotas(struct gfs2_sbd *sdp)
oq_ip->i_size = 0;
lgfs2_bmodified(nq_ip->i_bh);
- inode_put(&nq_ip);
+ lgfs2_inode_put(&nq_ip);
lgfs2_bmodified(oq_ip->i_bh);
- inode_put(&oq_ip);
+ lgfs2_inode_put(&oq_ip);
}
static int gfs2_query(struct gfs2_options *opts, const char *dev)
@@ -2314,7 +2314,7 @@ int main(int argc, char **argv)
log_notice(_("Reduced journal size to %u MB to accommodate "
"GFS2 file system structures.\n"), sb2.jsize);
/* Build the master subdirectory. */
- lgfs2_build_master(&sb2); /* Does not do inode_put */
+ lgfs2_build_master(&sb2); /* Does not do lgfs2_inode_put */
sb2.sd_meta_dir = sb2.master_dir->i_num;
/* Build empty journal index file. */
error = conv_build_jindex(&sb2);
@@ -2331,14 +2331,14 @@ int main(int argc, char **argv)
exit(-1);
}
/* Create the empty inode number file */
- sb2.md.inum = lgfs2_build_inum(&sb2); /* Does not do inode_put */
+ sb2.md.inum = lgfs2_build_inum(&sb2); /* Does not do lgfs2_inode_put */
if (sb2.md.inum == NULL) {
log_crit(_("Error building inum inode: %s\n"),
strerror(error));
exit(-1);
}
/* Create the statfs file */
- sb2.md.statfs = lgfs2_build_statfs(&sb2); /* Does not do inode_put */
+ sb2.md.statfs = lgfs2_build_statfs(&sb2); /* Does not do lgfs2_inode_put */
if (sb2.md.statfs == NULL) {
log_crit(_("Error building statfs inode: %s\n"),
strerror(error));
@@ -2353,7 +2353,7 @@ int main(int argc, char **argv)
strerror(errno));
exit(-1);
}
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
/* Create the quota file */
ip = lgfs2_build_quota(&sb2);
if (ip == NULL) {
@@ -2361,7 +2361,7 @@ int main(int argc, char **argv)
strerror(error));
exit(-1);
}
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
/* Copy out the master dinode */
if (sb2.master_dir->i_bh->b_modified)
@@ -2375,9 +2375,9 @@ int main(int argc, char **argv)
write_statfs_file(&sb2);
- inode_put(&sb2.master_dir);
- inode_put(&sb2.md.inum);
- inode_put(&sb2.md.statfs);
+ lgfs2_inode_put(&sb2.master_dir);
+ lgfs2_inode_put(&sb2.md.inum);
+ lgfs2_inode_put(&sb2.md.statfs);
fsync(sb2.device_fd); /* write the buffers to disk */
diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c
index 89720a53..ee410220 100644
--- a/gfs2/edit/extended.c
+++ b/gfs2/edit/extended.c
@@ -433,7 +433,7 @@ static int print_gfs_jindex(struct gfs2_inode *dij)
eol(0);
lines_per_row[dmode] = 4;
for (print_entry_ndx=0; ; print_entry_ndx++) {
- error = gfs2_readi(dij, (void *)&jbuf,
+ error = lgfs2_readi(dij, (void *)&jbuf,
print_entry_ndx*sizeof(struct gfs_jindex),
sizeof(struct gfs_jindex));
ji = (struct gfs_jindex *)jbuf;
@@ -484,7 +484,7 @@ static int print_gfs2_jindex(void)
print_gfs2("dirty.");
}
eol(0);
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
}
return 0;
}
@@ -508,7 +508,7 @@ static int parse_rindex(struct gfs2_inode *dip, int print_rindex)
roff = print_entry_ndx * sizeof(struct gfs2_rindex);
- error = gfs2_readi(dip, &ri, roff, sizeof(struct gfs2_rindex));
+ error = lgfs2_readi(dip, &ri, roff, sizeof(struct gfs2_rindex));
if (!error) /* end of file */
break;
lgfs2_rindex_in(&rg, &ri);
@@ -556,7 +556,7 @@ static int print_inum(struct gfs2_inode *dii)
__be64 inum;
int rc;
- rc = gfs2_readi(dii, (void *)&inum, 0, sizeof(inum));
+ rc = lgfs2_readi(dii, (void *)&inum, 0, sizeof(inum));
if (!rc) {
print_gfs2("The inum file is empty.");
eol(0);
@@ -578,7 +578,7 @@ static int print_statfs(struct gfs2_inode *dis)
struct gfs2_statfs_change sc;
int rc;
- rc = gfs2_readi(dis, (void *)&sc, 0, sizeof(sc));
+ rc = lgfs2_readi(dis, (void *)&sc, 0, sizeof(sc));
if (!rc) {
print_gfs2("The statfs file is empty.");
eol(0);
@@ -605,7 +605,7 @@ static int print_quota(struct gfs2_inode *diq)
print_gfs2("quota entries found: %"PRIu64".", diq->i_size / sizeof(q));
eol(0);
for (i=0; ; i++) {
- error = gfs2_readi(diq, &q, i * sizeof(q), sizeof(q));
+ error = lgfs2_readi(diq, &q, i * sizeof(q), sizeof(q));
if (!error)
break;
if (error != sizeof(q)) {
@@ -633,7 +633,7 @@ int display_extended(void)
if (tmp_inode == NULL)
return -1;
parse_rindex(tmp_inode, TRUE);
- inode_put(&tmp_inode);
+ lgfs2_inode_put(&tmp_inode);
lgfs2_brelse(tmp_bh);
} else if (block_is_journals(block)) {
if (sbd.gfs1)
@@ -655,7 +655,7 @@ int display_extended(void)
if (tmp_inode == NULL)
return -1;
parse_rindex(tmp_inode, FALSE);
- inode_put(&tmp_inode);
+ lgfs2_inode_put(&tmp_inode);
lgfs2_brelse(tmp_bh);
} else if (block_is_jindex(block)) {
tmp_bh = lgfs2_bread(&sbd, block);
@@ -663,7 +663,7 @@ int display_extended(void)
if (tmp_inode == NULL)
return -1;
print_gfs_jindex(tmp_inode);
- inode_put(&tmp_inode);
+ lgfs2_inode_put(&tmp_inode);
lgfs2_brelse(tmp_bh);
}
else if (block_is_inum_file(block)) {
@@ -672,7 +672,7 @@ int display_extended(void)
if (tmp_inode == NULL)
return -1;
print_inum(tmp_inode);
- inode_put(&tmp_inode);
+ lgfs2_inode_put(&tmp_inode);
lgfs2_brelse(tmp_bh);
}
else if (block_is_statfs_file(block)) {
@@ -681,7 +681,7 @@ int display_extended(void)
if (tmp_inode == NULL)
return -1;
print_statfs(tmp_inode);
- inode_put(&tmp_inode);
+ lgfs2_inode_put(&tmp_inode);
lgfs2_brelse(tmp_bh);
}
else if (block_is_quota_file(block)) {
@@ -690,7 +690,7 @@ int display_extended(void)
if (tmp_inode == NULL)
return -1;
print_quota(tmp_inode);
- inode_put(&tmp_inode);
+ lgfs2_inode_put(&tmp_inode);
lgfs2_brelse(tmp_bh);
}
return 0;
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 5521bf30..22e70830 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -692,7 +692,7 @@ static void rgcount(void)
{
printf("%"PRId64" RGs in this file system.\n",
sbd.md.riinode->i_size / sizeof(struct gfs2_rindex));
- inode_put(&sbd.md.riinode);
+ lgfs2_inode_put(&sbd.md.riinode);
gfs2_rgrp_free(&sbd, &sbd.rgtree);
exit(EXIT_SUCCESS);
}
@@ -715,7 +715,7 @@ static uint64_t find_rgrp_block(struct gfs2_inode *dif, int rg)
sizeof(struct gfs2_meta_header);
gfs1_adj += sizeof(struct gfs2_meta_header);
}
- amt = gfs2_readi(dif, &ri, foffset + gfs1_adj, sizeof(ri));
+ amt = lgfs2_readi(dif, &ri, foffset + gfs1_adj, sizeof(ri));
if (!amt) /* end of file */
return 0;
return be64_to_cpu(ri.ri_addr);
@@ -741,7 +741,7 @@ static uint64_t get_rg_addr(int rgnum)
else
fprintf(stderr, "Error: File system only has %"PRId64" RGs.\n",
riinode->i_size / sizeof(struct gfs2_rindex));
- inode_put(&riinode);
+ lgfs2_inode_put(&riinode);
return rgblk;
}
@@ -925,7 +925,7 @@ static void read_superblock(int fd)
if (sbd.master_dir == NULL) {
sbd.md.riinode = NULL;
} else {
- gfs2_lookupi(sbd.master_dir, "rindex", 6, &sbd.md.riinode);
+ lgfs2_lookupi(sbd.master_dir, "rindex", 6, &sbd.md.riinode);
}
}
lgfs2_brelse(bh);
diff --git a/gfs2/edit/journal.c b/gfs2/edit/journal.c
index 29986c3e..91d0a925 100644
--- a/gfs2/edit/journal.c
+++ b/gfs2/edit/journal.c
@@ -60,14 +60,14 @@ uint64_t find_journal_block(const char *journal, uint64_t *j_size)
jiinode = lgfs2_inode_get(&sbd, jindex_bh);
if (jiinode == NULL)
return 0;
- amtread = gfs2_readi(jiinode, &jidx,
+ amtread = lgfs2_readi(jiinode, &jidx,
journal_num * sizeof(struct gfs_jindex),
sizeof(struct gfs_jindex));
if (amtread) {
jblock = be64_to_cpu(jidx.ji_addr);
*j_size = (uint64_t)be32_to_cpu(jidx.ji_nsegment) * 0x10;
}
- inode_put(&jiinode);
+ lgfs2_inode_put(&jiinode);
} else {
struct gfs2_dinode *jdi;
@@ -99,7 +99,7 @@ static void check_journal_wrap(uint64_t seq, uint64_t *highest_seq)
}
/**
- * fsck_readi - same as libgfs2's gfs2_readi, but sets absolute block #
+ * fsck_readi - same as libgfs2's lgfs2_readi, but sets absolute block #
* of the first bit of data read.
*/
static int fsck_readi(struct gfs2_inode *ip, void *rbuf, uint64_t roffset,
@@ -144,7 +144,7 @@ static int fsck_readi(struct gfs2_inode *ip, void *rbuf, uint64_t roffset,
if (amount > sdp->sd_bsize - o)
amount = sdp->sd_bsize - o;
if (!extlen)
- block_map(ip, lblock, ¬_new, &dblock, &extlen,
+ lgfs2_block_map(ip, lblock, ¬_new, &dblock, &extlen,
FALSE);
if (dblock) {
lbh = lgfs2_bread(sdp, dblock);
@@ -643,7 +643,7 @@ void dump_journal(const char *journal, uint64_t tblk)
}
}
if (j_inode != NULL)
- inode_put(&j_inode);
+ lgfs2_inode_put(&j_inode);
lgfs2_brelse(j_bh);
blockhist = -1; /* So we don't print anything else */
free(jbuf);
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 941472aa..3b2152df 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -278,7 +278,7 @@ static int init_per_node_lookup(void)
}
do_dinode_extended(per_node_di->i_bh->b_data);
- inode_put(&per_node_di);
+ lgfs2_inode_put(&per_node_di);
for (i = 0; i < indirect_blocks; i++) {
int d;
@@ -956,10 +956,10 @@ static void get_journal_inode_blocks(void)
fprintf(stderr, "Error reading journal inode: %s\n", strerror(errno));
return;
}
- amt = gfs2_readi(j_inode, (void *)&jbuf,
+ amt = lgfs2_readi(j_inode, (void *)&jbuf,
journal * sizeof(struct gfs_jindex),
sizeof(struct gfs_jindex));
- inode_put(&j_inode);
+ lgfs2_inode_put(&j_inode);
if (!amt)
break;
ji = (struct gfs_jindex *)jbuf;
diff --git a/gfs2/fsck/afterpass1_common.c b/gfs2/fsck/afterpass1_common.c
index 952275a0..04249e10 100644
--- a/gfs2/fsck/afterpass1_common.c
+++ b/gfs2/fsck/afterpass1_common.c
@@ -123,7 +123,7 @@ static int remove_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
lgfs2_dirent_in(&d, dent);
if (d.dr_inum.in_addr == *dentryblock)
- dirent2_del(ip, bh, prev_de, dent);
+ lgfs2_dirent2_del(ip, bh, prev_de, dent);
else
(*count)++;
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
index f8e4403e..6f186c92 100644
--- a/gfs2/fsck/fs_recovery.c
+++ b/gfs2/fsck/fs_recovery.c
@@ -427,7 +427,7 @@ static int check_journal_seq_no(struct gfs2_inode *ip, int fix)
highest_seq++;
prev_seq = highest_seq;
log_warn(_("Renumbering it as 0x%"PRIx64"\n"), highest_seq);
- block_map(ip, blk, &new, &dblock, NULL, 0);
+ lgfs2_block_map(ip, blk, &new, &dblock, NULL, 0);
bh = lgfs2_bread(ip->i_sbd, dblock);
((struct gfs2_log_header *)bh->b_data)->lh_sequence = cpu_to_be64(highest_seq);
lgfs2_bmodified(bh);
@@ -692,7 +692,7 @@ int replay_journals(struct gfs2_sbd *sdp, int preen, int force_check,
if (error)
/* Don't use fsck_inode_put here because it's a
system file and we need to dismantle it. */
- inode_put(&sdp->md.journal[i]);
+ lgfs2_inode_put(&sdp->md.journal[i]);
error = 0; /* bad journal is non-fatal */
}
if (!sdp->md.journal[i]) {
@@ -768,7 +768,7 @@ int ji_update(struct gfs2_sbd *sdp)
if (sdp->gfs1) {
struct gfs_jindex *ji;
- error = gfs2_readi(ip,
+ error = lgfs2_readi(ip,
buf, i * sizeof(struct gfs_jindex),
sizeof(struct gfs_jindex));
if (!error)
@@ -786,7 +786,7 @@ int ji_update(struct gfs2_sbd *sdp)
/* FIXME check snprintf return code */
snprintf(journal_name, JOURNAL_NAME_SIZE,
"journal%u", i);
- gfs2_lookupi(sdp->md.jiinode, journal_name,
+ lgfs2_lookupi(sdp->md.jiinode, journal_name,
strlen(journal_name), &jip);
sdp->md.journal[i] = jip;
}
@@ -852,7 +852,7 @@ int build_jindex(struct gfs2_sbd *sdp)
{
struct gfs2_inode *jindex;
- jindex = createi(sdp->master_dir, "jindex", S_IFDIR | 0700,
+ jindex = lgfs2_createi(sdp->master_dir, "jindex", S_IFDIR | 0700,
GFS2_DIF_SYSTEM);
if (jindex == NULL) {
return errno;
@@ -862,10 +862,10 @@ int build_jindex(struct gfs2_sbd *sdp)
int ret = lgfs2_build_journal(sdp, j, jindex);
if (ret)
return ret;
- inode_put(&sdp->md.journal[j]);
+ lgfs2_inode_put(&sdp->md.journal[j]);
}
free(sdp->md.journal);
- inode_put(&jindex);
+ lgfs2_inode_put(&jindex);
return 0;
}
@@ -884,7 +884,7 @@ int init_jindex(struct gfs2_sbd *sdp, int allow_ji_rebuild)
if (sdp->gfs1)
sdp->md.jiinode = lgfs2_inode_read(sdp, sdp->sd_jindex_di.in_addr);
else
- gfs2_lookupi(sdp->master_dir, "jindex", 6, &sdp->md.jiinode);
+ lgfs2_lookupi(sdp->master_dir, "jindex", 6, &sdp->md.jiinode);
if (!sdp->md.jiinode) {
int err;
@@ -906,7 +906,7 @@ int init_jindex(struct gfs2_sbd *sdp, int allow_ji_rebuild)
log_crit(_("Error %d rebuilding jindex\n"), err);
return err;
}
- gfs2_lookupi(sdp->master_dir, "jindex", 6, &sdp->md.jiinode);
+ lgfs2_lookupi(sdp->master_dir, "jindex", 6, &sdp->md.jiinode);
}
/* check for irrelevant entries in jindex. Can't use check_dir because
@@ -929,8 +929,8 @@ int init_jindex(struct gfs2_sbd *sdp, int allow_ji_rebuild)
"valid jindex file.\n"));
return -1;
}
- inode_put(&sdp->md.jiinode);
- gfs2_dirent_del(sdp->master_dir, "jindex", 6);
+ lgfs2_inode_put(&sdp->md.jiinode);
+ lgfs2_dirent_del(sdp->master_dir, "jindex", 6);
log_err(_("Corrupt journal index was removed.\n"));
error = build_jindex(sdp);
if (error) {
@@ -938,7 +938,7 @@ int init_jindex(struct gfs2_sbd *sdp, int allow_ji_rebuild)
"index: Cannot continue.\n"));
return error;
}
- gfs2_lookupi(sdp->master_dir, "jindex", 6,
+ lgfs2_lookupi(sdp->master_dir, "jindex", 6,
&sdp->md.jiinode);
}
}
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index e65ec619..63024a87 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -446,7 +446,7 @@ static int rebuild_master(struct gfs2_sbd *sdp)
log_err(_("Trying to rebuild the master directory.\n"));
inum.in_formal_ino = sdp->md.next_inum++;
inum.in_addr = sdp->sd_meta_dir.in_addr;
- err = init_dinode(sdp, &bh, &inum, S_IFDIR | 0755, GFS2_DIF_SYSTEM, &inum);
+ err = lgfs2_init_dinode(sdp, &bh, &inum, S_IFDIR | 0755, GFS2_DIF_SYSTEM, &inum);
if (err != 0)
return -1;
sdp->master_dir = lgfs2_inode_get(sdp, bh);
@@ -459,7 +459,7 @@ static int rebuild_master(struct gfs2_sbd *sdp)
if (fix_md.jiinode) {
inum.in_formal_ino = sdp->md.next_inum++;
inum.in_addr = fix_md.jiinode->i_num.in_addr;
- err = dir_add(sdp->master_dir, "jindex", 6, &inum,
+ err = lgfs2_dir_add(sdp->master_dir, "jindex", 6, &inum,
IF2DT(S_IFDIR | 0700));
if (err) {
log_crit(_("Error %d adding jindex directory\n"), errno);
@@ -477,7 +477,7 @@ static int rebuild_master(struct gfs2_sbd *sdp)
if (fix_md.pinode) {
inum.in_formal_ino = sdp->md.next_inum++;
inum.in_addr = fix_md.pinode->i_num.in_addr;
- err = dir_add(sdp->master_dir, "per_node", 8, &inum,
+ err = lgfs2_dir_add(sdp->master_dir, "per_node", 8, &inum,
IF2DT(S_IFDIR | 0700));
if (err) {
log_crit(_("Error %d adding per_node directory\n"),
@@ -497,7 +497,7 @@ static int rebuild_master(struct gfs2_sbd *sdp)
if (fix_md.inum) {
inum.in_formal_ino = sdp->md.next_inum++;
inum.in_addr = fix_md.inum->i_num.in_addr;
- err = dir_add(sdp->master_dir, "inum", 4, &inum,
+ err = lgfs2_dir_add(sdp->master_dir, "inum", 4, &inum,
IF2DT(S_IFREG | 0600));
if (err) {
log_crit(_("Error %d adding inum inode\n"), errno);
@@ -517,7 +517,7 @@ static int rebuild_master(struct gfs2_sbd *sdp)
if (fix_md.statfs) {
inum.in_formal_ino = sdp->md.next_inum++;
inum.in_addr = fix_md.statfs->i_num.in_addr;
- err = dir_add(sdp->master_dir, "statfs", 6, &inum,
+ err = lgfs2_dir_add(sdp->master_dir, "statfs", 6, &inum,
IF2DT(S_IFREG | 0600));
if (err) {
log_crit(_("Error %d adding statfs inode\n"), errno);
@@ -537,7 +537,7 @@ static int rebuild_master(struct gfs2_sbd *sdp)
if (fix_md.riinode) {
inum.in_formal_ino = sdp->md.next_inum++;
inum.in_addr = fix_md.riinode->i_num.in_addr;
- err = dir_add(sdp->master_dir, "rindex", 6, &inum,
+ err = lgfs2_dir_add(sdp->master_dir, "rindex", 6, &inum,
IF2DT(S_IFREG | 0600));
if (err) {
log_crit(_("Error %d adding rindex inode\n"), errno);
@@ -549,13 +549,13 @@ static int rebuild_master(struct gfs2_sbd *sdp)
log_crit(_("Error building rindex inode: %s\n"), strerror(errno));
exit(FSCK_ERROR);
}
- inode_put(&rip);
+ lgfs2_inode_put(&rip);
}
if (fix_md.qinode) {
inum.in_formal_ino = sdp->md.next_inum++;
inum.in_addr = fix_md.qinode->i_num.in_addr;
- err = dir_add(sdp->master_dir, "quota", 5, &inum,
+ err = lgfs2_dir_add(sdp->master_dir, "quota", 5, &inum,
IF2DT(S_IFREG | 0600));
if (err) {
log_crit(_("Error %d adding quota inode\n"), errno);
@@ -567,13 +567,13 @@ static int rebuild_master(struct gfs2_sbd *sdp)
log_crit(_("Error building quota inode: %s\n"), strerror(errno));
exit(FSCK_ERROR);
}
- inode_put(&qip);
+ lgfs2_inode_put(&qip);
}
log_err(_("Master directory rebuilt.\n"));
- inode_put(&sdp->md.inum);
- inode_put(&sdp->md.statfs);
- inode_put(&sdp->master_dir);
+ lgfs2_inode_put(&sdp->md.inum);
+ lgfs2_inode_put(&sdp->md.statfs);
+ lgfs2_inode_put(&sdp->master_dir);
return 0;
}
@@ -595,7 +595,7 @@ static void lookup_per_node(struct gfs2_sbd *sdp, int allow_rebuild)
if (sdp->md.pinode)
return;
- gfs2_lookupi(sdp->master_dir, "per_node", 8, &sdp->md.pinode);
+ lgfs2_lookupi(sdp->master_dir, "per_node", 8, &sdp->md.pinode);
if (sdp->md.pinode)
return;
if (!allow_rebuild) {
@@ -616,7 +616,7 @@ static void lookup_per_node(struct gfs2_sbd *sdp, int allow_rebuild)
exit(FSCK_ERROR);
}
}
- gfs2_lookupi(sdp->master_dir, "per_node", 8, &sdp->md.pinode);
+ lgfs2_lookupi(sdp->master_dir, "per_node", 8, &sdp->md.pinode);
if (!sdp->md.pinode) {
log_err( _("Unable to rebuild per_node; aborting.\n"));
exit(FSCK_ERROR);
@@ -796,7 +796,7 @@ static int init_system_inodes(struct gfs2_sbd *sdp)
*******************************************************************/
if (!sdp->gfs1) {
/* Look for "inum" entry in master dinode */
- gfs2_lookupi(sdp->master_dir, "inum", 4, &sdp->md.inum);
+ lgfs2_lookupi(sdp->master_dir, "inum", 4, &sdp->md.inum);
if (!sdp->md.inum) {
if (!query( _("The gfs2 system inum inode is missing. "
"Okay to rebuild it? (y/n) "))) {
@@ -816,7 +816,7 @@ static int init_system_inodes(struct gfs2_sbd *sdp)
}
}
/* Read inum entry into buffer */
- err = gfs2_readi(sdp->md.inum, &inumbuf, 0,
+ err = lgfs2_readi(sdp->md.inum, &inumbuf, 0,
sdp->md.inum->i_size);
if (err != sdp->md.inum->i_size) {
log_crit(_("Error %d reading system inum inode. "
@@ -847,7 +847,7 @@ static int init_system_inodes(struct gfs2_sbd *sdp)
goto fail;
}
} else
- gfs2_lookupi(sdp->master_dir, "statfs", 6, &sdp->md.statfs);
+ lgfs2_lookupi(sdp->master_dir, "statfs", 6, &sdp->md.statfs);
if (!sdp->gfs1 && !sdp->md.statfs) {
if (!query( _("The gfs2 system statfs inode is missing. "
"Okay to rebuild it? (y/n) "))) {
@@ -872,7 +872,7 @@ static int init_system_inodes(struct gfs2_sbd *sdp)
if (sdp->md.statfs->i_size) {
buf = malloc(sdp->md.statfs->i_size);
if (buf) {
- err = gfs2_readi(sdp->md.statfs, buf, 0,
+ err = lgfs2_readi(sdp->md.statfs, buf, 0,
sdp->md.statfs->i_size);
if (err != sdp->md.statfs->i_size) {
log_crit(_("Error %d reading statfs file. "
@@ -904,7 +904,7 @@ static int init_system_inodes(struct gfs2_sbd *sdp)
goto fail;
}
} else
- gfs2_lookupi(sdp->master_dir, "quota", 5, &sdp->md.qinode);
+ lgfs2_lookupi(sdp->master_dir, "quota", 5, &sdp->md.qinode);
if (!sdp->gfs1 && !sdp->md.qinode) {
if (!query( _("The gfs2 system quota inode is missing. "
"Okay to rebuild it? (y/n) "))) {
@@ -992,10 +992,10 @@ static void peruse_system_dinode(struct gfs2_sbd *sdp, struct gfs2_inode *ip)
} else if (!sdp->gfs1 && is_dir(ip, sdp->gfs1)) {
/* Check for a jindex dir entry. Only one system dir has a
jindex: master */
- gfs2_lookupi(ip, "jindex", 6, &child_ip);
+ lgfs2_lookupi(ip, "jindex", 6, &child_ip);
if (child_ip) {
if (fix_md.jiinode || is_journal_copy(ip)) {
- inode_put(&child_ip);
+ lgfs2_inode_put(&child_ip);
goto out_discard_ip;
}
fix_md.jiinode = child_ip;
@@ -1007,15 +1007,15 @@ static void peruse_system_dinode(struct gfs2_sbd *sdp, struct gfs2_inode *ip)
/* Check for a statfs_change0 dir entry. Only one system dir
has a statfs_change: per_node, and its .. will be master. */
- gfs2_lookupi(ip, "statfs_change0", 14, &child_ip);
+ lgfs2_lookupi(ip, "statfs_change0", 14, &child_ip);
if (child_ip) {
- inode_put(&child_ip);
+ lgfs2_inode_put(&child_ip);
if (fix_md.pinode || is_journal_copy(ip))
goto out_discard_ip;
log_warn(_("Found system per_node directory at: 0x%"PRIx64"\n"),
ip->i_num.in_addr);
fix_md.pinode = ip;
- error = dir_search(ip, "..", 2, NULL, &inum);
+ error = lgfs2_dir_search(ip, "..", 2, NULL, &inum);
if (!error && inum.in_addr) {
sdp->sd_meta_dir.in_addr = inum.in_addr;
log_warn(_("From per_node's '..' master directory backtracked to: "
@@ -1049,7 +1049,7 @@ static void peruse_system_dinode(struct gfs2_sbd *sdp, struct gfs2_inode *ip)
log_warn(_("Found system quota file at: 0x%"PRIx64"\n"), ip->i_num.in_addr);
} else {
out_discard_ip:
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
}
}
@@ -1095,27 +1095,27 @@ static void peruse_user_dinode(struct gfs2_sbd *sdp, struct gfs2_inode *ip)
return;
}
while (ip) {
- gfs2_lookupi(ip, "..", 2, &parent_ip);
+ lgfs2_lookupi(ip, "..", 2, &parent_ip);
if (parent_ip && parent_ip->i_num.in_addr == ip->i_num.in_addr) {
log_warn(_("Found the root directory at: 0x%"PRIx64"\n"),
ip->i_num.in_addr);
sdp->sd_root_dir.in_addr = ip->i_num.in_addr;
- inode_put(&parent_ip);
- inode_put(&ip);
+ lgfs2_inode_put(&parent_ip);
+ lgfs2_inode_put(&ip);
return;
}
if (!parent_ip)
break;
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
ip = parent_ip;
}
- error = dir_search(ip, "..", 2, NULL, &inum);
+ error = lgfs2_dir_search(ip, "..", 2, NULL, &inum);
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);
}
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
}
/**
@@ -1205,7 +1205,7 @@ static int peruse_metadata(struct gfs2_sbd *sdp, uint64_t startblock)
continue;
}
ip = lgfs2_inode_get(sdp, bh);
- ip->bh_owned = 1; /* inode_put() will free the bh */
+ ip->bh_owned = 1; /* lgfs2_inode_put() will free the bh */
if (ip->i_flags & GFS2_DIF_SYSTEM)
peruse_system_dinode(sdp, ip);
else
@@ -1289,7 +1289,7 @@ static int sb_repair(struct gfs2_sbd *sdp)
}
inum.in_formal_ino = 1;
inum.in_addr = possible_root;
- error = init_dinode(sdp, &bh, &inum, S_IFDIR | 0755, 0, &inum);
+ error = lgfs2_init_dinode(sdp, &bh, &inum, S_IFDIR | 0755, 0, &inum);
if (error != 0)
return -1;
lgfs2_brelse(bh);
@@ -1314,8 +1314,8 @@ static int sb_repair(struct gfs2_sbd *sdp)
}
sdp->sd_fs_format = GFS2_FORMAT_FS;
lgfs2_sb_write(sdp, sdp->device_fd);
- inode_put(&sdp->md.rooti);
- inode_put(&sdp->master_dir);
+ lgfs2_inode_put(&sdp->md.rooti);
+ lgfs2_inode_put(&sdp->master_dir);
sb_fixed = 1;
} else {
log_crit(_("GFS2 superblock not fixed; fsck cannot proceed "
@@ -1436,7 +1436,7 @@ static int correct_journal_seg_size(struct gfs2_sbd *sdp)
char buf[sizeof(struct gfs_jindex)];
unsigned int jsize = GFS2_DEFAULT_JSIZE * 1024 * 1024;
- count = gfs2_readi(sdp->md.jiinode, buf, 0, sizeof(struct gfs_jindex));
+ count = lgfs2_readi(sdp->md.jiinode, buf, 0, sizeof(struct gfs_jindex));
if (count != sizeof(struct gfs_jindex)) {
log_crit(_("Error %d reading system journal index inode. "
"Aborting\n"), count);
@@ -1462,7 +1462,7 @@ static int correct_journal_seg_size(struct gfs2_sbd *sdp)
return 0;
}
- count = gfs2_readi(sdp->md.jiinode, buf, sizeof(struct gfs_jindex),
+ count = lgfs2_readi(sdp->md.jiinode, buf, sizeof(struct gfs_jindex),
sizeof(struct gfs_jindex));
if (count != sizeof(struct gfs_jindex)) {
log_crit(_("Error %d reading system journal index inode. "
@@ -1496,7 +1496,7 @@ static int reconstruct_journals(struct gfs2_sbd *sdp)
log_err(_("Clearing GFS journals (this may take a while)\n"));
for (i = 0; i < sdp->md.journals; i++) {
- count = gfs2_readi(sdp->md.jiinode, buf,
+ count = lgfs2_readi(sdp->md.jiinode, buf,
i * sizeof(struct gfs_jindex),
sizeof(struct gfs_jindex));
if (count != sizeof(struct gfs_jindex))
@@ -1521,7 +1521,7 @@ static int init_rindex(struct gfs2_sbd *sdp)
if (sdp->gfs1)
sdp->md.riinode = lgfs2_inode_read(sdp, sdp->sd_rindex_di.in_addr);
else
- gfs2_lookupi(sdp->master_dir, "rindex", 6, &sdp->md.riinode);
+ lgfs2_lookupi(sdp->master_dir, "rindex", 6, &sdp->md.riinode);
if (sdp->md.riinode)
return 0;
@@ -1536,7 +1536,7 @@ static int init_rindex(struct gfs2_sbd *sdp)
log_crit(_("Error rebuilding rindex: %s\n"), strerror(errno));
return -1;
}
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
return 0;
}
@@ -1615,7 +1615,7 @@ int initialize(struct gfs2_sbd *sdp, int force_check, int preen,
(sdp->master_dir->i_magic != GFS2_MAGIC ||
sdp->master_dir->i_mh_type != GFS2_METATYPE_DI ||
!sdp->master_dir->i_size)) {
- inode_put(&sdp->master_dir);
+ lgfs2_inode_put(&sdp->master_dir);
rebuild_master(sdp);
sdp->master_dir = lgfs2_inode_read(sdp, sdp->sd_meta_dir.in_addr);
if (sdp->master_dir == NULL) {
diff --git a/gfs2/fsck/lost_n_found.c b/gfs2/fsck/lost_n_found.c
index 65e13125..8c66bea8 100644
--- a/gfs2/fsck/lost_n_found.c
+++ b/gfs2/fsck/lost_n_found.c
@@ -77,12 +77,12 @@ static void add_dotdot(struct gfs2_inode *ip)
"in directory tree.\n"),
ip->i_num.in_addr);
}
- if (gfs2_dirent_del(ip, "..", 2))
+ if (lgfs2_dirent_del(ip, "..", 2))
log_warn( _("add_inode_to_lf: Unable to remove "
"\"..\" directory entry.\n"));
no = lf_dip->i_num;
- err = dir_add(ip, "..", 2, &no, (sdp->gfs1 ? GFS_FILE_DIR : DT_DIR));
+ err = lgfs2_dir_add(ip, "..", 2, &no, (sdp->gfs1 ? GFS_FILE_DIR : DT_DIR));
if (err) {
log_crit(_("Error adding .. directory: %s\n"),
strerror(errno));
@@ -103,16 +103,16 @@ void make_sure_lf_exists(struct gfs2_inode *ip)
root_entries = sdp->md.rooti->i_entries;
log_info( _("Locating/Creating lost+found directory\n"));
- /* if this is gfs1, we have to trick createi into using
+ /* if this is gfs1, we have to trick lgfs2_createi into using
no_formal_ino = no_addr, so we set next_inum to the
free block we're about to allocate. */
if (sdp->gfs1)
sdp->md.next_inum = find_free_blk(sdp);
mode = (sdp->gfs1 ? DT2IF(GFS_FILE_DIR) : S_IFDIR) | 0700;
if (sdp->gfs1)
- lf_dip = gfs_createi(sdp->md.rooti, "lost+found", mode, 0);
+ lf_dip = lgfs2_gfs_createi(sdp->md.rooti, "lost+found", mode, 0);
else
- lf_dip = createi(sdp->md.rooti, "lost+found",
+ lf_dip = lgfs2_createi(sdp->md.rooti, "lost+found",
S_IFDIR | 0700, 0);
if (lf_dip == NULL) {
log_crit(_("Error creating lost+found: %s\n"),
@@ -120,7 +120,7 @@ void make_sure_lf_exists(struct gfs2_inode *ip)
exit(FSCK_ERROR);
}
- /* createi will have incremented the di_nlink link count for the root
+ /* lgfs2_createi will have incremented the di_nlink link count for the root
directory. We must set the nlink value in the hash table to keep
them in sync so that pass4 can detect and fix any descrepancies. */
set_di_nlink(sdp->md.rooti);
@@ -226,7 +226,7 @@ int add_inode_to_lf(struct gfs2_inode *ip){
}
no = ip->i_num;
- err = dir_add(lf_dip, tmp_name, strlen(tmp_name), &no, inode_type);
+ err = lgfs2_dir_add(lf_dip, tmp_name, strlen(tmp_name), &no, inode_type);
if (err) {
log_crit(_("Error adding directory %s: %s\n"),
tmp_name, strerror(errno));
diff --git a/gfs2/fsck/main.c b/gfs2/fsck/main.c
index 446f4f85..3c432be8 100644
--- a/gfs2/fsck/main.c
+++ b/gfs2/fsck/main.c
@@ -167,7 +167,7 @@ static int check_statfs(struct gfs2_sbd *sdp)
return 0;
}
/* Read the current statfs values */
- count = gfs2_readi(sdp->md.statfs, &sc, 0, sdp->md.statfs->i_size);
+ count = lgfs2_readi(sdp->md.statfs, &sc, 0, sdp->md.statfs->i_size);
if (count != sizeof(struct gfs2_statfs_change)) {
log_err(_("Failed to read statfs values (%d of %"PRIu64" read)\n"),
count, sdp->md.statfs->i_size);
@@ -328,22 +328,22 @@ int main(int argc, char **argv)
/* Free up our system inodes */
if (!sdp->gfs1)
- inode_put(&sdp->md.inum);
- inode_put(&sdp->md.statfs);
+ lgfs2_inode_put(&sdp->md.inum);
+ lgfs2_inode_put(&sdp->md.statfs);
for (j = 0; j < sdp->md.journals; j++)
- inode_put(&sdp->md.journal[j]);
+ lgfs2_inode_put(&sdp->md.journal[j]);
free(sdp->md.journal);
sdp->md.journal = NULL;
- inode_put(&sdp->md.jiinode);
- inode_put(&sdp->md.riinode);
- inode_put(&sdp->md.qinode);
+ lgfs2_inode_put(&sdp->md.jiinode);
+ lgfs2_inode_put(&sdp->md.riinode);
+ lgfs2_inode_put(&sdp->md.qinode);
if (!sdp->gfs1)
- inode_put(&sdp->md.pinode);
- inode_put(&sdp->md.rooti);
+ lgfs2_inode_put(&sdp->md.pinode);
+ lgfs2_inode_put(&sdp->md.rooti);
if (!sdp->gfs1)
- inode_put(&sdp->master_dir);
+ lgfs2_inode_put(&sdp->master_dir);
if (lf_dip)
- inode_put(&lf_dip);
+ lgfs2_inode_put(&lf_dip);
if (!opts.no && errors_corrected)
log_notice( _("Writing changes to disk\n"));
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 2f0ba6c2..a5b3fe36 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -231,7 +231,7 @@ struct gfs2_inode *fsck_system_inode(struct gfs2_sbd *sdp, uint64_t block)
if (lf_dip && lf_dip->i_num.in_addr == block)
return lf_dip;
if (!sdp->gfs1)
- return is_system_inode(sdp, block);
+ return lgfs2_is_system_inode(sdp, block);
if (sdp->md.statfs && block == sdp->md.statfs->i_num.in_addr)
return sdp->md.statfs;
@@ -287,7 +287,7 @@ struct gfs2_inode *fsck_inode_get(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
return ip;
}
-/* fsck_inode_put - same as inode_put() in libgfs2 but system inodes
+/* fsck_inode_put - same as lgfs2_inode_put() in libgfs2 but system inodes
get special treatment. */
void fsck_inode_put(struct gfs2_inode **ip_in)
{
@@ -296,7 +296,7 @@ void fsck_inode_put(struct gfs2_inode **ip_in)
sysip = fsck_system_inode(ip->i_sbd, ip->i_num.in_addr);
if (!sysip)
- inode_put(ip_in);
+ lgfs2_inode_put(ip_in);
}
/**
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 0e67ee35..c2d6cae4 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -154,7 +154,7 @@ static int pass1_repair_leaf(struct gfs2_inode *ip, uint64_t *leaf_no,
if (ip->i_sbd->gfs1)
gfs1_writei(ip, padbuf, lindex * sizeof(uint64_t), pad_size);
else
- gfs2_writei(ip, padbuf, lindex * sizeof(uint64_t), pad_size);
+ lgfs2_writei(ip, padbuf, lindex * sizeof(uint64_t), pad_size);
free(padbuf);
log_err(_("Directory Inode %"PRIu64" (0x%"PRIx64") patched.\n"),
ip->i_num.in_addr, ip->i_num.in_addr);
@@ -1463,7 +1463,7 @@ static int check_system_inode(struct gfs2_sbd *sdp,
gfs2_blockmap_set(bl, iblock, GFS2_BLKST_FREE);
check_n_fix_bitmap(sdp, (*sysinode)->i_rgd, iblock, 0,
GFS2_BLKST_FREE);
- inode_put(sysinode);
+ lgfs2_inode_put(sysinode);
}
}
if (*sysinode) {
@@ -1490,8 +1490,8 @@ static int check_system_inode(struct gfs2_sbd *sdp,
"flag. It should be rebuilt.\n"), filename);
if (sysdir && query(_("Delete the corrupt %s system "
"inode? (y/n) "), filename)) {
- inode_put(sysinode);
- gfs2_dirent_del(sysdir, filename,
+ lgfs2_inode_put(sysinode);
+ lgfs2_dirent_del(sysdir, filename,
strlen(filename));
/* Set the blockmap (but not bitmap) back to
'free' so that it gets checked like any
@@ -1567,7 +1567,7 @@ static int build_a_journal(struct gfs2_sbd *sdp)
/* First, try to delete the journal if it's in jindex */
sprintf(name, "journal%u", sdp->md.journals);
- gfs2_dirent_del(sdp->md.jiinode, name, strlen(name));
+ lgfs2_dirent_del(sdp->md.jiinode, name, strlen(name));
/* Now rebuild it */
err = lgfs2_build_journal(sdp, sdp->md.journals, sdp->md.jiinode);
if (err) {
@@ -1582,7 +1582,7 @@ int build_per_node(struct gfs2_sbd *sdp)
struct gfs2_inode *per_node;
unsigned int j;
- per_node = createi(sdp->master_dir, "per_node", S_IFDIR | 0700,
+ per_node = lgfs2_createi(sdp->master_dir, "per_node", S_IFDIR | 0700,
GFS2_DIF_SYSTEM);
if (per_node == NULL) {
log_err(_("Error building '%s': %s\n"), "per_node", strerror(errno));
@@ -1597,7 +1597,7 @@ int build_per_node(struct gfs2_sbd *sdp)
strerror(errno));
return 1;
}
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
ip = lgfs2_build_statfs_change(per_node, j);
if (ip == NULL) {
@@ -1605,7 +1605,7 @@ int build_per_node(struct gfs2_sbd *sdp)
strerror(errno));
return 1;
}
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
ip = lgfs2_build_quota_change(per_node, j);
if (ip == NULL) {
@@ -1613,9 +1613,9 @@ int build_per_node(struct gfs2_sbd *sdp)
strerror(errno));
return 1;
}
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
}
- inode_put(&per_node);
+ lgfs2_inode_put(&per_node);
return 0;
}
@@ -1624,7 +1624,7 @@ static int build_inum(struct gfs2_sbd *sdp)
struct gfs2_inode *ip = lgfs2_build_inum(sdp);
if (ip == NULL)
return -1;
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
return 0;
}
@@ -1633,7 +1633,7 @@ static int build_statfs(struct gfs2_sbd *sdp)
struct gfs2_inode *ip = lgfs2_build_statfs(sdp);
if (ip == NULL)
return -1;
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
return 0;
}
@@ -1642,7 +1642,7 @@ static int build_rindex(struct gfs2_sbd *sdp)
struct gfs2_inode *ip = lgfs2_build_rindex(sdp);
if (ip == NULL)
return -1;
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
return 0;
}
@@ -1651,7 +1651,7 @@ static int build_quota(struct gfs2_sbd *sdp)
struct gfs2_inode *ip = lgfs2_build_quota(sdp);
if (ip == NULL)
return -1;
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
return 0;
}
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 92c816ce..71e10e96 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -206,7 +206,7 @@ static int bad_formal_ino(struct gfs2_inode *ip, struct gfs2_dirent *dent,
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.in_addr);
- error = dir_search(child_ip, "..", 2, NULL, &childs_dotdot);
+ error = lgfs2_dir_search(child_ip, "..", 2, NULL, &childs_dotdot);
if (!error && childs_dotdot.in_addr == ip->i_num.in_addr) {
log_err( _("The entry points to another directory with intact "
"linkage.\n"));
@@ -223,12 +223,12 @@ static int bad_formal_ino(struct gfs2_inode *ip, struct gfs2_dirent *dent,
}
} else {
if (query( _("Remove the corrupt directory entry? (y/n) "))) {
- inode_put(&child_ip);
+ lgfs2_inode_put(&child_ip);
return 1;
}
log_err( _("Corrupt directory entry not removed.\n"));
}
- inode_put(&child_ip);
+ lgfs2_inode_put(&child_ip);
return 0;
}
@@ -337,7 +337,7 @@ static int wrong_leaf(struct gfs2_inode *ip, struct lgfs2_inum *entry,
free(tbl);
/* check if it's already on the correct leaf block */
- error = dir_search(ip, tmp_name, d->dr_name_len, NULL, &d->dr_inum);
+ error = lgfs2_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"));
@@ -347,7 +347,7 @@ static int wrong_leaf(struct gfs2_inode *ip, struct lgfs2_inum *entry,
}
di_depth = ip->i_depth;
- if (dir_add(ip, tmp_name, d->dr_name_len, &d->dr_inum, d->dr_type) == 0) {
+ if (lgfs2_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) {
@@ -400,7 +400,7 @@ static int wrong_leaf(struct gfs2_inode *ip, struct lgfs2_inum *entry,
The reason is: *count is the count of dentries on the leaf,
and we moved the dentry to a previous leaf within the same
directory dinode. So the directory counts still get
- incremented, but not leaf entries. When we called dir_add
+ incremented, but not leaf entries. When we called lgfs2_dir_add
above, it should have fixed that prev leaf's lf_entries. */
ds->entry_count++;
return 1;
@@ -656,7 +656,7 @@ static int dirref_find(struct gfs2_inode *ip, struct gfs2_dirent *dent,
}
decr_link_count(entry->in_addr, ip->i_num.in_addr, ip->i_sbd->gfs1,
_("bad original reference"));
- dirent2_del(ip, bh, prev, dent);
+ lgfs2_dirent2_del(ip, bh, prev, dent);
log_err(_("The corrupt directory entry '%s' was deleted.\n"), fn);
out:
return -1; /* force check_dir to stop; don't waste time. */
@@ -914,7 +914,7 @@ dentry_is_valid:
return 0;
nuke_dentry:
- dirent2_del(ip, bh, prev_de, dent);
+ lgfs2_dirent2_del(ip, bh, prev_de, dent);
log_err( _("Bad directory entry '%s' cleared.\n"), tmp_name);
return 1;
}
@@ -1003,7 +1003,7 @@ static int write_new_leaf(struct gfs2_inode *dip, int start_lindex,
count = gfs1_writei(dip, padbuf, start_lindex *
sizeof(uint64_t), pad_size);
else
- count = gfs2_writei(dip, padbuf, start_lindex *
+ count = lgfs2_writei(dip, padbuf, start_lindex *
sizeof(uint64_t), pad_size);
free(padbuf);
if (count != pad_size) {
@@ -1123,7 +1123,7 @@ static int lost_leaf(struct gfs2_inode *ip, __be64 *tbl, uint64_t leafno,
"\"%s\".\n"), tmp_name);
} else {
- error = dir_add(lf_dip, filename,
+ error = lgfs2_dir_add(lf_dip, filename,
de.dr_name_len, &de.dr_inum,
de.dr_type);
if (error && error != -EEXIST) {
@@ -1194,7 +1194,7 @@ static int basic_check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
error = basic_dentry_checks(ip, dent, &entry, tmp_name, count, de,
ds, &q, bh, &isdir);
if (error) {
- dirent2_del(ip, bh, prev_de, dent);
+ lgfs2_dirent2_del(ip, bh, prev_de, dent);
log_err( _("Bad directory entry '%s' cleared.\n"), tmp_name);
return 1;
} else {
@@ -1336,7 +1336,7 @@ static int fix_hashtable(struct gfs2_inode *ip, __be64 *tbl, unsigned hsize,
if ((dentry.dr_rec_len == ip->i_sbd->sd_bsize - sizeof(struct gfs2_leaf)) &&
(dentry.dr_inum.in_formal_ino == 0)) {
lgfs2_brelse(lbh);
- gfs2_free_block(ip->i_sbd, leafblk);
+ lgfs2_free_block(ip->i_sbd, leafblk);
log_err(_("Out of place leaf block %"PRIu64" (0x%"PRIx64") had no "
"entries, so it was deleted.\n"),
leafblk, leafblk);
@@ -1401,8 +1401,8 @@ static int fix_hashtable(struct gfs2_inode *ip, __be64 *tbl, unsigned hsize,
"0x%x.\n"), factor, len, proper_start);
changes++;
new_leaf_blk = find_free_blk(ip->i_sbd);
- dir_split_leaf(ip, lindex, leafblk, lbh);
- /* re-read the leaf to pick up dir_split_leaf's changes */
+ lgfs2_dir_split_leaf(ip, lindex, leafblk, lbh);
+ /* re-read the leaf to pick up lgfs2_dir_split_leaf's changes */
lgfs2_leaf_in(&leaf, lbh->b_data);
*proper_len = 1 << (ip->i_depth - leaf.lf_depth);
log_err(_("Leaf block %"PRIu64" (0x%"PRIx64") was split from length %d to %d\n"),
@@ -1654,7 +1654,7 @@ static int check_hash_tbl(struct gfs2_inode *ip, __be64 *tbl,
continue;
/* Make sure they call on proper leaf-split boundaries. This
- is the calculation used by the kernel, and dir_split_leaf */
+ is the calculation used by the kernel, and lgfs2_dir_split_leaf */
proper_start = (lindex & ~(proper_len - 1));
if (lindex != proper_start) {
log_debug(_("lindex 0x%x is not a proper starting "
@@ -1823,7 +1823,7 @@ static int check_pernode_for(int x, struct gfs2_inode *pernode, const char *fn,
int error, valid_size = 1;
log_debug(_("Checking system file %s\n"), fn);
- error = gfs2_lookupi(pernode, fn, strlen(fn), &ip);
+ error = lgfs2_lookupi(pernode, fn, strlen(fn), &ip);
if (error) {
log_err(_("System file %s is missing.\n"), fn);
if (!query( _("Rebuild the system file? (y/n) ")))
@@ -1853,7 +1853,7 @@ static int check_pernode_for(int x, struct gfs2_inode *pernode, const char *fn,
goto out_good;
check_metatree(ip, &pass2_fxns_delete);
fsck_inode_put(&ip);
- gfs2_dirent_del(pernode, fn, strlen(fn));
+ lgfs2_dirent_del(pernode, fn, strlen(fn));
goto build_it;
}
out_good:
@@ -1865,7 +1865,7 @@ build_it:
log_err(_("Error building %s\n"), fn);
return -1;
}
- error = gfs2_lookupi(pernode, fn, strlen(fn), &ip);
+ error = lgfs2_lookupi(pernode, fn, strlen(fn), &ip);
if (error) {
log_err(_("Error rebuilding %s.\n"), fn);
return -1;
@@ -1881,7 +1881,7 @@ static int build_inum_range(struct gfs2_inode *per_node, unsigned int n)
if (ip == NULL)
return 1;
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
return 0;
}
@@ -1891,7 +1891,7 @@ static int build_statfs_change(struct gfs2_inode *per_node, unsigned int n)
if (ip == NULL)
return 1;
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
return 0;
}
@@ -1901,7 +1901,7 @@ static int build_quota_change(struct gfs2_inode *per_node, unsigned int n)
if (ip == NULL)
return 1;
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
return 0;
}
@@ -1953,7 +1953,7 @@ static int check_system_dir(struct gfs2_inode *sysinode, const char *dirname,
if (query( _("Is it okay to add '.' entry? (y/n) "))) {
struct lgfs2_inum no = sysinode->i_num;
log_warn( _("Adding '.' entry\n"));
- error = dir_add(sysinode, ".", 1, &no,
+ error = lgfs2_dir_add(sysinode, ".", 1, &no,
(sysinode->i_sbd->gfs1 ? GFS_FILE_DIR : DT_DIR));
if (error) {
log_err(_("Error adding directory %s: %s\n"), "'.'",
@@ -2066,7 +2066,7 @@ static int pass2_check_dir(struct gfs2_sbd *sdp, struct gfs2_inode *ip)
if (query( _("Is it okay to add '.' entry? (y/n) "))) {
struct lgfs2_inum no = ip->i_num;
- error = dir_add(ip, ".", 1, &no,
+ error = lgfs2_dir_add(ip, ".", 1, &no,
(sdp->gfs1 ? GFS_FILE_DIR : DT_DIR));
if (error) {
log_err(_("Error adding directory %s: %s\n"), "'.'",
diff --git a/gfs2/fsck/pass3.c b/gfs2/fsck/pass3.c
index fce3c7f9..e2e20483 100644
--- a/gfs2/fsck/pass3.c
+++ b/gfs2/fsck/pass3.c
@@ -36,12 +36,12 @@ static int attach_dotdot_to(struct gfs2_sbd *sdp, uint64_t newdotdot,
* '..' entry for this directory in
* this case? */
- if (gfs2_dirent_del(ip, filename, filename_len))
+ if (lgfs2_dirent_del(ip, filename, filename_len))
log_warn( _("Unable to remove \"..\" directory entry.\n"));
else
decr_link_count(olddotdot, block, sdp->gfs1, _("old \"..\""));
no = pip->i_num;
- err = dir_add(ip, filename, filename_len, &no,
+ err = lgfs2_dir_add(ip, filename, filename_len, &no,
(sdp->gfs1 ? GFS_FILE_DIR : DT_DIR));
if (err) {
log_err(_("Error adding directory %s: %s\n"),
diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c
index 5dddaefb..825a6398 100644
--- a/gfs2/fsck/rgrepair.c
+++ b/gfs2/fsck/rgrepair.c
@@ -64,7 +64,7 @@ static void find_journaled_rgs(struct gfs2_sbd *sdp)
jblocks = ip->i_size / sdp->sd_bsize;
false_count = 0;
for (b = 0; b < jblocks; b++) {
- block_map(ip, b, &new, &dblock, NULL, 0);
+ lgfs2_block_map(ip, b, &new, &dblock, NULL, 0);
if (!dblock)
break;
bh = lgfs2_bread(sdp, dblock);
@@ -234,7 +234,7 @@ static int find_shortest_rgdist(struct gfs2_sbd *sdp, uint64_t *dist_array,
struct gfs2_rindex ri;
/* read in the second RG index entry for this subd. */
- gfs2_readi(sdp->md.riinode, &ri, sizeof(ri), sizeof(ri));
+ lgfs2_readi(sdp->md.riinode, &ri, sizeof(ri), sizeof(ri));
if (be64_to_cpu(ri.ri_addr) > LGFS2_SB_ADDR(sdp) + 1) { /* sanity check */
log_warn( _("rgrp 2 is damaged: getting dist from index: "));
@@ -681,8 +681,8 @@ static int rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs, int gfs_grow)
error = 0;
out:
for (j = 0; j < sdp->md.journals; j++)
- inode_put(&sdp->md.journal[j]);
- inode_put(&sdp->md.jiinode);
+ lgfs2_inode_put(&sdp->md.journal[j]);
+ lgfs2_inode_put(&sdp->md.jiinode);
free(sdp->md.journal);
return error;
}
@@ -1143,7 +1143,7 @@ int rindex_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok)
if (rindex_modified) {
if (query( _("Fix the index? (y/n)"))) {
lgfs2_rindex_out(expected, (char *)&buf);
- gfs2_writei(sdp->md.riinode, (char *)&buf,
+ lgfs2_writei(sdp->md.riinode, (char *)&buf,
rg * sizeof(struct gfs2_rindex),
sizeof(struct gfs2_rindex));
actual->rt_addr = expected->rt_addr;
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c
index f4d137ed..549c087b 100644
--- a/gfs2/fsck/util.c
+++ b/gfs2/fsck/util.c
@@ -578,7 +578,7 @@ __be64 *get_dir_hash(struct gfs2_inode *ip)
if (tbl == NULL)
return NULL;
- ret = gfs2_readi(ip, tbl, 0, hsize);
+ ret = lgfs2_readi(ip, tbl, 0, hsize);
if (ret != hsize) {
free(tbl);
return NULL;
diff --git a/gfs2/glocktop/glocktop.c b/gfs2/glocktop/glocktop.c
index 9fc7bc64..130cc8a9 100644
--- a/gfs2/glocktop/glocktop.c
+++ b/gfs2/glocktop/glocktop.c
@@ -630,15 +630,15 @@ static const char *show_inode(const char *id, int fd, uint64_t block)
subdepth++;
/* Backtrack the directory to its source */
while (1) {
- error = gfs2_lookupi(ip, "..", 2, &parent);
+ error = lgfs2_lookupi(ip, "..", 2, &parent);
if (error)
break;
/* Stop at the root inode */
if (ip->i_num.in_addr == parent->i_num.in_addr) {
- inode_put(&parent);
+ lgfs2_inode_put(&parent);
break;
}
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
ip = parent;
dirarray[subdepth++] = parent->i_num.in_addr;
}
@@ -657,7 +657,7 @@ static const char *show_inode(const char *id, int fd, uint64_t block)
inode_type = "socket ";
} else
inode_type = "file? ";
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
return inode_type;
}
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index a79c2d2e..432031e1 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -60,7 +60,7 @@ struct gfs2_inode *lgfs2_inode_read(struct gfs2_sbd *sdp, uint64_t di_addr)
return ip;
}
-struct gfs2_inode *is_system_inode(struct gfs2_sbd *sdp, uint64_t block)
+struct gfs2_inode *lgfs2_is_system_inode(struct gfs2_sbd *sdp, uint64_t block)
{
int j;
@@ -87,7 +87,7 @@ struct gfs2_inode *is_system_inode(struct gfs2_sbd *sdp, uint64_t block)
return NULL;
}
-void inode_put(struct gfs2_inode **ip_in)
+void lgfs2_inode_put(struct gfs2_inode **ip_in)
{
struct gfs2_inode *ip = *ip_in;
uint64_t block = ip->i_num.in_addr;
@@ -96,7 +96,7 @@ void inode_put(struct gfs2_inode **ip_in)
if (ip->i_bh != NULL) {
if (ip->i_bh->b_modified) {
lgfs2_dinode_out(ip, ip->i_bh->b_data);
- if (!ip->bh_owned && is_system_inode(sdp, block))
+ if (!ip->bh_owned && lgfs2_is_system_inode(sdp, block))
fprintf(stderr, "Warning: Changes made to inode were discarded.\n");
}
if (ip->bh_owned)
@@ -230,7 +230,7 @@ buffer_copy_tail(struct gfs2_sbd *sdp,
lgfs2_bmodified(to_bh);
}
-void unstuff_dinode(struct gfs2_inode *ip)
+void lgfs2_unstuff_dinode(struct gfs2_inode *ip)
{
struct gfs2_sbd *sdp = ip->i_sbd;
struct gfs2_buffer_head *bh;
@@ -340,7 +340,7 @@ int lgfs2_file_alloc(lgfs2_rgrp_t rg, uint64_t di_size, struct gfs2_inode *ip, u
ip->i_atime = ip->i_mtime = ip->i_ctime = sdp->sd_time;
ip->i_goal_data = ip->i_num.in_addr + ip->i_blocks - 1;
ip->i_goal_meta = ip->i_goal_data - ((di_size + sdp->sd_bsize - 1) / sdp->sd_bsize);
- ip->i_height = calc_tree_height(ip, di_size);
+ ip->i_height = lgfs2_calc_tree_height(ip, di_size);
ip->i_flags = flags;
rg->rt_free -= blocks;
@@ -352,7 +352,7 @@ int lgfs2_file_alloc(lgfs2_rgrp_t rg, uint64_t di_size, struct gfs2_inode *ip, u
return 0;
}
-unsigned int calc_tree_height(struct gfs2_inode *ip, uint64_t size)
+unsigned int lgfs2_calc_tree_height(struct gfs2_inode *ip, uint64_t size)
{
struct gfs2_sbd *sdp = ip->i_sbd;
uint64_t *arr;
@@ -376,7 +376,7 @@ unsigned int calc_tree_height(struct gfs2_inode *ip, uint64_t size)
return height;
}
-void build_height(struct gfs2_inode *ip, int height)
+void lgfs2_build_height(struct gfs2_inode *ip, int height)
{
struct gfs2_sbd *sdp = ip->i_sbd;
struct gfs2_buffer_head *bh;
@@ -423,7 +423,7 @@ void build_height(struct gfs2_inode *ip, int height)
}
}
-void find_metapath(struct gfs2_inode *ip, uint64_t block, struct metapath *mp)
+void lgfs2_find_metapath(struct gfs2_inode *ip, uint64_t block, struct metapath *mp)
{
const uint32_t inptrs = ip->i_sbd->sd_inptrs;
unsigned int i = ip->i_height;
@@ -435,9 +435,9 @@ void find_metapath(struct gfs2_inode *ip, uint64_t block, struct metapath *mp)
}
}
-void lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
- unsigned int height, struct metapath *mp,
- int create, int *new, uint64_t *block)
+void lgfs2_lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
+ unsigned int height, struct metapath *mp,
+ int create, int *new, uint64_t *block)
{
__be64 *ptr = metapointer(bh->b_data, height, mp);
@@ -461,8 +461,8 @@ void lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
*new = 1;
}
-void block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
- uint64_t *dblock, uint32_t *extlen, int prealloc)
+void lgfs2_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
+ uint64_t *dblock, uint32_t *extlen, int prealloc)
{
struct gfs2_sbd *sdp = ip->i_sbd;
struct gfs2_buffer_head *bh;
@@ -489,21 +489,21 @@ void block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
bsize = (S_ISDIR(ip->i_mode)) ? sdp->sd_jbsize : sdp->sd_bsize;
- height = calc_tree_height(ip, (lblock + 1) * bsize);
+ height = lgfs2_calc_tree_height(ip, (lblock + 1) * bsize);
if (ip->i_height < height) {
if (!create)
return;
- build_height(ip, height);
+ lgfs2_build_height(ip, height);
}
- find_metapath(ip, lblock, &mp);
+ lgfs2_find_metapath(ip, lblock, &mp);
end_of_metadata = ip->i_height - 1;
bh = ip->i_bh;
for (x = 0; x < end_of_metadata; x++) {
- lookup_block(ip, bh, x, &mp, create, new, dblock);
+ lgfs2_lookup_block(ip, bh, x, &mp, create, new, dblock);
if (bh != ip->i_bh)
lgfs2_brelse(bh);
if (!*dblock)
@@ -527,7 +527,7 @@ void block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
}
if (!prealloc)
- lookup_block(ip, bh, end_of_metadata, &mp, create, new, dblock);
+ lgfs2_lookup_block(ip, bh, end_of_metadata, &mp, create, new, dblock);
if (extlen && *dblock) {
*extlen = 1;
@@ -540,7 +540,7 @@ void block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
nptrs = (end_of_metadata) ? sdp->sd_inptrs : sdp->sd_diptrs;
while (++mp.mp_list[end_of_metadata] < nptrs) {
- lookup_block(ip, bh, end_of_metadata, &mp, 0, &tmp_new,
+ lgfs2_lookup_block(ip, bh, end_of_metadata, &mp, 0, &tmp_new,
&tmp_dblock);
if (*dblock + *extlen != tmp_dblock)
@@ -569,8 +569,7 @@ copy2mem(struct gfs2_buffer_head *bh, void **buf, unsigned int offset,
*p += size;
}
-int gfs2_readi(struct gfs2_inode *ip, void *buf,
- uint64_t offset, unsigned int size)
+int lgfs2_readi(struct gfs2_inode *ip, void *buf, uint64_t offset, unsigned int size)
{
struct gfs2_sbd *sdp = ip->i_sbd;
struct gfs2_buffer_head *bh;
@@ -616,7 +615,7 @@ int gfs2_readi(struct gfs2_inode *ip, void *buf,
gfs1_block_map(ip, lblock, ¬_new, &dblock,
&extlen, 0);
else
- block_map(ip, lblock, ¬_new, &dblock,
+ lgfs2_block_map(ip, lblock, ¬_new, &dblock,
&extlen, 0);
}
@@ -656,7 +655,7 @@ static void copy_from_mem(struct gfs2_buffer_head *bh, void **buf,
*p += size;
}
-int __gfs2_writei(struct gfs2_inode *ip, void *buf,
+int __lgfs2_writei(struct gfs2_inode *ip, void *buf,
uint64_t offset, unsigned int size, int resize)
{
struct gfs2_sbd *sdp = ip->i_sbd;
@@ -675,7 +674,7 @@ int __gfs2_writei(struct gfs2_inode *ip, void *buf,
if (inode_is_stuffed(ip) &&
((start + size) > (sdp->sd_bsize - sizeof(struct gfs2_dinode))))
- unstuff_dinode(ip);
+ lgfs2_unstuff_dinode(ip);
if (isdir) {
lblock = offset;
@@ -698,7 +697,7 @@ int __gfs2_writei(struct gfs2_inode *ip, void *buf,
if (!extlen) {
new = 1;
- block_map(ip, lblock, &new, &dblock, &extlen, 0);
+ lgfs2_block_map(ip, lblock, &new, &dblock, &extlen, 0);
}
if (new) {
@@ -738,7 +737,7 @@ int __gfs2_writei(struct gfs2_inode *ip, void *buf,
return copied;
}
-int gfs2_dirent_first(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
+int lgfs2_dirent_first(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
struct gfs2_dirent **dent)
{
struct gfs2_meta_header *h = (struct gfs2_meta_header *)bh->b_data;
@@ -752,7 +751,7 @@ int gfs2_dirent_first(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
}
}
-int gfs2_dirent_next(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
+int lgfs2_dirent_next(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
struct gfs2_dirent **dent)
{
char *bh_end;
@@ -782,7 +781,7 @@ static int dirent_alloc(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
unsigned int entries = 0, offset = 0;
int type;
- type = gfs2_dirent_first(dip, bh, &dent);
+ type = lgfs2_dirent_first(dip, bh, &dent);
if (type == IS_LEAF) {
struct gfs2_leaf *leaf = (struct gfs2_leaf *)bh->b_data;
@@ -842,14 +841,14 @@ static int dirent_alloc(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
lgfs2_bmodified(dip->i_bh);
return 0;
}
- } while (gfs2_dirent_next(dip, bh, &dent) == 0);
+ } while (lgfs2_dirent_next(dip, bh, &dent) == 0);
errno = ENOSPC;
return -1;
}
-void dirent2_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
- struct gfs2_dirent *prev, struct gfs2_dirent *cur)
+void lgfs2_dirent2_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
+ struct gfs2_dirent *prev, struct gfs2_dirent *cur)
{
uint16_t cur_rec_len, prev_rec_len;
@@ -882,7 +881,7 @@ void dirent2_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
int lgfs2_get_leaf_ptr(struct gfs2_inode *dip, const uint32_t lindex, uint64_t *ptr)
{
__be64 leaf_no;
- int count = gfs2_readi(dip, (char *)&leaf_no, lindex * sizeof(__be64), sizeof(__be64));
+ int count = lgfs2_readi(dip, (char *)&leaf_no, lindex * sizeof(__be64), sizeof(__be64));
if (count != sizeof(__be64))
return -1;
@@ -890,7 +889,7 @@ int lgfs2_get_leaf_ptr(struct gfs2_inode *dip, const uint32_t lindex, uint64_t *
return 0;
}
-void dir_split_leaf(struct gfs2_inode *dip, uint32_t start, uint64_t leaf_no,
+void lgfs2_dir_split_leaf(struct gfs2_inode *dip, uint32_t start, uint64_t leaf_no,
struct gfs2_buffer_head *obh)
{
struct gfs2_buffer_head *nbh;
@@ -939,10 +938,10 @@ void dir_split_leaf(struct gfs2_inode *dip, uint32_t start, uint64_t leaf_no,
count = gfs1_writei(dip, (char *)lp, start * sizeof(uint64_t),
half_len * sizeof(uint64_t));
else
- count = gfs2_writei(dip, (char *)lp, start * sizeof(uint64_t),
+ count = lgfs2_writei(dip, (char *)lp, start * sizeof(uint64_t),
half_len * sizeof(uint64_t));
if (count != half_len * sizeof(uint64_t)) {
- fprintf(stderr, "dir_split_leaf (2)\n");
+ fprintf(stderr, "lgfs2_dir_split_leaf (2)\n");
exit(1);
}
@@ -950,11 +949,11 @@ void dir_split_leaf(struct gfs2_inode *dip, uint32_t start, uint64_t leaf_no,
divider = (start + half_len) << (32 - dip->i_depth);
- gfs2_dirent_first(dip, obh, &dent);
+ lgfs2_dirent_first(dip, obh, &dent);
do {
next = dent;
- if (gfs2_dirent_next(dip, obh, &next))
+ if (lgfs2_dirent_next(dip, obh, &next))
next = NULL;
if (dent->de_inum.no_formal_ino &&
@@ -964,7 +963,7 @@ void dir_split_leaf(struct gfs2_inode *dip, uint32_t start, uint64_t leaf_no,
name_len = be16_to_cpu(dent->de_name_len);
if (dirent_alloc(dip, nbh, name_len, &new)) {
- fprintf(stderr, "dir_split_leaf (3)\n");
+ fprintf(stderr, "lgfs2_dir_split_leaf (3)\n");
exit(1);
}
@@ -976,7 +975,7 @@ void dir_split_leaf(struct gfs2_inode *dip, uint32_t start, uint64_t leaf_no,
entries = be16_to_cpu(nleaf->lf_entries) + 1;
nleaf->lf_entries = cpu_to_be16(entries);
- dirent2_del(dip, obh, prev, dent);
+ lgfs2_dirent2_del(dip, obh, prev, dent);
if (!prev)
prev = dent;
@@ -990,7 +989,7 @@ void dir_split_leaf(struct gfs2_inode *dip, uint32_t start, uint64_t leaf_no,
if (!moved) {
if (dirent_alloc(dip, nbh, 0, &new)) {
- fprintf(stderr, "dir_split_leaf (4)\n");
+ fprintf(stderr, "lgfs2_dir_split_leaf (4)\n");
exit(1);
}
new->de_inum.no_formal_ino = 0;
@@ -1027,7 +1026,7 @@ static void dir_double_exhash(struct gfs2_inode *dip)
}
for (block = dip->i_size >> sdp->sd_hash_bsize_shift; block--;) {
- count = gfs2_readi(dip, (char *)buf,
+ count = lgfs2_readi(dip, (char *)buf,
block * sdp->sd_hash_bsize,
sdp->sd_hash_bsize);
if (count != sdp->sd_hash_bsize) {
@@ -1048,7 +1047,7 @@ static void dir_double_exhash(struct gfs2_inode *dip)
sdp->sd_hash_bsize,
block * sdp->sd_bsize, sdp->sd_bsize);
else
- count = gfs2_writei(dip, (char *)buf +
+ count = lgfs2_writei(dip, (char *)buf +
sdp->sd_hash_bsize,
block * sdp->sd_bsize, sdp->sd_bsize);
if (count != sdp->sd_bsize) {
@@ -1072,7 +1071,7 @@ static void dir_double_exhash(struct gfs2_inode *dip)
* Returns: 0 on success, error code otherwise
*/
-int gfs2_get_leaf(struct gfs2_inode *dip, uint64_t leaf_no,
+int lgfs2_get_leaf(struct gfs2_inode *dip, uint64_t leaf_no,
struct gfs2_buffer_head **bhp)
{
int error = 0;
@@ -1172,7 +1171,7 @@ restart:
if (be16_to_cpu(leaf->lf_depth) < dip->i_depth) {
llen = 1 << (dip->i_depth -
be16_to_cpu(leaf->lf_depth));
- dir_split_leaf(dip, lindex & ~(llen - 1),
+ lgfs2_dir_split_leaf(dip, lindex & ~(llen - 1),
leaf_no, bh);
lgfs2_brelse(bh);
goto restart;
@@ -1264,14 +1263,14 @@ static void dir_make_exhash(struct gfs2_inode *dip)
dip->i_bh, sizeof(struct gfs2_dinode));
x = 0;
- gfs2_dirent_first(dip, bh, &dent);
+ lgfs2_dirent_first(dip, bh, &dent);
do {
if (!dent->de_inum.no_formal_ino)
continue;
if (++x == dip->i_entries)
break;
- } while (gfs2_dirent_next(dip, bh, &dent) == 0);
+ } while (lgfs2_dirent_next(dip, bh, &dent) == 0);
rec_len = be16_to_cpu(dent->de_rec_len) +
sizeof(struct gfs2_dinode) - sizeof(struct gfs2_leaf);
@@ -1322,8 +1321,8 @@ static int dir_l_add(struct gfs2_inode *dip, const char *filename, int len,
return err;
}
-int dir_add(struct gfs2_inode *dip, const char *filename, int len,
- struct lgfs2_inum *inum, unsigned int type)
+int lgfs2_dir_add(struct gfs2_inode *dip, const char *filename, int len,
+ struct lgfs2_inum *inum, unsigned int type)
{
int err = 0;
if (dip->i_flags & GFS2_DIF_EXHASH)
@@ -1411,8 +1410,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 lgfs2_inum *inum,
- unsigned int mode, uint32_t flags, struct lgfs2_inum *parent)
+int lgfs2_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);
}
@@ -1452,17 +1451,17 @@ int lgfs2_write_filemeta(struct gfs2_inode *ip)
if (bh == NULL)
return 1;
- /* Using find_metapath() to find the last data block in the file will
+ /* Using lgfs2_find_metapath() to find the last data block in the file will
effectively give a remainder for the number of pointers at each
height. Just need to add 1 to convert ptr index to quantity later. */
- find_metapath(ip, dblocks - 1, &mp);
+ lgfs2_find_metapath(ip, dblocks - 1, &mp);
for (height = 0; height < ip->i_height; height++) {
unsigned p;
/* The number of pointers in this height will be the number of
full indirect blocks pointed to by the previous height
multiplied by the pointer capacity of an indirect block,
- plus the remainder which find_metapath() gave us. */
+ plus the remainder which lgfs2_find_metapath() gave us. */
ptrs = ((ptrs - 1) * sdp->sd_inptrs) + mp.mp_list[height] + 1;
for (p = 0; p < ptrs; bh->b_blocknr++) {
@@ -1498,7 +1497,7 @@ static struct gfs2_inode *__createi(struct gfs2_inode *dip,
int err = 0;
int is_dir;
- gfs2_lookupi(dip, filename, strlen(filename), &ip);
+ lgfs2_lookupi(dip, filename, strlen(filename), &ip);
if (!ip) {
struct lgfs2_inum parent = dip->i_num;
@@ -1512,7 +1511,7 @@ static struct gfs2_inode *__createi(struct gfs2_inode *dip,
inum.in_formal_ino = sdp->md.next_inum++;
inum.in_addr = bn;
- err = dir_add(dip, filename, strlen(filename), &inum, IF2DT(mode));
+ err = lgfs2_dir_add(dip, filename, strlen(filename), &inum, IF2DT(mode));
if (err)
return NULL;
@@ -1538,14 +1537,14 @@ static struct gfs2_inode *__createi(struct gfs2_inode *dip,
return ip;
}
-struct gfs2_inode *createi(struct gfs2_inode *dip, const char *filename,
- unsigned int mode, uint32_t flags)
+struct gfs2_inode *lgfs2_createi(struct gfs2_inode *dip, const char *filename,
+ unsigned int mode, uint32_t flags)
{
return __createi(dip, filename, mode, flags, 0);
}
-struct gfs2_inode *gfs_createi(struct gfs2_inode *dip, const char *filename,
- unsigned int mode, uint32_t flags)
+struct gfs2_inode *lgfs2_gfs_createi(struct gfs2_inode *dip, const char *filename,
+ unsigned int mode, uint32_t flags)
{
return __createi(dip, filename, mode, flags, 1);
}
@@ -1589,7 +1588,7 @@ static int leaf_search(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
unsigned int entries = 0, x = 0;
int type;
- type = gfs2_dirent_first(dip, bh, &dent);
+ type = lgfs2_dirent_first(dip, bh, &dent);
if (type == IS_LEAF){
struct gfs2_leaf *leaf = (struct gfs2_leaf *)bh->b_data;
@@ -1606,7 +1605,7 @@ static int leaf_search(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
prev = dent;
continue;
}
-
+
if (be32_to_cpu(dent->de_hash) == hash &&
gfs2_filecmp(filename, (char *)(dent + 1),
be16_to_cpu(dent->de_name_len))) {
@@ -1615,12 +1614,12 @@ static int leaf_search(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
*dent_prev = prev;
return 0;
}
-
+
if(x >= entries)
return -1;
x++;
prev = dent;
- } while (gfs2_dirent_next(dip, bh, &dent) == 0);
+ } while (lgfs2_dirent_next(dip, bh, &dent) == 0);
return -ENOENT;
}
@@ -1747,7 +1746,7 @@ static int dir_l_search(struct gfs2_inode *dip, const char *filename,
}
/**
- * dir_search - Search a directory
+ * lgfs2_dir_search - Search a directory
* @dip: The GFS inode
* @id
* @type:
@@ -1759,8 +1758,8 @@ 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 lgfs2_inum *inum)
+int lgfs2_dir_search(struct gfs2_inode *dip, const char *filename, int len,
+ unsigned int *type, struct lgfs2_inum *inum)
{
int error;
@@ -1810,7 +1809,7 @@ static int dir_e_del(struct gfs2_inode *dip, const char *filename, int len)
return 1;
if (bh) {
- dirent2_del(dip, bh, prev, cur);
+ lgfs2_dirent2_del(dip, bh, prev, cur);
lgfs2_brelse(bh);
}
return 0;
@@ -1832,13 +1831,13 @@ static int dir_l_del(struct gfs2_inode *dip, const char *filename, int len)
return -1;
}
- dirent2_del(dip, dip->i_bh, prev, cur);
+ lgfs2_dirent2_del(dip, dip->i_bh, prev, cur);
return 0;
}
/*
- * gfs2_dirent_del
+ * lgfs2_dirent_del
* @dip
* filename
*
@@ -1848,7 +1847,7 @@ static int dir_l_del(struct gfs2_inode *dip, const char *filename, int len)
*
* Returns: 0 on success (or if it doesn't already exist), -1 on failure
*/
-int gfs2_dirent_del(struct gfs2_inode *dip, const char *filename, int len)
+int lgfs2_dirent_del(struct gfs2_inode *dip, const char *filename, int len)
{
int error;
@@ -1864,15 +1863,15 @@ int gfs2_dirent_del(struct gfs2_inode *dip, const char *filename, int len)
}
/**
- * gfs2_lookupi - Look up a filename in a directory and return its inode
+ * lgfs2_lookupi - Look up a filename in a directory and return its inode
* @dip: The directory to search
* @name: The name of the inode to look for
* @ipp: Used to return the found inode if any
*
* Returns: 0 on success, -EXXXX on failure
*/
-int gfs2_lookupi(struct gfs2_inode *dip, const char *filename, int len,
- struct gfs2_inode **ipp)
+int lgfs2_lookupi(struct gfs2_inode *dip, const char *filename, int len,
+ struct gfs2_inode **ipp)
{
struct gfs2_sbd *sdp = dip->i_sbd;
int error = 0;
@@ -1886,7 +1885,7 @@ int gfs2_lookupi(struct gfs2_inode *dip, const char *filename, int len,
*ipp = dip;
return 0;
}
- error = dir_search(dip, filename, len, NULL, &inum);
+ error = lgfs2_dir_search(dip, filename, len, NULL, &inum);
if (!error)
*ipp = lgfs2_inode_read(sdp, inum.in_addr);
@@ -1894,9 +1893,9 @@ int gfs2_lookupi(struct gfs2_inode *dip, const char *filename, int len,
}
/**
- * gfs2_free_block - free up a block given its block number
+ * lgfs2_free_block - free up a block given its block number
*/
-void gfs2_free_block(struct gfs2_sbd *sdp, uint64_t block)
+void lgfs2_free_block(struct gfs2_sbd *sdp, uint64_t block)
{
struct rgrp_tree *rgd;
@@ -1915,10 +1914,10 @@ void gfs2_free_block(struct gfs2_sbd *sdp, uint64_t block)
}
/**
- * gfs2_freedi - unlink a disk inode by block number.
+ * lgfs2_freedi - unlink a disk inode by block number.
* Note: currently only works for regular files.
*/
-int gfs2_freedi(struct gfs2_sbd *sdp, uint64_t diblock)
+int lgfs2_freedi(struct gfs2_sbd *sdp, uint64_t diblock)
{
struct gfs2_inode *ip;
struct gfs2_buffer_head *bh, *nbh;
@@ -1958,7 +1957,7 @@ int gfs2_freedi(struct gfs2_sbd *sdp, uint64_t diblock)
continue;
block = be64_to_cpu(*ptr);
- gfs2_free_block(sdp, block);
+ lgfs2_free_block(sdp, block);
if (h == height - 1) /* if not metadata */
continue; /* don't queue it up */
/* Read the next metadata block in the chain */
@@ -1970,8 +1969,8 @@ int gfs2_freedi(struct gfs2_sbd *sdp, uint64_t diblock)
}
rgd = gfs2_blk2rgrpd(sdp, diblock);
gfs2_set_bitmap(rgd, diblock, GFS2_BLKST_FREE);
- inode_put(&ip);
- /* inode_put deallocated the extra block used by the disk inode, */
+ lgfs2_inode_put(&ip);
+ /* lgfs2_inode_put deallocated the extra block used by the disk inode, */
/* so adjust it in the superblock struct */
sdp->blks_alloced--;
rgd->rt_free++;
diff --git a/gfs2/libgfs2/gfs1.c b/gfs2/libgfs2/gfs1.c
index 79da01a4..5cee3df8 100644
--- a/gfs2/libgfs2/gfs1.c
+++ b/gfs2/libgfs2/gfs1.c
@@ -95,15 +95,15 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
bsize = (fs_is_jdata(ip)) ? sdp->sd_jbsize : sdp->sd_bsize;
- height = calc_tree_height(ip, (lblock + 1) * bsize);
+ height = lgfs2_calc_tree_height(ip, (lblock + 1) * bsize);
if (ip->i_height < height) {
if (!create)
return;
- build_height(ip, height);
+ lgfs2_build_height(ip, height);
}
- find_metapath(ip, lblock, &mp);
+ lgfs2_find_metapath(ip, lblock, &mp);
end_of_metadata = ip->i_height - 1;
bh = ip->i_bh;
@@ -181,7 +181,7 @@ int gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
if (!ip->i_height && /* stuffed */
((start + size) > (sdp->sd_bsize - sizeof(struct gfs_dinode))))
- unstuff_dinode(ip);
+ lgfs2_unstuff_dinode(ip);
if (journaled) {
lblock = offset / sdp->sd_jbsize;
diff --git a/gfs2/libgfs2/gfs2l.c b/gfs2/libgfs2/gfs2l.c
index cc4f94fc..12862507 100644
--- a/gfs2/libgfs2/gfs2l.c
+++ b/gfs2/libgfs2/gfs2l.c
@@ -139,7 +139,7 @@ static int openfs(const char *path, struct gfs2_sbd *sdp)
}
sdp->master_dir = lgfs2_inode_read(sdp, sdp->sd_meta_dir.in_addr);
- gfs2_lookupi(sdp->master_dir, "rindex", 6, &sdp->md.riinode);
+ lgfs2_lookupi(sdp->master_dir, "rindex", 6, &sdp->md.riinode);
sdp->fssize = sdp->device.length;
if (sdp->md.riinode) {
rindex_read(sdp, &count, &ok);
@@ -191,8 +191,8 @@ int main(int argc, char *argv[])
}
gfs2_rgrp_free(&sbd, &sbd.rgtree);
- inode_put(&sbd.md.riinode);
- inode_put(&sbd.master_dir);
+ lgfs2_inode_put(&sbd.md.riinode);
+ lgfs2_inode_put(&sbd.master_dir);
lgfs2_lang_free(&state);
free(opts.fspath);
return 0;
diff --git a/gfs2/libgfs2/lang.c b/gfs2/libgfs2/lang.c
index dd46cd21..6b5d4449 100644
--- a/gfs2/libgfs2/lang.c
+++ b/gfs2/libgfs2/lang.c
@@ -163,12 +163,12 @@ static uint64_t ast_lookup_path(char *path, struct gfs2_sbd *sbd)
while (ip != NULL) {
if (segment == NULL) { // No more segments
bn = ip->i_num.in_addr;
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
return bn;
}
ast_string_unescape(segment);
- err = gfs2_lookupi(ip, segment, strlen(segment), &iptmp);
- inode_put(&ip);
+ err = lgfs2_lookupi(ip, segment, strlen(segment), &iptmp);
+ lgfs2_inode_put(&ip);
if (err != 0) {
errno = -err;
break;
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 05a90900..d4f232ce 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -500,62 +500,61 @@ extern uint32_t rgblocks2bitblocks(const unsigned int bsize, const uint32_t rgbl
#define IS_LEAF (1)
#define IS_DINODE (2)
-extern void find_metapath(struct gfs2_inode *ip, uint64_t block, struct metapath *mp);
-extern void lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
+extern void lgfs2_find_metapath(struct gfs2_inode *ip, uint64_t block, struct metapath *mp);
+extern void lgfs2_lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
unsigned int height, struct metapath *mp,
int create, int *new, uint64_t *block);
extern struct gfs2_inode *lgfs2_inode_get(struct gfs2_sbd *sdp,
struct gfs2_buffer_head *bh);
extern struct gfs2_inode *lgfs2_inode_read(struct gfs2_sbd *sdp, uint64_t di_addr);
-extern struct gfs2_inode *is_system_inode(struct gfs2_sbd *sdp,
+extern struct gfs2_inode *lgfs2_is_system_inode(struct gfs2_sbd *sdp,
uint64_t block);
-extern void inode_put(struct gfs2_inode **ip);
-extern uint64_t data_alloc(struct gfs2_inode *ip);
+extern void lgfs2_inode_put(struct gfs2_inode **ip);
+extern uint64_t lgfs2_data_alloc(struct gfs2_inode *ip);
extern int lgfs2_meta_alloc(struct gfs2_inode *ip, uint64_t *blkno);
extern int lgfs2_dinode_alloc(struct gfs2_sbd *sdp, const uint64_t blksreq, uint64_t *blkno);
extern uint64_t lgfs2_space_for_data(const struct gfs2_sbd *sdp, unsigned bsize, uint64_t bytes);
extern int lgfs2_file_alloc(lgfs2_rgrp_t rg, uint64_t di_size, struct gfs2_inode *ip, uint32_t flags, unsigned mode);
-extern int gfs2_readi(struct gfs2_inode *ip, void *buf, uint64_t offset,
+extern int lgfs2_readi(struct gfs2_inode *ip, void *buf, uint64_t offset,
unsigned int size);
-#define gfs2_writei(ip, buf, offset, size) \
- __gfs2_writei(ip, buf, offset, size, 1)
-extern int __gfs2_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
+#define lgfs2_writei(ip, buf, offset, size) \
+ __lgfs2_writei(ip, buf, offset, size, 1)
+extern int __lgfs2_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 lgfs2_inum *inum,
+extern int lgfs2_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,
+extern struct gfs2_inode *lgfs2_createi(struct gfs2_inode *dip, const char *filename,
unsigned int mode, uint32_t flags);
-extern struct gfs2_inode *gfs_createi(struct gfs2_inode *dip,
+extern struct gfs2_inode *lgfs2_gfs_createi(struct gfs2_inode *dip,
const char *filename, unsigned int mode,
uint32_t flags);
-extern void dirent2_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
+extern void lgfs2_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,
+extern int lgfs2_dir_search(struct gfs2_inode *dip, const char *filename, int len,
unsigned int *type, struct lgfs2_inum *inum);
-extern int gfs2_lookupi(struct gfs2_inode *dip, const char *filename, int len,
+extern int lgfs2_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,
+extern int lgfs2_dir_add(struct gfs2_inode *dip, const char *filename, int len,
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,
+extern int lgfs2_dirent_del(struct gfs2_inode *dip, const char *filename, int name_len);
+extern void lgfs2_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
uint64_t *dblock, uint32_t *extlen, int prealloc);
extern int lgfs2_get_leaf_ptr(struct gfs2_inode *dip, uint32_t index, uint64_t *ptr) __attribute__((warn_unused_result));
-extern void dir_split_leaf(struct gfs2_inode *dip, uint32_t start,
+extern void lgfs2_dir_split_leaf(struct gfs2_inode *dip, uint32_t start,
uint64_t leaf_no, struct gfs2_buffer_head *obh);
-extern void gfs2_free_block(struct gfs2_sbd *sdp, uint64_t block);
-extern int gfs2_freedi(struct gfs2_sbd *sdp, uint64_t block);
-extern int gfs2_get_leaf(struct gfs2_inode *dip, uint64_t leaf_no,
+extern void lgfs2_free_block(struct gfs2_sbd *sdp, uint64_t block);
+extern int lgfs2_freedi(struct gfs2_sbd *sdp, uint64_t block);
+extern int lgfs2_get_leaf(struct gfs2_inode *dip, uint64_t leaf_no,
struct gfs2_buffer_head **bhp);
-extern int gfs2_dirent_first(struct gfs2_inode *dip,
+extern int lgfs2_dirent_first(struct gfs2_inode *dip,
struct gfs2_buffer_head *bh,
struct gfs2_dirent **dent);
-extern int gfs2_dirent_next(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
+extern int lgfs2_dirent_next(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
struct gfs2_dirent **dent);
-extern void build_height(struct gfs2_inode *ip, int height);
-extern void unstuff_dinode(struct gfs2_inode *ip);
-extern unsigned int calc_tree_height(struct gfs2_inode *ip, uint64_t size);
+extern void lgfs2_build_height(struct gfs2_inode *ip, int height);
+extern void lgfs2_unstuff_dinode(struct gfs2_inode *ip);
+extern unsigned int lgfs2_calc_tree_height(struct gfs2_inode *ip, uint64_t size);
extern uint32_t lgfs2_log_header_hash(char *buf);
extern uint32_t lgfs2_log_header_crc(char *buf, unsigned bsize);
diff --git a/gfs2/libgfs2/recovery.c b/gfs2/libgfs2/recovery.c
index 2edfe120..3984e1e3 100644
--- a/gfs2/libgfs2/recovery.c
+++ b/gfs2/libgfs2/recovery.c
@@ -28,7 +28,7 @@ int gfs2_replay_read_block(struct gfs2_inode *ip, unsigned int blk,
int new = 0;
uint64_t dblock;
- block_map(ip, blk, &new, &dblock, NULL, 0);
+ lgfs2_block_map(ip, blk, &new, &dblock, NULL, 0);
if (!dblock)
return -EIO;
@@ -241,7 +241,7 @@ int lgfs2_clean_journal(struct gfs2_inode *ip, struct lgfs2_log_header *head)
lblock = head->lh_blkno;
gfs2_replay_incr_blk(ip, &lblock);
- block_map(ip, lblock, &new, &dblock, NULL, 0);
+ lgfs2_block_map(ip, lblock, &new, &dblock, NULL, 0);
if (!dblock)
return -EIO;
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index c6dfb228..4a522546 100644
--- a/gfs2/libgfs2/rgrp.c
+++ b/gfs2/libgfs2/rgrp.c
@@ -483,7 +483,7 @@ lgfs2_rgrp_t lgfs2_rindex_read_one(struct gfs2_inode *rip, lgfs2_rgrps_t rgs, un
if (rip == NULL || rgs == NULL)
return NULL;
- ret = gfs2_readi(rip, &ri, off, sizeof(struct gfs2_rindex));
+ ret = lgfs2_readi(rip, &ri, off, sizeof(struct gfs2_rindex));
if (ret != sizeof(struct gfs2_rindex))
return NULL;
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index 3bf876ea..ff4c5522 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -29,7 +29,7 @@ int lgfs2_build_master(struct gfs2_sbd *sdp)
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);
+ err = lgfs2_init_dinode(sdp, &bh, &inum, S_IFDIR | 0755, GFS2_DIF_SYSTEM, &inum);
if (err != 0)
return -1;
@@ -158,9 +158,9 @@ static struct gfs2_buffer_head *lgfs2_get_file_buf(struct gfs2_inode *ip, uint64
int new = 1;
if (ip->i_height == 0)
- unstuff_dinode(ip);
+ lgfs2_unstuff_dinode(ip);
- block_map(ip, lbn, &new, &dbn, NULL, prealloc);
+ lgfs2_block_map(ip, lbn, &new, &dbn, NULL, prealloc);
if (!dbn)
return NULL;
@@ -185,8 +185,8 @@ int lgfs2_write_journal(struct gfs2_inode *jnl, unsigned bsize, unsigned int blo
/* Build the height up so our journal blocks will be contiguous and */
/* not broken up by indirect block pages. */
- height = calc_tree_height(jnl, (blocks + 1) * bsize);
- build_height(jnl, height);
+ height = lgfs2_calc_tree_height(jnl, (blocks + 1) * bsize);
+ lgfs2_build_height(jnl, height);
for (x = 0; x < blocks; x++) {
struct gfs2_buffer_head *bh = lgfs2_get_file_buf(jnl, x, 1);
@@ -233,8 +233,8 @@ int lgfs2_build_journal(struct gfs2_sbd *sdp, int j, struct gfs2_inode *jindex)
int ret;
sprintf(name, "journal%u", j);
- sdp->md.journal[j] = createi(jindex, name, S_IFREG | 0600,
- GFS2_DIF_SYSTEM);
+ sdp->md.journal[j] = lgfs2_createi(jindex, name, S_IFREG | 0600,
+ GFS2_DIF_SYSTEM);
if (sdp->md.journal[j] == NULL) {
return errno;
}
@@ -259,7 +259,7 @@ struct gfs2_inode *lgfs2_build_jindex(struct gfs2_inode *master, struct lgfs2_in
errno = EINVAL;
return NULL;
}
- jindex = createi(master, "jindex", S_IFDIR | 0700, GFS2_DIF_SYSTEM);
+ jindex = lgfs2_createi(master, "jindex", S_IFDIR | 0700, GFS2_DIF_SYSTEM);
if (jindex == NULL)
return NULL;
@@ -269,9 +269,9 @@ struct gfs2_inode *lgfs2_build_jindex(struct gfs2_inode *master, struct lgfs2_in
int ret;
snprintf(fname, GFS2_FNAMESIZE, "journal%u", j);
- ret = dir_add(jindex, fname, strlen(fname), &jnls[j], IF2DT(S_IFREG | 0600));
+ ret = lgfs2_dir_add(jindex, fname, strlen(fname), &jnls[j], IF2DT(S_IFREG | 0600));
if (ret) {
- inode_put(&jindex);
+ lgfs2_inode_put(&jindex);
return NULL;
}
}
@@ -284,7 +284,7 @@ struct gfs2_inode *lgfs2_build_inum_range(struct gfs2_inode *per_node, unsigned
struct gfs2_inode *ip;
sprintf(name, "inum_range%u", j);
- ip = createi(per_node, name, S_IFREG | 0600,
+ ip = lgfs2_createi(per_node, name, S_IFREG | 0600,
GFS2_DIF_SYSTEM | GFS2_DIF_JDATA);
if (ip == NULL)
return NULL;
@@ -301,7 +301,7 @@ struct gfs2_inode *lgfs2_build_statfs_change(struct gfs2_inode *per_node, unsign
struct gfs2_inode *ip;
sprintf(name, "statfs_change%u", j);
- ip = createi(per_node, name, S_IFREG | 0600,
+ ip = lgfs2_createi(per_node, name, S_IFREG | 0600,
GFS2_DIF_SYSTEM | GFS2_DIF_JDATA);
if (ip == NULL)
return NULL;
@@ -329,12 +329,12 @@ struct gfs2_inode *lgfs2_build_quota_change(struct gfs2_inode *per_node, unsigne
mh.mh_format = cpu_to_be32(GFS2_FORMAT_QC);
sprintf(name, "quota_change%u", j);
- ip = createi(per_node, name, S_IFREG | 0600, GFS2_DIF_SYSTEM);
+ ip = lgfs2_createi(per_node, name, S_IFREG | 0600, GFS2_DIF_SYSTEM);
if (ip == NULL)
return NULL;
- hgt = calc_tree_height(ip, (blocks + 1) * sdp->sd_bsize);
- build_height(ip, hgt);
+ hgt = lgfs2_calc_tree_height(ip, (blocks + 1) * sdp->sd_bsize);
+ lgfs2_build_height(ip, hgt);
for (x = 0; x < blocks; x++) {
bh = lgfs2_get_file_buf(ip, x, 0);
@@ -353,7 +353,7 @@ struct gfs2_inode *lgfs2_build_inum(struct gfs2_sbd *sdp)
{
struct gfs2_inode *ip;
- ip = createi(sdp->master_dir, "inum", S_IFREG | 0600,
+ ip = lgfs2_createi(sdp->master_dir, "inum", S_IFREG | 0600,
GFS2_DIF_SYSTEM | GFS2_DIF_JDATA);
return ip;
}
@@ -362,7 +362,7 @@ struct gfs2_inode *lgfs2_build_statfs(struct gfs2_sbd *sdp)
{
struct gfs2_inode *ip;
- ip = createi(sdp->master_dir, "statfs", S_IFREG | 0600,
+ ip = lgfs2_createi(sdp->master_dir, "statfs", S_IFREG | 0600,
GFS2_DIF_SYSTEM | GFS2_DIF_JDATA);
return ip;
}
@@ -375,7 +375,7 @@ struct gfs2_inode *lgfs2_build_rindex(struct gfs2_sbd *sdp)
char buf[sizeof(struct gfs2_rindex)];
int count;
- ip = createi(sdp->master_dir, "rindex", S_IFREG | 0600,
+ ip = lgfs2_createi(sdp->master_dir, "rindex", S_IFREG | 0600,
GFS2_DIF_SYSTEM | GFS2_DIF_JDATA);
if (ip == NULL)
return NULL;
@@ -389,12 +389,12 @@ struct gfs2_inode *lgfs2_build_rindex(struct gfs2_sbd *sdp)
lgfs2_rindex_out(rl, buf);
- count = gfs2_writei(ip, buf, ip->i_size, sizeof(struct gfs2_rindex));
+ count = lgfs2_writei(ip, buf, ip->i_size, sizeof(struct gfs2_rindex));
if (count != sizeof(struct gfs2_rindex))
return NULL;
}
memset(buf, 0, sizeof(struct gfs2_rindex));
- count = __gfs2_writei(ip, buf, ip->i_size, sizeof(struct gfs2_rindex), 0);
+ count = __lgfs2_writei(ip, buf, ip->i_size, sizeof(struct gfs2_rindex), 0);
if (count != sizeof(struct gfs2_rindex))
return NULL;
@@ -407,7 +407,7 @@ struct gfs2_inode *lgfs2_build_quota(struct gfs2_sbd *sdp)
struct gfs2_quota qu;
int count;
- ip = createi(sdp->master_dir, "quota", S_IFREG | 0600,
+ ip = lgfs2_createi(sdp->master_dir, "quota", S_IFREG | 0600,
GFS2_DIF_SYSTEM | GFS2_DIF_JDATA);
if (ip == NULL)
return NULL;
@@ -418,10 +418,10 @@ struct gfs2_inode *lgfs2_build_quota(struct gfs2_sbd *sdp)
memset(&qu, 0, sizeof(struct gfs2_quota));
qu.qu_value = cpu_to_be64(1);
- count = gfs2_writei(ip, &qu, ip->i_size, sizeof(struct gfs2_quota));
+ count = lgfs2_writei(ip, &qu, ip->i_size, sizeof(struct gfs2_quota));
if (count != sizeof(struct gfs2_quota))
return NULL;
- count = gfs2_writei(ip, &qu, ip->i_size, sizeof(struct gfs2_quota));
+ count = lgfs2_writei(ip, &qu, ip->i_size, sizeof(struct gfs2_quota));
if (count != sizeof(struct gfs2_quota))
return NULL;
@@ -441,7 +441,7 @@ int lgfs2_build_root(struct gfs2_sbd *sdp)
inum.in_formal_ino = sdp->md.next_inum++;
inum.in_addr = bn;
- err = init_dinode(sdp, &bh, &inum, S_IFDIR | 0755, 0, &inum);
+ err = lgfs2_init_dinode(sdp, &bh, &inum, S_IFDIR | 0755, 0, &inum);
if (err != 0)
return -1;
@@ -460,7 +460,7 @@ int lgfs2_init_inum(struct gfs2_sbd *sdp)
int count;
buf = cpu_to_be64(sdp->md.next_inum);
- count = gfs2_writei(ip, &buf, 0, sizeof(uint64_t));
+ count = lgfs2_writei(ip, &buf, 0, sizeof(uint64_t));
if (count != sizeof(uint64_t))
return -1;
@@ -477,7 +477,7 @@ int lgfs2_init_statfs(struct gfs2_sbd *sdp, struct gfs2_statfs_change *res)
sc.sc_free = cpu_to_be64(sdp->blks_total - sdp->blks_alloced);
sc.sc_dinodes = cpu_to_be64(sdp->dinodes_alloced);
- count = gfs2_writei(ip, &sc, 0, sizeof(sc));
+ count = lgfs2_writei(ip, &sc, 0, sizeof(sc));
if (count != sizeof(sc))
return -1;
diff --git a/gfs2/libgfs2/super.c b/gfs2/libgfs2/super.c
index 119f1cd0..b32c89c9 100644
--- a/gfs2/libgfs2/super.c
+++ b/gfs2/libgfs2/super.c
@@ -213,7 +213,7 @@ int rindex_read(struct gfs2_sbd *sdp, uint64_t *rgcount, int *ok)
struct gfs2_rindex ri;
uint64_t addr;
- error = gfs2_readi(sdp->md.riinode, &ri,
+ error = lgfs2_readi(sdp->md.riinode, &ri,
rg * sizeof(struct gfs2_rindex),
sizeof(struct gfs2_rindex));
if (!error)
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 318c24f2..3b0f5b4e 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -686,7 +686,7 @@ static int build_per_node(struct gfs2_sbd *sdp, struct mkfs_opts *opts)
struct gfs2_inode *per_node;
unsigned int j;
- per_node = createi(sdp->master_dir, "per_node", S_IFDIR | 0700,
+ per_node = lgfs2_createi(sdp->master_dir, "per_node", S_IFDIR | 0700,
GFS2_DIF_SYSTEM);
if (per_node == NULL) {
fprintf(stderr, _("Error building '%s': %s\n"), "per_node", strerror(errno));
@@ -705,7 +705,7 @@ static int build_per_node(struct gfs2_sbd *sdp, struct mkfs_opts *opts)
printf("\nInum Range %u:\n", j);
dinode_print(ip->i_bh->b_data);
}
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
ip = lgfs2_build_statfs_change(per_node, j);
if (ip == NULL) {
@@ -717,7 +717,7 @@ static int build_per_node(struct gfs2_sbd *sdp, struct mkfs_opts *opts)
printf("\nStatFS Change %u:\n", j);
dinode_print(ip->i_bh->b_data);
}
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
ip = lgfs2_build_quota_change(per_node, j);
if (ip == NULL) {
@@ -729,13 +729,13 @@ static int build_per_node(struct gfs2_sbd *sdp, struct mkfs_opts *opts)
printf("\nQuota Change %u:\n", j);
dinode_print(ip->i_bh->b_data);
}
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
}
if (opts->debug) {
printf("\nper_node:\n");
dinode_print(per_node->i_bh->b_data);
}
- inode_put(&per_node);
+ lgfs2_inode_put(&per_node);
return 0;
}
@@ -1012,7 +1012,7 @@ static int create_jindex(struct gfs2_sbd *sdp, struct mkfs_opts *opts, struct lg
printf("Jindex:\n");
dinode_print(jindex->i_bh->b_data);
}
- inode_put(&jindex);
+ lgfs2_inode_put(&jindex);
return 0;
}
@@ -1325,7 +1325,7 @@ int main(int argc, char *argv[])
printf("\nResource Index:\n");
dinode_print(ip->i_bh->b_data);
}
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
if (!opts.quiet) {
printf("%s", _("Creating quota file: "));
fflush(stdout);
@@ -1339,7 +1339,7 @@ int main(int argc, char *argv[])
printf("\nQuota:\n");
dinode_print(ip->i_bh->b_data);
}
- inode_put(&ip);
+ lgfs2_inode_put(&ip);
if (!opts.quiet)
printf("%s", _("Done\n"));
@@ -1364,10 +1364,10 @@ int main(int argc, char *argv[])
printf("\nStatfs:\n");
statfs_change_print(&sc);
}
- inode_put(&sbd.md.rooti);
- inode_put(&sbd.master_dir);
- inode_put(&sbd.md.inum);
- inode_put(&sbd.md.statfs);
+ lgfs2_inode_put(&sbd.md.rooti);
+ lgfs2_inode_put(&sbd.master_dir);
+ lgfs2_inode_put(&sbd.md.inum);
+ lgfs2_inode_put(&sbd.md.statfs);
lgfs2_rgrps_free(&rgs);
diff --git a/tests/nukerg.c b/tests/nukerg.c
index a831e459..81424e17 100644
--- a/tests/nukerg.c
+++ b/tests/nukerg.c
@@ -232,7 +232,7 @@ static int nuke_ris(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, unsigned *rinums, s
printf("Nuking rindex entry %u.\n", i);
off = i * sizeof(struct gfs2_rindex);
- bytes = gfs2_writei(sdp->md.riinode, &blankri, off,
+ bytes = lgfs2_writei(sdp->md.riinode, &blankri, off,
sizeof(struct gfs2_rindex));
if (bytes != sizeof(struct gfs2_rindex)) {
fprintf(stderr, "Write failed (%d bytes): %s",
@@ -250,7 +250,7 @@ static lgfs2_rgrps_t read_rindex(struct gfs2_sbd *sdp)
unsigned rgcount;
unsigned i;
- gfs2_lookupi(sdp->master_dir, "rindex", 6, &sdp->md.riinode);
+ lgfs2_lookupi(sdp->master_dir, "rindex", 6, &sdp->md.riinode);
if (sdp->md.riinode == NULL) {
perror("Failed to look up rindex");
return NULL;
@@ -336,8 +336,8 @@ int main(int argc, char **argv)
if (opts.got_rinums && nuke_ris(&sbd, rgs, opts.rinums, opts.rinum_count) != 0)
exit(1);
- inode_put(&sbd.md.riinode);
- inode_put(&sbd.master_dir);
+ lgfs2_inode_put(&sbd.md.riinode);
+ lgfs2_inode_put(&sbd.master_dir);
lgfs2_rgrps_free(&rgs);
fsync(sbd.device_fd);
close(sbd.device_fd);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 3 months