Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
system_vold
Commits
3578c41e
Commit
3578c41e
authored
15 years ago
by
San Mehat
Browse files
Options
Download
Email Patches
Plain Diff
vold2: Add block device udev bootstrapping
Signed-off-by:
San Mehat
<
san@android.com
>
parent
59abc3c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
main.cpp
main.cpp
+53
-0
No files found.
main.cpp
View file @
3578c41e
...
...
@@ -18,6 +18,11 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <dirent.h>
#define LOG_TAG "Vold"
...
...
@@ -29,6 +34,7 @@
#include "DeviceVolume.h"
static
int
process_config
(
VolumeManager
*
vm
);
static
void
coldboot
(
const
char
*
path
);
int
main
()
{
...
...
@@ -68,6 +74,8 @@ int main() {
exit
(
1
);
}
coldboot
(
"/sys/block"
);
/*
* Now that we're up, we can respond to commands
*/
...
...
@@ -85,6 +93,51 @@ int main() {
exit
(
0
);
}
static
void
do_coldboot
(
DIR
*
d
,
int
lvl
)
{
struct
dirent
*
de
;
int
dfd
,
fd
;
dfd
=
dirfd
(
d
);
fd
=
openat
(
dfd
,
"uevent"
,
O_WRONLY
);
if
(
fd
>=
0
)
{
write
(
fd
,
"add
\n
"
,
4
);
close
(
fd
);
}
while
((
de
=
readdir
(
d
)))
{
DIR
*
d2
;
if
(
de
->
d_name
[
0
]
==
'.'
)
continue
;
if
(
de
->
d_type
!=
DT_DIR
&&
lvl
>
0
)
continue
;
fd
=
openat
(
dfd
,
de
->
d_name
,
O_RDONLY
|
O_DIRECTORY
);
if
(
fd
<
0
)
continue
;
d2
=
fdopendir
(
fd
);
if
(
d2
==
0
)
close
(
fd
);
else
{
do_coldboot
(
d2
,
lvl
+
1
);
closedir
(
d2
);
}
}
}
static
void
coldboot
(
const
char
*
path
)
{
DIR
*
d
=
opendir
(
path
);
if
(
d
)
{
do_coldboot
(
d
,
0
);
closedir
(
d
);
}
}
static
int
process_config
(
VolumeManager
*
vm
)
{
FILE
*
fp
;
int
n
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment