diff options
author | Treehugger Robot | 2016-11-15 21:57:46 -0600 |
---|---|---|
committer | Gerrit Code Review | 2016-11-15 21:57:46 -0600 |
commit | c884f80755f8ecaed92a783f2a13038ab06ae691 (patch) | |
tree | 1254698431bfb95d1fcfba4af54d9b5940c8b184 /libappfuse | |
parent | a73ba879b1bac25ce0b93cbeb895b05c796fc9ec (diff) | |
parent | 471ad6a59d4ab765a5e93d5dd557057e88858974 (diff) | |
download | platform-system-core-c884f80755f8ecaed92a783f2a13038ab06ae691.tar.gz platform-system-core-c884f80755f8ecaed92a783f2a13038ab06ae691.tar.xz platform-system-core-c884f80755f8ecaed92a783f2a13038ab06ae691.zip |
Merge "Use FUSE_COMPAT_22_INIT_OUT_SIZE always if available."
Diffstat (limited to 'libappfuse')
-rw-r--r-- | libappfuse/FuseBuffer.cc | 15 | ||||
-rw-r--r-- | libappfuse/tests/FuseBufferTest.cc | 2 |
2 files changed, 6 insertions, 11 deletions
diff --git a/libappfuse/FuseBuffer.cc b/libappfuse/FuseBuffer.cc index 74fe756a9..3ade31c54 100644 --- a/libappfuse/FuseBuffer.cc +++ b/libappfuse/FuseBuffer.cc | |||
@@ -118,23 +118,18 @@ void FuseBuffer::HandleInit() { | |||
118 | return; | 118 | return; |
119 | } | 119 | } |
120 | 120 | ||
121 | // We limit ourselves to 15 because we don't handle BATCH_FORGET yet | 121 | // We limit ourselves to minor=15 because we don't handle BATCH_FORGET yet. |
122 | size_t response_size = sizeof(fuse_init_out); | 122 | // Thus we need to use FUSE_COMPAT_22_INIT_OUT_SIZE. |
123 | #if defined(FUSE_COMPAT_22_INIT_OUT_SIZE) | 123 | #if defined(FUSE_COMPAT_22_INIT_OUT_SIZE) |
124 | // FUSE_KERNEL_VERSION >= 23. | 124 | // FUSE_KERNEL_VERSION >= 23. |
125 | 125 | const size_t response_size = FUSE_COMPAT_22_INIT_OUT_SIZE; | |
126 | // If the kernel only works on minor revs older than or equal to 22, | 126 | #else |
127 | // then use the older structure size since this code only uses the 7.22 | 127 | const size_t response_size = sizeof(fuse_init_out); |
128 | // version of the structure. | ||
129 | if (minor <= 22) { | ||
130 | response_size = FUSE_COMPAT_22_INIT_OUT_SIZE; | ||
131 | } | ||
132 | #endif | 128 | #endif |
133 | 129 | ||
134 | response.Reset(response_size, kFuseSuccess, unique); | 130 | response.Reset(response_size, kFuseSuccess, unique); |
135 | fuse_init_out* const out = &response.init_out; | 131 | fuse_init_out* const out = &response.init_out; |
136 | out->major = FUSE_KERNEL_VERSION; | 132 | out->major = FUSE_KERNEL_VERSION; |
137 | // We limit ourselves to 15 because we don't handle BATCH_FORGET yet. | ||
138 | out->minor = std::min(minor, 15u); | 133 | out->minor = std::min(minor, 15u); |
139 | out->max_readahead = max_readahead; | 134 | out->max_readahead = max_readahead; |
140 | out->flags = FUSE_ATOMIC_O_TRUNC | FUSE_BIG_WRITES; | 135 | out->flags = FUSE_ATOMIC_O_TRUNC | FUSE_BIG_WRITES; |
diff --git a/libappfuse/tests/FuseBufferTest.cc b/libappfuse/tests/FuseBufferTest.cc index 17f1306fe..c82213513 100644 --- a/libappfuse/tests/FuseBufferTest.cc +++ b/libappfuse/tests/FuseBufferTest.cc | |||
@@ -164,7 +164,7 @@ TEST(FuseBufferTest, HandleInit) { | |||
164 | 164 | ||
165 | buffer.HandleInit(); | 165 | buffer.HandleInit(); |
166 | 166 | ||
167 | ASSERT_EQ(sizeof(fuse_out_header) + sizeof(fuse_init_out), | 167 | ASSERT_EQ(sizeof(fuse_out_header) + FUSE_COMPAT_22_INIT_OUT_SIZE, |
168 | buffer.response.header.len); | 168 | buffer.response.header.len); |
169 | EXPECT_EQ(kFuseSuccess, buffer.response.header.error); | 169 | EXPECT_EQ(kFuseSuccess, buffer.response.header.error); |
170 | EXPECT_EQ(static_cast<unsigned int>(FUSE_KERNEL_VERSION), | 170 | EXPECT_EQ(static_cast<unsigned int>(FUSE_KERNEL_VERSION), |