From 48abdc31fd63fb013c131c09bed3a3ef9a230939 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 23 Aug 1999 14:58:16 +0000 Subject: Patch from Eric Norum to readd the behavior where the minor number indicated the port number to try. --- c/src/exec/libnetworking/lib/tftpDriver.c | 36 ++++++------------------------- c/src/lib/libnetworking/lib/tftpDriver.c | 36 ++++++------------------------- c/src/libnetworking/lib/tftpDriver.c | 36 ++++++------------------------- cpukit/libnetworking/lib/tftpDriver.c | 36 ++++++------------------------- 4 files changed, 24 insertions(+), 120 deletions(-) diff --git a/c/src/exec/libnetworking/lib/tftpDriver.c b/c/src/exec/libnetworking/lib/tftpDriver.c index f91b89927f..8e96c8d4a9 100644 --- a/c/src/exec/libnetworking/lib/tftpDriver.c +++ b/c/src/exec/libnetworking/lib/tftpDriver.c @@ -519,20 +519,13 @@ int rtems_tftp_open( int try = (now + retryCount) % 10; tp->myAddress.sin_family = AF_INET; - /* - * XXX Eric .. how do we get the minor information??? - * tp->myAddress.sin_port = htons (UDP_PORT_BASE + nStreams * try + minor); - */ - tp->myAddress.sin_port = htons (UDP_PORT_BASE + nStreams * try); + tp->myAddress.sin_port = htons (UDP_PORT_BASE + nStreams * try + s); tp->myAddress.sin_addr.s_addr = htonl (INADDR_ANY); if (bind (tp->socket, (struct sockaddr *)&tp->myAddress, sizeof tp->myAddress) >= 0) break; if (++retryCount == 10) { close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - releaseStream (minor); - */ + releaseStream (s); return EBUSY; } } @@ -554,10 +547,6 @@ int rtems_tftp_open( * Create the request */ tp->pkbuf.tftpRWRQ.opcode = htons (TFTP_OPCODE_RRQ); - /* - * XXX Eric .. is this cast taking the const off right? - */ - cp1 = (char *) tp->pkbuf.tftpRWRQ.filename_mode; cp2 = (char *) remoteFilename; while ((*cp1++ = *cp2++) != '\0') @@ -574,10 +563,7 @@ int rtems_tftp_open( (struct sockaddr *)&tp->farAddress, sizeof tp->farAddress) < 0) { close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - releaseStream (minor); - */ + releaseStream (s); return EIO; } @@ -595,11 +581,7 @@ int rtems_tftp_open( tp->eof = (tp->nleft < TFTP_BUFSIZE); if (sendAck (tp) != 0) { close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - releaseStream (minor); - */ - + releaseStream (s); return EIO; } break; @@ -607,10 +589,7 @@ int rtems_tftp_open( if (opcode == TFTP_OPCODE_ERROR) { tftpSetErrno (tp); close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - * releaseStream (minor); - */ + releaseStream (s); return EIO; } } @@ -620,10 +599,7 @@ int rtems_tftp_open( */ if (++retryCount >= OPEN_RETRY_LIMIT) { close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - releaseStream (minor); - */ + releaseStream (s); return EIO; } } diff --git a/c/src/lib/libnetworking/lib/tftpDriver.c b/c/src/lib/libnetworking/lib/tftpDriver.c index f91b89927f..8e96c8d4a9 100644 --- a/c/src/lib/libnetworking/lib/tftpDriver.c +++ b/c/src/lib/libnetworking/lib/tftpDriver.c @@ -519,20 +519,13 @@ int rtems_tftp_open( int try = (now + retryCount) % 10; tp->myAddress.sin_family = AF_INET; - /* - * XXX Eric .. how do we get the minor information??? - * tp->myAddress.sin_port = htons (UDP_PORT_BASE + nStreams * try + minor); - */ - tp->myAddress.sin_port = htons (UDP_PORT_BASE + nStreams * try); + tp->myAddress.sin_port = htons (UDP_PORT_BASE + nStreams * try + s); tp->myAddress.sin_addr.s_addr = htonl (INADDR_ANY); if (bind (tp->socket, (struct sockaddr *)&tp->myAddress, sizeof tp->myAddress) >= 0) break; if (++retryCount == 10) { close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - releaseStream (minor); - */ + releaseStream (s); return EBUSY; } } @@ -554,10 +547,6 @@ int rtems_tftp_open( * Create the request */ tp->pkbuf.tftpRWRQ.opcode = htons (TFTP_OPCODE_RRQ); - /* - * XXX Eric .. is this cast taking the const off right? - */ - cp1 = (char *) tp->pkbuf.tftpRWRQ.filename_mode; cp2 = (char *) remoteFilename; while ((*cp1++ = *cp2++) != '\0') @@ -574,10 +563,7 @@ int rtems_tftp_open( (struct sockaddr *)&tp->farAddress, sizeof tp->farAddress) < 0) { close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - releaseStream (minor); - */ + releaseStream (s); return EIO; } @@ -595,11 +581,7 @@ int rtems_tftp_open( tp->eof = (tp->nleft < TFTP_BUFSIZE); if (sendAck (tp) != 0) { close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - releaseStream (minor); - */ - + releaseStream (s); return EIO; } break; @@ -607,10 +589,7 @@ int rtems_tftp_open( if (opcode == TFTP_OPCODE_ERROR) { tftpSetErrno (tp); close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - * releaseStream (minor); - */ + releaseStream (s); return EIO; } } @@ -620,10 +599,7 @@ int rtems_tftp_open( */ if (++retryCount >= OPEN_RETRY_LIMIT) { close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - releaseStream (minor); - */ + releaseStream (s); return EIO; } } diff --git a/c/src/libnetworking/lib/tftpDriver.c b/c/src/libnetworking/lib/tftpDriver.c index f91b89927f..8e96c8d4a9 100644 --- a/c/src/libnetworking/lib/tftpDriver.c +++ b/c/src/libnetworking/lib/tftpDriver.c @@ -519,20 +519,13 @@ int rtems_tftp_open( int try = (now + retryCount) % 10; tp->myAddress.sin_family = AF_INET; - /* - * XXX Eric .. how do we get the minor information??? - * tp->myAddress.sin_port = htons (UDP_PORT_BASE + nStreams * try + minor); - */ - tp->myAddress.sin_port = htons (UDP_PORT_BASE + nStreams * try); + tp->myAddress.sin_port = htons (UDP_PORT_BASE + nStreams * try + s); tp->myAddress.sin_addr.s_addr = htonl (INADDR_ANY); if (bind (tp->socket, (struct sockaddr *)&tp->myAddress, sizeof tp->myAddress) >= 0) break; if (++retryCount == 10) { close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - releaseStream (minor); - */ + releaseStream (s); return EBUSY; } } @@ -554,10 +547,6 @@ int rtems_tftp_open( * Create the request */ tp->pkbuf.tftpRWRQ.opcode = htons (TFTP_OPCODE_RRQ); - /* - * XXX Eric .. is this cast taking the const off right? - */ - cp1 = (char *) tp->pkbuf.tftpRWRQ.filename_mode; cp2 = (char *) remoteFilename; while ((*cp1++ = *cp2++) != '\0') @@ -574,10 +563,7 @@ int rtems_tftp_open( (struct sockaddr *)&tp->farAddress, sizeof tp->farAddress) < 0) { close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - releaseStream (minor); - */ + releaseStream (s); return EIO; } @@ -595,11 +581,7 @@ int rtems_tftp_open( tp->eof = (tp->nleft < TFTP_BUFSIZE); if (sendAck (tp) != 0) { close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - releaseStream (minor); - */ - + releaseStream (s); return EIO; } break; @@ -607,10 +589,7 @@ int rtems_tftp_open( if (opcode == TFTP_OPCODE_ERROR) { tftpSetErrno (tp); close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - * releaseStream (minor); - */ + releaseStream (s); return EIO; } } @@ -620,10 +599,7 @@ int rtems_tftp_open( */ if (++retryCount >= OPEN_RETRY_LIMIT) { close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - releaseStream (minor); - */ + releaseStream (s); return EIO; } } diff --git a/cpukit/libnetworking/lib/tftpDriver.c b/cpukit/libnetworking/lib/tftpDriver.c index f91b89927f..8e96c8d4a9 100644 --- a/cpukit/libnetworking/lib/tftpDriver.c +++ b/cpukit/libnetworking/lib/tftpDriver.c @@ -519,20 +519,13 @@ int rtems_tftp_open( int try = (now + retryCount) % 10; tp->myAddress.sin_family = AF_INET; - /* - * XXX Eric .. how do we get the minor information??? - * tp->myAddress.sin_port = htons (UDP_PORT_BASE + nStreams * try + minor); - */ - tp->myAddress.sin_port = htons (UDP_PORT_BASE + nStreams * try); + tp->myAddress.sin_port = htons (UDP_PORT_BASE + nStreams * try + s); tp->myAddress.sin_addr.s_addr = htonl (INADDR_ANY); if (bind (tp->socket, (struct sockaddr *)&tp->myAddress, sizeof tp->myAddress) >= 0) break; if (++retryCount == 10) { close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - releaseStream (minor); - */ + releaseStream (s); return EBUSY; } } @@ -554,10 +547,6 @@ int rtems_tftp_open( * Create the request */ tp->pkbuf.tftpRWRQ.opcode = htons (TFTP_OPCODE_RRQ); - /* - * XXX Eric .. is this cast taking the const off right? - */ - cp1 = (char *) tp->pkbuf.tftpRWRQ.filename_mode; cp2 = (char *) remoteFilename; while ((*cp1++ = *cp2++) != '\0') @@ -574,10 +563,7 @@ int rtems_tftp_open( (struct sockaddr *)&tp->farAddress, sizeof tp->farAddress) < 0) { close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - releaseStream (minor); - */ + releaseStream (s); return EIO; } @@ -595,11 +581,7 @@ int rtems_tftp_open( tp->eof = (tp->nleft < TFTP_BUFSIZE); if (sendAck (tp) != 0) { close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - releaseStream (minor); - */ - + releaseStream (s); return EIO; } break; @@ -607,10 +589,7 @@ int rtems_tftp_open( if (opcode == TFTP_OPCODE_ERROR) { tftpSetErrno (tp); close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - * releaseStream (minor); - */ + releaseStream (s); return EIO; } } @@ -620,10 +599,7 @@ int rtems_tftp_open( */ if (++retryCount >= OPEN_RETRY_LIMIT) { close (tp->socket); - /* - * XXX Eric .. how do we get the minor information to release this??? - releaseStream (minor); - */ + releaseStream (s); return EIO; } } -- cgit v1.2.3