Merge lp:~n-muench/ubuntu/saucy/open-vm-tools/open-vm-tools.april-update.part2-merge into lp:ubuntu/saucy/open-vm-tools

Proposed by Nate Muench (Mink)
Status: Needs review
Proposed branch: lp:~n-muench/ubuntu/saucy/open-vm-tools/open-vm-tools.april-update.part2-merge
Merge into: lp:ubuntu/saucy/open-vm-tools
Diff against target: 4869 lines (+3948/-299)
48 files modified
.pc/0005-linux-310-fix.patch/modules/linux/shared/compat_fs.h (+266/-0)
.pc/0005-linux-310-fix.patch/modules/linux/vmblock/linux/control.c (+375/-0)
.pc/0005-linux-310-fix.patch/modules/linux/vmblock/linux/dentry.c (+118/-0)
.pc/0005-linux-310-fix.patch/modules/linux/vmblock/linux/inode.c (+232/-0)
.pc/0005-linux-310-fix.patch/modules/linux/vmhgfs/file.c (+1280/-0)
.pc/0005-linux-310-fix.patch/modules/linux/vmsync/sync.c (+711/-0)
.pc/0006-linux-311-fix.patch/modules/linux/vmblock/linux/file.c (+244/-0)
.pc/0007-dkms-suppress-error.patch/modules/linux/dkms.conf (+34/-0)
.pc/applied-patches (+3/-0)
debian/changelog (+99/-0)
debian/control (+70/-43)
debian/copyright (+2/-2)
debian/local/open-vm-tools.service (+11/-0)
debian/manpages/libguestlib.3 (+0/-4)
debian/manpages/libvmtools.3 (+0/-4)
debian/manpages/vmblock.9 (+0/-4)
debian/manpages/vmhgfs.9 (+0/-4)
debian/manpages/vmware-checkvm.1 (+0/-4)
debian/manpages/vmware-hgfsclient.1 (+0/-4)
debian/manpages/vmware-hgfsmounter.8 (+0/-4)
debian/manpages/vmware-toolbox-cmd.1 (+0/-4)
debian/manpages/vmware-user-suid-wrapper.8 (+0/-4)
debian/manpages/vmware-xferlogs.1 (+0/-4)
debian/manpages/vmxnet.9 (+0/-4)
debian/open-vm-dkms.dkms (+0/-10)
debian/open-vm-dkms.postinst (+0/-42)
debian/open-vm-dkms.prerm (+0/-29)
debian/open-vm-toolbox.lintian-overrides (+0/-2)
debian/open-vm-toolbox.manpages (+0/-1)
debian/open-vm-tools-desktop.lintian-overrides (+2/-0)
debian/open-vm-tools-desktop.manpages (+1/-0)
debian/open-vm-tools-dkms.dkms (+6/-0)
debian/open-vm-tools-dkms.postinst (+42/-0)
debian/open-vm-tools-dkms.prerm (+29/-0)
debian/open-vm-tools.init (+1/-2)
debian/patches/0005-linux-310-fix.patch (+225/-0)
debian/patches/0006-linux-311-fix.patch (+94/-0)
debian/patches/0007-dkms-suppress-error.patch (+41/-0)
debian/patches/series (+3/-0)
debian/rules (+20/-19)
modules/linux/dkms.conf (+5/-20)
modules/linux/shared/compat_fs.h (+0/-12)
modules/linux/vmblock/linux/control.c (+9/-9)
modules/linux/vmblock/linux/dentry.c (+3/-4)
modules/linux/vmblock/linux/file.c (+7/-50)
modules/linux/vmblock/linux/inode.c (+2/-2)
modules/linux/vmhgfs/file.c (+1/-0)
modules/linux/vmsync/sync.c (+12/-8)
To merge this branch: bzr merge lp:~n-muench/ubuntu/saucy/open-vm-tools/open-vm-tools.april-update.part2-merge
Reviewer Review Type Date Requested Status
Dimitri John Ledkov Approve
Review via email: mp+186927@code.launchpad.net

This proposal supersedes a proposal from 2013-09-08.

Description of the change

Merged some items from Debian. Added patches for Linux 3.10 & 3.11.

vmhgfs is still kind of flaky. Either because of something related to the kernel or a build package, I'm not really sure. It's been broken since the original upload, with the 3.9 kernel)

0007-dkms-suppress-error.patch tweaks the dkms.conf file. There are modules that still fail to build, modules that are either in the kernel or flaky. The patch lets only the vmblock module (fixed with the 3.11 patch) and the vmxnet module (fixed with the 3.10 patch) build. The reason is if during the DKMS build process, any modules fail to build, none will get installed.

vmxnet builds successfully because of the 3.10 patch.

0007-dkms-suppress-error.patch will be removed once a new upstream version is released. That will be the last merge proposal of this cycle.

I was planning on more updates (including the paper work to become the package's official maintainer (and gain uploader rights)) during the Saucy devel cycle, but there were some delays related to the package. These plans have been postponed until 14.04.

Did I say too much to get this disapproved?

To post a comment you must log in.
Revision history for this message
Luke Yelavich (themuso) wrote : Posted in a previous version of this proposal

You will have to either turn one of the existing bugs into a feature freeze exception, or create a new one and link it to this merge proposal.

Revision history for this message
Nate Muench (Mink) (n-muench) wrote : Posted in a previous version of this proposal

open-vm-tools is not a core package (as in not everyone is gonna use it), therefore it doesn't need a freeze exception. I think that's what the policy is.

Revision history for this message
Nate Muench (Mink) (n-muench) wrote : Posted in a previous version of this proposal
Revision history for this message
Dimitri John Ledkov (xnox) :
review: Approve

Unmerged revisions

37. By Nate Muench (Mink)

* Ubuntu-specific Changes
  - debian/rules: Removed Wno-error=unused-local-typedefs from CLFAGS.
    + We now enforce building with GCC 4.7.

  - debian/patches: Add 0005-linux-310-fix.patch & 0006-linux-311-fix.patch
    + Fixes building against Saucy Kernels. (LP: #1194940, LP: #1208011)

  - debian/patches: Add 0007-dkms-supress-error.patch
    + Don't build modules that are broken, so modules that do build
      are available to be loaded.
    + Will be removed after next upstream release.

* Items merged from Debian experimental:
  (From 2:9.2.2-893683-7 release)
  - Removing purely cosmetical 'sleep 1' leftover in initscript.

  (From 2:9.2.3-1031360-2 release)
  - Renaming debian-specific open-vm-toolbox package to open-vm-tools-
    desktop for consistency with upstream.
  - Revamping package descriptions.
  - Renaming open-vm-dkms to open-vm-tools-dkms for consistent package
    namespace.

  (From 2:9.2.3-1031360-3 release)
  - Adding initial systemd service file from fedora.

  (From 2:9.2.3-1031360-4 release)
  - Dropping kfreebsd from architecture list, it has never built and
    nobody seems willing to make it work (neither upstream, porters, nor
    users).

  (From 2:9.2.3-1031360-6 release)
  - Correcting syntax of file entries in copyright.
  - Adding section override for open-vm-tools-dkms.
  - Enforcing build with gcc 4.7 for the time being.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory '.pc/0005-linux-310-fix.patch'
2=== added directory '.pc/0005-linux-310-fix.patch/modules'
3=== added directory '.pc/0005-linux-310-fix.patch/modules/linux'
4=== added directory '.pc/0005-linux-310-fix.patch/modules/linux/shared'
5=== added file '.pc/0005-linux-310-fix.patch/modules/linux/shared/compat_fs.h'
6--- .pc/0005-linux-310-fix.patch/modules/linux/shared/compat_fs.h 1970-01-01 00:00:00 +0000
7+++ .pc/0005-linux-310-fix.patch/modules/linux/shared/compat_fs.h 2013-09-21 20:15:28 +0000
8@@ -0,0 +1,266 @@
9+/*********************************************************
10+ * Copyright (C) 2006 VMware, Inc. All rights reserved.
11+ *
12+ * This program is free software; you can redistribute it and/or modify it
13+ * under the terms of the GNU General Public License as published by the
14+ * Free Software Foundation version 2 and no later version.
15+ *
16+ * This program is distributed in the hope that it will be useful, but
17+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19+ * for more details.
20+ *
21+ * You should have received a copy of the GNU General Public License along
22+ * with this program; if not, write to the Free Software Foundation, Inc.,
23+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24+ *
25+ *********************************************************/
26+
27+#ifndef __COMPAT_FS_H__
28+# define __COMPAT_FS_H__
29+
30+#include <linux/fs.h>
31+
32+/*
33+ * 2.6.5+ kernels define FS_BINARY_MOUNTDATA. Since it didn't exist and
34+ * wasn't used prior, it's safe to define it to zero.
35+ */
36+
37+#ifndef FS_BINARY_MOUNTDATA
38+#define FS_BINARY_MOUNTDATA 0
39+#endif
40+
41+/*
42+ * MAX_LFS_FILESIZE wasn't defined until 2.5.4.
43+ */
44+#ifndef MAX_LFS_FILESIZE
45+# include <linux/pagemap.h>
46+# if BITS_PER_LONG == 32
47+# define MAX_LFS_FILESIZE (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG - 1)) - 1)
48+# elif BITS_PER_LONG == 64
49+# define MAX_LFS_FILESIZE 0x7fffffffffffffffUL
50+# endif
51+#endif
52+
53+
54+/*
55+ * sendfile as a VFS op was born in 2.5.30. Unfortunately, it also changed
56+ * signatures, first in 2.5.47, then again in 2.5.70, then again in 2.6.8.
57+ * Luckily, the 2.6.8+ signature is the same as the 2.5.47 signature. And
58+ * as of 2.6.23-rc1 sendfile is gone, replaced by splice_read...
59+ *
60+ * Let's not support sendfile from 2.5.30 to 2.5.47, because the 2.5.30
61+ * signature is much different and file_send_actor isn't externed.
62+ */
63+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
64+#define VMW_SENDFILE_NONE
65+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 8)
66+#define VMW_SENDFILE_NEW
67+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 70)
68+#define VMW_SENDFILE_OLD
69+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 47)
70+#define VMW_SENDFILE_NEW
71+#else
72+#define VMW_SENDFILE_NONE
73+#endif
74+
75+/*
76+ * splice_read is there since 2.6.17, but let's avoid 2.6.17-rcX kernels...
77+ * After all nobody is using splice system call until 2.6.23 using it to
78+ * implement sendfile.
79+ */
80+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)
81+#define VMW_SPLICE_READ 1
82+#endif
83+
84+/*
85+ * Filesystems wishing to use generic page cache read/write routines are
86+ * supposed to implement aio_read and aio_write (calling into
87+ * generic_file_aio_read() and generic_file_aio_write() if necessary).
88+ *
89+ * The VFS exports do_sync_read() and do_sync_write() as the "new"
90+ * generic_file_read() and generic_file_write(), but filesystems need not
91+ * actually implement read and write- the VFS will automatically call
92+ * do_sync_write() and do_sync_read() when applications invoke the standard
93+ * read() and write() system calls.
94+ *
95+ * In 2.6.19, generic_file_read() and generic_file_write() were removed,
96+ * necessitating this change. AIO dates as far back as 2.5.42, but the API has
97+ * changed over time, so for simplicity, we'll only enable it from 2.6.19 and
98+ * on.
99+ */
100+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
101+# define VMW_USE_AIO
102+#endif
103+
104+
105+/*
106+ * The alloc_inode and destroy_inode VFS ops didn't exist prior to 2.4.21.
107+ * Without these functions, file systems can't embed inodes.
108+ */
109+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 21)
110+# define VMW_EMBED_INODE
111+#endif
112+
113+
114+/*
115+ * iget() was removed from the VFS as of 2.6.25-rc1. The replacement for iget()
116+ * is iget_locked() which was added in 2.5.17.
117+ */
118+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 17)
119+# define VMW_USE_IGET_LOCKED
120+#endif
121+
122+/*
123+ * parent_ino was born in 2.5.5. For older kernels, let's use 2.5.5
124+ * implementation. It uses the dcache lock which is OK because per-dentry
125+ * locking appeared after 2.5.5.
126+ */
127+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 5)
128+#define compat_parent_ino(dentry) parent_ino(dentry)
129+#else
130+#define compat_parent_ino(dentry) \
131+({ \
132+ ino_t res; \
133+ spin_lock(&dcache_lock); \
134+ res = dentry->d_parent->d_inode->i_ino; \
135+ spin_unlock(&dcache_lock); \
136+ res; \
137+})
138+#endif
139+
140+
141+/*
142+ * putname changed to __putname in 2.6.6.
143+ */
144+#define compat___getname() __getname()
145+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 6)
146+#define compat___putname(name) putname(name)
147+#else
148+#define compat___putname(name) __putname(name)
149+#endif
150+
151+
152+/*
153+ * inc_nlink, drop_nlink, and clear_nlink were added in 2.6.19.
154+ */
155+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
156+#define compat_inc_nlink(inode) ((inode)->i_nlink++)
157+#define compat_drop_nlink(inode) ((inode)->i_nlink--)
158+#define compat_clear_nlink(inode) ((inode)->i_nlink = 0)
159+#else
160+#define compat_inc_nlink(inode) inc_nlink(inode)
161+#define compat_drop_nlink(inode) drop_nlink(inode)
162+#define compat_clear_nlink(inode) clear_nlink(inode)
163+#endif
164+
165+
166+/*
167+ * i_size_write and i_size_read were introduced in 2.6.0-test1
168+ * (though we'll look for them as of 2.6.1). They employ slightly different
169+ * locking in order to guarantee atomicity, depending on the length of a long,
170+ * whether the kernel is SMP, or whether the kernel is preemptible. Prior to
171+ * i_size_write and i_size_read, there was no such locking, so that's the
172+ * behavior we'll emulate.
173+ */
174+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 1)
175+#define compat_i_size_read(inode) ((inode)->i_size)
176+#define compat_i_size_write(inode, size) ((inode)->i_size = size)
177+#else
178+#define compat_i_size_read(inode) i_size_read(inode)
179+#define compat_i_size_write(inode, size) i_size_write(inode, size)
180+#endif
181+
182+
183+/*
184+ * filemap_fdatawrite was introduced in 2.5.12. Prior to that, modules used
185+ * filemap_fdatasync instead. In 2.4.18, both filemap_fdatawrite and
186+ * filemap_fdatawait began returning status codes. Prior to that, they were
187+ * void functions, so we'll just have them return 0.
188+ */
189+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 18)
190+#define compat_filemap_fdatawrite(mapping) \
191+({ \
192+ int result = 0; \
193+ filemap_fdatasync(mapping); \
194+ result; \
195+})
196+#define compat_filemap_fdatawait(mapping) \
197+({ \
198+ int result = 0; \
199+ filemap_fdatawait(mapping); \
200+ result; \
201+})
202+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 12)
203+#define compat_filemap_fdatawrite(mapping) filemap_fdatasync(mapping)
204+#define compat_filemap_fdatawait(mapping) filemap_fdatawait(mapping)
205+#else
206+#define compat_filemap_fdatawrite(mapping) filemap_fdatawrite(mapping)
207+#define compat_filemap_fdatawait(mapping) filemap_fdatawait(mapping)
208+#endif
209+
210+
211+/*
212+ * filemap_write_and_wait was introduced in 2.6.6 and exported for module use
213+ * in 2.6.16. It's really just a simple wrapper around filemap_fdatawrite and
214+ * and filemap_fdatawait, which initiates a flush of all dirty pages, then
215+ * waits for the pages to flush. The implementation here is a simplified form
216+ * of the one found in 2.6.20-rc3.
217+ *
218+ * Unfortunately, it just isn't possible to implement this prior to 2.4.5, when
219+ * neither filemap_fdatawait nor filemap_fdatasync were exported for module
220+ * use. So we'll define it out and hope for the best.
221+ */
222+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 5)
223+#define compat_filemap_write_and_wait(mapping)
224+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
225+#define compat_filemap_write_and_wait(mapping) \
226+({ \
227+ int result = 0; \
228+ if (mapping->nrpages) { \
229+ result = compat_filemap_fdatawrite(mapping); \
230+ if (result != -EIO) { \
231+ int result2 = compat_filemap_fdatawait(mapping); \
232+ if (!result) { \
233+ result = result2; \
234+ } \
235+ } \
236+ } \
237+ result; \
238+})
239+#else
240+#define compat_filemap_write_and_wait(mapping) filemap_write_and_wait(mapping)
241+#endif
242+
243+
244+/*
245+ * invalidate_remote_inode was introduced in 2.6.0-test5. Prior to that,
246+ * filesystems wishing to invalidate pages belonging to an inode called
247+ * invalidate_inode_pages.
248+ */
249+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
250+#define compat_invalidate_remote_inode(inode) invalidate_inode_pages(inode)
251+#else
252+#define compat_invalidate_remote_inode(inode) invalidate_remote_inode(inode)
253+#endif
254+
255+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
256+#define VMW_FSYNC_OLD
257+#endif
258+
259+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
260+typedef umode_t compat_umode_t;
261+#else
262+typedef int compat_umode_t;
263+#endif
264+
265+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)
266+#define d_make_root(inode) ({ \
267+ struct dentry * ____res = d_alloc_root(inode); \
268+ if (!____res) { \
269+ iput(inode); \
270+ } \
271+ ____res; \
272+})
273+#endif
274+#endif /* __COMPAT_FS_H__ */
275
276=== added directory '.pc/0005-linux-310-fix.patch/modules/linux/vmblock'
277=== added directory '.pc/0005-linux-310-fix.patch/modules/linux/vmblock/linux'
278=== added file '.pc/0005-linux-310-fix.patch/modules/linux/vmblock/linux/control.c'
279--- .pc/0005-linux-310-fix.patch/modules/linux/vmblock/linux/control.c 1970-01-01 00:00:00 +0000
280+++ .pc/0005-linux-310-fix.patch/modules/linux/vmblock/linux/control.c 2013-09-21 20:15:28 +0000
281@@ -0,0 +1,375 @@
282+/*********************************************************
283+ * Copyright (C) 2006 VMware, Inc. All rights reserved.
284+ *
285+ * This program is free software; you can redistribute it and/or modify it
286+ * under the terms of the GNU General Public License as published by the
287+ * Free Software Foundation version 2 and no later version.
288+ *
289+ * This program is distributed in the hope that it will be useful, but
290+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
291+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
292+ * for more details.
293+ *
294+ * You should have received a copy of the GNU General Public License along
295+ * with this program; if not, write to the Free Software Foundation, Inc.,
296+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
297+ *
298+ *********************************************************/
299+
300+/*
301+ * control.c --
302+ *
303+ * Control operations for the vmblock driver.
304+ *
305+ */
306+
307+#include "driver-config.h"
308+#include <linux/module.h>
309+#include <linux/proc_fs.h>
310+#include <linux/stat.h>
311+#include <linux/fs.h>
312+
313+#include <asm/uaccess.h>
314+
315+#include "vmblockInt.h"
316+#include "block.h"
317+
318+
319+/* procfs initialization/cleanup functions */
320+static int SetupProcDevice(void);
321+static int CleanupProcDevice(void);
322+
323+/* procfs entry file operations */
324+ssize_t ControlFileOpWrite(struct file *filp, const char __user *buf,
325+ size_t cmd, loff_t *ppos);
326+static int ControlFileOpRelease(struct inode *inode, struct file *file);
327+
328+
329+static struct proc_dir_entry *controlProcDirEntry;
330+struct file_operations ControlFileOps = {
331+ .owner = THIS_MODULE,
332+ .write = ControlFileOpWrite,
333+ .release = ControlFileOpRelease,
334+};
335+
336+
337+/* Public initialization/cleanup routines */
338+
339+/*
340+ *----------------------------------------------------------------------------
341+ *
342+ * VMBlockInitControlOps --
343+ *
344+ * Sets up state for control operations.
345+ *
346+ * Results:
347+ * Zero on success, negative error code on failure.
348+ *
349+ * Side effects:
350+ * None.
351+ *
352+ *----------------------------------------------------------------------------
353+ */
354+
355+int
356+VMBlockInitControlOps(void)
357+{
358+ int ret;
359+
360+ ret = BlockInit();
361+ if (ret < 0) {
362+ Warning("VMBlockInitControlOps: could not initialize blocking ops.\n");
363+ return ret;
364+ }
365+
366+ ret = SetupProcDevice();
367+ if (ret < 0) {
368+ Warning("VMBlockInitControlOps: could not setup proc device.\n");
369+ BlockCleanup();
370+ return ret;
371+ }
372+
373+ return 0;
374+}
375+
376+
377+/*
378+ *----------------------------------------------------------------------------
379+ *
380+ * VMBlockCleanupControlOps --
381+ *
382+ * Cleans up state for control operations.
383+ *
384+ * Results:
385+ * Zero on success, negative error code on failure.
386+ *
387+ * Side effects:
388+ * None.
389+ *
390+ *----------------------------------------------------------------------------
391+ */
392+
393+int
394+VMBlockCleanupControlOps(void)
395+{
396+ int ret;
397+
398+ ret = CleanupProcDevice();
399+ if (ret < 0) {
400+ Warning("VMBlockCleanupControlOps: could not cleanup proc device.\n");
401+ return ret;
402+ }
403+
404+ BlockCleanup();
405+ return 0;
406+}
407+
408+
409+/* Private initialization/cleanup routines */
410+
411+
412+/*
413+ *----------------------------------------------------------------------------
414+ *
415+ * VMBlockSetProcEntryOwner --
416+ *
417+ * Sets proc_dir_entry owner if necessary:
418+ *
419+ * Before version 2.6.24 kernel prints nasty warning when in-use
420+ * directory entry is destroyed, which happens when module is unloaded.
421+ * We try to prevent this warning in most cases by setting owner to point
422+ * to our module, so long operations (like current directory pointing to
423+ * directory we created) prevent module from unloading. Since 2.6.24 this
424+ * situation is handled without nastygrams, allowing module unload even
425+ * when current directory points to directory created by unloaded module,
426+ * so we do not have to set owner anymore. And since 2.6.29 we must not
427+ * set owner at all, as there is none...
428+ *
429+ * Results:
430+ * None. Always succeeds.
431+ *
432+ * Side effects:
433+ * None.
434+ *
435+ *----------------------------------------------------------------------------
436+ */
437+
438+static void
439+VMBlockSetProcEntryOwner(struct proc_dir_entry *entry) // IN/OUT: directory entry
440+{
441+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
442+ entry->owner = THIS_MODULE;
443+#endif
444+}
445+
446+
447+/*
448+ *----------------------------------------------------------------------------
449+ *
450+ * SetupProcDevice --
451+ *
452+ * Adds entries to /proc used to control file blocks.
453+ *
454+ * Results:
455+ * Zero on success, negative error code on failure.
456+ *
457+ * Side effects:
458+ * None.
459+ *
460+ *----------------------------------------------------------------------------
461+ */
462+
463+static int
464+SetupProcDevice(void)
465+{
466+ struct proc_dir_entry *controlProcEntry;
467+ struct proc_dir_entry *controlProcMountpoint;
468+
469+ /* Create /proc/fs/vmblock */
470+ controlProcDirEntry = proc_mkdir(VMBLOCK_CONTROL_PROC_DIRNAME, NULL);
471+ if (!controlProcDirEntry) {
472+ Warning("SetupProcDevice: could not create /proc/"
473+ VMBLOCK_CONTROL_PROC_DIRNAME "\n");
474+ return -EINVAL;
475+ }
476+
477+ VMBlockSetProcEntryOwner(controlProcDirEntry);
478+
479+ /* Create /proc/fs/vmblock/mountPoint */
480+ controlProcMountpoint = proc_mkdir(VMBLOCK_CONTROL_MOUNTPOINT,
481+ controlProcDirEntry);
482+ if (!controlProcMountpoint) {
483+ Warning("SetupProcDevice: could not create "
484+ VMBLOCK_MOUNT_POINT "\n");
485+ remove_proc_entry(VMBLOCK_CONTROL_PROC_DIRNAME, NULL);
486+ return -EINVAL;
487+ }
488+
489+ VMBlockSetProcEntryOwner(controlProcMountpoint);
490+
491+ /* Create /proc/fs/vmblock/dev */
492+ controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME,
493+ VMBLOCK_CONTROL_MODE,
494+ controlProcDirEntry);
495+ if (!controlProcEntry) {
496+ Warning("SetupProcDevice: could not create " VMBLOCK_DEVICE "\n");
497+ remove_proc_entry(VMBLOCK_CONTROL_MOUNTPOINT, controlProcDirEntry);
498+ remove_proc_entry(VMBLOCK_CONTROL_PROC_DIRNAME, NULL);
499+ return -EINVAL;
500+ }
501+
502+ controlProcEntry->proc_fops = &ControlFileOps;
503+ return 0;
504+}
505+
506+
507+/*
508+ *----------------------------------------------------------------------------
509+ *
510+ * CleanupProcDevice --
511+ *
512+ * Removes /proc entries for controlling file blocks.
513+ *
514+ * Results:
515+ * Zero on success, negative error code on failure.
516+ *
517+ * Side effects:
518+ * None.
519+ *
520+ *----------------------------------------------------------------------------
521+ */
522+
523+static int
524+CleanupProcDevice(void)
525+{
526+ if (controlProcDirEntry) {
527+ remove_proc_entry(VMBLOCK_CONTROL_MOUNTPOINT, controlProcDirEntry);
528+ remove_proc_entry(VMBLOCK_CONTROL_DEVNAME, controlProcDirEntry);
529+ remove_proc_entry(VMBLOCK_CONTROL_PROC_DIRNAME, NULL);
530+ }
531+ return 0;
532+}
533+
534+
535+/* procfs file operations */
536+
537+
538+/*
539+ *----------------------------------------------------------------------------
540+ *
541+ * ExecuteBlockOp --
542+ *
543+ * Copy block name from user buffer into kernel space, canonicalize it
544+ * by removing all trailing path separators, and execute desired block
545+ * operation.
546+ *
547+ * Results:
548+ * 0 on success, negative error code on failure.
549+ *
550+ * Side effects:
551+ * None.
552+ *
553+ *----------------------------------------------------------------------------
554+ */
555+
556+static int
557+ExecuteBlockOp(const char __user *buf, // IN: buffer with name
558+ const os_blocker_id_t blocker, // IN: blocker ID (file)
559+ int (*blockOp)(const char *filename, // IN: block operation
560+ const os_blocker_id_t blocker))
561+{
562+ char *name;
563+ int i;
564+ int retval;
565+
566+ name = getname(buf);
567+ if (IS_ERR(name)) {
568+ return PTR_ERR(name);
569+ }
570+
571+ for (i = strlen(name) - 1; i >= 0 && name[i] == '/'; i--) {
572+ name[i] = '\0';
573+ }
574+
575+ retval = i < 0 ? -EINVAL : blockOp(name, blocker);
576+
577+ putname(name);
578+
579+ return retval;
580+}
581+
582+/*
583+ *----------------------------------------------------------------------------
584+ *
585+ * ControlFileOpWrite --
586+ *
587+ * write implementation for our control file. This accepts either add or
588+ * delete commands and the buffer contains the file to block.
589+ *
590+ * Results:
591+ * Zero on success, negative error code on failure.
592+ *
593+ * Side effects:
594+ * None.
595+ *
596+ *----------------------------------------------------------------------------
597+ */
598+
599+ssize_t
600+ControlFileOpWrite(struct file *file, // IN: Opened file, used for ID
601+ const char __user *buf, // IN: NUL-terminated filename
602+ size_t cmd, // IN: VMBlock command (usually count)
603+ loff_t *ppos) // IN/OUT: File offset (unused)
604+{
605+ int ret;
606+
607+ switch (cmd) {
608+ case VMBLOCK_ADD_FILEBLOCK:
609+ ret = ExecuteBlockOp(buf, file, BlockAddFileBlock);
610+ break;
611+
612+ case VMBLOCK_DEL_FILEBLOCK:
613+ ret = ExecuteBlockOp(buf, file, BlockRemoveFileBlock);
614+ break;
615+
616+#ifdef VMX86_DEVEL
617+ case VMBLOCK_LIST_FILEBLOCKS:
618+ BlockListFileBlocks();
619+ ret = 0;
620+ break;
621+#endif
622+
623+ default:
624+ Warning("ControlFileOpWrite: unrecognized command (%u) recieved\n",
625+ (unsigned)cmd);
626+ ret = -EINVAL;
627+ break;
628+ }
629+
630+ return ret;
631+}
632+
633+
634+/*
635+ *----------------------------------------------------------------------------
636+ *
637+ * ControlFileOpRelease --
638+ *
639+ * Called when the file is closed.
640+ *
641+ * Results:
642+ * Zero on success, negative error code on failure.
643+ *
644+ * Side effects:
645+ * None.
646+ *
647+ *----------------------------------------------------------------------------
648+ */
649+
650+static int
651+ControlFileOpRelease(struct inode *inode, // IN
652+ struct file *file) // IN
653+{
654+ BlockRemoveAllBlocks(file);
655+ return 0;
656+}
657
658=== added file '.pc/0005-linux-310-fix.patch/modules/linux/vmblock/linux/dentry.c'
659--- .pc/0005-linux-310-fix.patch/modules/linux/vmblock/linux/dentry.c 1970-01-01 00:00:00 +0000
660+++ .pc/0005-linux-310-fix.patch/modules/linux/vmblock/linux/dentry.c 2013-09-21 20:15:28 +0000
661@@ -0,0 +1,118 @@
662+/*********************************************************
663+ * Copyright (C) 2006 VMware, Inc. All rights reserved.
664+ *
665+ * This program is free software; you can redistribute it and/or modify it
666+ * under the terms of the GNU General Public License as published by the
667+ * Free Software Foundation version 2 and no later version.
668+ *
669+ * This program is distributed in the hope that it will be useful, but
670+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
671+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
672+ * for more details.
673+ *
674+ * You should have received a copy of the GNU General Public License along
675+ * with this program; if not, write to the Free Software Foundation, Inc.,
676+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
677+ *
678+ *********************************************************/
679+
680+/*
681+ * dentry.c --
682+ *
683+ * Dentry operations for the file system of the vmblock driver.
684+ *
685+ */
686+
687+#include "driver-config.h"
688+
689+#include <linux/fs.h>
690+#include "compat_namei.h"
691+#include "vmblockInt.h"
692+#include "filesystem.h"
693+#include "block.h"
694+
695+
696+static int DentryOpRevalidate(struct dentry *dentry, struct nameidata *nd);
697+
698+struct dentry_operations LinkDentryOps = {
699+ .d_revalidate = DentryOpRevalidate,
700+};
701+
702+
703+/*
704+ *----------------------------------------------------------------------------
705+ *
706+ * DentryOpRevalidate --
707+ *
708+ * This function is invoked every time the dentry is accessed from the cache
709+ * to ensure it is still valid. We use it to block since any threads
710+ * looking up this dentry after the initial lookup should still block if the
711+ * block has not been cleared.
712+ *
713+ * Results:
714+ * 1 if the dentry is valid, 0 if it is not.
715+ *
716+ * Side effects:
717+ * None.
718+ *
719+ *----------------------------------------------------------------------------
720+ */
721+
722+static int
723+DentryOpRevalidate(struct dentry *dentry, // IN: dentry revalidating
724+ struct nameidata *nd) // IN: lookup flags & intent
725+{
726+ VMBlockInodeInfo *iinfo;
727+ struct nameidata actualNd;
728+ struct dentry *actualDentry;
729+ int ret;
730+
731+ if (!dentry) {
732+ Warning("DentryOpRevalidate: invalid args from kernel\n");
733+ return 0;
734+ }
735+
736+ /*
737+ * If a dentry does not have an inode associated with it then
738+ * we are dealing with a negative dentry. Always invalidate a negative
739+ * dentry which will cause a fresh lookup.
740+ */
741+ if (!dentry->d_inode) {
742+ return 0;
743+ }
744+
745+
746+ iinfo = INODE_TO_IINFO(dentry->d_inode);
747+ if (!iinfo) {
748+ Warning("DentryOpRevalidate: dentry has no fs-specific data\n");
749+ return 0;
750+ }
751+
752+ /* Block if there is a pending block on this file */
753+ BlockWaitOnFile(iinfo->name, NULL);
754+
755+ /*
756+ * If the actual dentry has a revalidate function, we'll let it figure out
757+ * whether the dentry is still valid. If not, do a path lookup to ensure
758+ * that the file still exists.
759+ */
760+ actualDentry = iinfo->actualDentry;
761+
762+ if (actualDentry &&
763+ actualDentry->d_op &&
764+ actualDentry->d_op->d_revalidate) {
765+ return actualDentry->d_op->d_revalidate(actualDentry, nd);
766+ }
767+
768+ if (compat_path_lookup(iinfo->name, 0, &actualNd)) {
769+ LOG(4, "DentryOpRevalidate: [%s] no longer exists\n", iinfo->name);
770+ return 0;
771+ }
772+ ret = compat_vmw_nd_to_dentry(actualNd) &&
773+ compat_vmw_nd_to_dentry(actualNd)->d_inode;
774+ compat_path_release(&actualNd);
775+
776+ LOG(8, "DentryOpRevalidate: [%s] %s revalidated\n",
777+ iinfo->name, ret ? "" : "not");
778+ return ret;
779+}
780
781=== added file '.pc/0005-linux-310-fix.patch/modules/linux/vmblock/linux/inode.c'
782--- .pc/0005-linux-310-fix.patch/modules/linux/vmblock/linux/inode.c 1970-01-01 00:00:00 +0000
783+++ .pc/0005-linux-310-fix.patch/modules/linux/vmblock/linux/inode.c 2013-09-21 20:15:28 +0000
784@@ -0,0 +1,232 @@
785+/*********************************************************
786+ * Copyright (C) 2006 VMware, Inc. All rights reserved.
787+ *
788+ * This program is free software; you can redistribute it and/or modify it
789+ * under the terms of the GNU General Public License as published by the
790+ * Free Software Foundation version 2 and no later version.
791+ *
792+ * This program is distributed in the hope that it will be useful, but
793+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
794+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
795+ * for more details.
796+ *
797+ * You should have received a copy of the GNU General Public License along
798+ * with this program; if not, write to the Free Software Foundation, Inc.,
799+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
800+ *
801+ *********************************************************/
802+
803+/*
804+ * inode.c --
805+ *
806+ * Inode operations for the file system of the vmblock driver.
807+ *
808+ */
809+
810+#include "driver-config.h"
811+#include <linux/module.h>
812+#include <linux/fs.h>
813+#include <linux/time.h>
814+#include <linux/namei.h>
815+
816+#include "vmblockInt.h"
817+#include "filesystem.h"
818+#include "block.h"
819+
820+
821+/* Inode operations */
822+static struct dentry *InodeOpLookup(struct inode *dir,
823+ struct dentry *dentry, struct nameidata *nd);
824+static int InodeOpReadlink(struct dentry *dentry, char __user *buffer, int buflen);
825+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
826+static void *InodeOpFollowlink(struct dentry *dentry, struct nameidata *nd);
827+#else
828+static int InodeOpFollowlink(struct dentry *dentry, struct nameidata *nd);
829+#endif
830+
831+
832+struct inode_operations RootInodeOps = {
833+ .lookup = InodeOpLookup,
834+};
835+
836+static struct inode_operations LinkInodeOps = {
837+ .readlink = InodeOpReadlink,
838+ .follow_link = InodeOpFollowlink,
839+};
840+
841+
842+/*
843+ *----------------------------------------------------------------------------
844+ *
845+ * InodeOpLookup --
846+ *
847+ * Looks up a name (dentry) in provided directory. Invoked every time
848+ * a directory entry is traversed in path lookups.
849+ *
850+ * Results:
851+ * NULL on success, negative error code on error.
852+ *
853+ * Side effects:
854+ * None.
855+ *
856+ *----------------------------------------------------------------------------
857+ */
858+
859+static struct dentry *
860+InodeOpLookup(struct inode *dir, // IN: parent directory's inode
861+ struct dentry *dentry, // IN: dentry to lookup
862+ struct nameidata *nd) // IN: lookup intent and information
863+{
864+ char *filename;
865+ struct inode *inode;
866+ int ret;
867+
868+ if (!dir || !dentry) {
869+ Warning("InodeOpLookup: invalid args from kernel\n");
870+ return ERR_PTR(-EINVAL);
871+ }
872+
873+ /* The kernel should only pass us our own inodes, but check just to be safe. */
874+ if (!INODE_TO_IINFO(dir)) {
875+ Warning("InodeOpLookup: invalid inode provided\n");
876+ return ERR_PTR(-EINVAL);
877+ }
878+
879+ /* Get a slab from the kernel's names_cache of PATH_MAX-sized buffers. */
880+ filename = __getname();
881+ if (!filename) {
882+ Warning("InodeOpLookup: unable to obtain memory for filename.\n");
883+ return ERR_PTR(-ENOMEM);
884+ }
885+
886+ ret = MakeFullName(dir, dentry, filename, PATH_MAX);
887+ if (ret < 0) {
888+ Warning("InodeOpLookup: could not construct full name\n");
889+ __putname(filename);
890+ return ERR_PTR(ret);
891+ }
892+
893+ /* Block if there is a pending block on this file */
894+ BlockWaitOnFile(filename, NULL);
895+ __putname(filename);
896+
897+ inode = Iget(dir->i_sb, dir, dentry, GetNextIno());
898+ if (!inode) {
899+ Warning("InodeOpLookup: failed to get inode\n");
900+ return ERR_PTR(-ENOMEM);
901+ }
902+
903+ dentry->d_op = &LinkDentryOps;
904+ dentry->d_time = jiffies;
905+
906+ /*
907+ * If the actual file's dentry doesn't have an inode, it means the file we
908+ * are redirecting to doesn't exist. Give back the inode that was created
909+ * for this and add a NULL dentry->inode entry in the dcache. (The NULL
910+ * entry is added so ops to create files/directories are invoked by VFS.)
911+ */
912+ if (!INODE_TO_ACTUALDENTRY(inode) || !INODE_TO_ACTUALINODE(inode)) {
913+ iput(inode);
914+ d_add(dentry, NULL);
915+ return NULL;
916+ }
917+
918+ inode->i_mode = S_IFLNK | S_IRWXUGO;
919+ inode->i_size = INODE_TO_IINFO(inode)->nameLen;
920+ inode->i_version = 1;
921+ inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
922+ inode->i_uid = inode->i_gid = 0;
923+ inode->i_op = &LinkInodeOps;
924+
925+ d_add(dentry, inode);
926+ return NULL;
927+}
928+
929+
930+/*
931+ *----------------------------------------------------------------------------
932+ *
933+ * InodeOpReadlink --
934+ *
935+ * Provides the symbolic link's contents to the user. Invoked when
936+ * readlink(2) is invoked on our symlinks.
937+ *
938+ * Results:
939+ * 0 on success, negative error code on failure.
940+ *
941+ * Side effects:
942+ * None.
943+ *
944+ *----------------------------------------------------------------------------
945+ */
946+
947+static int
948+InodeOpReadlink(struct dentry *dentry, // IN : dentry of symlink
949+ char __user *buffer, // OUT: output buffer (user space)
950+ int buflen) // IN : length of output buffer
951+{
952+ VMBlockInodeInfo *iinfo;
953+
954+ if (!dentry || !buffer) {
955+ Warning("InodeOpReadlink: invalid args from kernel\n");
956+ return -EINVAL;
957+ }
958+
959+ iinfo = INODE_TO_IINFO(dentry->d_inode);
960+ if (!iinfo) {
961+ return -EINVAL;
962+ }
963+
964+ return vfs_readlink(dentry, buffer, buflen, iinfo->name);
965+}
966+
967+
968+/*
969+ *----------------------------------------------------------------------------
970+ *
971+ * InodeOpFollowlink --
972+ *
973+ * Provides the inode corresponding to this symlink through the nameidata
974+ * structure.
975+ *
976+ * Results:
977+ * 0 on success, negative error on failure.
978+ *
979+ * Side effects:
980+ * None.
981+ *
982+ *----------------------------------------------------------------------------
983+ */
984+
985+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
986+static void *
987+#else
988+static int
989+#endif
990+InodeOpFollowlink(struct dentry *dentry, // IN : dentry of symlink
991+ struct nameidata *nd) // OUT: stores result
992+{
993+ int ret;
994+ VMBlockInodeInfo *iinfo;
995+
996+ if (!dentry) {
997+ Warning("InodeOpReadlink: invalid args from kernel\n");
998+ ret = -EINVAL;
999+ goto out;
1000+ }
1001+
1002+ iinfo = INODE_TO_IINFO(dentry->d_inode);
1003+ if (!iinfo) {
1004+ ret = -EINVAL;
1005+ goto out;
1006+ }
1007+
1008+ ret = vfs_follow_link(nd, iinfo->name);
1009+
1010+out:
1011+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
1012+ return ERR_PTR(ret);
1013+#else
1014+ return ret;
1015+#endif
1016+}
1017
1018=== added directory '.pc/0005-linux-310-fix.patch/modules/linux/vmhgfs'
1019=== added file '.pc/0005-linux-310-fix.patch/modules/linux/vmhgfs/file.c'
1020--- .pc/0005-linux-310-fix.patch/modules/linux/vmhgfs/file.c 1970-01-01 00:00:00 +0000
1021+++ .pc/0005-linux-310-fix.patch/modules/linux/vmhgfs/file.c 2013-09-21 20:15:28 +0000
1022@@ -0,0 +1,1280 @@
1023+/*********************************************************
1024+ * Copyright (C) 2006 VMware, Inc. All rights reserved.
1025+ *
1026+ * This program is free software; you can redistribute it and/or modify it
1027+ * under the terms of the GNU General Public License as published by the
1028+ * Free Software Foundation version 2 and no later version.
1029+ *
1030+ * This program is distributed in the hope that it will be useful, but
1031+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1032+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1033+ * for more details.
1034+ *
1035+ * You should have received a copy of the GNU General Public License along
1036+ * with this program; if not, write to the Free Software Foundation, Inc.,
1037+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1038+ *
1039+ *********************************************************/
1040+
1041+/*
1042+ * file.c --
1043+ *
1044+ * File operations for the filesystem portion of the vmhgfs driver.
1045+ */
1046+
1047+/* Must come before any kernel header file. */
1048+#include "driver-config.h"
1049+
1050+#include <linux/errno.h>
1051+#include <linux/module.h>
1052+#include <linux/signal.h>
1053+#include "compat_cred.h"
1054+#include "compat_fs.h"
1055+#include "compat_kernel.h"
1056+#include "compat_slab.h"
1057+
1058+#include "cpName.h"
1059+#include "hgfsProto.h"
1060+#include "module.h"
1061+#include "request.h"
1062+#include "hgfsUtil.h"
1063+#include "fsutil.h"
1064+#include "vm_assert.h"
1065+#include "vm_basic_types.h"
1066+
1067+/* Private functions. */
1068+static int HgfsPackOpenRequest(struct inode *inode,
1069+ struct file *file,
1070+ HgfsOp opUsed,
1071+ HgfsReq *req);
1072+static int HgfsUnpackOpenReply(HgfsReq *req,
1073+ HgfsOp opUsed,
1074+ HgfsHandle *file,
1075+ HgfsLockType *lock);
1076+static int HgfsGetOpenFlags(uint32 flags);
1077+
1078+/* HGFS file operations for files. */
1079+static int HgfsOpen(struct inode *inode,
1080+ struct file *file);
1081+#if defined VMW_USE_AIO
1082+static ssize_t HgfsAioRead(struct kiocb *iocb,
1083+ const struct iovec *iov,
1084+ unsigned long numSegs,
1085+ loff_t offset);
1086+static ssize_t HgfsAioWrite(struct kiocb *iocb,
1087+ const struct iovec *iov,
1088+ unsigned long numSegs,
1089+ loff_t offset);
1090+#else
1091+static ssize_t HgfsRead(struct file *file,
1092+ char __user *buf,
1093+ size_t count,
1094+ loff_t *offset);
1095+static ssize_t HgfsWrite(struct file *file,
1096+ const char __user *buf,
1097+ size_t count,
1098+ loff_t *offset);
1099+#endif
1100+
1101+static loff_t HgfsSeek(struct file *file,
1102+ loff_t offset,
1103+ int origin);
1104+
1105+static int HgfsFsync(struct file *file,
1106+#if defined VMW_FSYNC_OLD
1107+ struct dentry *dentry,
1108+#elif defined VMW_FSYNC_31
1109+ loff_t start,
1110+ loff_t end,
1111+#endif
1112+ int datasync);
1113+static int HgfsMmap(struct file *file,
1114+ struct vm_area_struct *vma);
1115+static int HgfsRelease(struct inode *inode,
1116+ struct file *file);
1117+
1118+#ifndef VMW_SENDFILE_NONE
1119+#if defined VMW_SENDFILE_OLD
1120+static ssize_t HgfsSendfile(struct file *file,
1121+ loff_t *offset,
1122+ size_t count,
1123+ read_actor_t actor,
1124+ void __user *target);
1125+#else /* defined VMW_SENDFILE_NEW */
1126+static ssize_t HgfsSendfile(struct file *file,
1127+ loff_t *offset,
1128+ size_t count,
1129+ read_actor_t actor,
1130+ void *target);
1131+#endif
1132+#endif
1133+#ifdef VMW_SPLICE_READ
1134+static ssize_t HgfsSpliceRead(struct file *file,
1135+ loff_t *offset,
1136+ struct pipe_inode_info *pipe,
1137+ size_t len,
1138+ unsigned int flags);
1139+#endif
1140+
1141+/* HGFS file operations structure for files. */
1142+struct file_operations HgfsFileFileOperations = {
1143+ .owner = THIS_MODULE,
1144+ .open = HgfsOpen,
1145+ .llseek = HgfsSeek,
1146+#if defined VMW_USE_AIO
1147+ .aio_read = HgfsAioRead,
1148+ .aio_write = HgfsAioWrite,
1149+#else
1150+ .read = HgfsRead,
1151+ .write = HgfsWrite,
1152+#endif
1153+ .fsync = HgfsFsync,
1154+ .mmap = HgfsMmap,
1155+ .release = HgfsRelease,
1156+#ifndef VMW_SENDFILE_NONE
1157+ .sendfile = HgfsSendfile,
1158+#endif
1159+#ifdef VMW_SPLICE_READ
1160+ .splice_read = HgfsSpliceRead,
1161+#endif
1162+};
1163+
1164+/* File open mask. */
1165+#define HGFS_FILE_OPEN_MASK (HGFS_OPEN_VALID_MODE | \
1166+ HGFS_OPEN_VALID_FLAGS | \
1167+ HGFS_OPEN_VALID_SPECIAL_PERMS | \
1168+ HGFS_OPEN_VALID_OWNER_PERMS | \
1169+ HGFS_OPEN_VALID_GROUP_PERMS | \
1170+ HGFS_OPEN_VALID_OTHER_PERMS | \
1171+ HGFS_OPEN_VALID_FILE_NAME | \
1172+ HGFS_OPEN_VALID_SERVER_LOCK)
1173+
1174+
1175+/*
1176+ * Private functions.
1177+ */
1178+
1179+/*
1180+ *----------------------------------------------------------------------
1181+ *
1182+ * HgfsPackOpenRequest --
1183+ *
1184+ * Setup the Open request, depending on the op version.
1185+ *
1186+ * Results:
1187+ * Returns zero on success, or negative error on failure.
1188+ *
1189+ * Side effects:
1190+ * None
1191+ *
1192+ *----------------------------------------------------------------------
1193+ */
1194+
1195+static int
1196+HgfsPackOpenRequest(struct inode *inode, // IN: Inode of the file to open
1197+ struct file *file, // IN: File pointer for this open
1198+ HgfsOp opUsed, // IN: Op to use
1199+ HgfsReq *req) // IN/OUT: Packet to write into
1200+{
1201+ char *name;
1202+ uint32 *nameLength;
1203+ size_t requestSize;
1204+ int result;
1205+
1206+ ASSERT(inode);
1207+ ASSERT(file);
1208+ ASSERT(req);
1209+
1210+ switch (opUsed) {
1211+ case HGFS_OP_OPEN_V3: {
1212+ HgfsRequest *requestHeader;
1213+ HgfsRequestOpenV3 *requestV3;
1214+
1215+ requestHeader = (HgfsRequest *)HGFS_REQ_PAYLOAD(req);
1216+ requestHeader->op = opUsed;
1217+ requestHeader->id = req->id;
1218+
1219+ requestV3 = (HgfsRequestOpenV3 *)HGFS_REQ_PAYLOAD_V3(req);
1220+ requestSize = HGFS_REQ_PAYLOAD_SIZE_V3(requestV3);
1221+
1222+ /* We'll use these later. */
1223+ name = requestV3->fileName.name;
1224+ nameLength = &requestV3->fileName.length;
1225+
1226+ requestV3->mask = HGFS_FILE_OPEN_MASK;
1227+
1228+ /* Linux clients need case-sensitive lookups. */
1229+ requestV3->fileName.flags = 0;
1230+ requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
1231+ requestV3->fileName.fid = HGFS_INVALID_HANDLE;
1232+
1233+ /* Set mode. */
1234+ result = HgfsGetOpenMode(file->f_flags);
1235+ if (result < 0) {
1236+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsPackOpenRequest: failed to get "
1237+ "open mode\n"));
1238+ return -EINVAL;
1239+ }
1240+ requestV3->mode = result;
1241+
1242+ /* Set flags. */
1243+ result = HgfsGetOpenFlags(file->f_flags);
1244+ if (result < 0) {
1245+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsPackOpenRequest: failed to get "
1246+ "open flags\n"));
1247+ return -EINVAL;
1248+ }
1249+ requestV3->flags = result;
1250+
1251+ /* Set permissions. */
1252+ requestV3->specialPerms = (inode->i_mode & (S_ISUID | S_ISGID | S_ISVTX))
1253+ >> 9;
1254+ requestV3->ownerPerms = (inode->i_mode & S_IRWXU) >> 6;
1255+ requestV3->groupPerms = (inode->i_mode & S_IRWXG) >> 3;
1256+ requestV3->otherPerms = (inode->i_mode & S_IRWXO);
1257+
1258+ /* XXX: Request no lock for now. */
1259+ requestV3->desiredLock = HGFS_LOCK_NONE;
1260+
1261+ requestV3->reserved1 = 0;
1262+ requestV3->reserved2 = 0;
1263+ break;
1264+ }
1265+
1266+ case HGFS_OP_OPEN_V2: {
1267+ HgfsRequestOpenV2 *requestV2;
1268+
1269+ requestV2 = (HgfsRequestOpenV2 *)(HGFS_REQ_PAYLOAD(req));
1270+ requestV2->header.op = opUsed;
1271+ requestV2->header.id = req->id;
1272+
1273+ /* We'll use these later. */
1274+ name = requestV2->fileName.name;
1275+ nameLength = &requestV2->fileName.length;
1276+ requestSize = sizeof *requestV2;
1277+
1278+ requestV2->mask = HGFS_FILE_OPEN_MASK;
1279+
1280+ /* Set mode. */
1281+ result = HgfsGetOpenMode(file->f_flags);
1282+ if (result < 0) {
1283+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsPackOpenRequest: failed to get "
1284+ "open mode\n"));
1285+ return -EINVAL;
1286+ }
1287+ requestV2->mode = result;
1288+
1289+ /* Set flags. */
1290+ result = HgfsGetOpenFlags(file->f_flags);
1291+ if (result < 0) {
1292+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsPackOpenRequest: failed to get "
1293+ "open flags\n"));
1294+ return -EINVAL;
1295+ }
1296+ requestV2->flags = result;
1297+
1298+ /* Set permissions. */
1299+ requestV2->specialPerms = (inode->i_mode & (S_ISUID | S_ISGID | S_ISVTX))
1300+ >> 9;
1301+ requestV2->ownerPerms = (inode->i_mode & S_IRWXU) >> 6;
1302+ requestV2->groupPerms = (inode->i_mode & S_IRWXG) >> 3;
1303+ requestV2->otherPerms = (inode->i_mode & S_IRWXO);
1304+
1305+ /* XXX: Request no lock for now. */
1306+ requestV2->desiredLock = HGFS_LOCK_NONE;
1307+ break;
1308+ }
1309+ case HGFS_OP_OPEN: {
1310+ HgfsRequestOpen *request;
1311+
1312+ request = (HgfsRequestOpen *)(HGFS_REQ_PAYLOAD(req));
1313+ request->header.op = opUsed;
1314+ request->header.id = req->id;
1315+
1316+ /* We'll use these later. */
1317+ name = request->fileName.name;
1318+ nameLength = &request->fileName.length;
1319+ requestSize = sizeof *request;
1320+
1321+ /* Set mode. */
1322+ result = HgfsGetOpenMode(file->f_flags);
1323+ if (result < 0) {
1324+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsPackOpenRequest: failed to get "
1325+ "open mode\n"));
1326+ return -EINVAL;
1327+ }
1328+ request->mode = result;
1329+
1330+ /* Set flags. */
1331+ result = HgfsGetOpenFlags(file->f_flags);
1332+ if (result < 0) {
1333+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsPackOpenRequest: failed to get "
1334+ "open flags\n"));
1335+ return -EINVAL;
1336+ }
1337+ request->flags = result;
1338+
1339+ /* Set permissions. */
1340+ request->permissions = (inode->i_mode & S_IRWXU) >> 6;
1341+ break;
1342+ }
1343+ default:
1344+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsPackOpenRequest: unexpected "
1345+ "OP type encountered\n"));
1346+ return -EPROTO;
1347+ }
1348+
1349+ /* Build full name to send to server. */
1350+ if (HgfsBuildPath(name,
1351+ req->bufferSize - (requestSize - 1),
1352+ file->f_dentry) < 0) {
1353+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsPackOpenRequest: build path "
1354+ "failed\n"));
1355+ return -EINVAL;
1356+ }
1357+ LOG(6, (KERN_DEBUG "VMware hgfs: HgfsPackOpenRequest: opening \"%s\", "
1358+ "flags %o, create perms %o\n", name,
1359+ file->f_flags, file->f_mode));
1360+
1361+ /* Convert to CP name. */
1362+ result = CPName_ConvertTo(name,
1363+ req->bufferSize - (requestSize - 1),
1364+ name);
1365+ if (result < 0) {
1366+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsPackOpenRequest: CP conversion "
1367+ "failed\n"));
1368+ return -EINVAL;
1369+ }
1370+
1371+ *nameLength = (uint32) result;
1372+ req->payloadSize = requestSize + result;
1373+
1374+ return 0;
1375+}
1376+
1377+
1378+/*
1379+ *----------------------------------------------------------------------
1380+ *
1381+ * HgfsUnpackOpenReply --
1382+ *
1383+ * Get interesting fields out of the Open reply, depending on the op
1384+ * version.
1385+ *
1386+ * Results:
1387+ * Returns zero on success, or negative error on failure.
1388+ *
1389+ * Side effects:
1390+ * None
1391+ *
1392+ *----------------------------------------------------------------------
1393+ */
1394+
1395+static int
1396+HgfsUnpackOpenReply(HgfsReq *req, // IN: Packet with reply inside
1397+ HgfsOp opUsed, // IN: What request op did we send
1398+ HgfsHandle *file, // OUT: Handle in reply packet
1399+ HgfsLockType *lock) // OUT: The server lock we got
1400+{
1401+ HgfsReplyOpenV3 *replyV3;
1402+ HgfsReplyOpenV2 *replyV2;
1403+ HgfsReplyOpen *replyV1;
1404+ size_t replySize;
1405+
1406+ ASSERT(req);
1407+ ASSERT(file);
1408+ ASSERT(lock);
1409+
1410+ switch (opUsed) {
1411+ case HGFS_OP_OPEN_V3:
1412+ replyV3 = (HgfsReplyOpenV3 *)HGFS_REP_PAYLOAD_V3(req);
1413+ replySize = HGFS_REP_PAYLOAD_SIZE_V3(replyV3);
1414+ *file = replyV3->file;
1415+ *lock = replyV3->acquiredLock;
1416+ break;
1417+ case HGFS_OP_OPEN_V2:
1418+ replyV2 = (HgfsReplyOpenV2 *)(HGFS_REQ_PAYLOAD(req));
1419+ replySize = sizeof *replyV2;
1420+ *file = replyV2->file;
1421+ *lock = replyV2->acquiredLock;
1422+ break;
1423+ case HGFS_OP_OPEN:
1424+ replyV1 = (HgfsReplyOpen *)(HGFS_REQ_PAYLOAD(req));
1425+ replySize = sizeof *replyV1;
1426+ *file = replyV1->file;
1427+ *lock = HGFS_LOCK_NONE;
1428+ break;
1429+ default:
1430+
1431+ /* This really shouldn't happen since we set opUsed ourselves. */
1432+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsUnpackOpenReply: unexpected "
1433+ "OP type encountered\n"));
1434+ ASSERT(FALSE);
1435+ return -EPROTO;
1436+ }
1437+
1438+ if (req->payloadSize != replySize) {
1439+ /*
1440+ * The reply to Open is a fixed size. So the size of the payload
1441+ * really ought to match the expected size of an HgfsReplyOpen[V2].
1442+ */
1443+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsUnpackOpenReply: wrong packet "
1444+ "size\n"));
1445+ return -EPROTO;
1446+ }
1447+ return 0;
1448+}
1449+
1450+
1451+/*
1452+ *----------------------------------------------------------------------
1453+ *
1454+ * HgfsGetOpenFlags --
1455+ *
1456+ * Based on the flags requested by the process making the open()
1457+ * syscall, determine which flags to send to the server to open the
1458+ * file.
1459+ *
1460+ * Results:
1461+ * Returns the correct HgfsOpenFlags enumeration to send to the
1462+ * server, or -1 on failure.
1463+ *
1464+ * Side effects:
1465+ * None
1466+ *
1467+ *----------------------------------------------------------------------
1468+ */
1469+
1470+static int
1471+HgfsGetOpenFlags(uint32 flags) // IN: Open flags
1472+{
1473+ uint32 mask = O_CREAT | O_TRUNC | O_EXCL;
1474+ int result = -1;
1475+
1476+ LOG(6, (KERN_DEBUG "VMware hgfs: HgfsGetOpenFlags: entered\n"));
1477+
1478+ /*
1479+ * Mask the flags to only look at O_CREAT, O_EXCL, and O_TRUNC.
1480+ */
1481+
1482+ flags &= mask;
1483+
1484+ /* O_EXCL has no meaning if O_CREAT is not set. */
1485+ if (!(flags & O_CREAT)) {
1486+ flags &= ~O_EXCL;
1487+ }
1488+
1489+ /* Pick the right HgfsOpenFlags. */
1490+ switch (flags) {
1491+
1492+ case 0:
1493+ /* Regular open; fails if file nonexistant. */
1494+ result = HGFS_OPEN;
1495+ break;
1496+
1497+ case O_CREAT:
1498+ /* Create file; if it exists already just open it. */
1499+ result = HGFS_OPEN_CREATE;
1500+ break;
1501+
1502+ case O_TRUNC:
1503+ /* Truncate existing file; fails if nonexistant. */
1504+ result = HGFS_OPEN_EMPTY;
1505+ break;
1506+
1507+ case (O_CREAT | O_EXCL):
1508+ /* Create file; fail if it exists already. */
1509+ result = HGFS_OPEN_CREATE_SAFE;
1510+ break;
1511+
1512+ case (O_CREAT | O_TRUNC):
1513+ /* Create file; if it exists already, truncate it. */
1514+ result = HGFS_OPEN_CREATE_EMPTY;
1515+ break;
1516+
1517+ default:
1518+ /*
1519+ * This can only happen if all three flags are set, which
1520+ * conceptually makes no sense because O_EXCL and O_TRUNC are
1521+ * mutually exclusive if O_CREAT is set.
1522+ *
1523+ * However, the open(2) man page doesn't say you can't set all
1524+ * three flags, and certain apps (*cough* Nautilus *cough*) do
1525+ * so. To be friendly to those apps, we just silenty drop the
1526+ * O_TRUNC flag on the assumption that it's safer to honor
1527+ * O_EXCL.
1528+ */
1529+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsGetOpenFlags: invalid open "
1530+ "flags %o. Ignoring the O_TRUNC flag.\n", flags));
1531+ result = HGFS_OPEN_CREATE_SAFE;
1532+ break;
1533+ }
1534+
1535+ return result;
1536+}
1537+
1538+
1539+/*
1540+ * HGFS file operations for files.
1541+ */
1542+
1543+/*
1544+ *----------------------------------------------------------------------
1545+ *
1546+ * HgfsOpen --
1547+ *
1548+ * Called whenever a process opens a file in our filesystem.
1549+ *
1550+ * We send an "Open" request to the server with the name stored in
1551+ * this file's inode. If the Open succeeds, we store the filehandle
1552+ * sent by the server in the file struct so it can be accessed by
1553+ * read/write/close.
1554+ *
1555+ * Results:
1556+ * Returns zero if on success, error on failure.
1557+ *
1558+ * Side effects:
1559+ * None
1560+ *
1561+ *----------------------------------------------------------------------
1562+ */
1563+
1564+static int
1565+HgfsOpen(struct inode *inode, // IN: Inode of the file to open
1566+ struct file *file) // IN: File pointer for this open
1567+{
1568+ HgfsReq *req;
1569+ HgfsOp opUsed;
1570+ HgfsStatus replyStatus;
1571+ HgfsHandle replyFile;
1572+ HgfsLockType replyLock;
1573+ HgfsInodeInfo *iinfo;
1574+ int result = 0;
1575+
1576+ ASSERT(inode);
1577+ ASSERT(inode->i_sb);
1578+ ASSERT(file);
1579+ ASSERT(file->f_dentry);
1580+ ASSERT(file->f_dentry->d_inode);
1581+
1582+ iinfo = INODE_GET_II_P(inode);
1583+
1584+ req = HgfsGetNewRequest();
1585+ if (!req) {
1586+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsOpen: out of memory while "
1587+ "getting new request\n"));
1588+ result = -ENOMEM;
1589+ goto out;
1590+ }
1591+
1592+ retry:
1593+ /*
1594+ * Set up pointers using the proper struct This lets us check the
1595+ * version exactly once and use the pointers later.
1596+ */
1597+
1598+ opUsed = hgfsVersionOpen;
1599+ result = HgfsPackOpenRequest(inode, file, opUsed, req);
1600+ if (result != 0) {
1601+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsOpen: error packing request\n"));
1602+ goto out;
1603+ }
1604+
1605+ /* Send the request and process the reply. */
1606+ result = HgfsSendRequest(req);
1607+ if (result == 0) {
1608+ /* Get the reply and check return status. */
1609+ replyStatus = HgfsReplyStatus(req);
1610+ result = HgfsStatusConvertToLinux(replyStatus);
1611+
1612+ switch (result) {
1613+ case 0:
1614+ iinfo->createdAndUnopened = FALSE;
1615+ LOG(10, (KERN_DEBUG "VMware hgfs: HgfsOpen: old hostFileId = "
1616+ "%"FMT64"u\n", iinfo->hostFileId));
1617+ /*
1618+ * Invalidate the hostFileId as we need to retrieve it from
1619+ * the server.
1620+ */
1621+ iinfo->hostFileId = 0;
1622+ result = HgfsUnpackOpenReply(req, opUsed, &replyFile, &replyLock);
1623+ if (result != 0) {
1624+ break;
1625+ }
1626+ result = HgfsCreateFileInfo(file, replyFile);
1627+ if (result != 0) {
1628+ break;
1629+ }
1630+ LOG(6, (KERN_DEBUG "VMware hgfs: HgfsOpen: set handle to %u\n",
1631+ replyFile));
1632+
1633+ /*
1634+ * HgfsCreate faked all of the inode's attributes, so by the time
1635+ * we're done in HgfsOpen, we need to make sure that the attributes
1636+ * in the inode are real. The following is only necessary when
1637+ * O_CREAT is set, otherwise we got here after HgfsLookup (which sent
1638+ * a getattr to the server and got the real attributes).
1639+ *
1640+ * In particular, we'd like to at least try and set the inode's
1641+ * uid/gid to match the caller's. We don't expect this to work,
1642+ * because Windows servers will ignore it, and Linux servers running
1643+ * as non-root won't be able to change it, but we're forward thinking
1644+ * people.
1645+ *
1646+ * Either way, we force a revalidate following the setattr so that
1647+ * we'll get the actual uid/gid from the server.
1648+ */
1649+ if (file->f_flags & O_CREAT) {
1650+ struct dentry *dparent;
1651+ struct inode *iparent;
1652+
1653+ /*
1654+ * This is not the root of our file system so there should always
1655+ * be a parent.
1656+ */
1657+ ASSERT(file->f_dentry->d_parent);
1658+
1659+ /*
1660+ * Here we obtain a reference on the parent to make sure it doesn't
1661+ * go away. This might not be necessary, since the existence of
1662+ * a child (which we hold a reference to in this call) should
1663+ * account for a reference in the parent, but it's safe to do so.
1664+ * Overly cautious and safe is better than risky and broken.
1665+ *
1666+ * XXX Note that this and a handful of other hacks wouldn't be
1667+ * necessary if we actually created the file in our create
1668+ * implementation (where references and locks are properly held).
1669+ * We could do this if we were willing to give up support for
1670+ * O_EXCL on 2.4 kernels.
1671+ */
1672+ dparent = dget(file->f_dentry->d_parent);
1673+ iparent = dparent->d_inode;
1674+
1675+ HgfsSetUidGid(iparent, file->f_dentry,
1676+ current_fsuid(), current_fsgid());
1677+
1678+ dput(dparent);
1679+ }
1680+ break;
1681+
1682+ case -EPROTO:
1683+ /* Retry with older version(s). Set globally. */
1684+ if (opUsed == HGFS_OP_OPEN_V3) {
1685+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsOpen: Version 3 not "
1686+ "supported. Falling back to version 2.\n"));
1687+ hgfsVersionOpen = HGFS_OP_OPEN_V2;
1688+ goto retry;
1689+ }
1690+
1691+ /* Retry with Version 1 of Open. Set globally. */
1692+ if (opUsed == HGFS_OP_OPEN_V2) {
1693+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsOpen: Version 2 not "
1694+ "supported. Falling back to version 1.\n"));
1695+ hgfsVersionOpen = HGFS_OP_OPEN;
1696+ goto retry;
1697+ }
1698+
1699+ /* Fallthrough. */
1700+ default:
1701+ break;
1702+ }
1703+ } else if (result == -EIO) {
1704+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsOpen: timed out\n"));
1705+ } else if (result == -EPROTO) {
1706+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsOpen: server "
1707+ "returned error: %d\n", result));
1708+ } else {
1709+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsOpen: unknown error: "
1710+ "%d\n", result));
1711+ }
1712+out:
1713+ HgfsFreeRequest(req);
1714+
1715+ /*
1716+ * If the open failed (for any reason) and we tried to open a newly created
1717+ * file, we must ensure that the next operation on this inode triggers a
1718+ * revalidate to the server. This is because the file wasn't created on the
1719+ * server, yet we currently believe that it was, because we created a fake
1720+ * inode with a hashed dentry for it in HgfsCreate. We will continue to
1721+ * believe this until the dentry's ttl expires, which will cause a
1722+ * revalidate to the server that will reveal the truth. So in order to find
1723+ * the truth as soon as possible, we'll reset the dentry's last revalidate
1724+ * time now to force a revalidate the next time someone uses the dentry.
1725+ *
1726+ * We're using our own flag to track this case because using O_CREAT isn't
1727+ * good enough: HgfsOpen will be called with O_CREAT even if the file exists
1728+ * on the server, and if that's the case, there's no need to revalidate.
1729+ *
1730+ * XXX: Note that this will need to be reworked if/when we support hard
1731+ * links, because multiple dentries will point to the same inode, and
1732+ * forcing a revalidate on one will not force it on any others.
1733+ */
1734+ if (result != 0 && iinfo->createdAndUnopened == TRUE) {
1735+ HgfsDentryAgeForce(file->f_dentry);
1736+ }
1737+ return result;
1738+}
1739+
1740+
1741+#if defined VMW_USE_AIO
1742+/*
1743+ *----------------------------------------------------------------------
1744+ *
1745+ * HgfsAioRead --
1746+ *
1747+ * Called when the kernel initiates an asynchronous read to a file in
1748+ * our filesystem. Our function is just a thin wrapper around
1749+ * generic_file_aio_read() that tries to validate the dentry first.
1750+ *
1751+ * Results:
1752+ * Returns the number of bytes read on success, or an error on
1753+ * failure.
1754+ *
1755+ * Side effects:
1756+ * None
1757+ *
1758+ *----------------------------------------------------------------------
1759+ */
1760+
1761+static ssize_t
1762+HgfsAioRead(struct kiocb *iocb, // IN: I/O control block
1763+ const struct iovec *iov, // OUT: Array of I/O buffers
1764+ unsigned long numSegs, // IN: Number of buffers
1765+ loff_t offset) // IN: Offset at which to read
1766+{
1767+ int result;
1768+
1769+ ASSERT(iocb);
1770+ ASSERT(iocb->ki_filp);
1771+ ASSERT(iocb->ki_filp->f_dentry);
1772+ ASSERT(iov);
1773+
1774+ LOG(6, (KERN_DEBUG "VMware hgfs: HgfsAioRead: was called\n"));
1775+
1776+ result = HgfsRevalidate(iocb->ki_filp->f_dentry);
1777+ if (result) {
1778+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsAioRead: invalid dentry\n"));
1779+ goto out;
1780+ }
1781+
1782+ result = generic_file_aio_read(iocb, iov, numSegs, offset);
1783+ out:
1784+ return result;
1785+}
1786+
1787+
1788+/*
1789+ *----------------------------------------------------------------------
1790+ *
1791+ * HgfsAioWrite --
1792+ *
1793+ * Called when the kernel initiates an asynchronous write to a file in
1794+ * our filesystem. Our function is just a thin wrapper around
1795+ * generic_file_aio_write() that tries to validate the dentry first.
1796+ *
1797+ * Note that files opened with O_SYNC (or superblocks mounted with
1798+ * "sync") are synchronously written to by the VFS.
1799+ *
1800+ * Results:
1801+ * Returns the number of bytes written on success, or an error on
1802+ * failure.
1803+ *
1804+ * Side effects:
1805+ * None
1806+ *
1807+ *----------------------------------------------------------------------
1808+ */
1809+
1810+static ssize_t
1811+HgfsAioWrite(struct kiocb *iocb, // IN: I/O control block
1812+ const struct iovec *iov, // IN: Array of I/O buffers
1813+ unsigned long numSegs, // IN: Number of buffers
1814+ loff_t offset) // IN: Offset at which to read
1815+{
1816+ int result;
1817+
1818+ ASSERT(iocb);
1819+ ASSERT(iocb->ki_filp);
1820+ ASSERT(iocb->ki_filp->f_dentry);
1821+ ASSERT(iov);
1822+
1823+ LOG(6, (KERN_DEBUG "VMware hgfs: HgfsAioWrite: was called\n"));
1824+
1825+ result = HgfsRevalidate(iocb->ki_filp->f_dentry);
1826+ if (result) {
1827+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsAioWrite: invalid dentry\n"));
1828+ goto out;
1829+ }
1830+
1831+ result = generic_file_aio_write(iocb, iov, numSegs, offset);
1832+ out:
1833+ return result;
1834+}
1835+
1836+
1837+#else
1838+/*
1839+ *----------------------------------------------------------------------
1840+ *
1841+ * HgfsRead --
1842+ *
1843+ * Called whenever a process reads from a file in our filesystem. Our
1844+ * function is just a thin wrapper around generic_read_file() that
1845+ * tries to validate the dentry first.
1846+ *
1847+ * Results:
1848+ * Returns the number of bytes read on success, or an error on
1849+ * failure.
1850+ *
1851+ * Side effects:
1852+ * None
1853+ *
1854+ *----------------------------------------------------------------------
1855+ */
1856+
1857+static ssize_t
1858+HgfsRead(struct file *file, // IN: File to read from
1859+ char __user *buf, // OUT: User buffer to copy data into
1860+ size_t count, // IN: Number of bytes to read
1861+ loff_t *offset) // IN: Offset at which to read
1862+{
1863+ int result;
1864+
1865+ ASSERT(file);
1866+ ASSERT(file->f_dentry);
1867+ ASSERT(buf);
1868+ ASSERT(offset);
1869+
1870+ LOG(6, (KERN_DEBUG "VMware hgfs: HgfsRead: read %Zu bytes from fh %u "
1871+ "at offset %Lu\n", count, FILE_GET_FI_P(file)->handle, *offset));
1872+
1873+ result = HgfsRevalidate(file->f_dentry);
1874+ if (result) {
1875+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsRead: invalid dentry\n"));
1876+ goto out;
1877+ }
1878+
1879+ result = generic_file_read(file, buf, count, offset);
1880+ out:
1881+ return result;
1882+}
1883+
1884+
1885+/*
1886+ *----------------------------------------------------------------------
1887+ *
1888+ * HgfsWrite --
1889+ *
1890+ * Called whenever a process writes to a file in our filesystem. Our
1891+ * function is just a thin wrapper around generic_write_file() that
1892+ * tries to validate the dentry first.
1893+ *
1894+ * Note that files opened with O_SYNC (or superblocks mounted with
1895+ * "sync") are synchronously written to by the VFS.
1896+ *
1897+ * Results:
1898+ * Returns the number of bytes written on success, or an error on
1899+ * failure.
1900+ *
1901+ * Side effects:
1902+ * None
1903+ *
1904+ *----------------------------------------------------------------------
1905+ */
1906+
1907+static ssize_t
1908+HgfsWrite(struct file *file, // IN: File to write to
1909+ const char __user *buf, // IN: User buffer where the data is
1910+ size_t count, // IN: Number of bytes to write
1911+ loff_t *offset) // IN: Offset to begin writing at
1912+{
1913+ int result;
1914+
1915+ ASSERT(file);
1916+ ASSERT(file->f_dentry);
1917+ ASSERT(file->f_dentry->d_inode);
1918+ ASSERT(buf);
1919+ ASSERT(offset);
1920+
1921+ LOG(6, (KERN_DEBUG "VMware hgfs: HgfsWrite: write %Zu bytes to fh %u "
1922+ "at offset %Lu\n", count, FILE_GET_FI_P(file)->handle, *offset));
1923+
1924+ result = HgfsRevalidate(file->f_dentry);
1925+ if (result) {
1926+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsWrite: invalid dentry\n"));
1927+ goto out;
1928+ }
1929+
1930+ result = generic_file_write(file, buf, count, offset);
1931+ out:
1932+ return result;
1933+}
1934+#endif
1935+
1936+/*
1937+ *----------------------------------------------------------------------
1938+ *
1939+ * HgfsSeek --
1940+ *
1941+ * Called whenever a process moves the file pointer for a file in our
1942+ * filesystem. Our function is just a thin wrapper around
1943+ * generic_file_llseek() that tries to validate the dentry first.
1944+ *
1945+ * Results:
1946+ * Returns the new position of the file pointer on success,
1947+ * or a negative error on failure.
1948+ *
1949+ * Side effects:
1950+ * None
1951+ *
1952+ *----------------------------------------------------------------------
1953+ */
1954+
1955+static loff_t
1956+HgfsSeek(struct file *file, // IN: File to seek
1957+ loff_t offset, // IN: Number of bytes to seek
1958+ int origin) // IN: Position to seek from
1959+
1960+{
1961+ loff_t result = -1;
1962+
1963+ ASSERT(file);
1964+ ASSERT(file->f_dentry);
1965+
1966+ LOG(6, (KERN_DEBUG "VMware hgfs: HgfsSeek: seek to %Lu bytes from fh %u "
1967+ "from position %d\n", offset, FILE_GET_FI_P(file)->handle, origin));
1968+
1969+ result = (loff_t) HgfsRevalidate(file->f_dentry);
1970+ if (result) {
1971+ LOG(6, (KERN_DEBUG "VMware hgfs: HgfsSeek: invalid dentry\n"));
1972+ goto out;
1973+ }
1974+
1975+ result = generic_file_llseek(file, offset, origin);
1976+
1977+ out:
1978+ return result;
1979+}
1980+
1981+
1982+/*
1983+ *----------------------------------------------------------------------
1984+ *
1985+ * HgfsFsync --
1986+ *
1987+ * Called when user process calls fsync() on hgfs file.
1988+ *
1989+ * The hgfs protocol doesn't support fsync yet, so for now, we punt
1990+ * and just return success. This is a little less sketchy than it
1991+ * might sound, because hgfs skips the buffer cache in the guest
1992+ * anyway (we always write to the host immediately).
1993+ *
1994+ * In the future we might want to try harder though, since
1995+ * presumably the intent of an app calling fsync() is to get the
1996+ * data onto persistent storage, and as things stand now we're at
1997+ * the whim of the hgfs server code running on the host to fsync or
1998+ * not if and when it pleases.
1999+ *
2000+ * Note that do_fsync will call filemap_fdatawrite() before us and
2001+ * filemap_fdatawait() after us, so there's no need to do anything
2002+ * here w.r.t. writing out dirty pages.
2003+ *
2004+ * Results:
2005+ * Returns zero on success. (Currently always succeeds).
2006+ *
2007+ * Side effects:
2008+ * None.
2009+ *
2010+ *----------------------------------------------------------------------
2011+ */
2012+
2013+static int
2014+HgfsFsync(struct file *file, // IN: File we operate on
2015+#if defined VMW_FSYNC_OLD
2016+ struct dentry *dentry, // IN: Dentry for this file
2017+#elif defined VMW_FSYNC_31
2018+ loff_t start, // IN: start of range to sync
2019+ loff_t end, // IN: end of range to sync
2020+#endif
2021+ int datasync) // IN: fdatasync or fsync
2022+{
2023+ LOG(6, (KERN_DEBUG "VMware hgfs: HgfsFsync: was called\n"));
2024+
2025+ return 0;
2026+}
2027+
2028+
2029+/*
2030+ *----------------------------------------------------------------------
2031+ *
2032+ * HgfsMmap --
2033+ *
2034+ * Called when user process calls mmap() on hgfs file. This is a very
2035+ * thin wrapper function- we simply attempt to revalidate the
2036+ * dentry prior to calling generic_file_mmap().
2037+ *
2038+ * Results:
2039+ * Returns zero on success.
2040+ * Returns negative error value on failure
2041+ *
2042+ * Side effects:
2043+ * None.
2044+ *
2045+ *----------------------------------------------------------------------
2046+ */
2047+
2048+static int
2049+HgfsMmap(struct file *file, // IN: File we operate on
2050+ struct vm_area_struct *vma) // IN/OUT: VM area information
2051+{
2052+ int result;
2053+
2054+ ASSERT(file);
2055+ ASSERT(vma);
2056+ ASSERT(file->f_dentry);
2057+
2058+ LOG(6, (KERN_DEBUG "VMware hgfs: HgfsMmap: was called\n"));
2059+
2060+ result = HgfsRevalidate(file->f_dentry);
2061+ if (result) {
2062+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsMmap: invalid dentry\n"));
2063+ goto out;
2064+ }
2065+
2066+ result = generic_file_mmap(file, vma);
2067+ out:
2068+ return result;
2069+}
2070+
2071+
2072+/*
2073+ *----------------------------------------------------------------------
2074+ *
2075+ * HgfsRelease --
2076+ *
2077+ * Called when the last user of a file closes it, i.e. when the
2078+ * file's f_count becomes zero.
2079+ *
2080+ * Results:
2081+ * Returns zero on success, or an error on failure.
2082+ *
2083+ * Side effects:
2084+ * None
2085+ *
2086+ *----------------------------------------------------------------------
2087+ */
2088+
2089+static int
2090+HgfsRelease(struct inode *inode, // IN: Inode that this file points to
2091+ struct file *file) // IN: File that is getting released
2092+{
2093+ HgfsReq *req;
2094+ HgfsHandle handle;
2095+ HgfsOp opUsed;
2096+ HgfsStatus replyStatus;
2097+ int result = 0;
2098+
2099+ ASSERT(inode);
2100+ ASSERT(file);
2101+ ASSERT(file->f_dentry);
2102+ ASSERT(file->f_dentry->d_sb);
2103+
2104+ handle = FILE_GET_FI_P(file)->handle;
2105+ LOG(6, (KERN_DEBUG "VMware hgfs: HgfsRelease: close fh %u\n", handle));
2106+
2107+ /*
2108+ * This may be our last open handle to an inode, so we should flush our
2109+ * dirty pages before closing it.
2110+ */
2111+ compat_filemap_write_and_wait(inode->i_mapping);
2112+
2113+ HgfsReleaseFileInfo(file);
2114+
2115+ req = HgfsGetNewRequest();
2116+ if (!req) {
2117+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsRelease: out of memory while "
2118+ "getting new request\n"));
2119+ result = -ENOMEM;
2120+ goto out;
2121+ }
2122+
2123+ retry:
2124+ opUsed = hgfsVersionClose;
2125+ if (opUsed == HGFS_OP_CLOSE_V3) {
2126+ HgfsRequest *header;
2127+ HgfsRequestCloseV3 *request;
2128+
2129+ header = (HgfsRequest *)(HGFS_REQ_PAYLOAD(req));
2130+ header->id = req->id;
2131+ header->op = opUsed;
2132+
2133+ request = (HgfsRequestCloseV3 *)(HGFS_REQ_PAYLOAD_V3(req));
2134+ request->file = handle;
2135+ request->reserved = 0;
2136+ req->payloadSize = HGFS_REQ_PAYLOAD_SIZE_V3(request);
2137+ } else {
2138+ HgfsRequestClose *request;
2139+
2140+ request = (HgfsRequestClose *)(HGFS_REQ_PAYLOAD(req));
2141+ request->header.id = req->id;
2142+ request->header.op = opUsed;
2143+ request->file = handle;
2144+ req->payloadSize = sizeof *request;
2145+ }
2146+
2147+ /* Send the request and process the reply. */
2148+ result = HgfsSendRequest(req);
2149+ if (result == 0) {
2150+ /* Get the reply. */
2151+ replyStatus = HgfsReplyStatus(req);
2152+ result = HgfsStatusConvertToLinux(replyStatus);
2153+
2154+ switch (result) {
2155+ case 0:
2156+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsRelease: released handle %u\n",
2157+ handle));
2158+ break;
2159+ case -EPROTO:
2160+ /* Retry with older version(s). Set globally. */
2161+ if (opUsed == HGFS_OP_CLOSE_V3) {
2162+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsRelease: Version 3 not "
2163+ "supported. Falling back to version 1.\n"));
2164+ hgfsVersionClose = HGFS_OP_CLOSE;
2165+ goto retry;
2166+ }
2167+ break;
2168+ default:
2169+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsRelease: failed handle %u\n",
2170+ handle));
2171+ break;
2172+ }
2173+ } else if (result == -EIO) {
2174+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsRelease: timed out\n"));
2175+ } else if (result == -EPROTO) {
2176+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsRelease: server "
2177+ "returned error: %d\n", result));
2178+ } else {
2179+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsRelease: unknown error: "
2180+ "%d\n", result));
2181+ }
2182+
2183+out:
2184+ HgfsFreeRequest(req);
2185+ return result;
2186+}
2187+
2188+
2189+#ifndef VMW_SENDFILE_NONE
2190+/*
2191+ *-----------------------------------------------------------------------------
2192+ *
2193+ * HgfsSendfile --
2194+ *
2195+ * sendfile() wrapper for HGFS. Note that this is for sending a file
2196+ * from HGFS to another filesystem (or socket). To use HGFS as the
2197+ * destination file in a call to sendfile(), we must implement sendpage()
2198+ * as well.
2199+ *
2200+ * Like mmap(), we're just interested in validating the dentry and then
2201+ * calling into generic_file_sendfile().
2202+ *
2203+ * Results:
2204+ * Returns number of bytes written on success, or an error on failure.
2205+ *
2206+ * Side effects:
2207+ * None.
2208+ *
2209+ *-----------------------------------------------------------------------------
2210+ */
2211+
2212+#if defined VMW_SENDFILE_OLD
2213+static ssize_t
2214+HgfsSendfile(struct file *file, // IN: File to read from
2215+ loff_t *offset, // IN/OUT: Where to start reading
2216+ size_t count, // IN: How much to read
2217+ read_actor_t actor, // IN: Routine to send a page of data
2218+ void __user *target) // IN: Destination file/socket
2219+#elif defined VMW_SENDFILE_NEW
2220+static ssize_t
2221+HgfsSendfile(struct file *file, // IN: File to read from
2222+ loff_t *offset, // IN/OUT: Where to start reading
2223+ size_t count, // IN: How much to read
2224+ read_actor_t actor, // IN: Routine to send a page of data
2225+ void *target) // IN: Destination file/socket
2226+#endif
2227+{
2228+ ssize_t result;
2229+
2230+ ASSERT(file);
2231+ ASSERT(file->f_dentry);
2232+ ASSERT(target);
2233+ ASSERT(offset);
2234+ ASSERT(actor);
2235+
2236+ LOG(6, (KERN_DEBUG "VMware hgfs: HgfsSendfile: was called\n"));
2237+
2238+ result = HgfsRevalidate(file->f_dentry);
2239+ if (result) {
2240+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsSendfile: invalid dentry\n"));
2241+ goto out;
2242+ }
2243+
2244+ result = generic_file_sendfile (file, offset, count, actor, target);
2245+ out:
2246+ return result;
2247+
2248+}
2249+#endif
2250+
2251+
2252+#ifdef VMW_SPLICE_READ
2253+/*
2254+ *-----------------------------------------------------------------------------
2255+ *
2256+ * HgfsSpliceRead --
2257+ *
2258+ * splice_read() wrapper for HGFS. Note that this is for sending a file
2259+ * from HGFS to another filesystem (or socket). To use HGFS as the
2260+ * destination file in a call to splice, we must implement splice_write()
2261+ * as well.
2262+ *
2263+ * Like mmap(), we're just interested in validating the dentry and then
2264+ * calling into generic_file_splice_read().
2265+ *
2266+ * Results:
2267+ * Returns number of bytes written on success, or an error on failure.
2268+ *
2269+ * Side effects:
2270+ * None.
2271+ *
2272+ *-----------------------------------------------------------------------------
2273+ */
2274+
2275+static ssize_t
2276+HgfsSpliceRead(struct file *file, // IN: File to read from
2277+ loff_t *offset, // IN/OUT: Where to start reading
2278+ struct pipe_inode_info *pipe, // IN: Pipe where to write data
2279+ size_t len, // IN: How much to read
2280+ unsigned int flags) // IN: Various flags
2281+{
2282+ ssize_t result;
2283+
2284+ ASSERT(file);
2285+ ASSERT(file->f_dentry);
2286+
2287+ LOG(6, (KERN_DEBUG "VMware hgfs: HgfsSpliceRead: was called\n"));
2288+
2289+ result = HgfsRevalidate(file->f_dentry);
2290+ if (result) {
2291+ LOG(4, (KERN_DEBUG "VMware hgfs: HgfsSpliceRead: invalid dentry\n"));
2292+ goto out;
2293+ }
2294+
2295+ result = generic_file_splice_read(file, offset, pipe, len, flags);
2296+ out:
2297+ return result;
2298+
2299+}
2300+#endif
2301+
2302+
2303
2304=== added directory '.pc/0005-linux-310-fix.patch/modules/linux/vmsync'
2305=== added file '.pc/0005-linux-310-fix.patch/modules/linux/vmsync/sync.c'
2306--- .pc/0005-linux-310-fix.patch/modules/linux/vmsync/sync.c 1970-01-01 00:00:00 +0000
2307+++ .pc/0005-linux-310-fix.patch/modules/linux/vmsync/sync.c 2013-09-21 20:15:28 +0000
2308@@ -0,0 +1,711 @@
2309+/*********************************************************
2310+ * Copyright (C) 2007 VMware, Inc. All rights reserved.
2311+ *
2312+ * This program is free software; you can redistribute it and/or modify it
2313+ * under the terms of the GNU General Public License as published by the
2314+ * Free Software Foundation version 2 and no later version.
2315+ *
2316+ * This program is distributed in the hope that it will be useful, but
2317+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
2318+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2319+ * for more details.
2320+ *
2321+ * You should have received a copy of the GNU General Public License along
2322+ * with this program; if not, write to the Free Software Foundation, Inc.,
2323+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2324+ *
2325+ *********************************************************/
2326+
2327+/*
2328+ * sync.c --
2329+ *
2330+ * Linux "sync driver" implementation.
2331+ *
2332+ * A typical user of vmsync will:
2333+ *
2334+ * - call ioctl() with the SYNC_IOC_FREEZE to freeze a list of paths.
2335+ * The list should be a colon-separated list of paths to be frozen.
2336+ * - call ioctl() with the SYNC_IOC_THAW command.
2337+ *
2338+ * The driver has an internal timer that is set up as soon as devices
2339+ * are frozen (i.e., after a successful SYNC_IOC_FREEZE). Subsequent calls
2340+ * to SYNC_IOC_FREEZE will not reset the timer. This timer is not designed
2341+ * as a way to protect the driver from being an avenue for a DoS attack
2342+ * (after all, if the user already has CAP_SYS_ADMIN privileges...), but
2343+ * as a way to protect itself from faulty user level apps during testing.
2344+ */
2345+
2346+/* Must come before any kernel header file. */
2347+#include "driver-config.h"
2348+
2349+#include <asm/bug.h>
2350+#include <asm/uaccess.h>
2351+#include <asm/string.h>
2352+#include <linux/buffer_head.h>
2353+#include <linux/proc_fs.h>
2354+
2355+#include "compat_fs.h"
2356+#include "compat_module.h"
2357+#include "compat_namei.h"
2358+#include "compat_mutex.h"
2359+#include "compat_slab.h"
2360+#include "compat_workqueue.h"
2361+
2362+#include "syncDriverIoc.h"
2363+#include "vmsync_version.h"
2364+
2365+/*
2366+ * After a successful SYNC_IOC_FREEZE ioctl, a timer will be enabled to thaw
2367+ * *all* frozen block devices after this delay.
2368+ */
2369+#define VMSYNC_THAW_TASK_DELAY (30 * HZ)
2370+
2371+/* Module information. */
2372+MODULE_AUTHOR("VMware, Inc.");
2373+MODULE_DESCRIPTION("VMware Sync Driver");
2374+MODULE_VERSION(VMSYNC_DRIVER_VERSION_STRING);
2375+MODULE_LICENSE("GPL v2");
2376+/*
2377+ * Starting with SLE10sp2, Novell requires that IHVs sign a support agreement
2378+ * with them and mark their kernel modules as externally supported via a
2379+ * change to the module header. If this isn't done, the module will not load
2380+ * by default (i.e., neither mkinitrd nor modprobe will accept it).
2381+ */
2382+MODULE_INFO(supported, "external");
2383+
2384+static int VmSyncRelease(struct inode* inode,
2385+ struct file *file);
2386+
2387+static long VmSyncUnlockedIoctl(struct file *file,
2388+ unsigned cmd,
2389+ unsigned long arg);
2390+
2391+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 11)
2392+static int VmSyncIoctl(struct inode *inode,
2393+ struct file *file,
2394+ unsigned cmd,
2395+ unsigned long arg);
2396+#endif
2397+
2398+static int VmSyncOpen(struct inode *inode,
2399+ struct file *f);
2400+
2401+static struct file_operations VmSyncFileOps = {
2402+ .owner = THIS_MODULE,
2403+ .open = VmSyncOpen,
2404+ .release = VmSyncRelease,
2405+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
2406+ .unlocked_ioctl = VmSyncUnlockedIoctl,
2407+#else
2408+ .ioctl = VmSyncIoctl,
2409+#endif
2410+};
2411+
2412+
2413+typedef struct VmSyncBlockDevice {
2414+ struct list_head list;
2415+ struct block_device *bdev;
2416+ struct nameidata nd;
2417+ struct super_block *sb;
2418+} VmSyncBlockDevice;
2419+
2420+
2421+typedef struct VmSyncState {
2422+ struct list_head devices;
2423+ compat_mutex_t lock;
2424+ compat_delayed_work thawTask;
2425+} VmSyncState;
2426+
2427+
2428+/*
2429+ * Serializes freeze operations. Used to make sure that two different
2430+ * fds aren't allowed to freeze the same device.
2431+ */
2432+static compat_mutex_t gFreezeLock;
2433+
2434+/* A global count of how many devices are currently frozen by the driver. */
2435+static atomic_t gFreezeCount;
2436+
2437+static compat_kmem_cache *gSyncStateCache;
2438+static compat_kmem_cache *gBlockDeviceCache;
2439+
2440+static compat_kmem_cache_ctor VmSyncBlockDeviceCtor;
2441+static compat_kmem_cache_ctor VmSyncStateCtor;
2442+
2443+
2444+/*
2445+ *-----------------------------------------------------------------------------
2446+ *
2447+ * VmSyncThawDevices --
2448+ *
2449+ * Thaws all currently frozen devices.
2450+ *
2451+ * Results:
2452+ * None.
2453+ *
2454+ * Side effects:
2455+ * Devices are thawed, thaw task is cancelled.
2456+ *
2457+ *-----------------------------------------------------------------------------
2458+ */
2459+
2460+static void
2461+VmSyncThawDevices(void *_state) // IN
2462+{
2463+ struct list_head *cur, *tmp;
2464+ VmSyncBlockDevice *dev;
2465+ VmSyncState *state;
2466+
2467+ state = (VmSyncState *) _state;
2468+
2469+ compat_mutex_lock(&state->lock);
2470+ cancel_delayed_work(&state->thawTask);
2471+ list_for_each_safe(cur, tmp, &state->devices) {
2472+ dev = list_entry(cur, VmSyncBlockDevice, list);
2473+ if (dev->sb != NULL && dev->sb->s_frozen != SB_UNFROZEN) {
2474+ thaw_bdev(dev->bdev, dev->sb);
2475+ atomic_dec(&gFreezeCount);
2476+ }
2477+ list_del_init(&dev->list);
2478+ kmem_cache_free(gBlockDeviceCache, dev);
2479+ }
2480+ compat_mutex_unlock(&state->lock);
2481+}
2482+
2483+
2484+/*
2485+ *-----------------------------------------------------------------------------
2486+ *
2487+ * VmSyncThawDevicesCallback --
2488+ *
2489+ * Wrapper around VmSyncThawDevices used by the work queue.
2490+ *
2491+ * Results:
2492+ * None.
2493+ *
2494+ * Side effects:
2495+ * See VmSyncThawDevices.
2496+ *
2497+ *-----------------------------------------------------------------------------
2498+ */
2499+
2500+static void
2501+VmSyncThawDevicesCallback(compat_delayed_work_arg data) // IN
2502+{
2503+ VmSyncState *state = COMPAT_DELAYED_WORK_GET_DATA(data,
2504+ VmSyncState, thawTask);
2505+ VmSyncThawDevices(state);
2506+}
2507+
2508+/*
2509+ *-----------------------------------------------------------------------------
2510+ *
2511+ * VmSyncAddPath --
2512+ *
2513+ * Adds the block device associated with the path to the internal list
2514+ * of devices to be frozen.
2515+ *
2516+ * Results:
2517+ * 0 on success.
2518+ * -EINVAL if path doesn't point to a freezable mount.
2519+ * -EALREADY if path is already frozen.
2520+ *
2521+ * Side effects:
2522+ * None.
2523+ *
2524+ *-----------------------------------------------------------------------------
2525+ */
2526+
2527+static int
2528+VmSyncAddPath(const VmSyncState *state, // IN
2529+ const char *path, // IN
2530+ struct list_head *pathList) // IN
2531+{
2532+ int result;
2533+ struct list_head *cur, *tmp;
2534+ struct inode *inode;
2535+ struct nameidata nd;
2536+ VmSyncBlockDevice *dev;
2537+
2538+ if ((result = compat_path_lookup(path, LOOKUP_FOLLOW, &nd)) != 0) {
2539+ goto exit;
2540+ }
2541+ inode = compat_vmw_nd_to_dentry(nd)->d_inode;
2542+
2543+ /*
2544+ * Abort if the inode's superblock isn't backed by a block device, or if
2545+ * the superblock is already frozen.
2546+ */
2547+ if (inode->i_sb->s_bdev == NULL ||
2548+ inode->i_sb->s_frozen != SB_UNFROZEN) {
2549+ result = (inode->i_sb->s_bdev == NULL) ? -EINVAL : -EALREADY;
2550+ compat_path_release(&nd);
2551+ goto exit;
2552+ }
2553+
2554+ /*
2555+ * Check if we've already added the block device to the list.
2556+ */
2557+ list_for_each_safe(cur, tmp, &state->devices) {
2558+ dev = list_entry(cur, VmSyncBlockDevice, list);
2559+ if (dev->bdev == inode->i_sb->s_bdev) {
2560+ result = 0;
2561+ compat_path_release(&nd);
2562+ goto exit;
2563+ }
2564+ }
2565+
2566+ /*
2567+ * Allocate a new entry and add it to the list.
2568+ */
2569+ dev = kmem_cache_alloc(gBlockDeviceCache, GFP_KERNEL);
2570+ if (dev == NULL) {
2571+ result = -ENOMEM;
2572+ compat_path_release(&nd);
2573+ goto exit;
2574+ }
2575+
2576+ /*
2577+ * Whenever we add a device to the "freeze list", the reference to
2578+ * the nameidata struct is retained until the device is actually
2579+ * frozen; this ensures the kernel knows the path is being used.
2580+ * Here we copy the nameidata struct so we can release our reference
2581+ * at that time.
2582+ */
2583+ dev->bdev = inode->i_sb->s_bdev;
2584+ memcpy(&dev->nd, &nd, sizeof nd);
2585+ list_add_tail(&dev->list, pathList);
2586+ result = 0;
2587+
2588+exit:
2589+ return result;
2590+}
2591+
2592+
2593+/*
2594+ *-----------------------------------------------------------------------------
2595+ *
2596+ * VmSyncFreezeDevices --
2597+ *
2598+ * Tries to freeze all the devices provided by the user.
2599+ *
2600+ * Results:
2601+ * o on success, -errno on error.
2602+ *
2603+ * Side effects:
2604+ * A task is scheduled to automatically thaw devices after a timeout.
2605+ *
2606+ *-----------------------------------------------------------------------------
2607+ */
2608+
2609+static int
2610+VmSyncFreezeDevices(VmSyncState *state, // IN
2611+ const char __user *userPaths) // IN
2612+{
2613+ int result = 0;
2614+ char *paths;
2615+ char *currPath;
2616+ char *nextSep;
2617+ struct list_head *cur, *tmp;
2618+ struct list_head pathList;
2619+ VmSyncBlockDevice *dev;
2620+
2621+ INIT_LIST_HEAD(&pathList);
2622+
2623+ /*
2624+ * XXX: Using getname() will restrict the list of paths to PATH_MAX.
2625+ * Although this is not ideal, it shouldn't be a problem. We need an
2626+ * upper bound anyway.
2627+ */
2628+ paths = getname(userPaths);
2629+ if (IS_ERR(paths)) {
2630+ return PTR_ERR(paths);
2631+ }
2632+
2633+ compat_mutex_lock(&gFreezeLock);
2634+ compat_mutex_lock(&state->lock);
2635+
2636+ /*
2637+ * First, try to add all paths to the list of paths to be frozen.
2638+ */
2639+ currPath = paths;
2640+ do {
2641+ nextSep = strchr(currPath, ':');
2642+ if (nextSep != NULL) {
2643+ *nextSep = '\0';
2644+ }
2645+ result = VmSyncAddPath(state, currPath, &pathList);
2646+ /*
2647+ * Due to the way our user level app decides which paths to freeze
2648+ * now, we need to ignore EINVAL since there's no way to detect
2649+ * from user-land which paths are freezable or not.
2650+ */
2651+ if (result != 0 && result != -EINVAL) {
2652+ break;
2653+ } else {
2654+ result = 0;
2655+ }
2656+ currPath = nextSep + 1;
2657+ } while (nextSep != NULL);
2658+
2659+ /*
2660+ * If adding all the requested paths worked, then freeze them.
2661+ * Otherwise, clean the list. Make sure we only touch the devices
2662+ * added in the current call.
2663+ */
2664+ list_for_each_safe(cur, tmp, &pathList) {
2665+ dev = list_entry(cur, VmSyncBlockDevice, list);
2666+ if (result == 0) {
2667+ dev->sb = freeze_bdev(dev->bdev);
2668+ compat_path_release(&dev->nd);
2669+ if (dev->sb != NULL) {
2670+ atomic_inc(&gFreezeCount);
2671+ }
2672+ list_move_tail(&dev->list, &state->devices);
2673+ } else {
2674+ list_del_init(&dev->list);
2675+ kmem_cache_free(gBlockDeviceCache, dev);
2676+ }
2677+ }
2678+
2679+ compat_mutex_unlock(&state->lock);
2680+ compat_mutex_unlock(&gFreezeLock);
2681+
2682+ if (result == 0) {
2683+ compat_schedule_delayed_work(&state->thawTask, VMSYNC_THAW_TASK_DELAY);
2684+ }
2685+ return result;
2686+}
2687+
2688+
2689+/*
2690+ *-----------------------------------------------------------------------------
2691+ *
2692+ * VmSyncQuery --
2693+ *
2694+ * Writes the number of devices currently frozen by the driver to the
2695+ * given address. The address should be in user space and be able to
2696+ * hold an int32_t.
2697+ *
2698+ * Results:
2699+ * 0 on success, -errno on failure.
2700+ *
2701+ * Side effects:
2702+ * None.
2703+ *
2704+ *-----------------------------------------------------------------------------
2705+ */
2706+
2707+static inline int
2708+VmSyncQuery(void __user *dst) // OUT
2709+{
2710+ int32_t active;
2711+ int result = 0;
2712+
2713+ active = (int32_t) atomic_read(&gFreezeCount);
2714+ if (copy_to_user(dst, &active, sizeof active)) {
2715+ result = -EFAULT;
2716+ }
2717+
2718+ return result;
2719+}
2720+
2721+
2722+/*
2723+ *-----------------------------------------------------------------------------
2724+ *
2725+ * VmSyncUnlockedIoctl --
2726+ *
2727+ * Handles the IOCTLs recognized by the driver.
2728+ *
2729+ * - SYNC_IOC_FREEZE: freezes the block device associated with the
2730+ * path passed as a parameter.
2731+ *
2732+ * - SYNC_IOC_THAW: thaws all currently frozen block devices.
2733+ *
2734+ * - SYNC_IOC_QUERY: returns the number of block devices currently
2735+ * frozen by the driver. This is a global view of the driver state
2736+ * and doesn't reflect any fd-specific data.
2737+ *
2738+ * Results:
2739+ * 0 on success, -errno otherwise.
2740+ *
2741+ * Side effects:
2742+ * See ioctl descriptions above.
2743+ *
2744+ *-----------------------------------------------------------------------------
2745+ */
2746+
2747+static long
2748+VmSyncUnlockedIoctl(struct file *file, // IN
2749+ unsigned cmd, // IN
2750+ unsigned long arg) // IN/OUT
2751+{
2752+ int result = -ENOTTY;
2753+ VmSyncState *state;
2754+
2755+ state = (VmSyncState *) file->private_data;
2756+
2757+ switch (cmd) {
2758+ case SYNC_IOC_FREEZE:
2759+ if (!capable(CAP_SYS_ADMIN)) {
2760+ result = -EPERM;
2761+ break;
2762+ }
2763+ result = VmSyncFreezeDevices(state, (const char __user *) arg);
2764+ break;
2765+
2766+ case SYNC_IOC_THAW:
2767+ if (!capable(CAP_SYS_ADMIN)) {
2768+ result = -EPERM;
2769+ break;
2770+ }
2771+ VmSyncThawDevices(state);
2772+ result = 0;
2773+ break;
2774+
2775+ case SYNC_IOC_QUERY:
2776+ result = VmSyncQuery((void __user *)arg);
2777+ break;
2778+
2779+ default:
2780+ printk(KERN_DEBUG "vmsync: unknown ioctl %d\n", cmd);
2781+ break;
2782+ }
2783+ return result;
2784+}
2785+
2786+
2787+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 11)
2788+/*
2789+ *-----------------------------------------------------------------------------
2790+ *
2791+ * VmSyncIoctl --
2792+ *
2793+ * Wrapper around VmSyncUnlockedIoctl for kernels < 2.6.11, which don't
2794+ * support unlocked_ioctl.
2795+ *
2796+ * Results:
2797+ * See VmSyncUnlockedIoctl.
2798+ *
2799+ * Side effects:
2800+ * See VmSyncUnlockedIoctl.
2801+ *
2802+ *-----------------------------------------------------------------------------
2803+ */
2804+
2805+static int
2806+VmSyncIoctl(struct inode *inode, // IN
2807+ struct file *file, // IN
2808+ unsigned cmd, // IN
2809+ unsigned long arg) // IN/OUT
2810+{
2811+ return (int) VmSyncUnlockedIoctl(file, cmd, arg);
2812+}
2813+#endif
2814+
2815+
2816+/*
2817+ *-----------------------------------------------------------------------------
2818+ *
2819+ * VmSyncOpen --
2820+ *
2821+ * Instantiates a new state object and attached it to the file struct.
2822+ *
2823+ * Results:
2824+ * 0, or -ENOMEM if can't allocate memory.
2825+ *
2826+ * Side effects:
2827+ * None.
2828+ *
2829+ *-----------------------------------------------------------------------------
2830+ */
2831+
2832+static int
2833+VmSyncOpen(struct inode *inode, // IN
2834+ struct file *f) // IN
2835+{
2836+ if (capable(CAP_SYS_ADMIN)) {
2837+ f->private_data = kmem_cache_alloc(gSyncStateCache, GFP_KERNEL);
2838+ if (f->private_data == NULL) {
2839+ return -ENOMEM;
2840+ }
2841+ }
2842+ return 0;
2843+}
2844+
2845+
2846+/*
2847+ *-----------------------------------------------------------------------------
2848+ *
2849+ * VmSyncRelease --
2850+ *
2851+ * If the fd was used to freeze devices, then thaw all frozen block devices.
2852+ *
2853+ * Results:
2854+ * Returns 0.
2855+ *
2856+ * Side effects:
2857+ * Calls VmSyncThawDevices.
2858+ *
2859+ *-----------------------------------------------------------------------------
2860+ */
2861+
2862+static int
2863+VmSyncRelease(struct inode *inode, // IN
2864+ struct file *file) // IN
2865+{
2866+ if (capable(CAP_SYS_ADMIN)) {
2867+ VmSyncState *state = (VmSyncState *) file->private_data;
2868+ if (!cancel_delayed_work(&state->thawTask)) {
2869+ flush_scheduled_work();
2870+ }
2871+ VmSyncThawDevices(state);
2872+ kmem_cache_free(gSyncStateCache, state);
2873+ }
2874+ return 0;
2875+}
2876+
2877+
2878+/*
2879+ *-----------------------------------------------------------------------------
2880+ *
2881+ * VmSyncBlockDeviceCtor --
2882+ *
2883+ * Constructor for VmSyncBlockDevice objects.
2884+ *
2885+ * Results:
2886+ * None.
2887+ *
2888+ * Side effects:
2889+ * None.
2890+ *
2891+ *-----------------------------------------------------------------------------
2892+ */
2893+
2894+static void
2895+VmSyncBlockDeviceCtor(COMPAT_KMEM_CACHE_CTOR_ARGS(slabelem)) // IN
2896+{
2897+ VmSyncBlockDevice *dev = slabelem;
2898+
2899+ INIT_LIST_HEAD(&dev->list);
2900+ dev->bdev = NULL;
2901+ dev->sb = NULL;
2902+}
2903+
2904+
2905+/*
2906+ *-----------------------------------------------------------------------------
2907+ *
2908+ * VmSyncStateCtor --
2909+ *
2910+ * Constructor for VmSyncState objects.
2911+ *
2912+ * Results:
2913+ * None.
2914+ *
2915+ * Side effects:
2916+ * None.
2917+ *
2918+ *-----------------------------------------------------------------------------
2919+ */
2920+
2921+static void
2922+VmSyncStateCtor(COMPAT_KMEM_CACHE_CTOR_ARGS(slabelem)) // IN
2923+{
2924+ VmSyncState *state = slabelem;
2925+
2926+ INIT_LIST_HEAD(&state->devices);
2927+ COMPAT_INIT_DELAYED_WORK(&state->thawTask,
2928+ VmSyncThawDevicesCallback, state);
2929+ compat_mutex_init(&state->lock);
2930+}
2931+
2932+
2933+/*
2934+ *-----------------------------------------------------------------------------
2935+ *
2936+ * init_module --
2937+ *
2938+ * Initializes the structures used by the driver, and creates the
2939+ * proc file used by the driver to receive commands.
2940+ *
2941+ * Results:
2942+ * None.
2943+ *
2944+ * Side effects:
2945+ * None.
2946+ *
2947+ *-----------------------------------------------------------------------------
2948+ */
2949+
2950+int
2951+init_module(void)
2952+{
2953+ struct proc_dir_entry *controlProcEntry;
2954+
2955+ atomic_set(&gFreezeCount, 0);
2956+ compat_mutex_init(&gFreezeLock);
2957+
2958+ /* Create the slab allocators for the module. */
2959+ gBlockDeviceCache = compat_kmem_cache_create("VmSyncBlockDeviceCache",
2960+ sizeof (VmSyncBlockDevice),
2961+ 0,
2962+ SLAB_HWCACHE_ALIGN,
2963+ VmSyncBlockDeviceCtor);
2964+ if (gBlockDeviceCache == NULL) {
2965+ printk(KERN_ERR "vmsync: no memory for block dev slab allocator\n");
2966+ return -ENOMEM;
2967+ }
2968+
2969+ gSyncStateCache = compat_kmem_cache_create("VmSyncStateCache",
2970+ sizeof (VmSyncState),
2971+ 0,
2972+ SLAB_HWCACHE_ALIGN,
2973+ VmSyncStateCtor);
2974+ if (gSyncStateCache == NULL) {
2975+ printk(KERN_ERR "vmsync: no memory for sync state slab allocator\n");
2976+ kmem_cache_destroy(gBlockDeviceCache);
2977+ return -ENOMEM;
2978+ }
2979+
2980+ /* Create /proc/driver/vmware-sync */
2981+ controlProcEntry = create_proc_entry("driver/vmware-sync",
2982+ S_IFREG | S_IRUSR | S_IRGRP | S_IROTH,
2983+ NULL);
2984+ if (!controlProcEntry) {
2985+ printk(KERN_ERR "vmsync: could not create /proc/driver/vmware-sync\n");
2986+ kmem_cache_destroy(gSyncStateCache);
2987+ kmem_cache_destroy(gBlockDeviceCache);
2988+ return -EINVAL;
2989+ }
2990+
2991+ controlProcEntry->proc_fops = &VmSyncFileOps;
2992+ return 0;
2993+}
2994+
2995+
2996+/*
2997+ *-----------------------------------------------------------------------------
2998+ *
2999+ * cleanup_module --
3000+ *
3001+ * Unregisters the proc file used by the driver.
3002+ *
3003+ * Results:
3004+ * None.
3005+ *
3006+ * Side effects:
3007+ * None.
3008+ *
3009+ *-----------------------------------------------------------------------------
3010+ */
3011+
3012+void
3013+cleanup_module(void)
3014+{
3015+ remove_proc_entry("driver/vmware-sync", NULL);
3016+ kmem_cache_destroy(gSyncStateCache);
3017+ kmem_cache_destroy(gBlockDeviceCache);
3018+}
3019+
3020
3021=== added directory '.pc/0006-linux-311-fix.patch'
3022=== added directory '.pc/0006-linux-311-fix.patch/modules'
3023=== added directory '.pc/0006-linux-311-fix.patch/modules/linux'
3024=== added directory '.pc/0006-linux-311-fix.patch/modules/linux/vmblock'
3025=== added directory '.pc/0006-linux-311-fix.patch/modules/linux/vmblock/linux'
3026=== added file '.pc/0006-linux-311-fix.patch/modules/linux/vmblock/linux/file.c'
3027--- .pc/0006-linux-311-fix.patch/modules/linux/vmblock/linux/file.c 1970-01-01 00:00:00 +0000
3028+++ .pc/0006-linux-311-fix.patch/modules/linux/vmblock/linux/file.c 2013-09-21 20:15:28 +0000
3029@@ -0,0 +1,244 @@
3030+/*********************************************************
3031+ * Copyright (C) 2006 VMware, Inc. All rights reserved.
3032+ *
3033+ * This program is free software; you can redistribute it and/or modify it
3034+ * under the terms of the GNU General Public License as published by the
3035+ * Free Software Foundation version 2 and no later version.
3036+ *
3037+ * This program is distributed in the hope that it will be useful, but
3038+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
3039+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3040+ * for more details.
3041+ *
3042+ * You should have received a copy of the GNU General Public License along
3043+ * with this program; if not, write to the Free Software Foundation, Inc.,
3044+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3045+ *
3046+ *********************************************************/
3047+
3048+/*
3049+ * file.c --
3050+ *
3051+ * File operations for the file system of the vmblock driver.
3052+ *
3053+ */
3054+
3055+#include "driver-config.h"
3056+#include <linux/module.h>
3057+#include <linux/fs.h>
3058+#include <linux/sched.h>
3059+#include <linux/pagemap.h>
3060+
3061+#include "vmblockInt.h"
3062+#include "filesystem.h"
3063+
3064+#if defined(VMW_FILLDIR_2618)
3065+typedef u64 inode_num_t;
3066+#else
3067+typedef ino_t inode_num_t;
3068+#endif
3069+
3070+/* Specifically for our filldir_t callback */
3071+typedef struct FilldirInfo {
3072+ filldir_t filldir;
3073+ void *dirent;
3074+} FilldirInfo;
3075+
3076+
3077+/*
3078+ *----------------------------------------------------------------------------
3079+ *
3080+ * Filldir --
3081+ *
3082+ * Callback function for readdir that we use in place of the one provided.
3083+ * This allows us to specify that each dentry is a symlink, but pass through
3084+ * everything else to the original filldir function.
3085+ *
3086+ * Results:
3087+ * Original filldir's return value.
3088+ *
3089+ * Side effects:
3090+ * Directory information gets copied to user's buffer.
3091+ *
3092+ *----------------------------------------------------------------------------
3093+ */
3094+
3095+static int
3096+Filldir(void *buf, // IN: Dirent buffer passed from FileOpReaddir
3097+ const char *name, // IN: Dirent name
3098+ int namelen, // IN: len of dirent's name
3099+ loff_t offset, // IN: Offset
3100+ inode_num_t ino, // IN: Inode number of dirent
3101+ unsigned int d_type) // IN: Type of file
3102+{
3103+ FilldirInfo *info = buf;
3104+
3105+ /* Specify DT_LNK regardless */
3106+ return info->filldir(info->dirent, name, namelen, offset, ino, DT_LNK);
3107+}
3108+
3109+
3110+/* File operations */
3111+
3112+/*
3113+ *----------------------------------------------------------------------------
3114+ *
3115+ * FileOpOpen --
3116+ *
3117+ * Invoked when open(2) has been called on our root inode. We get an open
3118+ * file instance of the actual file that we are providing indirect access
3119+ * to.
3120+ *
3121+ * Results:
3122+ * 0 on success, negative error code on failure.
3123+ *
3124+ * Side effects:
3125+ * None.
3126+ *
3127+ *----------------------------------------------------------------------------
3128+ */
3129+
3130+static int
3131+FileOpOpen(struct inode *inode, // IN
3132+ struct file *file) // IN
3133+{
3134+ VMBlockInodeInfo *iinfo;
3135+ struct file *actualFile;
3136+
3137+ if (!inode || !file || !INODE_TO_IINFO(inode)) {
3138+ Warning("FileOpOpen: invalid args from kernel\n");
3139+ return -EINVAL;
3140+ }
3141+
3142+ iinfo = INODE_TO_IINFO(inode);
3143+
3144+ /*
3145+ * Get an open file for the directory we are redirecting to. This ensure we
3146+ * can gracefully handle cases where that directory is removed after we are
3147+ * mounted.
3148+ */
3149+ actualFile = filp_open(iinfo->name, file->f_flags, file->f_flags);
3150+ if (IS_ERR(actualFile)) {
3151+ Warning("FileOpOpen: could not open file [%s]\n", iinfo->name);
3152+ file->private_data = NULL;
3153+ return PTR_ERR(actualFile);
3154+ }
3155+
3156+ /*
3157+ * If the file opened is the same as the one retrieved for the file then we
3158+ * shouldn't allow the open to happen. This can only occur if the
3159+ * redirected root directory specified at mount time is the same as where
3160+ * the mount is placed. Later in FileOpReaddir() we'd call vfs_readdir()
3161+ * and that would try to acquire the inode's semaphore; if the two inodes
3162+ * are the same we'll deadlock.
3163+ */
3164+ if (actualFile->f_dentry && inode == actualFile->f_dentry->d_inode) {
3165+ Warning("FileOpOpen: identical inode encountered, open cannot succeed.\n");
3166+ if (filp_close(actualFile, current->files) < 0) {
3167+ Warning("FileOpOpen: unable to close opened file.\n");
3168+ }
3169+ return -EINVAL;
3170+ }
3171+
3172+ file->private_data = actualFile;
3173+ return 0;
3174+}
3175+
3176+
3177+/*
3178+ *----------------------------------------------------------------------------
3179+ *
3180+ * FileOpReaddir --
3181+ *
3182+ * Invoked when a user invokes getdents(2) or readdir(2) on the root of our
3183+ * file system. We perform a readdir on the actual underlying file but
3184+ * interpose the callback by providing our own Filldir() function. This
3185+ * enables us to change dentry types to symlinks.
3186+ *
3187+ * Results:
3188+ * 0 on success, negative error code on error.
3189+ *
3190+ * Side effects:
3191+ * None.
3192+ *
3193+ *----------------------------------------------------------------------------
3194+ */
3195+
3196+static int
3197+FileOpReaddir(struct file *file, // IN
3198+ void *dirent, // IN
3199+ filldir_t filldir) // IN
3200+{
3201+ int ret;
3202+ FilldirInfo info;
3203+ struct file *actualFile;
3204+
3205+ if (!file) {
3206+ Warning("FileOpReaddir: invalid args from kernel\n");
3207+ return -EINVAL;
3208+ }
3209+
3210+ actualFile = file->private_data;
3211+ if (!actualFile) {
3212+ Warning("FileOpReaddir: no actual file found\n");
3213+ return -EINVAL;
3214+ }
3215+
3216+ info.filldir = filldir;
3217+ info.dirent = dirent;
3218+
3219+ actualFile->f_pos = file->f_pos;
3220+ ret = vfs_readdir(actualFile, Filldir, &info);
3221+ file->f_pos = actualFile->f_pos;
3222+
3223+ return ret;
3224+}
3225+
3226+
3227+/*
3228+ *----------------------------------------------------------------------------
3229+ *
3230+ * FileOpRelease --
3231+ *
3232+ * Invoked when a user close(2)s the root of our file system. Here we just
3233+ * close the actual file we opened in FileOpOpen().
3234+ *
3235+ * Results:
3236+ * 0 on success, negative value on error.
3237+ *
3238+ * Side effects:
3239+ * None.
3240+ *
3241+ *----------------------------------------------------------------------------
3242+ */
3243+
3244+static int
3245+FileOpRelease(struct inode *inode, // IN
3246+ struct file *file) // IN
3247+{
3248+ int ret;
3249+ struct file *actualFile;
3250+
3251+ if (!inode || !file) {
3252+ Warning("FileOpRelease: invalid args from kerel\n");
3253+ return -EINVAL;
3254+ }
3255+
3256+ actualFile = file->private_data;
3257+ if (!actualFile) {
3258+ Warning("FileOpRelease: no actual file found\n");
3259+ return -EINVAL;
3260+ }
3261+
3262+ ret = filp_close(actualFile, current->files);
3263+
3264+ return ret;
3265+}
3266+
3267+
3268+struct file_operations RootFileOps = {
3269+ .readdir = FileOpReaddir,
3270+ .open = FileOpOpen,
3271+ .release = FileOpRelease,
3272+};
3273+
3274
3275=== added directory '.pc/0007-dkms-suppress-error.patch'
3276=== added directory '.pc/0007-dkms-suppress-error.patch/modules'
3277=== added directory '.pc/0007-dkms-suppress-error.patch/modules/linux'
3278=== added file '.pc/0007-dkms-suppress-error.patch/modules/linux/dkms.conf'
3279--- .pc/0007-dkms-suppress-error.patch/modules/linux/dkms.conf 1970-01-01 00:00:00 +0000
3280+++ .pc/0007-dkms-suppress-error.patch/modules/linux/dkms.conf 2013-09-21 20:15:28 +0000
3281@@ -0,0 +1,34 @@
3282+PACKAGE_NAME=open-vm-tools
3283+PACKAGE_VERSION=2013.04.16
3284+MAKE_CMD_TMPL="make VM_UNAME=\$kernelver \
3285+ MODULEBUILDDIR=$dkms_tree/$PACKAGE_NAME/$PACKAGE_VERSION/build"
3286+
3287+# The vsock module depends on symbols exported by the vmci module, so it
3288+# needs to be built afterwards; the MODULEBUILDDIR variable tells the makefiles
3289+# where to store / retrive those symbol files.
3290+MAKE[0]="$MAKE_CMD_TMPL -C vmblock; \
3291+ $MAKE_CMD_TMPL -C vmci; \
3292+ $MAKE_CMD_TMPL -C vmhgfs; \
3293+ $MAKE_CMD_TMPL -C vmxnet; \
3294+ $MAKE_CMD_TMPL -C vsock"
3295+CLEAN[0]="$MAKE_CMD_TMPL -C vmblock clean; \
3296+ $MAKE_CMD_TMPL -C vmci clean; \
3297+ $MAKE_CMD_TMPL -C vmhgfs clean; \
3298+ $MAKE_CMD_TMPL -C vmxnet clean; \
3299+ $MAKE_CMD_TMPL -C vsock clean"
3300+BUILT_MODULE_NAME[0]="vmblock"
3301+BUILT_MODULE_NAME[1]="vmci"
3302+BUILT_MODULE_NAME[2]="vmhgfs"
3303+BUILT_MODULE_NAME[3]="vmxnet"
3304+BUILT_MODULE_NAME[4]="vsock"
3305+BUILT_MODULE_LOCATION[0]="vmblock/"
3306+BUILT_MODULE_LOCATION[1]="vmci/"
3307+BUILT_MODULE_LOCATION[2]="vmhgfs/"
3308+BUILT_MODULE_LOCATION[3]="vmxnet/"
3309+BUILT_MODULE_LOCATION[4]="vsock/"
3310+DEST_MODULE_LOCATION[0]="/kernel/fs/vmblock"
3311+DEST_MODULE_LOCATION[1]="/kernel/drivers/misc"
3312+DEST_MODULE_LOCATION[2]="/kernel/fs/vmhgfs"
3313+DEST_MODULE_LOCATION[3]="/kernel/drivers/net"
3314+DEST_MODULE_LOCATION[4]="/kernel/net/vsock"
3315+AUTOINSTALL="YES"
3316
3317=== modified file '.pc/applied-patches'
3318--- .pc/applied-patches 2013-05-29 12:57:21 +0000
3319+++ .pc/applied-patches 2013-09-21 20:15:28 +0000
3320@@ -2,3 +2,6 @@
3321 0002-dkms.patch
3322 0003-dkms-vmsync.patch
3323 0004-vsock-cve.patch
3324+0005-linux-310-fix.patch
3325+0006-linux-311-fix.patch
3326+0007-dkms-suppress-error.patch
3327
3328=== modified file 'debian/changelog'
3329--- debian/changelog 2013-05-29 12:57:21 +0000
3330+++ debian/changelog 2013-09-21 20:15:28 +0000
3331@@ -1,3 +1,69 @@
3332+open-vm-tools (2013.04.16-1098359-0ubuntu2) saucy-proposed; urgency=low
3333+
3334+ * Ubuntu-specific Changes
3335+ - debian/rules: Removed Wno-error=unused-local-typedefs from CLFAGS.
3336+ + We now enforce building with GCC 4.7.
3337+
3338+ - debian/patches: Add 0005-linux-310-fix.patch & 0006-linux-311-fix.patch
3339+ + Fixes building against Saucy Kernels. (LP: #1194940, LP: #1208011)
3340+
3341+ - debian/patches: Add 0007-dkms-supress-error.patch
3342+ + Don't build modules that are broken, so modules that do build
3343+ are available to be loaded.
3344+ + Will be removed after next upstream release.
3345+
3346+ * Items merged from Debian experimental:
3347+ (From 2:9.2.2-893683-7 release)
3348+ - Removing purely cosmetical 'sleep 1' leftover in initscript.
3349+
3350+ (From 2:9.2.3-1031360-2 release)
3351+ - Renaming debian-specific open-vm-toolbox package to open-vm-tools-
3352+ desktop for consistency with upstream.
3353+ - Revamping package descriptions.
3354+ - Renaming open-vm-dkms to open-vm-tools-dkms for consistent package
3355+ namespace.
3356+
3357+ (From 2:9.2.3-1031360-3 release)
3358+ - Adding initial systemd service file from fedora.
3359+
3360+ (From 2:9.2.3-1031360-4 release)
3361+ - Dropping kfreebsd from architecture list, it has never built and
3362+ nobody seems willing to make it work (neither upstream, porters, nor
3363+ users).
3364+
3365+ (From 2:9.2.3-1031360-6 release)
3366+ - Correcting syntax of file entries in copyright.
3367+ - Adding section override for open-vm-tools-dkms.
3368+ - Enforcing build with gcc 4.7 for the time being.
3369+
3370+ -- Nate Muench <NowIWillDestroyAbydos@gmail.com> Sat, 07 Sep 2013 20:50:33 -0500
3371+
3372+open-vm-tools (2:9.2.3-1031360-6) unstable; urgency=low
3373+
3374+ * Correcting syntax of file entries in copyright.
3375+ * Adding section override for open-vm-tools-dkms.
3376+ * Enforcing build with gcc 4.7 for the time being.
3377+ * Orphaning package.
3378+
3379+ -- Daniel Baumann <mail@daniel-baumann.ch> Tue, 16 Jul 2013 10:18:50 +0200
3380+
3381+open-vm-tools (2:9.2.3-1031360-4) experimental; urgency=low
3382+
3383+ * Dropping kfreebsd from architecture list, it has never built and
3384+ nobody seems willing to make it work (neither upstream, porters, nor
3385+ users).
3386+
3387+ -- Daniel Baumann <mail@daniel-baumann.ch> Thu, 06 Jun 2013 13:10:41 +0200
3388+
3389+open-vm-tools (2:9.2.3-1031360-3) experimental; urgency=low
3390+
3391+ * Adding initial systemd service file from fedora.
3392+ * Skipping vmsync kernel module for the time being until it has been
3393+ fixed for the debian specific change introduced in linux 3.8.11-1 that
3394+ broke it (Closes: #707208).
3395+
3396+ -- Daniel Baumann <mail@daniel-baumann.ch> Fri, 31 May 2013 12:01:52 +0200
3397+
3398 open-vm-tools (2013.04.16-1098359-0ubuntu1) saucy-proposed; urgency=low
3399
3400 * Merging upstream version 2013.04.16-1098359.
3401@@ -23,6 +89,39 @@
3402
3403 -- Nate Muench <NowIWillDestroyAbydos@gmail.com> Wed, 29 May 2013 12:57:21 -0500
3404
3405+open-vm-tools (2:9.2.3-1031360-2) experimental; urgency=low
3406+
3407+ * Renaming debian-specific open-vm-toolbox package to open-vm-tools-
3408+ desktop for consistency with upstream.
3409+ * Revamping package descriptions.
3410+ * Renaming open-vm-dkms to open-vm-tools-dkms for consistent package
3411+ namespace.
3412+
3413+ -- Daniel Baumann <mail@daniel-baumann.ch> Thu, 23 May 2013 19:13:26 +0200
3414+
3415+open-vm-tools (2:9.2.3-1031360-1) experimental; urgency=low
3416+
3417+ * Merging upstream version 9.2.3-1031360.
3418+ * Removing procps.patch, not needed anymore.
3419+ * Renumbering patches.
3420+
3421+ -- Daniel Baumann <mail@daniel-baumann.ch> Sun, 05 May 2013 09:58:58 +0200
3422+
3423+open-vm-tools (2:9.2.2-893683-8) experimental; urgency=low
3424+
3425+ * Adding patch from Mathias Krause <minipli@googlemail.com> to fix
3426+ kernel stack memory leack in vsock module [CVE-2013-3237] (Closes:
3427+ #706557).
3428+
3429+ -- Daniel Baumann <mail@daniel-baumann.ch> Wed, 01 May 2013 17:11:01 +0200
3430+
3431+open-vm-tools (2:9.2.2-893683-7) experimental; urgency=low
3432+
3433+ * Removing purely cosmetical 'sleep 1' leftover in initscript (Closes:
3434+ #686200).
3435+
3436+ -- Daniel Baumann <mail@daniel-baumann.ch> Sun, 31 Mar 2013 20:57:51 +0200
3437+
3438 open-vm-tools (2012.12.26-958366-0ubuntu3) raring-proposed; urgency=low
3439
3440 * Ubuntu-specific Changes
3441
3442=== modified file 'debian/control'
3443--- debian/control 2013-03-13 16:44:46 +0000
3444+++ debian/control 2013-09-21 20:15:28 +0000
3445@@ -2,86 +2,113 @@
3446 Section: admin
3447 Priority: extra
3448 Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
3449-XSBC-Original-Maintainer: Daniel Baumann <mail@daniel-baumann.ch>
3450+XSBC-Original-Maintainer: Debian QA Group <packages@qa.debian.org>
3451 Build-Depends:
3452 debhelper (>= 9), autotools-dev, doxygen, libcunit1-dev, libdumbnet-dev,
3453 libfuse-dev, libgtk2.0-dev, libgtkmm-2.4-dev, libicu-dev, libnotify-dev,
3454 libpam0g-dev, libprocps0-dev, libx11-dev, libxinerama-dev, libxss-dev,
3455- libxtst-dev
3456+ libxtst-dev, gcc-4.7
3457 Standards-Version: 3.9.4
3458 Homepage: http://open-vm-tools.sourceforge.net/
3459
3460 Package: open-vm-tools
3461-Architecture: amd64 i386 kfreebsd-amd64 kfreebsd-i386
3462+Architecture: amd64 i386
3463 Pre-Depends: ${misc:Pre-Depends}
3464 Depends: ${misc:Depends}, ${shlibs:Depends}
3465-Recommends: open-vm-dkms, ethtool, zerofree
3466-Suggests: open-vm-toolbox
3467-Description: tools and components for VMware guest systems (CLI tools)
3468- The Open Virtual Machine Tools (open-vm-tools) are the open source
3469- implementation of VMware Tools. They are a set of guest operating system
3470- virtualization components that enhance performance and user experience of
3471- virtual machines.
3472+Recommends: open-vm-tools-dkms, ethtool, zerofree
3473+Suggests: open-vm-tools-desktop
3474+Description: Open VMware Tools for virtual machines hosted on VMware (CLI)
3475+ The Open Virtual Machine Tools (open-vm-tools) project is an open source
3476+ implementation of VMware Tools. It is a suite of virtualization utilities and
3477+ drivers to improve the functionality, user experience and administration of
3478+ VMware virtual machines.
3479 .
3480- As virtualization technology rapidly becomes mainstream, each virtualization
3481- solution provider implements their own set of tools and utilities to supplement
3482- the guest virtual machine. However, most of the implementations are proprietary
3483- and are tied to a specific virtualization platform.
3484+ This package contains only the core user-space programs and libraries.
3485
3486-Package: open-vm-toolbox
3487-Architecture: amd64 i386 kfreebsd-amd64 kfreebsd-i386
3488+Package: open-vm-tools-desktop
3489+Architecture: amd64 i386
3490 Pre-Depends: ${misc:Pre-Depends}
3491 Depends: ${misc:Depends}, ${shlibs:Depends}, open-vm-tools (= ${binary:Version})
3492 Recommends:
3493- open-vm-dkms, xauth, xserver-xorg-input-vmmouse, xserver-xorg-video-vmware
3494+ open-vm-tools-dkms, xauth, xserver-xorg-input-vmmouse, xserver-xorg-video-vmware
3495 Suggests: xdg-utils
3496-Replaces: open-vm-source
3497-Breaks: open-vm-source
3498-Description: tools and components for VMware guest systems (GUI tools)
3499- The Open Virtual Machine Tools (open-vm-tools) are the open source
3500- implementation of VMware Tools. They are a set of guest operating system
3501- virtualization components that enhance performance and user experience of
3502- virtual machines.
3503+Conflicts: open-vm-toolbox (<< 2013.04.16-1098359-0ubuntu2~)
3504+Replaces: open-vm-toolbox
3505+Description: Open VMware Tools for virtual machines hosted on VMware (GUI)
3506+ The Open Virtual Machine Tools (open-vm-tools) project is an open source
3507+ implementation of VMware Tools. It is a suite of virtualization utilities and
3508+ drivers to improve the functionality, user experience and administration of
3509+ VMware virtual machines.
3510 .
3511- As virtualization technology rapidly becomes mainstream, each virtualization
3512- solution provider implements their own set of tools and utilities to supplement
3513- the guest virtual machine. However, most of the implementations are proprietary
3514- and are tied to a specific virtualization platform.
3515+ This package contains the user-space programs and libraries that are essential
3516+ for improved user experience of VMware virtual machines
3517
3518 Package: open-vm-tools-dev
3519 Section: devel
3520 Architecture: all
3521 Pre-Depends: ${misc:Pre-Depends}
3522 Depends: ${misc:Depends}
3523-Description: tools and components for VMware guest systems (development)
3524- The Open Virtual Machine Tools (open-vm-tools) are the open source
3525- implementation of VMware Tools. They are a set of guest operating system
3526- virtualization components that enhance performance and user experience of
3527- virtual machines.
3528+Description: Open VMware Tools for virtual machines hosted on VMware (development)
3529+ The Open Virtual Machine Tools (open-vm-tools) project is an open source
3530+ implementation of VMware Tools. It is a suite of virtualization utilities and
3531+ drivers to improve the functionality, user experience and administration of
3532+ VMware virtual machines.
3533 .
3534 This package contains the development files.
3535
3536 Package: open-vm-tools-dbg
3537 Section: debug
3538 Priority: extra
3539-Architecture: amd64 i386 kfreebsd-amd64 kfreebsd-i386
3540+Architecture: amd64 i386
3541 Pre-Depends: ${misc:Pre-Depends}
3542-Depends: ${misc:Depends}, open-vm-tools (= ${binary:Version}), open-vm-toolbox (= ${binary:Version})
3543-Description: tools and components for VMware guest systems (debug)
3544- The Open Virtual Machine Tools (open-vm-tools) are the open source
3545- implementation of VMware Tools. They are a set of guest operating system
3546- virtualization components that enhance performance and user experience of
3547- virtual machines.
3548+Depends: ${misc:Depends}, open-vm-tools (= ${binary:Version}), open-vm-tools-desktop (= ${binary:Version})
3549+Description: Open VMware Tools for virtual machines hosted on VMware (debug)
3550+ The Open Virtual Machine Tools (open-vm-tools) project is an open source
3551+ implementation of VMware Tools. It is a suite of virtualization utilities and
3552+ drivers to improve the functionality, user experience and administration of
3553+ VMware virtual machines.
3554 .
3555 This package contains the debugging symbols.
3556
3557-Package: open-vm-dkms
3558+Package: open-vm-tools-dkms
3559 Architecture: all
3560+Section: kernel
3561 Pre-Depends: ${misc:Pre-Depends}
3562 Depends: ${misc:Depends}, dkms, make
3563+Conflicts: open-vm-dkms (<< 2013.04.16-1098359-0ubuntu2~)
3564+Replaces: open-vm-dkms
3565 Recommends: open-vm-tools
3566-Suggests: open-vm-toolbox
3567-Description: Source for VMware guest systems driver (DKMS)
3568+Suggests: open-vm-tools-desktop
3569+Description: Open VMware Tools for virtual machines hosted on VMware (DKMS)
3570+ The Open Virtual Machine Tools (open-vm-tools) project is an open source
3571+ implementation of VMware Tools. It is a suite of virtualization utilities and
3572+ drivers to improve the functionality, user experience and administration of
3573+ VMware virtual machines.
3574+ .
3575 This package provides the source code for the open-vm kernel modules.
3576 The open-vm-tools package is also required in order to make use of these
3577 modules. Kernel source or headers are required to compile these modules.
3578+
3579+Package: open-vm-dkms
3580+Section: oldlibs
3581+Priority: extra
3582+Architecture: all
3583+Depends: ${misc:Depends}, open-vm-tools-dkms
3584+Description: Open VMware Tools for virtual machines hosted on VMware (transitional package)
3585+ Package to ease upgrading from older open-vm-dkms packages to the new
3586+ open-vm-tools-dkms package.
3587+ .
3588+ This package can be purged at anytime once the open-vm-tools-dkms package has
3589+ been installed.
3590+
3591+Package: open-vm-toolbox
3592+Section: oldlibs
3593+Priority: extra
3594+Architecture: all
3595+Depends: ${misc:Depends}, open-vm-tools-desktop
3596+Description: Open VMware Tools for virtual machines hosted on VMware (transitional package)
3597+ Package to ease upgrading from older open-vm-toolbox packages to the new
3598+ open-vm-tools-desktop package.
3599+ .
3600+ This package can be purged at anytime once the open-vm-tools-desktop package
3601+ has been installed.
3602
3603=== modified file 'debian/copyright'
3604--- debian/copyright 2013-05-29 12:57:21 +0000
3605+++ debian/copyright 2013-09-21 20:15:28 +0000
3606@@ -7,11 +7,11 @@
3607 Copyright: VMware, Inc. <http://www.vmware.com/>
3608 License: LGPL-2.1
3609
3610-Files: */Makefile*, modules/*
3611+Files: */Makefile* modules/*
3612 Copyright: VMware, Inc. <http://www.vmware.com/>
3613 License: GPL-2
3614
3615-Files: lib/include/bsd*, lib/string/bsd*
3616+Files: lib/include/bsd* lib/string/bsd*
3617 Copyright: 1990, 1993 The Regents of the University of California.
3618 License: BSD-3
3619
3620
3621=== added file 'debian/local/open-vm-tools.service'
3622--- debian/local/open-vm-tools.service 1970-01-01 00:00:00 +0000
3623+++ debian/local/open-vm-tools.service 2013-09-21 20:15:28 +0000
3624@@ -0,0 +1,11 @@
3625+[Unit]
3626+Description=Service for virtual machines hosted on VMware
3627+Documentation=http://open-vm-tools.sourceforge.net/about.php
3628+ConditionVirtualization=vmware
3629+
3630+[Service]
3631+ExecStart=/usr/bin/vmtoolsd
3632+TimeoutStopSec=5
3633+
3634+[Install]
3635+WantedBy=multi-user.target
3636
3637=== modified file 'debian/manpages/libguestlib.3'
3638--- debian/manpages/libguestlib.3 2013-03-13 16:44:46 +0000
3639+++ debian/manpages/libguestlib.3 2013-09-21 20:15:28 +0000
3640@@ -23,12 +23,8 @@
3641 .br
3642 \fIvmware\-user\-suid\-wrapper\fR(8)
3643 .br
3644-\fIvmci\fR(9)
3645-.br
3646 \fIvmhgfs\fR(9)
3647 .br
3648-\fIvmsock\fR(9)
3649-.br
3650 \fIvmxnet\fR(9)
3651
3652 .SH HOMEPAGE
3653
3654=== modified file 'debian/manpages/libvmtools.3'
3655--- debian/manpages/libvmtools.3 2013-03-13 16:44:46 +0000
3656+++ debian/manpages/libvmtools.3 2013-09-21 20:15:28 +0000
3657@@ -23,12 +23,8 @@
3658 .br
3659 \fIvmware\-user\-suid\-wrapper\fR(8)
3660 .br
3661-\fIvmci\fR(9)
3662-.br
3663 \fIvmhgfs\fR(9)
3664 .br
3665-\fIvmsock\fR(9)
3666-.br
3667 \fIvmxnet\fR(9)
3668
3669 .SH HOMEPAGE
3670
3671=== modified file 'debian/manpages/vmblock.9'
3672--- debian/manpages/vmblock.9 2013-03-13 16:44:46 +0000
3673+++ debian/manpages/vmblock.9 2013-09-21 20:15:28 +0000
3674@@ -37,12 +37,8 @@
3675 .br
3676 \fIvmware\-user\-suid\-wrapper\fR(8)
3677 .br
3678-\fIvmci\fR(9)
3679-.br
3680 \fIvmhgfs\fR(9)
3681 .br
3682-\fIvmsock\fR(9)
3683-.br
3684 \fIvmxnet\fR(9)
3685
3686 .SH HOMEPAGE
3687
3688=== modified file 'debian/manpages/vmhgfs.9'
3689--- debian/manpages/vmhgfs.9 2013-03-13 16:44:46 +0000
3690+++ debian/manpages/vmhgfs.9 2013-09-21 20:15:28 +0000
3691@@ -45,10 +45,6 @@
3692 .br
3693 \fIvmblock\fR(9)
3694 .br
3695-\fIvmci\fR(9)
3696-.br
3697-\fIvmsock\fR(9)
3698-.br
3699 \fIvmxnet\fR(9)
3700
3701 .SH HOMEPAGE
3702
3703=== modified file 'debian/manpages/vmware-checkvm.1'
3704--- debian/manpages/vmware-checkvm.1 2013-03-13 16:44:46 +0000
3705+++ debian/manpages/vmware-checkvm.1 2013-09-21 20:15:28 +0000
3706@@ -31,12 +31,8 @@
3707 .br
3708 \fIvmblock\fR(9)
3709 .br
3710-\fIvmci\fR(9)
3711-.br
3712 \fIvmhgfs\fR(9)
3713 .br
3714-\fIvmsock\fR(9)
3715-.br
3716 \fIvmxnet\fR(9)
3717
3718 .SH HOMEPAGE
3719
3720=== modified file 'debian/manpages/vmware-hgfsclient.1'
3721--- debian/manpages/vmware-hgfsclient.1 2013-03-13 16:44:46 +0000
3722+++ debian/manpages/vmware-hgfsclient.1 2013-09-21 20:15:28 +0000
3723@@ -31,12 +31,8 @@
3724 .br
3725 \fIvmblock\fR(9)
3726 .br
3727-\fIvmci\fR(9)
3728-.br
3729 \fIvmhgfs\fR(9)
3730 .br
3731-\fIvmsock\fR(9)
3732-.br
3733 \fIvmxnet\fR(9)
3734
3735 .SH HOMEPAGE
3736
3737=== modified file 'debian/manpages/vmware-hgfsmounter.8'
3738--- debian/manpages/vmware-hgfsmounter.8 2013-03-13 16:44:46 +0000
3739+++ debian/manpages/vmware-hgfsmounter.8 2013-09-21 20:15:28 +0000
3740@@ -83,12 +83,8 @@
3741 .br
3742 \fIvmblock\fR(9)
3743 .br
3744-\fIvmci\fR(9)
3745-.br
3746 \fIvmhgfs\fR(9)
3747 .br
3748-\fIvmsock\fR(9)
3749-.br
3750 \fIvmxnet\fR(9)
3751
3752 .SH HOMEPAGE
3753
3754=== modified file 'debian/manpages/vmware-toolbox-cmd.1'
3755--- debian/manpages/vmware-toolbox-cmd.1 2013-03-13 16:44:46 +0000
3756+++ debian/manpages/vmware-toolbox-cmd.1 2013-09-21 20:15:28 +0000
3757@@ -33,12 +33,8 @@
3758 .br
3759 \fIvmblock\fR(9)
3760 .br
3761-\fIvmci\fR(9)
3762-.br
3763 \fIvmhgfs\fR(9)
3764 .br
3765-\fIvmsock\fR(9)
3766-.br
3767 \fIvmxnet\fR(9)
3768
3769 .SH HOMEPAGE
3770
3771=== modified file 'debian/manpages/vmware-user-suid-wrapper.8'
3772--- debian/manpages/vmware-user-suid-wrapper.8 2013-03-13 21:46:00 +0000
3773+++ debian/manpages/vmware-user-suid-wrapper.8 2013-09-21 20:15:28 +0000
3774@@ -33,12 +33,8 @@
3775 .br
3776 \fIvmblock\fR(9)
3777 .br
3778-\fIvmci\fR(9)
3779-.br
3780 \fIvmhgfs\fR(9)
3781 .br
3782-\fIvmsock\fR(9)
3783-.br
3784 \fIvmxnet\fR(9)
3785
3786 .SH HOMEPAGE
3787
3788=== modified file 'debian/manpages/vmware-xferlogs.1'
3789--- debian/manpages/vmware-xferlogs.1 2013-03-13 16:44:46 +0000
3790+++ debian/manpages/vmware-xferlogs.1 2013-09-21 20:15:28 +0000
3791@@ -43,12 +43,8 @@
3792 .br
3793 \fIvmblock\fR(9)
3794 .br
3795-\fIvmci\fR(9)
3796-.br
3797 \fIvmhgfs\fR(9)
3798 .br
3799-\fIvmsock\fR(9)
3800-.br
3801 \fIvmxnet\fR(9)
3802
3803 .SH HOMEPAGE
3804
3805=== modified file 'debian/manpages/vmxnet.9'
3806--- debian/manpages/vmxnet.9 2013-03-13 16:44:46 +0000
3807+++ debian/manpages/vmxnet.9 2013-09-21 20:15:28 +0000
3808@@ -40,11 +40,7 @@
3809 .br
3810 \fIvmblock\fR(9)
3811 .br
3812-\fIvmci\fR(9)
3813-.br
3814 \fIvmhgfs\fR(9)
3815-.br
3816-\fIvmsock\fR(9)
3817
3818 .SH HOMEPAGE
3819 More information about vmxnet and the Open VM Tools can be found at <\fIhttp://open\-vm\-tools.sourceforge.net/\fR>.
3820
3821=== removed file 'debian/open-vm-dkms.dkms'
3822--- debian/open-vm-dkms.dkms 2013-05-29 12:57:21 +0000
3823+++ debian/open-vm-dkms.dkms 1970-01-01 00:00:00 +0000
3824@@ -1,10 +0,0 @@
3825-PACKAGE_NAME="open-vm-tools"
3826-PACKAGE_VERSION="#MODULE_VERSION#"
3827-
3828-BUILT_MODULE_NAME[2]="vmhgfs"
3829-DEST_MODULE_LOCATION[2]="/updates/dkms/"
3830-AUTOINSTALL=yes
3831-
3832-BUILT_MODULE_NAME[3]="vmxnet"
3833-DEST_MODULE_LOCATION[3]="/updates/dkms/"
3834-AUTOINSTALL=yes
3835
3836=== removed file 'debian/open-vm-dkms.postinst'
3837--- debian/open-vm-dkms.postinst 2010-05-29 17:35:25 +0000
3838+++ debian/open-vm-dkms.postinst 1970-01-01 00:00:00 +0000
3839@@ -1,42 +0,0 @@
3840-#!/bin/sh
3841-
3842-set -e
3843-
3844-NAME="open-vm-tools"
3845-PACKAGE_NAME="open-vm-dkms"
3846-CVERSION="$(dpkg-query -W -f='${Version}' ${PACKAGE_NAME} | awk -F "-" '{ print $1 }' | cut -d\: -f2)"
3847-ARCH=$(dpkg --print-architecture)
3848-
3849-case "${1}" in
3850- configure)
3851- for POSTINST in /usr/lib/dkms/common.postinst /usr/share/${PACKAGE_NAME}/postinst
3852- do
3853- if [ -f ${POSTINST} ]
3854- then
3855- ${POSTINST} ${NAME} ${CVERSION} /usr/share/${PACKAGE_NAME} ${ARCH} ${2}
3856- exit ${?}
3857- fi
3858-
3859- echo "WARNING: ${POSTINST} does not exist."
3860- done
3861-
3862- echo "ERROR: DKMS version is too old and ${PACKAGE_NAME} was not"
3863- echo "built with legacy DKMS support."
3864- echo "You must either rebuild ${PACKAGE_NAME} with legacy postinst"
3865- echo "support or upgrade DKMS to a more current version."
3866- exit 1
3867- ;;
3868-
3869- abort-upgrade|abort-remove|abort-deconfigure)
3870-
3871- ;;
3872-
3873- *)
3874- echo "postinst called with unknown argument \`${1}'" >&2
3875- exit 1
3876- ;;
3877-esac
3878-
3879-#DEBHELPER#
3880-
3881-exit 0
3882
3883=== removed file 'debian/open-vm-dkms.prerm'
3884--- debian/open-vm-dkms.prerm 2010-05-29 17:35:25 +0000
3885+++ debian/open-vm-dkms.prerm 1970-01-01 00:00:00 +0000
3886@@ -1,29 +0,0 @@
3887-#!/bin/sh
3888-
3889-NAME="open-vm-tools"
3890-PACKAGE_NAME="open-vm-dkms"
3891-CVERSION="$(dpkg-query -W -f='${Version}' ${PACKAGE_NAME} | awk -F "-" '{ print $1 }' | cut -d\: -f2)"
3892-
3893-set -e
3894-
3895-case "${1}" in
3896- remove|upgrade|deconfigure)
3897- if [ "$(dkms status -m ${NAME})" ]
3898- then
3899- dkms remove -m ${NAME} -v ${CVERSION} --all
3900- fi
3901- ;;
3902-
3903- failed-upgrade)
3904-
3905- ;;
3906-
3907- *)
3908- echo "prerm called with unknown argument \`${1}'" >&2
3909- exit 1
3910- ;;
3911-esac
3912-
3913-#DEBHELPER#
3914-
3915-exit 0
3916
3917=== removed file 'debian/open-vm-toolbox.lintian-overrides'
3918--- debian/open-vm-toolbox.lintian-overrides 2012-01-23 16:09:45 +0000
3919+++ debian/open-vm-toolbox.lintian-overrides 1970-01-01 00:00:00 +0000
3920@@ -1,2 +0,0 @@
3921-open-vm-toolbox: desktop-command-not-in-package /usr/share/applications/vmware-user.desktop vmware-user-suid-wrapper
3922-open-vm-toolbox: setuid-binary usr/sbin/vmware-user-suid-wrapper 4755 root/root
3923
3924=== removed file 'debian/open-vm-toolbox.manpages'
3925--- debian/open-vm-toolbox.manpages 2011-08-28 16:10:21 +0000
3926+++ debian/open-vm-toolbox.manpages 1970-01-01 00:00:00 +0000
3927@@ -1,1 +0,0 @@
3928-debian/manpages/vmware-user-suid-wrapper.8
3929
3930=== added file 'debian/open-vm-tools-desktop.lintian-overrides'
3931--- debian/open-vm-tools-desktop.lintian-overrides 1970-01-01 00:00:00 +0000
3932+++ debian/open-vm-tools-desktop.lintian-overrides 2013-09-21 20:15:28 +0000
3933@@ -0,0 +1,2 @@
3934+open-vm-toolbox: desktop-command-not-in-package /usr/share/applications/vmware-user.desktop vmware-user-suid-wrapper
3935+open-vm-toolbox: setuid-binary usr/sbin/vmware-user-suid-wrapper 4755 root/root
3936
3937=== added file 'debian/open-vm-tools-desktop.manpages'
3938--- debian/open-vm-tools-desktop.manpages 1970-01-01 00:00:00 +0000
3939+++ debian/open-vm-tools-desktop.manpages 2013-09-21 20:15:28 +0000
3940@@ -0,0 +1,1 @@
3941+debian/manpages/vmware-user-suid-wrapper.8
3942
3943=== added file 'debian/open-vm-tools-dkms.dkms'
3944--- debian/open-vm-tools-dkms.dkms 1970-01-01 00:00:00 +0000
3945+++ debian/open-vm-tools-dkms.dkms 2013-09-21 20:15:28 +0000
3946@@ -0,0 +1,6 @@
3947+PACKAGE_NAME="open-vm-tools"
3948+PACKAGE_VERSION="#MODULE_VERSION#"
3949+
3950+BUILT_MODULE_NAME[1]="vmxnet"
3951+DEST_MODULE_LOCATION[1]="/updates/dkms/"
3952+AUTOINSTALL=yes
3953
3954=== added file 'debian/open-vm-tools-dkms.postinst'
3955--- debian/open-vm-tools-dkms.postinst 1970-01-01 00:00:00 +0000
3956+++ debian/open-vm-tools-dkms.postinst 2013-09-21 20:15:28 +0000
3957@@ -0,0 +1,42 @@
3958+#!/bin/sh
3959+
3960+set -e
3961+
3962+NAME="open-vm-tools"
3963+PACKAGE_NAME="open-vm-tools-dkms"
3964+CVERSION="$(dpkg-query -W -f='${Version}' ${PACKAGE_NAME} | awk -F "-" '{ print $1 }' | cut -d\: -f2)"
3965+ARCH=$(dpkg --print-architecture)
3966+
3967+case "${1}" in
3968+ configure)
3969+ for POSTINST in /usr/lib/dkms/common.postinst /usr/share/${PACKAGE_NAME}/postinst
3970+ do
3971+ if [ -f ${POSTINST} ]
3972+ then
3973+ ${POSTINST} ${NAME} ${CVERSION} /usr/share/${PACKAGE_NAME} ${ARCH} ${2}
3974+ exit ${?}
3975+ fi
3976+
3977+ echo "WARNING: ${POSTINST} does not exist."
3978+ done
3979+
3980+ echo "ERROR: DKMS version is too old and ${PACKAGE_NAME} was not"
3981+ echo "built with legacy DKMS support."
3982+ echo "You must either rebuild ${PACKAGE_NAME} with legacy postinst"
3983+ echo "support or upgrade DKMS to a more current version."
3984+ exit 1
3985+ ;;
3986+
3987+ abort-upgrade|abort-remove|abort-deconfigure)
3988+
3989+ ;;
3990+
3991+ *)
3992+ echo "postinst called with unknown argument \`${1}'" >&2
3993+ exit 1
3994+ ;;
3995+esac
3996+
3997+#DEBHELPER#
3998+
3999+exit 0
4000
4001=== added file 'debian/open-vm-tools-dkms.prerm'
4002--- debian/open-vm-tools-dkms.prerm 1970-01-01 00:00:00 +0000
4003+++ debian/open-vm-tools-dkms.prerm 2013-09-21 20:15:28 +0000
4004@@ -0,0 +1,29 @@
4005+#!/bin/sh
4006+
4007+NAME="open-vm-tools"
4008+PACKAGE_NAME="open-vm-tools-dkms"
4009+CVERSION="$(dpkg-query -W -f='${Version}' ${PACKAGE_NAME} | awk -F "-" '{ print $1 }' | cut -d\: -f2)"
4010+
4011+set -e
4012+
4013+case "${1}" in
4014+ remove|upgrade|deconfigure)
4015+ if [ "$(dkms status -m ${NAME})" ]
4016+ then
4017+ dkms remove -m ${NAME} -v ${CVERSION} --all
4018+ fi
4019+ ;;
4020+
4021+ failed-upgrade)
4022+
4023+ ;;
4024+
4025+ *)
4026+ echo "prerm called with unknown argument \`${1}'" >&2
4027+ exit 1
4028+ ;;
4029+esac
4030+
4031+#DEBHELPER#
4032+
4033+exit 0
4034
4035=== modified file 'debian/open-vm-tools.init'
4036--- debian/open-vm-tools.init 2013-05-29 12:57:21 +0000
4037+++ debian/open-vm-tools.init 2013-09-21 20:15:28 +0000
4038@@ -62,14 +62,13 @@
4039 log_end_msg 0
4040
4041 log_daemon_msg "Removing open-vm-tools modules"
4042- log_progress_msg "vmhgfs"; modprobe -r vmhgfs
4043+# log_progress_msg "vmhgfs"; modprobe -r vmhgfs
4044 log_progress_msg "vmxnet"; modprobe -r vmxnet
4045 log_end_msg 0
4046 ;;
4047
4048 force-reload|restart)
4049 ${0} stop
4050- sleep 1
4051 ${0} start
4052 ;;
4053
4054
4055=== added file 'debian/patches/0005-linux-310-fix.patch'
4056--- debian/patches/0005-linux-310-fix.patch 1970-01-01 00:00:00 +0000
4057+++ debian/patches/0005-linux-310-fix.patch 2013-09-21 20:15:28 +0000
4058@@ -0,0 +1,225 @@
4059+Author: Nate Muench <NowIWillDestroyAbydos@gmail.com>
4060+Description: Fixes building against 3.10 Kernel
4061+
4062+Index: open-vm-tools.april-update.part2/modules/linux/shared/compat_fs.h
4063+===================================================================
4064+--- open-vm-tools.april-update.part2.orig/modules/linux/shared/compat_fs.h 2013-09-06 16:04:05.108047078 -0500
4065++++ open-vm-tools.april-update.part2/modules/linux/shared/compat_fs.h 2013-09-06 16:04:05.104047078 -0500
4066+@@ -129,18 +129,6 @@
4067+ })
4068+ #endif
4069+
4070+-
4071+-/*
4072+- * putname changed to __putname in 2.6.6.
4073+- */
4074+-#define compat___getname() __getname()
4075+-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 6)
4076+-#define compat___putname(name) putname(name)
4077+-#else
4078+-#define compat___putname(name) __putname(name)
4079+-#endif
4080+-
4081+-
4082+ /*
4083+ * inc_nlink, drop_nlink, and clear_nlink were added in 2.6.19.
4084+ */
4085+Index: open-vm-tools.april-update.part2/modules/linux/vmblock/linux/control.c
4086+===================================================================
4087+--- open-vm-tools.april-update.part2.orig/modules/linux/vmblock/linux/control.c 2013-09-06 16:04:05.108047078 -0500
4088++++ open-vm-tools.april-update.part2/modules/linux/vmblock/linux/control.c 2013-09-06 16:04:05.104047078 -0500
4089+@@ -208,9 +208,10 @@
4090+ VMBlockSetProcEntryOwner(controlProcMountpoint);
4091+
4092+ /* Create /proc/fs/vmblock/dev */
4093+- controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME,
4094+- VMBLOCK_CONTROL_MODE,
4095+- controlProcDirEntry);
4096++ controlProcEntry = proc_create(VMBLOCK_CONTROL_DEVNAME,
4097++ VMBLOCK_CONTROL_MODE,
4098++ controlProcDirEntry,
4099++ &ControlFileOps);
4100+ if (!controlProcEntry) {
4101+ Warning("SetupProcDevice: could not create " VMBLOCK_DEVICE "\n");
4102+ remove_proc_entry(VMBLOCK_CONTROL_MOUNTPOINT, controlProcDirEntry);
4103+@@ -218,7 +219,6 @@
4104+ return -EINVAL;
4105+ }
4106+
4107+- controlProcEntry->proc_fops = &ControlFileOps;
4108+ return 0;
4109+ }
4110+
4111+@@ -278,7 +278,7 @@
4112+ int (*blockOp)(const char *filename, // IN: block operation
4113+ const os_blocker_id_t blocker))
4114+ {
4115+- char *name;
4116++ struct filename *name;
4117+ int i;
4118+ int retval;
4119+
4120+@@ -287,13 +287,13 @@
4121+ return PTR_ERR(name);
4122+ }
4123+
4124+- for (i = strlen(name) - 1; i >= 0 && name[i] == '/'; i--) {
4125+- name[i] = '\0';
4126++ for (i = strlen(name->name) - 1; i >= 0 && name->name[i] == '/'; i--) {
4127++ ((char *)name->name)[i] = '\0';
4128+ }
4129+
4130+- retval = i < 0 ? -EINVAL : blockOp(name, blocker);
4131++ retval = i < 0 ? -EINVAL : blockOp(name->name, blocker);
4132+
4133+- putname(name);
4134++ __putname(name);
4135+
4136+ return retval;
4137+ }
4138+Index: open-vm-tools.april-update.part2/modules/linux/vmblock/linux/dentry.c
4139+===================================================================
4140+--- open-vm-tools.april-update.part2.orig/modules/linux/vmblock/linux/dentry.c 2013-09-06 16:04:05.108047078 -0500
4141++++ open-vm-tools.april-update.part2/modules/linux/vmblock/linux/dentry.c 2013-09-06 16:04:05.104047078 -0500
4142+@@ -31,8 +31,7 @@
4143+ #include "filesystem.h"
4144+ #include "block.h"
4145+
4146+-
4147+-static int DentryOpRevalidate(struct dentry *dentry, struct nameidata *nd);
4148++static int DentryOpRevalidate(struct dentry *dentry, unsigned int flags);
4149+
4150+ struct dentry_operations LinkDentryOps = {
4151+ .d_revalidate = DentryOpRevalidate,
4152+@@ -60,7 +59,7 @@
4153+
4154+ static int
4155+ DentryOpRevalidate(struct dentry *dentry, // IN: dentry revalidating
4156+- struct nameidata *nd) // IN: lookup flags & intent
4157++ unsigned int flags) // IN: lookup flags
4158+ {
4159+ VMBlockInodeInfo *iinfo;
4160+ struct nameidata actualNd;
4161+@@ -101,7 +100,7 @@
4162+ if (actualDentry &&
4163+ actualDentry->d_op &&
4164+ actualDentry->d_op->d_revalidate) {
4165+- return actualDentry->d_op->d_revalidate(actualDentry, nd);
4166++ return actualDentry->d_op->d_revalidate(actualDentry, flags);
4167+ }
4168+
4169+ if (compat_path_lookup(iinfo->name, 0, &actualNd)) {
4170+Index: open-vm-tools.april-update.part2/modules/linux/vmblock/linux/inode.c
4171+===================================================================
4172+--- open-vm-tools.april-update.part2.orig/modules/linux/vmblock/linux/inode.c 2013-09-06 16:04:05.108047078 -0500
4173++++ open-vm-tools.april-update.part2/modules/linux/vmblock/linux/inode.c 2013-09-06 16:04:05.104047078 -0500
4174+@@ -36,7 +36,7 @@
4175+
4176+ /* Inode operations */
4177+ static struct dentry *InodeOpLookup(struct inode *dir,
4178+- struct dentry *dentry, struct nameidata *nd);
4179++ struct dentry *dentry, unsigned int flags);
4180+ static int InodeOpReadlink(struct dentry *dentry, char __user *buffer, int buflen);
4181+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
4182+ static void *InodeOpFollowlink(struct dentry *dentry, struct nameidata *nd);
4183+@@ -75,7 +75,7 @@
4184+ static struct dentry *
4185+ InodeOpLookup(struct inode *dir, // IN: parent directory's inode
4186+ struct dentry *dentry, // IN: dentry to lookup
4187+- struct nameidata *nd) // IN: lookup intent and information
4188++ unsigned int flags) // IN: lookup flags
4189+ {
4190+ char *filename;
4191+ struct inode *inode;
4192+Index: open-vm-tools.april-update.part2/modules/linux/vmhgfs/file.c
4193+===================================================================
4194+--- open-vm-tools.april-update.part2.orig/modules/linux/vmhgfs/file.c 2013-09-06 16:04:05.108047078 -0500
4195++++ open-vm-tools.april-update.part2/modules/linux/vmhgfs/file.c 2013-09-06 16:04:05.104047078 -0500
4196+@@ -25,6 +25,7 @@
4197+ /* Must come before any kernel header file. */
4198+ #include "driver-config.h"
4199+
4200++#include <linux/aio.h>
4201+ #include <linux/errno.h>
4202+ #include <linux/module.h>
4203+ #include <linux/signal.h>
4204+Index: open-vm-tools.april-update.part2/modules/linux/vmsync/sync.c
4205+===================================================================
4206+--- open-vm-tools.april-update.part2.orig/modules/linux/vmsync/sync.c 2013-09-06 16:04:05.108047078 -0500
4207++++ open-vm-tools.april-update.part2/modules/linux/vmsync/sync.c 2013-09-06 16:04:05.104047078 -0500
4208+@@ -162,7 +162,7 @@
4209+ cancel_delayed_work(&state->thawTask);
4210+ list_for_each_safe(cur, tmp, &state->devices) {
4211+ dev = list_entry(cur, VmSyncBlockDevice, list);
4212+- if (dev->sb != NULL && dev->sb->s_frozen != SB_UNFROZEN) {
4213++ if (dev->sb != NULL && dev->sb->s_writers.frozen != SB_UNFROZEN) {
4214+ thaw_bdev(dev->bdev, dev->sb);
4215+ atomic_dec(&gFreezeCount);
4216+ }
4217+@@ -237,7 +237,7 @@
4218+ * the superblock is already frozen.
4219+ */
4220+ if (inode->i_sb->s_bdev == NULL ||
4221+- inode->i_sb->s_frozen != SB_UNFROZEN) {
4222++ inode->i_sb->s_writers.frozen != SB_UNFROZEN) {
4223+ result = (inode->i_sb->s_bdev == NULL) ? -EINVAL : -EALREADY;
4224+ compat_path_release(&nd);
4225+ goto exit;
4226+@@ -303,7 +303,7 @@
4227+ const char __user *userPaths) // IN
4228+ {
4229+ int result = 0;
4230+- char *paths;
4231++ struct filename *paths;
4232+ char *currPath;
4233+ char *nextSep;
4234+ struct list_head *cur, *tmp;
4235+@@ -328,7 +328,8 @@
4236+ /*
4237+ * First, try to add all paths to the list of paths to be frozen.
4238+ */
4239+- currPath = paths;
4240++ currPath = __getname();
4241++ strcpy(currPath, paths->name);
4242+ do {
4243+ nextSep = strchr(currPath, ':');
4244+ if (nextSep != NULL) {
4245+@@ -347,6 +348,7 @@
4246+ }
4247+ currPath = nextSep + 1;
4248+ } while (nextSep != NULL);
4249++ __putname(currPath);
4250+
4251+ /*
4252+ * If adding all the requested paths worked, then freeze them.
4253+@@ -371,6 +373,8 @@
4254+ compat_mutex_unlock(&state->lock);
4255+ compat_mutex_unlock(&gFreezeLock);
4256+
4257++ __putname(paths);
4258++
4259+ if (result == 0) {
4260+ compat_schedule_delayed_work(&state->thawTask, VMSYNC_THAW_TASK_DELAY);
4261+ }
4262+@@ -670,9 +674,10 @@
4263+ }
4264+
4265+ /* Create /proc/driver/vmware-sync */
4266+- controlProcEntry = create_proc_entry("driver/vmware-sync",
4267+- S_IFREG | S_IRUSR | S_IRGRP | S_IROTH,
4268+- NULL);
4269++ controlProcEntry = proc_create("driver/vmware-sync",
4270++ S_IFREG | S_IRUSR | S_IRGRP | S_IROTH,
4271++ NULL,
4272++ &VmSyncFileOps);
4273+ if (!controlProcEntry) {
4274+ printk(KERN_ERR "vmsync: could not create /proc/driver/vmware-sync\n");
4275+ kmem_cache_destroy(gSyncStateCache);
4276+@@ -680,7 +685,6 @@
4277+ return -EINVAL;
4278+ }
4279+
4280+- controlProcEntry->proc_fops = &VmSyncFileOps;
4281+ return 0;
4282+ }
4283+
4284
4285=== added file 'debian/patches/0006-linux-311-fix.patch'
4286--- debian/patches/0006-linux-311-fix.patch 1970-01-01 00:00:00 +0000
4287+++ debian/patches/0006-linux-311-fix.patch 2013-09-21 20:15:28 +0000
4288@@ -0,0 +1,94 @@
4289+Author: Nate Muench <NowIWillDestroyAbydos@gmail.com>
4290+Description: Fixes building of vmblock module against 3.11 Kernel
4291+
4292+Index: open-vm-tools.april-update.part2/modules/linux/vmblock/linux/file.c
4293+===================================================================
4294+--- open-vm-tools.april-update.part2.orig/modules/linux/vmblock/linux/file.c 2013-09-06 16:04:22.336046467 -0500
4295++++ open-vm-tools.april-update.part2/modules/linux/vmblock/linux/file.c 2013-09-06 16:04:22.332046467 -0500
4296+@@ -38,46 +38,6 @@
4297+ typedef ino_t inode_num_t;
4298+ #endif
4299+
4300+-/* Specifically for our filldir_t callback */
4301+-typedef struct FilldirInfo {
4302+- filldir_t filldir;
4303+- void *dirent;
4304+-} FilldirInfo;
4305+-
4306+-
4307+-/*
4308+- *----------------------------------------------------------------------------
4309+- *
4310+- * Filldir --
4311+- *
4312+- * Callback function for readdir that we use in place of the one provided.
4313+- * This allows us to specify that each dentry is a symlink, but pass through
4314+- * everything else to the original filldir function.
4315+- *
4316+- * Results:
4317+- * Original filldir's return value.
4318+- *
4319+- * Side effects:
4320+- * Directory information gets copied to user's buffer.
4321+- *
4322+- *----------------------------------------------------------------------------
4323+- */
4324+-
4325+-static int
4326+-Filldir(void *buf, // IN: Dirent buffer passed from FileOpReaddir
4327+- const char *name, // IN: Dirent name
4328+- int namelen, // IN: len of dirent's name
4329+- loff_t offset, // IN: Offset
4330+- inode_num_t ino, // IN: Inode number of dirent
4331+- unsigned int d_type) // IN: Type of file
4332+-{
4333+- FilldirInfo *info = buf;
4334+-
4335+- /* Specify DT_LNK regardless */
4336+- return info->filldir(info->dirent, name, namelen, offset, ino, DT_LNK);
4337+-}
4338+-
4339+-
4340+ /* File operations */
4341+
4342+ /*
4343+@@ -166,11 +126,10 @@
4344+
4345+ static int
4346+ FileOpReaddir(struct file *file, // IN
4347+- void *dirent, // IN
4348+- filldir_t filldir) // IN
4349++ struct dir_context *ctx) // IN
4350+ {
4351+ int ret;
4352+- FilldirInfo info;
4353++
4354+ struct file *actualFile;
4355+
4356+ if (!file) {
4357+@@ -184,12 +143,10 @@
4358+ return -EINVAL;
4359+ }
4360+
4361+- info.filldir = filldir;
4362+- info.dirent = dirent;
4363+-
4364+- actualFile->f_pos = file->f_pos;
4365+- ret = vfs_readdir(actualFile, Filldir, &info);
4366+- file->f_pos = actualFile->f_pos;
4367++ /* Ricky Wong Yung Fei:
4368++ * Manipulation of pos is now handled internally by iterate_dir().
4369++ */
4370++ ret = iterate_dir(actualFile, ctx);
4371+
4372+ return ret;
4373+ }
4374+@@ -237,7 +194,7 @@
4375+
4376+
4377+ struct file_operations RootFileOps = {
4378+- .readdir = FileOpReaddir,
4379++ .iterate = FileOpReaddir,
4380+ .open = FileOpOpen,
4381+ .release = FileOpRelease,
4382+ };
4383
4384=== added file 'debian/patches/0007-dkms-suppress-error.patch'
4385--- debian/patches/0007-dkms-suppress-error.patch 1970-01-01 00:00:00 +0000
4386+++ debian/patches/0007-dkms-suppress-error.patch 2013-09-21 20:15:28 +0000
4387@@ -0,0 +1,41 @@
4388+Author: Nate Muench <NowIWillDestroyAbydos@gmail.com>
4389+Description: Builds only the modules that actually work.
4390+
4391+Index: open-vm-tools-2013.04.16-1098359/modules/linux/dkms.conf
4392+===================================================================
4393+--- open-vm-tools-2013.04.16-1098359.orig/modules/linux/dkms.conf 2013-09-07 20:50:04.000000000 -0500
4394++++ open-vm-tools-2013.04.16-1098359/modules/linux/dkms.conf 2013-09-07 20:53:21.168995183 -0500
4395+@@ -7,28 +7,13 @@
4396+ # needs to be built afterwards; the MODULEBUILDDIR variable tells the makefiles
4397+ # where to store / retrive those symbol files.
4398+ MAKE[0]="$MAKE_CMD_TMPL -C vmblock; \
4399+- $MAKE_CMD_TMPL -C vmci; \
4400+- $MAKE_CMD_TMPL -C vmhgfs; \
4401+- $MAKE_CMD_TMPL -C vmxnet; \
4402+- $MAKE_CMD_TMPL -C vsock"
4403++ $MAKE_CMD_TMPL -C vmxnet"
4404+ CLEAN[0]="$MAKE_CMD_TMPL -C vmblock clean; \
4405+- $MAKE_CMD_TMPL -C vmci clean; \
4406+- $MAKE_CMD_TMPL -C vmhgfs clean; \
4407+- $MAKE_CMD_TMPL -C vmxnet clean; \
4408+- $MAKE_CMD_TMPL -C vsock clean"
4409++ $MAKE_CMD_TMPL -C vmxnet clean"
4410+ BUILT_MODULE_NAME[0]="vmblock"
4411+-BUILT_MODULE_NAME[1]="vmci"
4412+-BUILT_MODULE_NAME[2]="vmhgfs"
4413+-BUILT_MODULE_NAME[3]="vmxnet"
4414+-BUILT_MODULE_NAME[4]="vsock"
4415++BUILT_MODULE_NAME[1]="vmxnet"
4416+ BUILT_MODULE_LOCATION[0]="vmblock/"
4417+-BUILT_MODULE_LOCATION[1]="vmci/"
4418+-BUILT_MODULE_LOCATION[2]="vmhgfs/"
4419+-BUILT_MODULE_LOCATION[3]="vmxnet/"
4420+-BUILT_MODULE_LOCATION[4]="vsock/"
4421++BUILT_MODULE_LOCATION[1]="vmxnet/"
4422+ DEST_MODULE_LOCATION[0]="/kernel/fs/vmblock"
4423+-DEST_MODULE_LOCATION[1]="/kernel/drivers/misc"
4424+-DEST_MODULE_LOCATION[2]="/kernel/fs/vmhgfs"
4425+-DEST_MODULE_LOCATION[3]="/kernel/drivers/net"
4426+-DEST_MODULE_LOCATION[4]="/kernel/net/vsock"
4427++DEST_MODULE_LOCATION[1]="/kernel/drivers/net"
4428+ AUTOINSTALL="YES"
4429
4430=== modified file 'debian/patches/series'
4431--- debian/patches/series 2013-05-29 12:57:21 +0000
4432+++ debian/patches/series 2013-09-21 20:15:28 +0000
4433@@ -2,3 +2,6 @@
4434 0002-dkms.patch
4435 0003-dkms-vmsync.patch
4436 0004-vsock-cve.patch
4437+0005-linux-310-fix.patch
4438+0006-linux-311-fix.patch
4439+0007-dkms-suppress-error.patch
4440
4441=== modified file 'debian/rules'
4442--- debian/rules 2013-05-29 12:57:21 +0000
4443+++ debian/rules 2013-09-21 20:15:28 +0000
4444@@ -1,19 +1,19 @@
4445 #!/usr/bin/make -f
4446
4447 export CFLAGS += -Wno-deprecated-declarations
4448-export CFLAGS += -Wno-error=unused-local-typedefs
4449+#export CFLAGS += -Wno-error=unused-local-typedefs
4450 export LIBS += -lpthread
4451
4452 %:
4453 dh ${@} --with autotools_dev
4454
4455 override_dh_auto_configure:
4456- dh_auto_configure -- --prefix=/usr --libdir=\$${prefix}/lib --without-kernel-modules
4457+ dh_auto_configure -- --prefix=/usr --libdir=\$${prefix}/lib --without-kernel-modules CC=/usr/bin/gcc-4.7
4458
4459 override_dh_auto_install:
4460 dh_auto_install -- DESTDIR=$(CURDIR)/debian/open-vm-tools
4461
4462- install -D -m 0755 vmware-user-suid-wrapper/vmware-user-suid-wrapper debian/open-vm-toolbox/usr/sbin/vmware-user-suid-wrapper
4463+ install -D -m 0755 vmware-user-suid-wrapper/vmware-user-suid-wrapper debian/open-vm-tools-desktop/usr/sbin/vmware-user-suid-wrapper
4464
4465 if [ -e debian/open-vm-tools/etc/pam.d/vmtoolsd-x64 ]; \
4466 then \
4467@@ -24,18 +24,19 @@
4468 chmod 0644 debian/open-vm-tools/etc/pam.d/vmtoolsd
4469
4470 install -D -m 0755 debian/local/vmxnet.hook debian/open-vm-tools/usr/share/initramfs-tools/hooks/vmxnet
4471- install -D -m 0644 debian/local/xautostart.conf debian/open-vm-toolbox/etc/vmware-tools/xautostart.conf
4472+ install -D -m 0644 debian/local/xautostart.conf debian/open-vm-tools-desktop/etc/vmware-tools/xautostart.conf
4473 install -D -m 0644 debian/local/tools.conf debian/open-vm-tools/etc/vmware-tools/tools.conf
4474+ install -D -m 0755 debian/local/open-vm-tools.service debian/open-vm-tools/lib/systemd/system/open-vm-tools.service
4475
4476 # open-vm-tools-dev
4477 mkdir -p debian/open-vm-tools-dev/usr/share/doc/open-vm-tools
4478 mv debian/open-vm-tools/usr/share/doc/open-vm-tools/api debian/open-vm-tools-dev/usr/share/doc/open-vm-tools
4479
4480- # open-vm-dkms
4481- mkdir -p debian/open-vm-dkms/usr/src
4482- sh modules/linux/dkms.sh . debian/open-vm-dkms/usr/src
4483- find debian/open-vm-dkms/usr/src -name COPYING | xargs rm -f
4484- find debian/open-vm-dkms/usr/src -name "Makefile*" | xargs chmod 0755
4485+ # open-vm-tools-dkms
4486+ mkdir -p debian/open-vm-tools-dkms/usr/src
4487+ sh modules/linux/dkms.sh . debian/open-vm-tools-dkms/usr/src
4488+ find debian/open-vm-tools-dkms/usr/src -name COPYING | xargs rm -f
4489+ find debian/open-vm-tools-dkms/usr/src -name "Makefile*" | xargs chmod 0755
4490
4491 # removing useless files
4492 rm -f debian/open-vm-tools/usr/lib/*.la
4493@@ -46,16 +47,16 @@
4494 mkdir -p debian/open-vm-tools/sbin
4495 mv debian/open-vm-tools/usr/sbin/mount.vmhgfs debian/open-vm-tools/sbin/mount.vmhgfs
4496
4497- # moving open-vm-toolbox files
4498- mkdir -p debian/open-vm-toolbox/etc
4499- mv debian/open-vm-tools/etc/xdg debian/open-vm-toolbox/etc/
4500-
4501- mkdir -p debian/open-vm-toolbox/usr/lib/open-vm-tools/plugins
4502- mv debian/open-vm-tools/usr/lib/open-vm-tools/plugins/vmusr debian/open-vm-toolbox/usr/lib/open-vm-tools/plugins
4503-
4504- mkdir -p debian/open-vm-toolbox/usr/bin
4505- install -m 755 scripts/common/vmware-xdg-detect-de debian/open-vm-toolbox/usr/bin
4506- install -D -m 4755 vmware-user-suid-wrapper/vmware-user-suid-wrapper debian/open-vm-toolbox/usr/sbin/vmware-user-suid-wrapper
4507+ # moving open-vm-tools-desktop files
4508+ mkdir -p debian/open-vm-tools-desktop/etc
4509+ mv debian/open-vm-tools/etc/xdg debian/open-vm-tools-desktop/etc/
4510+
4511+ mkdir -p debian/open-vm-tools-desktop/usr/lib/open-vm-tools/plugins
4512+ mv debian/open-vm-tools/usr/lib/open-vm-tools/plugins/vmusr debian/open-vm-tools-desktop/usr/lib/open-vm-tools/plugins
4513+
4514+ mkdir -p debian/open-vm-tools-desktop/usr/bin
4515+ install -m 755 scripts/common/vmware-xdg-detect-de debian/open-vm-tools-desktop/usr/bin
4516+ install -D -m 4755 vmware-user-suid-wrapper/vmware-user-suid-wrapper debian/open-vm-tools-desktop/usr/sbin/vmware-user-suid-wrapper
4517
4518 override_dh_builddeb:
4519 dh_builddeb -- -Zxz
4520
4521=== modified file 'modules/linux/dkms.conf'
4522--- modules/linux/dkms.conf 2013-05-29 12:57:21 +0000
4523+++ modules/linux/dkms.conf 2013-09-21 20:15:28 +0000
4524@@ -7,28 +7,13 @@
4525 # needs to be built afterwards; the MODULEBUILDDIR variable tells the makefiles
4526 # where to store / retrive those symbol files.
4527 MAKE[0]="$MAKE_CMD_TMPL -C vmblock; \
4528- $MAKE_CMD_TMPL -C vmci; \
4529- $MAKE_CMD_TMPL -C vmhgfs; \
4530- $MAKE_CMD_TMPL -C vmxnet; \
4531- $MAKE_CMD_TMPL -C vsock"
4532+ $MAKE_CMD_TMPL -C vmxnet"
4533 CLEAN[0]="$MAKE_CMD_TMPL -C vmblock clean; \
4534- $MAKE_CMD_TMPL -C vmci clean; \
4535- $MAKE_CMD_TMPL -C vmhgfs clean; \
4536- $MAKE_CMD_TMPL -C vmxnet clean; \
4537- $MAKE_CMD_TMPL -C vsock clean"
4538+ $MAKE_CMD_TMPL -C vmxnet clean"
4539 BUILT_MODULE_NAME[0]="vmblock"
4540-BUILT_MODULE_NAME[1]="vmci"
4541-BUILT_MODULE_NAME[2]="vmhgfs"
4542-BUILT_MODULE_NAME[3]="vmxnet"
4543-BUILT_MODULE_NAME[4]="vsock"
4544+BUILT_MODULE_NAME[1]="vmxnet"
4545 BUILT_MODULE_LOCATION[0]="vmblock/"
4546-BUILT_MODULE_LOCATION[1]="vmci/"
4547-BUILT_MODULE_LOCATION[2]="vmhgfs/"
4548-BUILT_MODULE_LOCATION[3]="vmxnet/"
4549-BUILT_MODULE_LOCATION[4]="vsock/"
4550+BUILT_MODULE_LOCATION[1]="vmxnet/"
4551 DEST_MODULE_LOCATION[0]="/kernel/fs/vmblock"
4552-DEST_MODULE_LOCATION[1]="/kernel/drivers/misc"
4553-DEST_MODULE_LOCATION[2]="/kernel/fs/vmhgfs"
4554-DEST_MODULE_LOCATION[3]="/kernel/drivers/net"
4555-DEST_MODULE_LOCATION[4]="/kernel/net/vsock"
4556+DEST_MODULE_LOCATION[1]="/kernel/drivers/net"
4557 AUTOINSTALL="YES"
4558
4559=== modified file 'modules/linux/shared/compat_fs.h'
4560--- modules/linux/shared/compat_fs.h 2012-08-03 16:09:30 +0000
4561+++ modules/linux/shared/compat_fs.h 2013-09-21 20:15:28 +0000
4562@@ -129,18 +129,6 @@
4563 })
4564 #endif
4565
4566-
4567-/*
4568- * putname changed to __putname in 2.6.6.
4569- */
4570-#define compat___getname() __getname()
4571-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 6)
4572-#define compat___putname(name) putname(name)
4573-#else
4574-#define compat___putname(name) __putname(name)
4575-#endif
4576-
4577-
4578 /*
4579 * inc_nlink, drop_nlink, and clear_nlink were added in 2.6.19.
4580 */
4581
4582=== modified file 'modules/linux/vmblock/linux/control.c'
4583--- modules/linux/vmblock/linux/control.c 2012-01-23 16:09:45 +0000
4584+++ modules/linux/vmblock/linux/control.c 2013-09-21 20:15:28 +0000
4585@@ -208,9 +208,10 @@
4586 VMBlockSetProcEntryOwner(controlProcMountpoint);
4587
4588 /* Create /proc/fs/vmblock/dev */
4589- controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME,
4590- VMBLOCK_CONTROL_MODE,
4591- controlProcDirEntry);
4592+ controlProcEntry = proc_create(VMBLOCK_CONTROL_DEVNAME,
4593+ VMBLOCK_CONTROL_MODE,
4594+ controlProcDirEntry,
4595+ &ControlFileOps);
4596 if (!controlProcEntry) {
4597 Warning("SetupProcDevice: could not create " VMBLOCK_DEVICE "\n");
4598 remove_proc_entry(VMBLOCK_CONTROL_MOUNTPOINT, controlProcDirEntry);
4599@@ -218,7 +219,6 @@
4600 return -EINVAL;
4601 }
4602
4603- controlProcEntry->proc_fops = &ControlFileOps;
4604 return 0;
4605 }
4606
4607@@ -278,7 +278,7 @@
4608 int (*blockOp)(const char *filename, // IN: block operation
4609 const os_blocker_id_t blocker))
4610 {
4611- char *name;
4612+ struct filename *name;
4613 int i;
4614 int retval;
4615
4616@@ -287,13 +287,13 @@
4617 return PTR_ERR(name);
4618 }
4619
4620- for (i = strlen(name) - 1; i >= 0 && name[i] == '/'; i--) {
4621- name[i] = '\0';
4622+ for (i = strlen(name->name) - 1; i >= 0 && name->name[i] == '/'; i--) {
4623+ ((char *)name->name)[i] = '\0';
4624 }
4625
4626- retval = i < 0 ? -EINVAL : blockOp(name, blocker);
4627+ retval = i < 0 ? -EINVAL : blockOp(name->name, blocker);
4628
4629- putname(name);
4630+ __putname(name);
4631
4632 return retval;
4633 }
4634
4635=== modified file 'modules/linux/vmblock/linux/dentry.c'
4636--- modules/linux/vmblock/linux/dentry.c 2012-01-23 16:09:45 +0000
4637+++ modules/linux/vmblock/linux/dentry.c 2013-09-21 20:15:28 +0000
4638@@ -31,8 +31,7 @@
4639 #include "filesystem.h"
4640 #include "block.h"
4641
4642-
4643-static int DentryOpRevalidate(struct dentry *dentry, struct nameidata *nd);
4644+static int DentryOpRevalidate(struct dentry *dentry, unsigned int flags);
4645
4646 struct dentry_operations LinkDentryOps = {
4647 .d_revalidate = DentryOpRevalidate,
4648@@ -60,7 +59,7 @@
4649
4650 static int
4651 DentryOpRevalidate(struct dentry *dentry, // IN: dentry revalidating
4652- struct nameidata *nd) // IN: lookup flags & intent
4653+ unsigned int flags) // IN: lookup flags
4654 {
4655 VMBlockInodeInfo *iinfo;
4656 struct nameidata actualNd;
4657@@ -101,7 +100,7 @@
4658 if (actualDentry &&
4659 actualDentry->d_op &&
4660 actualDentry->d_op->d_revalidate) {
4661- return actualDentry->d_op->d_revalidate(actualDentry, nd);
4662+ return actualDentry->d_op->d_revalidate(actualDentry, flags);
4663 }
4664
4665 if (compat_path_lookup(iinfo->name, 0, &actualNd)) {
4666
4667=== modified file 'modules/linux/vmblock/linux/file.c'
4668--- modules/linux/vmblock/linux/file.c 2011-08-28 16:10:21 +0000
4669+++ modules/linux/vmblock/linux/file.c 2013-09-21 20:15:28 +0000
4670@@ -38,46 +38,6 @@
4671 typedef ino_t inode_num_t;
4672 #endif
4673
4674-/* Specifically for our filldir_t callback */
4675-typedef struct FilldirInfo {
4676- filldir_t filldir;
4677- void *dirent;
4678-} FilldirInfo;
4679-
4680-
4681-/*
4682- *----------------------------------------------------------------------------
4683- *
4684- * Filldir --
4685- *
4686- * Callback function for readdir that we use in place of the one provided.
4687- * This allows us to specify that each dentry is a symlink, but pass through
4688- * everything else to the original filldir function.
4689- *
4690- * Results:
4691- * Original filldir's return value.
4692- *
4693- * Side effects:
4694- * Directory information gets copied to user's buffer.
4695- *
4696- *----------------------------------------------------------------------------
4697- */
4698-
4699-static int
4700-Filldir(void *buf, // IN: Dirent buffer passed from FileOpReaddir
4701- const char *name, // IN: Dirent name
4702- int namelen, // IN: len of dirent's name
4703- loff_t offset, // IN: Offset
4704- inode_num_t ino, // IN: Inode number of dirent
4705- unsigned int d_type) // IN: Type of file
4706-{
4707- FilldirInfo *info = buf;
4708-
4709- /* Specify DT_LNK regardless */
4710- return info->filldir(info->dirent, name, namelen, offset, ino, DT_LNK);
4711-}
4712-
4713-
4714 /* File operations */
4715
4716 /*
4717@@ -166,11 +126,10 @@
4718
4719 static int
4720 FileOpReaddir(struct file *file, // IN
4721- void *dirent, // IN
4722- filldir_t filldir) // IN
4723+ struct dir_context *ctx) // IN
4724 {
4725 int ret;
4726- FilldirInfo info;
4727+
4728 struct file *actualFile;
4729
4730 if (!file) {
4731@@ -184,12 +143,10 @@
4732 return -EINVAL;
4733 }
4734
4735- info.filldir = filldir;
4736- info.dirent = dirent;
4737-
4738- actualFile->f_pos = file->f_pos;
4739- ret = vfs_readdir(actualFile, Filldir, &info);
4740- file->f_pos = actualFile->f_pos;
4741+ /* Ricky Wong Yung Fei:
4742+ * Manipulation of pos is now handled internally by iterate_dir().
4743+ */
4744+ ret = iterate_dir(actualFile, ctx);
4745
4746 return ret;
4747 }
4748@@ -237,7 +194,7 @@
4749
4750
4751 struct file_operations RootFileOps = {
4752- .readdir = FileOpReaddir,
4753+ .iterate = FileOpReaddir,
4754 .open = FileOpOpen,
4755 .release = FileOpRelease,
4756 };
4757
4758=== modified file 'modules/linux/vmblock/linux/inode.c'
4759--- modules/linux/vmblock/linux/inode.c 2009-08-25 10:35:29 +0000
4760+++ modules/linux/vmblock/linux/inode.c 2013-09-21 20:15:28 +0000
4761@@ -36,7 +36,7 @@
4762
4763 /* Inode operations */
4764 static struct dentry *InodeOpLookup(struct inode *dir,
4765- struct dentry *dentry, struct nameidata *nd);
4766+ struct dentry *dentry, unsigned int flags);
4767 static int InodeOpReadlink(struct dentry *dentry, char __user *buffer, int buflen);
4768 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
4769 static void *InodeOpFollowlink(struct dentry *dentry, struct nameidata *nd);
4770@@ -75,7 +75,7 @@
4771 static struct dentry *
4772 InodeOpLookup(struct inode *dir, // IN: parent directory's inode
4773 struct dentry *dentry, // IN: dentry to lookup
4774- struct nameidata *nd) // IN: lookup intent and information
4775+ unsigned int flags) // IN: lookup flags
4776 {
4777 char *filename;
4778 struct inode *inode;
4779
4780=== modified file 'modules/linux/vmhgfs/file.c'
4781--- modules/linux/vmhgfs/file.c 2013-01-28 16:11:13 +0000
4782+++ modules/linux/vmhgfs/file.c 2013-09-21 20:15:28 +0000
4783@@ -25,6 +25,7 @@
4784 /* Must come before any kernel header file. */
4785 #include "driver-config.h"
4786
4787+#include <linux/aio.h>
4788 #include <linux/errno.h>
4789 #include <linux/module.h>
4790 #include <linux/signal.h>
4791
4792=== modified file 'modules/linux/vmsync/sync.c'
4793--- modules/linux/vmsync/sync.c 2012-01-23 16:09:45 +0000
4794+++ modules/linux/vmsync/sync.c 2013-09-21 20:15:28 +0000
4795@@ -162,7 +162,7 @@
4796 cancel_delayed_work(&state->thawTask);
4797 list_for_each_safe(cur, tmp, &state->devices) {
4798 dev = list_entry(cur, VmSyncBlockDevice, list);
4799- if (dev->sb != NULL && dev->sb->s_frozen != SB_UNFROZEN) {
4800+ if (dev->sb != NULL && dev->sb->s_writers.frozen != SB_UNFROZEN) {
4801 thaw_bdev(dev->bdev, dev->sb);
4802 atomic_dec(&gFreezeCount);
4803 }
4804@@ -237,7 +237,7 @@
4805 * the superblock is already frozen.
4806 */
4807 if (inode->i_sb->s_bdev == NULL ||
4808- inode->i_sb->s_frozen != SB_UNFROZEN) {
4809+ inode->i_sb->s_writers.frozen != SB_UNFROZEN) {
4810 result = (inode->i_sb->s_bdev == NULL) ? -EINVAL : -EALREADY;
4811 compat_path_release(&nd);
4812 goto exit;
4813@@ -303,7 +303,7 @@
4814 const char __user *userPaths) // IN
4815 {
4816 int result = 0;
4817- char *paths;
4818+ struct filename *paths;
4819 char *currPath;
4820 char *nextSep;
4821 struct list_head *cur, *tmp;
4822@@ -328,7 +328,8 @@
4823 /*
4824 * First, try to add all paths to the list of paths to be frozen.
4825 */
4826- currPath = paths;
4827+ currPath = __getname();
4828+ strcpy(currPath, paths->name);
4829 do {
4830 nextSep = strchr(currPath, ':');
4831 if (nextSep != NULL) {
4832@@ -347,6 +348,7 @@
4833 }
4834 currPath = nextSep + 1;
4835 } while (nextSep != NULL);
4836+ __putname(currPath);
4837
4838 /*
4839 * If adding all the requested paths worked, then freeze them.
4840@@ -371,6 +373,8 @@
4841 compat_mutex_unlock(&state->lock);
4842 compat_mutex_unlock(&gFreezeLock);
4843
4844+ __putname(paths);
4845+
4846 if (result == 0) {
4847 compat_schedule_delayed_work(&state->thawTask, VMSYNC_THAW_TASK_DELAY);
4848 }
4849@@ -670,9 +674,10 @@
4850 }
4851
4852 /* Create /proc/driver/vmware-sync */
4853- controlProcEntry = create_proc_entry("driver/vmware-sync",
4854- S_IFREG | S_IRUSR | S_IRGRP | S_IROTH,
4855- NULL);
4856+ controlProcEntry = proc_create("driver/vmware-sync",
4857+ S_IFREG | S_IRUSR | S_IRGRP | S_IROTH,
4858+ NULL,
4859+ &VmSyncFileOps);
4860 if (!controlProcEntry) {
4861 printk(KERN_ERR "vmsync: could not create /proc/driver/vmware-sync\n");
4862 kmem_cache_destroy(gSyncStateCache);
4863@@ -680,7 +685,6 @@
4864 return -EINVAL;
4865 }
4866
4867- controlProcEntry->proc_fops = &VmSyncFileOps;
4868 return 0;
4869 }
4870

Subscribers

People subscribed via source and target branches