Add posix_filesystem_static
target and source.
This implements the static registration of a filesystem, without needing to load the plugin DSO. Simply link this target in the binary which needs the filesystem to have the static filesystem imported.
This commit is contained in:
parent
d025964187
commit
9e1c010111
@ -27,6 +27,19 @@ cc_library(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Since building pip package and API tests require a filesystem, we provide a
|
||||||
|
# static registration target that they should link against.
|
||||||
|
cc_library(
|
||||||
|
name = "posix_filesystem_static",
|
||||||
|
srcs = ["posix_filesystem_static.cc"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
deps = [
|
||||||
|
":posix_filesystem_impl",
|
||||||
|
"//tensorflow/c/experimental/filesystem:filesystem_interface",
|
||||||
|
"//tensorflow/c/experimental/filesystem:modular_filesystem",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
# Library implementing helper functionality, so that the above only contains
|
# Library implementing helper functionality, so that the above only contains
|
||||||
# the API implementation for modular filesystems.
|
# the API implementation for modular filesystems.
|
||||||
cc_library(
|
cc_library(
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
|
||||||
|
|
||||||
|
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.
|
||||||
|
==============================================================================*/
|
||||||
|
|
||||||
|
#include "tensorflow/c/experimental/filesystem/filesystem_interface.h"
|
||||||
|
#include "tensorflow/c/experimental/filesystem/modular_filesystem_registration.h"
|
||||||
|
#include "tensorflow/c/experimental/filesystem/plugins/posix/posix_filesystem.h"
|
||||||
|
|
||||||
|
namespace tensorflow {
|
||||||
|
|
||||||
|
// Register the POSIX filesystems statically.
|
||||||
|
// Return value will be unused
|
||||||
|
Status StaticallyRegisterLocalFilesystems() {
|
||||||
|
TF_FilesystemPluginInfo info;
|
||||||
|
TF_InitPlugin(&info);
|
||||||
|
return filesystem_registration::RegisterFilesystemPluginImpl(&info);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform the actual registration
|
||||||
|
static Status unused = StaticallyRegisterLocalFilesystems();
|
||||||
|
|
||||||
|
} // namespace tensorflow
|
Loading…
x
Reference in New Issue
Block a user