[RFC] [PATCH take 2] JFFS2: use MTD_OOB_AUTO

Kyungmin Park kmpark at infradead.org
Thu Feb 1 21:17:57 EST 2007


 

>  
> -#define NR_OOB_SCAN_PAGES	4
> +#define NR_OOB_SCAN_PAGES 4
> +
> +/* For historical reasons we use only 12 bytes for OOB clean 
> marker */ 
> +#define OOB_CM_SIZE 12
> +
> +static struct jffs2_unknown_node oob_cleanmarker = {
> +	.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK),
> +	.nodetype = cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER),
> +	.totlen = cpu_to_je32(8)
> +};

Looks good, how about make it const?

-
> -	n.magic = cpu_to_je16 (JFFS2_MAGIC_BITMASK);
> -	n.nodetype = cpu_to_je16 (JFFS2_NODETYPE_CLEANMARKER);
> -	n.totlen = cpu_to_je32 (8);
> -	p = (unsigned char *) &n;
> -	b = c->oobbuf + c->fsdata_pos;
> +	p = (unsigned char *)&oob_cleanmarker;
> +	b = c->oobbuf;
>  
> -	for (i = c->fsdata_len; i; i--) {
> -		if (*b++ != *p++)
> +	for (i = 0; i < cmlen; i++)
> +		if (*b++ != *p++) {
>  			ret = 1;
> -	}
> +			break;
> +		}

Why we compare it with character pointer? just use memcmp

if (memcmp(p, b, cmlen))
	ret = 1;

Are there any reasons?

Thank you,
Kyungmin Park





More information about the linux-mtd mailing list