Move DM helpers to separate header.
authorMilan Broz <gmazyland@gmail.com>
Tue, 24 May 2011 11:19:12 +0000 (11:19 +0000)
committerMilan Broz <gmazyland@gmail.com>
Tue, 24 May 2011 11:19:12 +0000 (11:19 +0000)
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@530 36d66b0a-2a48-0410-832c-cd162a569da5

lib/Makefile.am
lib/internal.h
lib/utils_devpath.c
lib/utils_dm.h [new file with mode: 0644]

index d59f0be..6d76637 100644 (file)
@@ -54,6 +54,7 @@ libcryptsetup_la_SOURCES = \
        utils_loop.h                            \
        utils_devpath.c                         \
        libdevmapper.c                          \
+       utils_dm.h                              \
        volumekey.c                             \
        random.c                                \
        crypt_plain.c
index 04a5e67..07e7db2 100644 (file)
@@ -13,6 +13,7 @@
 #include "nls.h"
 #include "utils_crypt.h"
 #include "utils_loop.h"
+#include "utils_dm.h"
 
 #define SECTOR_SHIFT           9
 #define SECTOR_SIZE            (1 << SECTOR_SHIFT)
 
 struct crypt_device;
 
-struct hash_type {
-       char            *name;
-       void            *private;
-       int             (*fn)(void *data, int size, char *key,
-                             int sizep, const char *passphrase);
-};
-
-struct hash_backend {
-       const char              *name;
-       struct hash_type *      (*get_hashes)(void);
-       void                    (*free_hashes)(struct hash_type *hashes);
-};
-
 struct volume_key {
        size_t keylength;
        char key[];
@@ -58,41 +46,6 @@ void set_error_va(const char *fmt, va_list va);
 void set_error(const char *fmt, ...);
 const char *get_error(void);
 
-/* Device mapper backend - kernel support flags */
-#define DM_KEY_WIPE_SUPPORTED (1 << 0) /* key wipe message */
-#define DM_LMK_SUPPORTED      (1 << 1) /* lmk mode */
-#define DM_SECURE_SUPPORTED   (1 << 2) /* wipe (secure) buffer flag */
-#define DM_PLAIN64_SUPPORTED  (1 << 3) /* plain64 IV */
-uint32_t dm_flags(void);
-
-const char *dm_get_dir(void);
-int dm_init(struct crypt_device *context, int check_kernel);
-void dm_exit(void);
-int dm_remove_device(const char *name, int force, uint64_t size);
-int dm_status_device(const char *name);
-int dm_query_device(const char *name,
-                   char **device,
-                   uint64_t *size,
-                   uint64_t *skip,
-                   uint64_t *offset,
-                   char **cipher,
-                   int *key_size,
-                   char **key,
-                   int *read_only,
-                   int *suspended,
-                   char **uuid);
-int dm_create_device(const char *name, const char *device, const char *cipher,
-                    const char *type, const char *uuid,
-                    uint64_t size, uint64_t skip, uint64_t offset,
-                    size_t key_size, const char *key,
-                    int read_only, int reload);
-int dm_suspend_and_wipe_key(const char *name);
-int dm_resume_and_reinstate_key(const char *name,
-                               size_t key_size,
-                               const char *key);
-char *dm_device_path(const char *dev_id);
-int dm_is_dm_device(int major);
-
 char *crypt_lookup_dev(const char *dev_id);
 
 int sector_size_for_device(const char *device);
index f397f7c..35b639e 100644 (file)
@@ -79,6 +79,9 @@ static char *__lookup_dev(char *path, dev_t dev, int dir_level, const int max_le
        return result;
 }
 
+/*
+ * Non-udev systemd need to scan for device here.
+ */
 static char *lookup_dev_old(const char *dev_id)
 {
        int major, minor;
diff --git a/lib/utils_dm.h b/lib/utils_dm.h
new file mode 100644 (file)
index 0000000..6cbd732
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef _UTILS_DM_H
+#define _UTILS_DM_H
+
+/* device-mapper library helpers */
+
+/* Device mapper backend - kernel support flags */
+#define DM_KEY_WIPE_SUPPORTED (1 << 0) /* key wipe message */
+#define DM_LMK_SUPPORTED      (1 << 1) /* lmk mode */
+#define DM_SECURE_SUPPORTED   (1 << 2) /* wipe (secure) buffer flag */
+#define DM_PLAIN64_SUPPORTED  (1 << 3) /* plain64 IV */
+uint32_t dm_flags(void);
+
+const char *dm_get_dir(void);
+int dm_init(struct crypt_device *context, int check_kernel);
+void dm_exit(void);
+int dm_remove_device(const char *name, int force, uint64_t size);
+int dm_status_device(const char *name);
+int dm_query_device(const char *name,
+                   char **device,
+                   uint64_t *size,
+                   uint64_t *skip,
+                   uint64_t *offset,
+                   char **cipher,
+                   int *key_size,
+                   char **key,
+                   int *read_only,
+                   int *suspended,
+                   char **uuid);
+int dm_create_device(const char *name, const char *device, const char *cipher,
+                    const char *type, const char *uuid,
+                    uint64_t size, uint64_t skip, uint64_t offset,
+                    size_t key_size, const char *key,
+                    int read_only, int reload);
+int dm_suspend_and_wipe_key(const char *name);
+int dm_resume_and_reinstate_key(const char *name,
+                               size_t key_size,
+                               const char *key);
+char *dm_device_path(const char *dev_id);
+int dm_is_dm_device(int major);
+
+#endif /* _UTILS_DM_H */