mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
498a3b8aba
Summary: Enables mkdir in the overlay area. I had to add some `lstat` calls in to the overlay dir reader because we depend on knowing at least whether a node is a dir or not at the next level up. When I run the test suite, the mounts are on my `/tmp` filesystem. When I run eden manually, they are on my `/data` filesystem. The latter (xfs) does not populate the type bits. This meant that the test suite passed but manual testing did not. Adding the `lstat` calls is a little unfortunate. On OS X there is a bulk operation that combines `readdir` and `lstat` so that there are fewer syscalls. We don't have an equivalent for Linux. Reviewed By: bolinfest Differential Revision: D3301532 fbshipit-source-id: e228f4a392f90aa491fec62e8b98471a8acecff2
82 lines
2.3 KiB
C++
82 lines
2.3 KiB
C++
/*
|
|
* Copyright (c) 2016, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
*/
|
|
#pragma once
|
|
#include "eden/fs/model/Tree.h"
|
|
#include "eden/fuse/Inodes.h"
|
|
|
|
namespace facebook {
|
|
namespace eden {
|
|
|
|
class LocalStore;
|
|
class Overlay;
|
|
|
|
namespace fusell {
|
|
class MountPoint;
|
|
}
|
|
|
|
// Represents a Tree instance in a form that FUSE can consume
|
|
class TreeInode : public fusell::DirInode {
|
|
public:
|
|
TreeInode(
|
|
std::unique_ptr<Tree>&& tree,
|
|
fusell::MountPoint* mountPoint,
|
|
fuse_ino_t parent,
|
|
fuse_ino_t ino,
|
|
std::shared_ptr<LocalStore> store,
|
|
std::shared_ptr<Overlay> overlay);
|
|
|
|
/// Construct an inode that only has backing in the Overlay area
|
|
TreeInode(
|
|
fusell::MountPoint* mountPoint,
|
|
fuse_ino_t parent,
|
|
fuse_ino_t ino,
|
|
std::shared_ptr<LocalStore> store,
|
|
std::shared_ptr<Overlay> overlay);
|
|
|
|
~TreeInode();
|
|
|
|
folly::Future<fusell::Dispatcher::Attr> getattr() override;
|
|
folly::Future<std::shared_ptr<fusell::InodeBase>> getChildByName(
|
|
PathComponentPiece namepiece) override;
|
|
folly::Future<std::unique_ptr<fusell::DirHandle>> opendir(
|
|
const struct fuse_file_info& fi) override;
|
|
|
|
const Tree* getTree() const;
|
|
fuse_ino_t getParent() const;
|
|
fuse_ino_t getInode() const;
|
|
std::shared_ptr<LocalStore> getStore() const;
|
|
std::shared_ptr<Overlay> getOverlay() const;
|
|
folly::Future<fusell::DirInode::CreateResult>
|
|
create(PathComponentPiece name, mode_t mode, int flags) override;
|
|
|
|
folly::Future<fuse_entry_param> mkdir(PathComponentPiece name, mode_t mode)
|
|
override;
|
|
|
|
/** Called in a thrift context to switch the active snapshot.
|
|
* Since this is called in a thrift context, RequestData::get() won't
|
|
* return the usual results and the appropriate information must
|
|
* be passed down from the thrift server itself.
|
|
*/
|
|
void performCheckout(
|
|
const std::string& hash,
|
|
fusell::InodeDispatcher* dispatcher,
|
|
std::shared_ptr<fusell::MountPoint> mountPoint);
|
|
|
|
private:
|
|
std::unique_ptr<Tree> tree_;
|
|
fusell::MountPoint* const mount_{nullptr};
|
|
fuse_ino_t parent_;
|
|
fuse_ino_t ino_;
|
|
std::shared_ptr<LocalStore> store_;
|
|
std::shared_ptr<Overlay> overlay_;
|
|
};
|
|
}
|
|
}
|