{"id":1281,"date":"2015-01-23T22:50:24","date_gmt":"2015-01-23T22:50:24","guid":{"rendered":"http:\/\/rglinuxtech.com\/?p=1281"},"modified":"2015-01-23T22:50:24","modified_gmt":"2015-01-23T22:50:24","slug":"vmware-backward-compatible-3-19-fix","status":"publish","type":"post","link":"https:\/\/rglinuxtech.com\/?p=1281","title":{"rendered":"VMware &#8211; Backward-Compatible 3.19 Fix.."},"content":{"rendered":"<p>After the solution to the Kernel 3.19\/vmnet problem mentioned in previous posts, I have produced a fix that includes tests for kernel versions, and works with Kernel 3.19 <span style=\"text-decoration: underline;\">and<\/span> with earlier kernel versions..<\/p>\n<p>This is probably not the most <em>elegant<\/em> code, but it works &#8211; I have tested it with VMware 11.0 and Kernels 3.19-rc5 and 3.18.3 (from kernel.org)..<\/p>\n<p>In vmnet-only\/<strong>driver.c<\/strong> &#8211; around line 267<br \/>\nchange:<\/p>\n<pre><strong>if (filp &amp;&amp; filp-&gt;f_op &amp;&amp; filp-&gt;f_op-&gt;ioctl == VNetFileOpIoctl) {<\/strong>\r\n<strong> ret = VNetFileOpIoctl(filp-&gt;f_dentry-&gt;d_inode, filp, iocmd, ioarg);<\/strong>\r\n<strong> }<\/strong>\r\n<strong> return ret;<\/strong>\r\n<strong>}<\/strong><\/pre>\n<p>to:<\/p>\n<pre><strong>#if LINUX_VERSION_CODE &lt; KERNEL_VERSION(3, 19, 0)<\/strong>\r\n<strong> if (filp &amp;&amp; filp-&gt;f_op &amp;&amp; filp-&gt;f_op-&gt;ioctl == VNetFileOpIoctl) {<\/strong>\r\n<strong> ret = VNetFileOpIoctl(filp-&gt;f_dentry-&gt;d_inode, filp, iocmd, ioarg);<\/strong>\r\n<strong> }<\/strong>\r\n<strong> return ret;<\/strong>\r\n<strong>#else <\/strong>\r\n<strong> if (filp &amp;&amp; filp-&gt;f_op &amp;&amp; filp-&gt;f_op-&gt;ioctl == VNetFileOpIoctl) {<\/strong>\r\n<strong> ret = VNetFileOpIoctl(filp-&gt;f_path.dentry-&gt;d_inode, filp, iocmd, ioarg);<\/strong>\r\n<strong> }<\/strong>\r\n<strong> return ret;<\/strong>\r\n<strong>#endif<\/strong>\r\n<strong>}<\/strong><\/pre>\n<p>And, around line 1194<br \/>\nchange:<\/p>\n<pre><strong>if (filp &amp;&amp; filp-&gt;f_dentry) {<\/strong>\r\n<strong> inode = filp-&gt;f_dentry-&gt;d_inode;<\/strong>\r\n<strong> }<\/strong>\r\n<strong> err = VNetFileOpIoctl(inode, filp, iocmd, ioarg);<\/strong>\r\n<strong> return err;<\/strong><\/pre>\n<p>to:<\/p>\n<pre><strong>#if LINUX_VERSION_CODE &lt; KERNEL_VERSION(3, 19, 0)<\/strong>\r\n<strong> if (filp &amp;&amp; filp-&gt;f_dentry) {<\/strong>\r\n<strong> inode = filp-&gt;f_dentry-&gt;d_inode;<\/strong>\r\n<strong> }<\/strong>\r\n<strong> err = VNetFileOpIoctl(inode, filp, iocmd, ioarg);<\/strong>\r\n<strong> return err;<\/strong>\r\n<strong>#else <\/strong>\r\n<strong> if (filp &amp;&amp; filp-&gt;f_path.dentry) {<\/strong>\r\n<strong> inode = filp-&gt;f_path.dentry-&gt;d_inode;<\/strong>\r\n<strong> }<\/strong>\r\n<strong> err = VNetFileOpIoctl(inode, filp, iocmd, ioarg);<\/strong>\r\n<strong> return err;<\/strong>\r\n<strong>#endif<\/strong><\/pre>\n<p>In vmnet-only\/<strong>userif.c<\/strong> &#8211; around line 526<br \/>\nchange:<\/p>\n<pre><strong>return skb_copy_datagram_iovec(skb, 0, &amp;iov, len);<\/strong><\/pre>\n<p>to:<\/p>\n<pre><strong>#if LINUX_VERSION_CODE &lt; KERNEL_VERSION(3, 19, 0)<\/strong>\r\n<strong> return skb_copy_datagram_iovec(skb, 0, &amp;iov, len);<\/strong>\r\n<strong>#else<\/strong>\r\n<strong> struct iov_iter to;<\/strong>\r\n<strong> iov_iter_init(&amp;to, READ, &amp;iov, 1, len);<\/strong>\r\n<strong> return skb_copy_datagram_iter(skb, 0, &amp;to, len);<\/strong>\r\n<strong>#endif<\/strong><\/pre>\n<p>Basically, test for kernel version prior to 3.19, and if found, use the &#8216;old&#8217; code, otherwise, use the &#8216;new&#8217; code..<\/p>\n<p>Once again, thanks are due to Al Viro and <em><strong>coderus<\/strong><\/em> for the fix for <em>skb_copy_datagram_iovec<\/em>..<\/p>\n<p>Hopefully this makes sense!<\/p>\n<p><em>Robert Gadsdon\u00a0\u00a0 January 23, 2015.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>After the solution to the Kernel 3.19\/vmnet problem mentioned in previous posts, I have produced a fix that includes tests for kernel versions, and works with Kernel 3.19 and with earlier kernel versions.. This is probably not the most elegant code, but it works &#8211; I have tested it with VMware 11.0 and Kernels 3.19-rc5 and 3.18.3 <span class=\"excerpt-dots\">&hellip;<\/span> <a class=\"more-link\" href=\"https:\/\/rglinuxtech.com\/?p=1281\"><span class=\"more-msg\">Continue reading &rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[5,6,11,14,15,19,20,25],"tags":[991,990,1175,992,761,957],"class_list":["post-1281","post","type-post","status-publish","format-standard","hentry","category-compilation","category-crash-and-burn","category-hacks","category-kernel","category-linux-2","category-opinion","category-performance-2","category-vmware","tag-backward-compatible","tag-kernel-3-19-fix","tag-success","tag-test-for-kernel-version","tag-vmnet","tag-vmware-11"],"_links":{"self":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts\/1281","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1281"}],"version-history":[{"count":1,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts\/1281\/revisions"}],"predecessor-version":[{"id":1282,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts\/1281\/revisions\/1282"}],"wp:attachment":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}