hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/fs/ocfs2/cluster/netdebug.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* -*- mode: c; c-basic-offset: 8; -*-
23 * vim: noexpandtab sw=8 ts=8 sts=0:
34 *
....@@ -6,22 +7,6 @@
67 * debug functionality for o2net
78 *
89 * Copyright (C) 2005, 2008 Oracle. All rights reserved.
9
- *
10
- * This program is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 2 of the License, or (at your option) any later version.
14
- *
15
- * This program is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
- * General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU General Public
21
- * License along with this program; if not, write to the
22
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23
- * Boston, MA 021110-1307, USA.
24
- *
2510 */
2611
2712 #ifdef CONFIG_DEBUG_FS
....@@ -53,10 +38,6 @@
5338 #define SHOW_SOCK_STATS 1
5439
5540 static struct dentry *o2net_dentry;
56
-static struct dentry *sc_dentry;
57
-static struct dentry *nst_dentry;
58
-static struct dentry *stats_dentry;
59
-static struct dentry *nodes_dentry;
6041
6142 static DEFINE_SPINLOCK(o2net_debug_lock);
6243
....@@ -462,8 +443,8 @@
462443 o2net_fill_node_map(map, sizeof(map));
463444
464445 while ((i = find_next_bit(map, O2NM_MAX_NODES, i + 1)) < O2NM_MAX_NODES)
465
- out += snprintf(buf + out, PAGE_SIZE - out, "%d ", i);
466
- out += snprintf(buf + out, PAGE_SIZE - out, "\n");
446
+ out += scnprintf(buf + out, PAGE_SIZE - out, "%d ", i);
447
+ out += scnprintf(buf + out, PAGE_SIZE - out, "\n");
467448
468449 return out;
469450 }
....@@ -505,36 +486,23 @@
505486
506487 void o2net_debugfs_exit(void)
507488 {
508
- debugfs_remove(nodes_dentry);
509
- debugfs_remove(stats_dentry);
510
- debugfs_remove(sc_dentry);
511
- debugfs_remove(nst_dentry);
512
- debugfs_remove(o2net_dentry);
489
+ debugfs_remove_recursive(o2net_dentry);
513490 }
514491
515
-int o2net_debugfs_init(void)
492
+void o2net_debugfs_init(void)
516493 {
517494 umode_t mode = S_IFREG|S_IRUSR;
518495
519496 o2net_dentry = debugfs_create_dir(O2NET_DEBUG_DIR, NULL);
520
- if (o2net_dentry)
521
- nst_dentry = debugfs_create_file(NST_DEBUG_NAME, mode,
522
- o2net_dentry, NULL, &nst_seq_fops);
523
- if (nst_dentry)
524
- sc_dentry = debugfs_create_file(SC_DEBUG_NAME, mode,
525
- o2net_dentry, NULL, &sc_seq_fops);
526
- if (sc_dentry)
527
- stats_dentry = debugfs_create_file(STATS_DEBUG_NAME, mode,
528
- o2net_dentry, NULL, &stats_seq_fops);
529
- if (stats_dentry)
530
- nodes_dentry = debugfs_create_file(NODES_DEBUG_NAME, mode,
531
- o2net_dentry, NULL, &nodes_fops);
532
- if (nodes_dentry)
533
- return 0;
534497
535
- o2net_debugfs_exit();
536
- mlog_errno(-ENOMEM);
537
- return -ENOMEM;
498
+ debugfs_create_file(NST_DEBUG_NAME, mode, o2net_dentry, NULL,
499
+ &nst_seq_fops);
500
+ debugfs_create_file(SC_DEBUG_NAME, mode, o2net_dentry, NULL,
501
+ &sc_seq_fops);
502
+ debugfs_create_file(STATS_DEBUG_NAME, mode, o2net_dentry, NULL,
503
+ &stats_seq_fops);
504
+ debugfs_create_file(NODES_DEBUG_NAME, mode, o2net_dentry, NULL,
505
+ &nodes_fops);
538506 }
539507
540508 #endif /* CONFIG_DEBUG_FS */