Linux supports 32-bit device numbers in the format 0xmmmMMMmm, where
each m is a hex digit of the minor number and each M is a hex digit of
the major number.

Currently parse_lilo only works if the top 3 digits are 0 (or absent).
Shift and mask the upper bits correctly.

Signed-off-by: Ben Hutchings <[email protected]>
---
 scripts/functions | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/functions b/scripts/functions
index 2da6173..adcfefa 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -121,8 +121,8 @@ parse_numeric() {
        *)
                # [A-Fa-f0-9]*
                value=$(( 0x${1} ))
-               minor=$(( ${value} % 256 ))
-               major=$(( ${value} / 256 ))
+               minor=$(( (${value} & 0xff) | (${value} >> 12) & 0xfff00 ))
+               major=$(( (${value} >> 8) & 0xfff ))
                ;;
        esac
 

-- 
Ben Hutchings
Life would be so much easier if we could look at the source code.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to