Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

d_path: Make d_path() use a struct path

d_path() is used on a <dentry,vfsmount> pair. Lets use a struct path to
reflect this.

[akpm@linux-foundation.org: fix build in mm/memory.c]
Signed-off-by: Jan Blunck <jblunck@suse.de>
Acked-by: Bryan Wu <bryan.wu@analog.com>
Acked-by: Christoph Hellwig <hch@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Neil Brown <neilb@suse.de>
Cc: Michael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Jan Blunck and committed by
Linus Torvalds
cf28b486 c32c2f63

+24 -36
+5 -7
arch/blackfin/kernel/traps.c
··· 126 126 struct vm_area_struct *vma = vml->vma; 127 127 128 128 if (address >= vma->vm_start && address < vma->vm_end) { 129 + char _tmpbuf[256]; 129 130 char *name = p->comm; 130 131 struct file *file = vma->vm_file; 131 - if (file) { 132 - char _tmpbuf[256]; 133 - name = d_path(file->f_dentry, 134 - file->f_vfsmnt, 135 - _tmpbuf, 136 - sizeof(_tmpbuf)); 137 - } 132 + 133 + if (file) 134 + name = d_path(&file->f_path, _tmpbuf, 135 + sizeof(_tmpbuf)); 138 136 139 137 /* FLAT does not have its text aligned to the start of 140 138 * the map while FDPIC ELF does ...
+1 -7
drivers/md/bitmap.c
··· 206 206 /* copy the pathname of a file to a buffer */ 207 207 char *file_path(struct file *file, char *buf, int count) 208 208 { 209 - struct dentry *d; 210 - struct vfsmount *v; 211 - 212 209 if (!buf) 213 210 return NULL; 214 211 215 - d = file->f_path.dentry; 216 - v = file->f_path.mnt; 217 - 218 - buf = d_path(d, v, buf, count); 212 + buf = d_path(&file->f_path, buf, count); 219 213 220 214 return IS_ERR(buf) ? NULL : buf; 221 215 }
+3 -5
drivers/usb/gadget/file_storage.c
··· 3563 3563 3564 3564 down_read(&fsg->filesem); 3565 3565 if (backing_file_is_open(curlun)) { // Get the complete pathname 3566 - p = d_path(curlun->filp->f_path.dentry, 3567 - curlun->filp->f_path.mnt, buf, PAGE_SIZE - 1); 3566 + p = d_path(&curlun->filp->f_path, buf, PAGE_SIZE - 1); 3568 3567 if (IS_ERR(p)) 3569 3568 rc = PTR_ERR(p); 3570 3569 else { ··· 3980 3981 if (backing_file_is_open(curlun)) { 3981 3982 p = NULL; 3982 3983 if (pathbuf) { 3983 - p = d_path(curlun->filp->f_path.dentry, 3984 - curlun->filp->f_path.mnt, 3985 - pathbuf, PATH_MAX); 3984 + p = d_path(&curlun->filp->f_path, 3985 + pathbuf, PATH_MAX); 3986 3986 if (IS_ERR(p)) 3987 3987 p = NULL; 3988 3988 }
+1 -1
fs/compat_ioctl.c
··· 2853 2853 /* find the name of the device. */ 2854 2854 path = (char *)__get_free_page(GFP_KERNEL); 2855 2855 if (path) { 2856 - fn = d_path(filp->f_path.dentry, filp->f_path.mnt, path, PAGE_SIZE); 2856 + fn = d_path(&filp->f_path, path, PAGE_SIZE); 2857 2857 if (IS_ERR(fn)) 2858 2858 fn = "?"; 2859 2859 }
+5 -7
fs/dcache.c
··· 1845 1845 1846 1846 /** 1847 1847 * d_path - return the path of a dentry 1848 - * @dentry: dentry to report 1849 - * @vfsmnt: vfsmnt to which the dentry belongs 1848 + * @path: path to report 1850 1849 * @buf: buffer to return value in 1851 1850 * @buflen: buffer length 1852 1851 * ··· 1856 1857 * 1857 1858 * "buflen" should be positive. Caller holds the dcache_lock. 1858 1859 */ 1859 - char *d_path(struct dentry *dentry, struct vfsmount *vfsmnt, 1860 - char *buf, int buflen) 1860 + char *d_path(struct path *path, char *buf, int buflen) 1861 1861 { 1862 1862 char *res; 1863 1863 struct path root; ··· 1868 1870 * user wants to identify the object in /proc/pid/fd/. The little hack 1869 1871 * below allows us to generate a name for these objects on demand: 1870 1872 */ 1871 - if (dentry->d_op && dentry->d_op->d_dname) 1872 - return dentry->d_op->d_dname(dentry, buf, buflen); 1873 + if (path->dentry->d_op && path->dentry->d_op->d_dname) 1874 + return path->dentry->d_op->d_dname(path->dentry, buf, buflen); 1873 1875 1874 1876 read_lock(&current->fs->lock); 1875 1877 root = current->fs->root; 1876 1878 path_get(&current->fs->root); 1877 1879 read_unlock(&current->fs->lock); 1878 1880 spin_lock(&dcache_lock); 1879 - res = __d_path(dentry, vfsmnt, &root, buf, buflen); 1881 + res = __d_path(path->dentry, path->mnt, &root, buf, buflen); 1880 1882 spin_unlock(&dcache_lock); 1881 1883 path_put(&root); 1882 1884 return res;
+1 -1
fs/dcookies.c
··· 171 171 goto out; 172 172 173 173 /* FIXME: (deleted) ? */ 174 - path = d_path(dcs->path.dentry, dcs->path.mnt, kbuf, PAGE_SIZE); 174 + path = d_path(&dcs->path, kbuf, PAGE_SIZE); 175 175 176 176 if (IS_ERR(path)) { 177 177 err = PTR_ERR(path);
+1 -1
fs/nfsd/export.c
··· 345 345 char *pth; 346 346 347 347 qword_add(bpp, blen, exp->ex_client->name); 348 - pth = d_path(exp->ex_path.dentry, exp->ex_path.mnt, *bpp, *blen); 348 + pth = d_path(&exp->ex_path, *bpp, *blen); 349 349 if (IS_ERR(pth)) { 350 350 /* is this correct? */ 351 351 (*bpp)[0] = '\n';
+1 -1
fs/proc/base.c
··· 1185 1185 if (!tmp) 1186 1186 return -ENOMEM; 1187 1187 1188 - pathname = d_path(path->dentry, path->mnt, tmp, PAGE_SIZE); 1188 + pathname = d_path(path, tmp, PAGE_SIZE); 1189 1189 len = PTR_ERR(pathname); 1190 1190 if (IS_ERR(pathname)) 1191 1191 goto out;
+1 -2
fs/seq_file.c
··· 346 346 { 347 347 if (m->count < m->size) { 348 348 char *s = m->buf + m->count; 349 - char *p = d_path(path->dentry, path->mnt, s, 350 - m->size - m->count); 349 + char *p = d_path(path, s, m->size - m->count); 351 350 if (!IS_ERR(p)) { 352 351 while (s <= p) { 353 352 char c = *p++;
+3 -2
include/linux/dcache.h
··· 10 10 #include <linux/rcupdate.h> 11 11 12 12 struct nameidata; 13 + struct path; 13 14 struct vfsmount; 14 15 15 16 /* ··· 301 300 */ 302 301 extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); 303 302 304 - extern char * d_path(struct dentry *, struct vfsmount *, char *, int); 305 - 303 + extern char *d_path(struct path *, char *, int); 304 + 306 305 /* Allocation counts.. */ 307 306 308 307 /**
+1 -1
kernel/audit.c
··· 1325 1325 audit_log_format(ab, "<no memory>"); 1326 1326 return; 1327 1327 } 1328 - p = d_path(path->dentry, path->mnt, pathname, PATH_MAX+11); 1328 + p = d_path(path, pathname, PATH_MAX+11); 1329 1329 if (IS_ERR(p)) { /* Should never happen since we send PATH_MAX */ 1330 1330 /* FIXME: can we save some information here? */ 1331 1331 audit_log_format(ab, "<too long>");
+1 -1
mm/memory.c
··· 2719 2719 if (buf) { 2720 2720 char *p, *s; 2721 2721 2722 - p = d_path(f->f_dentry, f->f_vfsmnt, buf, PAGE_SIZE); 2722 + p = d_path(&f->f_path, buf, PAGE_SIZE); 2723 2723 if (IS_ERR(p)) 2724 2724 p = "?"; 2725 2725 s = strrchr(p, '/');