3
0

blkid.h 3.0 KB

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