Main Page | Directories | File List | Globals

file.c File Reference

#include <agnix/agnix.h>
#include <agnix/fs.h>
#include <agnix/terminal.h>
#include <agnix/memory.h>
#include <agnix/console.h>

Include dependency graph for file.c:

Go to the source code of this file.

Defines

#define MOD_NAME   "VFS: "

Functions

int file_install_fd (struct file_s *file)
file_s * file_create (void)
void file_destroy (struct file_s *file)
file_s ** file_table_create (void)
files_s * files_create (void)
files_s * files_copy (struct files_s *cur_files)
int files_fork (struct task_s *cur_task, struct task_s *new_task)


Define Documentation

#define MOD_NAME   "VFS: "
 

Definition at line 20 of file file.c.


Function Documentation

struct file_s* file_create void   ) 
 

Definition at line 37 of file file.c.

References get_free_pages().

Referenced by do_sys_open().

00038 {
00039     struct file_s *file;
00040     
00041     file = (struct file_s *)get_free_pages(0);
00042     
00043     return file;
00044 }

Here is the call graph for this function:

void file_destroy struct file_s *  file  ) 
 

Definition at line 46 of file file.c.

References put_free_pages().

Referenced by do_sys_open().

00047 {
00048     put_free_pages((u32)file, 0);
00049 }

Here is the call graph for this function:

int file_install_fd struct file_s *  file  ) 
 

Definition at line 22 of file file.c.

References fd, and get_free_resource().

Referenced by do_sys_open().

00023 {
00024     int fd;
00025     
00026     if ((fd = get_free_resource(current_task->files->fd_resource_desc)) < 0)
00027         return -1;
00028 
00029     if (fd > MAX_FILES)
00030         return -1;
00031 
00032     current_task->files->file[fd] = file;
00033     
00034     return fd;
00035 }

Here is the call graph for this function:

struct file_s** file_table_create void   ) 
 

Definition at line 51 of file file.c.

References get_free_pages().

Referenced by files_create().

00052 {
00053     struct file_s **file;
00054     
00055     file = (struct file_s **)get_free_pages(0);
00056     
00057     return file;
00058 }

Here is the call graph for this function:

struct files_s* files_copy struct files_s *  cur_files  ) 
 

Definition at line 76 of file file.c.

References files_create(), and memcpy().

Referenced by files_fork().

00077 {
00078     struct files_s *files;
00079     
00080     files = files_create();
00081     
00082     memcpy(files->fd, cur_files->fd, FILES_BITMAP_LEN);
00083 
00084     return files;
00085 }

Here is the call graph for this function:

struct files_s* files_create void   ) 
 

Definition at line 60 of file file.c.

References file_table_create(), get_free_pages(), and register_resource().

Referenced by files_copy(), and files_fork().

00061 {
00062     struct files_s *files;
00063 
00064     files = (struct files_s *)get_free_pages(0);
00065 
00066     files->fd_resource.resource_name   = "fds";
00067     files->fd_resource.resource_bitmap = files->fd;
00068     files->fd_resource.resource_len    = FILES_BITMAP_LEN;
00069     files->file                        = file_table_create();
00070     
00071     files->fd_resource_desc = register_resource(&files->fd_resource);
00072 
00073     return files;
00074 }

Here is the call graph for this function:

int files_fork struct task_s *  cur_task,
struct task_s *  new_task
 

Definition at line 87 of file file.c.

References files_copy(), and files_create().

Referenced by do_sys_fork().

00088 {
00089     if (cur_task->files == NULL) {
00090         new_task->files = files_create();
00091     } else {
00092         new_task->files = files_copy(cur_task->files);
00093     }
00094     
00095     return 0;
00096 }

Here is the call graph for this function:

Dokumentacje wygenerowano programem Doxygen 1.4.2 dla projektu Agnix