shred: expand buffer size from 512 to 65536 to reduce write calls

This buffer size matches GNU
This commit is contained in:
Terts Diepraam 2023-03-10 12:12:24 +01:00
parent 3982fc58fd
commit 73d5c4474b

View file

@ -25,7 +25,8 @@ use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
use uucore::libc::S_IWUSR;
use uucore::{format_usage, show, show_if_err, util_name};
const BLOCK_SIZE: usize = 512;
// This block size seems to match GNU (2^16 = 65536)
const BLOCK_SIZE: usize = 1 << 16;
const NAME_CHARSET: &[u8] = b"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_.";
// Patterns as shown in the GNU coreutils shred implementation