3
0

write_bb_file.c 757 B

1234567891011121314151617181920212223242526272829303132333435
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * write_bb_file.c --- write a list of bad blocks to a FILE *
  4. *
  5. * Copyright (C) 1994, 1995 Theodore Ts'o.
  6. *
  7. * %Begin-Header%
  8. * This file may be redistributed under the terms of the GNU Public
  9. * License.
  10. * %End-Header%
  11. */
  12. #include <stdio.h>
  13. #include "ext2_fs.h"
  14. #include "ext2fs.h"
  15. errcode_t ext2fs_write_bb_FILE(ext2_badblocks_list bb_list,
  16. unsigned int flags EXT2FS_ATTR((unused)),
  17. FILE *f)
  18. {
  19. badblocks_iterate bb_iter;
  20. blk_t blk;
  21. errcode_t retval;
  22. retval = ext2fs_badblocks_list_iterate_begin(bb_list, &bb_iter);
  23. if (retval)
  24. return retval;
  25. while (ext2fs_badblocks_list_iterate(bb_iter, &blk)) {
  26. fprintf(f, "%d\n", blk);
  27. }
  28. ext2fs_badblocks_list_iterate_end(bb_iter);
  29. return 0;
  30. }