blob: 269b576b25388c5f4b91b12b396fa87f2e21d0be [file] [log] [blame]
Mike Frysinger1fd98e02005-05-09 22:10:42 +00001/*
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
17errcode_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}