mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
695c24f493
Summary: These don't compile on Windows, and in order to get mode/win to compile, we need to avoid compiling their contents. Ideally, we could do that in the TARGETS files with the select statement, but that's not available in fbcode. Thus, we do the next best thing: ifdef the file entirely. Reviewed By: wez Differential Revision: D23871728 fbshipit-source-id: b4d9df6503eaa008e649afd7bdc665cd37a9585d
46 lines
938 B
C++
46 lines
938 B
C++
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This software may be used and distributed according to the terms of the
|
|
* GNU General Public License version 2.
|
|
*/
|
|
|
|
#ifndef _WIN32
|
|
|
|
#include "eden/fs/inodes/InodeMetadata.h"
|
|
#include "eden/fs/fuse/FuseTypes.h"
|
|
|
|
namespace facebook {
|
|
namespace eden {
|
|
|
|
void InodeMetadata::updateFromAttr(
|
|
const Clock& clock,
|
|
const fuse_setattr_in& attr) {
|
|
if (attr.valid & FATTR_MODE) {
|
|
// Make sure we preserve the file type bits, and only update
|
|
// permissions.
|
|
mode = (mode & S_IFMT) | (07777 & attr.mode);
|
|
}
|
|
|
|
if (attr.valid & FATTR_UID) {
|
|
uid = attr.uid;
|
|
}
|
|
if (attr.valid & FATTR_GID) {
|
|
gid = attr.gid;
|
|
}
|
|
|
|
timestamps.setattrTimes(clock, attr);
|
|
}
|
|
|
|
void InodeMetadata::applyToStat(struct stat& st) const {
|
|
st.st_mode = mode;
|
|
st.st_uid = uid;
|
|
st.st_gid = gid;
|
|
timestamps.applyToStat(st);
|
|
}
|
|
|
|
} // namespace eden
|
|
} // namespace facebook
|
|
|
|
#endif
|