Skip to content
Snippets Groups Projects
Commit 844e1bd3c328 authored by jfp's avatar jfp
Browse files

rule02: make code simple to read

rule04: starlet.device_scan always returns 4 values
parent a859d1226501
Branches
No related tags found
No related merge requests found
...@@ -46,7 +46,10 @@ ...@@ -46,7 +46,10 @@
)[2][ )[2][
ossdef.OSS__PROTECTION ossdef.OSS__PROTECTION
] # type:ignore ] # type:ignore
if not ((sec & 0x8000) and (sec & 0x2000)): wprot = (sec & 0xF000) >> 12
wbit = 0x2
dbit = 0x8
if wprot & wbit == 0 or wprot & dbit == 0:
if fmt: if fmt:
print('0201"2"', fn, file=fo) print('0201"2"', fn, file=fo)
else: else:
...@@ -90,7 +93,10 @@ ...@@ -90,7 +93,10 @@
)[2][ )[2][
ossdef.OSS__PROTECTION ossdef.OSS__PROTECTION
] # type:ignore ] # type:ignore
if not ((sec & 0x800) and (sec & 0x200)): gprot = (sec & 0x0F00) >> 8
wbit = 0x2
dbit = 0x8
if gprot & wbit == 0 or gprot & dbit == 0:
if fmt: if fmt:
print('0202"3"', fn.decode(), file=fo) # type:ignore print('0202"3"', fn.decode(), file=fo) # type:ignore
else: else:
......
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
while True: while True:
try: try:
sts, device, devCtx = starlet.device_scan(b'*', devItm, devCtx) sts, device, devCtx, d = starlet.device_scan(b'*', devItm, devCtx)
except: except:
break break
if not lib.getdvi(dvidef.DVI__MNT, device_name=device)[1]: if not lib.getdvi(dvidef.DVI__MNT, device_name=device)[1]:
...@@ -138,5 +138,5 @@ ...@@ -138,5 +138,5 @@
print(fn.decode(), prot.decode(), file=fo) print(fn.decode(), prot.decode(), file=fo)
devCtx = 0 devCtx = 0
devItm = [ devItm = (
itemList.itemList(code=dvsdef.DVS__DEVCLASS, value=dcdef.DC__DISK), itemList.itemList(code=dvsdef.DVS__DEVCLASS, value=dcdef.DC__DISK),
...@@ -142,5 +142,5 @@ ...@@ -142,5 +142,5 @@
itemList.itemList(code=dvsdef.DVS__DEVCLASS, value=dcdef.DC__DISK), itemList.itemList(code=dvsdef.DVS__DEVCLASS, value=dcdef.DC__DISK),
] )
while True: while True:
try: try:
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
while True: while True:
try: try:
sts, device, devCtx = starlet.device_scan(b'*', devItm, devCtx) sts, device, devCtx, d = starlet.device_scan(b'*', devItm, devCtx)
except: except:
break break
if not lib.getdvi(dvidef.DVI__MNT, device_name=device)[1]: if not lib.getdvi(dvidef.DVI__MNT, device_name=device)[1]:
...@@ -307,7 +307,7 @@ ...@@ -307,7 +307,7 @@
while True: while True:
try: try:
sts, device, devCtx = starlet.device_scan(b'*', devItm, devCtx) sts, device, devCtx, d = starlet.device_scan(b'*', devItm, devCtx)
except: except:
break break
if not lib.getdvi(dvidef.DVI__MNT, device_name=device)[1]: if not lib.getdvi(dvidef.DVI__MNT, device_name=device)[1]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment