libblkid-tiny.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (C) 2013 Felix Fietkau <nbd@openwrt.org>
  3. * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License version 2.1
  7. * as published by the Free Software Foundation
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. #ifndef _LIBBLKID_TINY_H
  15. #define _LIBBLKID_TINY_H
  16. #include <libubox/list.h>
  17. struct blkid_struct_probe;
  18. /*
  19. * Filesystem / Raid magic strings
  20. */
  21. struct blkid_idmag
  22. {
  23. const char *magic; /* magic string */
  24. unsigned int len; /* length of magic */
  25. long kboff; /* kilobyte offset of superblock */
  26. unsigned int sboff; /* byte offset within superblock */
  27. };
  28. /*
  29. * Filesystem / Raid description
  30. */
  31. struct blkid_idinfo
  32. {
  33. const char *name; /* fs, raid or partition table name */
  34. int usage; /* BLKID_USAGE_* flag */
  35. int flags; /* BLKID_IDINFO_* flags */
  36. int minsz; /* minimal device size */
  37. /* probe function */
  38. int (*probefunc)(struct blkid_struct_probe *pr, const struct blkid_idmag *mag);
  39. struct blkid_idmag magics[]; /* NULL or array with magic strings */
  40. };
  41. /* Smaller version of the struct provided in blkidP.h */
  42. struct blkid_struct_probe
  43. {
  44. const struct blkid_idinfo *id;
  45. struct list_head list;
  46. int fd;
  47. int err;
  48. char dev[32];
  49. char uuid[64];
  50. char label[1025];
  51. char version[64];
  52. struct list_head buffers; /* list of buffers */
  53. };
  54. struct blkid_struct_probe *blkidtiny_new_probe(void);
  55. void blkidtiny_free_probe(struct blkid_struct_probe *pr);
  56. extern int probe_block(char *block, struct blkid_struct_probe *pr);
  57. extern int mkblkdev(void);
  58. #endif /* _LIBBLKID_TINY_H */