libselinux: Save digest of all partial matches for directory

We used to hash the file_context and skip the restorecon on the top
level directory if the hash doesn't change. But the file_context
might change after an OTA update; and some users experienced long
restorecon time as they have lots of files under directories like
/data/media.

This CL tries to hash all the partial match entries in the
file_context for each directory; and skips the restorecon if that
digest stays the same, regardless of the changes to the other parts
of file_context.

This is a version ported from Android that was originally written by:
xunchang <xunchang@google.com>

Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
This commit is contained in:
Richard Haines 2019-07-06 16:21:14 +01:00 committed by Nicolas Iooss
parent c00ed59281
commit e016502c0a
No known key found for this signature in database
GPG Key ID: C191415F340DAAA0
12 changed files with 560 additions and 138 deletions