Gitweb:
http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=1bc68e62...
Commit: 1bc68e624966a4d73c98500452d69290cd15caa8
Parent: 3d2064e22dbc3e884c7c4e37ed5edc372494656c
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Mon Feb 25 13:07:19 2013 -0700
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon May 20 11:12:45 2013 -0500
fsck.gfs2: Move function to read directory hash table to util.c
This patch moves function get_dir_hash from metawalk.c to util.c.
This was done because a future patch will need access to the function.
---
gfs2/fsck/metawalk.c | 18 ------------------
gfs2/fsck/util.c | 19 +++++++++++++++++++
gfs2/fsck/util.h | 1 +
3 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 02408e0..32afc46 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -639,24 +639,6 @@ out_copy_old_leaf:
return 1;
}
-static uint64_t *get_dir_hash(struct gfs2_inode *ip)
-{
- unsigned hsize = (1 << ip->i_di.di_depth) * sizeof(uint64_t);
- int ret;
- uint64_t *tbl = malloc(hsize);
-
- if (tbl == NULL)
- return NULL;
-
- ret = gfs2_readi(ip, tbl, 0, hsize);
- if (ret != hsize) {
- free(tbl);
- return NULL;
- }
-
- return tbl;
-}
-
static int u64cmp(const void *p1, const void *p2)
{
uint64_t a = *(uint64_t *)p1;
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c
index 94d532e..5be260c 100644
--- a/gfs2/fsck/util.c
+++ b/gfs2/fsck/util.c
@@ -654,3 +654,22 @@ uint64_t find_free_blk(struct gfs2_sbd *sdp)
}
return 0;
}
+
+uint64_t *get_dir_hash(struct gfs2_inode *ip)
+{
+ unsigned hsize = (1 << ip->i_di.di_depth) * sizeof(uint64_t);
+ int ret;
+ uint64_t *tbl = malloc(hsize);
+
+ if (tbl == NULL)
+ return NULL;
+
+ ret = gfs2_readi(ip, tbl, 0, hsize);
+ if (ret != hsize) {
+ free(tbl);
+ return NULL;
+ }
+
+ return tbl;
+}
+
diff --git a/gfs2/fsck/util.h b/gfs2/fsck/util.h
index 1a4811c..7b587d4 100644
--- a/gfs2/fsck/util.h
+++ b/gfs2/fsck/util.h
@@ -185,6 +185,7 @@ extern char generic_interrupt(const char *caller, const char *where,
const char *answers);
extern char gfs2_getch(void);
extern uint64_t find_free_blk(struct gfs2_sbd *sdp);
+extern uint64_t *get_dir_hash(struct gfs2_inode *ip);
#define stack log_debug("<backtrace> - %s()\n", __func__)