source: trunk/kernel/vfs/devfs.h @ 233

Last change on this file since 233 was 204, checked in by alain, 7 years ago

Bug fix in kernel_init
-This line, and those below, will be ignored--

M params.mk
M kernel_config.h
M Makefile
M hdd/virt_hdd.dmg
M tools/bootloader_tsar/boot.c
M kernel/libk/bits.h
M kernel/libk/elf.c
M kernel/libk/xhtab.c
M kernel/libk/elf.h
M kernel/libk/xhtab.h
M kernel/devices/dev_pic.c
M kernel/mm/vmm.c
M kernel/mm/mapper.c
M kernel/mm/mapper.h
M kernel/vfs/devfs.h
M kernel/vfs/vfs.c
M kernel/vfs/vfs.h
M kernel/vfs/devfs.c
M kernel/kern/chdev.h
M kernel/kern/kernel_init.c
M kernel/kern/process.c
M kernel/kern/process.h
M hal/tsar_mips32/core/hal_remote.c
M hal/tsar_mips32/drivers/soclib_pic.c

File size: 6.5 KB
Line 
1/*
2 * devfs.h - DEVFS File System API definition                               
3 *
4 * Authors       Mohamed Lamine Karaoui (2014,2015)
5 *               Alain Greiner (2016,2017)
6 *
7 * Copyright (c) 2011,2012 UPMC Sorbonne Universites
8 *
9 * This file is part of ALMOS-MKH.
10 *
11 * ALMOS-MKH is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; version 2.0 of the License.
14 *
15 * ALMOS-MKH is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24
25#ifndef _DEVFS_H_
26#define _DEVFS_H_
27
28//////////////////////////////////////////////////////////////////////////////////////////
29// The DEVFS File System contains inodes and dentries associated to all chdev descriptors
30// availables in the architecture. It is structured as a three levels tree structure :
31// - The "dev" directory inode is stored in cluster_IO. It is the root of the DEVFS
32//   file system. The parent inode is the "/" VFS root.
33// - There is one "internal_cxy" directory inode per cluster, that is the parent of
34//   the local children inodes associated to the local, internal chdev descriptors.
35//   The parent dentry is stored in cluster_IO.
36// - The I/O cluster contains one "external" directory inode, that is the parent of
37//   the remote children inodes associated to the remote external chdev descriptors.
38//   The parent dentry is stored in cluster_IO.
39//
40// The DEVFS file system uses the DEVFS context extension to register an extended pointer
41// on the DEVFS "dev" inode, and and another extended pointer on the "external" inode.
42//
43// The DEVFS file system uses the VFS inode extension to store the pointer
44// on the associated chdev descriptor.
45//////////////////////////////////////////////////////////////////////////////////////////
46
47/*****************************************************************************************
48 * This structure defines the DEVFS context extension.
49 ****************************************************************************************/
50
51typedef struct devfs_ctx_s
52{
53    xptr_t   dev_inode_xp;               /*! extended pointer on DEVFS root inode       */ 
54    xptr_t   external_inode_xp;          /*! extended pointer on DEVFS external inode   */ 
55}
56devfs_ctx_t;
57
58
59/*****************************************************************************************
60 * This fuction allocates memory from local cluster for a DEVFS context descriptor.
61 *****************************************************************************************
62 * @ return a pointer on the created context / return NULL if failure.
63 ****************************************************************************************/
64devfs_ctx_t * devfs_ctx_alloc();
65
66/*****************************************************************************************
67 * This function initialises the DEVFS context from arguments values, and link it
68 * to the relevant VFS context in the local cluster.
69 *****************************************************************************************
70 * @ devfs_ctx               : local pointer on DEVFS context.
71 * @ devfs_dev_inode_xp      : [out] extended pointer on  <dev> inode.
72 * @ devfs_external_inode_xp : [out] extended pointer on  <external> inode.
73 ****************************************************************************************/
74void devfs_ctx_init( devfs_ctx_t * devfs_ctx,
75                     xptr_t        devfs_dev_inode_xp,
76                     xptr_t        devfs_external_inode_xp );
77
78/*****************************************************************************************
79 * This function releases memory dynamically allocated for the DEVFS context.
80 *****************************************************************************************
81 * @ devfs_ctx   : local pointer on DEVFS context.
82 ****************************************************************************************/
83void devfs_ctx_destroy( devfs_ctx_t * devfs_ctx );
84
85/*****************************************************************************************
86 * This function start to create the DEVFS subtree.
87 * This function should be called once in the cluster containing the VFS parent inode.
88 * More precisely, it creates in cluster IO the "dev" and "external" DEVFS directories.
89 * For each one, it creates the inode and link the associated dentry to parent inode.
90 * The DEVFS root inode is linked to the VFS parent inode identified by <parent_inode_xp>.
91 *****************************************************************************************
92 * @ parent_inode_xp         : extended pointer on the parent VFS inode.
93 * @ devfs_dev_inode_xp      : [out] extended pointer on created <dev> inode.
94 * @ devfs_external_inode_xp : [out] extended pointer on created <external> inode.
95 ****************************************************************************************/
96void devfs_global_init( xptr_t   parent_inode_xp,
97                        xptr_t * devfs_dev_inode_xp,
98                        xptr_t * devfs_external_inode_xp );
99
100/*****************************************************************************************
101 * This function completes the initialisation of the DEVFS subtree.
102 * It should be called once in each cluster.
103 * 1. In each cluster (i), it creates the "internal" directory,
104 *    linked to the DEVFS "dev" parent directory.
105 * 2. In each cluster (i), it creates - for each external chdev in cluster (i) -
106 *    a pseudo-file, linked to the DEVFS "external" parent directory.
107 * 3. In each cluster (i), it creates - for each internal chdev in cluster (i) -
108 *    a pseudo-file, linked to the DEVFS "internal" parent directory.
109 *****************************************************************************************
110 * @ devfs_dev_inode_xp      : extended pointer on DEVFS root inode.
111 * @ devfs_external_inode_xp : extended pointer on DEVFS external inode.
112 * @ devfs_internal_inode_xp : [out] extended pointer on created <internal> inode.
113 ****************************************************************************************/
114void devfs_local_init( xptr_t   devfs_dev_inode_xp,
115                       xptr_t   devfs_external_inode_xp,
116                       xptr_t * devfs_internal_inode_xp );
117                       
118#endif  /* _DEVFS_H_ */
Note: See TracBrowser for help on using the repository browser.