Annotation of dmsdos/src/lib_interface.h, revision 1.1.1.1

1.1       root        1: /*
                      2: lib_interface.h
                      3: 
                      4: DMSDOS library: headers for interface functions, hacks, dummies, and fakes.
                      5: 
                      6: ******************************************************************************
                      7: DMSDOS (compressed MSDOS filesystem support) for Linux
                      8: written 1995-1998 by Frank Gockel and Pavel Pisa
                      9: 
                     10:     (C) Copyright 1995-1998 by Frank Gockel
                     11:     (C) Copyright 1996-1998 by Pavel Pisa
                     12: 
                     13: Some code of dmsdos has been copied from the msdos filesystem
                     14: so there are the following additional copyrights:
                     15: 
                     16:     (C) Copyright 1992,1993 by Werner Almesberger (msdos filesystem)
                     17:     (C) Copyright 1994,1995 by Jacques Gelinas (mmap code)
                     18:     (C) Copyright 1992-1995 by Linus Torvalds
                     19: 
                     20: DMSDOS was inspired by the THS filesystem (a simple doublespace
                     21: DS-0-2 compressed read-only filesystem) written 1994 by Thomas Scheuermann.
                     22: 
                     23: The DMSDOS code is distributed under the Gnu General Public Licence.
                     24: See file COPYING for details.
                     25: ******************************************************************************
                     26: 
                     27: */
                     28: 
                     29: /* These are copied from the kernel include files in order to avoid
                     30:    including those files. They are not 100% identical to the kernel types.
                     31:    Most of them needn't be the same as in the kernel.
                     32:    This has been done for libc6 support.
                     33: */
                     34: 
                     35: /* this defines machine-dependent __u8, __s8 etc. types */
                     36: #include<asm/types.h>
                     37: 
                     38: int printk(const char *fmt, ...);
                     39: void panic(const char * fmt, ...);
                     40: 
                     41: #define MOD_INC_USE_COUNT
                     42: #define MOD_DEC_USE_COUNT
                     43: 
                     44: #define SECTOR_SIZE 512
                     45: #define SECTOR_BITS 9
                     46: #define MSDOS_DPB       (MSDOS_DPS) /* dir entries per block */
                     47: #define MSDOS_DPB_BITS  4 /* log2(MSDOS_DPB) */
                     48: #define MSDOS_DPS       (SECTOR_SIZE/sizeof(struct msdos_dir_entry))
                     49: #define MSDOS_DPS_BITS  4 /* log2(MSDOS_DPS) */
                     50: #define MSDOS_DIR_BITS  5 /* log2(sizeof(struct msdos_dir_entry)) */
                     51: 
                     52: #define MSDOS_SUPER_MAGIC 0x4d44 /* MD */
                     53: 
                     54: #define MSDOS_MAX_EXTRA 3 /* tolerate up to that number of clusters which are
                     55:                              inaccessible because the FAT is too short */
                     56: 
                     57: #define KERN_EMERG      "<0>"   /* system is unusable                   */
                     58: #define KERN_ALERT      "<1>"   /* action must be taken immediately     */
                     59: #define KERN_CRIT       "<2>"   /* critical conditions                  */
                     60: #define KERN_ERR        "<3>"   /* error conditions                     */
                     61: #define KERN_WARNING    "<4>"   /* warning conditions                   */
                     62: #define KERN_NOTICE     "<5>"   /* normal but significant condition     */
                     63: #define KERN_INFO       "<6>"   /* informational                        */
                     64: #define KERN_DEBUG      "<7>"   /* debug-level messages                 */
                     65: 
                     66: struct buffer_head {
                     67:         unsigned long b_blocknr;        /* block number */
                     68:         char * b_data;                  /* pointer to data block */
                     69: };
                     70: 
                     71: #define MS_RDONLY   1      /* Mount read-only */
                     72: #define MSDOS_SB(s) (&((s)->u.msdos_sb))
                     73: 
                     74: struct msdos_sb_info {
                     75:         unsigned short cluster_size; /* sectors/cluster */
                     76:         unsigned char fats,fat_bits; /* number of FATs, FAT bits (12 or 16) */
                     77:         unsigned short fat_start,fat_length; /* FAT start & length (sec.) */
                     78:         unsigned short dir_start,dir_entries; /* root dir start & entries */
                     79:         unsigned short data_start;   /* first data sector */
                     80:         unsigned long clusters;      /* number of clusters */
                     81:         unsigned long root_cluster;  /* first cluster of the root directory */
                     82:         unsigned long fsinfo_offset; /* FAT32 fsinfo offset from start of disk */
                     83:         void *fat_wait;
                     84:         int fat_lock;
                     85:         int prev_free;               /* previously returned free cluster number */
                     86:         int free_clusters;           /* -1 if undefined */
                     87:         /*struct fat_mount_options options;*/
                     88:         struct nls_table *nls_disk;  /* Codepage used on disk */
                     89:         struct nls_table *nls_io;    /* Charset used for input and display */
                     90:         struct cvf_format* cvf_format;
                     91:         void* private_data;
                     92: };
                     93: 
                     94: struct super_block {
                     95:         int s_dev;
                     96:         unsigned long s_blocksize;
                     97:         unsigned char s_blocksize_bits;
                     98:         unsigned long s_flags;
                     99:         unsigned long s_magic;
                    100:         union {
                    101:                 struct msdos_sb_info msdos_sb;
                    102:         } u;
                    103: 
                    104: };
                    105: 
                    106: struct fat_boot_sector {
                    107:         __s8    ignored[3];     /* Boot strap short or near jump */
                    108:         __s8    system_id[8];   /* Name - can be used to special case
                    109:                                    partition manager volumes */
                    110:         __u8    sector_size[2]; /* bytes per logical sector */
                    111:         __u8    cluster_size;   /* sectors/cluster */
                    112:         __u16   reserved;       /* reserved sectors */
                    113:         __u8    fats;           /* number of FATs */
                    114:         __u8    dir_entries[2]; /* root directory entries */
                    115:         __u8    sectors[2];     /* number of sectors */
                    116:         __u8    media;          /* media code (unused) */
                    117:         __u16   fat_length;     /* sectors/FAT */
                    118:         __u16   secs_track;     /* sectors per track */
                    119:         __u16   heads;          /* number of heads */
                    120:         __u32   hidden;         /* hidden sectors (unused) */
                    121:         __u32   total_sect;     /* number of sectors (if sectors == 0) */
                    122:         /* The following fields are only used by FAT32 */
                    123:         __u32   fat32_length;   /* sectors/FAT */
                    124:         __u16   flags;          /* bit 8: fat mirroring, low 4: active fat */
                    125:         __u8    version[2];     /* major, minor filesystem version */
                    126:         __u32   root_cluster;   /* first cluster in root directory */
                    127:         __u16   info_sector;    /* filesystem info sector */
                    128:         __u16   backup_boot;    /* backup boot sector */
                    129:         __u16   reserved2[6];   /* Unused */
                    130: };
                    131: 
                    132: #define MALLOC malloc
                    133: #define FREE free
                    134: #define kmalloc(x,y) malloc(x)
                    135: #define kfree free
                    136: #define CURRENT_TIME time(NULL)
                    137: #define vmalloc malloc
                    138: #define vfree free

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.