root/include/linux/fs.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. buffer_uptodate
  2. buffer_dirty
  3. buffer_locked
  4. buffer_req
  5. buffer_touched
  6. buffer_has_aged
  7. buffer_protected
  8. locks_verify_locked
  9. locks_verify_area
  10. mark_buffer_clean
  11. mark_buffer_dirty
  12. brelse
  13. bforget
  14. iget

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

/* [previous][next][first][last][top][bottom][index][help] */