ted
ted

Reputation: 4985

Knowing where op structs are filled

I am currently trying to write a linux driver and for this it is necessary that I understand some apis to make best use of them. Often I come across a pattern where I start digging into a funciton and end up at a point where the function reads:

returnType OperationX(args...) {
    ...
    struct operations_t operations = get_operations();
    if(operations->X)
        return operations->X(args...)

}

Basically get_operations() returns a pointer to a global struct, which holds a pointer to the actual function running the operation.

I find it very tedious using the linux cross reference to dig into the different places and then actually understand which assignement actually takes place. Is there a better faster way?

AN example would be dma mapping.

Upvotes: 1

Views: 61

Answers (1)

0andriy
0andriy

Reputation: 4674

git grep and cscope are your best friends.

By the way, DMA operations are filled either by platform code or in IOMMU implementations. I bet most probably you have lib/swiotlb.c in use for that.

Upvotes: 1

Related Questions