From a8305b7318e66eb33e7789072e8b91dffa0e4b93 Mon Sep 17 00:00:00 2001 From: Robert Morris Date: Thu, 13 Jun 2019 10:29:27 -0400 Subject: FD_DEVICE --- kernel/file.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'kernel/file.h') diff --git a/kernel/file.h b/kernel/file.h index f28018f..5cf15a2 100644 --- a/kernel/file.h +++ b/kernel/file.h @@ -1,11 +1,12 @@ struct file { - enum { FD_NONE, FD_PIPE, FD_INODE } type; + enum { FD_NONE, FD_PIPE, FD_INODE, FD_DEVICE } type; int ref; // reference count char readable; char writable; - struct pipe *pipe; - struct inode *ip; - uint off; + struct pipe *pipe; // FD_PIPE + struct inode *ip; // FD_INODE and FD_DEVICE + uint off; // FD_INODE + short major; // FD_DEVICE }; @@ -25,11 +26,10 @@ struct inode { uint addrs[NDIRECT+1]; }; -// table mapping major device number to -// device functions +// map major device number to device functions. struct devsw { - int (*read)(struct inode*, int, uint64, int); - int (*write)(struct inode*, int, uint64, int); + int (*read)(int, uint64, int); + int (*write)(int, uint64, int); }; extern struct devsw devsw[]; -- cgit v1.2.3