Skip to content

Instantly share code, notes, and snippets.

@leafnode
Created May 24, 2013 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leafnode/5647269 to your computer and use it in GitHub Desktop.
Save leafnode/5647269 to your computer and use it in GitHub Desktop.
--- ./compat_mm.h 2013-03-04 01:36:39.184925478 -0800
+++ ./compat_mm.h 2013-03-04 01:40:37.793728289 -0800
@@ -91,8 +91,9 @@
/*
* In 2.4.10, vmtruncate was changed from returning void to returning int.
+ * In 3.8.0, vmtruncate was removed
*/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 10)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
#define compat_vmtruncate(inode, size) \
({ \
int result = 0; \
@@ -100,7 +101,16 @@
result; \
})
#else
-#define compat_vmtruncate(inode, size) vmtruncate(inode, size)
+#define compat_vmtruncate(inode, size) \
+({ \
+ result = inode_newsize_ok(inode, size); \
+ if (!result) \
+ { \
+ truncate_setsize(inode, size); \
+ } \
+ result; \
+})
+
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment