From 83935a247a78adeda9add500fd497a629dc44b17 Mon Sep 17 00:00:00 2001 From: liuzerun Date: Tue, 5 Dec 2023 03:11:04 +0000 Subject: [PATCH] stat_show Signed-off-by: liuzerun --- fs/hmdfs/comm/device_node.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/hmdfs/comm/device_node.c b/fs/hmdfs/comm/device_node.c index 796e5cd09a72..284bfb21d9bd 100644 --- a/fs/hmdfs/comm/device_node.c +++ b/fs/hmdfs/comm/device_node.c @@ -307,12 +307,13 @@ static ssize_t sbi_stat_show(struct kobject *kobj, struct sbi_attribute *attr, mutex_lock(&peer->conn_impl_list_lock); list_for_each_entry(conn_impl, &peer->conn_impl_list, list) { tcp = conn_impl->connect_handle; - size += sprintf(buf + size, "socket_fd: %d\n", tcp->fd); - size += sprintf(buf + size, + size += sprintf_s(buf + size, PAGE_SIZE - size, + "socket_fd: %d\n", tcp->fd); + size += sprintf_s(buf + size, PAGE_SIZE - size, "\tsend_msg %d \tsend_bytes %llu\n", conn_impl->stat.send_message_count, conn_impl->stat.send_bytes); - size += sprintf(buf + size, + size += sprintf_s(buf + size, PAGE_SIZE - size, "\trecv_msg %d \trecv_bytes %llu\n", conn_impl->stat.recv_message_count, conn_impl->stat.recv_bytes); -- Gitee