# Where is BUS_ALLOC_RESOURCE defined!



## FestusHagen (Nov 15, 2011)

Hi all,

Been grep'n source, searching the web, created a ctags of the complete src tree, yet I still cannot find the definition of the macro BUS_ALLOC_RESOURCE.

Where is it please ?

Thanks

One would think the source file name would be indicated in the functions man page!

-Enjoy
fh : )_~


----------



## DutchDaemon (Nov 16, 2011)

You don't mean sys/sys/bus.h?


----------



## FestusHagen (Nov 16, 2011)

First place I looked.

This is what I'm looking for (highlighted in red):
From: kern/subr_bus.c

```
/**
 * @brief Wrapper function for BUS_ALLOC_RESOURCE().
 *
 * This function simply calls the BUS_ALLOC_RESOURCE() method of the
 * parent of @p dev.
 */
struct resource *
bus_alloc_resource(device_t dev, int type, int *rid, u_long start, u_long end,
    u_long count, u_int flags)
{
	if (dev->parent == NULL)
		return (NULL);
	return ([color="Red"]BUS_ALLOC_RESOURCE[/color](dev->parent, dev, type, rid, start, end,
	    count, flags));
}
```

Thanks

-Enjoy
fh : )_~


----------



## PseudoCylon (Nov 18, 2011)

/usr/obj/usr/src/sys/_YOUR_KERNCONF_NAME_/bus_if.h

The file is generated at compile time. You need to compile kernel otherwise there isn't such dir.

awk(1) (uses a script file make???.awk I don't remember) reads corresponding *.m files in /usr/src/sys/kern/, in this case reads /usr/src/sys/kern/bus_if.m and makes the file.


----------



## FestusHagen (Nov 18, 2011)

PseudoCylon said:
			
		

> /usr/obj/usr/src/sys/_YOUR_KERNCONF_NAME_/bus_if.h
> 
> The file is generated at compile time. You need to compile kernel otherwise there isn't such dir.
> 
> awk(1) (uses a script file make???.awk I don't remember) reads corresponding *.m files in /usr/src/sys/kern/, in this case reads /usr/src/sys/kern/bus_if.m and makes the file.



Much Thanks!

I was reading over the Kobj last night and figured this out, what an amazing obfuscation!

-Enjoy
fh : )_~


----------

