/* * get_write_buffer * * a wrapper to tlm_get_write_buffer so that * we can cleanly detect ABORT commands * without involving the TLM library with * our problems. */ static char * get_write_buffer(long size, long *actual_size, boolean_t zero, tlm_cmd_t *local_commands) { while (local_commands->tc_reader == TLM_BACKUP_RUN) { char *rec = tlm_get_write_buffer(size, actual_size, local_commands->tc_buffers, zero); if (rec != 0) { return (rec); } } return (NULL); }
/* * ndmp_write_utf8magic * * Write a magic pattern to the tar header. This is used * as a crest to indicate that tape belongs to us. */ int ndmp_write_utf8magic(tlm_cmd_t *cmd) { char *cp; long actual_size; if (cmd->tc_buffers == NULL) { NDMP_LOG(LOG_DEBUG, "cmd->tc_buffers == NULL"); return (-1); } cp = tlm_get_write_buffer(RECORDSIZE, &actual_size, cmd->tc_buffers, TRUE); if (actual_size < RECORDSIZE) { NDMP_LOG(LOG_DEBUG, "Couldn't get enough buffer"); return (-1); } (void) strlcpy(cp, NDMPUTF8MAGIC, RECORDSIZE); return (0); }