Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #130 from darrenldl/dev
Browse files Browse the repository at this point in the history
Major upgrade (2.2.0 to 3.0.0)
  • Loading branch information
darrenldl committed Jan 10, 2019
2 parents b2b8588 + 3edc31f commit 505e4d7
Show file tree
Hide file tree
Showing 157 changed files with 17,642 additions and 5,768 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
/tests/blkar
/cov_tests/rsbx
/cov_tests/blkar
blkar
54 changes: 52 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## 2.3.0
## 3.0.0

- Changed decode mode to use only file portion of stored file name in SBX container

- In previous versions, if the stored file name contains a path, then the entire path would be used, which can lead to unexpected output locations

- Added `--multi-pass` flag to decode and sort mode
- Added `--multi-pass` and `--multi-pass-no-skip` flag to decode and sort mode

- This disables truncation, and allows updating the file gradually across multiple runs

Expand All @@ -16,6 +16,56 @@

- Combined with the improved stats tracking allows checking if the container is sorted or not

- Repalced `--to` with `--to-inc` and `--to-exc`

- This affects `rescue` and `show` mode

- Added `--from`, `--to-inc` and `--to-exc` to the following modes

- check
- decode
- encode
- sort

- Added `--ref-from`, `--ref-to-inc` and `--ref-to-exc` to the following modes

- check
- decode
- sort

- Added `--force-misalign` to the following modes

- check
- decode
- sort

- Updated reference block scanning code to respect `--force-misalign`

- Updated burst error resistance level guessing to respect `--force-misalign`

- Updated decode mode stats output

- This results in potentially incompatible JSON output

- Fixed `misc_utils::calc_required_len_and_seek_to_from_byte_range`

- Sometimes off by one error occured

- Ran `rustfmt` for code formatting

- Ran `cargo fix --edition` to update to Rust 2018 edition

- Fixed potential integer overflow issues in decode and repair mode

- Previously, when output is stdout, block index and seq num counter in decode mode may be incremented even if already at max
- Previously, seq num counter in repair mode may be incremented even if already at max

- Updated burst error resistance level guessing code to respect `--from` and `--force-misalign` options

- Fixed potential incorrect behaviour when processed block is incomplete

- Rectified by adding `#[must_use]` to `Reader::ReadResult`, forcing all code paths to check read result instead of possibly ignoring it

## 2.2.0

- Added `--only-pick-uid` option to show mode
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[package]
name = "blkar"
version = "2.3.0"
version = "3.0.0"
authors = ["Darren Ldl <darrenldldev@gmail.com>"]
edition = "2018"
build = "build.rs"
exclude = [
"ci/*",
Expand Down
19 changes: 9 additions & 10 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,24 @@ use std::fs::File;
use std::io::Write;
use std::path::Path;

const CRC_POLY_CCITT : u16 = 0x1021;
const CRC_POLY_CCITT: u16 = 0x1021;

fn make_crcccitt_tab() -> [u16; 256] {
let mut crc : u16;
let mut c : u16;
let mut crc: u16;
let mut c: u16;

let mut table : [u16; 256] = [0; 256];
let mut table: [u16; 256] = [0; 256];

for i in 0u16..256u16 {

crc = 0;
c = i << 8;
c = i << 8;

for _ in 0..8 {

if ((crc ^ c) & 0x8000u16) != 0 {
crc = ( crc << 1 ) ^ CRC_POLY_CCITT; }
else {
crc = crc << 1; }
crc = (crc << 1) ^ CRC_POLY_CCITT;
} else {
crc = crc << 1;
}

c = c << 1;
}
Expand Down
2 changes: 1 addition & 1 deletion cov_tests/negative_params_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ for v in ${VALS[*]}; do
echo "show using $v to"
echo "========================================"

./blkar show --to="$v" dummy.sbx
./blkar show --to-exc="$v" dummy.sbx

echo ""
done
4 changes: 2 additions & 2 deletions cov_tests/rescue_from_to_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ echo "Rescuing from dummy disk"

echo -n "Checking that blkar only decodes first block"
rm rescued_data/DEADBEEF* &>/dev/null
output=$(kcov_blkar rescue --json dummy_empty_disk rescued_data --from 0 --to 511)
output=$(kcov_blkar rescue --json dummy_empty_disk rescued_data --from 0 --to-inc 511)
if [[ $(echo $output | jq -r ".error") != "null" ]]; then
echo " ==> Invalid JSON"
exit_code=1
Expand All @@ -63,7 +63,7 @@ fi

echo -n "Checking that blkar only decodes second block"
rm rescued_data/DEADBEEF* &>/dev/null
output=$(kcov_blkar rescue --json dummy_empty_disk rescued_data --from 512 --to 512)
output=$(kcov_blkar rescue --json dummy_empty_disk rescued_data --from 512 --to-inc 512)
if [[ $(echo $output | jq -r ".error") != "null" ]]; then
echo " ==> Invalid JSON"
exit_code=1
Expand Down
9 changes: 3 additions & 6 deletions src/block_preds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ macro_rules! block_pred_same_ver_uid {
$block:expr
) => {{
let version = $block.get_version();
let uid = $block.get_uid();
move |block : &Block| -> bool {
block.get_version() == version
&& block.get_uid() == uid
}
}}
let uid = $block.get_uid();
move |block: &Block| -> bool { block.get_version() == version && block.get_uid() == uid }
}};
}

0 comments on commit 505e4d7

Please sign in to comment.