cope with potentially long ->d_dname() output for shmem/hugetlb
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / fs / dcache.c
index f09b9085f7d849e235a2b8d77c079de71c96f5d2..da89cdfb21ab8ab90905b8fc811cf62abd355678 100644 (file)
@@ -2724,6 +2724,17 @@ char *dynamic_dname(struct dentry *dentry, char *buffer, int buflen,
        return memcpy(buffer, temp, sz);
 }
 
+char *simple_dname(struct dentry *dentry, char *buffer, int buflen)
+{
+       char *end = buffer + buflen;
+       /* these dentries are never renamed, so d_lock is not needed */
+       if (prepend(&end, &buflen, " (deleted)", 11) ||
+           prepend_name(&end, &buflen, &dentry->d_name) ||
+           prepend(&end, &buflen, "/", 1))
+               end = ERR_PTR(-ENAMETOOLONG);
+       return end;
+}
+
 /*
  * Write full pathname from the root of the filesystem into the buffer.
  */