Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/arch/atari/stand/installboot



christos@ wrote:

> How about this then,
 :
> -static u_int	abcksum(void *);
> +static void	abcksum(void *);

Changing existing functions requires more tests and
it's annoying for maintainers, especially for netbsd-7.

Please don't assume we have unlimited resources and
remember that we need just temporary workaround until
we get atari support in MI installboot.

> -	newroot->ar_checksum = 0;
> -	newroot->ar_checksum = 0x1234 - abcksum(newroot);
> +	abcksum(newroot);

Did you check the definition of the struct ahdi_root?
ar_checksum is properly defined as u_int16_t and
no change is required in the mkahdiboot() function.

Actually I don't know about atari specific "AHDI label" at all
so it's also annyoing for me to test it.

> -static u_int
> -abcksum (void *bs)
> +static void
> +abcksum(void *bs)
>  {
>  	u_int16_t sum  = 0,
>  		  *st  = (u_int16_t *)bs,
> -		  *end = (u_int16_t *)bs + 256;
> +		  *end = (u_int16_t *)bs + 255;
>  
>  	while (st < end)
>  		sum += *st++;
> -	return(sum);
> +	*st++ = 0x1234 - sum;

You should also consider about current MI dkcksum() (and dkcksum_sized())
implementation in sys/kern/subr_disk.c.  The MI dkcksum() just does
calculate a sum of the label and magic numbers are handled by callers:
>> 	label->d_checksum = 0;
>> 	label->d_checksum = dkcksum(label);

It looks better to use consistent strategies for both MI/MD sums.

---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index