version 1.7.12.4, 2007/10/27 11:35:06 |
version 1.8, 2005/08/30 18:49:19 |
|
|
* October 1992 |
* October 1992 |
*/ |
*/ |
|
|
#ifndef _MSDOSFS_MSDOSFSMOUNT_H_ |
|
#define _MSDOSFS_MSDOSFSMOUNT_H_ |
|
|
|
/* |
/* |
* Arguments to mount MSDOS filesystems. |
* Arguments to mount MSDOS filesystems. |
*/ |
*/ |
struct msdosfs_args { |
struct msdosfs_args { |
char *fspec; /* blocks special holding the fs to mount */ |
char *fspec; /* blocks special holding the fs to mount */ |
struct export_args30 _pad1; /* compat with old userland tools */ |
struct export_args export; /* network export information */ |
uid_t uid; /* uid that owns msdosfs files */ |
uid_t uid; /* uid that owns msdosfs files */ |
gid_t gid; /* gid that owns msdosfs files */ |
gid_t gid; /* gid that owns msdosfs files */ |
mode_t mask; /* mask to be applied for msdosfs perms */ |
mode_t mask; /* mask to be applied for msdosfs perms */ |
Line 93 struct msdosfs_args { |
|
Line 90 struct msdosfs_args { |
|
#ifdef _KERNEL |
#ifdef _KERNEL |
#include <sys/mallocvar.h> |
#include <sys/mallocvar.h> |
MALLOC_DECLARE(M_MSDOSFSMNT); |
MALLOC_DECLARE(M_MSDOSFSMNT); |
MALLOC_DECLARE(M_MSDOSFSTMP); |
|
|
|
/* |
/* |
* Layout of the mount control block for a msdos file system. |
* Layout of the mount control block for a msdos file system. |
Line 111 struct msdosfsmount { |
|
Line 107 struct msdosfsmount { |
|
struct vnode *pm_devvp; /* vnode for block device mntd */ |
struct vnode *pm_devvp; /* vnode for block device mntd */ |
struct bpb50 pm_bpb; /* BIOS parameter blk for this fs */ |
struct bpb50 pm_bpb; /* BIOS parameter blk for this fs */ |
u_long pm_FATsecs; /* actual number of fat sectors */ |
u_long pm_FATsecs; /* actual number of fat sectors */ |
u_long pm_fatblk; /* sector # of first FAT */ |
u_long pm_fatblk; /* block # of first FAT */ |
u_long pm_rootdirblk; /* sector # (cluster # for FAT32) of root directory number */ |
u_long pm_rootdirblk; /* block # (cluster # for FAT32) of root directory number */ |
u_long pm_rootdirsize; /* size in sectors (not clusters) */ |
u_long pm_rootdirsize; /* size in blocks (not clusters) */ |
u_long pm_firstcluster; /* sector number of first cluster */ |
u_long pm_firstcluster; /* block number of first cluster */ |
u_long pm_nmbrofclusters; /* # of clusters in filesystem */ |
u_long pm_nmbrofclusters; /* # of clusters in filesystem */ |
u_long pm_maxcluster; /* maximum cluster number */ |
u_long pm_maxcluster; /* maximum cluster number */ |
u_long pm_freeclustercount; /* number of free clusters */ |
u_long pm_freeclustercount; /* number of free clusters */ |
u_long pm_cnshift; /* shift file offset right this amount to get a cluster number */ |
u_long pm_cnshift; /* shift file offset right this amount to get a cluster number */ |
u_long pm_crbomask; /* and a file offset with this mask to get cluster rel offset */ |
u_long pm_crbomask; /* and a file offset with this mask to get cluster rel offset */ |
u_long pm_bnshift; /* shift file offset right this amount to get a sector number */ |
u_long pm_bnshift; /* shift file offset right this amount to get a block number */ |
u_long pm_bpcluster; /* bytes per cluster */ |
u_long pm_bpcluster; /* bytes per cluster */ |
u_long pm_fmod; /* ~0 if fs is modified, this can rollover to 0 */ |
u_long pm_fmod; /* ~0 if fs is modified, this can rollover to 0 */ |
u_long pm_fatblocksize; /* size of fat blocks in bytes */ |
u_long pm_fatblocksize; /* size of fat blocks in bytes */ |
Line 134 struct msdosfsmount { |
|
Line 130 struct msdosfsmount { |
|
u_int pm_curfat; /* current fat for FAT32 (0 otherwise) */ |
u_int pm_curfat; /* current fat for FAT32 (0 otherwise) */ |
u_int *pm_inusemap; /* ptr to bitmap of in-use clusters */ |
u_int *pm_inusemap; /* ptr to bitmap of in-use clusters */ |
u_int pm_flags; /* see below */ |
u_int pm_flags; /* see below */ |
|
struct netexport pm_export; /* export information */ |
}; |
}; |
/* Byte offset in FAT on filesystem pmp, cluster cn */ |
/* Byte offset in FAT on filesystem pmp, cluster cn */ |
#define FATOFS(pmp, cn) ((cn) * (pmp)->pm_fatmult / (pmp)->pm_fatdiv) |
#define FATOFS(pmp, cn) ((cn) * (pmp)->pm_fatmult / (pmp)->pm_fatdiv) |
Line 161 struct msdosfsmount { |
|
Line 158 struct msdosfsmount { |
|
* Convert pointer to buffer -> pointer to direntry |
* Convert pointer to buffer -> pointer to direntry |
*/ |
*/ |
#define bptoep(pmp, bp, dirofs) \ |
#define bptoep(pmp, bp, dirofs) \ |
((struct direntry *)(((char *)(bp)->b_data) \ |
((struct direntry *)(((bp)->b_data) \ |
+ ((dirofs) & (pmp)->pm_crbomask))) |
+ ((dirofs) & (pmp)->pm_crbomask))) |
|
|
/* |
/* |
* Convert sector number to cluster number |
* Convert block number to cluster number |
*/ |
*/ |
#define de_bn2cn(pmp, bn) \ |
#define de_bn2cn(pmp, bn) \ |
((bn) >> ((pmp)->pm_cnshift - (pmp)->pm_bnshift)) |
((bn) >> ((pmp)->pm_cnshift - (pmp)->pm_bnshift)) |
|
|
/* |
/* |
* Convert cluster number to sector number |
* Convert cluster number to block number |
*/ |
*/ |
#define de_cn2bn(pmp, cn) \ |
#define de_cn2bn(pmp, cn) \ |
((cn) << ((pmp)->pm_cnshift - (pmp)->pm_bnshift)) |
((cn) << ((pmp)->pm_cnshift - (pmp)->pm_bnshift)) |
|
|
/* |
/* |
* Convert sector number to kernel block number |
|
*/ |
|
#define de_bn2kb(pmp, bn) \ |
|
((bn) << ((pmp)->pm_bnshift - DEV_BSHIFT)) |
|
|
|
/* |
|
* Convert kernel block number to sector number |
|
*/ |
|
#define de_kb2bn(pmp, kb) \ |
|
((kb) >> ((pmp)->pm_bnshift - DEV_BSHIFT)) |
|
|
|
/* |
|
* Convert file offset to cluster number |
* Convert file offset to cluster number |
*/ |
*/ |
#define de_cluster(pmp, off) \ |
#define de_cluster(pmp, off) \ |
Line 201 struct msdosfsmount { |
|
Line 186 struct msdosfsmount { |
|
(((size) + (pmp)->pm_bpcluster - 1) >> (pmp)->pm_cnshift) |
(((size) + (pmp)->pm_bpcluster - 1) >> (pmp)->pm_cnshift) |
|
|
/* |
/* |
* Convert file offset to sector number |
* Convert file offset to block number |
*/ |
*/ |
#define de_blk(pmp, off) \ |
#define de_blk(pmp, off) \ |
(de_cn2bn(pmp, de_cluster((pmp), (off)))) |
(de_cn2bn(pmp, de_cluster((pmp), (off)))) |
Line 213 struct msdosfsmount { |
|
Line 198 struct msdosfsmount { |
|
((cn) << (pmp)->pm_cnshift) |
((cn) << (pmp)->pm_cnshift) |
|
|
/* |
/* |
* Convert sector number to file offset |
* Convert block number to file offset |
*/ |
*/ |
#define de_bn2off(pmp, bn) \ |
#define de_bn2off(pmp, bn) \ |
((bn) << (pmp)->pm_bnshift) |
((bn) << (pmp)->pm_bnshift) |
/* |
/* |
* Map a cluster number into a filesystem relative sector number. |
* Map a cluster number into a filesystem relative block number. |
*/ |
*/ |
#define cntobn(pmp, cn) \ |
#define cntobn(pmp, cn) \ |
(de_cn2bn((pmp), (cn)-CLUST_FIRST) + (pmp)->pm_firstcluster) |
(de_cn2bn((pmp), (cn)-CLUST_FIRST) + (pmp)->pm_firstcluster) |
|
|
/* |
/* |
* Calculate sector number for directory entry in root dir, offset dirofs |
* Calculate block number for directory entry in root dir, offset dirofs |
*/ |
*/ |
#define roottobn(pmp, dirofs) \ |
#define roottobn(pmp, dirofs) \ |
(de_blk((pmp), (dirofs)) + (pmp)->pm_rootdirblk) |
(de_blk((pmp), (dirofs)) + (pmp)->pm_rootdirblk) |
|
|
/* |
/* |
* Calculate sector number for directory entry at cluster dirclu, offset |
* Calculate block number for directory entry at cluster dirclu, offset |
* dirofs |
* dirofs |
*/ |
*/ |
#define detobn(pmp, dirclu, dirofs) \ |
#define detobn(pmp, dirclu, dirofs) \ |
Line 249 void msdosfs_done(void); |
|
Line 234 void msdosfs_done(void); |
|
SYSCTL_SETUP_PROTO(sysctl_vfs_msdosfs_setup); |
SYSCTL_SETUP_PROTO(sysctl_vfs_msdosfs_setup); |
#endif /* SYSCTL_SETUP_PROTO */ |
#endif /* SYSCTL_SETUP_PROTO */ |
#endif /* _KERNEL */ |
#endif /* _KERNEL */ |
#endif /* _MSDOSFS_MSDOSFSMOUNT_H_ */ |
|