#define isprint(a) ((a >= ' ') && (a <= '~'))
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
+#define PAL_VFS_GETATTR(path, kstat) vfs_getattr(path.mnt, path.dentry, kstat)
+#else
+#define PAL_VFS_GETATTR(path, kstat) vfs_getattr(path, kstat)
+#endif
+
struct palacios_file {
struct file * filp;
/* It only exists to provide version compatibility */
struct path tmp_path;
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,41)
+ struct nameidata nd;
+#endif
struct path * path_ptr = NULL;
struct dentry * dentry;
/* Before Linux 3.1 this was somewhat more difficult */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,41)
{
- struct nameidata nd;
-
// I'm not 100% sure about the version here, but it was around this time that the API changed
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)
ret = kern_path_parent(pathname, &nd);
struct kstat s;
int ret;
- ret = vfs_getattr(filp->f_path.mnt, filp->f_path.dentry, &s);
+ ret = PAL_VFS_GETATTR(filp->f_path, &s);
if (ret != 0) {
ERROR("Failed to fstat file\n");