aboutsummaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/net/socket.c b/net/socket.c
index 759825b7ca26..98a8f67abbfc 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -313,8 +313,19 @@ static int sockfs_delete_dentry(struct dentry *dentry)
313 dentry->d_flags |= DCACHE_UNHASHED; 313 dentry->d_flags |= DCACHE_UNHASHED;
314 return 0; 314 return 0;
315} 315}
316
317/*
318 * sockfs_dname() is called from d_path().
319 */
320static char *sockfs_dname(struct dentry *dentry, char *buffer, int buflen)
321{
322 return dynamic_dname(dentry, buffer, buflen, "socket:[%lu]",
323 dentry->d_inode->i_ino);
324}
325
316static struct dentry_operations sockfs_dentry_operations = { 326static struct dentry_operations sockfs_dentry_operations = {
317 .d_delete = sockfs_delete_dentry, 327 .d_delete = sockfs_delete_dentry,
328 .d_dname = sockfs_dname,
318}; 329};
319 330
320/* 331/*
@@ -354,14 +365,9 @@ static int sock_alloc_fd(struct file **filep)
354 365
355static int sock_attach_fd(struct socket *sock, struct file *file) 366static int sock_attach_fd(struct socket *sock, struct file *file)
356{ 367{
357 struct qstr this; 368 struct qstr name = { .name = "" };
358 char name[32];
359
360 this.len = sprintf(name, "[%lu]", SOCK_INODE(sock)->i_ino);
361 this.name = name;
362 this.hash = 0;
363 369
364 file->f_path.dentry = d_alloc(sock_mnt->mnt_sb->s_root, &this); 370 file->f_path.dentry = d_alloc(sock_mnt->mnt_sb->s_root, &name);
365 if (unlikely(!file->f_path.dentry)) 371 if (unlikely(!file->f_path.dentry))
366 return -ENOMEM; 372 return -ENOMEM;
367 373