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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [linux/] [fs.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
#ifndef _LINUX_FS_H
2
#define _LINUX_FS_H
3
 
4
/*
5
 * This file has definitions for some important file table
6
 * structures etc.
7
 */
8
 
9
#include <linux/config.h>
10
#include <linux/linkage.h>
11
#include <linux/limits.h>
12
#include <linux/wait.h>
13
#include <linux/types.h>
14
#include <linux/vfs.h>
15
#include <linux/net.h>
16
#include <linux/kdev_t.h>
17
#include <linux/ioctl.h>
18
 
19
/*
20
 * It's silly to have NR_OPEN bigger than NR_FILE, but I'll fix
21
 * that later. Anyway, now the file code is no longer dependent
22
 * on bitmaps in unsigned longs, but uses the new fd_set structure..
23
 *
24
 * Some programs (notably those using select()) may have to be
25
 * recompiled to take full advantage of the new limits..
26
 */
27
 
28
/* Fixed constants first: */
29
#undef NR_OPEN
30
 
31
#ifdef CONFIG_REDUCED_MEMORY
32
/* Originally 256: 116 would be neat because a files_struct becomes exactly 500 bytes,
33
   a relatively cool figure for kmalloc, but problems reducing fd_select made this not worth it.
34
   Currently 128. */
35
#define NR_OPEN 128 /*256*/
36
 
37
#define NR_SUPER 8 /*64*/
38
 
39
#else /* !CONFIG_REDUCED_MEMORY */
40
 
41
#define NR_OPEN 256
42
 
43
#define NR_SUPER 64
44
#endif /* !CONFIG_REDUCED_MEMORY */
45
#define BLOCK_SIZE 1024
46
#define BLOCK_SIZE_BITS 10
47
 
48
/* And dynamically-tunable limits and defaults: */
49
extern int max_inodes, nr_inodes;
50
extern int max_files, nr_files;
51
 
52
#ifdef CONFIG_REDUCED_MEMORY
53
#define NR_INODE 200/*64*/ /*3072*/
54
#define NR_FILE 128/*116*/ /*1024*/
55
#else /* !CONFIG_REDUCED_MEMORY */
56
#define NR_INODE 3072   /* this should be bigger than NR_FILE */
57
#define NR_FILE 1024    /* this can well be larger on a larger system */
58
#endif /* !CONFIG_REDUCED_MEMORY */
59
 
60
#define MAY_EXEC 1
61
#define MAY_WRITE 2
62
#define MAY_READ 4
63
 
64
#define FMODE_READ 1
65
#define FMODE_WRITE 2
66
 
67
#define READ 0
68
#define WRITE 1
69
#define READA 2         /* read-ahead  - don't block if no resources */
70
#define WRITEA 3        /* write-ahead - don't block if no resources */
71
 
72
#ifndef NULL
73
#define NULL ((void *) 0)
74
#endif
75
 
76
#define NIL_FILP        ((struct file *)0)
77
#define SEL_IN          1
78
#define SEL_OUT         2
79
#define SEL_EX          4
80
 
81
/*
82
 * These are the fs-independent mount-flags: up to 16 flags are supported
83
 */
84
#define MS_RDONLY        1      /* Mount read-only */
85
#define MS_NOSUID        2      /* Ignore suid and sgid bits */
86
#define MS_NODEV         4      /* Disallow access to device special files */
87
#define MS_NOEXEC        8      /* Disallow program execution */
88
#define MS_SYNCHRONOUS  16      /* Writes are synced at once */
89
#define MS_REMOUNT      32      /* Alter flags of a mounted FS */
90
#define MS_MANDLOCK     64      /* Allow mandatory locks on an FS */
91
#define S_WRITE         128     /* Write on file/directory/symlink */
92
#define S_APPEND        256     /* Append-only file */
93
#define S_IMMUTABLE     512     /* Immutable file */
94
#define MS_NOATIME      1024    /* Do not update access times. */
95
#define S_BAD_INODE     2048    /* Marker for unreadable inodes */
96
#define S_ZERO_WR       4096    /* Device accepts 0 length writes */
97
 
98
/*
99
 * Flags that can be altered by MS_REMOUNT
100
 */
101
#define MS_RMT_MASK (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME)
102
 
103
/*
104
 * Magic mount flag number. Has to be or-ed to the flag values.
105
 */
106
#define MS_MGC_VAL 0xC0ED0000   /* magic flag number to indicate "new" flags */
107
#define MS_MGC_MSK 0xffff0000   /* magic flag number mask */
108
 
109
/*
110
 * Note that read-only etc flags are inode-specific: setting some file-system
111
 * flags just means all the inodes inherit those flags by default. It might be
112
 * possible to override it selectively if you really wanted to with some
113
 * ioctl() that is not currently implemented.
114
 *
115
 * Exception: MS_RDONLY is always applied to the entire file system.
116
 */
117
#define IS_RDONLY(inode) (((inode)->i_sb) && ((inode)->i_sb->s_flags & MS_RDONLY))
118
#define IS_NOSUID(inode) ((inode)->i_flags & MS_NOSUID)
119
#define IS_NODEV(inode) ((inode)->i_flags & MS_NODEV)
120
#define IS_NOEXEC(inode) ((inode)->i_flags & MS_NOEXEC)
121
#define IS_SYNC(inode) ((inode)->i_flags & MS_SYNCHRONOUS)
122
#define IS_MANDLOCK(inode) ((inode)->i_flags & MS_MANDLOCK)
123
 
124
#define IS_WRITABLE(inode) ((inode)->i_flags & S_WRITE)
125
#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
126
#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
127
#define IS_NOATIME(inode) ((inode)->i_flags & MS_NOATIME)
128
#define        IS_ZERO_WR(inode) ((inode)->i_flags & S_ZERO_WR)
129
 
130
#define UPDATE_ATIME(inode) \
131
        if (!IS_NOATIME(inode) && !IS_RDONLY(inode)) { \
132
                inode->i_atime = CURRENT_TIME; \
133
                inode->i_dirt = 1; \
134
        }
135
 
136
/* the read-only stuff doesn't really belong here, but any other place is
137
   probably as bad and I don't want to create yet another include file. */
138
 
139
#define BLKROSET   _IO(0x12,93) /* set device read-only (0 = read-write) */
140
#define BLKROGET   _IO(0x12,94) /* get read-only status (0 = read_write) */
141
#define BLKRRPART  _IO(0x12,95) /* re-read partition table */
142
#define BLKGETSIZE _IO(0x12,96) /* return device size */
143
#define BLKFLSBUF  _IO(0x12,97) /* flush buffer cache */
144
#define BLKRASET   _IO(0x12,98) /* Set read ahead for block device */
145
#define BLKRAGET   _IO(0x12,99) /* get current read ahead setting */
146
 
147
#define BMAP_IOCTL 1            /* obsolete - kept for compatibility */
148
#define FIBMAP     _IO(0x00,1)  /* bmap access */
149
#define FIGETBSZ   _IO(0x00,2)  /* get the block size used for bmap */
150
 
151
#ifdef __KERNEL__
152
 
153
#include <asm/semaphore.h>
154
#include <asm/bitops.h>
155
 
156
extern void buffer_init(void);
157
extern unsigned long inode_init(unsigned long start, unsigned long end);
158
extern unsigned long file_table_init(unsigned long start, unsigned long end);
159
extern unsigned long name_cache_init(unsigned long start, unsigned long end);
160
 
161
typedef char buffer_block[BLOCK_SIZE];
162
 
163
/* bh state bits */
164
#define BH_Uptodate             0        /* 1 if the buffer contains valid data */
165
#define BH_Dirty                1       /* 1 if the buffer is dirty */
166
#define BH_Lock                 2       /* 1 if the buffer is locked */
167
#define BH_Req                  3       /* 0 if the buffer has been invalidated */
168
#define BH_Touched              4       /* 1 if the buffer has been touched (aging) */
169
#define BH_Has_aged             5       /* 1 if the buffer has been aged (aging) */
170
#define BH_Protected            6       /* 1 if the buffer is protected */
171
#define BH_FreeOnIO             7       /* 1 to discard the buffer_head after IO */
172
#define BH_MD                   8       /* 1 if the buffer is an MD request */
173
 
174
/*
175
 * Try to keep the most commonly used fields in single cache lines (16
176
 * bytes) to improve performance.  This ordering should be
177
 * particularly beneficial on 32-bit processors.
178
 *
179
 * We use the first 16 bytes for the data which is used in searches
180
 * over the block hash lists (ie. getblk(), find_buffer() and
181
 * friends).
182
 *
183
 * The second 16 bytes we use for lru buffer scans, as used by
184
 * sync_buffers() and refill_freelist().  -- sct
185
 */
186
struct buffer_head {
187
        /* First cache line: */
188
        unsigned long b_blocknr;        /* block number */
189
        kdev_t b_dev;                   /* device (B_FREE = free) */
190
        kdev_t b_rdev;                  /* Real device */
191
        unsigned long b_rsector;        /* Real buffer location on disk */
192
        struct buffer_head * b_next;    /* Hash queue list */
193
        struct buffer_head * b_this_page;       /* circular list of buffers in one page */
194
 
195
        /* Second cache line: */
196
        unsigned long b_state;          /* buffer state bitmap (see above) */
197
        struct buffer_head * b_next_free;
198
        unsigned int b_count;           /* users using this block */
199
        unsigned long b_size;           /* block size */
200
 
201
        /* Non-performance-critical data follows. */
202
        char * b_data;                  /* pointer to data block (1024 bytes) */
203
        unsigned int b_list;            /* List that this buffer appears */
204
        unsigned long b_flushtime;      /* Time when this (dirty) buffer
205
                                         * should be written */
206
        unsigned long b_lru_time;       /* Time when this buffer was
207
                                         * last used. */
208
        struct wait_queue * b_wait;
209
        struct buffer_head * b_prev;            /* doubly linked list of hash-queue */
210
        struct buffer_head * b_prev_free;       /* doubly linked list of buffers */
211
        struct buffer_head * b_reqnext;         /* request queue */
212
 
213
/*
214
 * Some MD stuff like RAID5 needs special event handlers and
215
 * special private buffer_head fields:
216
 */
217
        void * personality;
218
        void * private_bh;
219
};
220
 
221
static inline int buffer_uptodate(struct buffer_head * bh)
222
{
223
        return test_bit(BH_Uptodate, &bh->b_state);
224
}
225
 
226
static inline int buffer_dirty(struct buffer_head * bh)
227
{
228
        return test_bit(BH_Dirty, &bh->b_state);
229
}
230
 
231
static inline int buffer_locked(struct buffer_head * bh)
232
{
233
        return test_bit(BH_Lock, &bh->b_state);
234
}
235
 
236
static inline int buffer_req(struct buffer_head * bh)
237
{
238
        return test_bit(BH_Req, &bh->b_state);
239
}
240
 
241
static inline int buffer_touched(struct buffer_head * bh)
242
{
243
        return test_bit(BH_Touched, &bh->b_state);
244
}
245
 
246
static inline int buffer_has_aged(struct buffer_head * bh)
247
{
248
        return test_bit(BH_Has_aged, &bh->b_state);
249
}
250
 
251
static inline int buffer_protected(struct buffer_head * bh)
252
{
253
        return test_bit(BH_Protected, &bh->b_state);
254
}
255
 
256
#include <linux/pipe_fs_i.h>
257
#include <linux/minix_fs_i.h>
258
#include <linux/ext_fs_i.h>
259
#include <linux/ext2_fs_i.h>
260
#include <linux/hpfs_fs_i.h>
261
#include <linux/msdos_fs_i.h>
262
#include <linux/umsdos_fs_i.h>
263
#include <linux/iso_fs_i.h>
264
#include <linux/nfs_fs_i.h>
265
#include <linux/xia_fs_i.h>
266
#include <linux/sysv_fs_i.h>
267
#include <linux/affs_fs_i.h>
268
#include <linux/ufs_fs_i.h>
269
#include <linux/romfs_fs_i.h>
270
 
271
/*
272
 * Attribute flags.  These should be or-ed together to figure out what
273
 * has been changed!
274
 */
275
#define ATTR_MODE       1
276
#define ATTR_UID        2
277
#define ATTR_GID        4
278
#define ATTR_SIZE       8
279
#define ATTR_ATIME      16
280
#define ATTR_MTIME      32
281
#define ATTR_CTIME      64
282
#define ATTR_ATIME_SET  128
283
#define ATTR_MTIME_SET  256
284
#define ATTR_FORCE      512     /* Not a change, but a change it */
285
 
286
/*
287
 * This is the Inode Attributes structure, used for notify_change().  It
288
 * uses the above definitions as flags, to know which values have changed.
289
 * Also, in this manner, a Filesystem can look at only the values it cares
290
 * about.  Basically, these are the attributes that the VFS layer can
291
 * request to change from the FS layer.
292
 *
293
 * Derek Atkins <warlord@MIT.EDU> 94-10-20
294
 */
295
struct iattr {
296
        unsigned int    ia_valid;
297
        umode_t         ia_mode;
298
        uid_t           ia_uid;
299
        gid_t           ia_gid;
300
        off_t           ia_size;
301
        time_t          ia_atime;
302
        time_t          ia_mtime;
303
        time_t          ia_ctime;
304
};
305
 
306
#include <linux/quota.h>
307
 
308
struct vm_area_struct;
309
 
310
struct inode {
311
        kdev_t          i_dev;
312
        unsigned long   i_ino;
313
        umode_t         i_mode;
314
        nlink_t         i_nlink;
315
        uid_t           i_uid;
316
        gid_t           i_gid;
317
        kdev_t          i_rdev;
318
        off_t           i_size;
319
        time_t          i_atime;
320
        time_t          i_mtime;
321
        time_t          i_ctime;
322
        unsigned long   i_blksize;
323
        unsigned long   i_blocks;
324
        unsigned long   i_version;
325
        unsigned long   i_nrpages;
326
        struct semaphore i_sem;
327
        struct inode_operations *i_op;
328
        struct super_block *i_sb;
329
        struct wait_queue *i_wait;
330
        struct file_lock *i_flock;
331
#ifndef NO_MM
332
        struct vm_area_struct *i_mmap;
333
#endif /* !NO_MM */
334
        struct page *i_pages;
335
        struct dquot *i_dquot[MAXQUOTAS];
336
        struct inode *i_next, *i_prev;
337
        struct inode *i_hash_next, *i_hash_prev;
338
        struct inode *i_bound_to, *i_bound_by;
339
        struct inode *i_mount;
340
        unsigned long i_count;  /* needs to be > (address_space * tasks)>>pagebits */
341
        unsigned short i_flags;
342
        unsigned short i_writecount;
343
        unsigned char i_lock;
344
        unsigned char i_dirt;
345
        unsigned char i_pipe;
346
        unsigned char i_sock;
347
        unsigned char i_seek;
348
        unsigned char i_update;
349
        unsigned char i_condemned;
350
        union {
351
                struct pipe_inode_info pipe_i;
352
                struct minix_inode_info minix_i;
353
                struct ext_inode_info ext_i;
354
                struct ext2_inode_info ext2_i;
355
                struct hpfs_inode_info hpfs_i;
356
                struct msdos_inode_info msdos_i;
357
                struct umsdos_inode_info umsdos_i;
358
                struct iso_inode_info isofs_i;
359
                struct nfs_inode_info nfs_i;
360
                struct xiafs_inode_info xiafs_i;
361
                struct sysv_inode_info sysv_i;
362
                struct affs_inode_info affs_i;
363
                struct ufs_inode_info ufs_i;
364
                struct romfs_inode_info romfs_i;
365
                struct socket socket_i;
366
                void * generic_ip;
367
        } u;
368
};
369
 
370
struct fown_struct {
371
        int pid;                /* pid or -pgrp where SIGIO should be sent */
372
        uid_t uid, euid;        /* uid/euid of process setting the owner */
373
};
374
 
375
struct file {
376
        mode_t f_mode;
377
        loff_t f_pos;
378
        unsigned short f_flags;
379
        unsigned short f_count;
380
        unsigned long f_reada, f_ramax, f_raend, f_ralen, f_rawin;
381
        struct file *f_next, *f_prev;
382
        struct fown_struct f_owner;
383
        struct inode * f_inode;
384
        struct file_operations * f_op;
385
        unsigned long f_version;
386
        void *private_data;     /* needed for tty driver, and maybe others */
387
};
388
 
389
#define FL_POSIX        1
390
#define FL_FLOCK        2
391
#define FL_BROKEN       4       /* broken flock() emulation */
392
#define FL_ACCESS       8       /* for processes suspended by mandatory locking */
393
 
394
struct file_lock {
395
        struct file_lock *fl_next;      /* singly linked list for this inode  */
396
        struct file_lock *fl_nextlink;  /* doubly linked list of all locks */
397
        struct file_lock *fl_prevlink;  /* used to simplify lock removal */
398
        struct file_lock *fl_nextblock; /* circular list of blocked processes */
399
        struct file_lock *fl_prevblock;
400
        struct task_struct *fl_owner;
401
        struct wait_queue *fl_wait;
402
        struct file *fl_file;
403
        unsigned char fl_flags;
404
        unsigned char fl_type;
405
        off_t fl_start;
406
        off_t fl_end;
407
};
408
 
409
#include <linux/fcntl.h>
410
 
411
extern int fcntl_getlk(unsigned int fd, struct flock *l);
412
extern int fcntl_setlk(unsigned int fd, unsigned int cmd, struct flock *l);
413
extern void locks_remove_locks(struct task_struct *task, struct file *filp);
414
 
415
#include <linux/stat.h>
416
 
417
#define FLOCK_VERIFY_READ  1
418
#define FLOCK_VERIFY_WRITE 2
419
 
420
extern int locks_mandatory_locked(struct inode *inode);
421
extern int locks_mandatory_area(int read_write, struct inode *inode,
422
                                struct file *filp, unsigned int offset,
423
                                unsigned int count);
424
 
425
extern inline int locks_verify_locked(struct inode *inode)
426
{
427
        /* Candidates for mandatory locking have the setgid bit set
428
         * but no group execute bit -  an otherwise meaningless combination.
429
         */
430
        if (IS_MANDLOCK(inode) &&
431
            (inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
432
                return (locks_mandatory_locked(inode));
433
        return (0);
434
}
435
extern inline int locks_verify_area(int read_write, struct inode *inode,
436
                                    struct file *filp, unsigned int offset,
437
                                    unsigned int count)
438
{
439
        /* Candidates for mandatory locking have the setgid bit set
440
         * but no group execute bit -  an otherwise meaningless combination.
441
         */
442
        if (IS_MANDLOCK(inode) &&
443
            (inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
444
                return (locks_mandatory_area(read_write, inode, filp, offset,
445
                                             count));
446
        return (0);
447
}
448
 
449
struct fasync_struct {
450
        int    magic;
451
        struct fasync_struct    *fa_next; /* singly linked list */
452
        struct file             *fa_file;
453
};
454
 
455
#define FASYNC_MAGIC 0x4601
456
 
457
extern int fasync_helper(struct inode *, struct file *, int, struct fasync_struct **);
458
 
459
#include <linux/minix_fs_sb.h>
460
#include <linux/ext_fs_sb.h>
461
#include <linux/ext2_fs_sb.h>
462
#include <linux/hpfs_fs_sb.h>
463
#include <linux/msdos_fs_sb.h>
464
#include <linux/iso_fs_sb.h>
465
#include <linux/nfs_fs_sb.h>
466
#include <linux/xia_fs_sb.h>
467
#include <linux/sysv_fs_sb.h>
468
#include <linux/affs_fs_sb.h>
469
#include <linux/ufs_fs_sb.h>
470
#include <linux/romfs_fs_sb.h>
471
 
472
struct super_block {
473
        kdev_t s_dev;
474
        unsigned long s_blocksize;
475
        unsigned char s_blocksize_bits;
476
        unsigned char s_lock;
477
        unsigned char s_rd_only;
478
        unsigned char s_dirt;
479
        struct file_system_type *s_type;
480
        struct super_operations *s_op;
481
        struct dquot_operations *dq_op;
482
        unsigned long s_flags;
483
        unsigned long s_magic;
484
        unsigned long s_time;
485
        struct inode * s_covered;
486
        struct inode * s_mounted;
487
        struct wait_queue * s_wait;
488
        union {
489
                struct minix_sb_info minix_sb;
490
                struct ext_sb_info ext_sb;
491
                struct ext2_sb_info ext2_sb;
492
                struct hpfs_sb_info hpfs_sb;
493
                struct msdos_sb_info msdos_sb;
494
                struct isofs_sb_info isofs_sb;
495
                struct nfs_sb_info nfs_sb;
496
                struct xiafs_sb_info xiafs_sb;
497
                struct sysv_sb_info sysv_sb;
498
                struct affs_sb_info affs_sb;
499
                struct ufs_sb_info ufs_sb;
500
                struct romfs_sb_info romfs_sb;
501
                void *generic_sbp;
502
        } u;
503
};
504
 
505
/*
506
 * This is the "filldir" function type, used by readdir() to let
507
 * the kernel specify what kind of dirent layout it wants to have.
508
 * This allows the kernel to read directories into kernel space or
509
 * to have different dirent layouts depending on the binary type.
510
 */
511
typedef int (*filldir_t)(void *, const char *, int, off_t, ino_t);
512
 
513
struct file_operations {
514
        int (*lseek) (struct inode *, struct file *, off_t, int);
515
        int (*read) (struct inode *, struct file *, char *, int);
516
        int (*write) (struct inode *, struct file *, const char *, int);
517
        int (*readdir) (struct inode *, struct file *, void *, filldir_t);
518
        int (*select) (struct inode *, struct file *, int, select_table *);
519
        int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
520
        int (*mmap) (struct inode *, struct file *, struct vm_area_struct *);
521
        int (*open) (struct inode *, struct file *);
522
        void (*release) (struct inode *, struct file *);
523
        int (*fsync) (struct inode *, struct file *);
524
        int (*fasync) (struct inode *, struct file *, int);
525
        int (*check_media_change) (kdev_t dev);
526
        int (*revalidate) (kdev_t dev);
527
#ifdef MAGIC_ROM_PTR
528
        int (*romptr) (struct inode *, struct file *, struct vm_area_struct *);
529
#endif /* MAGIC_ROM_PTR */
530
};
531
 
532
struct inode_operations {
533
        struct file_operations * default_file_ops;
534
        int (*create) (struct inode *,const char *,int,int,struct inode **);
535
        int (*lookup) (struct inode *,const char *,int,struct inode **);
536
        int (*link) (struct inode *,struct inode *,const char *,int);
537
        int (*unlink) (struct inode *,const char *,int);
538
        int (*symlink) (struct inode *,const char *,int,const char *);
539
        int (*mkdir) (struct inode *,const char *,int,int);
540
        int (*rmdir) (struct inode *,const char *,int);
541
        int (*mknod) (struct inode *,const char *,int,int,int);
542
        int (*rename) (struct inode *,const char *,int,struct inode *,const char *,int, int);
543
        int (*readlink) (struct inode *,char *,int);
544
        int (*follow_link) (struct inode *,struct inode *,int,int,struct inode **);
545
        int (*readpage) (struct inode *, struct page *);
546
        int (*writepage) (struct inode *, struct page *);
547
        int (*bmap) (struct inode *,int);
548
        void (*truncate) (struct inode *);
549
        int (*permission) (struct inode *, int);
550
        int (*smap) (struct inode *,int);
551
};
552
 
553
struct super_operations {
554
        void (*read_inode) (struct inode *);
555
        int (*notify_change) (struct inode *, struct iattr *);
556
        void (*write_inode) (struct inode *);
557
        void (*put_inode) (struct inode *);
558
        void (*put_super) (struct super_block *);
559
        void (*write_super) (struct super_block *);
560
        void (*statfs) (struct super_block *, struct statfs *, int);
561
        int (*remount_fs) (struct super_block *, int *, char *);
562
};
563
 
564
struct dquot_operations {
565
        void (*initialize) (struct inode *, short);
566
        void (*drop) (struct inode *);
567
        int (*alloc_block) (const struct inode *, unsigned long);
568
        int (*alloc_inode) (const struct inode *, unsigned long);
569
        void (*free_block) (const struct inode *, unsigned long);
570
        void (*free_inode) (const struct inode *, unsigned long);
571
        int (*transfer) (struct inode *, struct iattr *, char);
572
};
573
 
574
struct file_system_type {
575
        struct super_block *(*read_super) (struct super_block *, void *, int);
576
        const char *name;
577
        int requires_dev;
578
        struct file_system_type * next;
579
};
580
 
581
extern int register_filesystem(struct file_system_type *);
582
extern int unregister_filesystem(struct file_system_type *);
583
 
584
asmlinkage int sys_open(const char *, int, int);
585
asmlinkage int sys_close(unsigned int);         /* yes, it's really unsigned */
586
asmlinkage int sys_read(unsigned int, char *, int);
587
 
588
extern void kill_fasync(struct fasync_struct *fa, int sig);
589
 
590
extern int getname(const char * filename, char **result);
591
extern void putname(char * name);
592
extern int do_truncate(struct inode *, unsigned long);
593
extern int register_blkdev(unsigned int, const char *, struct file_operations *);
594
extern int unregister_blkdev(unsigned int major, const char * name);
595
extern int blkdev_open(struct inode * inode, struct file * filp);
596
extern void blkdev_release (struct inode * inode);
597
extern struct file_operations def_blk_fops;
598
extern struct inode_operations blkdev_inode_operations;
599
 
600
extern int register_chrdev(unsigned int, const char *, struct file_operations *);
601
extern int unregister_chrdev(unsigned int major, const char * name);
602
extern int chrdev_open(struct inode * inode, struct file * filp);
603
extern struct file_operations def_chr_fops;
604
extern struct inode_operations chrdev_inode_operations;
605
 
606
extern void init_fifo(struct inode * inode);
607
extern struct inode_operations fifo_inode_operations;
608
 
609
extern struct file_operations connecting_fifo_fops;
610
extern struct file_operations read_fifo_fops;
611
extern struct file_operations write_fifo_fops;
612
extern struct file_operations rdwr_fifo_fops;
613
extern struct file_operations read_pipe_fops;
614
extern struct file_operations write_pipe_fops;
615
extern struct file_operations rdwr_pipe_fops;
616
 
617
extern struct file_system_type *get_fs_type(const char *name);
618
 
619
extern int fs_may_mount(kdev_t dev);
620
extern int fs_may_umount(kdev_t dev, struct inode * mount_root);
621
extern int fs_may_remount_ro(kdev_t dev);
622
 
623
extern struct file *first_file;
624
extern struct super_block super_blocks[NR_SUPER];
625
 
626
extern void refile_buffer(struct buffer_head * buf);
627
extern void set_writetime(struct buffer_head * buf, int flag);
628
extern int try_to_free_buffer(struct buffer_head*, struct buffer_head**, int);
629
 
630
extern int nr_buffers;
631
extern int buffermem;
632
extern int nr_buffer_heads;
633
 
634
#define BUF_CLEAN       0
635
#define BUF_LOCKED      1       /* Buffers scheduled for write */
636
#define BUF_LOCKED1     2       /* Supers, inodes */
637
#define BUF_DIRTY       3       /* Dirty buffers, not yet scheduled for write */
638
#define NR_LIST         4
639
 
640
void mark_buffer_uptodate(struct buffer_head * bh, int on);
641
 
642
extern inline void mark_buffer_clean(struct buffer_head * bh)
643
{
644
        if (clear_bit(BH_Dirty, &bh->b_state)) {
645
                if (bh->b_list == BUF_DIRTY)
646
                        refile_buffer(bh);
647
        }
648
}
649
 
650
extern inline void mark_buffer_dirty(struct buffer_head * bh, int flag)
651
{
652
        if (!set_bit(BH_Dirty, &bh->b_state)) {
653
                set_writetime(bh, flag);
654
                if (bh->b_list != BUF_DIRTY)
655
                        refile_buffer(bh);
656
        }
657
}
658
 
659
extern int check_disk_change(kdev_t dev);
660
extern void invalidate_inodes(kdev_t dev);
661
extern void invalidate_inode_pages(struct inode *);
662
extern void invalidate_buffers(kdev_t dev);
663
extern void invalidate_buffers_by_block(kdev_t dev, unsigned int start, unsigned int count);
664
extern void invalidate_buffers_by_byte(kdev_t dev, unsigned long pos, unsigned long len);
665
extern int floppy_is_wp(int minor);
666
extern void sync_inodes(kdev_t dev);
667
extern void sync_dev(kdev_t dev);
668
extern int fsync_dev(kdev_t dev);
669
extern void sync_supers(kdev_t dev);
670
extern int bmap(struct inode * inode,int block);
671
extern int notify_change(struct inode *, struct iattr *);
672
extern int namei(const char * pathname, struct inode ** res_inode);
673
extern int lnamei(const char * pathname, struct inode ** res_inode);
674
extern int permission(struct inode * inode,int mask);
675
extern int get_write_access(struct inode *inode);
676
extern void put_write_access(struct inode *inode);
677
extern int open_namei(const char * pathname, int flag, int mode,
678
        struct inode ** res_inode, struct inode * base);
679
extern int do_mknod(const char * filename, int mode, dev_t dev);
680
extern int do_pipe(int *);
681
extern void iput(struct inode * inode);
682
extern struct inode * __iget(struct super_block * sb,int nr,int crsmnt);
683
extern struct inode * get_empty_inode(void);
684
extern void insert_inode_hash(struct inode *);
685
extern void clear_inode(struct inode *);
686
extern struct inode * get_pipe_inode(void);
687
extern void make_bad_inode(struct inode *);
688
extern int get_unused_fd(void);
689
extern void put_unused_fd(int);
690
extern struct file * get_empty_filp(void);
691
extern int close_fp(struct file *filp);
692
extern struct buffer_head * get_hash_table(kdev_t dev, int block, int size);
693
extern struct buffer_head * getblk(kdev_t dev, int block, int size);
694
extern void ll_rw_block(int rw, int nr, struct buffer_head * bh[]);
695
extern void ll_rw_page(int rw, kdev_t dev, unsigned long nr, char * buffer);
696
extern void ll_rw_swap_file(int rw, kdev_t dev, unsigned int *b, int nb, char *buffer);
697
extern int is_read_only(kdev_t dev);
698
extern void __brelse(struct buffer_head *buf);
699
extern inline void brelse(struct buffer_head *buf)
700
{
701
        if (buf)
702
                __brelse(buf);
703
}
704
extern void __bforget(struct buffer_head *buf);
705
#ifndef NO_FORGET
706
extern inline void bforget(struct buffer_head *buf)
707
{
708
        if (buf)
709
                __bforget(buf);
710
}
711
#else
712
#define bforget(x) brelse(x)
713
#endif
714
 
715
extern void set_blocksize(kdev_t dev, int size);
716
extern struct buffer_head * bread(kdev_t dev, int block, int size);
717
extern struct buffer_head * breada(kdev_t dev,int block, int size,
718
                                   unsigned int pos, unsigned int filesize);
719
 
720
extern int generic_readpage(struct inode *, struct page *);
721
extern int generic_file_read(struct inode *, struct file *, char *, int);
722
extern int generic_file_mmap(struct inode *, struct file *, struct vm_area_struct *);
723
extern int brw_page(int, struct page *, kdev_t, int [], int, int);
724
 
725
#ifdef MAGIC_ROM_PTR
726
extern int bromptr(kdev_t dev, struct vm_area_struct * vma);
727
#endif
728
 
729
extern void put_super(kdev_t dev);
730
unsigned long generate_cluster(kdev_t dev, int b[], int size);
731
unsigned long generate_cluster_swab32(kdev_t dev, int b[], int size);
732
extern kdev_t ROOT_DEV;
733
 
734
extern void show_buffers(void);
735
extern void mount_root(void);
736
 
737
#ifdef CONFIG_BLK_DEV_INITRD
738
extern kdev_t real_root_dev;
739
extern int change_root(kdev_t new_root_dev,const char *put_old);
740
#endif
741
 
742
extern int char_read(struct inode *, struct file *, char *, int);
743
extern int block_read(struct inode *, struct file *, char *, int);
744
extern int read_ahead[];
745
 
746
extern int char_write(struct inode *, struct file *, const char *, int);
747
extern int block_write(struct inode *, struct file *, const char *, int);
748
 
749
extern int block_fsync(struct inode *, struct file *);
750
extern int file_fsync(struct inode *, struct file *);
751
 
752
extern void dcache_add(struct inode *, const char *, int, unsigned long);
753
extern int dcache_lookup(struct inode *, const char *, int, unsigned long *);
754
 
755
extern int inode_change_ok(struct inode *, struct iattr *);
756
extern void inode_setattr(struct inode *, struct iattr *);
757
 
758
extern inline struct inode * iget(struct super_block * sb,int nr)
759
{
760
        return __iget(sb, nr, 1);
761
}
762
 
763
/* kludge to get SCSI modules working */
764
#include <linux/minix_fs.h>
765
#include <linux/minix_fs_sb.h>
766
 
767
/* Byte swapping 32/16-bit quantities into little endian format. */
768
#ifdef __LITTLE_ENDIAN
769
#define swab32(x) (x)
770
#define swab16(x) (x)
771
#else /* __BIG_ENDIAN */
772
extern __inline__ __u32 swab32(__u32 value)
773
{
774
        return((value>>24) | ((value>>8)&0xff00) |
775
               ((value<<8)&0xff0000) | (value<<24));
776
}
777
 
778
extern __inline__ __u16 swab16(__u16 value)
779
{
780
        return (value >> 8) | (value << 8);
781
}
782
#endif
783
 
784
#endif /* __KERNEL__ */
785
 
786
#endif

powered by: WebSVN 2.1.0

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