[vbox-dev] kernel 4.18 build fix

Gianfranco Costamagna locutusofborg at debian.org
Wed Aug 29 16:11:38 GMT 2018


Hello,
Bug:https://bugs.launchpad.net/ubuntu/+source/virtualbox/+bug/1787441
/var/lib/dkms/virtualbox-guest/5.2.16/build/vboxsf/utils.c: In function ‘sf_init_inode’:
/var/lib/dkms/virtualbox-guest/5.2.16/build/vboxsf/utils.c:165:28: error: passing argument 1 of ‘sf_ftime_from_timespec’ from incompatible pointer type [-Werror=incompatible-pointer-types]
     sf_ftime_from_timespec(&inode->i_atime, &info->AccessTime);
                            ^~~~~~~~~~~~~~~
/var/lib/dkms/virtualbox-guest/5.2.16/build/vboxsf/utils.c:53:53: note: expected ‘struct timespec *’ but argument is of type ‘struct timespec64 *’


MIT licensed proposed fix:
diff --git a/src/VBox/Additions/linux/sharedfolders/utils.c b/src/VBox/Additions/linux/sharedfolders/utils.c
index 187ba2eff..11ff49a3a 100644
--- a/src/VBox/Additions/linux/sharedfolders/utils.c
+++ b/src/VBox/Additions/linux/sharedfolders/utils.c
@@ -50,7 +50,11 @@ static void sf_timespec_from_ftime(RTTIMESPEC *ts, time_t *time)
     RTTimeSpecSetNano(ts, t);
 }
 #else /* >= 2.6.0 */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)
 static void sf_ftime_from_timespec(struct timespec *tv, RTTIMESPEC *ts)
+#else
+static void sf_ftime_from_timespec(struct timespec64 *tv, RTTIMESPEC *ts)
+#endif
 {
     int64_t t = RTTimeSpecGetNano(ts);
     int64_t nsec;
@@ -60,7 +64,11 @@ static void sf_ftime_from_timespec(struct timespec *tv, RTTIMESPEC *ts)
     tv->tv_nsec = nsec;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)
 static void sf_timespec_from_ftime(RTTIMESPEC *ts, struct timespec *tv)
+#else
+static void sf_timespec_from_ftime(RTTIMESPEC *ts, struct timespec64 *tv)
+#endif
 {
     int64_t t = (int64_t)tv->tv_nsec + (int64_t)tv->tv_sec * 1000000000;
     RTTimeSpecSetNano(ts, t);

cheers,
Gianfranco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20180829/906dd68b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kernel-4.18.patch
Type: text/x-patch
Size: 1218 bytes
Desc: not available
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20180829/906dd68b/attachment.bin>


More information about the vbox-dev mailing list