Merge tag 'acpi-5.15-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
[linux-2.6-microblaze.git] / fs / ksmbd / smbacl.h
index 940f686..73e08ca 100644 (file)
@@ -209,4 +209,29 @@ int set_info_sec(struct ksmbd_conn *conn, struct ksmbd_tree_connect *tcon,
                 bool type_check);
 void id_to_sid(unsigned int cid, uint sidtype, struct smb_sid *ssid);
 void ksmbd_init_domain(u32 *sub_auth);
+
+static inline uid_t posix_acl_uid_translate(struct user_namespace *mnt_userns,
+                                           struct posix_acl_entry *pace)
+{
+       kuid_t kuid;
+
+       /* If this is an idmapped mount, apply the idmapping. */
+       kuid = kuid_into_mnt(mnt_userns, pace->e_uid);
+
+       /* Translate the kuid into a userspace id ksmbd would see. */
+       return from_kuid(&init_user_ns, kuid);
+}
+
+static inline gid_t posix_acl_gid_translate(struct user_namespace *mnt_userns,
+                                           struct posix_acl_entry *pace)
+{
+       kgid_t kgid;
+
+       /* If this is an idmapped mount, apply the idmapping. */
+       kgid = kgid_into_mnt(mnt_userns, pace->e_gid);
+
+       /* Translate the kgid into a userspace id ksmbd would see. */
+       return from_kgid(&init_user_ns, kgid);
+}
+
 #endif /* _SMBACL_H */