am f3761585: am 60f56e7d: am 996d8f48: Merge "Add support for tuning partitions" into lmp-sprout-dev

* commit 'f37615859e369c774841eafdb225a5f02259e1ee':
  Add support for tuning partitions
This commit is contained in:
Michael Runge 2014-11-24 18:06:36 +00:00 committed by Android Git Automerger
commit 3deca9e5df

View file

@ -201,6 +201,17 @@ class EdifyGenerator(object):
"""Log a message to the screen (if the logs are visible)."""
self.script.append('ui_print("%s");' % (message,))
def TunePartition(self, partition, *options):
fstab = self.info.get("fstab", None)
if fstab:
p = fstab[partition]
if (p.fs_type not in ( "ext2", "ext3", "ext4")):
raise ValueError("Partition %s cannot be tuned\n" % (partition,))
self.script.append('tune2fs(' +
"".join(['"%s", ' % (i,) for i in options]) +
'"%s") || abort("Failed to tune partition %s");'
% ( p.device,partition));
def FormatPartition(self, partition):
"""Format the given partition, specified by its mount point (eg,
"/system")."""