Use common utils_tools.c for all tools.
[platform/upstream/cryptsetup.git] / src / cryptsetup.h
index a966f81..2c82d76 100644 (file)
 #ifndef CRYPTSETUP_H
 #define CRYPTSETUP_H
 
+#define _LARGEFILE64_SOURCE
+#define _FILE_OFFSET_BITS 64
+
 #include <config.h>
 
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <errno.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <ctype.h>
+#include <fcntl.h>
+#include <popt.h>
+#include <sys/stat.h>
+
 #include "lib/nls.h"
 #include "lib/utils_crypt.h"
 #include "lib/utils_loop.h"
 #include "libcryptsetup.h"
 
 #define CONST_CAST(x) (x)(uintptr_t)
-
 #define DEFAULT_CIPHER(type)   (DEFAULT_##type##_CIPHER "-" DEFAULT_##type##_MODE)
+#define SECTOR_SIZE 512
+#define ROUND_SECTOR(x) (((x) + SECTOR_SIZE - 1) / SECTOR_SIZE)
+
+extern int opt_debug;
+extern int opt_verbose;
+extern int opt_batch_mode;
+
+/* Common tools */
+void clogger(struct crypt_device *cd, int level, const char *file, int line,
+            const char *format, ...);
+void tool_log(int level, const char *msg, void *usrptr __attribute__((unused)));
+void quiet_log(int level, const char *msg, void *usrptr);
+
+int yesDialog(const char *msg, void *usrptr __attribute__((unused)));
+void show_status(int errcode);
+const char *uuid_or_device(const char *spec);
+void usage(poptContext popt_context, int exitcode, const char *error, const char *more);
+void dbg_version_and_cmd(int argc, const char **argv);
+int translate_errno(int r);
 
+/* Log */
 #define log_dbg(x...) clogger(NULL, CRYPT_LOG_DEBUG, __FILE__, __LINE__, x)
 #define log_std(x...) clogger(NULL, CRYPT_LOG_NORMAL, __FILE__, __LINE__, x)
 #define log_verbose(x...) clogger(NULL, CRYPT_LOG_VERBOSE, __FILE__, __LINE__, x)