mirror of https://github.com/BOINC/boinc.git
db_dump: split host.serialnum into client version/vbox version/coprocs parts
This commit is contained in:
parent
ce97e855d0
commit
c897dc8276
|
@ -717,3 +717,26 @@ char* lf_terminate(char* p) {
|
|||
p[n+1] = 0;
|
||||
return p;
|
||||
}
|
||||
|
||||
void parse_serialnum(char* in, char* boinc, char* vbox, char* coprocs) {
|
||||
strcpy(boinc, "");
|
||||
strcpy(vbox, "");
|
||||
strcpy(coprocs, "");
|
||||
while (*in) {
|
||||
if (*in != '[') break; // format error
|
||||
char* p = strchr(in, ']');
|
||||
if (!p) break; // format error
|
||||
p++;
|
||||
char c = *p;
|
||||
*p = 0;
|
||||
if (strstr(in, "BOINC")) {
|
||||
strcpy(boinc, in);
|
||||
} else if (strstr(in, "vbox")) {
|
||||
strcpy(vbox, in);
|
||||
} else {
|
||||
strcat(coprocs, in);
|
||||
}
|
||||
*p = c;
|
||||
in = p;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,6 +75,13 @@ extern int string_substitute(
|
|||
//
|
||||
extern void mysql_timestamp(double, char*);
|
||||
|
||||
// parse host.serialnum into component parts.
|
||||
// Given a string of the form
|
||||
// [BOINC|7.2.42][CUDA|GeForce GTX 860M|1|2048MB|34052|101][INTEL|Intel(R) HD Graphics 4600|1|1752MB||102][vbox|4.2.16]
|
||||
// split it into the BOINC, vbox, and other (coproc) parts
|
||||
//
|
||||
extern void parse_serialnum(char* in, char* boinc, char* vbox, char* coprocs);
|
||||
|
||||
// take a malloced string.
|
||||
// if \n is not last char, add it.
|
||||
//
|
||||
|
|
|
@ -345,14 +345,30 @@ void write_host(HOST& host, FILE* f, bool detail) {
|
|||
);
|
||||
|
||||
// host.serialnum stores coprocessor description
|
||||
// and client and vbox versions.
|
||||
//
|
||||
if (strlen(host.serialnum)) {
|
||||
char serialnum[1024];
|
||||
xml_escape(host.serialnum, serialnum, sizeof(serialnum));
|
||||
char boinc[256], vbox[256], coprocs[256];
|
||||
char buf[1024];
|
||||
parse_serialnum(host.serialnum, boinc, vbox, coprocs);
|
||||
if (strlen(boinc)) {
|
||||
xml_escape(boinc, buf, sizeof(buf));
|
||||
fprintf(f,
|
||||
" <coprocs>%s</coprocs>\n", serialnum
|
||||
" <boinc_version>%s</boinc_version>\n", buf
|
||||
);
|
||||
}
|
||||
if (strlen(vbox)) {
|
||||
xml_escape(vbox, buf, sizeof(buf));
|
||||
fprintf(f,
|
||||
" <vbox_version>%s</vbox_version>\n", buf
|
||||
);
|
||||
}
|
||||
if (strlen(coprocs)) {
|
||||
xml_escape(coprocs, buf, sizeof(buf));
|
||||
fprintf(f,
|
||||
" <coprocs>%s</coprocs>\n", buf
|
||||
);
|
||||
}
|
||||
|
||||
if (detail) {
|
||||
fprintf(f,
|
||||
" <create_time>%d</create_time>\n"
|
||||
|
|
Loading…
Reference in New Issue