util.h revision f83d0b9af5cbe4440cc41ceaa8a7806a13c86282
13899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross/*
23899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross * Copyright (C) 2010 The Android Open Source Project
33899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross *
43899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross * Licensed under the Apache License, Version 2.0 (the "License");
53899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross * you may not use this file except in compliance with the License.
63899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross * You may obtain a copy of the License at
73899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross *
83899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross *      http://www.apache.org/licenses/LICENSE-2.0
93899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross *
103899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross * Unless required by applicable law or agreed to in writing, software
113899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross * distributed under the License is distributed on an "AS IS" BASIS,
123899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
133899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross * See the License for the specific language governing permissions and
143899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross * limitations under the License.
153899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross */
163899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross
173899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross#ifndef _INIT_UTIL_H_
183899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross#define _INIT_UTIL_H_
193899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross
20f83d0b9af5cbe4440cc41ceaa8a7806a13c86282Colin Cross#include <sys/stat.h>
21f83d0b9af5cbe4440cc41ceaa8a7806a13c86282Colin Cross#include <sys/types.h>
22f83d0b9af5cbe4440cc41ceaa8a7806a13c86282Colin Cross
23f83d0b9af5cbe4440cc41ceaa8a7806a13c86282Colin Crossstatic const char *coldboot_done = "/dev/.coldboot_done";
24f83d0b9af5cbe4440cc41ceaa8a7806a13c86282Colin Cross
253899e9fc01cf608f19f716749c54cc5c4d17e766Colin Crossint mtd_name_to_number(const char *name);
263899e9fc01cf608f19f716749c54cc5c4d17e766Colin Crossint create_socket(const char *name, int type, mode_t perm,
273899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross                  uid_t uid, gid_t gid);
283899e9fc01cf608f19f716749c54cc5c4d17e766Colin Crossvoid *read_file(const char *fn, unsigned *_sz);
293899e9fc01cf608f19f716749c54cc5c4d17e766Colin Crosstime_t gettime(void);
303899e9fc01cf608f19f716749c54cc5c4d17e766Colin Crossunsigned int decode_uid(const char *s);
313899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross
32b0ab94b7d5a888f0b6920b156e5c6a075fa0741aColin Crossint mkdir_recursive(const char *pathname, mode_t mode);
33b0ab94b7d5a888f0b6920b156e5c6a075fa0741aColin Crossvoid sanitize(char *p);
34b0ab94b7d5a888f0b6920b156e5c6a075fa0741aColin Crossvoid make_link(const char *oldpath, const char *newpath);
35b0ab94b7d5a888f0b6920b156e5c6a075fa0741aColin Crossvoid remove_link(const char *oldpath, const char *newpath);
36cd0f173e2790ee068fd2a20bcfc6c20468e97e51Colin Crossint wait_for_file(const char *filename, int timeout);
37f83d0b9af5cbe4440cc41ceaa8a7806a13c86282Colin Crossvoid open_devnull_stdio(void);
38f83d0b9af5cbe4440cc41ceaa8a7806a13c86282Colin Crossvoid get_hardware_name(char *hardware, unsigned int *revision);
393899e9fc01cf608f19f716749c54cc5c4d17e766Colin Cross#endif
40