Hi Alex,
please see my comment below.
Thank you,
Jan
boot_archive_archive.py
-----------------------
212-216: I might recommend to take advantage of Python 'math'
module to calculate this value as it could take care of this
task in more generic way.
Also, please add comment about what the formula calculates,
e.g.
[...]
from math import floor,log <-- put at the beginning within other imports
[...]
#
# round the nbpi value to the largest power of 2
# which is less than or equal to calculated value
#
if nbpi is not 0:
nbpi = pow(2,floor(log(nbpi,2)))
[...]
218: Please log the message if we end up with 0, as it means
that something went wrong with the calculation, e.g.
218 if (nbpi != 0):
219 print "Calculated number of bytes per inode: %d." % (nbpi)
->
218 if (nbpi != 0):
219 print "Calculated number of bytes per inode: %d." % (nbpi)
220 else:
221 print "Calculation of nbpi failed, default will be used."
nit (to be compliant with rest of the code
now when Python 2.6 changes were integrated):
350 if (BA_BYTES_PER_INODE_STR != None):
->
350 if BA_BYTES_PER_INODE_STR is not None:
356-357: Since nbpi is optional, I might recommend to slightly modify the
message,
so that user is not under impression that not specifying nbpi in DC manifest
might be a problem.
356 print "Boot archive nbpi is missing from manifest or invalid, " \
357 "will use the calculated value"
->
356 print "Boot archive nbpi has not been specified in the manifest, " \
357 "it will be calculated"
Alexander Eremin wrote:
> On Wed, 2009-11-25 at 10:34 +0100, Jan Damborsky wrote:
>> Alexander Eremin wrote:
> Hi Jan,
> I've added initial code for nbpi calculation
> (http://cr.opensolaris.org/~alhazred/8205/).
> If nbpi is not defined in manifest, DC is calculating this number.
> Example if not defined for sparc AI:
> ...
> ==== ba-arch: Boot archive
> archiving
>
>
> Sizing boot archive
> requirements...
>
> Raw uncompressed: 143
> MB.
>
> Boot archive nbpi is missing from manifest or invalid, will use the
> calculated value
> Calculated number of bytes per inode:
> 16384.
> Creating boot archive with padded size of 172
> MB...
> ==== ai-post-mod: Auto-Install post boot archive image area
> modification
> ---
> Function tested for sparc AI and x86 LiveCD archives, in both cases got
> required values.
>
>