zipfuse: fix on readdir

This change fixes a bug that the 'size' parameter of the `readdir` call
was incorrectly interprested as the maximum number of directory entires
that kernel can accept. In fact, that is the maximum number of bytes
that kernel can accept for the directory entries.

To handle this correcty, we incrementally calculate the number of bytes
required to hold directories entries from the specified offset. When the
calculated number becomes greater than the requested buffer size, we
stop and pass the entries enumerated so far.

Adds a test to excercise the path that the directory entries are so many
that they don't fit to a single buffer (thus requiring multiple readdir
calls).

Also made a small change that opendir returns CACHE_DIR so that they are
cached.

Bug: 186377508
Test: atest ZipFuseTest

Change-Id: I86e767b58b2f0793132be462e2a8fa63266f7774
1 file changed
tree: 2cdb9285afdf0f5636404f86a0fc580b74a28ca0
  1. apex/
  2. authfs/
  3. compos/
  4. docs/
  5. microdroid/
  6. tests/
  7. virtmanager/
  8. vm/
  9. zipfuse/
  10. .clang-format
  11. PREUPLOAD.cfg