@@ -1316,7 +1316,10 @@ static struct ctl_dir *sysctl_mkdir_p(struct ctl_dir *dir, const char *path)
1316
1316
* __register_sysctl_table - register a leaf sysctl table
1317
1317
* @set: Sysctl tree to register on
1318
1318
* @path: The path to the directory the sysctl table is in.
1319
- * @table: the top-level table structure without any child
1319
+ * @table: the top-level table structure without any child. This table
1320
+ * should not be free'd after registration. So it should not be
1321
+ * used on stack. It can either be a global or dynamically allocated
1322
+ * by the caller and free'd later after sysctl unregistration.
1320
1323
*
1321
1324
* Register a sysctl table hierarchy. @table should be a filled in ctl_table
1322
1325
* array. A completely 0 filled entry terminates the table.
@@ -1410,8 +1413,15 @@ struct ctl_table_header *__register_sysctl_table(
1410
1413
1411
1414
/**
1412
1415
* register_sysctl - register a sysctl table
1413
- * @path: The path to the directory the sysctl table is in.
1414
- * @table: the table structure
1416
+ * @path: The path to the directory the sysctl table is in. If the path
1417
+ * doesn't exist we will create it for you.
1418
+ * @table: the table structure. The calller must ensure the life of the @table
1419
+ * will be kept during the lifetime use of the syctl. It must not be freed
1420
+ * until unregister_sysctl_table() is called with the given returned table
1421
+ * with this registration. If your code is non modular then you don't need
1422
+ * to call unregister_sysctl_table() and can instead use something like
1423
+ * register_sysctl_init() which does not care for the result of the syctl
1424
+ * registration.
1415
1425
*
1416
1426
* Register a sysctl table. @table should be a filled in ctl_table
1417
1427
* array. A completely 0 filled entry terminates the table.
@@ -1427,8 +1437,11 @@ EXPORT_SYMBOL(register_sysctl);
1427
1437
1428
1438
/**
1429
1439
* __register_sysctl_init() - register sysctl table to path
1430
- * @path: path name for sysctl base
1431
- * @table: This is the sysctl table that needs to be registered to the path
1440
+ * @path: path name for sysctl base. If that path doesn't exist we will create
1441
+ * it for you.
1442
+ * @table: This is the sysctl table that needs to be registered to the path.
1443
+ * The caller must ensure the life of the @table will be kept during the
1444
+ * lifetime use of the sysctl.
1432
1445
* @table_name: The name of sysctl table, only used for log printing when
1433
1446
* registration fails
1434
1447
*
@@ -1570,6 +1583,7 @@ static int register_leaf_sysctl_tables(const char *path, char *pos,
1570
1583
*
1571
1584
* Register a sysctl table hierarchy. @table should be a filled in ctl_table
1572
1585
* array. A completely 0 filled entry terminates the table.
1586
+ * We are slowly deprecating this call so avoid its use.
1573
1587
*
1574
1588
* See __register_sysctl_table for more details.
1575
1589
*/
@@ -1641,6 +1655,7 @@ struct ctl_table_header *__register_sysctl_paths(
1641
1655
*
1642
1656
* Register a sysctl table hierarchy. @table should be a filled in ctl_table
1643
1657
* array. A completely 0 filled entry terminates the table.
1658
+ * We are slowly deprecating this caller so avoid future uses of it.
1644
1659
*
1645
1660
* See __register_sysctl_paths for more details.
1646
1661
*/
0 commit comments