X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_module%2Fiface-file.c;h=880c4d98dc53a5819a5e0c207fec0013e5ee8200;hb=c8b23e99efde3aa5a2c26d1b8e9bc7dc914e6113;hp=92ed9ff3e170347d65c68fa7afa9450198d7a0d6;hpb=d22c11cec4e8c3390bfe6bf16ed07f5d073f0d4a;p=palacios.git diff --git a/linux_module/iface-file.c b/linux_module/iface-file.c index 92ed9ff..880c4d9 100644 --- a/linux_module/iface-file.c +++ b/linux_module/iface-file.c @@ -20,6 +20,12 @@ static struct list_head global_files; #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; @@ -119,6 +125,9 @@ static int palacios_file_mkdir(const char * pathname, unsigned short perms, int /* 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; @@ -133,8 +142,6 @@ static int palacios_file_mkdir(const char * pathname, unsigned short perms, int /* 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); @@ -275,7 +282,7 @@ static unsigned long long palacios_file_size(void * file_ptr) { 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");