Subversion Repositories shark

Rev

Rev 3 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
/*
2
 * Project: HARTIK (HA-rd R-eal TI-me K-ernel)
3
 *
4
 * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
5
 *               Gerardo Lamastra <gerardo@sssup.it>
6
 *
7
 * Authors     : Massimiliano Giorgi <massy@hartik.sssup.it>
8
 * (see authors.txt for full list of hartik's authors)
9
 *
10
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
11
 *
12
 * http://www.sssup.it
13
 * http://retis.sssup.it
14
 * http://hartik.sssup.it
15
 */
16
 
17
/*
18
 * Copyright (C) 1999 Massimiliano Giorgi
19
 *
20
 * This program is free software; you can redistribute it and/or modify
21
 * it under the terms of the GNU General Public License as published by
22
 * the Free Software Foundation; either version 2 of the License, or
23
 * (at your option) any later version.
24
 *
25
 * This program is distributed in the hope that it will be useful,
26
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28
 * GNU General Public License for more details.
29
 *
30
 * You should have received a copy of the GNU General Public License
31
 * along with this program; if not, write to the Free Software
32
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
33
 *
34
 */
35
 
36
/*
37
 * CVS :        $Id: devfs_s.c,v 1.1.1.1 2002-03-29 14:12:50 pj Exp $
38
 *
39
 * File:        $File$
40
 * Revision:    $Revision: 1.1.1.1 $
41
 * Last update: $Date: 2002-03-29 14:12:50 $
42
 */
43
 
44
#include <fs/util.h>
45
#include <fs/types.h>
46
#include <fs/stat.h>
47
#include <fs/fsinit.h>
48
#include <fs/fsind.h>
49
 
50
#include "dcache.h"
51
#include "fs.h"
52
 
53
static struct super_block *devfs_read_super(__dev_t dev, __uint8_t fs_ind);
54
 
55
static struct file_system_type devfs=
56
  {"devfs",0,FS_MSDOS,devfs_read_super};
57
 
58
int devfs_fs_init(FILESYSTEM_PARMS *ptr)
59
{
60
  filesystem_register(&devfs);
61
  return 0;
62
}
63
 
64
 
65
/*-----------------------------------------*/
66
 
67
/*
68
 *
69
 * Super operations
70
 *
71
 */
72
 
73
static int devfs_read_inode(struct inode *in);
74
static int devfsrite_inode(struct inode *in);
75
 
76
static struct super_operations devfs_super_operations={
77
  devfs_read_inode,
78
  devfs_write_inode
79
};
80
 
81
static int msdos_read_inode(struct inode *in)
82
{
83
  struct directoryentry *den;
84
  dcache_t *ptr;
85
  __uint16_t  cluster;
86
  __uint32_t lsector;
87
  __uint16_t  deoffs,offs;
88
 
89
  /*i_sb gia' messo*/
90
  /*i_ino gia' messo*/
91
 
92
  den=(struct directoryentry *)(ptr->buffer)+offs;
93
 
94
  in->i_dev=in->i_sb->sb_dev;
95
  in->i_mode=__S_IRWXO|__S_IRWXG|__S_IRWXU;
96
  in->i_mode|=__S_IFREG);
97
  in->i_nlink=1;
98
  in->i_uid=0;
99
  in->i_gid=0;
100
  in->i_rdev=0;
101
  in->i_size=den->size;  
102
  in->i_atime=in->i_mtime=in->i_ctime=0;
103
  in->i_op=&devfs_inode_operations;
104
 
105
  return 0;
106
}
107
 
108
static int msdos_write_inode(struct inode *in)
109
{
110
  return -1;
111
}
112
 
113
/*
114
 *
115
 * Mount operation
116
 *
117
 */
118
 
119
static struct super_block *devfs_read_super(__dev_t dev, __uint8_t fs_ind)
120
{
121
  struct inode       *in;
122
  struct bootrecord  *br;
123
  struct super_block *sb;
124
  dcache_t           *dc;
125
  int                res;
126
 
127
  sb=super_getblock();
128
  if (sb==NULL) {
129
    dcache_unlock(dc);
130
    return NULL;
131
  }
132
 
133
  sb->sb_dev=dev;
134
  //sb->sb_op=&devfs_super_operations;
135
  //sb->sb_dop=&devfs_dentry_operations;
136
 
137
  in=inode_get();
138
  if (in==NULL) {
139
    super_freeblock(sb);
140
    return NULL;    
141
  }
142
 
143
  sb->sb_root=in;
144
  in->i_sb=sb;
145
  in->i_ino=0; /* ??? */
146
 
147
  return sb;
148
}