Snap for 11896415 from 91c96f323af9c71fe8fefab1c61ea044347c9287 to 24Q3-release
Change-Id: I27bc679c023a9d13b504c3366b5b1dfc2a9d09b3
diff --git a/init/devices.cpp b/init/devices.cpp
index 792d8c8..5560c20 100644
--- a/init/devices.cpp
+++ b/init/devices.cpp
@@ -435,6 +435,7 @@
if (ReadFileToString("/sys/class/block/" + uevent.device_name + "/queue/zoned", &model) &&
!StartsWith(model, "none")) {
links.emplace_back("/dev/block/by-name/zoned_device");
+ links.emplace_back("/dev/sys/block/by-name/zoned_device");
}
auto last_slash = uevent.path.rfind('/');
@@ -483,11 +484,21 @@
// event.
if (action == "add" || (action == "change" && StartsWith(devpath, "/dev/block/dm-"))) {
for (const auto& link : links) {
+ std::string target;
+ if (StartsWith(link, "/dev/block/")) {
+ target = devpath;
+ } else if (StartsWith(link, "/dev/sys/block/")) {
+ target = "/sys/class/block/" + Basename(devpath);
+ } else {
+ LOG(ERROR) << "Unrecognized link type: " << link;
+ continue;
+ }
+
if (!mkdir_recursive(Dirname(link), 0755)) {
PLOG(ERROR) << "Failed to create directory " << Dirname(link);
}
- if (symlink(devpath.c_str(), link.c_str())) {
+ if (symlink(target.c_str(), link.c_str())) {
if (errno != EEXIST) {
PLOG(ERROR) << "Failed to symlink " << devpath << " to " << link;
} else if (std::string link_path;
diff --git a/trusty/metrics/include/trusty/metrics/tipc.h b/trusty/metrics/include/trusty/metrics/tipc.h
index e2cf57b..b4428d5 100644
--- a/trusty/metrics/include/trusty/metrics/tipc.h
+++ b/trusty/metrics/include/trusty/metrics/tipc.h
@@ -49,6 +49,7 @@
* @METRICS_CMD_REQ_SHIFT: number of bits used by @METRICS_CMD_RESP_BIT
* @METRICS_CMD_REPORT_EVENT_DROP: report gaps in the event stream
* @METRICS_CMD_REPORT_CRASH: report an app crash event
+ * @METRICS_CMD_REPORT_EXIT: report an app exit
* @METRICS_CMD_REPORT_STORAGE_ERROR: report trusty storage error
*/
enum metrics_cmd {
@@ -57,7 +58,8 @@
METRICS_CMD_REPORT_EVENT_DROP = (1 << METRICS_CMD_REQ_SHIFT),
METRICS_CMD_REPORT_CRASH = (2 << METRICS_CMD_REQ_SHIFT),
- METRICS_CMD_REPORT_STORAGE_ERROR = (3 << METRICS_CMD_REQ_SHIFT),
+ METRICS_CMD_REPORT_EXIT = (3 << METRICS_CMD_REQ_SHIFT),
+ METRICS_CMD_REPORT_STORAGE_ERROR = (4 << METRICS_CMD_REQ_SHIFT),
};
/**
@@ -92,9 +94,22 @@
} __attribute__((__packed__));
/**
+ * struct metrics_report_exit_req - arguments of %METRICS_CMD_REPORT_EXIT
+ * requests
+ * @app_id: app_id in the form UUID in ascii format
+ * "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
+ * @exit_code: architecture-specific exit code
+ */
+struct metrics_report_exit_req {
+ char app_id[UUID_STR_SIZE];
+ uint32_t exit_code;
+} __attribute__((__packed__));
+
+/**
* struct metrics_report_crash_req - arguments of %METRICS_CMD_REPORT_CRASH
* requests
- * @app_id: uuid of the app that crashed
+ * @app_id: app_id in the form UUID in ascii format
+ * "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
* @crash_reason: architecture-specific code representing the reason for the
* crash
*/
@@ -158,6 +173,7 @@
struct metrics_req req;
union {
struct metrics_report_crash_req crash_args;
+ struct metrics_report_exit_req exit_args;
struct metrics_report_storage_error_req storage_args;
};
} __attribute__((__packed__));
\ No newline at end of file