1 // Copyright 2018 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include <stdlib.h>
6 #include <stdio.h>
7 
8 #include "kernel.h"
9 #include "modules.h"
10 
11 #include <lib/backtrace-request/backtrace-request.h>
12 
13 SEM FileSysSem; // Global File System Semaphore
14 
15 // Called when a file system error has occurred.
FsError(int err_code)16 int FsError(int err_code) {
17     printf("FsError: %d\n", err_code);
18     backtrace_request();
19     return -1;
20 }
21 
FsModule(int req,...)22 void* FsModule(int req, ...) {
23     // Only respond to module initialization request.
24     if (req == kInitMod) {
25         FileSysSem = semCreate("fsys sem", 1, OS_FIFO);
26         if (FileSysSem == NULL)
27             return (void*)-1;
28     }
29     return NULL;
30 }
31