Check if the subvolume is copy on write
199539
def _is_cow(path):
    '''
    
    '''
    dirname = os.path.dirname(path)
    return 'C' not in __salt__['file.lsattr'](dirname)[path]
3342
public boolean checkWrite()
    {
        if (!outActive || state != State.ACTIVE) {
            return false;
        }

        // TODO DIFF V4 small change, it is done like this in 4.2.2
        boolean full = !checkHwm();

        if (full) {
            outActive = false;
            return false;
        }

        return true;
    }
1373081
void checkWriteSuspend(ChannelHandlerContext ctx, long delay, long queueSize) {
        if (queueSize > maxWriteSize || delay > maxWriteDelay) {
            setUserDefinedWritability(ctx, false);
        }
    }
372142
def is_filelike(ob):
    
    if hasattr(ob, 'read') and callable(ob.read):
        return True

    if hasattr(ob, 'write') and callable(ob.write):
        return True

    return False
270709
def is_writer(self, check_pending=True):
        """"""
        me = self._current_thread()
        if self._writer == me:
            return True
        if check_pending:
            return me in self._pending_writers
        else:
            return False
113532
def write(self):
        """"""
        self._assure_writable("write")
        if not self._dirty:
            return

        if isinstance(self._file_or_files, (list, tuple)):
            raise AssertionError("Cannot write back if there is not exactly a single file to write to, have %i files"
                                 % len(self._file_or_files))
        # end assert multiple files

        if self._has_includes():
            log.debug("Skipping write-back of configuration file as include files were merged in." +
                      "Set merge_includes=False to prevent this.")
            return
        # end

        fp = self._file_or_files

        # we have a physical file on disk, so get a lock
        is_file_lock = isinstance(fp, string_types + (FileType, ))
        if is_file_lock:
            self._lock._obtain_lock()
        if not hasattr(fp, "seek"):
            with open(self._file_or_files, "wb") as fp:
                self._write(fp)
        else:
            fp.seek(0)
            # make sure we do not overwrite into an existing file
            if hasattr(fp, 'truncate'):
                fp.truncate()
            self._write(fp)
607665
def write(self, device=None, char=0, bs=None, count=None):
        
        volume = self.get_volume(device)
        block_size = bs or BLOCK_SIZE

        # Calculate the number of blocks that are in the volume
        count = count or (volume['size'] / block_size)

        data = "".join([chr(int(char)) for i in range(0, block_size)])

        print("Writing: '%c'" % data[0])
        total = 0
        with directio.open(volume['path'], buffered=block_size) as file:
            for i in range(0, count):
                self.dot()
                total += file.write(data)
        print("\nWrote: ", total)
        return 0
66012
def _do_batched_write_command(
        namespace, operation, command, docs, check_keys, opts, ctx):
    """"""
    if ctx.sock_info.compression_context:
        return _batched_write_command_compressed(
            namespace, operation, command, docs, check_keys, opts, ctx)
    return _batched_write_command(
        namespace, operation, command, docs, check_keys, opts, ctx)
393996
def write_eof(self):
        
        self._check_writable()
        self._transport._can_write.wait()
        self._transport.write_eof()
227250
def _make_subvolume(self, **args):
        """"""

        from imagemounter.volume import Volume
        v = Volume(disk=self.disk, parent=self.parent,
                   volume_detector=self.volume_detector,
                   **args)  # vstype is not passed down, let it decide for itself.
        self.volumes.append(v)
        return v
186486
def should_copy(column):
    
    if not isinstance(column.type, Serial):
        return True

    if column.nullable:
        return True

    if not column.server_default:
        return True

    # do not create temporary serial values; they will be defaulted on upsert/insert
    return False
569288
function copyToOut(src, out, multiFileMode) {
    try {
        fs.copySync(src, out);
        fs.statSync(out)
        return out;
    } catch (err) {
    }
}
7975
function copy(source, destination, callback) {
  cp(source, destination, {overwrite: true}, function done(err) {
    if (err) callback(err)
    else callback()
  })
}
406225
def _write_object(self, path, value):
    ''''''
    ensure_directory_exists(os.path.dirname(path))

    with open(path, 'w') as f:
      f.write(value)
692241
private void blockFaultLogWriteStatus(SettableFuture<Boolean> written) {
        boolean logWritten = false;

        if (written != null) {
            try {
                logWritten = written.get();
            } catch (InterruptedException e) {
            } catch (ExecutionException e) {
                if (tmLog.isDebugEnabled()) {
                    tmLog.debug("Could not determine fault log state for partition: " + m_partitionId, e);
                }
            }
            if (!logWritten) {
                tmLog.warn("Attempted fault log not written for partition: " + m_partitionId);
            }
        }
    }
313694
def check_output(cmd):
    """"""
    popen = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
    out = popen.communicate()[0].strip()
    if not isinstance(out, str):
        out = out.decode(sys.stdout.encoding)
    return out
6809
def cli(env, volume_id, snapshot_id):
    """"""
    block_manager = SoftLayer.BlockStorageManager(env.client)
    success = block_manager.restore_from_snapshot(volume_id, snapshot_id)

    if success:
        click.echo('Block volume %s is being restored using snapshot %s'
                   % (volume_id, snapshot_id))