/* Fixup an Apple bug where they have bogus \0 chars in the * middle of the path in some properties */ for (p = namep, ep = namep + l; p < ep; p++) if (*p == '\0') { memmove(p, p+1, ep - p); ep--; l--; } 
static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start,					unsigned long *mem_end){	int l, align;	phandle child;	char *namep, *prev_name, *sstart;	unsigned long soff;	unsigned char *valp;	unsigned long offset = reloc_offset();	char pname[MAX_PROPERTY_NAME];	char *path;	path = RELOC(prom_scratch);	dt_push_token(OF_DT_BEGIN_NODE, mem_start, mem_end);	/* get the node's full name */	namep = (char *)*mem_start;	l = call_prom("package-to-path", 3, 1, node,		      namep, *mem_end - *mem_start);	if (l >= 0) {		/* Didn't fit?  Get more room. */		if (l+1 > *mem_end - *mem_start) {			namep = make_room(mem_start, mem_end, l+1, 1);			call_prom("package-to-path", 3, 1, node, namep, l);		}		namep[l] = '\0';		*mem_start = _ALIGN(((unsigned long) namep) + strlen(namep) + 1, 4);	}	/* get it again for debugging */	memset(path, 0, PROM_SCRATCH_SIZE);	call_prom("package-to-path", 3, 1, node, path, PROM_SCRATCH_SIZE-1);	/* get and store all properties */	prev_name = RELOC("");	sstart = (char *)RELOC(dt_string_start);	for (;;) {		if (call_prom("nextprop", 3, 1, node, prev_name, pname) <= 0)			break;		/* find string offset */		soff = dt_find_string(pname);		if (soff == 0) {			prom_printf("WARNING: Can't find string index for <%s>, node %s\n",				    pname, path);			break;		}		prev_name = sstart + soff;		/* get length */		l = call_prom("getproplen", 2, 1, node, pname);		/* sanity checks */		if (l < 0)			continue;		if (l > MAX_PROPERTY_LENGTH) {			prom_printf("WARNING: ignoring large property ");			/* It seems OF doesn't null-terminate the path :-( */			prom_printf("[%s] ", path);			prom_printf("%s length 0x%x\n", pname, l);			continue;		}		/* push property head */		dt_push_token(OF_DT_PROP, mem_start, mem_end);		dt_push_token(l, mem_start, mem_end);		dt_push_token(soff, mem_start, mem_end);		/* push property content */		align = (l >= 8) ? 8 : 4;		valp = make_room(mem_start, mem_end, l, align);		call_prom("getprop", 4, 1, node, pname, valp, l);		*mem_start = _ALIGN(*mem_start, 4);	}	/* Add a "linux,phandle" property. */	soff = dt_find_string(RELOC("linux,phandle"));	if (soff == 0)		prom_printf("WARNING: Can't find string index for <linux-phandle>"			    " node %s\n", path);	else {		dt_push_token(OF_DT_PROP, mem_start, mem_end);		dt_push_token(4, mem_start, mem_end);		dt_push_token(soff, mem_start, mem_end);		valp = make_room(mem_start, mem_end, 4, 4);		*(u32 *)valp = node;	}	/* do all our children */	child = call_prom("child", 1, 1, node);	while (child != (phandle)0) {		scan_dt_build_struct(child, mem_start, mem_end);		child = call_prom("peer", 1, 1, child);	}	dt_push_token(OF_DT_END_NODE, mem_start, mem_end);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/44e4665cc9d856d15f04a012c78e4ab48f71290b/prom_init.c/clean/arch/ppc64/kernel/prom_init.c