Subversion Repositories shark

Rev

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

Rev Author Line No. Line
2 pj 1
/*
2
 * Project: S.Ha.R.K.
3
 *
4
 * Coordinators:
5
 *   Giorgio Buttazzo    <giorgio@sssup.it>
6
 *   Paolo Gai           <pj@gandalf.sssup.it>
7
 *
8
 * Authors     :
9
 *   Paolo Gai           <pj@gandalf.sssup.it>
10
 *   Massimiliano Giorgi <massy@gandalf.sssup.it>
11
 *   Luca Abeni          <luca@gandalf.sssup.it>
12
 *   (see the web pages for full authors list)
13
 *
14
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
15
 *
16
 * http://www.sssup.it
17
 * http://retis.sssup.it
18
 * http://shark.sssup.it
19
 */
20
 
21
 
22
/*
23
 * Copyright (C) 1999 Massimiliano Giorgi
24
 *
25
 * This program is free software; you can redistribute it and/or modify
26
 * it under the terms of the GNU General Public License as published by
27
 * the Free Software Foundation; either version 2 of the License, or
28
 * (at your option) any later version.
29
 *
30
 * This program is distributed in the hope that it will be useful,
31
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
33
 * GNU General Public License for more details.
34
 *
35
 * You should have received a copy of the GNU General Public License
36
 * along with this program; if not, write to the Free Software
37
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
38
 *
39
 */
40
 
41
/*
80 pj 42
 * CVS :        $Id: bdev.h,v 1.2 2003-03-13 13:43:13 pj Exp $
2 pj 43
 *
44
 * File:        $File$
80 pj 45
 * Revision:    $Revision: 1.2 $
46
 * Last update: $Date: 2003-03-13 13:43:13 $
2 pj 47
 */
48
 
49
#ifndef __BDEV_H__
50
#define __BDEV_H__
51
 
52
#include "glue.h"
53
#include <fs/bdevinit.h>
54
#include <fs/bdev.h>
1689 fabio 55
#include <arch/sys/cdefs.h>
2 pj 56
 
80 pj 57
__BEGIN_DECLS
58
 
2 pj 59
#define MAXBLOCKDEVICE 8
60
 
61
struct block_device {
62
 
63
#ifdef _PARANOIA
64
  __uint32_t magic;
65
#endif
66
 
67
  char       *bd_name;
68
  int        bd_sectorsize;
69
 
70
  __uint32_t bd_flag_used:1;
71
 
72
  struct block_device_operations *bd_op;
73
};
74
 
75
#define MAXBLOCKDEVICEMINOR 16
76
 
77
struct block_device_minor {
78
 
79
#ifdef _PARANOIA
80
  __uint32_t magic;
81
#endif
82
 
83
  __dev_t              bdm_device;
84
  __uint8_t            bdm_fsind;
85
#define MAXDEVICENAME 16
86
  char                 bdm_name[MAXDEVICENAME+1];
87
};
88
 
89
struct block_device_operations {
90
  int (*_trylock)(__dev_t device);
91
  int (*_tryunlock)(__dev_t device);
92
  int (*read)(__dev_t device, __blkcnt_t blocknum, __uint8_t *buffer);
93
  int (*seek)(__dev_t device, __blkcnt_t blocknum);
94
  int (*write)(__dev_t device, __blkcnt_t blocknum, __uint8_t *buffer);
95
};
96
 
97
#define TRYLOCK_OK     BDEV_OK
98
#define TRYLOCK_CANT   BDEV_FAIL
99
#define TRYLOCK_ERR    BDEV_ERROR
100
#define TRYUNLOCK_OK   TRYLOCK_OK 
101
#define TRYUNLOCK_CANT TRYLOCK_CANT
102
#define TRYUNLOCK_ERR  TRYLOCK_ERR
103
 
104
int bdev_register(__dev_t major,char *name,struct block_device *);
105
int bdev_register_minor(__dev_t device, char *name,__uint8_t fsind);
106
 
107
int bdev_read(__dev_t dev, __blkcnt_t blocknum, __uint8_t *buffer);
108
int bdev_seek(__dev_t dev, __blkcnt_t blocknum);
109
int bdev_write(__dev_t dev, __blkcnt_t blocknum, __uint8_t *buffer);
110
 
80 pj 111
__END_DECLS
2 pj 112
#endif