[PATCH 1/5] sysctl: Clarify how the ctl_table.flags should be set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Additional comments are added to clarify how the ctl_table.flags
field should be set as well as precaution on what needs to be done
when additional flags are defined in the future.

Signed-off-by: Waiman Long <longman@xxxxxxxxxx>
---
 include/linux/sysctl.h | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 3db57af..bc09361 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -125,7 +125,7 @@ struct ctl_table
 } __randomize_layout;
 
 /**
- * enum ctl_table_flags - flags for the ctl table
+ * enum ctl_table_flags - flags for the ctl table (struct ctl_table.flags)
  *
  * @CTL_FLAGS_CLAMP_RANGE: Set to indicate that the entry should be
  *	flexibly clamped to min/max range in case the user provided
@@ -134,10 +134,23 @@ struct ctl_table
  * 	had been issued for that entry.
  *
  * At most 16 different flags will be allowed.
+ *
+ * The flags can be set in two different ways. They can either be
+ * statically set at definition time or dynamically set at run time.
+ *
+ * Currently, only the CTL_FLAGS_OOR_WARNED flag is set at run time.
+ * No locking or atomic access to set @CTL_FLAGS_OOR_WARNED is needed
+ * in the current use case. If similar dynamic flags are defined in the
+ * future, we may need to revisit again to see if atomic access or
+ * locking is needed to prevent lost changes due to concurrent updates
+ * to the flags field.
  */
 enum ctl_table_flags {
+	/* Statically set flags */
 	CTL_FLAGS_CLAMP_RANGE		= BIT(0),
-	CTL_FLAGS_OOR_WARNED		= BIT(1),
+
+	/* Flags set at run time */
+	CTL_FLAGS_OOR_WARNED		= BIT(8),
 };
 
 struct ctl_node {
-- 
1.8.3.1




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux