diff options
Diffstat (limited to 'e2fsprogs/ext2fs/write_bb_file.c')
-rw-r--r-- | e2fsprogs/ext2fs/write_bb_file.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/e2fsprogs/ext2fs/write_bb_file.c b/e2fsprogs/ext2fs/write_bb_file.c new file mode 100644 index 000000000..269b576b2 --- /dev/null +++ b/e2fsprogs/ext2fs/write_bb_file.c | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * write_bb_file.c --- write a list of bad blocks to a FILE * | ||
3 | * | ||
4 | * Copyright (C) 1994, 1995 Theodore Ts'o. | ||
5 | * | ||
6 | * %Begin-Header% | ||
7 | * This file may be redistributed under the terms of the GNU Public | ||
8 | * License. | ||
9 | * %End-Header% | ||
10 | */ | ||
11 | |||
12 | #include <stdio.h> | ||
13 | |||
14 | #include "ext2_fs.h" | ||
15 | #include "ext2fs.h" | ||
16 | |||
17 | errcode_t ext2fs_write_bb_FILE(ext2_badblocks_list bb_list, | ||
18 | unsigned int flags EXT2FS_ATTR((unused)), | ||
19 | FILE *f) | ||
20 | { | ||
21 | badblocks_iterate bb_iter; | ||
22 | blk_t blk; | ||
23 | errcode_t retval; | ||
24 | |||
25 | retval = ext2fs_badblocks_list_iterate_begin(bb_list, &bb_iter); | ||
26 | if (retval) | ||
27 | return retval; | ||
28 | |||
29 | while (ext2fs_badblocks_list_iterate(bb_iter, &blk)) { | ||
30 | fprintf(f, "%d\n", blk); | ||
31 | } | ||
32 | ext2fs_badblocks_list_iterate_end(bb_iter); | ||
33 | return 0; | ||
34 | } | ||