Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1481925
| From | Miklos Szeredi <mszeredi@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 03/17] proc/self: use generic_readlink |
| Date | 2016-09-12 21:40 +0200 |
| Message-ID | <sgFfd-7H4-69@gated-at.bofh.it> (permalink) |
| References | <sgF5v-7Bx-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This will also allow us to move the generic readlink logic into the VFS and
get rid of the readlink method.
The /proc/self and /proc/self-thread symlinks have separate but identical
functionality for reading and following. This cleanup utilizes
generic_readlink to remove the duplication.
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
---
fs/proc/self.c | 14 +-------------
fs/proc/thread_self.c | 15 +--------------
2 files changed, 2 insertions(+), 27 deletions(-)
diff --git a/fs/proc/self.c b/fs/proc/self.c
index b6a8d3529fea..80bc52fd7846 100644
--- a/fs/proc/self.c
+++ b/fs/proc/self.c
@@ -6,18 +6,6 @@
/*
* /proc/self:
*/
-static int proc_self_readlink(struct dentry *dentry, char __user *buffer,
- int buflen)
-{
- struct pid_namespace *ns = dentry->d_sb->s_fs_info;
- pid_t tgid = task_tgid_nr_ns(current, ns);
- char tmp[PROC_NUMBUF];
- if (!tgid)
- return -ENOENT;
- sprintf(tmp, "%d", tgid);
- return readlink_copy(buffer, buflen, tmp);
-}
-
static const char *proc_self_get_link(struct dentry *dentry,
struct inode *inode,
struct delayed_call *done)
@@ -38,7 +26,7 @@ static const char *proc_self_get_link(struct dentry *dentry,
}
static const struct inode_operations proc_self_inode_operations = {
- .readlink = proc_self_readlink,
+ .readlink = generic_readlink,
.get_link = proc_self_get_link,
};
diff --git a/fs/proc/thread_self.c b/fs/proc/thread_self.c
index e58a31e8fb2a..55053d5280ff 100644
--- a/fs/proc/thread_self.c
+++ b/fs/proc/thread_self.c
@@ -6,19 +6,6 @@
/*
* /proc/thread_self:
*/
-static int proc_thread_self_readlink(struct dentry *dentry, char __user *buffer,
- int buflen)
-{
- struct pid_namespace *ns = dentry->d_sb->s_fs_info;
- pid_t tgid = task_tgid_nr_ns(current, ns);
- pid_t pid = task_pid_nr_ns(current, ns);
- char tmp[PROC_NUMBUF + 6 + PROC_NUMBUF];
- if (!pid)
- return -ENOENT;
- sprintf(tmp, "%d/task/%d", tgid, pid);
- return readlink_copy(buffer, buflen, tmp);
-}
-
static const char *proc_thread_self_get_link(struct dentry *dentry,
struct inode *inode,
struct delayed_call *done)
@@ -40,7 +27,7 @@ static const char *proc_thread_self_get_link(struct dentry *dentry,
}
static const struct inode_operations proc_thread_self_inode_operations = {
- .readlink = proc_thread_self_readlink,
+ .readlink = generic_readlink,
.get_link = proc_thread_self_get_link,
};
--
2.5.5
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/17] clean up readlinks Miklos Szeredi <mszeredi@redhat.com> - 2016-09-12 21:40 +0200 [PATCH 08/17] proc: merge proc_pid_readlink() into proc_pid_get_link() Miklos Szeredi <mszeredi@redhat.com> - 2016-09-12 21:40 +0200 [PATCH 15/17] vfs: add vfs_get_link() helper Miklos Szeredi <mszeredi@redhat.com> - 2016-09-12 21:40 +0200 [PATCH 09/17] proc: merge proc_ns_readlink() into proc_ns_get_link() Miklos Szeredi <mszeredi@redhat.com> - 2016-09-12 21:40 +0200 [PATCH 04/17] afs: use generic_readlink Miklos Szeredi <mszeredi@redhat.com> - 2016-09-12 21:40 +0200 [PATCH 12/17] vfs: remove ".readlink = generic_readlink" assignments Miklos Szeredi <mszeredi@redhat.com> - 2016-09-12 21:40 +0200 [PATCH 06/17] vfs: remove page_readlink() Miklos Szeredi <mszeredi@redhat.com> - 2016-09-12 21:40 +0200 [PATCH 03/17] proc/self: use generic_readlink Miklos Szeredi <mszeredi@redhat.com> - 2016-09-12 21:40 +0200 [PATCH 16/17] ovl: use vfs_get_link() Miklos Szeredi <mszeredi@redhat.com> - 2016-09-12 21:40 +0200
csiph-web