version 1.6.2.6, 2014/02/06 14:22:43
|
version 1.7.4.1, 2017/01/22 20:40:10
|
Line 12 terms:
|
Line 12 terms:
|
All of the documentation and software included in the ELWIX and AITNET |
All of the documentation and software included in the ELWIX and AITNET |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
|
|
Copyright 2004 - 2014 | Copyright 2004 - 2017 |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
|
|
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
Line 61 Usage()
|
Line 61 Usage()
|
" Syntax: imgupd [options] [image_file]\n\n" |
" Syntax: imgupd [options] [image_file]\n\n" |
"\t-v\t\tVerbose ...\n" |
"\t-v\t\tVerbose ...\n" |
"\t-R\t\tReboot system after complete\n" |
"\t-R\t\tReboot system after complete\n" |
"\t-p\t\tPipe suitable transfer on little chunks\n" |
|
"\t-i\t\tStart fill storage from begin\n" |
"\t-i\t\tStart fill storage from begin\n" |
"\t-g\t\tGet image from Storage\n" |
"\t-g\t\tGet image from Storage\n" |
"\t-t\t\tTruncate Storage file name\n" |
"\t-t\t\tTruncate Storage file name\n" |
Line 130 EmptyStore(int img, int flg)
|
Line 129 EmptyStore(int img, int flg)
|
if (wlen == -1) |
if (wlen == -1) |
ESYSERR(0); |
ESYSERR(0); |
else |
else |
EERROR(EIO, "Error at chunk %d init %d bytes, " | EERROR(EIO, "Error at chunk %d init %zd bytes, " |
"should be %u\n", i, wlen, bufSize); | "should be %d\n", i, wlen, bufSize); |
return -1; |
return -1; |
} else |
} else |
VERB(1) printf("+Written chunk #%d\n", i); |
VERB(1) printf("+Written chunk #%d\n", i); |
Line 161 FillStore(int img, int iflg, int fd, int fflg)
|
Line 160 FillStore(int img, int iflg, int fd, int fflg)
|
} else if (!rlen) |
} else if (!rlen) |
break; |
break; |
else |
else |
VERB(1) printf("+Readed %d bytes for chunk #%d\n", rlen, j); | VERB(1) printf("+Readed %zd bytes for chunk #%d\n", rlen, j); |
} |
} |
|
|
wlen = write(img, buf, bufSize); |
wlen = write(img, buf, bufSize); |
Line 169 FillStore(int img, int iflg, int fd, int fflg)
|
Line 168 FillStore(int img, int iflg, int fd, int fflg)
|
ESYSERR(0); |
ESYSERR(0); |
return -1; |
return -1; |
} else if (wlen && wlen != bufSize) { |
} else if (wlen && wlen != bufSize) { |
EERROR(EIO, "Error at chunk %d written %d bytes, " | EERROR(EIO, "Error at chunk %d written %zd bytes, " |
"should be %u\n", i, wlen, bufSize); |
"should be %u\n", i, wlen, bufSize); |
} else |
} else |
VERB(1) printf("+Written %d bytes at chunk #%d\n", wlen, i); | VERB(1) printf("+Written %zd bytes at chunk #%d\n", wlen, i); |
} |
} |
|
|
return 0; |
return 0; |
Line 184 main(int argc, char **argv)
|
Line 183 main(int argc, char **argv)
|
char ch, m = 0, R = 0; |
char ch, m = 0, R = 0; |
int fd, img, tr = 0; |
int fd, img, tr = 0; |
|
|
while ((ch = getopt(argc, argv, "hvRipgts:f:")) != -1) | while ((ch = getopt(argc, argv, "hvRigts:f:")) != -1) |
switch (ch) { |
switch (ch) { |
case 'f': |
case 'f': |
strlcpy(imgName, optarg, sizeof imgName); |
strlcpy(imgName, optarg, sizeof imgName); |
Line 199 main(int argc, char **argv)
|
Line 198 main(int argc, char **argv)
|
case 't': |
case 't': |
tr = O_TRUNC; |
tr = O_TRUNC; |
break; |
break; |
case 'p': |
|
bufSize = IMGBUF_SIZE2; |
|
break; |
|
case 'g': |
case 'g': |
m = 1; |
m = 1; |
case 'i': |
case 'i': |
Line 240 main(int argc, char **argv)
|
Line 236 main(int argc, char **argv)
|
close(fd); |
close(fd); |
EERROR(ENOSPC, "Error:: file size %llu is " |
EERROR(ENOSPC, "Error:: file size %llu is " |
"greater from storage size %llu\n", |
"greater from storage size %llu\n", |
iSize, imgSize); | (unsigned long long) iSize, |
| (unsigned long long) imgSize); |
return 2; |
return 2; |
} else |
} else |
lseek(fd, 0, SEEK_SET); |
lseek(fd, 0, SEEK_SET); |
Line 273 main(int argc, char **argv)
|
Line 270 main(int argc, char **argv)
|
} |
} |
|
|
VERB(1) printf("imgSize=%llu imgName=%s imgFile=%s\n", |
VERB(1) printf("imgSize=%llu imgName=%s imgFile=%s\n", |
imgSize, imgName, argc ? imgFile : "<stdin>"); | (unsigned long long) imgSize, imgName, argc ? imgFile : "<stdin>"); |
|
|
if (!m) { |
if (!m) { |
/* open storage device */ |
/* open storage device */ |
Line 306 main(int argc, char **argv)
|
Line 303 main(int argc, char **argv)
|
close(img); |
close(img); |
EERROR(ENOSPC, "Error:: storage size %llu is " |
EERROR(ENOSPC, "Error:: storage size %llu is " |
"greater from file size %llu\n", |
"greater from file size %llu\n", |
iSize, imgSize); | (unsigned long long) iSize, |
| (unsigned long long) imgSize); |
return 3; |
return 3; |
} else |
} else |
lseek(img, 0, SEEK_SET); |
lseek(img, 0, SEEK_SET); |
Line 335 main(int argc, char **argv)
|
Line 333 main(int argc, char **argv)
|
} |
} |
} else { /* GET */ |
} else { /* GET */ |
iSize ^= iSize; |
iSize ^= iSize; |
if (EmptyStore(fd, fileFlg) == -1) { | if (!(fileFlg & FD_PIPE)) |
if (fd > 2) | if (EmptyStore(fd, fileFlg) == -1) { |
close(fd); | if (fd > 2) |
close(img); | close(fd); |
return 3; | close(img); |
} | return 3; |
| } |
if (FillStore(fd, fileFlg, img, nameFlg) == -1) { |
if (FillStore(fd, fileFlg, img, nameFlg) == -1) { |
if (fd > 2) |
if (fd > 2) |
close(fd); |
close(fd); |