Drivers: hv: Make the sysfs node size for the ring buffer dynamic
authorNaman Jain <namjain@linux.microsoft.com>
Fri, 2 May 2025 07:48:11 +0000 (13:18 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 May 2025 11:59:02 +0000 (13:59 +0200)
commit65995e97a1caacf0024bebda3332b8d1f0f443c4
treee8e721ff358699fa7ee807c9132d616e51eaa3d0
parentf31fe8165d365379d858c53bef43254c7d6d1cfd
Drivers: hv: Make the sysfs node size for the ring buffer dynamic

The ring buffer size varies across VMBus channels. The size of sysfs
node for the ring buffer is currently hardcoded to 4 MB. Userspace
clients either use fstat() or hardcode this size for doing mmap().
To address this, make the sysfs node size dynamic to reflect the
actual ring buffer size for each channel. This will ensure that
fstat() on ring sysfs node always returns the correct size of
ring buffer.

Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Tested-by: Michael Kelley <mhklinux@outlook.com>
Reviewed-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Naman Jain <namjain@linux.microsoft.com>
Link: https://lore.kernel.org/r/20250502074811.2022-3-namjain@linux.microsoft.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hv/vmbus_drv.c