summaryrefslogtreecommitdiff
path: root/src/apk_defines.h
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-01-07 21:45:11 +0200
committerTimo Teras <timo.teras@iki.fi>2009-01-07 21:45:11 +0200
commit052fbe3f86eaab1940f25824705d809cd9af59e5 (patch)
tree248d8da56e8660db2aa09a17bd52d25e0256cf29 /src/apk_defines.h
parentc7ffc96a16c6963fe0a07be7ee75e8f1f7426882 (diff)
downloadapk-tools-052fbe3f86eaab1940f25824705d809cd9af59e5.tar.gz
apk-tools-052fbe3f86eaab1940f25824705d809cd9af59e5.tar.bz2
apk-tools-052fbe3f86eaab1940f25824705d809cd9af59e5.tar.xz
apk-tools-052fbe3f86eaab1940f25824705d809cd9af59e5.zip
various: make fancy progress bar and update todo
Diffstat (limited to 'src/apk_defines.h')
-rw-r--r--src/apk_defines.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/apk_defines.h b/src/apk_defines.h
index f86a4a8..5503167 100644
--- a/src/apk_defines.h
+++ b/src/apk_defines.h
@@ -50,7 +50,7 @@ extern csum_t bad_checksum;
#define csum_valid(buf) memcmp(buf, bad_checksum, sizeof(csum_t))
#endif
-extern int apk_cwd_fd, apk_quiet;
+extern int apk_cwd_fd, apk_quiet, apk_progress;
#define apk_error(args...) apk_log("ERROR: ", args);
#define apk_warning(args...) if (!apk_quiet) { apk_log("WARNING: ", args); }
@@ -58,6 +58,25 @@ extern int apk_cwd_fd, apk_quiet;
void apk_log(const char *prefix, const char *format, ...);
+static inline size_t apk_calc_installed_size(size_t size)
+{
+ const size_t bsize = 4 * 1024;
+
+ return (size + bsize - 1) & ~(bsize - 1);
+}
+static inline size_t muldiv(size_t a, size_t b, size_t c)
+{
+ unsigned long long tmp;
+ tmp = a;
+ tmp *= b;
+ tmp /= c;
+ return (size_t) tmp;
+}
+
+typedef void (*apk_progress_cb)(void *cb_ctx, size_t);
+
+#define APK_PROGRESS_SCALE 0x100
+
#define APK_ARRAY(array_type_name, elem_type_name) \
struct array_type_name { \
int num; \