ASSERT(inode);
LOG(4, (KERN_DEBUG "VMware hgfs: HgfsTruncatePages: entered\n"));
- result = compat_vmtruncate(inode, newSize);
+
+ /*
+ * In 3.8.0, vmtruncate was removed and replaced by calling the check
+ * size and set directly.
+ */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
+ result = vmtruncate(inode, newSize);
+#else
+ result = inode_newsize_ok(inode, newSize);
+ if (0 == result) {
+ truncate_setsize(inode, newSize);
+ }
+#endif
if (result) {
LOG(4, (KERN_DEBUG "VMware hgfs: HgfsTruncatePages: vmtruncate failed "
"with error code %d\n", result));
if (mask & MAY_ACCESS) { /* For sys_access. */
struct dentry *dentry;
struct hlist_node *p;
- int dcount = 0;
if (mask & MAY_NOT_BLOCK)
return -ECHILD;
/* Find a dentry with valid d_count. Refer bug 587879. */
hlist_for_each_entry(dentry, p, &inode->i_dentry, d_alias) {
- dcount = dentry->d_count;
+ int dcount = dentry->d_count;
if (dcount) {
LOG(4, ("Found %s %d \n", dentry->d_name.name, dcount));
- break;
+ return HgfsAccessInt(dentry, mask & (MAY_READ | MAY_WRITE | MAY_EXEC));
}
}
- ASSERT(dcount);
- return HgfsAccessInt(dentry, mask & (MAY_READ | MAY_WRITE | MAY_EXEC));
+ ASSERT(FALSE);
}
return 0;
}
if (mask & MAY_ACCESS) { /* For sys_access. */
#endif
struct list_head *pos;
- int dcount = 0;
- struct dentry *dentry = NULL;
/*
* In 2.6.38 path walk is done in 2 distinct modes: rcu-walk and
/* Find a dentry with valid d_count. Refer bug 587879. */
list_for_each(pos, &inode->i_dentry) {
- dentry = list_entry(pos, struct dentry, d_alias);
+ int dcount;
+ struct dentry *dentry = list_entry(pos, struct dentry, d_alias);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38)
dcount = atomic_read(&dentry->d_count);
#else
#endif
if (dcount) {
LOG(4, ("Found %s %d \n", (dentry)->d_name.name, dcount));
- break;
+ return HgfsAccessInt(dentry, mask & (MAY_READ | MAY_WRITE | MAY_EXEC));
}
}
- ASSERT(dcount);
- return HgfsAccessInt(dentry, mask & (MAY_READ | MAY_WRITE | MAY_EXEC));
+ ASSERT(FALSE);
}
return 0;
}