~psusi/ubuntu/precise/dmraid/fix-gpt

« back to all changes in this revision

Viewing changes to 1.0.0.rc16/include/dmraid/dmraid.h

  • Committer: Bazaar Package Importer
  • Author(s): Artur Rona
  • Date: 2010-02-04 21:34:22 UTC
  • mfrom: (1.1.4 upstream) (2.4.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100204213422-tdag8lcxpr7ahmg4
Tags: 1.0.0.rc16-3ubuntu1
* Merge from debian testing. (LP: #503136)  Remaining changes:
  - debian/dmraid-activate: Remove the special-casing of the root
    device which breaks in many situations and leaves the raw devices
    exposed. This was introduced in Debian to accommodate some broken
    configurations which wanted to access "partitions" on the raid
    raw devices. In Ubuntu, broken configurations has not been supported.
  - debian/dmraid.postinst: Comment out "udevadm trigger" call in postinst
    for now as it has severeconsequences when mountall is installed
    (clears /tmp).  If dmraid is installed, then presumably the important
    system devices are up and one canbe bothered with a reboot to take 
    the change into account. Let update-initramfs flag the system
    as needing a reboot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2004-2008  Heinz Mauelshagen, Red Hat GmbH.
 
3
 *                          All rights reserved.
 
4
 *
 
5
 * Copyright (C) 2007, 2009   Intel Corporation. All rights reserved.
 
6
 * November, 2007 - additions for Create, Delete, Rebuild & Raid 10. 
 
7
 * April, 2009 - dmreg.h file included
 
8
 *
 
9
 * See file LICENSE at the top of this source tree for license information.
 
10
 */
 
11
 
 
12
#ifndef _DMRAID_H_
 
13
#define _DMRAID_H_
 
14
 
 
15
#include <stdint.h>
 
16
#include <stdlib.h>
 
17
#include <sys/types.h>
 
18
 
 
19
/* FIXME: avoid more library internals. */
 
20
#include <dmraid/lib_context.h>
 
21
#include <dmraid/display.h>
 
22
#include <dmraid/format.h>
 
23
#include <dmraid/metadata.h>
 
24
#include <dmraid/reconfig.h>
 
25
#include <dmraid/dmreg.h>
 
26
/*
 
27
 * Library init/exit
 
28
 */
 
29
extern struct lib_context *libdmraid_init(int argc, char **argv);
 
30
extern void libdmraid_exit(struct lib_context *lc);
 
31
 
 
32
/*
 
33
 * Retrieve version identifiers.
 
34
 */
 
35
extern int dm_version(struct lib_context *lc, char *version, size_t size);
 
36
extern const char *libdmraid_date(struct lib_context *lc);
 
37
extern const char *libdmraid_version(struct lib_context *lc);
 
38
 
 
39
/*
 
40
 * Dealing with formats.
 
41
 */
 
42
extern int check_valid_format(struct lib_context *lc, char *fmt);
 
43
 
 
44
/*
 
45
 * Dealing with devices.
 
46
 */
 
47
extern unsigned int count_devices(struct lib_context *lc, enum dev_type type);
 
48
extern int discover_devices(struct lib_context *lc, char **devnodes);
 
49
extern void discover_raid_devices(struct lib_context *lc, char **devices);
 
50
extern void discover_partitions(struct lib_context *lc);
 
51
extern int write_dev(struct lib_context *lc, struct raid_dev *rd, int erase);
 
52
 
 
53
/*
 
54
 * Erase ondisk metadata.
 
55
 */
 
56
extern int erase_metadata(struct lib_context *lc);
 
57
 
 
58
/*
 
59
 * Dealing with RAID sets.
 
60
 */
 
61
extern const char *get_set_type(struct lib_context *lc, void *rs);
 
62
extern const char *get_set_name(struct lib_context *lc, void *rs);
 
63
extern int group_set(struct lib_context *lc, char **name);
 
64
extern char *libdmraid_make_table(struct lib_context *lc, struct raid_set *rs);
 
65
 
 
66
enum activate_type {
 
67
        A_ACTIVATE,
 
68
        A_DEACTIVATE,
 
69
};
 
70
 
 
71
extern void process_sets(struct lib_context *lc,
 
72
                         int (*func) (struct lib_context * lc, void *rs,
 
73
                                      int arg), int arg, enum set_type type);
 
74
extern int change_set(struct lib_context *lc, enum activate_type what,
 
75
                      void *rs);
 
76
 
 
77
/*
 
78
 * Memory allocation
 
79
 */
 
80
#ifdef  DEBUG_MALLOC
 
81
 
 
82
extern void *_dbg_malloc(size_t size, struct lib_context *lc,
 
83
                         const char *who, unsigned int line);
 
84
extern void *_dbg_realloc(void *ptr, size_t size, struct lib_context *lc,
 
85
                          const char *who, unsigned int line);
 
86
extern void *_dbg_strdup(void *ptr, struct lib_context *lc,
 
87
                         const char *who, unsigned int line);
 
88
extern void _dbg_free(void *ptr, struct lib_context *lc,
 
89
                      const char *who, unsigned int line);
 
90
 
 
91
#define dbg_malloc(size)        _dbg_malloc((size), lc, __func__, __LINE__)
 
92
#define dbg_realloc(ptr, size)  _dbg_realloc((ptr), (size), lc, \
 
93
                                             __func__, __LINE__)
 
94
#define dbg_strdup(ptr)         _dbg_strdup((ptr), lc, __func__, __LINE__)
 
95
#define dbg_strndup(ptr, len)   _dbg_strndup((ptr), len, lc, __func__, __LINE__)
 
96
#define dbg_free(ptr)           _dbg_free((ptr), lc, __func__, __LINE__)
 
97
 
 
98
#else
 
99
 
 
100
extern void *_dbg_malloc(size_t size);
 
101
extern void *_dbg_realloc(void *ptr, size_t size);
 
102
extern void *_dbg_strdup(void *ptr);
 
103
extern void *_dbg_strndup(void *ptr, size_t len);
 
104
extern void _dbg_free(void *ptr);
 
105
 
 
106
#define dbg_malloc      _dbg_malloc
 
107
#define dbg_realloc     _dbg_realloc
 
108
#define dbg_strdup      _dbg_strdup
 
109
#define dbg_strndup     _dbg_strndup
 
110
#define dbg_free        _dbg_free
 
111
 
 
112
#endif /* #ifdef DEBUG_MALLOC */
 
113
 
 
114
#endif