diff options
author | Theodore Ts'o <tytso@mit.edu> | 2000-07-04 19:20:25 +0000 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2000-07-04 19:20:25 +0000 |
commit | 57dca85467cf3fc61565e916a5f2e35db8020d88 (patch) | |
tree | 5499c0d1c5105e41ee285f5b5cefc07dd7c962a3 /lib/ext2fs/write_bb_file.c | |
parent | b2420d4057c0a151c5ada91c4648794c8c6cb1a4 (diff) | |
download | e2fsprogs-57dca85467cf3fc61565e916a5f2e35db8020d88.tar.gz |
Many files:
tst_badblocks.c: Update test program to test ext2fs_read_bb_FILE2 and
ext2fs_write_FILE.
write_bb_file.c (ext2fs_write_bb_FILE): New function which writes out
bad blocks list to a file.
read_bb_file.c (ext2fs_read_bb_FILE2): Add new function which changes
the callback function to take two additional arguments; a private
blind pointer supplied by the caller, and pointer to a char *
containing a pointer to the invalid string.
badblocks.c (ext2fs_badblocks_equal): Add new function which returns
true if two badblocks list are equal.
Makefile.in: Remove explicit link of -lc in the shared library. (It
shouldn't be necessary, and is harmful in some cases).
jump.funcs:
dll/jump.funcs: Add new jumptable entries for ext2fs_write_bb_FILE,
ext2fs_read_bb_FILE2, and ext2fs_badblocks_equal.
Diffstat (limited to 'lib/ext2fs/write_bb_file.c')
-rw-r--r-- | lib/ext2fs/write_bb_file.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/ext2fs/write_bb_file.c b/lib/ext2fs/write_bb_file.c new file mode 100644 index 00000000..5550765c --- /dev/null +++ b/lib/ext2fs/write_bb_file.c @@ -0,0 +1,39 @@ +/* + * write_bb_file.c --- write a list of bad blocks to a FILE * + * + * Copyright (C) 1994, 1995 Theodore Ts'o. + * + * %Begin-Header% + * This file may be redistributed under the terms of the GNU Public + * License. + * %End-Header% + */ + +#include <stdio.h> + +#if EXT2_FLAT_INCLUDES +#include "ext2_fs.h" +#else +#include <linux/ext2_fs.h> +#endif + +#include "ext2fs.h" + +errcode_t ext2fs_write_bb_FILE(ext2_badblocks_list bb_list, + unsigned int flags, + FILE *f) +{ + badblocks_iterate bb_iter; + blk_t blk; + errcode_t retval; + + retval = ext2fs_badblocks_list_iterate_begin(bb_list, &bb_iter); + if (retval) + return retval; + + while (ext2fs_badblocks_list_iterate(bb_iter, &blk)) { + fprintf(f, "%d\n", blk); + } + ext2fs_badblocks_list_iterate_end(bb_iter); + return 0; +} |