diff --git a/VoldNativeService.cpp b/VoldNativeService.cpp
index 0cce561..1020526 100644
--- a/VoldNativeService.cpp
+++ b/VoldNativeService.cpp
@@ -41,7 +41,7 @@
 #include "VoldUtil.h"
 #include "VolumeManager.h"
 #include "cryptfs.h"
-#include "incfs_ndk.h"
+#include "incfs.h"
 
 using android::base::StringPrintf;
 using std::endl;
@@ -879,7 +879,7 @@
 binder::Status VoldNativeService::incFsEnabled(bool* _aidl_return) {
     ENFORCE_SYSTEM_OR_ROOT;
 
-    *_aidl_return = IncFs_IsEnabled();
+    *_aidl_return = incfs::enabled();
     return Ok();
 }
 
@@ -890,22 +890,19 @@
     CHECK_ARGUMENT_PATH(backingPath);
     CHECK_ARGUMENT_PATH(targetDir);
 
-    auto control = IncFs_Mount(backingPath.c_str(), targetDir.c_str(),
-                               {.flags = IncFsMountFlags(flags),
-                                .defaultReadTimeoutMs = INCFS_DEFAULT_READ_TIMEOUT_MS,
-                                // Mount with read logs disabled.
-                                .readLogBufferPages = 0});
-    if (control == nullptr) {
-        return translate(-1);
+    auto control = incfs::mount(backingPath, targetDir,
+                                {.flags = IncFsMountFlags(flags),
+                                 .defaultReadTimeoutMs = INCFS_DEFAULT_READ_TIMEOUT_MS,
+                                 // Mount with read logs disabled.
+                                 .readLogBufferPages = 0});
+    if (!control) {
+        return translate(-errno);
     }
-    using unique_fd = ::android::base::unique_fd;
-    _aidl_return->cmd.reset(unique_fd(dup(IncFs_GetControlFd(control, CMD))));
-    _aidl_return->pendingReads.reset(unique_fd(dup(IncFs_GetControlFd(control, PENDING_READS))));
-    auto logsFd = IncFs_GetControlFd(control, LOGS);
-    if (logsFd >= 0) {
-        _aidl_return->log.reset(unique_fd(dup(logsFd)));
-    }
-    IncFs_DeleteControl(control);
+    auto fds = control.releaseFds();
+    using android::base::unique_fd;
+    _aidl_return->cmd.reset(unique_fd(fds[CMD].release()));
+    _aidl_return->pendingReads.reset(unique_fd(fds[PENDING_READS].release()));
+    _aidl_return->log.reset(unique_fd(fds[LOGS].release()));
     return Ok();
 }
 
@@ -913,7 +910,7 @@
     ENFORCE_SYSTEM_OR_ROOT;
     CHECK_ARGUMENT_PATH(dir);
 
-    return translate(IncFs_Unmount(dir.c_str()));
+    return translate(incfs::unmount(dir));
 }
 
 binder::Status VoldNativeService::setIncFsMountOptions(
@@ -921,19 +918,24 @@
         bool enableReadLogs) {
     ENFORCE_SYSTEM_OR_ROOT;
 
-    auto status = Ok();
-    auto incfsControl = IncFs_CreateControl(dup(control.cmd.get()), dup(control.pendingReads.get()),
-                                            dup(control.log.get()));
-    if (auto error = IncFs_SetOptions(
+    auto incfsControl =
+            incfs::createControl(control.cmd.get(), control.pendingReads.get(), control.log.get());
+    auto cleanupFunc = [](auto incfsControl) {
+        for (auto& fd : incfsControl->releaseFds()) {
+            (void)fd.release();
+        }
+    };
+    auto cleanup =
+            std::unique_ptr<incfs::Control, decltype(cleanupFunc)>(&incfsControl, cleanupFunc);
+    if (auto error = incfs::setOptions(
                 incfsControl,
                 {.defaultReadTimeoutMs = INCFS_DEFAULT_READ_TIMEOUT_MS,
                  .readLogBufferPages = enableReadLogs ? INCFS_DEFAULT_PAGE_READ_BUFFER_PAGES : 0});
         error < 0) {
-        status = binder::Status::fromServiceSpecificError(error);
+        return binder::Status::fromServiceSpecificError(error);
     }
-    IncFs_DeleteControl(incfsControl);
 
-    return status;
+    return Ok();
 }
 
 binder::Status VoldNativeService::bindMount(const std::string& sourceDir,
@@ -942,7 +944,7 @@
     CHECK_ARGUMENT_PATH(sourceDir);
     CHECK_ARGUMENT_PATH(targetDir);
 
-    return translate(IncFs_BindMount(sourceDir.c_str(), targetDir.c_str()));
+    return translate(incfs::bindMount(sourceDir, targetDir));
 }
 
 }  // namespace vold
