blkid.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * blkid.h - Interface for libblkid, a library to identify block devices
  3. *
  4. * Copyright (C) 2001 Andreas Dilger
  5. * Copyright (C) 2003 Theodore Ts'o
  6. *
  7. * %Begin-Header%
  8. * This file may be redistributed under the terms of the
  9. * GNU Lesser General Public License.
  10. * %End-Header%
  11. */
  12. #ifndef _BLKID_BLKID_H
  13. #define _BLKID_BLKID_H
  14. #include <sys/types.h>
  15. #include <linux/types.h>
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. #define BLKID_VERSION "1.0.0"
  20. #define BLKID_DATE "12-Feb-2003"
  21. typedef struct blkid_struct_dev *blkid_dev;
  22. typedef struct blkid_struct_cache *blkid_cache;
  23. typedef __s64 blkid_loff_t;
  24. typedef struct blkid_struct_tag_iterate *blkid_tag_iterate;
  25. typedef struct blkid_struct_dev_iterate *blkid_dev_iterate;
  26. /*
  27. * Flags for blkid_get_dev
  28. *
  29. * BLKID_DEV_CREATE Create an empty device structure if not found
  30. * in the cache.
  31. * BLKID_DEV_VERIFY Make sure the device structure corresponds
  32. * with reality.
  33. * BLKID_DEV_FIND Just look up a device entry, and return NULL
  34. * if it is not found.
  35. * BLKID_DEV_NORMAL Get a valid device structure, either from the
  36. * cache or by probing the device.
  37. */
  38. #define BLKID_DEV_FIND 0x0000
  39. #define BLKID_DEV_CREATE 0x0001
  40. #define BLKID_DEV_VERIFY 0x0002
  41. #define BLKID_DEV_NORMAL (BLKID_DEV_CREATE | BLKID_DEV_VERIFY)
  42. /* cache.c */
  43. extern void blkid_put_cache(blkid_cache cache);
  44. extern int blkid_get_cache(blkid_cache *cache, const char *filename);
  45. /* dev.c */
  46. extern const char *blkid_dev_devname(blkid_dev dev);
  47. extern blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache);
  48. extern int blkid_dev_next(blkid_dev_iterate iterate, blkid_dev *dev);
  49. extern void blkid_dev_iterate_end(blkid_dev_iterate iterate);
  50. /* devno.c */
  51. extern char *blkid_devno_to_devname(dev_t devno);
  52. /* devname.c */
  53. extern int blkid_probe_all(blkid_cache cache);
  54. extern blkid_dev blkid_get_dev(blkid_cache cache, const char *devname,
  55. int flags);
  56. /* getsize.c */
  57. extern blkid_loff_t blkid_get_dev_size(int fd);
  58. /* probe.c */
  59. int blkid_known_fstype(const char *fstype);
  60. extern blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev);
  61. /* read.c */
  62. /* resolve.c */
  63. extern char *blkid_get_tag_value(blkid_cache cache, const char *tagname,
  64. const char *devname);
  65. extern char *blkid_get_devname(blkid_cache cache, const char *token,
  66. const char *value);
  67. /* tag.c */
  68. extern blkid_tag_iterate blkid_tag_iterate_begin(blkid_dev dev);
  69. extern int blkid_tag_next(blkid_tag_iterate iterate,
  70. const char **type, const char **value);
  71. extern void blkid_tag_iterate_end(blkid_tag_iterate iterate);
  72. extern blkid_dev blkid_find_dev_with_tag(blkid_cache cache,
  73. const char *type,
  74. const char *value);
  75. extern int blkid_parse_tag_string(const char *token, char **ret_type,
  76. char **ret_val);
  77. /* version.c */
  78. extern int blkid_parse_version_string(const char *ver_string);
  79. extern int blkid_get_library_version(const char **ver_string,
  80. const char **date_string);
  81. #ifdef __cplusplus
  82. }
  83. #endif
  84. #endif /* _BLKID_BLKID_H */