Commit Graph

18 Commits

Author SHA1 Message Date
Wolfgang Bumiller
0652d81977 tree-wide: enable doc_cfg and doc_auto_cfg for docs
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-02 11:59:53 +02:00
Wolfgang Bumiller
c336cb9ab7 io: bump to 1.1.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-06-19 12:21:43 +02:00
Fabian Grünbichler
6f532dfb7d various clippy fixes
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-06-06 11:40:49 +02:00
Max Carrara
8841b389e3 proxmox-io: fix sparse_copy not copying sparsely on irregular read operations
In the uncommon circumstance that calls to `read()` end up reading any number of
bytes other than 4096, the subsequently read bytes become misaligned, causing
blocks of zeroes to be written unnecessarily.

To illustrate, imagine you have a 12KiB file:

  [x][x][x][x][ ][ ][ ][ ][x][x][x][x]
   └──4096──┘  └──4096──┘  └──4096──┘

The first and last block are filled with some data, whereas the middle block is
empty and will therefore result in only zeroes being read.

In order for the empty block to be skipped with `seek()`, the entire buffer has
to be filled with zeroes.

If, for example, the first `read()` ends up putting only 3KiB into the buffer,
the empty block in the middle won't be detected properly, as the buffer will
now always contain some data. What results are four misaligned reads:

  [x][x][x][x][ ][ ][ ][ ][x][x][x][x]
   ├─────┘  ├────────┘  ├────────┘  │
   1        2           3           4

This is fixed by ensuring chunks of 4KiB are always read into the buffer,
except when the last block is truncated. In order to prevent frequent small
reads, the incoming reader is also buffered via `io::BufReader`.

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
2023-08-09 12:48:04 +02:00
Wolfgang Bumiller
8f8d52f148 update d/copyright files to debian copyright-format 1.0
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-05-23 13:02:39 +02:00
Wolfgang Bumiller
2610208794 io: add boxed module for boxed bytes like vec::zeroed...
- proxmox_io::boxed::uninitialized(len) -> Box<[u8]>
  same as vec::uninitialized, but as a box

- proxmox_io::boxed::zeroed(len) -> Box<[u8]>
  same as vec::zeroed, but as a box

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-12-12 11:00:22 +01:00
Wolfgang Bumiller
a7d84effc5 io: deny unsafe_op_in_unsafe_fn
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-12-12 11:00:22 +01:00
Fabian Grünbichler
6c161bd5ab update d/control files
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-12-07 09:48:38 +01:00
Fabian Grünbichler
4189221470 inherit shared, external dependencies
noteworthy changes:
- proxmox-http had a default_features_false dep on hyper, which is dropped (the
  default feature is empty anyway)
- hyper, libc, nix, tokio and url versions are unified
- missing (cosmetic) bindgen feature on zstd enabled everywhere

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-12-07 09:48:38 +01:00
Fabian Grünbichler
64959d9ae0 move common metadata to workspace
and switch all crates to 2021 edition as well as a unified "authors" value.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-12-07 09:48:25 +01:00
Fabian Grünbichler
5ec765f842 update d/control files
debcargo 2.6 changed some minor details

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-12-06 11:21:43 +01:00
Fabian Grünbichler
28e30719e8 clippy fixes
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-10-11 09:48:04 +02:00
Thomas Lamprecht
9c0e9dca59 tree wide update of genereated control
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-05-05 10:22:50 +02:00
Wolfgang Bumiller
a774958239 io: formatting
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-07 11:51:15 +01:00
Wolfgang Bumiller
36e064d73a io: clippy fixes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-29 14:51:26 +01:00
Dietmar Maurer
cdf8220676 bump proxmox-io version to 1.0.1-1
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-25 12:16:03 +01:00
Dietmar Maurer
41d3df8950 proxmox-io: imported pbs-tools/src/sync/std_channel_writer.rs
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-25 11:21:31 +01:00
Wolfgang Bumiller
01a8b6f1bf add proxmox-io crate
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-11 10:07:53 +02:00