[packages/open-vm-tools] - make the patch work on any kernel
baggins
baggins at pld-linux.org
Sat Feb 8 18:01:36 CET 2014
commit 6d3c800b8898b81b1fcf38ebd1dc60ffa39237d2
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Sat Feb 8 18:01:22 2014 +0100
- make the patch work on any kernel
open-vm-tools-linux-3.12.patch | 93 +++++++++++++++++++++++++++++++-----------
1 file changed, 69 insertions(+), 24 deletions(-)
---
diff --git a/open-vm-tools-linux-3.12.patch b/open-vm-tools-linux-3.12.patch
index 5f2815e..e2487d5 100644
--- a/open-vm-tools-linux-3.12.patch
+++ b/open-vm-tools-linux-3.12.patch
@@ -100,125 +100,170 @@
}
--- a/modules/linux/vsock/linux/af_vsock.c
+++ b/modules/linux/vsock/linux/af_vsock.c
-@@ -3147,7 +3147,7 @@ __VSockVmciCreate(struct net *net,
+@@ -3147,7 +3147,11 @@ __VSockVmciCreate(struct net *net,
vsk->connectTimeout = psk->connectTimeout;
} else {
vsk->trusted = capable(CAP_NET_ADMIN);
-- vsk->owner = current_uid();
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+ vsk->owner = current_uid();
++#else
+ vsk->owner = from_kuid(&init_user_ns, current_uid());
++#endif
vsk->queuePairSize = VSOCK_DEFAULT_QP_SIZE;
vsk->queuePairMinSize = VSOCK_DEFAULT_QP_SIZE_MIN;
vsk->queuePairMaxSize = VSOCK_DEFAULT_QP_SIZE_MAX;
--- a/modules/linux/vmhgfs/file.c
+++ b/modules/linux/vmhgfs/file.c
-@@ -656,7 +656,8 @@ HgfsOpen(struct inode *inode, // IN: In
+@@ -656,7 +656,12 @@ HgfsOpen(struct inode *inode, // IN: In
iparent = dparent->d_inode;
HgfsSetUidGid(iparent, file->f_dentry,
-- current_fsuid(), current_fsgid());
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+ current_fsuid(), current_fsgid());
++#else
+ from_kuid(&init_user_ns, current_fsuid()),
+ from_kgid(&init_user_ns,current_fsgid()));
++#endif
dput(dparent);
}
--- a/modules/linux/vmhgfs/filesystem.c
+++ b/modules/linux/vmhgfs/filesystem.c
-@@ -231,13 +231,13 @@ HgfsInitSuperInfo(HgfsMountInfo *mountIn
+@@ -231,13 +231,21 @@ HgfsInitSuperInfo(HgfsMountInfo *mountIn
if (si->uidSet) {
si->uid = mountInfo->uid;
} else {
-- si->uid = current_uid();
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+ si->uid = current_uid();
++#else
+ si->uid = from_kuid(&init_user_ns, current_uid());
++#endif
}
si->gidSet = mountInfo->gidSet;
if (si->gidSet) {
si->gid = mountInfo->gid;
} else {
-- si->gid = current_gid();
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+ si->gid = current_gid();
++#else
+ si->gid = from_kgid(&init_user_ns, current_gid());
++#endif
}
si->fmask = mountInfo->fmask;
si->dmask = mountInfo->dmask;
--- a/modules/linux/vmhgfs/inode.c
+++ b/modules/linux/vmhgfs/inode.c
-@@ -490,13 +490,13 @@ HgfsPackSetattrRequest(struct iattr *iat
+@@ -490,13 +490,21 @@ HgfsPackSetattrRequest(struct iattr *iat
if (valid & ATTR_UID) {
attrV2->mask |= HGFS_ATTR_VALID_USERID;
-- attrV2->userId = iattr->ia_uid;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+ attrV2->userId = iattr->ia_uid;
++#else
+ attrV2->userId = from_kuid(&init_user_ns, iattr->ia_uid);
++#endif
*changed = TRUE;
}
if (valid & ATTR_GID) {
attrV2->mask |= HGFS_ATTR_VALID_GROUPID;
-- attrV2->groupId = iattr->ia_gid;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+ attrV2->groupId = iattr->ia_gid;
++#else
+ attrV2->groupId = from_kgid(&init_user_ns, iattr->ia_gid);
++#endif
*changed = TRUE;
}
-@@ -593,13 +593,13 @@ HgfsPackSetattrRequest(struct iattr *iat
+@@ -593,13 +593,21 @@ HgfsPackSetattrRequest(struct iattr *iat
if (valid & ATTR_UID) {
attrV2->mask |= HGFS_ATTR_VALID_USERID;
-- attrV2->userId = iattr->ia_uid;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+ attrV2->userId = iattr->ia_uid;
++#else
+ attrV2->userId = from_kuid(&init_user_ns, iattr->ia_uid);
++#endif
*changed = TRUE;
}
if (valid & ATTR_GID) {
attrV2->mask |= HGFS_ATTR_VALID_GROUPID;
-- attrV2->groupId = iattr->ia_gid;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+ attrV2->groupId = iattr->ia_gid;
++#else
+ attrV2->groupId = from_kgid(&init_user_ns, iattr->ia_gid);
++#endif
*changed = TRUE;
}
-@@ -1192,7 +1192,8 @@ HgfsMkdir(struct inode *dir, // IN:
+@@ -1192,7 +1192,12 @@ HgfsMkdir(struct inode *dir, // IN:
* a Linux machine and as root, but we might as well give it
* a go.
*/
-- HgfsSetUidGid(dir, dentry, current_fsuid(), current_fsgid());
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+ HgfsSetUidGid(dir, dentry, current_fsuid(), current_fsgid());
++#else
+ HgfsSetUidGid(dir, dentry, from_kuid(&init_user_ns, current_fsuid()),
+ from_kgid(&init_user_ns, current_fsgid()));
++#endif
}
/*
--- a/modules/linux/vmhgfs/fsutil.c
+++ b/modules/linux/vmhgfs/fsutil.c
-@@ -639,14 +639,14 @@ HgfsChangeFileAttributes(struct inode *i
+@@ -639,14 +639,30 @@ HgfsChangeFileAttributes(struct inode *i
* the server didn't give us a uid or gid.
*/
if (si->uidSet || (attr->mask & HGFS_ATTR_VALID_USERID) == 0) {
-- inode->i_uid = si->uid;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+ inode->i_uid = si->uid;
++#else
+ inode->i_uid = make_kuid(&init_user_ns, si->uid);
++#endif
} else {
-- inode->i_uid = attr->userId;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+ inode->i_uid = attr->userId;
++#else
+ inode->i_uid = make_kuid(&init_user_ns, attr->userId);
++#endif
}
if (si->gidSet || (attr->mask & HGFS_ATTR_VALID_GROUPID) == 0) {
-- inode->i_gid = si->gid;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+ inode->i_gid = si->gid;
++#else
+ inode->i_gid = make_kgid(&init_user_ns, si->gid);
++#endif
} else {
-- inode->i_gid = attr->groupId;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+ inode->i_gid = attr->groupId;
++#else
+ inode->i_gid = make_kgid(&init_user_ns, attr->groupId);
++#endif
}
inode->i_rdev = 0; /* Device nodes are not supported */
-@@ -1623,7 +1623,7 @@ HgfsSetUidGid(struct inode *parent,
+@@ -1623,7 +1623,11 @@ HgfsSetUidGid(struct inode *parent,
struct iattr setUidGid;
setUidGid.ia_valid = ATTR_UID;
-- setUidGid.ia_uid = uid;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+ setUidGid.ia_uid = uid;
++#else
+ setUidGid.ia_uid = make_kuid(&init_user_ns, uid);
++#endif
/*
* Only set the gid if the host file system wouldn't have for us. See the
-@@ -1631,7 +1631,7 @@ HgfsSetUidGid(struct inode *parent,
+@@ -1631,7 +1631,11 @@ HgfsSetUidGid(struct inode *parent,
*/
if (!parent || !(parent->i_mode & S_ISGID)) {
setUidGid.ia_valid |= ATTR_GID;
-- setUidGid.ia_gid = gid;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+ setUidGid.ia_gid = gid;
++#else
+ setUidGid.ia_gid = make_kgid(&init_user_ns, gid);
++#endif
}
/*
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/open-vm-tools.git/commitdiff/6d3c800b8898b81b1fcf38ebd1dc60ffa39237d2
More information about the pld-cvs-commit
mailing list