tuxonice_bio.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * kernel/power/tuxonice_bio.h
  3. *
  4. * Copyright (C) 2004-2014 Nigel Cunningham (nigel at tuxonice net)
  5. *
  6. * Distributed under GPLv2.
  7. *
  8. * This file contains declarations for functions exported from
  9. * tuxonice_bio.c, which contains low level io functions.
  10. */
  11. #include <linux/buffer_head.h>
  12. #include "tuxonice_extent.h"
  13. void toi_put_extent_chain(struct hibernate_extent_chain *chain);
  14. int toi_add_to_extent_chain(struct hibernate_extent_chain *chain,
  15. unsigned long start, unsigned long end);
  16. struct hibernate_extent_saved_state {
  17. int extent_num;
  18. struct hibernate_extent *extent_ptr;
  19. unsigned long offset;
  20. };
  21. struct toi_bdev_info {
  22. struct toi_bdev_info *next;
  23. struct hibernate_extent_chain blocks;
  24. struct block_device *bdev;
  25. struct toi_module_ops *allocator;
  26. int allocator_index;
  27. struct hibernate_extent_chain allocations;
  28. char name[266]; /* "swap on " or "file " + up to 256 chars */
  29. /* Saved in header */
  30. char uuid[17];
  31. dev_t dev_t;
  32. int prio;
  33. int bmap_shift;
  34. int blocks_per_page;
  35. unsigned long pages_used;
  36. struct hibernate_extent_saved_state saved_state[4];
  37. };
  38. struct toi_extent_iterate_state {
  39. struct toi_bdev_info *current_chain;
  40. int num_chains;
  41. int saved_chain_number[4];
  42. struct toi_bdev_info *saved_chain_ptr[4];
  43. };
  44. /*
  45. * Our exported interface so the swapwriter and filewriter don't
  46. * need these functions duplicated.
  47. */
  48. struct toi_bio_ops {
  49. int (*bdev_page_io)(int rw, struct block_device *bdev, long pos,
  50. struct page *page);
  51. int (*register_storage)(struct toi_bdev_info *new);
  52. void (*free_storage)(void);
  53. };
  54. struct toi_allocator_ops {
  55. unsigned long (*toi_swap_storage_available)(void);
  56. };
  57. extern struct toi_bio_ops toi_bio_ops;
  58. extern char *toi_writer_buffer;
  59. extern int toi_writer_buffer_posn;
  60. struct toi_bio_allocator_ops {
  61. int (*register_storage)(void);
  62. unsigned long (*storage_available)(void);
  63. int (*allocate_storage)(struct toi_bdev_info *, unsigned long);
  64. int (*bmap)(struct toi_bdev_info *);
  65. void (*free_storage)(struct toi_bdev_info *);
  66. };