Skip to content

Commit

Permalink
Move is_eden_fs_mount to common/utils
Browse files Browse the repository at this point in the history
Summary:
Moves is_eden_fs_mount out of watchman into eden/common/utils

This function checks if an entry in the mount table is an edenfs mount by seeing if it starts with `edenfs:`

The intention is to have a single source of determining what entries are eden mounts to prevent duplicated code

TARGETS changes by autodeps

Reviewed By: genevievehelsel

Differential Revision: D62528347

fbshipit-source-id: b1edf7e811334de815c5255e5d3dc9536d177fb8
  • Loading branch information
Chris Dinh authored and facebook-github-bot committed Sep 13, 2024
1 parent 30cc1ed commit af2d27a
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions eden/common/utils/FSDetect.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

#pragma once

#include <string>

#include <folly/Range.h>

namespace facebook::eden {

inline bool is_edenfs_fs_type(folly::StringPiece fs_type) {
return !fs_type.empty() &&
(fs_type == "edenfs" || fs_type.startsWith("edenfs:"));
}

inline bool is_edenfs_fs_mount(
folly::StringPiece line_entry,
const std::string& mountPoint) {
return is_edenfs_fs_type(line_entry) &&
line_entry.find(mountPoint) != std::string::npos;
}

} // namespace facebook::eden

0 comments on commit af2d27a

Please sign in to comment.