Ignore:
Timestamp:
Jan 9, 2019, 3:02:51 PM (5 years ago)
Author:
alain
Message:

Introduce sigificant modifs in VFS to support the <ls> command,
and the . and .. directories entries.

Location:
trunk/kernel/syscalls/shared_include
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/syscalls/shared_include/shared_almos.h

    r580 r611  
    5252    DISPLAY_DQDT              = 7,
    5353    DISPLAY_BUSYLOCKS         = 8,
     54    DISPLAY_MAPPER            = 9,
    5455}
    5556display_type_t;
  • trunk/kernel/syscalls/shared_include/shared_dirent.h

    r445 r611  
    2626
    2727/*******************************************************************************************
    28  * These two structure defines the informations returned to user by the opendir()
    29  * function, used by the readdir() function, and released by the closedir() function.
    30  * - "DIR" describes the complete directory.
    31  * - "dirent" describes one directory entry.
     28 * This enum defines the possible types for a dirent inode in a dirent structure.
     29 *
     30 * WARNING : these types must be kept consistent with inode types in <vfs.h> file.
     31 *           and with types in <shared_stat.h> file.
    3232 ******************************************************************************************/
    3333
    34 #define DIRENT_NAME_MAX_LENGTH  56
    35 #define DIRENT_MAX_NUMBER       63
     34typedef enum
     35{
     36    DT_REG     = 0,                     /*! regular file                                  */
     37    DT_DIR     = 1,                     /*! directory                                     */
     38    DT_FIFO    = 2,                     /*! named pipe (FIFO)                             */
     39    DT_PIPE    = 3,                     /*! anonymous pipe                                */
     40    DT_SOCK    = 4,                     /*! socket                                        */
     41    DT_CHR     = 5,                     /*! character device                              */
     42    DT_BLK     = 6,                     /*! block device                                  */
     43    DT_LNK     = 7,                     /*! symbolic link                                 */
     44    DT_UNKNOWN = 8,                     /*! undetermined type                             */
     45}
     46dirent_type_t;
     47
     48/*******************************************************************************************
     49 * This defines the actual ALMOS-MKH implementation of the DIR user type.
     50 ******************************************************************************************/
     51
     52typedef unsigned int   DIR;
     53
     54/*******************************************************************************************
     55 * This structure defines the informations returned to user by the readdir() syscall.
     56 *
     57 * WARNING: sizeof(dirent) must be 64 bytes.
     58 ******************************************************************************************/
    3659
    3760struct dirent
    3861{
    39     unsigned int   inum;                                /*! inode identifier              */
    40     unsigned int   type;                                /*! inode type                    */
    41     char           name[DIRENT_NAME_MAX_LENGTH];        /*! directory entry name          */
     62    int           d_ino;                                  /*! inode identifier            */
     63    int           d_type;                                 /*! inode type                  */
     64    char          d_name[48];                             /*! dentry name                 */
     65    char          padding[64 - 48 - (2*sizeof(int))];
    4266};
    4367
    44 typedef struct user_directory
    45 {
    46     struct dirent   entry[DIRENT_MAX_NUMBER];
    47     unsigned int    current;
    48 }
    49 DIR;
    50 
    5168#endif
  • trunk/kernel/syscalls/shared_include/shared_stat.h

    r594 r611  
    3030 *****************************************************************************************/
    3131
    32 typedef struct stat
     32struct stat
    3333{
    3434        unsigned int    st_dev;     /*! ID of device containing file                         */
     
    4242        unsigned int    st_blksize; /*! blocksize for file system I/O                        */
    4343        unsigned int    st_blocks;  /*! number of allocated blocks                           */
    44 }
    45 stat_t;
     44};
    4645
    4746/******************************************************************************************
     
    5251 *
    5352 * WARNING : these macros must be kept consistent with inode types in <vfs.h> file.
     53 *           and with types in <dirent.h> file.
    5454 *****************************************************************************************/
    5555
     
    6060#define  S_ISSOCK(x)  ((((x)>>16) & 0xF) == 4)    /*! it is a socket                     */
    6161#define  S_ISCHR(x)   ((((x)>>16) & 0xF) == 5)    /*! it is a character device           */
    62 #define  S_ISLNK(x)   ((((x)>>16) & 0xF) == 6)    /*! it is a symbolic link              */
     62#define  S_ISBLK(x)   ((((x)>>16) & 0xF) == 6)    /*! it is a block device               */
     63#define  S_ISLNK(x)   ((((x)>>16) & 0xF) == 7)    /*! it is a symbolic link              */
    6364
    6465#endif /* _STAT_H_ */
Note: See TracChangeset for help on using the changeset viewer.