Showing posts with label Linux-3.1 compilation errors with filesystems. Show all posts
Showing posts with label Linux-3.1 compilation errors with filesystems. Show all posts

Thursday, 12 April 2012

fsync (VFS layer) defination changes in Linux-3.1+

Problem Description: 
You might see a compilation error on your filesystem, which was successfully compiled on versions before linux-3.1.

Scenarios:
You fsync declarations is something like in Kernel older than linux3.1:
int fsync(struct file , struct dentry *, int );
New Declarations:
int fsync(struct file, loff_t, loff_t, int );



Root cause:
Kernel Header can not match the fs_ops pointers because of vfs changes.

Solution:
Try defining something like (LINUX_KERNEL_VERSION_MACRO defined as Version number):


int fsync(
  struct file                           *file,
#if       (LINUX_KERNEL_VERSION_MACRO < 3.1)
  struct dentry                         *dentry,
#else
  loff_t                                start,
  loff_t                                end,
#endif /* (
LINUX_KERNEL_VERSION_MACRO) */
  int                                    datasync);