Skip to content

Commit d26f39a

Browse files
author
Armelle Laine
committed
trusty: storage: proxy: FS_READY property setting on vendor only
Bug: 367965796 Test: launch_cvd --noresume --console=true \ --extra_kernel_cmdline='androidboot.selinux=permissive' \ --secure_hals=guest_keymint_trusty_insecure Change-Id: I4d5ea1762f7cf9edfd8cbc00e2aec13caae965f4
1 parent 65daca3 commit d26f39a

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

trusty/storage/proxy/Android.bp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ cc_binary {
4747
"libtrustystorageinterface",
4848
"libtrusty",
4949
],
50-
50+
target: {
51+
vendor: {
52+
// vendor variant requires this flag
53+
cflags: ["-DVENDOR_FS_READY_PROPERTY"],
54+
},
55+
},
5156
cflags: [
5257
"-Wall",
5358
"-Werror",

trusty/storage/proxy/storage.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ static const char *ssdir_name;
5454
/* List head for storage mapping, elements added at init, and never removed */
5555
static struct storage_mapping_node* storage_mapping_head;
5656

57+
#ifdef VENDOR_FS_READY_PROPERTY
58+
5759
/*
5860
* Properties set to 1 after we have opened a file under ssdir_name. The backing
5961
* files for both TD and TDP are currently located under /data/vendor/ss and can
@@ -75,16 +77,6 @@ static struct storage_mapping_node* storage_mapping_head;
7577
static bool fs_ready_set = false;
7678
static bool fs_ready_rw_set = false;
7779

78-
static enum sync_state fs_state;
79-
static enum sync_state fd_state[FD_TBL_SIZE];
80-
81-
static bool alternate_mode;
82-
83-
static struct {
84-
struct storage_file_read_resp hdr;
85-
uint8_t data[MAX_READ_SIZE];
86-
} read_rsp;
87-
8880
static bool property_set_helper(const char* prop) {
8981
int rc = property_set(prop, "1");
9082
if (rc == 0) {
@@ -96,6 +88,18 @@ static bool property_set_helper(const char* prop) {
9688
return rc == 0;
9789
}
9890

91+
#endif // #ifdef VENDOR_FS_READY_PROPERTY
92+
93+
static enum sync_state fs_state;
94+
static enum sync_state fd_state[FD_TBL_SIZE];
95+
96+
static bool alternate_mode;
97+
98+
static struct {
99+
struct storage_file_read_resp hdr;
100+
uint8_t data[MAX_READ_SIZE];
101+
} read_rsp;
102+
99103
static uint32_t insert_fd(int open_flags, int fd, struct storage_mapping_node* node) {
100104
uint32_t handle = fd;
101105

@@ -535,6 +539,7 @@ int storage_file_open(struct storage_msg* msg, const void* r, size_t req_len,
535539
free(path);
536540
path = NULL;
537541

542+
#ifdef VENDOR_FS_READY_PROPERTY
538543
/* a backing file has been opened, notify any waiting init steps */
539544
if (!fs_ready_set || !fs_ready_rw_set) {
540545
bool is_checkpoint_active = false;
@@ -552,6 +557,7 @@ int storage_file_open(struct storage_msg* msg, const void* r, size_t req_len,
552557
}
553558
}
554559
}
560+
#endif // #ifdef VENDOR_FS_READY_PROPERTY
555561

556562
return ipc_respond(msg, &resp, sizeof(resp));
557563

0 commit comments

Comments
 (0)