summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2008-08-27 14:56:11 -0300
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2008-08-28 19:06:19 -0300
commit5ec5ef30ffd7e743499462bd7b3bfde0e65e2bb4 (patch)
tree62f1082dfc0730ca8e379089117f5e75d77997f5 /src
parent6c0f7565f134e526fd549538569ad70cd09fefc1 (diff)
Cleanup: declaring mode2str and str2mode to static
Diffstat (limited to 'src')
-rw-r--r--src/adapter.c27
-rw-r--r--src/adapter.h4
-rw-r--r--src/hcid.h2
-rw-r--r--src/storage.c4
4 files changed, 12 insertions, 25 deletions
diff --git a/src/adapter.c b/src/adapter.c
index 16d03958..91e7c454 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -331,7 +331,7 @@ static struct bonding_request_info *bonding_request_new(DBusConnection *conn,
return bonding;
}
-const char *mode2str(uint8_t mode)
+static const char *mode2str(uint8_t mode)
{
switch(mode) {
case MODE_OFF:
@@ -347,20 +347,7 @@ const char *mode2str(uint8_t mode)
}
}
-static uint8_t on_mode(const char *addr)
-{
- char mode[14];
- bdaddr_t sba;
-
- str2ba(addr, &sba);
-
- if (read_on_mode(&sba, mode, sizeof(mode)) < 0)
- return MODE_CONNECTABLE;
-
- return str2mode(addr, mode);
-}
-
-uint8_t str2mode(const char *addr, const char *mode)
+static uint8_t str2mode(const char *addr, const char *mode)
{
if (strcasecmp("off", mode) == 0)
return MODE_OFF;
@@ -370,9 +357,13 @@ uint8_t str2mode(const char *addr, const char *mode)
return MODE_DISCOVERABLE;
else if (strcasecmp("limited", mode) == 0)
return MODE_LIMITED;
- else if (strcasecmp("on", mode) == 0)
- return on_mode(addr);
- else
+ else if (strcasecmp("on", mode) == 0) {
+ char onmode[14];
+ if (read_on_mode(addr, onmode, sizeof(onmode)) < 0)
+ return MODE_CONNECTABLE;
+
+ return str2mode(addr, onmode);
+ } else
return MODE_UNKNOWN;
}
diff --git a/src/adapter.h b/src/adapter.h
index 7d6ca9cb..b39fcd03 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -145,10 +145,6 @@ void adapter_remove_device(DBusConnection *conn, struct adapter *adapter,
struct btd_device *adapter_create_device(DBusConnection *conn,
struct adapter *adapter, const char *address);
-const char *mode2str(uint8_t mode);
-
-uint8_t str2mode(const char *addr, const char *mode);
-
int pending_remote_name_cancel(struct adapter *adapter);
void remove_pending_device(struct adapter *adapter);
diff --git a/src/hcid.h b/src/hcid.h
index 786ef804..210654d5 100644
--- a/src/hcid.h
+++ b/src/hcid.h
@@ -117,7 +117,7 @@ int write_discoverable_timeout(bdaddr_t *bdaddr, int timeout);
int read_discoverable_timeout(bdaddr_t *bdaddr, int *timeout);
int write_device_mode(bdaddr_t *bdaddr, const char *mode);
int read_device_mode(bdaddr_t *bdaddr, char *mode, int length);
-int read_on_mode(bdaddr_t *bdaddr, char *mode, int length);
+int read_on_mode(const char *src, char *mode, int length);
int write_local_name(bdaddr_t *bdaddr, char *name);
int read_local_name(bdaddr_t *bdaddr, char *name);
int write_local_class(bdaddr_t *bdaddr, uint8_t *class);
diff --git a/src/storage.c b/src/storage.c
index f8064254..7a9c5989 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -121,11 +121,11 @@ int read_device_mode(bdaddr_t *bdaddr, char *mode, int length)
return 0;
}
-int read_on_mode(bdaddr_t *bdaddr, char *mode, int length)
+int read_on_mode(const char *src, char *mode, int length)
{
char filename[PATH_MAX + 1], *str;
- create_filename(filename, PATH_MAX, bdaddr, "config");
+ create_name(filename, PATH_MAX, STORAGEDIR, src, "config");
str = textfile_get(filename, "onmode");
if (!str)