mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Move DM helpers to separate header.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@530 36d66b0a-2a48-0410-832c-cd162a569da5
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
@@ -30,19 +31,6 @@
|
||||
|
||||
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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
41
lib/utils_dm.h
Normal file
41
lib/utils_dm.h
Normal file
@@ -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 */
|
||||
Reference in New Issue
Block a user