File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -373,6 +373,37 @@ fn main() {
373
373
Ok ( ( ) )
374
374
}
375
375
376
+ fn trim ( & mut self , offset : u64 , len : u32 ) -> std:: io:: Result < ( ) > {
377
+ if self . arguments . print_operations {
378
+ println ! ( "trim(offset={offset} len={len})" ) ;
379
+ }
380
+
381
+ let zeros = vec ! [ 0 ; len as usize ] ;
382
+ match self . overlay_file . write_at ( & zeros, offset) {
383
+ Ok ( _) => ( ) ,
384
+ Err ( error) => {
385
+ eprintln ! (
386
+ "failed to write {len} zeros to overlay file at offset {offset}: {error}"
387
+ ) ;
388
+ if !self . arguments . ignore_errors {
389
+ return Err ( error) ;
390
+ }
391
+ }
392
+ } ;
393
+ match self . mask_file . write_at ( & zeros, offset) {
394
+ Ok ( _) => ( ) ,
395
+ Err ( error) => {
396
+ eprintln ! (
397
+ "failed to write {len} zeros to mask file at offset {offset}: {error}"
398
+ ) ;
399
+ if !self . arguments . ignore_errors {
400
+ return Err ( error) ;
401
+ }
402
+ }
403
+ } ;
404
+ Ok ( ( ) )
405
+ }
406
+
376
407
fn unmount ( & mut self ) {
377
408
if self . arguments . print_operations {
378
409
println ! ( "unmount()" )
You can’t perform that action at this time.
0 commit comments