+ * Utility function to get real name from object name
+ *
+ * \param[in] obj pointer to the object to be handled
+ * \param[in] name object name
+ * \param[in] len object name len
+ * \param[out]ln pointer to the struct lu_name to hold the real name
+ *
+ * If file is not encrypted, real name is just the object name.
+ * If file is encrypted, object name needs to be decoded. In
+ * this case a new buffer is allocated, and ln->ln_name needs to be freed by
+ * the caller.
+ *
+ * \retval 0, on success
+ * \retval -ve, on error
+ */
+static int obj_name2lu_name(struct osd_object *obj, const char *name,
+ int len, struct lu_name *ln)
+{
+ if (!(obj->oo_lma_flags & LUSTRE_ENCRYPT_FL)) {
+ ln->ln_name = name;
+ ln->ln_namelen = len;
+ } else {
+ char *buf = kmalloc(len, GFP_NOFS);
+
+ if (!buf)
+ return -ENOMEM;
+
+ len = critical_decode(name, len, buf);
+ ln->ln_name = buf;
+ ln->ln_namelen = len;
+ }
+
+ return 0;
+}
+
+/**