Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 401f8b69 authored by Daichi Hirono's avatar Daichi Hirono Committed by android-build-merger
Browse files

Merge "Use FUSE_COMPAT_22_INIT_OUT_SIZE always if available." am: c884f807

am: c0a79ff4

Change-Id: Ie4d71460a86e8504cf32a65b143d8d7a32248cca
parents fde3b5b9 c0a79ff4
Loading
Loading
Loading
Loading
+5 −10
Original line number Diff line number Diff line
@@ -118,23 +118,18 @@ void FuseBuffer::HandleInit() {
    return;
  }

  // We limit ourselves to 15 because we don't handle BATCH_FORGET yet
  size_t response_size = sizeof(fuse_init_out);
  // We limit ourselves to minor=15 because we don't handle BATCH_FORGET yet.
  // Thus we need to use FUSE_COMPAT_22_INIT_OUT_SIZE.
#if defined(FUSE_COMPAT_22_INIT_OUT_SIZE)
  // FUSE_KERNEL_VERSION >= 23.

  // If the kernel only works on minor revs older than or equal to 22,
  // then use the older structure size since this code only uses the 7.22
  // version of the structure.
  if (minor <= 22) {
    response_size = FUSE_COMPAT_22_INIT_OUT_SIZE;
  }
  const size_t response_size = FUSE_COMPAT_22_INIT_OUT_SIZE;
#else
  const size_t response_size = sizeof(fuse_init_out);
#endif

  response.Reset(response_size, kFuseSuccess, unique);
  fuse_init_out* const out = &response.init_out;
  out->major = FUSE_KERNEL_VERSION;
  // We limit ourselves to 15 because we don't handle BATCH_FORGET yet.
  out->minor = std::min(minor, 15u);
  out->max_readahead = max_readahead;
  out->flags = FUSE_ATOMIC_O_TRUNC | FUSE_BIG_WRITES;
+1 −1
Original line number Diff line number Diff line
@@ -164,7 +164,7 @@ TEST(FuseBufferTest, HandleInit) {

  buffer.HandleInit();

  ASSERT_EQ(sizeof(fuse_out_header) + sizeof(fuse_init_out),
  ASSERT_EQ(sizeof(fuse_out_header) + FUSE_COMPAT_22_INIT_OUT_SIZE,
            buffer.response.header.len);
  EXPECT_EQ(kFuseSuccess, buffer.response.header.error);
  EXPECT_EQ(static_cast<unsigned int>(FUSE_KERNEL_VERSION),