summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/bmaptool/files/0003-BmapCopy.py-tweak-suggested-udev-rule.patch
blob: 2794eeada39435d2760e995634d254a1aa97b2be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From 2a71e0c1a675e4f30f02c03dd0325944b393c434 Mon Sep 17 00:00:00 2001
From: Trevor Woerner <twoerner@gmail.com>
Date: Fri, 12 Jan 2024 01:54:26 -0500
Subject: [PATCH 3/3] BmapCopy.py: tweak suggested udev rule

Both bdi/max_ratio and queue/scheduler are only valid for whole block devices,
not individual partitions. Therefore, add a

	ENV{DEVTYPE}!="partition",

to the suggested udev rule so that bmaptool doesn't try to check every
partition of the block device, just the whole device.

Otherwise the following will appear in the logs:

	Jan 10 01:30:31 localhost (udev-worker)[10399]: sdk1: /etc/udev/rules.d/60-bmaptool-optimizations.rules:5 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3.1/2-3.1.2/2-3.1.2:1.0/host14/target14:0:0/14:0:0:0/block/sdk/sdk1/bdi/min_ratio}, ignoring: No such file or directory
	Jan 10 01:30:31 localhost (udev-worker)[10399]: sdk1: /etc/udev/rules.d/60-bmaptool-optimizations.rules:5 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3.1/2-3.1.2/2-3.1.2:1.0/host14/target14:0:0/14:0:0:0/block/sdk/sdk1/bdi/max_ratio}, ignoring: No such file or directory
	Jan 10 01:30:31 localhost (udev-worker)[10399]: sdk1: /etc/udev/rules.d/60-bmaptool-optimizations.rules:5 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3.1/2-3.1.2/2-3.1.2:1.0/host14/target14:0:0/14:0:0:0/block/sdk/sdk1/queue/scheduler}, ignoring: No such file or directory
	[... and so on for every partition on your block device ...]

Upstream-Status: Submitted [https://github.com/intel/bmap-tools/pull/131]
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
 bmaptools/BmapCopy.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bmaptools/BmapCopy.py b/bmaptools/BmapCopy.py
index b1e8e0fcbdb7..a4c1177246a9 100644
--- a/bmaptools/BmapCopy.py
+++ b/bmaptools/BmapCopy.py
@@ -906,7 +906,8 @@ class BmapBdevCopy(BmapCopy):
                     "\n"
                     'ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="xxxx", '
                     'ATTRS{idProduct}=="xxxx", TAG+="uaccess"\n'
-                    'SUBSYSTEMS=="usb", ATTRS{idVendor}=="xxxx", '
+                    'SUBSYSTEMS=="usb", ENV{DEVTYPE}!="partition", '
+                    'ATTRS{idVendor}=="xxxx", '
                     'ATTRS{idProduct}=="xxxx", ATTR{bdi/min_ratio}="0", '
                     'ATTR{bdi/max_ratio}="1", ATTR{queue/scheduler}="none"\n'
                     "\n"
-- 
2.43.0.76.g1a87c842ece3