[Ocfs2-tools-devel] [PATCH 11/11] libocfs2: Silence compiler
warnings - take 2
Sunil Mushran
sunil.mushran at oracle.com
Thu Sep 27 17:14:34 PDT 2007
ocfs2_extent_map_get_blocks() function was tweaked to silence the
compiler warnings.
Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
---
fsck.ocfs2/journal.c | 11 ++++-------
fswreck/dir.c | 6 ++----
fswreck/symlink.c | 4 +---
libocfs2/dir_scan.c | 3 +--
libocfs2/expanddir.c | 4 +---
libocfs2/extent_map.c | 17 ++++++++++-------
libocfs2/fileio.c | 8 ++++++--
libocfs2/include/ocfs2.h | 2 +-
8 files changed, 26 insertions(+), 29 deletions(-)
diff --git a/fsck.ocfs2/journal.c b/fsck.ocfs2/journal.c
index 2638536..eaa48ff 100644
--- a/fsck.ocfs2/journal.c
+++ b/fsck.ocfs2/journal.c
@@ -238,11 +238,10 @@ static errcode_t lookup_journal_block(ocfs2_filesys *fs,
int check_dup)
{
errcode_t ret;
- int contig;
int was_set;
ret = ocfs2_extent_map_get_blocks(ji->ji_cinode, blkoff, 1, blkno,
- &contig);
+ NULL);
if (ret) {
com_err(whoami, ret, "while looking up logical block "
"%"PRIu64" in slot %d's journal", blkoff, ji->ji_slot);
@@ -529,7 +528,7 @@ errcode_t o2fsck_should_replay_journals(ocfs2_filesys *fs, int *should)
uint64_t blkno;
errcode_t ret;
ocfs2_cached_inode *cinode = NULL;
- int contig, is_dirty;
+ int is_dirty;
journal_superblock_t *jsb;
*should = 0;
@@ -576,8 +575,7 @@ errcode_t o2fsck_should_replay_journals(ocfs2_filesys *fs, int *should)
if (!is_dirty)
continue;
- ret = ocfs2_extent_map_get_blocks(cinode, 0, 1, &blkno,
- &contig);
+ ret = ocfs2_extent_map_get_blocks(cinode, 0, 1, &blkno, NULL);
if (ret) {
com_err(whoami, ret, "while looking up the journal "
"super block in slot %d's journal", i);
@@ -740,7 +738,6 @@ static errcode_t check_journal_super(ocfs2_filesys *fs,
ocfs2_cached_inode *ci)
{
errcode_t ret;
- int contig;
uint64_t blkno;
char *buf = NULL;
@@ -752,7 +749,7 @@ static errcode_t check_journal_super(ocfs2_filesys *fs,
if (ret)
goto out;
- ret = ocfs2_extent_map_get_blocks(ci, 0, 1, &blkno, &contig);
+ ret = ocfs2_extent_map_get_blocks(ci, 0, 1, &blkno, NULL);
if (ret)
goto out;
diff --git a/fswreck/dir.c b/fswreck/dir.c
index 686c3bd..e69707d 100644
--- a/fswreck/dir.c
+++ b/fswreck/dir.c
@@ -134,7 +134,6 @@ static void damage_dir_content(ocfs2_filesys *fs, uint64_t dir,
errcode_t ret;
char *buf = NULL;
uint64_t blkno, tmp_blkno;
- int contig;
ocfs2_cached_inode *cinode = NULL;
struct ocfs2_dir_entry *de = NULL, *newent = NULL;
char name[OCFS2_MAX_FILENAME_LEN];
@@ -150,7 +149,7 @@ static void damage_dir_content(ocfs2_filesys *fs, uint64_t dir,
FSWRK_COM_FATAL(progname, ret);
/* get first blockno */
- ret = ocfs2_extent_map_get_blocks(cinode, 0, 1, &blkno, &contig);
+ ret = ocfs2_extent_map_get_blocks(cinode, 0, 1, &blkno, NULL);
if (ret)
FSWRK_COM_FATAL(progname, ret);
@@ -336,7 +335,6 @@ void mess_up_dir_ent(ocfs2_filesys *fs, uint64_t blkno)
void mess_up_dir_parent_dup(ocfs2_filesys *fs, uint64_t blkno)
{
errcode_t ret;
- int contig;
uint64_t parent1, parent2, tmp_blkno,extblk;
char *buf = NULL;
struct ocfs2_dir_entry *de = NULL, *newent = NULL;
@@ -364,7 +362,7 @@ void mess_up_dir_parent_dup(ocfs2_filesys *fs, uint64_t blkno)
if (ret)
FSWRK_COM_FATAL(progname, ret);
- ret = ocfs2_extent_map_get_blocks(cinode, 0, 1, &extblk, &contig);
+ ret = ocfs2_extent_map_get_blocks(cinode, 0, 1, &extblk, NULL);
if (ret)
FSWRK_COM_FATAL(progname, ret);
diff --git a/fswreck/symlink.c b/fswreck/symlink.c
index a2d7bb0..aa7dd31 100644
--- a/fswreck/symlink.c
+++ b/fswreck/symlink.c
@@ -76,7 +76,6 @@ static void add_symlink(ocfs2_filesys *fs, uint64_t blkno)
errcode_t ret = 0;
ocfs2_cached_inode *cinode = NULL;
uint64_t new_blk;
- int contig;
char *buf = NULL;
ret = ocfs2_read_cached_inode(fs, blkno, &cinode);
@@ -88,8 +87,7 @@ static void add_symlink(ocfs2_filesys *fs, uint64_t blkno)
FSWRK_COM_FATAL(progname, ret);
/* get first block of the file */
- ret = ocfs2_extent_map_get_blocks(cinode, 0, 1,
- &new_blk, &contig);
+ ret = ocfs2_extent_map_get_blocks(cinode, 0, 1, &new_blk, NULL);
if (ret)
FSWRK_COM_FATAL(progname, ret);
diff --git a/libocfs2/dir_scan.c b/libocfs2/dir_scan.c
index 94aa8d2..501d811 100644
--- a/libocfs2/dir_scan.c
+++ b/libocfs2/dir_scan.c
@@ -50,14 +50,13 @@ static errcode_t get_more_dir_blocks(ocfs2_dir_scan *scan)
{
errcode_t ret;
uint64_t blkno;
- int cblocks;
if (scan->blocks_read == scan->total_blocks)
return OCFS2_ET_ITERATION_COMPLETE;
ret = ocfs2_extent_map_get_blocks(scan->inode,
scan->blocks_read, 1,
- &blkno, &cblocks);
+ &blkno, NULL);
if (ret)
return ret;
diff --git a/libocfs2/expanddir.c b/libocfs2/expanddir.c
index 8caec2b..bc71cff 100644
--- a/libocfs2/expanddir.c
+++ b/libocfs2/expanddir.c
@@ -50,7 +50,6 @@ errcode_t ocfs2_expand_dir(ocfs2_filesys *fs,
uint64_t used_blks;
uint64_t totl_blks;
uint64_t new_blk;
- int contig;
char *buf = NULL;
if (!(fs->fs_flags & OCFS2_FLAG_RW))
@@ -91,8 +90,7 @@ errcode_t ocfs2_expand_dir(ocfs2_filesys *fs,
goto bail;
/* get the next free block */
- ret = ocfs2_extent_map_get_blocks(cinode, used_blks, 1,
- &new_blk, &contig);
+ ret = ocfs2_extent_map_get_blocks(cinode, used_blks, 1, &new_blk, NULL);
if (ret)
goto bail;
diff --git a/libocfs2/extent_map.c b/libocfs2/extent_map.c
index 5577a6b..a0d50df 100644
--- a/libocfs2/extent_map.c
+++ b/libocfs2/extent_map.c
@@ -444,7 +444,7 @@ errcode_t ocfs2_extent_map_get_clusters(ocfs2_cached_inode *cinode,
errcode_t ocfs2_extent_map_get_blocks(ocfs2_cached_inode *cinode,
uint64_t v_blkno, int count,
- uint64_t *p_blkno, int *ret_count)
+ uint64_t *p_blkno, uint64_t *ret_count)
{
errcode_t ret;
uint64_t boff;
@@ -840,7 +840,9 @@ int main(int argc, char *argv[])
errcode_t ret;
uint64_t blkno, blkoff;
uint32_t cpos, coff;
- int count, contig;
+ int count;
+ uint64_t cblks;
+ int cclts;
int c, op = 0;
char *filename;
ocfs2_filesys *fs;
@@ -971,14 +973,15 @@ int main(int argc, char *argv[])
blkoff,
count,
&blkno,
- &contig);
+ &cblks);
if (ret) {
com_err(argv[0], ret,
"looking up block range %"PRIu64":%d", blkoff, count);
goto out_free;
}
- fprintf(stdout, "Lookup of block range %"PRIu64":%d returned %"PRIu64":%d\n",
- blkoff, count, blkno, contig);
+ fprintf(stdout, "Lookup of block range %"PRIu64":%d "
+ "returned %"PRIu64":%"PRIu64"\n",
+ blkoff, count, blkno, cblks);
break;
case OP_LOOKUP_CLUSTER:
@@ -986,14 +989,14 @@ int main(int argc, char *argv[])
cpos,
count,
&coff,
- &contig);
+ &cclts);
if (ret) {
com_err(argv[0], ret,
"looking up cluster range %"PRIu32":%d", cpos, count);
goto out_free;
}
fprintf(stdout, "Lookup of cluster range %"PRIu32":%d returned %"PRIu32":%d\n",
- cpos, count, coff, contig);
+ cpos, count, coff, cclts);
break;
case OP_LOOKUP_REC:
diff --git a/libocfs2/fileio.c b/libocfs2/fileio.c
index d6515e6..b4c3ebb 100644
--- a/libocfs2/fileio.c
+++ b/libocfs2/fileio.c
@@ -129,6 +129,7 @@ errcode_t ocfs2_file_read(ocfs2_cached_inode *ci, void *buf, uint32_t count,
char *ptr = (char *) buf;
uint32_t wanted_blocks;
uint32_t contig_blocks;
+ uint64_t cblks;
uint64_t v_blkno;
uint64_t p_blkno;
uint32_t tmp;
@@ -155,10 +156,11 @@ errcode_t ocfs2_file_read(ocfs2_cached_inode *ci, void *buf, uint32_t count,
while(wanted_blocks) {
ret = ocfs2_extent_map_get_blocks(ci, v_blkno, 1,
- &p_blkno, &contig_blocks);
+ &p_blkno, &cblks);
if (ret)
return ret;
+ contig_blocks = (uint32_t)cblks;
if (contig_blocks > wanted_blocks)
contig_blocks = wanted_blocks;
@@ -192,6 +194,7 @@ errcode_t ocfs2_file_write(ocfs2_cached_inode *ci, void *buf, uint32_t count,
char *ptr = (char *) buf;
uint32_t wanted_blocks;
uint32_t contig_blocks;
+ uint64_t cblks;
uint64_t v_blkno;
uint64_t p_blkno;
uint32_t tmp;
@@ -218,10 +221,11 @@ errcode_t ocfs2_file_write(ocfs2_cached_inode *ci, void *buf, uint32_t count,
while(wanted_blocks) {
ret = ocfs2_extent_map_get_blocks(ci, v_blkno, 1,
- &p_blkno, &contig_blocks);
+ &p_blkno, &cblks);
if (ret)
return ret;
+ contig_blocks = cblks;
if (contig_blocks > wanted_blocks)
contig_blocks = wanted_blocks;
diff --git a/libocfs2/include/ocfs2.h b/libocfs2/include/ocfs2.h
index 7984f35..c79734c 100644
--- a/libocfs2/include/ocfs2.h
+++ b/libocfs2/include/ocfs2.h
@@ -316,7 +316,7 @@ errcode_t ocfs2_extent_map_get_clusters(ocfs2_cached_inode *cinode,
errcode_t ocfs2_extent_map_get_blocks(ocfs2_cached_inode *cinode,
uint64_t v_blkno, int count,
uint64_t *p_blkno,
- int *ret_count);
+ uint64_t *ret_count);
errcode_t ocfs2_load_extent_map(ocfs2_filesys *fs,
ocfs2_cached_inode *cinode);
--
1.5.2.5
More information about the Ocfs2-tools-devel
mailing list