[PATCH] 9p: simplify v9fs_cache_session_get_cookie()

Dmitry Antipov <[email protected]>
Newsgroups dev.linux.lists.v9fs
Message-ID <[email protected]>
Use the convenient 'strreplace()' to simplify
'v9fs_cache_session_get_cookie()'.

Signed-off-by: Dmitry Antipov <[email protected]>
---
 fs/9p/cache.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/9p/cache.c b/fs/9p/cache.c
index 12c0ae29f185..cb0e5b61e131 100644
--- a/fs/9p/cache.c
+++ b/fs/9p/cache.c
@@ -20,18 +20,15 @@ int v9fs_cache_session_get_cookie(struct v9fs_session_info *v9ses,
 				  const char *dev_name)
 {
 	struct fscache_volume *vcookie;
-	char *name, *p;
+	char *name;
 
 	name = kasprintf(GFP_KERNEL, "9p,%s,%s",
 			 dev_name, v9ses->cachetag ?: v9ses->aname);
 	if (!name)
 		return -ENOMEM;
 
-	for (p = name; *p; p++)
-		if (*p == '/')
-			*p = ';';
-
-	vcookie = fscache_acquire_volume(name, NULL, NULL, 0);
+	vcookie = fscache_acquire_volume(strreplace(name, '/', ';'),
+					 NULL, NULL, 0);
 	p9_debug(P9_DEBUG_FSC, "session %p get volume %p (%s)\n",
 		 v9ses, vcookie, name);
 	if (IS_ERR(vcookie)) {
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.