X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ffilesys%2Ffile.h;h=a33c5af49f7c9c29142b234290e7c1969b9f54cb;hb=fd2a5afa946474ba0839de0e9da238dbaecbd6a5;hp=d165e80bf427123fcd41f1634e5de9cbf117a9b6;hpb=2cf38a4ba2dd965c892767b0d8ee97e67f33b274;p=pintos-anon diff --git a/src/filesys/file.h b/src/filesys/file.h index d165e80..a33c5af 100644 --- a/src/filesys/file.h +++ b/src/filesys/file.h @@ -1,29 +1,29 @@ -#ifndef HEADER_FILE_H -#define HEADER_FILE_H 1 +#ifndef FILESYS_FILE_H +#define FILESYS_FILE_H -#include -#include +#include "filesys/off_t.h" -#ifndef OFF_T -#define OFF_T -typedef int32_t off_t; -#endif +struct inode; -struct file - { - struct filehdr *hdr; - off_t pos; - }; - -bool file_open (struct file *, const char *name); -bool file_open_sector (struct file *, disk_sector_no); +/* Opening and closing files. */ +struct file *file_open (struct inode *); +struct file *file_reopen (struct file *); void file_close (struct file *); +struct inode *file_get_inode (struct file *); + +/* Reading and writing. */ off_t file_read (struct file *, void *, off_t); off_t file_read_at (struct file *, void *, off_t size, off_t start); off_t file_write (struct file *, const void *, off_t); off_t file_write_at (struct file *, const void *, off_t size, off_t start); -off_t file_length (struct file *); + +/* Preventing writes. */ +void file_deny_write (struct file *); +void file_allow_write (struct file *); + +/* File position. */ void file_seek (struct file *, off_t); off_t file_tell (struct file *); +off_t file_length (struct file *); -#endif /* file.h */ +#endif /* filesys/file.h */