def super_(dev):
    '''
    Read out BCache SuperBlock

    CLI example:

    .. code-block:: bash

        salt '*' bcache.device bcache0
        salt '*' bcache.device /dev/sdc

    '''
    dev = _devpath(dev)
    ret = {}

    res = _run_all('bcache-super-show {0}'.format(dev), 'error', 'Error reading superblock on {0}: %s'.format(dev))
    if not res:
        return False

    for line in res.splitlines():  # pylint: disable=no-member
        line = line.strip()
        if not line:
            continue

        key, val = [val.strip() for val in re.split(r'[\s]+', line, maxsplit=1)]
        if not (key and val):
            continue

        mval = None
        if ' ' in val:
            rval, mval = [val.strip() for val in re.split(r'[\s]+', val, maxsplit=1)]
            mval = mval[1:-1]
        else:
            rval = val

        try:
            rval = int(rval)
        except Exception:
            try:
                rval = float(rval)
            except Exception:
                if rval == 'yes':
                    rval = True
                elif rval == 'no':
                    rval = False

        pkey, key = re.split(r'\.', key, maxsplit=1)
        if pkey not in ret:
            ret[pkey] = {}

        if mval is not None:
            ret[pkey][key] = (rval, mval)
        else:
            ret[pkey][key] = rval

    return ret
def super_ ( dev ) : dev = _devpath ( dev ) ret = { } res = _run_all ( 'bcache-super-show {0}' . format ( dev ) , 'error' , 'Error reading superblock on {0}: %s' . format ( dev ) ) if not res : return False for line in res . splitlines ( ) : line = line . strip ( ) if not line : continue key , val = [ val . strip ( ) for val in re . split ( r'[\s]+' , line , maxsplit = 1 ) ] if not ( key and val ) : continue mval = None if ' ' in val : rval , mval = [ val . strip ( ) for val in re . split ( r'[\s]+' , val , maxsplit = 1 ) ] mval = mval [ 1 : - 1 ] else : rval = val try : rval = int ( rval ) except Exception : try : rval = float ( rval ) except Exception : if rval == 'yes' : rval = True elif rval == 'no' : rval = False pkey , key = re . split ( r'\.' , key , maxsplit = 1 ) if pkey not in ret : ret [ pkey ] = { } if mval is not None : ret [ pkey ] [ key ] = ( rval , mval ) else : ret [ pkey ] [ key ] = rval return ret
Read out BCache SuperBlock

    CLI example:

    .. code-block:: bash

        salt '*' bcache.device bcache0
        salt '*' bcache.device /dev/sdc