lkml.org 
[lkml]   [2004]   [Jan]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Dri-devel] 2.6 kernel change in nopage


On Thu, 1 Jan 2004, Michel Dänzer wrote:
>
> > well the advantage is that the ifdefs can just go away in kernel trees of
> > specific versions... (eg unifdef it)
>
> Does this look better? Maybe a macro (or a typedef?) for the type of the
> last argument would still be a good idea? Or is there yet a better way?

My preference is either:

- we can still undo the "nopage" argument change. It's been in the -mm
tree for a long time, and it _does_ solve a problem (page fault type
accounting), but the problem it solves is potentially so small that we
might decide it's ok for 2.6.x.

However, Andrew is king, and besides, it does fix a tiny bug, so I
don't think this is what we should do. I just wanted to put it on the
table as a possibility.

- Use separate (and trivial) wrapper functions for this. Keep the "real"
function the same across everything, and just have a _static_ function
(ie no header file declaration crap) that does
linux-new-vm.h:

static int DRM(nopage_interface)(struct vm_area_struct * area,
unsigned long address,
int *type)
{
*type = VM_FAULT_MINOR;
DRM(nopage)(area, address);
}

linux-old-vm.h:

static int DRM(nopage_interface)(struct vm_area_struct * area,
unsigned long address,
int unused)
{
DRM(nopage)(area, address);
}

drm_vm.h:

/*
* Or, poreferably, we could create a symlink and avoid
* the #if's at compile-time _entirely_.
*/
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
#include "linux-new-vm.h"
#else
#include "linux-old-v.h
#endif
..
.nopage = nopage_interface;
..

Done right, the virtualization could be a bit higher still, and maybe
the BSD code can do the same thing.

In general, at least I personally _much_ prefer the #ifdef's etc to be
outside the code. So even if you don't like to have separate small files
for different architectures/ports/versions, I'd at least personally
much rather have

#if xxxx
int onewholefunction(..)
...


#else

int onewholefunction(..)
...

#endif

rather than the messy

int onewholefunction(
#if xxx
..
#else
..
#endif
(
{
...
#if xxxx
..
#endif
The latter is a huge pain not just to read (you go blind after a while),
but it's also painful as _hell_ to merge anywhere else.

In contrast, full-file interfaces for different kernel versions are a
_lot_ easier to merge and keep track of. They may look like "duplication",
but the advantages are legion. You don't mix different OS's and different
versions together, and that makes it much easier to support them all
without going crazy.

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2009-11-18 23:46    [from the cache]
©2003-2011 Jasper Spaans