Linux device mounting: Mount the drive with the lowest kernel name as main memory

This commit is contained in:
Kovid Goyal 2010-10-19 16:53:51 -06:00
parent 5fb294486b
commit 2bd9f63f29
2 changed files with 5 additions and 4 deletions

View File

@ -97,8 +97,8 @@ class XMLCache(object):
for source_id, path in paths.items(): for source_id, path in paths.items():
if source_id == 0: if source_id == 0:
if not os.path.exists(path): if not os.path.exists(path):
raise DeviceError('The SONY XML cache media.xml does not exist. Try' raise DeviceError(('The SONY XML cache %r does not exist. Try'
' disconnecting and reconnecting your reader.') ' disconnecting and reconnecting your reader.')%repr(path))
with open(path, 'rb') as f: with open(path, 'rb') as f:
raw = f.read() raw = f.read()
else: else:
@ -112,7 +112,7 @@ class XMLCache(object):
verbose=DEBUG)[0], verbose=DEBUG)[0],
parser=parser) parser=parser)
if self.roots[source_id] is None: if self.roots[source_id] is None:
raise Exception(('The SONY database at %s is corrupted. Try ' raise Exception(('The SONY database at %r is corrupted. Try '
' disconnecting and reconnecting your reader.')%path) ' disconnecting and reconnecting your reader.')%path)
self.ext_paths, self.ext_roots = {}, {} self.ext_paths, self.ext_roots = {}, {}

View File

@ -523,7 +523,8 @@ class Device(DeviceConfig, DevicePlugin):
devnodes.append(node) devnodes.append(node)
devnodes += list(repeat(None, 3)) devnodes += list(repeat(None, 3))
ans = tuple(['/dev/'+x if ok.get(x, False) else None for x in devnodes[:3]]) ans = ['/dev/'+x if ok.get(x, False) else None for x in devnodes[:3]]
ans.sort(key=lambda x: x[5:] if x else 'zzzzz')
return self.linux_swap_drives(ans) return self.linux_swap_drives(ans)
def linux_swap_drives(self, drives): def linux_swap_drives(self, drives):