rasa / vmware-tools-patches

Patch and build VMware tools automatically
https://github.com/rasa/vmware-tools-patches/wiki
MIT License
1.19k stars 198 forks source link

vmhgfs doesn't compile - DENTRY(file) - 3.13.0-53 - VMwareTools-9.6.2-1688356 #55

Closed hurda closed 9 years ago

hurda commented 9 years ago

System: Ubuntu 14.04 32bit

Patch in question: https://github.com/rasa/vmware-tools-patches/blob/832ab6b98c7671e70c929dee8f50e572f19dec44/patches/vmhgfs/16-vmhgfs-f_dentry-kernel-3.19.0-15-tools-9.6.2.patch

It's applying all patches cleanly on a freshly downloaded tar, but compilation fails on file.c, but not dir.c.

  CC [M]  /tmp/modconfig-urTco3/vmhgfs-only/file.o
In file included from /tmp/modconfig-urTco3/vmhgfs-only/file.c:35:0:
/tmp/modconfig-urTco3/vmhgfs-only/file.c: In function ‘HgfsAioRead’:
/tmp/modconfig-urTco3/vmhgfs-only/./shared/compat_dentry.h:7:23: error: expected identifier before ‘(’ token
 # define DENTRY(file) (file->f_dentry)
                       ^
/tmp/modconfig-urTco3/vmhgfs-only/file.c:790:34: note: in expansion of macro ‘DENTRY’
    result = HgfsRevalidate(iocb->DENTRY(ki_filp));
                                  ^
/tmp/modconfig-urTco3/vmhgfs-only/file.c: In function ‘HgfsAioWrite’:
/tmp/modconfig-urTco3/vmhgfs-only/./shared/compat_dentry.h:7:23: error: expected identifier before ‘(’ token
 # define DENTRY(file) (file->f_dentry)
                       ^
/tmp/modconfig-urTco3/vmhgfs-only/file.c:839:24: note: in expansion of macro ‘DENTRY’
    writeDentry = iocb->DENTRY(ki_filp);
                        ^

When removing this patch before executing /untar-and-patch.sh, compilation of vmhgfs is working.

Whole log:

user@ubuntu:~$ cd Desktop/vmware-patch/vmware-tools-patches/
user@ubuntu:~/Desktop/vmware-patch/vmware-tools-patches$ ./untar-and-patch.sh
untar.sh: Patching ./VMwareTools-9.6.2-1688356.tar.gz
=== Patching ./VMwareTools-9.6.2-1688356.tar.gz ...

*** Applying vmci/01-vmware9.k3.8rc4.patch ...
patching file linux/driver.c
Reversed (or previously applied) patch detected!  Assuming -R.
Hunk #1 succeeded at 128 with fuzz 1 (offset 4 lines).
Hunk #2 succeeded at 1747 (offset -3 lines).
Hunk #3 succeeded at 1975 (offset -3 lines).
*** Applying vmhgfs/01-compat_dcache.h.patch ...
patching file shared/compat_dcache.h
*** Skipping vmhgfs/02-patch_inode.c.patch: patch not appropriate for this kernel
*** Applying vmhgfs/03-vmhgfs-3.15-vfs_readlink.patch ...
patching file link.c
*** Skipping vmhgfs/04-vmhgfs-d_alias-kernel-3.18.1-tools-9.9.0.patch: patch not appropriate for this kernel
*** Skipping vmhgfs/05-vmhgfs-d_count-kernel-3.11-tools-9.6.0.patch: patch not appropriate for this kernel
*** Skipping vmhgfs/06-vmhgfs-d_set_type-kernel-3.18.1-tools-9.6.1.patch: patch not appropriate for this kernel
*** Applying vmhgfs/07-vmhgfs-rename_deprecated-kernel-3.18.1-tools-9.6.1.patch ...
patching file shared/vm_assert.h
*** Applying vmhgfs/08-vmhgfs-smp_mb_before_clear_bit-3.18-tools-9.9.0.patch ...
patching file page.c
Hunk #1 succeeded at 1450 (offset -228 lines).
*** Skipping vmhgfs/09-vmhgfs-uid-gid-kernel-3.12-tools-9.6.1.patch: patch not appropriate for this kernel
*** Applying vmhgfs/10-vmhgfs-vfs_readlink-kernel-3.16-tools-9.6.2.patch ...
patching file file.c
patching file link.c
patching file shared/compat_fs.h
*** Applying vmhgfs/11-vmhgfs-wait_on_bit-kernel-3.17-tools-9.6.2.patch ...
patching file page.c
*** Skipping vmhgfs/12-vmware9.compat_mm.patch: patch not appropriate for this kernel
*** Skipping vmhgfs/13-vmhgfs-f_dentry-kernel-3.19-tools-9.9.2.patch: patch not appropriate for this kernel
*** Applying vmhgfs/14-vmhgfs-d_alias-kernel-3.18.1-tools-9.6.2.patch ...
patching file inode.c
patching file Makefile.kernel
patching file shared/autoconf/d_alias.c
*** Applying vmhgfs/15-vmhgfs-bdi-kernel-4.0-tools-9.9.2.patch ...
patching file filesystem.c
Hunk #1 succeeded at 388 (offset 2 lines).
Hunk #2 succeeded at 442 (offset 2 lines).
patching file module.h
patching file super.c
*** Applying vmhgfs/16-vmhgfs-f_dentry-kernel-3.19.0-15-tools-9.6.2.patch ...
patching file dir.c
patching file file.c
Hunk #2 succeeded at 363 (offset 4 lines).
Hunk #3 succeeded at 590 (offset 4 lines).
Hunk #4 succeeded at 668 (offset 4 lines).
Hunk #5 succeeded at 683 (offset 4 lines).
Hunk #6 succeeded at 746 (offset 4 lines).
Hunk #7 succeeded at 782 (offset 4 lines).
Hunk #8 succeeded at 833 (offset 4 lines).
Hunk #9 succeeded at 919 (offset 4 lines).
Hunk #10 succeeded at 973 (offset 8 lines).
Hunk #11 succeeded at 1025 (offset 12 lines).
Hunk #12 succeeded at 1114 (offset 12 lines).
Hunk #13 succeeded at 1128 (offset 12 lines).
Hunk #14 succeeded at 1186 (offset 12 lines).
Hunk #15 succeeded at 1232 (offset 12 lines).
Hunk #16 succeeded at 1277 (offset 12 lines).
Hunk #17 succeeded at 1407 (offset 12 lines).
Hunk #18 succeeded at 1461 (offset 12 lines).
patching file fsutil.c
patching file page.c
patching file shared/compat_dentry.h
*** Skipping vmhgfs/17-vmhgfs-bdi-kernel-4.0-tools-9.9.3.patch: patch not appropriate for this kernel
*** Applying vsock/01-vsock-sk_data_ready-kernel-3.15-tools-9.6.2.patch ...
patching file linux/notify.c
patching file linux/notifyQState.c
*** Applying vmblock/01-vmblock.3.10.patch ...
patching file linux/control.c
*** Applying vmblock/02-vmblock.3.11.patch ...
patching file linux/file.c
*** Applying vmblock/03-vmblock.3.12.patch ...
patching file linux/control.c
patching file linux/dentry.c
patching file linux/inode.c
*** Applying vmblock/04-vmblock-vfs_readlink-kernel-3.15-tools-9.6.2.patch ...
patching file linux/inode.c
Hunk #1 succeeded at 177 (offset -1 lines).
user@ubuntu:~/Desktop/vmware-patch/vmware-tools-patches$ cd vmware-tools-distrib/
user@ubuntu:~/Desktop/vmware-patch/vmware-tools-patches/vmware-tools-distrib$ sudo ./vmware-install.pl 
[sudo] password for user: 
A previous installation of VMware Tools has been detected.

The previous installation was made by the tar installer (version 4).

Keeping the tar4 installer database format.

You have a version of VMware Tools installed.  Continuing this install will 
first uninstall the currently installed version.  Do you wish to continue? 
(yes/no) [yes] 

.....

Installing VMware Tools.

.....

The VMware Host-Guest Filesystem allows for shared folders between the host OS 
and the guest OS in a Fusion or Workstation virtual environment.  Do you wish 
to enable this feature? [yes] 

Before you can compile modules, you need to have the following installed... 

make
gcc
kernel headers of the running kernel

Searching for GCC...
Detected GCC binary at "/usr/bin/gcc".
The path "/usr/bin/gcc" appears to be a valid path to the gcc binary.
Would you like to change it? [no] 

Searching for a valid kernel header path...
Detected the kernel headers at "/lib/modules/3.13.0-53-generic/build/include".
The path "/lib/modules/3.13.0-53-generic/build/include" appears to be a valid 
path to the 3.13.0-53-generic kernel headers.
Would you like to change it? [no] 

Using 2.6.x kernel build system.
make: Entering directory `/tmp/modconfig-urTco3/vmhgfs-only'
/usr/bin/make -C /lib/modules/3.13.0-53-generic/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \
      MODULEBUILDDIR= modules
make[1]: Entering directory `/usr/src/linux-headers-3.13.0-53-generic'
  CC [M]  /tmp/modconfig-urTco3/vmhgfs-only/backdoor.o
  CC [M]  /tmp/modconfig-urTco3/vmhgfs-only/backdoorGcc32.o
  CC [M]  /tmp/modconfig-urTco3/vmhgfs-only/bdhandler.o
  CC [M]  /tmp/modconfig-urTco3/vmhgfs-only/cpName.o
  CC [M]  /tmp/modconfig-urTco3/vmhgfs-only/cpNameLinux.o
  CC [M]  /tmp/modconfig-urTco3/vmhgfs-only/cpNameLite.o
  CC [M]  /tmp/modconfig-urTco3/vmhgfs-only/dentry.o
  CC [M]  /tmp/modconfig-urTco3/vmhgfs-only/dir.o
  CC [M]  /tmp/modconfig-urTco3/vmhgfs-only/file.o
In file included from /tmp/modconfig-urTco3/vmhgfs-only/file.c:35:0:
/tmp/modconfig-urTco3/vmhgfs-only/file.c: In function ‘HgfsAioRead’:
/tmp/modconfig-urTco3/vmhgfs-only/./shared/compat_dentry.h:7:23: error: expected identifier before ‘(’ token
 # define DENTRY(file) (file->f_dentry)
                       ^
/tmp/modconfig-urTco3/vmhgfs-only/file.c:790:34: note: in expansion of macro ‘DENTRY’
    result = HgfsRevalidate(iocb->DENTRY(ki_filp));
                                  ^
/tmp/modconfig-urTco3/vmhgfs-only/file.c: In function ‘HgfsAioWrite’:
/tmp/modconfig-urTco3/vmhgfs-only/./shared/compat_dentry.h:7:23: error: expected identifier before ‘(’ token
 # define DENTRY(file) (file->f_dentry)
                       ^
/tmp/modconfig-urTco3/vmhgfs-only/file.c:839:24: note: in expansion of macro ‘DENTRY’
    writeDentry = iocb->DENTRY(ki_filp);
                        ^
make[2]: *** [/tmp/modconfig-urTco3/vmhgfs-only/file.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [_module_/tmp/modconfig-urTco3/vmhgfs-only] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.13.0-53-generic'
make: *** [vmhgfs.ko] Error 2
make: Leaving directory `/tmp/modconfig-urTco3/vmhgfs-only'

The filesystem driver (vmhgfs module) is used only for the shared folder 
feature. The rest of the software provided by VMware Tools is designed to work 
independently of this feature.

If you wish to have the shared folders feature, you can install the driver by 
running vmware-config-tools.pl again after making sure that gcc, binutils, make
and the kernel sources for your running kernel are installed on your machine. 
These packages are available on your distribution's installation CD.
[ Press Enter key to continue ] 

.....

Creating a new initrd boot image for the kernel.
update-initramfs: Generating /boot/initrd.img-3.13.0-53-generic
vmware-tools-thinprint start/running
vmware-tools start/running
The configuration of VMware Tools 9.6.2 build-1688356 for Linux for this 
running kernel completed successfully.

.....

user@ubuntu:~/Desktop/vmware-patch/vmware-tools-patches/vmware-tools-distrib$ uname -a
Linux ubuntu 3.13.0-53-generic #89-Ubuntu SMP Wed May 20 10:34:28 UTC 2015 i686 i686 i686 GNU/Linux
rasa commented 9 years ago

Can you try again with latest version, currently VMwareTools-9.9.3-2759765.tar.gz ?

hurda commented 9 years ago

Well, yes, that one compiles with all the patches. I think 13-vmhgfs-f_dentry-kernel-3.19-tools-9.9.2.patch is the relevant patch in this case.

hurda commented 9 years ago

https://github.com/rasa/vmware-tools-patches/blob/832ab6b98c7671e70c929dee8f50e572f19dec44/patches/vmhgfs/16-vmhgfs-f_dentry-kernel-3.19.0-15-tools-9.6.2.patch#L191

https://github.com/rasa/vmware-tools-patches/blob/832ab6b98c7671e70c929dee8f50e572f19dec44/patches/vmhgfs/13-vmhgfs-f_dentry-kernel-3.19-tools-9.9.2.patch#L199

Here's where the patches differ. 16: iocb->DENTRY(ki_filp) 13: DENTRY(iocb->ki_filp)

After modifying 16 to look like 13, 9.6.2 is compiling, too.

hurda commented 9 years ago

I don't know if it's valid C, but leaving out the enclosing parenthesis from the #define fixes the compilation-error on 14.04 too.

E.g. # define DENTRY(file) file->f_path.dentry instead of # define DENTRY(file) (file->f_path.dentry)

No idea which fix is better or safer.

hurda commented 9 years ago

Fixed by #59.