Commit cf28b4863f9ee8f122e8ff3ac0d403e07ba9c6d9
Committed by
Linus Torvalds
1 parent
c32c2f63a9
Exists in
master
and in
4 other branches
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>
Showing 12 changed files with 24 additions and 36 deletions Side-by-side Diff
arch/blackfin/kernel/traps.c
... | ... | @@ -126,15 +126,13 @@ |
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 ... |
drivers/md/bitmap.c
... | ... | @@ -206,16 +206,10 @@ |
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 | } |
drivers/usb/gadget/file_storage.c
... | ... | @@ -3563,8 +3563,7 @@ |
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 { |
... | ... | @@ -3981,9 +3980,8 @@ |
3981 | 3980 | if (backing_file_is_open(curlun)) { |
3982 | 3981 | p = NULL; |
3983 | 3982 | if (pathbuf) { |
3984 | - p = d_path(curlun->filp->f_path.dentry, | |
3985 | - curlun->filp->f_path.mnt, | |
3986 | - pathbuf, PATH_MAX); | |
3983 | + p = d_path(&curlun->filp->f_path, | |
3984 | + pathbuf, PATH_MAX); | |
3987 | 3985 | if (IS_ERR(p)) |
3988 | 3986 | p = NULL; |
3989 | 3987 | } |
fs/compat_ioctl.c
... | ... | @@ -2853,7 +2853,7 @@ |
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 | } |
fs/dcache.c
... | ... | @@ -1845,8 +1845,7 @@ |
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 | * |
... | ... | @@ -1857,8 +1856,7 @@ |
1857 | 1856 | * |
1858 | 1857 | * "buflen" should be positive. Caller holds the dcache_lock. |
1859 | 1858 | */ |
1860 | -char *d_path(struct dentry *dentry, struct vfsmount *vfsmnt, | |
1861 | - char *buf, int buflen) | |
1859 | +char *d_path(struct path *path, char *buf, int buflen) | |
1862 | 1860 | { |
1863 | 1861 | char *res; |
1864 | 1862 | struct path root; |
1865 | 1863 | |
... | ... | @@ -1870,15 +1868,15 @@ |
1870 | 1868 | * user wants to identify the object in /proc/pid/fd/. The little hack |
1871 | 1869 | * below allows us to generate a name for these objects on demand: |
1872 | 1870 | */ |
1873 | - if (dentry->d_op && dentry->d_op->d_dname) | |
1874 | - return dentry->d_op->d_dname(dentry, buf, buflen); | |
1871 | + if (path->dentry->d_op && path->dentry->d_op->d_dname) | |
1872 | + return path->dentry->d_op->d_dname(path->dentry, buf, buflen); | |
1875 | 1873 | |
1876 | 1874 | read_lock(¤t->fs->lock); |
1877 | 1875 | root = current->fs->root; |
1878 | 1876 | path_get(¤t->fs->root); |
1879 | 1877 | read_unlock(¤t->fs->lock); |
1880 | 1878 | spin_lock(&dcache_lock); |
1881 | - res = __d_path(dentry, vfsmnt, &root, buf, buflen); | |
1879 | + res = __d_path(path->dentry, path->mnt, &root, buf, buflen); | |
1882 | 1880 | spin_unlock(&dcache_lock); |
1883 | 1881 | path_put(&root); |
1884 | 1882 | return res; |
fs/dcookies.c
fs/nfsd/export.c
... | ... | @@ -345,7 +345,7 @@ |
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'; |
fs/proc/base.c
fs/seq_file.c
... | ... | @@ -346,8 +346,7 @@ |
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++; |
include/linux/dcache.h
... | ... | @@ -10,6 +10,7 @@ |
10 | 10 | #include <linux/rcupdate.h> |
11 | 11 | |
12 | 12 | struct nameidata; |
13 | +struct path; | |
13 | 14 | struct vfsmount; |
14 | 15 | |
15 | 16 | /* |
... | ... | @@ -300,8 +301,8 @@ |
300 | 301 | */ |
301 | 302 | extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); |
302 | 303 | |
303 | -extern char * d_path(struct dentry *, struct vfsmount *, char *, int); | |
304 | - | |
304 | +extern char *d_path(struct path *, char *, int); | |
305 | + | |
305 | 306 | /* Allocation counts.. */ |
306 | 307 | |
307 | 308 | /** |
kernel/audit.c
... | ... | @@ -1325,7 +1325,7 @@ |
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>"); |
mm/memory.c