9p: fix sysfs output overwrite and clean up typos
PATCH 1/1 9p: fix sysfs output overwrite and clean up typos
While diagnosing a UID mismatch issue with 9p shared folders under UTM on macOS, I noticed a couple of small problems in the 9p client code:
- caches_show() overwrote its buffer on each iteration, so only the last cache tag was visible in sysfs output. Fix this by appending with snprintf(buf + count, …).
- v9fs_sysfs_init() always returned -ENOMEM on failure; return the actual sysfs_create_group() error instead.
- a few minor typos in comments (e.g. "trasnport" → "transport").
These changes improve debug output and readability without altering core behavior.
Signed-off-by Randall P. Embry <[email protected]>
--- fs/9p/v9fs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
fs/9p/v9fs.c +7 -7
@@ -438,8 +438,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, v9ses->flags &= ~V9FS_ACCESS_MASK ; v9ses->flags |=V9FS_ACCESS_USER ; } -/*FIXME !! */ -/* for legacy mode, fall back to V9FS_ACCESS_ANY */ +/* FIXME: for legacy mode, fall back to V9FS_ACCESS_ANY */ if (!(v9fs_proto_dotu (v9ses) ||v9fs_proto_dotl (v9ses)) && ((v9ses->flags&V9FS_ACCESS_MASK ) ==V9FS_ACCESS_USER )) {
@@ -450,7 +449,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,if (!v9fs_proto_dotl (v9ses) || !((v9ses->flags &V9FS_ACCESS_MASK ) ==V9FS_ACCESS_CLIENT )) {/* -* We support ACL checks on clinet only if the protocol is +* We support ACL checks on client only if the protocol is * 9P2000.L and access is V9FS_ACCESS_CLIENT. */ v9ses->flags &= ~V9FS_ACL_MASK ;
@@ -561,7 +560,7 @@ static ssize_t caches_show(struct kobject *kobj,spin_lock (&v9fs_sessionlist_lock);list_for_each_entry (v9ses, &v9fs_sessionlist, slist) {if (v9ses->cachetag) { - n =snprintf (buf, limit,"%s\n" , v9ses->cachetag); + n =snprintf (buf + count, limit,"%s\n" , v9ses->cachetag);if (n <0 ) { count = n;break ;
@@ -601,9 +600,10 @@ static int __init v9fs_sysfs_init(void)if (!v9fs_kobj)return -ENOMEM ; -if (sysfs_create_group (v9fs_kobj, &v9fs_attr_group)) { +int ret =sysfs_create_group (v9fs_kobj, &v9fs_attr_group); +if (ret) {kobject_put (v9fs_kobj); -return -ENOMEM ; +return ret; }return 0 ;
@@ -669,7 +669,7 @@ static int __init init_v9fs(void)int err;pr_info ("Installing v9fs 9p2000 file system support\n" ); -/* TODO: Setup list of registered trasnport modules */ +/* TODO: Setup list of registered transport modules */ err =v9fs_init_inode_cache ();if (err <0 ) {
Signature · 1 line
2.39.5 (Apple Git-154)