Changeset View
Changeset View
Standalone View
Standalone View
tests/sys/fs/fusefs/utils.cc
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* The default max_write is set to this formula in libfuse, though | * The default max_write is set to this formula in libfuse, though | ||||
* individual filesystems can lower it. The "- 4096" was added in | * individual filesystems can lower it. The "- 4096" was added in | ||||
* commit 154ffe2, with the commit message "fix". | * commit 154ffe2, with the commit message "fix". | ||||
*/ | */ | ||||
const uint32_t libfuse_max_write = 32 * getpagesize() + 0x1000 - 4096; | const uint32_t libfuse_max_write = 32 * getpagesize() + 0x1000 - 4096; | ||||
/* | |||||
* Set the default max_write to a distinct value from MAXPHYS to catch bugs | |||||
* that confuse the two. | |||||
*/ | |||||
const uint32_t default_max_write = MIN(libfuse_max_write, MAXPHYS / 2); | |||||
/* Check that fusefs(4) is accessible and the current user can mount(2) */ | /* Check that fusefs(4) is accessible and the current user can mount(2) */ | ||||
void check_environment() | void check_environment() | ||||
{ | { | ||||
const char *devnode = "/dev/fuse"; | const char *devnode = "/dev/fuse"; | ||||
const char *bsdextended_node = "security.mac.bsdextended.enabled"; | const char *bsdextended_node = "security.mac.bsdextended.enabled"; | ||||
int bsdextended_val = 0; | int bsdextended_val = 0; | ||||
size_t bsdextended_size = sizeof(bsdextended_val); | size_t bsdextended_size = sizeof(bsdextended_val); | ||||
int bsdextended_found; | int bsdextended_found; | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | if (IsSkipped()) | ||||
return; | return; | ||||
ASSERT_EQ(0, sysctlbyname(maxbcachebuf_node, &val, &size, NULL, 0)) | ASSERT_EQ(0, sysctlbyname(maxbcachebuf_node, &val, &size, NULL, 0)) | ||||
<< strerror(errno); | << strerror(errno); | ||||
m_maxbcachebuf = val; | m_maxbcachebuf = val; | ||||
ASSERT_EQ(0, sysctlbyname(maxphys_node, &val, &size, NULL, 0)) | ASSERT_EQ(0, sysctlbyname(maxphys_node, &val, &size, NULL, 0)) | ||||
<< strerror(errno); | << strerror(errno); | ||||
m_maxphys = val; | m_maxphys = val; | ||||
/* | |||||
* Set the default max_write to a distinct value from MAXPHYS to catch | |||||
* bugs that confuse the two. | |||||
*/ | |||||
if (m_maxwrite == 0) | |||||
m_maxwrite = MIN(libfuse_max_write, (uint32_t)m_maxphys / 2); | |||||
try { | try { | ||||
m_mock = new MockFS(m_maxreadahead, m_allow_other, | m_mock = new MockFS(m_maxreadahead, m_allow_other, | ||||
m_default_permissions, m_push_symlinks_in, m_ro, | m_default_permissions, m_push_symlinks_in, m_ro, | ||||
m_pm, m_init_flags, m_kernel_minor_version, | m_pm, m_init_flags, m_kernel_minor_version, | ||||
m_maxwrite, m_async, m_noclusterr, m_time_gran, | m_maxwrite, m_async, m_noclusterr, m_time_gran, | ||||
m_nointr); | m_nointr); | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 485 Lines • Show Last 20 Lines |