summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext4_utils/make_ext4fs.c23
-rw-r--r--libpagemap/include/pagemap/pagemap.h5
-rw-r--r--tests/bionic/libc/Android.mk5
-rw-r--r--tests/bionic/libc/other/test_atomics.c17
4 files changed, 25 insertions, 25 deletions
diff --git a/ext4_utils/make_ext4fs.c b/ext4_utils/make_ext4fs.c
index 0cb5bae9..b9a24b83 100644
--- a/ext4_utils/make_ext4fs.c
+++ b/ext4_utils/make_ext4fs.c
@@ -79,7 +79,8 @@ static int filter_dot(const struct dirent *d)
return (strcmp(d->d_name, "..") && strcmp(d->d_name, "."));
}
-static u32 build_default_directory_structure()
+static u32 build_default_directory_structure(const char *dir_path,
+ struct selabel_handle *sehnd)
{
u32 inode;
u32 root_inode;
@@ -97,6 +98,22 @@ static u32 build_default_directory_structure()
inode_set_permissions(inode, dentries.mode,
dentries.uid, dentries.gid, dentries.mtime);
+#ifndef USE_MINGW
+ if (sehnd) {
+ char *path = NULL;
+ char *secontext = NULL;
+
+ asprintf(&path, "%slost+found", dir_path);
+ if (selabel_lookup(sehnd, &secontext, path, S_IFDIR) < 0) {
+ error("cannot lookup security context for %s", path);
+ } else {
+ inode_set_selinux(inode, secontext);
+ freecon(secontext);
+ }
+ free(path);
+ }
+#endif
+
return root_inode;
}
@@ -564,13 +581,13 @@ int make_ext4fs_internal(int fd, const char *_directory,
#ifdef USE_MINGW
// Windows needs only 'create an empty fs image' functionality
assert(!directory);
- root_inode_num = build_default_directory_structure();
+ root_inode_num = build_default_directory_structure(mountpoint, sehnd);
#else
if (directory)
root_inode_num = build_directory_structure(directory, mountpoint, 0,
fs_config_func, sehnd, verbose);
else
- root_inode_num = build_default_directory_structure();
+ root_inode_num = build_default_directory_structure(mountpoint, sehnd);
#endif
root_mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
diff --git a/libpagemap/include/pagemap/pagemap.h b/libpagemap/include/pagemap/pagemap.h
index 22025672..210bc815 100644
--- a/libpagemap/include/pagemap/pagemap.h
+++ b/libpagemap/include/pagemap/pagemap.h
@@ -19,8 +19,11 @@
#include <stdint.h>
#include <stdio.h>
+#include <sys/cdefs.h>
#include <sys/types.h>
+__BEGIN_DECLS
+
typedef struct pm_memusage pm_memusage_t;
/* Holds the various metrics for memory usage of a process or a mapping. */
@@ -198,4 +201,6 @@ int pm_map_usage_flags(pm_map_t *map, pm_memusage_t *usage_out,
/* Get the working set of this map alone. */
int pm_map_workingset(pm_map_t *map, pm_memusage_t *ws_out);
+__END_DECLS
+
#endif
diff --git a/tests/bionic/libc/Android.mk b/tests/bionic/libc/Android.mk
index 32900a8e..a29b7925 100644
--- a/tests/bionic/libc/Android.mk
+++ b/tests/bionic/libc/Android.mk
@@ -142,11 +142,6 @@ sources := \
other/test_sysconf.c \
other/test_vfprintf_leak.c \
-ifeq ($(TARGET_ARCH),arm)
-sources += \
- other/test_atomics.c
-endif
-
$(call device-test, $(sources))
# The relocations test is a bit special, since we need
diff --git a/tests/bionic/libc/other/test_atomics.c b/tests/bionic/libc/other/test_atomics.c
deleted file mode 100644
index 0de2a938..00000000
--- a/tests/bionic/libc/other/test_atomics.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <stdio.h>
-
-
-extern int __atomic_dec(volatile int* addr);
-
-int main(int argc, const char *argv[])
-{
- int x = 5;
-
- while (x > -20) {
- printf("old_x=%d\n", __atomic_dec(&x));
- printf("x=%d\n", x);
- }
-
- printf ("OK\n");
- return 0;
-}