2 * Interface constants and typedefs shared between kernel/user space
3 * Copyright (c) 2003, Jeffrey K. Hollingsworth <hollings@cs.umd.edu>
4 * Copyright (c) 2004, David H. Hovemeyer <daveho@cs.umd.edu>
7 * This is free software. You are permitted to use,
8 * redistribute, and modify it as specified in the file "COPYING".
11 #ifndef GEEKOS_FILEIO_H
12 #define GEEKOS_FILEIO_H
15 #include <geekos/ktypes.h>
17 /* Maximum name of a path. */
18 #define VFS_MAX_PATH_LEN 1023
20 /* Maximum length of the name of a filesystem type: e.g., "pfat", "gosfs", etc. */
21 #define VFS_MAX_FS_NAME_LEN 15
23 /* Maximum number of ACL entries in a directory entry. */
24 #define VFS_MAX_ACL_ENTRIES 10
26 /* We assume that all block devices have 512 byte sectors. */
27 #define SECTOR_SIZE 512
29 /* Maximum length for the name of a block device, e.g. "ide0". */
30 #define BLOCKDEV_MAX_NAME_LEN 15
34 * These are used as flags for Open() VFS function.
35 * O_READ and O_WRITE are also used in the permissions
36 * field of struct VFS_ACL_Entry.
38 #define O_CREATE 0x1 /* Create the file if it doesn't exist. */
39 #define O_READ 0x2 /* Open file for reading. */
40 #define O_WRITE 0x4 /* Open file for writing. */
41 #define O_EXCL 0x8 /* Don't create file if it already exists. */
44 * An entry in an Access Control List (ACL).
45 * Represents a set of permissions for a particular user id.
47 struct VFS_ACL_Entry {
53 * Generic structure representing the metadata for a directory entry.
54 * This is filled in by the Stat() and FStat() VFS functions.
56 struct VFS_File_Stat {
60 struct VFS_ACL_Entry acls[VFS_MAX_ACL_ENTRIES];
64 * Generic directory entry structure.
65 * This is filled in by the Read_Entry() VFS function.
67 struct VFS_Dir_Entry {
69 struct VFS_File_Stat stats;
73 * A request to mount a filesystem.
74 * This is passed as a struct because it would require too many registers
75 * to pass all of the information in registers.
77 struct VFS_Mount_Request {
78 char devname[BLOCKDEV_MAX_NAME_LEN+1];/* Name of block device: e.g., "ide1". */
79 char prefix[VFS_MAX_PATH_LEN+1]; /* Directory prefix to mount on: e.g., "/d". */
80 char fstype[VFS_MAX_FS_NAME_LEN+1]; /* Filesystem type: e.g., "gosfs". */