david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

Use autocolourisation

This commit is contained in:
Michael Brown 2006-12-29 14:09:23 +00:00
parent feb4f65d1e
commit 83e1340d88
1 changed files with 13 additions and 10 deletions

View File

@ -75,7 +75,7 @@ static inline struct ftp_request * tcp_to_ftp ( struct tcp_application *app ) {
*/ */
static void ftp_done ( struct ftp_request *ftp, int rc ) { static void ftp_done ( struct ftp_request *ftp, int rc ) {
DBG ( "FTP %p completed with status %d\n", ftp, rc ); DBGC ( ftp, "FTP %p completed with status %d\n", ftp, rc );
/* Close both TCP connections */ /* Close both TCP connections */
tcp_close ( &ftp->tcp ); tcp_close ( &ftp->tcp );
@ -118,7 +118,7 @@ static void ftp_parse_value ( char **text, uint8_t *value, size_t len ) {
static void ftp_reply ( struct ftp_request *ftp ) { static void ftp_reply ( struct ftp_request *ftp ) {
char status_major = ftp->status_text[0]; char status_major = ftp->status_text[0];
DBG ( "FTP %p received status %s\n", ftp, ftp->status_text ); DBGC ( ftp, "FTP %p received status %s\n", ftp, ftp->status_text );
/* Ignore "intermediate" responses (1xx codes) */ /* Ignore "intermediate" responses (1xx codes) */
if ( status_major == '1' ) if ( status_major == '1' )
@ -149,8 +149,8 @@ static void ftp_reply ( struct ftp_request *ftp ) {
ftp_parse_value ( &ptr, ( uint8_t * ) &sa.sin.sin_port, ftp_parse_value ( &ptr, ( uint8_t * ) &sa.sin.sin_port,
sizeof ( sa.sin.sin_port ) ); sizeof ( sa.sin.sin_port ) );
if ( ( rc = tcp_connect ( &ftp->tcp_data, &sa.st, 0 ) ) != 0 ){ if ( ( rc = tcp_connect ( &ftp->tcp_data, &sa.st, 0 ) ) != 0 ){
DBG ( "FTP %p could not create data connection\n", DBGC ( ftp, "FTP %p could not make data connection\n",
ftp ); ftp );
ftp_done ( ftp, rc ); ftp_done ( ftp, rc );
return; return;
} }
@ -162,9 +162,10 @@ static void ftp_reply ( struct ftp_request *ftp ) {
ftp->already_sent = 0; ftp->already_sent = 0;
if ( ftp->state < FTP_DONE ) { if ( ftp->state < FTP_DONE ) {
DBG ( "FTP %p sending ", ftp ); const struct ftp_string *string = &ftp_strings[ftp->state];
DBG ( ftp_strings[ftp->state].format, ftp_string_data ( ftp, DBGC ( ftp, "FTP %p sending ", ftp );
ftp_strings[ftp->state].data_offset ) ); DBGC ( ftp, string->format,
ftp_string_data ( ftp, string->data_offset ) );
} }
return; return;
@ -270,7 +271,8 @@ static void ftp_senddata ( struct tcp_application *app,
static void ftp_closed ( struct tcp_application *app, int status ) { static void ftp_closed ( struct tcp_application *app, int status ) {
struct ftp_request *ftp = tcp_to_ftp ( app ); struct ftp_request *ftp = tcp_to_ftp ( app );
DBG ( "FTP %p control connection closed (status %d)\n", ftp, status ); DBGC ( ftp, "FTP %p control connection closed (status %d)\n",
ftp, status );
/* Complete FTP operation */ /* Complete FTP operation */
ftp_done ( ftp, status ); ftp_done ( ftp, status );
@ -315,7 +317,8 @@ tcp_to_ftp_data ( struct tcp_application *app ) {
static void ftp_data_closed ( struct tcp_application *app, int status ) { static void ftp_data_closed ( struct tcp_application *app, int status ) {
struct ftp_request *ftp = tcp_to_ftp_data ( app ); struct ftp_request *ftp = tcp_to_ftp_data ( app );
DBG ( "FTP %p data connection closed (status %d)\n", ftp, status ); DBGC ( ftp, "FTP %p data connection closed (status %d)\n",
ftp, status );
/* If there was an error, close control channel and record status */ /* If there was an error, close control channel and record status */
if ( status ) if ( status )
@ -358,7 +361,7 @@ static struct tcp_operations ftp_data_tcp_operations = {
struct async_operation * ftp_get ( struct ftp_request *ftp ) { struct async_operation * ftp_get ( struct ftp_request *ftp ) {
int rc; int rc;
DBG ( "FTP %p fetching %s\n", ftp, ftp->filename ); DBGC ( ftp, "FTP %p fetching %s\n", ftp, ftp->filename );
ftp->tcp.tcp_op = &ftp_tcp_operations; ftp->tcp.tcp_op = &ftp_tcp_operations;
ftp->tcp_data.tcp_op = &ftp_data_tcp_operations; ftp->tcp_data.tcp_op = &ftp_data_tcp_operations;