diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2021-11-28 05:45:34 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2021-12-04 23:05:05 +0200 |
commit | 5c85e7024027c90b1b054782e510691b8b9c7419 (patch) | |
tree | 4fa3beff65de2a9a1236ad5c931b8e2495fd6eb2 /utils | |
parent | 3dc3e2e61e548e4cd3e213b1b3022ed4d8e7ecee (diff) |
libcamera: base: Rename FileDescriptor to SharedFD
Now that we have a UniqueFD class, the name FileDescriptor is ambiguous.
Rename it to SharedFD.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'utils')
5 files changed, 17 insertions, 17 deletions
diff --git a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl index d856339a..c37c4941 100644 --- a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl +++ b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl @@ -237,7 +237,7 @@ void {{proxy_name}}::recvMessage(const IPCMessage &data) void {{proxy_name}}::{{method.mojom_name}}IPC( std::vector<uint8_t>::const_iterator data, size_t dataSize, - [[maybe_unused]] const std::vector<FileDescriptor> &fds) + [[maybe_unused]] const std::vector<SharedFD> &fds) { {%- for param in method.parameters %} {{param|name}} {{param.mojom_name}}; diff --git a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.h.tmpl b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.h.tmpl index ce396c18..c308dd10 100644 --- a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.h.tmpl +++ b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.h.tmpl @@ -64,7 +64,7 @@ private: void {{method.mojom_name}}IPC( std::vector<uint8_t>::const_iterator data, size_t dataSize, - const std::vector<FileDescriptor> &fds); + const std::vector<SharedFD> &fds); {% endfor %} /* Helper class to invoke async functions in another thread. */ diff --git a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl index ebcd2aaa..bac826a7 100644 --- a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl +++ b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl @@ -54,7 +54,7 @@ {%- for param in params %} std::vector<uint8_t> {{param.mojom_name}}Buf; {%- if param|has_fd %} - std::vector<FileDescriptor> {{param.mojom_name}}Fds; + std::vector<SharedFD> {{param.mojom_name}}Fds; std::tie({{param.mojom_name}}Buf, {{param.mojom_name}}Fds) = {%- else %} std::tie({{param.mojom_name}}Buf, std::ignore) = diff --git a/utils/ipc/generators/libcamera_templates/serializer.tmpl b/utils/ipc/generators/libcamera_templates/serializer.tmpl index b8ef8e7b..77bae36f 100644 --- a/utils/ipc/generators/libcamera_templates/serializer.tmpl +++ b/utils/ipc/generators/libcamera_templates/serializer.tmpl @@ -40,7 +40,7 @@ retData.insert(retData.end(), {{field.mojom_name}}.begin(), {{field.mojom_name}}.end()); {%- elif field|is_fd %} std::vector<uint8_t> {{field.mojom_name}}; - std::vector<FileDescriptor> {{field.mojom_name}}Fds; + std::vector<SharedFD> {{field.mojom_name}}Fds; std::tie({{field.mojom_name}}, {{field.mojom_name}}Fds) = IPADataSerializer<{{field|name}}>::serialize(data.{{field.mojom_name}}); retData.insert(retData.end(), {{field.mojom_name}}.begin(), {{field.mojom_name}}.end()); @@ -58,7 +58,7 @@ {%- elif field|is_plain_struct or field|is_array or field|is_map or field|is_str %} std::vector<uint8_t> {{field.mojom_name}}; {%- if field|has_fd %} - std::vector<FileDescriptor> {{field.mojom_name}}Fds; + std::vector<SharedFD> {{field.mojom_name}}Fds; std::tie({{field.mojom_name}}, {{field.mojom_name}}Fds) = {%- else %} std::tie({{field.mojom_name}}, std::ignore) = @@ -177,7 +177,7 @@ # \a struct. #} {%- macro serializer(struct, namespace) %} - static std::tuple<std::vector<uint8_t>, std::vector<FileDescriptor>> + static std::tuple<std::vector<uint8_t>, std::vector<SharedFD>> serialize(const {{struct|name_full}} &data, {%- if struct|needs_control_serializer %} ControlSerializer *cs) @@ -187,7 +187,7 @@ { std::vector<uint8_t> retData; {%- if struct|has_fd %} - std::vector<FileDescriptor> retFds; + std::vector<SharedFD> retFds; {%- endif %} {%- for field in struct.fields %} {{serializer_field(field, namespace, loop)}} @@ -210,7 +210,7 @@ {%- macro deserializer_fd(struct, namespace) %} static {{struct|name_full}} deserialize(std::vector<uint8_t> &data, - std::vector<FileDescriptor> &fds, + std::vector<SharedFD> &fds, {%- if struct|needs_control_serializer %} ControlSerializer *cs) {%- else %} @@ -224,8 +224,8 @@ static {{struct|name_full}} deserialize(std::vector<uint8_t>::const_iterator dataBegin, std::vector<uint8_t>::const_iterator dataEnd, - std::vector<FileDescriptor>::const_iterator fdsBegin, - std::vector<FileDescriptor>::const_iterator fdsEnd, + std::vector<SharedFD>::const_iterator fdsBegin, + std::vector<SharedFD>::const_iterator fdsEnd, {%- if struct|needs_control_serializer %} ControlSerializer *cs) {%- else %} @@ -234,7 +234,7 @@ { {{struct|name_full}} ret; std::vector<uint8_t>::const_iterator m = dataBegin; - std::vector<FileDescriptor>::const_iterator n = fdsBegin; + std::vector<SharedFD>::const_iterator n = fdsBegin; size_t dataSize = std::distance(dataBegin, dataEnd); [[maybe_unused]] size_t fdsSize = std::distance(fdsBegin, fdsEnd); @@ -255,7 +255,7 @@ {%- macro deserializer_fd_simple(struct, namespace) %} static {{struct|name_full}} deserialize(std::vector<uint8_t> &data, - [[maybe_unused]] std::vector<FileDescriptor> &fds, + [[maybe_unused]] std::vector<SharedFD> &fds, ControlSerializer *cs = nullptr) { return IPADataSerializer<{{struct|name_full}}>::deserialize(data.cbegin(), data.cend(), cs); @@ -264,8 +264,8 @@ static {{struct|name_full}} deserialize(std::vector<uint8_t>::const_iterator dataBegin, std::vector<uint8_t>::const_iterator dataEnd, - [[maybe_unused]] std::vector<FileDescriptor>::const_iterator fdsBegin, - [[maybe_unused]] std::vector<FileDescriptor>::const_iterator fdsEnd, + [[maybe_unused]] std::vector<SharedFD>::const_iterator fdsBegin, + [[maybe_unused]] std::vector<SharedFD>::const_iterator fdsEnd, ControlSerializer *cs = nullptr) { return IPADataSerializer<{{struct|name_full}}>::deserialize(dataBegin, dataEnd, cs); diff --git a/utils/ipc/generators/mojom_libcamera_generator.py b/utils/ipc/generators/mojom_libcamera_generator.py index c609f4e5..753bfc73 100644 --- a/utils/ipc/generators/mojom_libcamera_generator.py +++ b/utils/ipc/generators/mojom_libcamera_generator.py @@ -77,7 +77,7 @@ def GetDefaultValue(element): if mojom.IsEnumKind(element.kind): return f'static_cast<{element.kind.mojom_name}>(0)' if isinstance(element.kind, mojom.Struct) and \ - element.kind.mojom_name == 'FileDescriptor': + element.kind.mojom_name == 'SharedFD': return '-1' return '' @@ -140,7 +140,7 @@ def HasFd(element): types = GetAllTypes(element) else: types = GetAllTypes(element.kind) - return "FileDescriptor" in types or (attrs is not None and "hasFd" in attrs) + return "SharedFD" in types or (attrs is not None and "hasFd" in attrs) def WithDefaultValues(element): return [x for x in element if HasDefaultValue(x)] @@ -221,7 +221,7 @@ def IsEnum(element): return mojom.IsEnumKind(element.kind) def IsFd(element): - return mojom.IsStructKind(element.kind) and element.kind.mojom_name == "FileDescriptor" + return mojom.IsStructKind(element.kind) and element.kind.mojom_name == "SharedFD" def IsMap(element): return mojom.IsMapKind(element.kind) |