source: trunk/kernel/syscalls/shared_include/shared_dirent.h @ 653

Last change on this file since 653 was 611, checked in by alain, 6 years ago

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

File size: 3.1 KB
Line 
1/*
2 * shared_dirent.h - Shared structure used by the opendir() / readdir() / closedir() syscalls.
3 *
4 * Author  Alain Greiner (2016,2017,2018)
5 *
6 * Copyright (c) UPMC Sorbonne Universites
7 *
8 * This file is part of ALMOS-MKH.
9 *
10 * ALMOS-MKH is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; version 2.0 of the License.
13 *
14 * ALMOS-MKH is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#ifndef _SHARED_DIRENT_H_
25#define _SHARED_DIRENT_H_
26
27/*******************************************************************************************
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.
32 ******************************************************************************************/
33
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 ******************************************************************************************/
59
60struct dirent
61{
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))];
66};
67
68#endif
Note: See TracBrowser for help on using the repository browser.