Home | History | Annotate | Download | only in dd

Lines Matching refs:out

32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
77 IO in, out; /* input/output state */
199 if (out.name == NULL) {
201 out.fd = STDOUT_FILENO;
202 out.name = "stdout";
203 out.ops = &ddfops_stdfd;
205 out.ops = prog_ops;
221 out.fd = ddop_open(out, out.name, O_RDWR | OFLAGS, DEFFILEMODE);
227 if (out.fd < 0) {
228 out.fd = ddop_open(out, out.name, O_WRONLY | OFLAGS,
230 out.flags |= NOREAD;
232 if (out.fd < 0) {
233 err(EXIT_FAILURE, "%s", out.name);
237 /* Ensure out.fd is outside the stdio descriptor range */
238 redup_clean_fd(&out);
241 getfdtype(&out);
248 size_t dbsz = out.dbsz;
255 out.db = in.db;
258 (out.db = buffer_alloc((u_int)(out.dbsz + cbsz))) == NULL) {
263 out.dbp = out.db;
268 if (out.offset)
276 (void)ddop_ftruncate(out, out.fd, (off_t)out.offset * out.dbsz);
448 out.dbcnt = in.dbcnt;
481 if (ddflags & C_OSYNC && out.dbcnt < out.dbsz) {
482 (void)memset(out.dbp, 0, out.dbsz - out.dbcnt);
483 out.dbcnt = out.dbsz;
486 * to write out the final block un-sparse
488 if ((out.dbcnt == 0) && pending) {
489 memset(out.db, 0, out.dbsz);
490 out.dbcnt = out.dbsz;
491 out.dbp = out.db + out.dbcnt;
492 pending -= out.dbsz;
494 if (out.dbcnt)
504 if (out.fd == STDOUT_FILENO && ddop_fsync(out, out.fd) == -1
509 if (ddop_close(out, out.fd) == -1) {
523 * Write one or more blocks out. The common case is writing a full
538 outp = out.db;
539 for (n = force ? out.dbcnt : out.dbsz;; n = out.dbsz) {
558 if (ddop_lseek(out,
559 out.fd, pending, SEEK_CUR) == -1)
561 out.name);
563 nw = bwrite(&out, outp, cnt);
567 "%s: end of device", out.name);
570 err(EXIT_FAILURE, "%s", out.name);
576 st.sparse += pending/out.dbsz;
577 st.out_full += pending/out.dbsz;
583 if ((uint64_t)n != out.dbsz)
592 if (out.flags & ISCHR && !warned) {
594 warnx("%s: short write on character device", out.name);
596 if (out.flags & ISTAPE)
598 "%s: short write on tape device", out.name);
602 if ((out.dbcnt -= n) < out.dbsz)
607 if (out.dbcnt)
608 (void)memmove(out.db, out.dbp - out.dbcnt, out.dbcnt);
609 out.dbp = out.db + out.dbcnt;