diff options
| author | Dan Albert <danalbert@google.com> | 2015-03-13 22:35:27 -0700 |
|---|---|---|
| committer | Dan Albert <danalbert@google.com> | 2015-03-14 16:53:36 -0700 |
| commit | b67219a71d1d896bcb34c4a7a797824b88515b2c (patch) | |
| tree | afb5171b6e804b87a0a0aedd0742f36283b3bd64 /server/InterfaceController.cpp | |
| parent | 909757cfc276546652d8f6d433c56d644325af8c (diff) | |
Update for libbase.
StringPrintf and the string based file I/O are being moved to libbase.
Change-Id: I765d9e53f65a76d318d9d0d9503403fc092254d5
Diffstat (limited to 'server/InterfaceController.cpp')
| -rw-r--r-- | server/InterfaceController.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/server/InterfaceController.cpp b/server/InterfaceController.cpp index 6855bdf7..76f5e05d 100644 --- a/server/InterfaceController.cpp +++ b/server/InterfaceController.cpp @@ -19,14 +19,18 @@ #include <malloc.h> #define LOG_TAG "InterfaceController" +#include <base/file.h> +#include <base/stringprintf.h> #include <cutils/log.h> #include <logwrap/logwrap.h> -#include <utils/file.h> -#include <utils/stringprintf.h> #include "InterfaceController.h" #include "RouteController.h" +using android::base::ReadFileToString; +using android::base::StringPrintf; +using android::base::WriteStringToFile; + const char ipv6_proc_path[] = "/proc/sys/net/ipv6/conf"; const char sys_net_path[] = "/sys/class/net"; @@ -55,8 +59,8 @@ int InterfaceController::writeIPv6ProcPath(const char *interface, const char *se errno = ENOENT; return -1; } - std::string path(android::StringPrintf("%s/%s/%s", ipv6_proc_path, interface, setting)); - return android::WriteStringToFile(value, path); + std::string path(StringPrintf("%s/%s/%s", ipv6_proc_path, interface, setting)); + return WriteStringToFile(value, path); } int InterfaceController::setEnableIPv6(const char *interface, const int on) { @@ -133,7 +137,7 @@ void InterfaceController::setAcceptRA(const char *value) { // ID to get the table. If it's set to -1000, routes from interface ID 5 will go into // table 1005, etc. void InterfaceController::setAcceptRARouteTable(int tableOrOffset) { - std::string value(android::StringPrintf("%d", tableOrOffset)); + std::string value(StringPrintf("%d", tableOrOffset)); setOnAllInterfaces("accept_ra_rt_table", value.c_str()); } @@ -143,8 +147,8 @@ int InterfaceController::setMtu(const char *interface, const char *mtu) errno = ENOENT; return -1; } - std::string path(android::StringPrintf("%s/%s/mtu", sys_net_path, interface)); - return android::WriteStringToFile(mtu, path); + std::string path(StringPrintf("%s/%s/mtu", sys_net_path, interface)); + return WriteStringToFile(mtu, path); } void InterfaceController::setIPv6OptimisticMode(const char *value) { |
