[pbs-devel] [PATCH proxmox-backup v2 03/14] tape/drive: clippy fixes
Wolfgang Bumiller
w.bumiller at proxmox.com
Mon Apr 19 14:09:37 CEST 2021
> On 04/19/2021 11:40 AM Thomas Lamprecht <t.lamprecht at proxmox.com> wrote:
>
>
> On 19.04.21 10:38, Wolfgang Bumiller wrote:
> >> if let Some(buffer_mode) = buffer_mode {
> >> - let mut mode = head.flags3 & 0b1_000_1111;
> >> + let mut mode = head.flags3 & 0b1000_1111;
> > ^ I really wish those bits were documented or `bitflags!`, because maybe the 1/3/4 grouping is based on meaning :S
> > But since it's not, I agree with this hunk ;-)
>
> But it is though, they are from the SCSI reference
> "Mode Parameter Header for Mode Select"
>
> +--+--+--+--+--+--+--+--+
> |WP| B.MODE | SPEED |
> +--+--+--+--+--+--+--+--+
>
> (write protect, buffer mode, speed)
>
> so this is the wrong solution, the right one would be:
> * keep as is
> * introduce constant like BUFFER_MODE_MASK 0b01110000 and use it negated here
^ So let's do this then.
I do think this particular lint is the least useful one TBH. When working on embedded
riscv code I was pretty much constantly fighting with it...
And maybe when the base is done we should also go through all the data structures and
add doc comments referencing the corresponding scsi documentation to make it easier
to navigate?
More information about the pbs-devel
mailing list