diff options
Diffstat (limited to 'qarsh_packet.c')
-rw-r--r-- | qarsh_packet.c | 59 |
1 files changed, 28 insertions, 31 deletions
diff --git a/qarsh_packet.c b/qarsh_packet.c index eb4eac0..269675f 100644 --- a/qarsh_packet.c +++ b/qarsh_packet.c @@ -305,7 +305,6 @@ void parse_qp_recvfile(char *buf, int *buflen, struct qa_packet *qp) { buf = fetch_string(buf, buflen, &(qp->qp_recvfile.qp_path)); - buf = fetch_int(buf, buflen, &(qp->qp_recvfile.qp_if_port)); buf = fetch_off_t(buf, buflen, &(qp->qp_recvfile.qp_count)); buf = fetch_int(buf, buflen, (int *)&(qp->qp_recvfile.qp_mode)); } @@ -314,7 +313,7 @@ void parse_qp_sendfile(char *buf, int *buflen, struct qa_packet *qp) { buf = fetch_string(buf, buflen, &(qp->qp_sendfile.qp_path)); - buf = fetch_int(buf, buflen, &(qp->qp_sendfile.qp_of_port)); + buf = fetch_int(buf, buflen, &(qp->qp_sendfile.qp_remfd)); } void @@ -467,7 +466,6 @@ char * store_qp_recvfile(char *buf, struct qa_packet *qp) { buf = store_string(buf, qp->qp_recvfile.qp_path); - buf = store_int(buf, qp->qp_recvfile.qp_if_port); buf = store_off_t(buf, qp->qp_recvfile.qp_count); buf = store_int(buf, qp->qp_recvfile.qp_mode); return buf; @@ -477,7 +475,7 @@ char * store_qp_sendfile(char *buf, struct qa_packet *qp) { buf = store_string(buf, qp->qp_sendfile.qp_path); - buf = store_int(buf, qp->qp_sendfile.qp_of_port); + buf = store_int(buf, qp->qp_sendfile.qp_remfd); return buf; } @@ -631,7 +629,7 @@ make_qp_kill(int sig) } struct qa_packet * -make_qp_recvfile(const char *path, int if_port, off_t count, mode_t mode) +make_qp_recvfile(const char *path, off_t count, mode_t mode) { struct qa_packet *qp; qp = malloc(sizeof *qp); @@ -640,7 +638,6 @@ make_qp_recvfile(const char *path, int if_port, off_t count, mode_t mode) qp->qp_type = QP_RECVFILE; qp->qp_recvfile.qp_path = strdup(path); - qp->qp_recvfile.qp_if_port = if_port; qp->qp_recvfile.qp_count = count; qp->qp_recvfile.qp_mode = mode; @@ -648,7 +645,7 @@ make_qp_recvfile(const char *path, int if_port, off_t count, mode_t mode) } struct qa_packet * -make_qp_sendfile(const char *path, int of_port) +make_qp_sendfile(const char *path, int remfd) { struct qa_packet *qp; qp = malloc(sizeof *qp); @@ -657,7 +654,7 @@ make_qp_sendfile(const char *path, int of_port) qp->qp_type = QP_SENDFILE; qp->qp_sendfile.qp_path = strdup(path); - qp->qp_sendfile.qp_of_port = of_port; + qp->qp_sendfile.qp_remfd = remfd; return qp; } @@ -773,85 +770,85 @@ qpfree(struct qa_packet *qp) void dump_qp_ack(struct qa_packet *qp) { - fprintf(stderr, "\t%s #%d\n", QP_NAME(qp->qp_ack.qp_ack_type), + fprintf(stderr, "%s #%d", QP_NAME(qp->qp_ack.qp_ack_type), qp->qp_ack.qp_ack_seq); } void dump_qp_runcmd(struct qa_packet *qp) { - fprintf(stderr, "\tcmdline: %s\n", qp->qp_runcmd.qp_cmdline); + fprintf(stderr, "cmdline: %s", qp->qp_runcmd.qp_cmdline); } void dump_qp_returncode(struct qa_packet *qp) { - fprintf(stderr, "\trc: %d\n", qp->qp_returncode.qp_rc); + fprintf(stderr, "rc: %d", qp->qp_returncode.qp_rc); } void dump_qp_cmdexit(struct qa_packet *qp) { if (WIFEXITED(qp->qp_cmdexit.qp_status)) { - fprintf(stderr, "\texited: %d\n", WEXITSTATUS(qp->qp_cmdexit.qp_status)); + fprintf(stderr, "exited: %d", WEXITSTATUS(qp->qp_cmdexit.qp_status)); } else if (WIFSIGNALED(qp->qp_cmdexit.qp_status)) { - fprintf(stderr, "\tsignaled: %d\n", WTERMSIG(qp->qp_cmdexit.qp_status)); + fprintf(stderr, "signaled: %d", WTERMSIG(qp->qp_cmdexit.qp_status)); } else { - fprintf(stderr, "\tstatus: %d\n", qp->qp_cmdexit.qp_status); + fprintf(stderr, "status: %d", qp->qp_cmdexit.qp_status); } } void dump_qp_setuser(struct qa_packet *qp) { - fprintf(stderr, "\tuser: %s\n", qp->qp_setuser.qp_user); - fprintf(stderr, "\tgroup: %s\n", qp->qp_setuser.qp_group); + fprintf(stderr, "user: %s group: %s", + qp->qp_setuser.qp_user, qp->qp_setuser.qp_group); } void dump_qp_kill(struct qa_packet *qp) { - fprintf(stderr, "\tsig: %d\n", qp->qp_kill.qp_sig); + fprintf(stderr, "sig: %d", qp->qp_kill.qp_sig); } void dump_qp_recvfile(struct qa_packet *qp) { - fprintf(stderr, "\tpath: %s\n", qp->qp_recvfile.qp_path); - fprintf(stderr, "\tmode: %o\n", qp->qp_recvfile.qp_mode); - fprintf(stderr, "\tcount: %lld\n", (long long int)qp->qp_recvfile.qp_count); + fprintf(stderr, "path: %s mode: %o count: %lld", + qp->qp_recvfile.qp_path, qp->qp_recvfile.qp_mode, + (long long int)qp->qp_recvfile.qp_count); } void dump_qp_sendfile(struct qa_packet *qp) { - fprintf(stderr, "\tpath: %s\n", qp->qp_sendfile.qp_path); - fprintf(stderr, "\tremfd: %d\n", qp->qp_sendfile.qp_remfd); + fprintf(stderr, "path: %s remfd: %d", + qp->qp_sendfile.qp_path, qp->qp_sendfile.qp_remfd); } void dump_qp_rstat(struct qa_packet *qp) { - fprintf(stderr, "\tpath: %s\n", qp->qp_rstat.qp_path); - fprintf(stderr, "\tst_mode: %o\n", qp->qp_rstat.qp_st_mode); - fprintf(stderr, "\tst_uid: %d\n", qp->qp_rstat.qp_st_uid); - fprintf(stderr, "\tst_gid: %d\n", qp->qp_rstat.qp_st_gid); - fprintf(stderr, "\tst_size: %lld\n", (long long int)qp->qp_rstat.qp_st_size); + fprintf(stderr, "path: %s st_mode: %o st_uid: %d st_gid: %d st_size: %lld", + qp->qp_rstat.qp_path, qp->qp_rstat.qp_st_mode, + qp->qp_rstat.qp_st_uid, qp->qp_rstat.qp_st_gid, + (long long int)qp->qp_rstat.qp_st_size); } void dump_qp_data(struct qa_packet *qp) { - fprintf(stderr, "\tremfd: %d\n", qp->qp_data.qp_remfd); - fprintf(stderr, "\toffset: %lld\n", (long long int)qp->qp_data.qp_offset); - fprintf(stderr, "\tcount: %d\n", qp->qp_data.qp_count); + fprintf(stderr, "remfd: %d offset: %lld count: %d", + qp->qp_data.qp_remfd, (long long int)qp->qp_data.qp_offset, qp->qp_data.qp_count); } void dump_qp(struct qa_packet *qp) { - fprintf(stderr, "%s #%d\n", QP_NAME(qp->qp_type), qp->qp_seq); + fprintf(stderr, "#%d %s ", qp->qp_seq, QP_NAME(qp->qp_type)); if (qa_pi[qp->qp_type].pi_dump) { qa_pi[qp->qp_type].pi_dump(qp); } + fprintf(stderr, "\n"); + fflush(stderr); } |