]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android/platform-hardware-interfaces.git/commitdiff
health filesystem: update garbageCollect() function.
authorYifan Hong <elsk@google.com>
Wed, 15 Aug 2018 21:41:01 +0000 (14:41 -0700)
committerYifan Hong <elsk@google.com>
Wed, 12 Sep 2018 17:43:49 +0000 (10:43 -0700)
Bug: 111655771
Test: run dev gc on vold

Change-Id: I2cef404f9e2720c1be7822895187a590837763c8

health/filesystem/1.0/Android.bp
health/filesystem/1.0/IFileSystem.hal
health/filesystem/1.0/IGarbageCollectCallback.hal [new file with mode: 0644]
health/filesystem/1.0/types.hal

index 74b9bc31e43e209087ca0e93297ad502d6e1bbc6..cb7cf0e88e18ee3590b39f6df6299f323fe701c4 100644 (file)
@@ -9,6 +9,7 @@ hidl_interface {
     srcs: [
         "types.hal",
         "IFileSystem.hal",
+        "IGarbageCollectCallback.hal",
     ],
     interfaces: [
         "android.hidl.base@1.0",
index 33ea3ff849efea1c14f2c8b4f00c2d2b5fb5741a..a5e6487a63db793306f27e9a4fc29a517eac61e0 100644 (file)
 
 package android.hardware.health.filesystem@1.0;
 
+import IGarbageCollectCallback;
+
 /**
  * IFileSystem is an interface that provides operations on underlying storage
  * devices, including flash memory.
  */
 interface IFileSystem {
     /**
-     * Start garbage collection on the driver of storage devices. This function
-     * must be called at regular intervals when it is a good time for a
-     * longer-running cleanup tasks.
+     * Start garbage collection on the driver of storage devices.
+     *
+     * Garbage collection must be started at regular intervals when it is a good
+     * time for a longer-running cleanup tasks, roughly daily.
+     *
+     * When garbage collection finishes or encounters an error before the
+     * specified timeout, the implementation must call IGarbageCollect.finish
+     * immediately with appropriate result.
+     *
+     * If garbage collection does not finish within the specified timeout,
+     * the implementation must stop garbage collection, and must not call
+     * IGarbageCollect.finish.
+     *
+     * @param timeoutSeconds timeout in seconds. The implementation must
+     *     return after the timeout is reached.
+     *
+     * @param callback callback interface. Callback must be null if the client
+     *     does not need to receive any callbacks.
      *
-     * @return result Execution result. See documentation for Result for
-     *     details.
      */
-    garbageCollect() generates (Result result);
+    oneway garbageCollect(uint64_t timeoutSeconds,
+                          IGarbageCollectCallback callback);
 };
diff --git a/health/filesystem/1.0/IGarbageCollectCallback.hal b/health/filesystem/1.0/IGarbageCollectCallback.hal
new file mode 100644 (file)
index 0000000..901c35c
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.hardware.health.filesystem@1.0;
+
+/**
+ * Callback interface to IFileSystem.garbageCollect.
+ */
+interface IGarbageCollectCallback {
+    /**
+     * When garbage collection has finished, the implementation must
+     * invoke this function to indicate the result of the garbage collection.
+     *
+     * @return result Execution result. See documentation for Result for
+     *     details.
+     */
+    oneway onFinish(Result result);
+};
index 00431f7522fb7c5fd71b8d17389df36879d747d3..0d2db2cdf45be31d6d99a84fdc5aa46a40ff9530 100644 (file)
@@ -24,10 +24,6 @@ enum Result : uint32_t {
      * Execution of the method is successful.
      */
     SUCCESS = 0,
-    /**
-     * Execution of the method timed out.
-     */
-    TIMEOUT,
     /**
      * An IO error is encountered when the HAL communicates with the device.
      */