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

Last change on this file since 202 was 188, checked in by alain, 7 years ago

Redefine the PIC device API.

File size: 6.4 KB
RevLine 
[23]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
[188]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.
[23]33// - There is one "internal_cxy" directory inode per cluster, that is the parent of
[188]34//   the local children inodes associated to the local, internal chdev descriptors.
35//   The parent dentry is stored in cluster_IO.
[23]36// - The I/O cluster contains one "external" directory inode, that is the parent of
[188]37//   the remote children inodes associated to the remote external chdev descriptors.
38//   The parent dentry is stored in cluster_IO.
[23]39//
[188]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//////////////////////////////////////////////////////////////////////////////////////////
[23]46
[188]47/*****************************************************************************************
48 * This structure defines the DEVFS context extension.
49 ****************************************************************************************/
[23]50
[188]51typedef struct devfs_ctx_s
[23]52{
[188]53    xptr_t   root_inode_xp;              /*! extended pointer on DEVFS root inode       */ 
54    xptr_t   external_inode_xp;          /*! extended pointer on DEVFS external inode   */ 
[23]55}
[188]56devfs_ctx_t;
[23]57
58
59/*****************************************************************************************
[188]60 * This fuction allocates memory from local cluster for a DEVFS context descriptor.
[23]61 *****************************************************************************************
[188]62 * @ return a pointer on the created context / return NULL if failure.
[23]63 ****************************************************************************************/
[188]64devfs_ctx_t * devfs_ctx_alloc();
[23]65
66/*****************************************************************************************
[188]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_root_inode_xp     : [out] extended pointer on created <dev> inode.
72 * @ devfs_external_inode_xp : [out] extended pointer on created <external> inode.
[23]73 ****************************************************************************************/
[188]74void devfs_ctx_init( devfs_ctx_t * devfs_ctx,
75                     xptr_t        devfs_root_inode_xp,
76                     xptr_t        devfs_external_inode_xp );
[23]77
78/*****************************************************************************************
[188]79 * This function releases memory dynamically allocated for the DEVFS context.
[23]80 *****************************************************************************************
[188]81 * @ devfs_ctx   : local pointer on DEVFS context.
[23]82 ****************************************************************************************/
[188]83void devfs_ctx_destroy( devfs_ctx_t * devfs_ctx );
[23]84
85/*****************************************************************************************
[188]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>.
[23]91 *****************************************************************************************
[188]92 * @ parent_inode_xp         : extended pointer on the parent VFS inode.
93 * @ devfs_root_inode_xp     : [out] extended pointer on created <dev> inode.
94 * @ devfs_external_inode_xp : [out] extended pointer on created <external> inode.
[23]95 ****************************************************************************************/
[188]96void devfs_global_init( xptr_t   parent_inode_xp,
97                        xptr_t * devfs_root_inode_xp,
98                        xptr_t * devfs_external_inode_xp );
[23]99
100/*****************************************************************************************
[188]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_root_inode_xp     : extended pointer on DEVFS root inode.
111 * @ devfs_external_inode_xp : extended pointer on DEVFS external inode.
[23]112 ****************************************************************************************/
[188]113void devfs_local_init( xptr_t devfs_root_inode_xp,
114                       xptr_t devfs_external_inode_xp );
115                       
[23]116#endif  /* _DEVFS_H_ */
Note: See TracBrowser for help on using the repository browser.