Compress .so files for PackageManager to reclaim the space
Let's set compression bit to compress .so files in first place for PM. If the underlying filesystem like f2fs supports per-file compression, we can give the compressed space back to user. Bug: 188859114 Signed-off-by: Jaegeuk Kim <jaegeuk@google.com> Change-Id: I6f261946c0a076ec50ec41bfe031f4438fed4db8
This commit is contained in:
parent
8aebd244de
commit
61a0a35dd5
@ -36,6 +36,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <linux/fs.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
@ -253,6 +254,16 @@ copyFileIfChanged(JNIEnv *env, void* arg, ZipFileRO* zipFile, ZipEntryRO zipEntr
|
||||
return INSTALL_FAILED_CONTAINER_ERROR;
|
||||
}
|
||||
|
||||
// If a filesystem like f2fs supports per-file compression, set the compression bit before data
|
||||
// writes
|
||||
unsigned int flags;
|
||||
if (ioctl(fd, FS_IOC_GETFLAGS, &flags) == -1) {
|
||||
ALOGE("Failed to call FS_IOC_GETFLAGS on %s: %s\n", localTmpFileName, strerror(errno));
|
||||
} else if ((flags & FS_COMPR_FL) == 0) {
|
||||
flags |= FS_COMPR_FL;
|
||||
ioctl(fd, FS_IOC_SETFLAGS, &flags);
|
||||
}
|
||||
|
||||
if (!zipFile->uncompressEntry(zipEntry, fd)) {
|
||||
ALOGE("Failed uncompressing %s to %s\n", fileName, localTmpFileName);
|
||||
close(fd);
|
||||
|
Loading…
x
Reference in New Issue
Block a user