[pbs-devel] [PATCH proxmox-backup v2 03/14] tape/drive: clippy fixes
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon Apr 19 11:40:30 CEST 2021
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
* use bitflags or the like
When reading the actual code and having the SCSI reference open (which is a must
when working on such code anyway) it's actually quite clear what the intention
is.
More information about the pbs-devel
mailing list