Main Page | Directories | File List | Globals

pseudo_vfs.c File Reference

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

Include dependency graph for pseudo_vfs.c:

Go to the source code of this file.

Defines

#define MOD_NAME   "VFS: "

Functions

int do_sys_open (char *filename, int flag, int mode)
int do_sys_read (int fd, char *buf, int count)
int do_sys_write (int fd, char *buf, int count)
int do_sys_lseek (int fd, int offset, int whence)
int do_sys_close (int fd)


Define Documentation

#define MOD_NAME   "VFS: "
 

Definition at line 25 of file pseudo_vfs.c.


Function Documentation

int do_sys_close int  fd  ) 
 

Definition at line 92 of file pseudo_vfs.c.

00093 {
00094     return 0;
00095 }

int do_sys_lseek int  fd,
int  offset,
int  whence
 

Definition at line 87 of file pseudo_vfs.c.

00088 {
00089     return 0;
00090 }

int do_sys_open char *  filename,
int  flag,
int  mode
 

Definition at line 27 of file pseudo_vfs.c.

References adi_chrdev_find_by_name(), fd, file_create(), file_destroy(), file_install_fd(), and printk().

Referenced by SYS_CALL().

00028 {
00029     struct adi_chrdev_s *dev;    
00030     struct file_s *file;
00031     int ret;
00032     int fd;
00033 
00034     if ((dev = adi_chrdev_find_by_name(filename))) {
00035         file = file_create();
00036         file->file_ops  = dev->file_ops;
00037         file->file_data = (void *)DEV_MINOR(dev);
00038 
00039         if (file->file_ops && file->file_ops->open) {
00040                 if ((ret = file->file_ops->open(file, flag, mode)) < 0) {
00041                     file_destroy(file);
00042                     return ret;
00043             }
00044         } else {
00045             printk("no open function %08x %08x %08x\n", file->file_ops, file->file_ops->open, dev->file_ops);
00046 
00047             return -1;
00048         }
00049         
00050         if ((fd = file_install_fd(file)) < 0) {
00051             file_destroy(file);
00052             return -1;    
00053         }
00054         
00055         return fd;
00056     } 
00057 
00058     return -1;
00059 }

Here is the call graph for this function:

int do_sys_read int  fd,
char *  buf,
int  count
 

Definition at line 61 of file pseudo_vfs.c.

Referenced by SYS_CALL().

00062 {
00063     struct file_s *file;
00064     
00065     file = current_task->files->file[fd];
00066 
00067     if (file->file_ops && file->file_ops->read) {
00068         return file->file_ops->read(file, buf, count);
00069     }
00070     
00071     return -1;
00072 }

int do_sys_write int  fd,
char *  buf,
int  count
 

Definition at line 74 of file pseudo_vfs.c.

Referenced by SYS_CALL().

00075 {
00076     struct file_s *file;
00077     
00078     file = current_task->files->file[fd];
00079 
00080     if (file->file_ops && file->file_ops->write) {
00081         return file->file_ops->write(file, buf, count);
00082     }
00083 
00084     return -1;
00085 }

Dokumentacje wygenerowano programem Doxygen 1.4.2 dla projektu Agnix