From dc6227429d46d754be93e298f384e4ddbd8b689e Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 24 Jan 2012 18:23:18 +0000 Subject: [PATCH] - client: when deleting a file, check for .gzt and .gz variants as well svn path=/trunk/boinc/; revision=25139 --- checkin_notes | 6 ++++ client/client_types.cpp | 12 ++++++++ vda/vdad.cpp | 64 +++++++++++++++++++++++++++++++++++++++-- 3 files changed, 80 insertions(+), 2 deletions(-) diff --git a/checkin_notes b/checkin_notes index 397f42c4af..cb8d81eccb 100644 --- a/checkin_notes +++ b/checkin_notes @@ -957,3 +957,9 @@ Rom 24 Jan 2012 client/ http_curl.cpp + +David 24 Jan 2012 + - client: when deleting a file, check for .gzt and .gz variants as well + + client/ + client_types.cpp diff --git a/client/client_types.cpp b/client/client_types.cpp index d36f661edc..db1803d2a8 100644 --- a/client/client_types.cpp +++ b/client/client_types.cpp @@ -1148,6 +1148,18 @@ int FILE_INFO::delete_file() { get_pathname(this, path, sizeof(path)); int retval = delete_project_owned_file(path, true); + + // files with download_gzipped set may exist + // in temporary or compressed form + // + if (retval) { + strcat(path, ".gz"); + retval = delete_project_owned_file(path, true); + } + if (retval) { + strcat(path, "t"); + retval = delete_project_owned_file(path, true); + } if (retval && status != FILE_NOT_PRESENT) { msg_printf(project, MSG_INTERNAL_ERROR, "Couldn't delete file %s", path); } diff --git a/vda/vdad.cpp b/vda/vdad.cpp index c13e45e1d5..479a8358b0 100644 --- a/vda/vdad.cpp +++ b/vda/vdad.cpp @@ -19,6 +19,33 @@ #include "util.h" +#include "vda_lib.h" + +// return the name of a file created by Jerasure's encoder +// +// encoder creates files with names of the form +// Coding/fname_k01.ext +// Coding/fname_m01.ext +// +void encoder_filename( + const char* base, const char* ext, CODING& c, int i, char* buf +) { + int ndigits = 1; + if (c.m > 9) ndigits = 2; + else if (c.m > 99) ndigits = 3; + else if (c.m > 999) ndigits = 4; + int j; + char ch; + if (i >= c.n) { + j = i-c.n + 1; + ch = 'k'; + } else { + j = i+1; + ch = 'm'; + } + sprintf(buf, "%s_%c%*d%s", base, ch, ndigits, j, ext"); +} + // encode a meta-chunk. // precondition: "dir" contains a file "fname". // postcondition: dir contains @@ -26,16 +53,49 @@ // subdirs fname_k0 ... fname_mn, // each containing a same-named symbolic link to the corresponding chunk // -int encode(ENCODING& e) { +int encode(const char* dir, const char* fname, CODING& c) { + char cmd[1024]; + sprintf(cmd, + "cd %s; encoder %s %d %d cauchy_good 32 1024 500000", + dir, fname, e.n, e.k + ); + int s = system(cmd); + int status = WEXITSTATUS(s); + if (status) return status; + + for (int i=0; i