bool context_node::open(bool access_rw, bool* fsetxattr_failed) { lock_.lock(); if (pa_) { lock_.unlock(); return true; } char filename[PROP_FILENAME_MAX]; int len = snprintf(filename, sizeof(filename), "%s/%s", property_filename, context_); if (len < 0 || len > PROP_FILENAME_MAX) { lock_.unlock(); return false; } if (access_rw) { pa_ = map_prop_area_rw(filename, context_, fsetxattr_failed); } else { pa_ = map_prop_area(filename #if MB_ENABLE_COMPAT_PROPERTIES , false #endif ); } lock_.unlock(); return pa_; }
static bool map_system_property_area(bool access_rw, bool* fsetxattr_failed) { char filename[PROP_FILENAME_MAX]; int len = snprintf(filename, sizeof(filename), "%s/properties_serial", property_filename); if (len < 0 || len > PROP_FILENAME_MAX) { mb__system_property_area__ = nullptr; return false; } if (access_rw) { mb__system_property_area__ = map_prop_area_rw(filename, "u:object_r:properties_serial:s0", fsetxattr_failed); } else { mb__system_property_area__ = map_prop_area(filename, false); } return mb__system_property_area__; }
int __system_property_area_init() { return map_prop_area_rw(); }