Annotation of Net2/pcfs/pcfsmount.h, revision 1.1

1.1     ! root        1: /*
        !             2:  *  Written by Paul Popelka ([email protected])
        !             3:  *
        !             4:  *  You can do anything you want with this software,
        !             5:  *    just don't say you wrote it,
        !             6:  *    and don't remove this notice.
        !             7:  *
        !             8:  *  This software is provided "as is".
        !             9:  *
        !            10:  *  The author supplies this software to be publicly
        !            11:  *  redistributed on the understanding that the author
        !            12:  *  is not responsible for the correct functioning of
        !            13:  *  this software in any circumstances and is not liable
        !            14:  *  for any damages caused by this software.
        !            15:  *
        !            16:  *  October 1992
        !            17:  *
        !            18:  *     pcfsmount.h,v 1.2 1993/05/20 03:34:27 cgd Exp
        !            19:  */
        !            20: 
        !            21: /*
        !            22:  *  Layout of the mount control block for a msdos
        !            23:  *  file system.
        !            24:  */
        !            25: struct pcfsmount {
        !            26:        struct mount *pm_mountp;        /* vfs mount struct for this fs */
        !            27:        dev_t pm_dev;                   /* block special device mounted */
        !            28:        struct vnode *pm_devvp;         /* vnode for block device mntd  */
        !            29:        struct bpb50 pm_bpb;            /* BIOS parameter blk for this fs */
        !            30:        u_long pm_fatblk;               /* block # of first FAT         */
        !            31:        u_long pm_rootdirblk;           /* block # of root directory    */
        !            32:        u_long pm_rootdirsize;          /* size in blocks (not clusters) */
        !            33:        u_long pm_firstcluster;         /* block number of first cluster */
        !            34:        u_long pm_nmbrofclusters;       /* # of clusters in filesystem  */
        !            35:        u_long pm_maxcluster;           /* maximum cluster number       */
        !            36:        u_long pm_freeclustercount;     /* number of free clusters      */
        !            37:        u_long pm_lookhere;             /* start free cluster search here */
        !            38:        u_long pm_bnshift;              /* shift file offset right this
        !            39:                                         *  amount to get a block number */
        !            40:        u_long pm_brbomask;             /* and a file offset with this
        !            41:                                         *  mask to get block rel offset */
        !            42:        u_long pm_cnshift;              /* shift file offset right this
        !            43:                                         *  amount to get a cluster number */
        !            44:        u_long pm_crbomask;             /* and a file offset with this
        !            45:                                         *  mask to get cluster rel offset */
        !            46:        u_long pm_bpcluster;            /* bytes per cluster            */
        !            47:        u_long pm_depclust;             /* directory entries per cluster */
        !            48:        u_long pm_fmod;                 /* ~0 if fs is modified, this can
        !            49:                                         * rollover to 0                */
        !            50:        u_long pm_fatblocksize;         /* size of fat blocks in bytes */
        !            51:        u_long pm_fatblocksec;          /* size of fat blocks in sectors */
        !            52:        u_long pm_fatsize;              /* size of fat in bytes */
        !            53:        u_char *pm_inusemap;            /* ptr to bitmap of in-use clusters */
        !            54:        char pm_ronly;                  /* read only if non-zero        */
        !            55:        char pm_waitonfat;              /* wait for writes of the fat to complt,
        !            56:                                         * when 0 use bdwrite, else use bwrite */
        !            57: };
        !            58: /*
        !            59:  *  How to compute pm_cnshift and pm_crbomask.
        !            60:  *
        !            61:  *  pm_crbomask = (pm_SectPerClust * pm_BytesPerSect) - 1
        !            62:  *  if (bytesperclust == 0) return EBADBLKSZ;
        !            63:  *  bit = 1;
        !            64:  *  for (i = 0; i < 32; i++) {
        !            65:  *    if (bit & bytesperclust) {
        !            66:  *      if (bit ^ bytesperclust) return EBADBLKSZ;
        !            67:  *      pm_cnshift = i;
        !            68:  *      break;
        !            69:  *    }
        !            70:  *    bit <<= 1;
        !            71:  * }
        !            72:  */
        !            73: 
        !            74: /*
        !            75:  *  Shorthand for fields in the bpb contained in
        !            76:  *  the pcfsmount structure.
        !            77:  */
        !            78: #define        pm_BytesPerSec  pm_bpb.bpbBytesPerSec
        !            79: #define        pm_SectPerClust pm_bpb.bpbSecPerClust
        !            80: #define        pm_ResSectors   pm_bpb.bpbResSectors
        !            81: #define        pm_FATs         pm_bpb.bpbFATs
        !            82: #define        pm_RootDirEnts  pm_bpb.bpbRootDirEnts
        !            83: #define        pm_Sectors      pm_bpb.bpbSectors
        !            84: #define        pm_Media        pm_bpb.bpbMedia
        !            85: #define        pm_FATsecs      pm_bpb.bpbFATsecs
        !            86: #define        pm_SecPerTrack  pm_bpb.bpbSecPerTrack
        !            87: #define        pm_Heads        pm_bpb.bpbHeads
        !            88: #define        pm_HiddenSects  pm_bpb.bpbHiddenSecs
        !            89: #define        pm_HugeSectors  pm_bpb.bpbHugeSectors
        !            90: 
        !            91: /*
        !            92:  *  Map a cluster number into a filesystem relative
        !            93:  *  block number.
        !            94:  */
        !            95: #define        cntobn(pmp, cn) \
        !            96:        ((((cn)-CLUST_FIRST) * (pmp)->pm_SectPerClust) + (pmp)->pm_firstcluster)
        !            97: 
        !            98: /*
        !            99:  *  Map a filesystem relative block number back into
        !           100:  *  a cluster number.
        !           101:  */
        !           102: #define        bntocn(pmp, bn) \
        !           103:        ((((bn) - pmp->pm_firstcluster)/ (pmp)->pm_SectPerClust) + CLUST_FIRST)
        !           104: 
        !           105: /*
        !           106:  * Calculate block number for directory entry in root dir, offset dirofs
        !           107:  */
        !           108: #define        roottobn(pmp, dirofs) \
        !           109:        (((dirofs) / (pmp)->pm_depclust) * (pmp)->pm_SectPerClust \
        !           110:        + (pmp)->pm_rootdirblk)
        !           111: 
        !           112: /*
        !           113:  * Calculate block number for directory entry at cluster dirclu, offset dirofs
        !           114:  */
        !           115: #define        detobn(pmp, dirclu, dirofs) \
        !           116:        ((dirclu) == PCFSROOT \
        !           117:         ? roottobn((pmp), (dirofs)) \
        !           118:         : cntobn((pmp), (dirclu)))
        !           119: 
        !           120: /*
        !           121:  * Convert pointer to buffer -> pointer to direntry
        !           122:  */
        !           123: #define        bptoep(pmp, bp, dirofs) \
        !           124:        ((struct direntry *)((bp)->b_un.b_addr) \
        !           125:         + (dirofs) % (pmp)->pm_depclust)
        !           126: 
        !           127: 
        !           128: /*
        !           129:  * Prototypes for PCFS virtual filesystem operations
        !           130:  */
        !           131: int pcfs_mount __P((struct mount *mp, char *path, caddr_t data,
        !           132:        struct nameidata *ndp, struct proc *p));
        !           133: int pcfs_start __P((struct mount *mp, int flags, struct proc *p));
        !           134: int pcfs_unmount __P((struct mount *mp, int mntflags, struct proc *p));
        !           135: int pcfs_root __P((struct mount *mp, struct vnode **vpp));
        !           136: int pcfs_quotactl __P((struct mount *mp, int cmds, int uid, /* should be uid_t */
        !           137:        caddr_t arg, struct proc *p));
        !           138: int pcfs_statfs __P((struct mount *mp, struct statfs *sbp, struct proc *p));
        !           139: int pcfs_sync __P((struct mount *mp, int waitfor));
        !           140: int pcfs_fhtovp __P((struct mount *mp, struct fid *fhp, struct vnode **vpp));
        !           141: int pcfs_vptofh __P((struct vnode *vp, struct fid *fhp));
        !           142: int pcfs_init __P(());

unix.superglobalmegacorp.com

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