Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1331445 > unrolled thread
| Started by | Christian Brauner <christian.brauner@mailbox.org> |
|---|---|
| First post | 2016-02-10 20:10 +0100 |
| Last post | 2016-02-12 04:20 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v2] let kernfs_name_locked & kernfs_name return size_t Christian Brauner <christian.brauner@mailbox.org> - 2016-02-10 20:10 +0100
[PATCH v2] let kernfs_name_locked & kernfs_name return size_t Christian Brauner <christian.brauner@mailbox.org> - 2016-02-10 20:10 +0100
Re: [PATCH v2] let kernfs_name_locked & kernfs_name return size_t Greg KH <gregkh@linuxfoundation.org> - 2016-02-12 04:20 +0100
| From | Christian Brauner <christian.brauner@mailbox.org> |
|---|---|
| Date | 2016-02-10 20:10 +0100 |
| Subject | [PATCH v2] let kernfs_name_locked & kernfs_name return size_t |
| Message-ID | <r0Ijg-6oz-9@gated-at.bofh.it> |
Simple patch that changes the return value of kernfs_name_locked and kernfs_name
to size_t which alignes these functions with kernfs_path_len which also returns
size_t.
Patch was made against for-4.5 branch of Tejun's cgroup tree. (As per Tejun's
request, ccing gregkh@linuxfoundation.org and linux-kernel@vger.kernel.org.)
Changelog
20150210: - Change return type of kernfs_name in kernfs.h as well.
- Build tested against Tejun's for-4.5 tree, 4.5-rc2 and
mainline 4.5-rc3.
*Note*, the changes in kernfs.h change the dummy return value of the static
inline definition of kernfs_name from -ENOSYS. I changed it to 0 analogous to
kernfs_path_len. I don't know if this is considered a deal-breaker.
Christian Brauner (1):
let kernfs_name_locked & kernfs_name return size_t
fs/kernfs/dir.c | 4 ++--
include/linux/kernfs.h | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
--
2.7.1
[toc] | [next] | [standalone]
| From | Christian Brauner <christian.brauner@mailbox.org> |
|---|---|
| Date | 2016-02-10 20:10 +0100 |
| Message-ID | <r0Ijg-6oz-11@gated-at.bofh.it> |
| In reply to | #1331445 |
They return the length of kn->parent or kn->name and should be aligned with
kernfs_path_len which also returns size_t.
Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
---
Changelog:
20150210: - Change return type of kernfs_name in kernfs.h as well.
- Build tested against Tejun's for-4.5 tree, 4.5-rc2 and
mainline 4.5-rc3.
---
fs/kernfs/dir.c | 4 ++--
include/linux/kernfs.h | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 742bf4a..a3553b8 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -39,7 +39,7 @@ static bool kernfs_lockdep(struct kernfs_node *kn)
#endif
}
-static int kernfs_name_locked(struct kernfs_node *kn, char *buf, size_t buflen)
+static size_t kernfs_name_locked(struct kernfs_node *kn, char *buf, size_t buflen)
{
return strlcpy(buf, kn->parent ? kn->name : "/", buflen);
}
@@ -80,7 +80,7 @@ static char * __must_check kernfs_path_locked(struct kernfs_node *kn, char *buf,
*
* This function can be called from any context.
*/
-int kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen)
+size_t kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen)
{
unsigned long flags;
int ret;
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index af51df3..982a198 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -265,7 +265,7 @@ static inline bool kernfs_ns_enabled(struct kernfs_node *kn)
return kn->flags & KERNFS_NS;
}
-int kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen);
+size_t kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen);
size_t kernfs_path_len(struct kernfs_node *kn);
char * __must_check kernfs_path(struct kernfs_node *kn, char *buf,
size_t buflen);
@@ -332,8 +332,8 @@ static inline void kernfs_enable_ns(struct kernfs_node *kn) { }
static inline bool kernfs_ns_enabled(struct kernfs_node *kn)
{ return false; }
-static inline int kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen)
-{ return -ENOSYS; }
+static inline size_t kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen)
+{ return 0; }
static inline size_t kernfs_path_len(struct kernfs_node *kn)
{ return 0; }
--
2.7.1
[toc] | [prev] | [next] | [standalone]
| From | Greg KH <gregkh@linuxfoundation.org> |
|---|---|
| Date | 2016-02-12 04:20 +0100 |
| Message-ID | <r1cqZ-1gv-1@gated-at.bofh.it> |
| In reply to | #1331445 |
On Wed, Feb 10, 2016 at 08:07:05PM +0100, Christian Brauner wrote: > Simple patch that changes the return value of kernfs_name_locked and kernfs_name > to size_t which alignes these functions with kernfs_path_len which also returns > size_t. > > Patch was made against for-4.5 branch of Tejun's cgroup tree. (As per Tejun's > request, ccing gregkh@linuxfoundation.org and linux-kernel@vger.kernel.org.) > > Changelog > 20150210: - Change return type of kernfs_name in kernfs.h as well. > - Build tested against Tejun's for-4.5 tree, 4.5-rc2 and > mainline 4.5-rc3. > > *Note*, the changes in kernfs.h change the dummy return value of the static > inline definition of kernfs_name from -ENOSYS. I changed it to 0 analogous to > kernfs_path_len. I don't know if this is considered a deal-breaker. Please don't change that, that's a behavior change, not just a "cleanup the return type" change. thanks, greg k-h
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web