def back_make(dev, cache_mode='writeback', force=False, attach=True, bucket_size=None):
    # pylint: disable=too-many-return-statements
    cache = uuid()

    if not cache:
        log.error('No bcache set found')
        return False
    elif _sysfs_attr(_bcpath(dev)):
        if not force:
            log.error('{0} already contains a bcache. Wipe it manually or use force'.format(dev))
            return False
        elif uuid(dev) and not detach(dev):
            return False
        elif not stop(dev):
            return False

    dev = _devpath(dev)
    block_size = _size_map(_fssys('block_size'))
    # You might want to override, we pick the cache set's as sane default
    if bucket_size is None:
        bucket_size = _size_map(_fssys('bucket_size'))

    cmd = 'make-bcache --block {0} --bucket {1} --{2} --bdev {3}'.format(block_size, bucket_size, cache_mode, dev)
    if force:
        cmd += ' --wipe-bcache'

    if not _run_all(cmd, 'error', 'Error creating backing device {0}: {{0}}'.format(dev)):
        return False
    elif not _sysfs_attr('fs/bcache/register', _devpath(dev),
                         'error', 'Error registering backing device {0}: {{0}}'.format(dev)):
        return False
    elif not _wait(lambda: _sysfs_attr(_bcpath(dev)) is not False,
                   'error', 'Backing device {0} did not register'.format(dev)):
        return False
    elif attach:
        return attach_(dev)

    return True
generated source for method __init__
dataset/ETHPy150Open saltstack/salt/salt/modules/bcache.py/back_make--crossover with--dataset/ETHPy150Open CarterBain/Medici/ib/ext/UnderComp.py/UnderComp.__init__