32,19 → 32,20 |
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
|
/** @addtogroup FileSystemImpl |
* @{ |
*/ |
|
/** |
* @file utility.c |
* @brief This is the master header for fs. It includes some other files |
* and defines the principal constants. |
*/ |
|
|
/* This file contains a few general purpose utility routines. */ |
|
/* Methods: |
* fetch_name: go get a path name from user space |
* no_sys: reject a system call that FS does not handle |
* conv2: does byte swapping on a 16-bit int |
* conv4: does byte swapping on a 32-bit long |
* fs_strncmp: same like strncmp |
*/ |
|
|
#include <unistd.h> |
#include "fs.h" |
#include "block.h" |
52,7 → 53,9 |
#include "fproc.h" |
#include "inode.h" |
|
|
/** |
* Go get a path name from user space |
*/ |
int fetch_name(char* path, int len) |
{ |
|
78,7 → 81,10 |
|
return OK; |
} |
|
|
/** |
* Reject a system call that FS does not handle |
*/ |
int no_sys() |
{ |
|
86,9 → 92,12 |
|
print_console("FS_NOSYS called, illegal system call number!\n"); |
|
return FS_EINVAL; |
re\turn FS_EINVAL; |
} |
|
|
/** |
* Does byte swapping on a 16-bit int |
*/ |
unsigned conv2(int norm, int w) |
{ |
|
100,6 → 109,9 |
return(((w&BYTE) << 8) | ( (w>>8) & BYTE)); |
} |
|
/** |
* Does byte swapping on a 32-bit long |
*/ |
long conv4(int norm, long x) |
{ |
|
118,6 → 130,9 |
return l; |
} |
|
/** |
* Same like strncmp |
*/ |
int fs_strncmp(const char *src, const char *dst, size_t len) |
{ |
|
144,3 → 159,8 |
|
return 0; |
} |
|
/** |
* } |
*/ |
|