Move definition of maximum file name length from <syscall> to file.h

This commit is contained in:
Themis Demetriades
2024-11-08 15:41:35 +00:00
parent ed09e0b08e
commit b64434fb9d
3 changed files with 6 additions and 5 deletions

View File

@@ -4,6 +4,9 @@
#include "filesys/off_t.h"
#include <stdbool.h>
/* The maximum length of a file name in PintOS. */
#define FNAME_MAX_LEN 14
struct inode;
/* Opening and closing files. */

View File

@@ -166,7 +166,7 @@ mkdir (const char *dir)
}
bool
readdir (int fd, char name[READDIR_MAX_LEN + 1])
readdir (int fd, char name[FNAME_MAX_LEN + 1])
{
return syscall2 (SYS_READDIR, fd, name);
}

View File

@@ -3,6 +3,7 @@
#include <stdbool.h>
#include <debug.h>
#include "../../filesys/file.h"
/* Process identifier. */
typedef int pid_t;
@@ -12,9 +13,6 @@ typedef int pid_t;
typedef int mapid_t;
#define MAP_FAILED ((mapid_t) -1)
/* Maximum characters in a filename written by readdir(). */
#define READDIR_MAX_LEN 14
/* Typical return values from main() and arguments to exit(). */
#define EXIT_SUCCESS 0 /* Successful execution. */
#define EXIT_FAILURE 1 /* Unsuccessful execution. */
@@ -41,7 +39,7 @@ void munmap (mapid_t);
/* Task 4 only. */
bool chdir (const char *dir);
bool mkdir (const char *dir);
bool readdir (int fd, char name[READDIR_MAX_LEN + 1]);
bool readdir (int fd, char name[FNAME_MAX_LEN + 1]);
bool isdir (int fd);
int inumber (int fd);