def get_volumes(blocks, layout_info):
    """Get a list of UBI volume objects from list of blocks

    Arguments:
    List:blocks            -- List of layout block objects
    List:layout_info    -- Layout info (indexes of layout blocks and
                                        associated data blocks.)

    Returns:
    Dict -- Of Volume objects by volume name, including any
            relevant blocks.
    """
    volumes = {}

    vol_blocks_lists = sort.by_vol_id(blocks, layout_info[2])

    for vol_rec in blocks[layout_info[0]].vtbl_recs:
        vol_name = vol_rec.name.strip(b'\x00').decode('utf-8')
        if vol_rec.rec_index not in vol_blocks_lists:
            vol_blocks_lists[vol_rec.rec_index] = []
        volumes[vol_name] = description(vol_rec.rec_index, vol_rec, vol_blocks_lists[vol_rec.rec_index])
            
    return volumes
def get_volumes ( blocks , layout_info ) : volumes = { } vol_blocks_lists = sort . by_vol_id ( blocks , layout_info [ 2 ] ) for vol_rec in blocks [ layout_info [ 0 ] ] . vtbl_recs : vol_name = vol_rec . name . strip ( b'\x00' ) . decode ( 'utf-8' ) if vol_rec . rec_index not in vol_blocks_lists : vol_blocks_lists [ vol_rec . rec_index ] = [ ] volumes [ vol_name ] = description ( vol_rec . rec_index , vol_rec , vol_blocks_lists [ vol_rec . rec_index ] ) return volumes
Get a list of UBI volume objects from list of blocks

    Arguments:
    List:blocks            -- List of layout block objects
    List:layout_info    -- Layout info (indexes of layout blocks and
                                        associated data blocks.)

    Returns:
    Dict -- Of Volume objects by volume name, including any
            relevant blocks.