~ubuntu-branches/debian/sid/lvm2/sid

« back to all changes in this revision

Viewing changes to libdm/libdevmapper.h

  • Committer: Package Import Robot
  • Author(s): Bastian Blank
  • Date: 2013-03-03 12:33:47 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20130303123347-smfwei6dodkdth55
Tags: 2.02.98-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
164
164
int dm_get_library_version(char *version, size_t size);
165
165
int dm_task_get_driver_version(struct dm_task *dmt, char *version, size_t size);
166
166
int dm_task_get_info(struct dm_task *dmt, struct dm_info *dmi);
 
167
 
 
168
/*
 
169
 * This function returns dm device's UUID based on the value
 
170
 * of the mangling mode set during preceding dm_task_run call:
 
171
 *   - unmangled UUID for DM_STRING_MANGLING_{AUTO, HEX},
 
172
 *   - UUID without any changes for DM_STRING_MANGLING_NONE.
 
173
 *
 
174
 * To get mangled or unmangled form of the UUID directly, use
 
175
 * dm_task_get_uuid_mangled or dm_task_get_uuid_unmangled function.
 
176
 */
167
177
const char *dm_task_get_uuid(const struct dm_task *dmt);
168
178
 
169
179
struct dm_deps *dm_task_get_deps(struct dm_task *dmt);
297
307
} dm_string_mangling_t;
298
308
 
299
309
/*
300
 
 * Set/get mangling mode used for device-mapper names.
 
310
 * Set/get mangling mode used for device-mapper names and uuids.
301
311
 */
302
312
int dm_set_name_mangling_mode(dm_string_mangling_t name_mangling);
303
313
dm_string_mangling_t dm_get_name_mangling_mode(void);
304
314
 
305
315
/*
306
 
 * Get mangled/unmangled form of the device-mapper name
 
316
 * Get mangled/unmangled form of the device-mapper name or uuid
307
317
 * irrespective of the global setting (set by dm_set_name_mangling_mode).
308
 
 * The name returned needs to be freed after use by calling dm_free!
 
318
 * The name or uuid returned needs to be freed after use by calling dm_free!
309
319
 */
310
320
char *dm_task_get_name_mangled(const struct dm_task *dmt);
311
321
char *dm_task_get_name_unmangled(const struct dm_task *dmt);
 
322
char *dm_task_get_uuid_mangled(const struct dm_task *dmt);
 
323
char *dm_task_get_uuid_unmangled(const struct dm_task *dmt);
312
324
 
313
325
/*
314
326
 * Configure the device-mapper directory
650
662
        DM_THIN_MESSAGE_CREATE_THIN,            /* device_id */
651
663
        DM_THIN_MESSAGE_DELETE,                 /* device_id */
652
664
        DM_THIN_MESSAGE_SET_TRANSACTION_ID,     /* current_id, new_id */
 
665
        DM_THIN_MESSAGE_RESERVE_METADATA_SNAP,  /* target version >= 1.1 */
 
666
        DM_THIN_MESSAGE_RELEASE_METADATA_SNAP,  /* target version >= 1.1 */
653
667
} dm_thin_message_t;
654
668
 
655
669
int dm_tree_node_add_thin_pool_message(struct dm_tree_node *node,
657
671
                                       uint64_t id1, uint64_t id2);
658
672
 
659
673
/*
 
674
 * Set thin pool discard features
 
675
 *   ignore      - Disable support for discards
 
676
 *   no_passdown - Don't pass discards down to underlying data device,
 
677
 *                 just remove the mapping
 
678
 * Feature is available since version 1.1 of the thin target.
 
679
 */
 
680
int dm_tree_node_set_thin_pool_discard(struct dm_tree_node *node,
 
681
                                       unsigned ignore,
 
682
                                       unsigned no_passdown);
 
683
 
 
684
/*
660
685
 * FIXME: Defines bellow are based on kernel's dm-thin.c defines
661
686
 * MAX_DEV_ID ((1 << 24) - 1)
662
687
 */
666
691
                                 const char *pool_uuid,
667
692
                                 uint32_t device_id);
668
693
 
 
694
int dm_tree_node_set_thin_external_origin(struct dm_tree_node *node,
 
695
                                          const char *external_uuid);
 
696
 
669
697
void dm_tree_node_set_udev_flags(struct dm_tree_node *node, uint16_t udev_flags);
670
698
 
671
699
void dm_tree_node_set_presuspend_node(struct dm_tree_node *node,
713
741
 * Memory management
714
742
 *******************/
715
743
 
716
 
void *dm_malloc_aux(size_t s, const char *file, int line);
717
 
void *dm_malloc_aux_debug(size_t s, const char *file, int line);
718
 
void *dm_zalloc_aux(size_t s, const char *file, int line);
719
 
void *dm_zalloc_aux_debug(size_t s, const char *file, int line);
720
 
char *dm_strdup_aux(const char *str, const char *file, int line);
 
744
void *dm_malloc_aux(size_t s, const char *file, int line)
 
745
        __attribute__((malloc)) __attribute__((__warn_unused_result__));
 
746
void *dm_malloc_aux_debug(size_t s, const char *file, int line)
 
747
        __attribute__((__warn_unused_result__));
 
748
void *dm_zalloc_aux(size_t s, const char *file, int line)
 
749
        __attribute__((malloc)) __attribute__((__warn_unused_result__));
 
750
void *dm_zalloc_aux_debug(size_t s, const char *file, int line)
 
751
        __attribute__((__warn_unused_result__));
 
752
char *dm_strdup_aux(const char *str, const char *file, int line)
 
753
        __attribute__((malloc)) __attribute__((__warn_unused_result__));
721
754
void dm_free_aux(void *p);
722
 
void *dm_realloc_aux(void *p, unsigned int s, const char *file, int line);
 
755
void *dm_realloc_aux(void *p, unsigned int s, const char *file, int line)
 
756
        __attribute__((__warn_unused_result__));
723
757
int dm_dump_memory_debug(void);
724
758
void dm_bounds_check_debug(void);
725
759
 
782
816
struct dm_pool;
783
817
 
784
818
/* constructor and destructor */
785
 
struct dm_pool *dm_pool_create(const char *name, size_t chunk_hint);
 
819
struct dm_pool *dm_pool_create(const char *name, size_t chunk_hint)
 
820
        __attribute__((__warn_unused_result__));
786
821
void dm_pool_destroy(struct dm_pool *p);
787
822
 
788
823
/* simple allocation/free routines */
789
 
void *dm_pool_alloc(struct dm_pool *p, size_t s);
790
 
void *dm_pool_alloc_aligned(struct dm_pool *p, size_t s, unsigned alignment);
 
824
void *dm_pool_alloc(struct dm_pool *p, size_t s)
 
825
        __attribute__((__warn_unused_result__));
 
826
void *dm_pool_alloc_aligned(struct dm_pool *p, size_t s, unsigned alignment)
 
827
        __attribute__((__warn_unused_result__));
791
828
void dm_pool_empty(struct dm_pool *p);
792
829
void dm_pool_free(struct dm_pool *p, void *ptr);
793
830
 
858
895
void dm_pool_abandon_object(struct dm_pool *p);
859
896
 
860
897
/* utilities */
861
 
char *dm_pool_strdup(struct dm_pool *p, const char *str);
862
 
char *dm_pool_strndup(struct dm_pool *p, const char *str, size_t n);
863
 
void *dm_pool_zalloc(struct dm_pool *p, size_t s);
 
898
char *dm_pool_strdup(struct dm_pool *p, const char *str)
 
899
        __attribute__((__warn_unused_result__));
 
900
char *dm_pool_strndup(struct dm_pool *p, const char *str, size_t n)
 
901
        __attribute__((__warn_unused_result__));
 
902
void *dm_pool_zalloc(struct dm_pool *p, size_t s)
 
903
        __attribute__((__warn_unused_result__));
864
904
 
865
905
/******************
866
906
 * bitset functions
918
958
 
919
959
typedef void (*dm_hash_iterate_fn) (void *data);
920
960
 
921
 
struct dm_hash_table *dm_hash_create(unsigned size_hint);
 
961
struct dm_hash_table *dm_hash_create(unsigned size_hint)
 
962
        __attribute__((__warn_unused_result__));
922
963
void dm_hash_destroy(struct dm_hash_table *t);
923
964
void dm_hash_wipe(struct dm_hash_table *t);
924
965
 
1262
1303
 */
1263
1304
int dm_asprintf(char **buf, const char *format, ...)
1264
1305
    __attribute__ ((format(printf, 2, 3)));
 
1306
int dm_vasprintf(char **buf, const char *format, va_list ap);
1265
1307
 
1266
1308
/*
1267
1309
 * create lockfile (pidfile) - create and lock a lock file
1459
1501
void dm_config_destroy(struct dm_config_tree *cft);
1460
1502
 
1461
1503
typedef int (*dm_putline_fn)(const char *line, void *baton);
 
1504
/* Write the node and any subsequent siblings it has. */
1462
1505
int dm_config_write_node(const struct dm_config_node *cn, dm_putline_fn putline, void *baton);
 
1506
/* Write given node only without subsequent siblings. */
 
1507
int dm_config_write_one_node(const struct dm_config_node *cn, dm_putline_fn putline, void *baton);
1463
1508
 
1464
1509
struct dm_config_node *dm_config_find_node(const struct dm_config_node *cn, const char *path);
1465
1510
int dm_config_has_node(const struct dm_config_node *cn, const char *path);
1500
1545
 
1501
1546
struct dm_pool *dm_config_memory(struct dm_config_tree *cft);
1502
1547
 
 
1548
/* Udev device directory. */
 
1549
#define DM_UDEV_DEV_DIR "/dev/"
 
1550
 
1503
1551
/* Cookie prefixes.
1504
1552
 *
1505
1553
 * The cookie value consists of a prefix (16 bits) and a base (16 bits).