diff options
author | Krzysztof Opasiak <k.opasiak@samsung.com> | 2016-05-13 14:19:08 +0200 |
---|---|---|
committer | Seung-Woo Kim <sw0312.kim@samsung.com> | 2016-07-25 14:39:49 +0900 |
commit | 8b19dd2c0ae925b0692ecb73b2f912ec65a6dd82 (patch) | |
tree | 828db4c55a9e48cdb921fe0a1dbe79e338b36e66 /libthor/thor.c | |
parent | 40175b01581831beff844c7bebe3fe3b8bf51cc4 (diff) | |
download | lthor-8b19dd2c0ae925b0692ecb73b2f912ec65a6dd82.tar.gz lthor-8b19dd2c0ae925b0692ecb73b2f912ec65a6dd82.tar.bz2 lthor-8b19dd2c0ae925b0692ecb73b2f912ec65a6dd82.zip |
Add support for large files
Currently session size is send over USB as integer 32b.
So max size of all files is 2GB.
Some fixed uboot versions treat this value as unsigned integer 32b.
So there max size of all files is 4GB.
Let's provide initial support for large files in lthor by
counting all size using off_t which thanks to define is 64b
on all platforms.
This patch also add a suitable warning if image is larger than
2GB and reports an error if image is larger than 4GB.
Change-Id: I402b3684fa96c7531edb580e38f109ecc8a5ebd0
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Diffstat (limited to 'libthor/thor.c')
-rw-r--r-- | libthor/thor.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libthor/thor.c b/libthor/thor.c index 6a15155..a670f4d 100644 --- a/libthor/thor.c +++ b/libthor/thor.c @@ -157,7 +157,7 @@ static int t_thor_exec_cmd(thor_device_handle *th, request_type req_id, NULL, 0, NULL); } -int thor_start_session(thor_device_handle *th, size_t total) +int thor_start_session(thor_device_handle *th, off_t total) { int ret; @@ -200,7 +200,7 @@ out: static int t_thor_prep_next_chunk(struct t_thor_data_chunk *chunk, struct t_thor_data_transfer *transfer_data) { - size_t to_read; + off_t to_read; int ret; to_read = transfer_data->data_left - transfer_data->data_in_progress; @@ -319,7 +319,7 @@ complete_all: static int t_thor_init_chunk(struct t_thor_data_chunk *chunk, thor_device_handle *th, - size_t trans_unit_size, + off_t trans_unit_size, void *user_data) { int ret; @@ -376,7 +376,7 @@ static inline void t_thor_cancel_chunk(struct t_thor_data_chunk *chunk) static int t_thor_send_raw_data(thor_device_handle *th, struct thor_data_src *data, - size_t trans_unit_size, + off_t trans_unit_size, thor_progress_cb report_progress, void *user_data) { @@ -441,11 +441,11 @@ int thor_send_data(thor_device_handle *th, struct thor_data_src *data, void *user_data, thor_next_entry_cb report_next_entry, void *ne_cb_data) { - size_t filesize; + off_t filesize; const char *filename; struct res_pkt resp; int32_t int_data[2]; - size_t trans_unit_size; + off_t trans_unit_size; int ret; while (1) { |