nsproxy: add struct nsset
[sfrench/cifs-2.6.git] / include / linux / nsproxy.h
index 074f395b9ad25484871d2452325476253cb23932..cdb171efc7cb052dd4844ae182206939627c68e8 100644 (file)
@@ -41,6 +41,30 @@ struct nsproxy {
 };
 extern struct nsproxy init_nsproxy;
 
+/*
+ * A structure to encompass all bits needed to install
+ * a partial or complete new set of namespaces.
+ *
+ * If a new user namespace is requested cred will
+ * point to a modifiable set of credentials. If a pointer
+ * to a modifiable set is needed nsset_cred() must be
+ * used and tested.
+ */
+struct nsset {
+       unsigned flags;
+       struct nsproxy *nsproxy;
+       struct fs_struct *fs;
+       const struct cred *cred;
+};
+
+static inline struct cred *nsset_cred(struct nsset *set)
+{
+       if (set->flags & CLONE_NEWUSER)
+               return (struct cred *)set->cred;
+
+       return NULL;
+}
+
 /*
  * the namespaces access rules are:
  *