CS350 COS
COS
Loading...
Searching...
No Matches
handle.h
Go to the documentation of this file.
1
2#ifndef __SYS_HANDLE_H__
3#define __SYS_HANDLE_H__
4
5#include <sys/queue.h>
6#include <sys/disk.h>
7#include <sys/vfs.h>
8
9struct Handle;
10typedef struct Handle Handle;
11
12#define HANDLE_TYPE_FILE 1
13#define HANDLE_TYPE_CONSOLE 2
14
15typedef TAILQ_HEAD(HandleQueue, Handle) HandleQueue;
16
17typedef struct Handle {
18 uint64_t fd; // FD Number
19 uint64_t type; // Type
20 uint64_t processId; // Process ID
21 VNode *vnode; // File VNode
22 TAILQ_ENTRY(Handle) handleList; // Hash table
23 int (*read)(Handle *, void *, uint64_t, uint64_t); // Read
24 int (*write)(Handle *, void *, uint64_t, uint64_t); // Write
25 int (*flush)(Handle *); // Flush
26 int (*close)(Handle *); // Close
27} Handle;
28
30
31#endif /* __SYS_HANDLE_H__ */
32
#define DECLARE_SLAB(_type)
Definition: kmem.h:65
#define TAILQ_HEAD(name, type)
Definition: queue.h:491
Definition: handle.h:17
uint64_t fd
Definition: handle.h:18
uint64_t type
Definition: handle.h:19
uint64_t processId
Definition: handle.h:20
int(* close)(Handle *)
Definition: handle.h:26
TAILQ_ENTRY(Handle) handleList
VNode * vnode
Definition: handle.h:21
int(* write)(Handle *, void *, uint64_t, uint64_t)
Definition: handle.h:24
int(* read)(Handle *, void *, uint64_t, uint64_t)
Definition: handle.h:23
int(* flush)(Handle *)
Definition: handle.h:25
unsigned long uint64_t
Definition: types.h:13
Definition: vfs.h:24