summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaichi Hirono2016-11-09 18:17:17 -0600
committerDaichi Hirono2016-11-14 19:18:37 -0600
commit0d97be4d7db1baa831d0432229dec08c87193919 (patch)
tree7f0bd712b7e52ed12b56c89fb4e743073003d05c /libappfuse/include
parenta0aecda12b9a76aa15a8c5175e15538574a05af7 (diff)
downloadplatform-system-core-0d97be4d7db1baa831d0432229dec08c87193919.tar.gz
platform-system-core-0d97be4d7db1baa831d0432229dec08c87193919.tar.xz
platform-system-core-0d97be4d7db1baa831d0432229dec08c87193919.zip
Add static assert to check if FuseBuffer is standard layout union.
Bug: 32260320 Test: libappfuse_test Change-Id: I6430c11fdeb2405996410c97044b4260c25209b8
Diffstat (limited to 'libappfuse/include')
-rw-r--r--libappfuse/include/libappfuse/FuseBuffer.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/libappfuse/include/libappfuse/FuseBuffer.h b/libappfuse/include/libappfuse/FuseBuffer.h
index 1464142c4..e7f620cb6 100644
--- a/libappfuse/include/libappfuse/FuseBuffer.h
+++ b/libappfuse/include/libappfuse/FuseBuffer.h
@@ -28,9 +28,9 @@ constexpr size_t kFuseMaxWrite = 256 * 1024;
28constexpr size_t kFuseMaxRead = 128 * 1024; 28constexpr size_t kFuseMaxRead = 128 * 1024;
29constexpr int32_t kFuseSuccess = 0; 29constexpr int32_t kFuseSuccess = 0;
30 30
31template<typename T, typename Header> 31template<typename T>
32struct FuseMessage { 32class FuseMessage {
33 Header header; 33 public:
34 bool Read(int fd); 34 bool Read(int fd);
35 bool Write(int fd) const; 35 bool Write(int fd) const;
36 private: 36 private:
@@ -40,7 +40,8 @@ struct FuseMessage {
40 40
41// FuseRequest represents file operation requests from /dev/fuse. It starts 41// FuseRequest represents file operation requests from /dev/fuse. It starts
42// from fuse_in_header. The body layout depends on the operation code. 42// from fuse_in_header. The body layout depends on the operation code.
43struct FuseRequest final : public FuseMessage<FuseRequest, fuse_in_header> { 43struct FuseRequest : public FuseMessage<FuseRequest> {
44 fuse_in_header header;
44 union { 45 union {
45 // for FUSE_WRITE 46 // for FUSE_WRITE
46 struct { 47 struct {
@@ -61,7 +62,8 @@ struct FuseRequest final : public FuseMessage<FuseRequest, fuse_in_header> {
61 62
62// FuseResponse represents file operation responses to /dev/fuse. It starts 63// FuseResponse represents file operation responses to /dev/fuse. It starts
63// from fuse_out_header. The body layout depends on the operation code. 64// from fuse_out_header. The body layout depends on the operation code.
64struct FuseResponse final : public FuseMessage<FuseResponse, fuse_out_header> { 65struct FuseResponse : public FuseMessage<FuseResponse> {
66 fuse_out_header header;
65 union { 67 union {
66 // for FUSE_INIT 68 // for FUSE_INIT
67 fuse_init_out init_out; 69 fuse_init_out init_out;