[PATCH BlueZ 1/2] Renamed Bluez4 config read functions

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

 



---
 src/adapter.c |  8 ++++----
 src/storage.c | 36 ++++++++----------------------------
 src/storage.h | 10 ++++++----
 3 files changed, 18 insertions(+), 36 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index b8a6bb6e2..f7c24fe62 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -5654,21 +5654,21 @@ static void convert_config(struct btd_adapter *adapter, const char *filename,
 	ba2str(&adapter->bdaddr, address);
 	snprintf(config_path, PATH_MAX, STORAGEDIR "/%s/config", address);
 
-	if (read_pairable_timeout(address, &timeout) == 0)
+	if (bluez4_read_pairable_timeout(config_path, &timeout) == 0)
 		g_key_file_set_integer(key_file, "General",
 						"PairableTimeout", timeout);
 
-	if (read_discoverable_timeout(address, &timeout) == 0)
+	if (bluez4_read_discoverable_timeout(config_path, &timeout) == 0)
 		g_key_file_set_integer(key_file, "General",
 						"DiscoverableTimeout", timeout);
 
-	if (read_on_mode(address, str, sizeof(str)) == 0) {
+	if (bluez4_read_on_mode(config_path, str, sizeof(str)) == 0) {
 		mode = get_mode(str);
 		g_key_file_set_boolean(key_file, "General", "Discoverable",
 					mode == MODE_DISCOVERABLE);
 	}
 
-	if (read_local_name(&adapter->bdaddr, str) == 0)
+	if (bluez4_read_local_name(config_path, str) == 0)
 		g_key_file_set_string(key_file, "General", "Alias", str);
 
 	create_file(filename, S_IRUSR | S_IWUSR);
diff --git a/src/storage.c b/src/storage.c
index 8cbb5b270..779ca2bc8 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -56,22 +56,9 @@ struct match {
 	char *pattern;
 };
 
-static inline int create_filename(char *buf, size_t size,
-				const bdaddr_t *bdaddr, const char *name)
+int bluez4_read_discoverable_timeout(const char *filename, int *timeout)
 {
-	char addr[18];
-
-	ba2str(bdaddr, addr);
-
-	return create_name(buf, size, STORAGEDIR, addr, name);
-}
-
-int read_discoverable_timeout(const char *src, int *timeout)
-{
-	char filename[PATH_MAX], *str;
-
-	create_name(filename, PATH_MAX, STORAGEDIR, src, "config");
-
+	char *str;
 	str = textfile_get(filename, "discovto");
 	if (!str)
 		return -ENOENT;
@@ -86,12 +73,9 @@ int read_discoverable_timeout(const char *src, int *timeout)
 	return 0;
 }
 
-int read_pairable_timeout(const char *src, int *timeout)
+int bluez4_read_pairable_timeout(const char *filename, int *timeout)
 {
-	char filename[PATH_MAX], *str;
-
-	create_name(filename, PATH_MAX, STORAGEDIR, src, "config");
-
+	char *str;
 	str = textfile_get(filename, "pairto");
 	if (!str)
 		return -ENOENT;
@@ -106,11 +90,9 @@ int read_pairable_timeout(const char *src, int *timeout)
 	return 0;
 }
 
-int read_on_mode(const char *src, char *mode, int length)
+int bluez4_read_on_mode(const char *filename, char *mode, int length)
 {
-	char filename[PATH_MAX], *str;
-
-	create_name(filename, PATH_MAX, STORAGEDIR, src, "config");
+	char *str;
 
 	str = textfile_get(filename, "onmode");
 	if (!str)
@@ -124,13 +106,11 @@ int read_on_mode(const char *src, char *mode, int length)
 	return 0;
 }
 
-int read_local_name(const bdaddr_t *bdaddr, char *name)
+int bluez4_read_local_name(const char *filename, char *name)
 {
-	char filename[PATH_MAX], *str;
+	char *str;
 	int len;
 
-	create_filename(filename, PATH_MAX, bdaddr, "config");
-
 	str = textfile_get(filename, "name");
 	if (!str)
 		return -ENOENT;
diff --git a/src/storage.h b/src/storage.h
index 1c0ad57ec..d84cc86db 100644
--- a/src/storage.h
+++ b/src/storage.h
@@ -21,9 +21,11 @@
  *
  */
 
-int read_discoverable_timeout(const char *src, int *timeout);
-int read_pairable_timeout(const char *src, int *timeout);
-int read_on_mode(const char *src, char *mode, int length);
-int read_local_name(const bdaddr_t *bdaddr, char *name);
+#include "lib/sdp.h"
+
+int bluez4_read_discoverable_timeout(const char *filename, int *timeout);
+int bluez4_read_pairable_timeout(const char *filename, int *timeout);
+int bluez4_read_on_mode(const char *filename, char *mode, int length);
+int bluez4_read_local_name(const char *filename, char *name);
 sdp_record_t *record_from_string(const char *str);
 sdp_record_t *find_record_in_list(sdp_list_t *recs, const char *uuid);
-- 
2.11.0




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux