1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Where is BUS_ALLOC_RESOURCE defined!

Discussion in 'FreeBSD Development' started by FestusHagen, Nov 15, 2011.

  1. FestusHagen

    FestusHagen New Member

    Messages:
    64
    Likes Received:
    0
    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 : )_~
     
  2. DutchDaemon

    DutchDaemon Administrator Staff Member Administrator Moderator

    Messages:
    10,672
    Likes Received:
    26
    You don't mean sys/sys/bus.h?
     
  3. FestusHagen

    FestusHagen New Member

    Messages:
    64
    Likes Received:
    0
    First place I looked.

    This is what I'm looking for (highlighted in red):
    From: kern/subr_bus.c
    Code:
    /**
     * @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 : )_~
     
  4. PseudoCylon

    PseudoCylon New Member

    Messages:
    151
    Likes Received:
    0
    /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.
     
  5. FestusHagen

    FestusHagen New Member

    Messages:
    64
    Likes Received:
    0
    Much Thanks!

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

    -Enjoy
    fh : )_~