I'd be happy to email a copy of the log file and the file from which this snippet originated. I'm hoping someone on the other end of the intelligence bathtub curve can spot the error that this nincompoop (me) can't detect.
[fyi]The system is a 16 core HP DL580 G4 with 8g RAM, RAID 0, Mandrivalinux 11.0 and the display is a Matrox Parhelia 256PCIx.[/fyi]
Yours especially
Peter :-)
BTW: please be aware there is a similar post in another message on this board but the solution seemed not to be entered into.
From the error it sounds like it returns an integer instead of a pointer.
From what I (mis)understand from the log it is making a pointer from the integer. In the followup to this post I will post the log file and the file containing the code for you.
I'm saying you should double-check, because the error suggests that it doesn't return that.
Yes pvChunk is a void*. But the error is saying you're converting an int to a void* without a cast. Which makes me think that ClientMemAlloc is returning an int, not a void* as you expect.
Either that or the value you're passing as the first parameter (dwSize + sizeof(UINT32)) is the int and the function is expecting a void* for that paramter. In which case the parameters you're passing are incorrect.
Whatever the case, it's clear that you need to find the definition of ClientMemAlloc and figure out what it returns and what parameters it takes. Because you're not using it correctly in the code you have now.
So either dig up any documentation on that function you have... or find its definition in the source code.
MtxMem.c: In function ‘memFileAlloc’:
MtxMem.c:79:5: error: too few arguments to function ‘ClientMemAlloc’
/root/matroxdriver-x86_64-cvs-20090511/kernel/src/mtx_client.h:41:30: note: declared here
which tells me 'region' is now an unknown type. BTW, the code was written by the geniuses at Matrox. The only support Suse and RH. Because I choose to use Mandriva they won't lift a finger. Makes me want to blow them a raspberry.
I took out the comma, saved and recompiled. Then I get this error along with stacks more that my 6th sense tells me is related to the two files; MtxMem.c and mtx_client.h mentioned immediately below.
MtxMem.c: In function ‘memFileAlloc’:
MtxMem.c:79:5: warning: passing argument 2 of ‘ClientMemAlloc’ makes integer from pointer without a cast [enabled by default]
mtx_client.h:41:30: note: expected ‘HREGION’ but argument is of type ‘void *’
I've tried already placing HREGION between brackets, braces et al but I keep getting the same reference back to
ClientMemAlloc
.
MtxMem.c:79 is pvChunk = ClientMemAlloc(dwSize + sizeof(UINT32), NULL); as above also. and mtx_client.h:41 is EXTERN_C STACK_LINKAGE void* ClientMemAlloc(size_t size, HREGION region); as we have been discussing.
So I have the sneaking suspicion the following relates to these two above:
mtx_drv.h: In function ‘GetPciName’:
mtx_drv.h:407:5: warning: return discards ‘const’ qualifier from pointer target type [enabled by default]
In file included from mtx_dev.c:20:0:
mtx_drv.h: In function ‘GetPciName’:
mtx_drv.h:407:5: warning: return discards ‘const’ qualifier from pointer target type [enabled by default]
In file included from mtx_ctx.c:16:0:
mtx_drv.h: In function ‘GetPciName’:
mtx_drv.h:407:5: warning: return discards ‘const’ qualifier from pointer target type [enabled by default]
In file included from mtx_mem.c:15:0:
mtx_drv.h: In function ‘GetPciName’:
mtx_drv.h:407:5: warning: return discards ‘const’ qualifier from pointer target type [enabled by default]
mtx_mem.c: In function ‘mtx_mem_alloc_agp’:
mtx_mem.c:267:5: warning: passing argument 1 of ‘agp_allocate_memory’ makes pointer from integer without a cast [enabled by default]
agp_backend.h:101:27: note: expected ‘struct agp_bridge_data *’ but argument is of type ‘ULONG’
mtx_mem.c:267:5: error: too few arguments to function ‘agp_allocate_memory’
agp_backend.h:101:27: note: declared here
Please be aware that agp_backend.h is a Linux system include file, agp_backend.h:101 externstruct agp_memory *agp_allocate_memory(struct agp_bridge_data *, size_t, u32);.
Thank you for continuing to help and bless your cottonsox.
Peter