OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [linux/] [adfs_fs.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
#ifndef _ADFS_FS_H
2
#define _ADFS_FS_H
3
 
4
#include <linux/types.h>
5
/*
6
 * Structures of data on the disk
7
 */
8
 
9
/*
10
 * Disc Record at disc address 0xc00
11
 */
12
struct adfs_discrecord {
13
    unsigned char  log2secsize;
14
    unsigned char  secspertrack;
15
    unsigned char  heads;
16
    unsigned char  density;
17
    unsigned char  idlen;
18
    unsigned char  log2bpmb;
19
    unsigned char  skew;
20
    unsigned char  bootoption;
21
    unsigned char  lowsector;
22
    unsigned char  nzones;
23
    unsigned short zone_spare;
24
    unsigned long  root;
25
    unsigned long  disc_size;
26
    unsigned short disc_id;
27
    unsigned char  disc_name[10];
28
    unsigned long  disc_type;
29
    unsigned long  disc_size_high;
30
    unsigned char  log2sharesize:4;
31
    unsigned char  unused:4;
32
    unsigned char  big_flag:1;
33
};
34
 
35
#define ADFS_DISCRECORD         (0xc00)
36
#define ADFS_DR_OFFSET          (0x1c0)
37
#define ADFS_DR_SIZE             60
38
#define ADFS_SUPER_MAGIC         0xadf5
39
#define ADFS_FREE_FRAG           0
40
#define ADFS_BAD_FRAG            1
41
#define ADFS_ROOT_FRAG           2
42
 
43
/*
44
 * Directory header
45
 */
46
struct adfs_dirheader {
47
        unsigned char startmasseq;
48
        unsigned char startname[4];
49
};
50
 
51
#define ADFS_NEWDIR_SIZE        2048
52
#define ADFS_OLDDIR_SIZE        1024
53
#define ADFS_NUM_DIR_ENTRIES    77
54
 
55
/*
56
 * Directory entries
57
 */
58
struct adfs_direntry {
59
        char dirobname[10];
60
#define ADFS_NAME_LEN 10
61
        __u8 dirload[4];
62
        __u8 direxec[4];
63
        __u8 dirlen[4];
64
        __u8 dirinddiscadd[3];
65
        __u8 newdiratts;
66
#define ADFS_NDA_OWNER_READ     (1 << 0)
67
#define ADFS_NDA_OWNER_WRITE    (1 << 1)
68
#define ADFS_NDA_LOCKED         (1 << 2)
69
#define ADFS_NDA_DIRECTORY      (1 << 3)
70
#define ADFS_NDA_EXECUTE        (1 << 4)
71
#define ADFS_NDA_PUBLIC_READ    (1 << 5)
72
#define ADFS_NDA_PUBLIC_WRITE   (1 << 6)
73
};
74
 
75
#define ADFS_MAX_NAME_LEN       255
76
struct adfs_idir_entry {
77
        __u32           inode_no;                       /* Address              */
78
        __u32           file_id;                        /* file id              */
79
        __u32           name_len;                       /* name length          */
80
        __u32           size;                           /* size                 */
81
        __u32           mtime;                          /* modification time    */
82
        __u32           filetype;                       /* RiscOS file type     */
83
        __u8            mode;                           /* internal mode        */
84
        char            name[ADFS_MAX_NAME_LEN];        /* file name            */
85
};
86
 
87
/*
88
 * Directory tail
89
 */
90
union adfs_dirtail {
91
        struct {
92
                unsigned char dirlastmask;
93
                char dirname[10];
94
                unsigned char dirparent[3];
95
                char dirtitle[19];
96
                unsigned char reserved[14];
97
                unsigned char endmasseq;
98
                unsigned char endname[4];
99
                unsigned char dircheckbyte;
100
        } old;
101
        struct {
102
                unsigned char dirlastmask;
103
                unsigned char reserved[2];
104
                unsigned char dirparent[3];
105
                char dirtitle[19];
106
                char dirname[10];
107
                unsigned char endmasseq;
108
                unsigned char endname[4];
109
                unsigned char dircheckbyte;
110
        } new;
111
};
112
 
113
#ifdef __KERNEL__
114
/*
115
 * Calculate the boot block checksum on an ADFS drive.  Note that this will
116
 * appear to be correct if the sector contains all zeros, so also check that
117
 * the disk size is non-zero!!!
118
 */
119
extern inline int adfs_checkbblk (unsigned char *ptr)
120
{
121
    unsigned int result = 0;
122
    unsigned char *p = ptr + 511;
123
 
124
    do {
125
        result = (result & 0xff) + (result >> 8);
126
        result = result + *--p;
127
    } while (p != ptr);
128
 
129
    return (result & 0xff) != ptr[511];
130
}
131
 
132
/* dir.c */
133
extern unsigned int adfs_val (unsigned char *p, int len);
134
extern int adfs_dir_read_parent (struct inode *inode, struct buffer_head **bhp);
135
extern int adfs_dir_read (struct inode *inode, struct buffer_head **bhp);
136
extern int adfs_dir_check (struct inode *inode, struct buffer_head **bhp,
137
                           int buffers, union adfs_dirtail *dtp);
138
extern void adfs_dir_free (struct buffer_head **bhp, int buffers);
139
extern int adfs_dir_get (struct super_block *sb, struct buffer_head **bhp,
140
                         int buffers, int pos, unsigned long parent_object_id,
141
                         struct adfs_idir_entry *ide);
142
extern int adfs_dir_find_entry (struct super_block *sb, struct buffer_head **bhp,
143
                                int buffers, unsigned int index,
144
                                struct adfs_idir_entry *ide);
145
 
146
/* inode.c */
147
extern int adfs_inode_validate (struct inode *inode);
148
extern unsigned long adfs_inode_generate (unsigned long parent_id, int diridx);
149
extern unsigned long adfs_inode_objid (struct inode *inode);
150
extern unsigned int adfs_parent_bmap (struct inode *inode, int block);
151
extern int adfs_bmap (struct inode *inode, int block);
152
extern void adfs_read_inode (struct inode *inode);
153
 
154
/* map.c */
155
extern int adfs_map_lookup (struct super_block *sb, int frag_id, int offset);
156
 
157
/* namei.c */
158
extern int adfs_lookup (struct inode * dir, const char * name, int len,
159
                        struct inode ** result);
160
 
161
/* super.c */
162
extern int init_adfs_fs (void);
163
extern void adfs_error (struct super_block *, const char *, const char *, ...);
164
 
165
/*
166
 * Inodes and file operations
167
 */
168
 
169
/* dir.c */
170
extern struct inode_operations adfs_dir_inode_operations;
171
 
172
/* file.c */
173
extern struct inode_operations adfs_file_inode_operations;
174
#endif
175
 
176
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.