mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
951eb290b1
Summary: Unify how inode metadata is modified across inode types. This allows changing the permission bits on a directory. Reviewed By: simpkins Differential Revision: D7767254 fbshipit-source-id: 35e9cf652c84c7d8680cc22dec7942e94e9f5af1
58 lines
1.5 KiB
C++
58 lines
1.5 KiB
C++
/*
|
|
* Copyright (c) 2018-present, 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 <sys/stat.h>
|
|
#include "eden/fs/inodes/InodeTimestamps.h"
|
|
|
|
struct fuse_setattr_in;
|
|
struct stat;
|
|
|
|
namespace facebook {
|
|
namespace eden {
|
|
|
|
/**
|
|
* Fixed-size structure of per-inode bits that should be persisted across runs.
|
|
*
|
|
* Warning: This data structure is serialized directly to disk via InodeTable.
|
|
* Do not change the order, sizes, or meanings of the fields. Instead, rename
|
|
* this struct, create a new InodeMetadata struct with the next VERSION value,
|
|
* add an explicit constructor from the old version, and add the old version to
|
|
* the InodeMetadataTable typedef in InodeTable.h.
|
|
*/
|
|
struct InodeMetadata {
|
|
enum { VERSION = 0 };
|
|
|
|
InodeMetadata() = default;
|
|
|
|
explicit InodeMetadata(
|
|
mode_t m,
|
|
uid_t u,
|
|
gid_t g,
|
|
const InodeTimestamps& ts) noexcept
|
|
: mode{m}, uid{u}, gid{g}, timestamps{ts} {}
|
|
|
|
mode_t mode{0};
|
|
uid_t uid{0};
|
|
gid_t gid{0};
|
|
InodeTimestamps timestamps;
|
|
|
|
void updateFromAttr(const Clock& clock, const fuse_setattr_in& attr);
|
|
|
|
void applyToStat(struct stat& st) const;
|
|
|
|
// Other potential things to include:
|
|
// nlink_t nlinks;
|
|
// dev_t rdev;
|
|
// creation time
|
|
};
|
|
} // namespace eden
|
|
} // namespace facebook
|