def config_(dev=None, **kwargs):
 if (dev is None):
  spath = _fspath()
 else:
  spath = _bcpath(dev)
 updates = dict([(key, val) for (key, val) in kwargs.items() if (not key.startswith('__'))])
 if updates:
  endres = 0
  for (key, val) in updates.items():
   endres += _sysfs_attr([spath, key], val, 'warn', 'Failed to update {0} with {1}'.format(os.path.join(spath, key), val))
  return (endres > 0)
 else:
  result = {}
  data = _sysfs_parse(spath, config=True, internals=True, options=True)
  for key in ('other_ro', 'inter_ro'):
   if (key in data):
    del data[key]
  for key in data.keys():
   result.update(data[key])
  return result

def config_ ( dev = None , ** kwargs ) : if ( dev is None ) : spath = _fspath ( ) else : spath = _bcpath ( dev ) updates = dict ( [ ( key , val ) for ( key , val ) in kwargs . items ( ) if ( not key . startswith ( '__' ) ) ] ) if updates : endres = 0 for ( key , val ) in updates . items ( ) : endres += _sysfs_attr ( [ spath , key ] , val , 'warn' , 'Failed to update {0} with {1}' . format ( os . path . join ( spath , key ) , val ) ) return ( endres > 0 ) else : result = { } data = _sysfs_parse ( spath , config = True , internals = True , options = True ) for key in ( 'other_ro' , 'inter_ro' ) : if ( key in data ) : del data [ key ] for key in data . keys ( ) : result . update ( data [ key ] ) return result
show or update config of a bcache device .