mirror of https://github.com/BOINC/boinc.git
- client: when deleting a file, check for .gzt and .gz variants as well
svn path=/trunk/boinc/; revision=25139
This commit is contained in:
parent
188e792365
commit
dc6227429d
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
64
vda/vdad.cpp
64
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<e.m; i++) {
|
||||
encoder_filename(base, ext, c, i, buf);
|
||||
sprintf(path, "%s/Coding/%s", dir, buf);
|
||||
|
||||
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int init_meta_chunk(const char* dir, const char* fname, POLICY& p, int level) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int init_file(VDA_FILE& vf) {
|
||||
POLICY p;
|
||||
char buf[1024];
|
||||
int retval;
|
||||
|
||||
// read the policy file
|
||||
//
|
||||
sprintf(buf, "%s/boinc_meta.txt", vf.dir);
|
||||
retval = p.parse(buf);
|
||||
if (retval) return retval;
|
||||
return init_meta_chunk(vf.dir, vf.name, p, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void handle_file(VDA_FILE& vf) {
|
||||
int handle_file(VDA_FILE& vf) {
|
||||
if (!vf.inited) {
|
||||
init_file(vf);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool scan_files() {
|
||||
|
|
Loading…
Reference in New Issue