aboutsummaryrefslogtreecommitdiff
path: root/fsutils.c
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-09-13 20:53:56 +0800
committerMistivia <i@mistivia.com>2025-09-13 20:53:56 +0800
commita4daf467f871b0e77f07f1071b47b960da7bfba9 (patch)
tree43b8847b395a90f5aadb57593c0d84e2c13cca7c /fsutils.c
parentf3eeea1d7092f3ca98836035bf75b941d14c2067 (diff)
add s3 client
Diffstat (limited to 'fsutils.c')
-rw-r--r--fsutils.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/fsutils.c b/fsutils.c
index 0c38eaf..f26f2b9 100644
--- a/fsutils.c
+++ b/fsutils.c
@@ -4,27 +4,29 @@
#include <stdlib.h>
#include <string.h>
+#include "s3_worker.h"
+
+const char hextable[] = "0123456789abcdef";
+
void tmp_local_filename(const char *prefix, char *buf) {
- static const char hex[] = "0123456789abcdef";
int prefix_len = strlen(prefix);
memcpy(buf, prefix, prefix_len);
buf = buf + prefix_len;
size_t i;
for (i = 0; i < 4; i++) {
unsigned char r = rand() & 0xFF;
- buf[i * 2] = hex[r >> 4];
- buf[i * 2 + 1] = hex[r & 0xF];
+ buf[i * 2] = hextable[r >> 4];
+ buf[i * 2 + 1] = hextable[r & 0xF];
}
buf[i*2] = '\0';
}
void tmp_ts_prefix(char *buf) {
- static const char hex[] = "0123456789abcdef";
size_t i;
for (i = 0; i < 4; i++) {
unsigned char r = rand() & 0xFF;
- buf[i * 2] = hex[r >> 4];
- buf[i * 2 + 1] = hex[r & 0xF];
+ buf[i * 2] = hextable[r >> 4];
+ buf[i * 2 + 1] = hextable[r & 0xF];
}
buf[i*2] = '\0';
}
@@ -34,14 +36,9 @@ void ts_filename(const char *prefix, int num, char *buf) {
}
void upload_file(const char *local, const char *remote) {
- // TODO
+ s3_worker_push(s3_upload_task(local, remote));
}
void remove_remote(const char *remote) {
- // TODO
+ s3_worker_push(s3_delete_task(remote));
}
-
-char ** list_file() {
- // TODO
- return NULL;
-} \ No newline at end of file