38 lines
1.0 KiB
C
38 lines
1.0 KiB
C
#ifndef FILESYS_FILE_H
|
|
#define FILESYS_FILE_H
|
|
|
|
#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. */
|
|
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);
|
|
|
|
/* 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 *);
|
|
|
|
/* File comparison and hashing */
|
|
bool file_compare (struct file *, struct file *);
|
|
unsigned file_hash (struct file *);
|
|
|
|
#endif /* filesys/file.h */
|