Skip to content

Commit

Permalink
fs: dlm: Simplify buffer size computation in dlm_create_debug_file()
Browse files Browse the repository at this point in the history
Use sizeof(name) instead of the equivalent, but hard coded,
DLM_LOCKSPACE_LEN + 8.

This is less verbose and more future proof.

Signed-off-by: Christophe JAILLET <[email protected]>
Signed-off-by: Alexander Aring <[email protected]>
Signed-off-by: David Teigland <[email protected]>
  • Loading branch information
tititiou36 authored and teigland committed Oct 12, 2023
1 parent 94f6f05 commit 19b3102
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions fs/dlm/debug_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ void dlm_create_debug_file(struct dlm_ls *ls)
/* format 2 */

memset(name, 0, sizeof(name));
snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_locks", ls->ls_name);
snprintf(name, sizeof(name), "%s_locks", ls->ls_name);

ls->ls_debug_locks_dentry = debugfs_create_file(name,
0644,
Expand All @@ -997,7 +997,7 @@ void dlm_create_debug_file(struct dlm_ls *ls)
/* format 3 */

memset(name, 0, sizeof(name));
snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_all", ls->ls_name);
snprintf(name, sizeof(name), "%s_all", ls->ls_name);

ls->ls_debug_all_dentry = debugfs_create_file(name,
S_IFREG | S_IRUGO,
Expand All @@ -1008,7 +1008,7 @@ void dlm_create_debug_file(struct dlm_ls *ls)
/* format 4 */

memset(name, 0, sizeof(name));
snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_toss", ls->ls_name);
snprintf(name, sizeof(name), "%s_toss", ls->ls_name);

ls->ls_debug_toss_dentry = debugfs_create_file(name,
S_IFREG | S_IRUGO,
Expand All @@ -1017,7 +1017,7 @@ void dlm_create_debug_file(struct dlm_ls *ls)
&format4_fops);

memset(name, 0, sizeof(name));
snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_waiters", ls->ls_name);
snprintf(name, sizeof(name), "%s_waiters", ls->ls_name);

ls->ls_debug_waiters_dentry = debugfs_create_file(name,
0644,
Expand All @@ -1028,7 +1028,7 @@ void dlm_create_debug_file(struct dlm_ls *ls)
/* format 5 */

memset(name, 0, sizeof(name));
snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_queued_asts", ls->ls_name);
snprintf(name, sizeof(name), "%s_queued_asts", ls->ls_name);

ls->ls_debug_queued_asts_dentry = debugfs_create_file(name,
0644,
Expand Down

0 comments on commit 19b3102

Please sign in to comment.