Skip to contentSkip to conversation

tuningsysfs patches

PATCH In review Sergey Senozhatsky 2 participants 4 messages Nov 26, 2013 – Dec 11, 2013

lore
Share & tools
lore

Sergey Senozhatsky

author
#0 lore raw

cover tuningsysfs patches

Hello,
two small patches in -next.

tuningsysfs:
- fix tuningsysfs typo
- use process_directory() helper function

please pull from:
https://github.com/sergey-senozhatsky/powertop2-next.git

Sergey Senozhatsky (2):
tuningsysfs: fix msg typo
tuningsysfs: use lib process_directory() helper

 src/tuning/tuningsysfs.cpp | 33 ++++++++-------------------------
 1 file changed, 8 insertions(+), 25 deletions(-)
Signature · 1 line
1.8.5.rc3.362.gdf10213.dirty
author
#1 lore raw

PATCH 1/2 tuningsysfs: fix msg typo

fix 'Managmenet' typo.

Reported-by Gijs Hillenius <gijs(a)hillenius.net>
Signed-off-by Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
---
 src/tuning/tuningsysfs.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/tuning/tuningsysfs.cpp +1 -1
index ec1ca6b..f70dc23 100644
@@ -136,7 +136,7 @@ void add_sata_tunables(void)
 
 		sprintf(filename, "/sys/class/scsi_host/%s/link_power_management_policy", entry->d_name);
 
-	        sprintf(msg, _("Enable SATA link power Managmenet for %s"),entry->d_name);
+	        sprintf(msg, _("Enable SATA link power management for %s"),entry->d_name);
 
 		add_sysfs_tunable(msg, filename,"min_power");
 
Signature · 1 line
1.8.5.rc3.362.gdf10213.dirty
author
#2 lore raw

PATCH 2/2 tuningsysfs: use lib process_directory() helper

In reply to Sergey Senozhatsky

use process_directory() helper while processing sata tunables.

Signed-off-by Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
---
 src/tuning/tuningsysfs.cpp | 33 ++++++++-------------------------
 1 file changed, 8 insertions(+), 25 deletions(-)
src/tuning/tuningsysfs.cpp +8 -25
index f70dc23..0859a0c 100644
@@ -113,34 +113,17 @@ void add_sysfs_tunable(const char *str, const char *_sysfs_path, const char *_ta
 	all_tunables.push_back(tunable);
 }
 
-void add_sata_tunables(void)
+static void add_sata_tunables_callback(const char *d_name)
 {
-	struct dirent *entry;
-	DIR *dir;
 	char filename[4096];
 	char msg[4096];
 
-	dir = opendir("/sys/class/scsi_host");
-
-	if (!dir)
-		return;
-
-        while (1) {
-		entry = readdir(dir);
-
-		if (!entry)
-			break;
-
-		if (entry->d_name[0] == '.')
-			continue;
-
-		sprintf(filename, "/sys/class/scsi_host/%s/link_power_management_policy", entry->d_name);
-
-	        sprintf(msg, _("Enable SATA link power management for %s"),entry->d_name);
-
-		add_sysfs_tunable(msg, filename,"min_power");
-
-        }
+	sprintf(filename, "/sys/class/scsi_host/%s/link_power_management_policy", d_name);
+	sprintf(msg, _("Enable SATA link power management for %s"), d_name);
+	add_sysfs_tunable(msg, filename,"min_power");
+}
 
-        closedir(dir);
+void add_sata_tunables(void)
+{
+	process_directory("/sys/class/scsi_host", add_sata_tunables_callback);
 }
Signature · 1 line
1.8.5.rc3.362.gdf10213.dirty
#3 lore raw
In reply to Sergey Senozhatsky
Quoted 19 lines

Hello,
two small patches in -next.

tuningsysfs:
- fix tuningsysfs typo
- use process_directory() helper function

please pull from:
https://github.com/sergey-senozhatsky/powertop2-next.git

Sergey Senozhatsky (2):
tuningsysfs: fix msg typo
tuningsysfs: use lib process_directory() helper

 src/tuning/tuningsysfs.cpp | 33 ++++++++-------------------------
 1 file changed, 8 insertions(+), 25 deletions(-)
Quoted 8 lines

--
1.8.5.rc3.362.gdf10213.dirty

_______________________________________________
PowerTop mailing list
PowerTop(a)lists.01.org
https://lists.01.org/mailman/listinfo/powertop

Sergey

Your patches were merged today.

Thank you,
Alexandra.