2001-02-07 00:17:24

by Richard A Nelson

[permalink] [raw]
Subject: Device driver port from 2.2 to 2.4

I'm porting a device driver from 2.2 to 2.4 and have run across one
spot that I'm just not sure how to handle... 'Twould help if I new
either(or both) the driver or kernel internals better ;-}

It overrides the vm_operations_struct nopage function to share a trace
buffer between user and driver.

in the nopage function, there is this:
offset = address - vma->vm_start + vma->vm_offset;
newPtr = ( (void *)devExt->Trace + offset );
atomic_inc(&mem_map[ MAP_NR(newPtr) ].count ); // increment usage count

now, it looks like this might map to:
atomic_inc(virt_to_page(newPtr).count );

But I'd like to be sure I'm not missing something... I already feel
like something is amiss in that I can't find any corresponding
decrements !!

--
Rick Nelson
Life'll kill ya -- Warren Zevon
Then you'll be dead -- Life'll kill ya