Skip to content

Commit 286cabf

Browse files
Address review concerns
1 parent 2159a35 commit 286cabf

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

src/wakefs/namespace.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,11 @@ static bool do_squashfuse_mount(const std::string &source, const std::string &mo
206206
if (pid == 0) {
207207
// kernel to send SIGKILL to squashfuse when wakebox terminates
208208
if (prctl(PR_SET_PDEATHSIG, SIGKILL) == -1) {
209-
std::cerr << "squashfuse_ll prctl: " << strerror(errno) << std::endl;
209+
std::cerr << "wake_squashfuse_ll prctl: " << strerror(errno) << std::endl;
210210
unlink(fifo_path_result->c_str());
211211
exit(1);
212212
}
213-
execlp("squashfuse_ll", "squashfuse_ll", "-o", "notify_pipe", fifo_path_result->c_str(), "-f",
213+
execlp("wake_squashfuse_ll", "wake_squashfuse_ll", "-o", "notify_pipe", fifo_path_result->c_str(), "-f",
214214
source.c_str(), mountpoint.c_str(), NULL);
215215
std::cerr << "execlp squashfuse: " << strerror(errno) << std::endl;
216216
unlink(fifo_path_result->c_str());
@@ -226,20 +226,16 @@ static bool do_squashfuse_mount(const std::string &source, const std::string &mo
226226
std::cerr << "Could not open fifo: " << strerror(wait_for_mount_opt->posix_error)
227227
<< std::endl;
228228
return false;
229-
break;
230229
case SquashFuseMountWaitErrorType::FailureToReadFifo:
231230
std::cerr << "Error reading fifo: " << strerror(wait_for_mount_opt->posix_error)
232231
<< std::endl;
233232
return false;
234-
break;
235233
case SquashFuseMountWaitErrorType::ReceivedZeroBytes:
236234
std::cerr << "Zero bytes read from fifo." << std::endl;
237235
return false;
238-
break;
239236
case SquashFuseMountWaitErrorType::MountFailed:
240237
std::cerr << "Squashfuse wrote 'f' meaning it failed to mount." << std::endl;
241238
return false;
242-
break;
243239
default:
244240
break;
245241
}

src/wakefs/squashfuse_helper.cpp

+22-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/* Squashfuse mount helper fuctions
2+
*
3+
* Copyright 2023 SiFive, Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You should have received a copy of LICENSE.Apache2 along with
8+
* this software. If not, you may obtain a copy at
9+
*
10+
* https://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// Open Group Base Specifications Issue 7
120
#define _XOPEN_SOURCE 700
221
#define _POSIX_C_SOURCE 200809L
322

@@ -42,12 +61,12 @@ wcl::optional<SquashFuseMountWaitError> wait_for_squashfuse_mount(
4261
auto defer = wcl::make_defer([&]() { unlink(squashfuse_fifo_path.c_str()); });
4362

4463
char squashfuse_notify_result = '\0';
45-
ssize_t bytesRead = read(squashfuse_notify_pipe_fd->get(), &squashfuse_notify_result,
64+
ssize_t bytes_read = read(squashfuse_notify_pipe_fd->get(), &squashfuse_notify_result,
4665
sizeof(squashfuse_notify_result));
47-
if (bytesRead == -1) {
66+
if (bytes_read == -1) {
4867
return wcl::some(
4968
SquashFuseMountWaitError{SquashFuseMountWaitErrorType::FailureToReadFifo, errno});
50-
} else if (bytesRead == 0) {
69+
} else if (bytes_read == 0) {
5170
return wcl::some(SquashFuseMountWaitError{SquashFuseMountWaitErrorType::ReceivedZeroBytes, -1});
5271
}
5372

0 commit comments

Comments
 (0)