init: more header cleanup

Remove includes of "log.h" that really want <android-base/logging.h>
Fix header include order
Remove headers included in .cpp files that their associated .h already includes
Remove some unused headers

Test: boot bullhead
Change-Id: I2b415adfe86a5c8bbe4fb1ebc53c7b0ee2253824
This commit is contained in:
Tom Cherry 2017-04-06 16:30:22 -07:00
parent b15882faab
commit 3f5eaae526
27 changed files with 92 additions and 131 deletions

View File

@ -16,16 +16,11 @@
#include "action.h"
#include <errno.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include "builtins.h"
#include "error.h"
#include "init_parser.h"
#include "log.h"
#include "util.h"
using android::base::Join;

View File

@ -17,7 +17,6 @@
#include "bootchart.h"
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@ -31,9 +30,7 @@
#include <condition_variable>
#include <memory>
#include <mutex>
#include <string>
#include <thread>
#include <vector>
#include <android-base/file.h>
#include <android-base/logging.h>

View File

@ -19,33 +19,27 @@
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <linux/loop.h>
#include <linux/module.h>
#include <mntent.h>
#include <net/if.h>
#include <signal.h>
#include <sched.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/mount.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
#include <linux/loop.h>
#include <linux/module.h>
#include <string>
#include <thread>
#include <selinux/android.h>
#include <selinux/selinux.h>
#include <selinux/label.h>
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/parseint.h>
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
@ -55,14 +49,14 @@
#include <ext4_utils/ext4_crypt.h>
#include <ext4_utils/ext4_crypt_init_extensions.h>
#include <fs_mgr.h>
#include <logwrap/logwrap.h>
#include <selinux/android.h>
#include <selinux/label.h>
#include <selinux/selinux.h>
#include "action.h"
#include "bootchart.h"
#include "devices.h"
#include "init.h"
#include "init_parser.h"
#include "log.h"
#include "property_service.h"
#include "reboot.h"
#include "service.h"

View File

@ -19,16 +19,15 @@
#include <ctype.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
#include <android-base/unique_fd.h>
#include <cutils/android_get_control_file.h>
#include <cutils/sockets.h>
#include "init.h"
#include "log.h"
#include "util.h"
DescriptorInfo::DescriptorInfo(const std::string& name, const std::string& type, uid_t uid,

View File

@ -19,41 +19,37 @@
#include <fcntl.h>
#include <fnmatch.h>
#include <libgen.h>
#include <linux/netlink.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/sendfile.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <unistd.h>
#include <linux/netlink.h>
#include <memory>
#include <thread>
#include <selinux/selinux.h>
#include <selinux/label.h>
#include <selinux/android.h>
#include <selinux/avc.h>
#include <private/android_filesystem_config.h>
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
#include <android-base/unique_fd.h>
#include <cutils/list.h>
#include <cutils/uevent.h>
#include <private/android_filesystem_config.h>
#include <selinux/android.h>
#include <selinux/avc.h>
#include <selinux/label.h>
#include <selinux/selinux.h>
#include "devices.h"
#include "ueventd_parser.h"
#include "util.h"
#include "log.h"
#define SYSFS_PREFIX "/sys"
static const char *firmware_dirs[] = { "/etc/firmware",

View File

@ -17,9 +17,10 @@
#ifndef _INIT_DEVICES_H
#define _INIT_DEVICES_H
#include <functional>
#include <sys/stat.h>
#include <functional>
enum coldboot_action_t {
// coldboot continues without creating the device for the uevent
COLDBOOT_CONTINUE = 0,

View File

@ -16,12 +16,8 @@
#include "import_parser.h"
#include "errno.h"
#include <android-base/logging.h>
#include <string>
#include <vector>
#include "log.h"
#include "util.h"
bool ImportParser::ParseSection(const std::vector<std::string>& args,

View File

@ -14,6 +14,8 @@
* limitations under the License.
*/
#include "init.h"
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
@ -42,6 +44,7 @@
#include <android-base/chrono_utils.h>
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
@ -59,7 +62,6 @@
#include "devices.h"
#include "fs_mgr.h"
#include "import_parser.h"
#include "init.h"
#include "init_parser.h"
#include "keychords.h"
#include "log.h"

View File

@ -14,18 +14,17 @@
* limitations under the License.
*/
#include "init_parser.h"
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
#include "action.h"
#include "init_parser.h"
#include "log.h"
#include "parser.h"
#include "service.h"
#include "util.h"
#include <android-base/stringprintf.h>
Parser::Parser() {
}

View File

@ -18,6 +18,7 @@
#define _INIT_INIT_PARSER_H_
#include <map>
#include <memory>
#include <string>
#include <vector>

View File

@ -18,9 +18,7 @@
#include "init.h"
#include "service.h"
#include "util.h"
#include <errno.h>
#include <gtest/gtest.h>
#include <string>

View File

@ -14,19 +14,17 @@
* limitations under the License.
*/
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <linux/keychord.h>
#include <unistd.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
#include "init.h"
#include "log.h"
#include "service.h"
static struct input_keychord *keychords = 0;

View File

@ -17,9 +17,10 @@
#include "log.h"
#include <fcntl.h>
#include <linux/audit.h>
#include <string.h>
#include <linux/audit.h>
#include <android-base/logging.h>
#include <netlink/netlink.h>
#include <selinux/selinux.h>

View File

@ -17,7 +17,7 @@
#ifndef _INIT_LOG_H_
#define _INIT_LOG_H_
#include <android-base/logging.h>
#include <sys/cdefs.h>
void InitKernelLogging(char* argv[]);

View File

@ -4,7 +4,7 @@
#include <stdio.h>
#include <string.h>
#include "log.h"
#include <android-base/logging.h>
void parse_error(struct parse_state *state, const char *fmt, ...)
{

View File

@ -14,46 +14,44 @@
* limitations under the License.
*/
#include "property_service.h"
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <limits.h>
#include <netinet/in.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <fcntl.h>
#include <stdarg.h>
#include <dirent.h>
#include <limits.h>
#include <errno.h>
#include <sys/mman.h>
#include <sys/poll.h>
#include <memory>
#include <vector>
#include <sys/select.h>
#include <sys/types.h>
#include <sys/un.h>
#include <unistd.h>
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/select.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/mman.h>
#include <memory>
#include <vector>
#include <selinux/android.h>
#include <selinux/selinux.h>
#include <selinux/label.h>
#include <fs_mgr.h>
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include "bootimg.h"
#include <bootimg.h>
#include <fs_mgr.h>
#include <selinux/android.h>
#include <selinux/label.h>
#include <selinux/selinux.h>
#include "property_service.h"
#include "init.h"
#include "util.h"
#include "log.h"
using android::base::StringPrintf;

View File

@ -20,6 +20,7 @@
#include <stddef.h>
#include <sys/socket.h>
#include <sys/system_properties.h>
#include <string>
struct property_audit_data {

View File

@ -13,6 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "reboot.h"
#include <dirent.h>
#include <fcntl.h>
#include <mntent.h>
@ -27,11 +30,11 @@
#include <memory>
#include <set>
#include <string>
#include <thread>
#include <vector>
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/macros.h>
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
@ -41,11 +44,8 @@
#include <fs_mgr.h>
#include <logwrap/logwrap.h>
#include "log.h"
#include "property_service.h"
#include "reboot.h"
#include "service.h"
#include "util.h"
using android::base::StringPrintf;

View File

@ -17,6 +17,8 @@
#ifndef _INIT_REBOOT_H
#define _INIT_REBOOT_H
#include <string>
/* Reboot / shutdown the system.
* cmd ANDROID_RB_* as defined in android_reboot.h
* reason Reason string like "reboot", "userrequested"

View File

@ -25,27 +25,21 @@
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <termios.h>
#include <unistd.h>
#include <selinux/selinux.h>
#include <android-base/chrono_utils.h>
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/parseint.h>
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include <processgroup/processgroup.h>
#include <selinux/selinux.h>
#include <system/thread_defs.h>
#include <processgroup/processgroup.h>
#include "action.h"
#include "init.h"
#include "init_parser.h"
#include "log.h"
#include "property_service.h"
#include "util.h"

View File

@ -19,14 +19,13 @@
#include <sys/types.h>
#include <cutils/iosched_policy.h>
#include <memory>
#include <set>
#include <string>
#include <vector>
#include <android-base/chrono_utils.h>
#include <cutils/iosched_policy.h>
#include "action.h"
#include "capabilities.h"

View File

@ -14,22 +14,17 @@
* limitations under the License.
*/
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
#include "action.h"
#include "init.h"
#include "log.h"
#include "service.h"
#include "util.h"
static int signal_write_fd = -1;
static int signal_read_fd = -1;

View File

@ -14,6 +14,8 @@
* limitations under the License.
*/
#include "ueventd.h"
#include <ctype.h>
#include <fcntl.h>
#include <grp.h>
@ -24,17 +26,15 @@
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <selinux/selinux.h>
#include "ueventd.h"
#include "log.h"
#include "util.h"
#include "devices.h"
#include "log.h"
#include "ueventd_parser.h"
#include "util.h"
int ueventd_main(int argc, char **argv)
{

View File

@ -17,9 +17,10 @@
#ifndef _INIT_UEVENTD_H_
#define _INIT_UEVENTD_H_
#include <cutils/list.h>
#include <sys/types.h>
#include <cutils/list.h>
enum devname_src_t {
DEVNAME_UNKNOWN = 0,
DEVNAME_UEVENT_DEVNAME,

View File

@ -14,18 +14,18 @@
* limitations under the License.
*/
#include "ueventd_parser.h"
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <android-base/logging.h>
#include "ueventd.h"
#include "ueventd_parser.h"
#include "parser.h"
#include "log.h"
#include "util.h"
static list_declare(subsystem_list);

View File

@ -14,26 +14,21 @@
* limitations under the License.
*/
#include "util.h"
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <ftw.h>
#include <pwd.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <time.h>
#include <unistd.h>
#include <selinux/android.h>
#include <selinux/label.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/un.h>
#include <thread>
#include <android-base/file.h>
@ -42,15 +37,13 @@
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include <android-base/unique_fd.h>
#include <cutils/android_reboot.h>
/* for ANDROID_SOCKET_* */
#include <cutils/sockets.h>
#include <selinux/android.h>
#include <selinux/label.h>
#include "init.h"
#include "log.h"
#include "reboot.h"
#include "util.h"
using android::base::boot_clock;

View File

@ -16,11 +16,12 @@
#include <errno.h>
#include <fcntl.h>
#include <linux/watchdog.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <linux/watchdog.h>
#include <android-base/logging.h>
#include "log.h"
#include "util.h"