Fix two mem leaks in crypt_init_by_name_and_header().
[platform/upstream/cryptsetup.git] / lib / internal.h
index 1803462..d574911 100644 (file)
@@ -15,6 +15,9 @@
 #include "utils_loop.h"
 #include "utils_dm.h"
 
+/* to silent gcc -Wcast-qual for const cast */
+#define CONST_CAST(x) (x)(uintptr_t)
+
 #define SECTOR_SHIFT           9
 #define SECTOR_SIZE            (1 << SECTOR_SHIFT)
 #define DEFAULT_DISK_ALIGNMENT 1048576 /* 1MiB */
@@ -55,6 +58,7 @@ ssize_t write_blockwise(int fd, void *buf, size_t count);
 ssize_t read_blockwise(int fd, void *_buf, size_t count);
 ssize_t write_lseek_blockwise(int fd, char *buf, size_t count, off_t offset);
 int device_ready(struct crypt_device *cd, const char *device, int mode);
+int device_size(const char *device, uint64_t *size);
 
 enum devcheck { DEV_OK = 0, DEV_EXCL = 1, DEV_SHARED = 2 };
 int device_check_and_adjust(struct crypt_device *cd,
@@ -62,7 +66,7 @@ int device_check_and_adjust(struct crypt_device *cd,
                            enum devcheck device_check,
                            uint64_t *size,
                            uint64_t *offset,
-                           int *read_only);
+                           uint32_t *flags);
 int wipe_device_header(const char *device, int sectors);
 
 void logger(struct crypt_device *cd, int class, const char *file, int line, const char *format, ...);
@@ -94,5 +98,10 @@ int crypt_plain_hash(struct crypt_device *ctx,
                     const char *hash_name,
                     char *key, size_t key_size,
                     const char *passphrase, size_t passphrase_size);
+int PLAIN_activate(struct crypt_device *cd,
+                    const char *name,
+                    struct volume_key *vk,
+                    uint64_t size,
+                    uint32_t flags);
 
 #endif /* INTERNAL_H */