Re: [Yaffs] Makefile.kernel in git misses yaffs_nameval.o?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Charles Manning
Date:  
To: yaffs
Subject: Re: [Yaffs] Makefile.kernel in git misses yaffs_nameval.o?
On Wednesday 09 June 2010 23:44:23 wrote:

> Now the kernel compiles. Why is it necessary to add this to the
> Makefile, is it my weird configuration?


This is my fault.

I added a new file to the build. I checked out-of-tree building but not
in-tree building.


>
> Side note: The Montavista version of 2.6.18 didn't know file->f_path,
> so I added a kernel version check in yaffs_fs.c, yaffs_dir_llseek(),
> "case 2"


>
> static loff_t yaffs_dir_llseek(struct file *file, loff_t offset, int
> origin) {
>     long long retval;

>
>     lock_kernel();

>
>     switch (origin){
>     case 2:
>         #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
>             offset += i_size_read(file->f_dentry->d_inode);
>         #else
>             offset += i_size_read(file->f_path.dentry->d_inode);
>         #endif
>         break;

>
> I'm not completely sure if f_path was really introduced in 2.6.20, but
> found this in a similar workaround floating in the net.


The changing interfaces make it challenging to keep the multi-version
compilation working. This is made far more difficult with revisions and
backports because there are no indicators that can be used to distinguish
between the various sub-sub versions.

Sometimes you just have to adjust things to work properly...

>
> Last comment: "freeze.h" and therefore "set_freezable()" were also
> unknown in Montavista's 2.6.18. Here I'm not so sure, if my workaround
> has unwanted side effects. I added a check for
> CONFIG_YAFFS_DISABLE_BACKGROUND in yaffs_fs.c, line 36.
>
> #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10))
> #define YAFFS_COMPILE_BACKGROUND
> #if CONFIG_YAFFS_DISABLE_BACKGROUND
> #undef YAFFS_COMPILE_BACKGROUND
> #endif
> #endif
>
> But is the kernel configuration option
> "CONFIG_YAFFS_DISABLE_BACKGROUND" really the negated
> "YAFFS_COMPILE_BACKGROUND"? Why do then two different variables exist?
> Would be nice, if you could comment on this one.


The reason for having two variables is that it allows us to build the feature
in or not and also allows us to control the feature at run-time (eg. via a
mount option).

Compile time feature selection is typically based on kernel version. ie. if a
version supports kthreads then it is compiled in. It is far easier to
understand and tweak:

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10))
#define YAFFS_COMPILE_BACKGROUND
#endif

#ifdef YAFFS_COMPILE_BACKGROUND
...
#endif

#ifdef YAFFS_COMPILE_BACKGROUND
...
#endif

than

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10))
...
#endif

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10))
....
#endif

I would recommend keeping the background threads and just clobbering the
freezable stuff since background processing has some performance advantages.

I'll look at neatening this up.


-- Charles