Ignore:
Timestamp:
Jun 18, 2017, 10:06:41 PM (5 years ago)
Author:
alain
Message:

Introduce syscalls.

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/kernel/vfs/ramfs.h

    r15 r23  
    22 * ramfs.h  RAMFS file system API definition.
    33 *
    4  * Authors   Mohamed Lamine Karaoui (2015)
    5  *           Alain Greiner (2016)
     4 * Authors   Mohamed Lamine Karaoui (2014,2015)
     5 *           Alain Greiner (2016,2017)
    66 *
    77 * Copyright (c) UPMC Sorbonne Universites
     
    2626#define _RAMFS_H_
    2727
     28///////////////////////////////////////////////////////////////////////////////////////////
     29// The RAMFS File System Rdoes not uses any external device to store data.
     30// It stores the dynamically created files and directories in the VFS mappers.
     31// The ramfs_read_page() and ramfs_write_page() functions should never be used.
     32// The RAMFS cannot be used as the root FS.
     33// There is no RAMFS context extension, and no RAMFS inode extension.
     34///////////////////////////////////////////////////////////////////////////////////////////
     35
     36
    2837/****  Forward declarations  ****/
    2938
    30 struct vfs_inode_s;
    31 struct page_s;
     39
     40//////////////////////////////////////////////////////////////////////////////////////////
     41// These functions are called by the VFS, and must be implemented by all FS.
     42//////////////////////////////////////////////////////////////////////////////////////////
     43
     44/******************************************************************************************
     45 * This function does not exist, as the RAMFS cannot be the root FS.
     46 *****************************************************************************************/
     47xptr_t ramfs_init();
     48
     49/******************************************************************************************
     50 * This function mount a RAMFS on a given inode of the root FS.
     51 * It actually creates a new VFS dentry in the cluster containing the parent inode,
     52 * and create a new VFS inode in another cluster.
     53 ******************************************************************************************
     54 * @ parent_inode_xp : extended pointer on the parent inode.
     55 * @ ramfs_root_name : RAMFS root directory name.
     56 *****************************************************************************************/
     57error_t ramfs_mount( xptr_t   parent_inode_xp,
     58                     char   * ramfs_root_name );
    3259
    3360/*****************************************************************************************
    34  * This structure defines a RAMFS specific context extension.
     61 * This function initializes all fields of the VFS context.
     62 * No extra memory is allocated for a RAMFS context.
    3563 ****************************************************************************************/
    36 
    37 typedef struct ramfs_ctx_s
    38 {
    39     intptr_t          base;                                                                 
    40     rwlock_t          size;
    41 }
    42 ramfs_ctx_t;
     64error_t ramfs_ctx_init( struct vfs_ctx_s * vfs_ctx,
     65                        xptr_t             root_inode_xp );
    4366
    4467/*****************************************************************************************
    45  * This structure defines the RAMFS inode specific extension (versus the VFS inode).
     68 * This function does not exist for a RAMFS context, as there is no RAMFS context.
    4669 ****************************************************************************************/
    47 
    48 typedef struct ramfs_inode_s
    49 {
    50     struct vfs_inode_s * vfs_inode;   /*! local pointer on VFS inode                    */
    51 }
    52 ramfs_inode_t;
    53 
    54 
    55 
     70error_t ramfs_ctx_destroy();
    5671
    5772/*****************************************************************************************
    58  * This function allocates memory for a RAMFS inode, and link it to the VFS inode.
    59  *****************************************************************************************
    60  * @ inode   : local pointer on vfs_inode.
    61  * @ return 0 if success / return ENOMEM if error.
     73 * This function does not exist, as the RAMFS does not use a RAMFS inode extension.
    6274 ****************************************************************************************/
    6375error_t ramfs_inode_create( struct vfs_inode_s * inode );
    6476
    6577/*****************************************************************************************
    66  * This function releases memory allocated for a RAMFS inode.
    67  *****************************************************************************************
    68  * @ inode   : local pointer on vfs_inode.
     78 * This function does not exist, as the RAMFS does not use a RAMFS inode extension.
    6979 ****************************************************************************************/
    7080void ramfs_inode_destroy( struct vfs_inode_s * inode );
    7181
    7282/*****************************************************************************************
    73  * This function moves a page from the mapper to the RAMFS file system.
    74  * It must be called by a thread running in cluster containing the mapper.
    75  * The pointer on the mapper and the page index in file are supposed to be registered
    76  * in the page descriptor.
    77 ******************************************************************************************
    78  * @ page    : local pointer on source page descriptor.
    79  * @ return 0 if success / return EIO if error.
     83 * This function does nothing for the RAMFS File System.
    8084 ****************************************************************************************/
    81 error_t ramfs_write_page( struct page_s  * page );
     85error_t ramfs_write_page( struct page_s * page );
    8286
    8387/*****************************************************************************************
    84  * This function moves a page from the RAMFS file system to the mapper.
    85  * It must be called by a thread running in cluster containing the mapper.
    86  * The pointer on the mapper and the page index in file are supposed to be registered
    87  * in the page descriptor.
    88  *****************************************************************************************
    89  * @ page    : local pointer on destination page descriptor.
    90  * @ return 0 if success / return EIO if error.
     88 * This function does not exist for the RAMFS File System.
    9189 ****************************************************************************************/
    92 error_t ramfs_read_page( struct page_s  * page );
     90error_t ramfs_read_page( struct page_s * page );
    9391
    9492
    95    
    9693#endif  /* _RAMFS_H_ */
Note: See TracChangeset for help on using the changeset viewer.