[SLOF] [PATCH 1/9] libnet: Get rid of unused huge_load and block_size parameters

Thomas Huth thuth at redhat.com
Fri May 18 21:31:42 AEST 2018


On 18.05.2018 11:41, Greg Kurz wrote:
> On Thu, 17 May 2018 19:40:48 +0200
> Thomas Huth <thuth at redhat.com> wrote:
> 
>> The blocksize is hard-coded to 1428 bytes in obp-tftp.fs, so instead
>> of hardcoding this in the Forth code, we could also move this into
>> netload.c directly instead. A similar condition exists with the
>> huge-tftp-load parameter. While this non-standard variable could still
>> be changed in the obp-tftp package, it does not make much sense to set
>> it to zero - you only lose the possibility to do huge TFTP loads with
>> index wrap-around in that case.
>>
>> Signed-off-by: Thomas Huth <thuth at redhat.com>
>> ---
>>  lib/libnet/libnet.code       |  4 +---
>>  lib/libnet/netapps.h         |  3 +--
>>  lib/libnet/netload.c         | 11 ++++-------
>>  slof/fs/packages/obp-tftp.fs |  3 ---
>>  4 files changed, 6 insertions(+), 15 deletions(-)
>>
>> diff --git a/lib/libnet/libnet.code b/lib/libnet/libnet.code
>> index 2746782..419419d 100644
>> --- a/lib/libnet/libnet.code
>> +++ b/lib/libnet/libnet.code
>> @@ -4,11 +4,9 @@
>>  PRIM(NET_X2d_LOAD)
>>  	int alen = TOS.n; POP;
>>  	char *arg = TOS.a; POP;
>> -	int blocksize = TOS.n; POP;
>> -	int hugeload = TOS.n; POP;
>>  	long maxlen = TOS.n; POP;
>>  	void *loadaddr = TOS.a;
>> -	TOS.n = netload(loadaddr, maxlen, hugeload, blocksize, arg, alen);
>> +	TOS.n = netload(loadaddr, maxlen, arg, alen);
>>  MIRP
>>  
>>  PRIM(NET_X2d_PING)
>> diff --git a/lib/libnet/netapps.h b/lib/libnet/netapps.h
>> index 0e637e1..6e00466 100644
>> --- a/lib/libnet/netapps.h
>> +++ b/lib/libnet/netapps.h
>> @@ -18,8 +18,7 @@
>>  
>>  struct filename_ip;
>>  
>> -extern int netload(char *buffer, int len, int huge_load, int block_size,
>> -                   char *args_fs, int alen);
>> +extern int netload(char *buffer, int len, char *args_fs, int alen);
>>  extern int ping(char *args_fs, int alen);
>>  extern int dhcp(char *ret_buffer, struct filename_ip *fn_ip,
>>  		unsigned int retries, int flags);
>> diff --git a/lib/libnet/netload.c b/lib/libnet/netload.c
>> index 5c37fe2..6b9bc57 100644
>> --- a/lib/libnet/netload.c
>> +++ b/lib/libnet/netload.c
>> @@ -405,13 +405,12 @@ static void seed_rng(uint8_t mac[])
>>  }
>>  
>>  static int tftp_load(filename_ip_t *fnip, unsigned char *buffer, int len,
>> -		     unsigned int retries, int32_t mode,
>> -		     int32_t blksize, int ip_vers)
>> +		     unsigned int retries, int ip_vers)
>>  {
>>  	tftp_err_t tftp_err;
>>  	int rc;
>>  
>> -	rc = tftp(fnip, buffer, len, retries, &tftp_err, mode, blksize, ip_vers);
>> +	rc = tftp(fnip, buffer, len, retries, &tftp_err, 1, 1428, ip_vers);
> 
> This is the only call site for tftp(). Why not going further and ditch these
> parameters as well ? This would simplify the tftp() code.

True, I can do this when respinning the series.

 Thomas


More information about the SLOF mailing list