[Pvfs2-cvs] commit by pw in pvfs2/src/kernel/linux-2.6: pvfs2-proc.c
CVS commit program
cvs at parl.clemson.edu
Fri Jan 11 10:20:16 EST 2008
Update of /projects/cvsroot/pvfs2/src/kernel/linux-2.6
In directory parlweb1:/tmp/cvs-serv3667/src/kernel/linux-2.6
Modified Files:
pvfs2-proc.c
Log Message:
Use CTL_UNNUMBERED in sysctl tables, if the kernel provides it. Inspired
by murali.
Index: pvfs2-proc.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/kernel/linux-2.6/pvfs2-proc.c,v
diff -u -p -p -u -r1.8 -r1.9
--- pvfs2-proc.c 19 Aug 2007 18:20:28 -0000 1.8
+++ pvfs2-proc.c 11 Jan 2008 15:20:16 -0000 1.9
@@ -261,10 +261,19 @@ static struct pvfs2_param_extra perf_res
static int min_debug[] = {0}, max_debug[] = {GOSSIP_MAX_DEBUG};
static int min_op_timeout_secs[] = {0}, max_op_timeout_secs[] = {INT_MAX};
+/*
+ * Modern kernels prefer to number the controls themselves.
+ */
+#ifdef CTL_UNNUMBERED
+#define UNNUMBERED_OR_VAL(x) CTL_UNNUMBERED
+#else
+#define UNNUMBERED_OR_VAL(x) x
+#endif
+
static ctl_table pvfs2_acache_table[] = {
/* controls acache timeout */
{
- .ctl_name = 1,
+ .ctl_name = UNNUMBERED_OR_VAL(1),
.procname = "timeout-msecs",
.maxlen = sizeof(int),
.mode = 0644,
@@ -273,7 +282,7 @@ static ctl_table pvfs2_acache_table[] =
},
/* controls acache hard limit */
{
- .ctl_name = 2,
+ .ctl_name = UNNUMBERED_OR_VAL(2),
.procname = "hard-limit",
.maxlen = sizeof(int),
.mode = 0644,
@@ -282,7 +291,7 @@ static ctl_table pvfs2_acache_table[] =
},
/* controls acache soft limit */
{
- .ctl_name = 3,
+ .ctl_name = UNNUMBERED_OR_VAL(3),
.procname = "soft-limit",
.maxlen = sizeof(int),
.mode = 0644,
@@ -291,7 +300,7 @@ static ctl_table pvfs2_acache_table[] =
},
/* controls acache reclaim percentage */
{
- .ctl_name = 4,
+ .ctl_name = UNNUMBERED_OR_VAL(4),
.procname = "reclaim-percentage",
.maxlen = sizeof(int),
.mode = 0644,
@@ -303,7 +312,7 @@ static ctl_table pvfs2_acache_table[] =
static ctl_table pvfs2_ncache_table[] = {
/* controls ncache timeout */
{
- .ctl_name = 1,
+ .ctl_name = UNNUMBERED_OR_VAL(1),
.procname = "timeout-msecs",
.maxlen = sizeof(int),
.mode = 0644,
@@ -312,7 +321,7 @@ static ctl_table pvfs2_ncache_table[] =
},
/* controls ncache hard limit */
{
- .ctl_name = 2,
+ .ctl_name = UNNUMBERED_OR_VAL(2),
.procname = "hard-limit",
.maxlen = sizeof(int),
.mode = 0644,
@@ -321,7 +330,7 @@ static ctl_table pvfs2_ncache_table[] =
},
/* controls ncache soft limit */
{
- .ctl_name = 3,
+ .ctl_name = UNNUMBERED_OR_VAL(3),
.procname = "soft-limit",
.maxlen = sizeof(int),
.mode = 0644,
@@ -330,7 +339,7 @@ static ctl_table pvfs2_ncache_table[] =
},
/* controls ncache reclaim percentage */
{
- .ctl_name = 4,
+ .ctl_name = UNNUMBERED_OR_VAL(4),
.procname = "reclaim-percentage",
.maxlen = sizeof(int),
.mode = 0644,
@@ -343,7 +352,7 @@ static int acache_perf_count = PVFS2_PER
static int ncache_perf_count = PVFS2_PERF_COUNT_REQUEST_NCACHE;
static ctl_table pvfs2_pc_table[] = {
{
- .ctl_name = 1,
+ .ctl_name = UNNUMBERED_OR_VAL(1),
.procname = "acache",
.maxlen = 4096,
.mode = 0444,
@@ -351,7 +360,7 @@ static ctl_table pvfs2_pc_table[] = {
.extra1 = &acache_perf_count,
},
{
- .ctl_name = 2,
+ .ctl_name = UNNUMBERED_OR_VAL(2),
.procname = "ncache",
.maxlen = 4096,
.mode = 0444,
@@ -366,7 +375,7 @@ pvfs2_stats g_pvfs2_stats;
static ctl_table pvfs2_stats_table[] = {
/* shows number of hits in cache */
{
- .ctl_name = 1,
+ .ctl_name = UNNUMBERED_OR_VAL(1),
.procname = "hits",
.data = &g_pvfs2_stats.cache_hits,
.maxlen = sizeof(unsigned long),
@@ -374,7 +383,7 @@ static ctl_table pvfs2_stats_table[] = {
.proc_handler = &proc_dointvec,
},
{
- .ctl_name = 2,
+ .ctl_name = UNNUMBERED_OR_VAL(2),
.procname = "misses",
.data = &g_pvfs2_stats.cache_misses,
.maxlen = sizeof(unsigned long),
@@ -382,7 +391,7 @@ static ctl_table pvfs2_stats_table[] = {
.proc_handler = &proc_dointvec,
},
{
- .ctl_name = 3,
+ .ctl_name = UNNUMBERED_OR_VAL(3),
.procname = "reads",
.data = &g_pvfs2_stats.reads,
.maxlen = sizeof(unsigned long),
@@ -390,20 +399,20 @@ static ctl_table pvfs2_stats_table[] = {
.proc_handler = &proc_dointvec,
},
{
- .ctl_name = 4,
+ .ctl_name = UNNUMBERED_OR_VAL(4),
.procname = "writes",
.data = &g_pvfs2_stats.writes,
.maxlen = sizeof(unsigned long),
.mode = 0444,
.proc_handler = &proc_dointvec,
},
- {.ctl_name = 0},
+ {0}
};
static ctl_table pvfs2_table[] = {
/* controls debugging level */
{
- .ctl_name = 1,
+ .ctl_name = UNNUMBERED_OR_VAL(1),
.procname = "debug",
.data = &gossip_debug_mask,
.maxlen = sizeof(int),
@@ -415,7 +424,7 @@ static ctl_table pvfs2_table[] = {
},
/* operation timeout */
{
- .ctl_name = 2,
+ .ctl_name = UNNUMBERED_OR_VAL(2),
.procname = "op-timeout-secs",
.data = &op_timeout_secs,
.maxlen = sizeof(int),
@@ -427,7 +436,7 @@ static ctl_table pvfs2_table[] = {
},
/* time interval for client side performance counters */
{
- .ctl_name = 3,
+ .ctl_name = UNNUMBERED_OR_VAL(3),
.procname = "perf-time-interval-secs",
.maxlen = sizeof(int),
.mode = 0644,
@@ -436,7 +445,7 @@ static ctl_table pvfs2_table[] = {
},
/* time interval for client side performance counters */
{
- .ctl_name = 4,
+ .ctl_name = UNNUMBERED_OR_VAL(4),
.procname = "perf-history-size",
.maxlen = sizeof(int),
.mode = 0644,
@@ -445,7 +454,7 @@ static ctl_table pvfs2_table[] = {
},
/* reset performance counters */
{
- .ctl_name = 5,
+ .ctl_name = UNNUMBERED_OR_VAL(5),
.procname = "perf-counter-reset",
.maxlen = sizeof(int),
.mode = 0644,
@@ -454,14 +463,14 @@ static ctl_table pvfs2_table[] = {
},
/* subdir for acache control */
{
- .ctl_name = 6,
+ .ctl_name = UNNUMBERED_OR_VAL(6),
.procname = "acache",
.maxlen = 0,
.mode = 0555,
.child = pvfs2_acache_table
},
{
- .ctl_name = 7,
+ .ctl_name = UNNUMBERED_OR_VAL(7),
.procname = "perf-counters",
.maxlen = 0,
.mode = 0555,
@@ -469,7 +478,7 @@ static ctl_table pvfs2_table[] = {
},
/* subdir for ncache control */
{
- .ctl_name = 8,
+ .ctl_name = UNNUMBERED_OR_VAL(8),
.procname = "ncache",
.maxlen = 0,
.mode = 0555,
@@ -477,7 +486,7 @@ static ctl_table pvfs2_table[] = {
},
/* statistics maintained by the kernel module (output only below this) */
{
- .ctl_name = 9,
+ .ctl_name = UNNUMBERED_OR_VAL(9),
.procname = "stats",
.maxlen = 0,
.mode = 0555,
@@ -487,7 +496,7 @@ static ctl_table pvfs2_table[] = {
};
static ctl_table fs_table[] = {
{
- .ctl_name = 1,
+ .ctl_name = UNNUMBERED_OR_VAL(1),
.procname = "pvfs2",
.mode = 0555,
.child = pvfs2_table
More information about the Pvfs2-cvs
mailing list