📄 pcdisk.h
字号:
// File FORMAT.C:
// See end of pcdisk.h for prototypes
// File IDE_DRV.C:
// See ide_drv.h
// RAMDISK/ROMDISK
BOOLEAN ramdisk_io(word driveno, dword block, void KS_FAR *buffer, word count, BOOLEAN reading);
int ramdisk_perform_device_ioctl(int driveno, int opcode, PFVOID pargs);
BOOLEAN romdisk_io(int driveno, dword block, void KS_FAR *buffer, word count, BOOLEAN reading);
int romdisk_perform_device_ioctl(int driveno, int opcode, PFVOID pargs);
BOOLEAN pcmsram_io(word driveno, dword block, void KS_FAR *buffer, word count, BOOLEAN reading);
int pcmsram_perform_device_ioctl(int driveno, int opcode, PFVOID pargs);
BOOLEAN hostdisk_io(word driveno, dword block, void KS_FAR *buffer, word count, BOOLEAN reading);
int hostdisk_perform_device_ioctl(int driveno, int opcode, PFVOID pargs);
// File LOWL.C:
CLUSTERTYPE pc_alloc_chain(DDRIVE *pdr, CLUSTERTYPE *pstart_cluster, CLUSTERTYPE n_clusters);
CLUSTERTYPE pc_find_free_cluster(DDRIVE *pdr, CLUSTERTYPE startpt, CLUSTERTYPE endpt);
CLUSTERTYPE pc_clalloc(DDRIVE *pdr, CLUSTERTYPE clhint);
CLUSTERTYPE pc_clgrow(DDRIVE *pdr, CLUSTERTYPE clno);
CLUSTERTYPE pc_clnext(DDRIVE *pdr, CLUSTERTYPE clno);
void pc_clrelease(DDRIVE *pdr, CLUSTERTYPE clno);
BOOLEAN pc_faxx(DDRIVE *pdr, CLUSTERTYPE clno, CLUSTERTYPE *pvalue);
BOOLEAN pc_flushinfo(DDRIVE *pdr);
BOOLEAN pc_flushfat(int driveno);
void pc_freechain(DDRIVE *pdr, CLUSTERTYPE cluster);
CLUSTERTYPE pc_cl_truncate(DDRIVE *pdr, CLUSTERTYPE cluster, CLUSTERTYPE l_cluster);
CLUSTERTYPE pc_get_chain(DDRIVE *pdr, CLUSTERTYPE start_cluster, CLUSTERTYPE *pnext_cluster, CLUSTERTYPE n_clusters);
BOOLEAN pc_pfaxxterm(DDRIVE *pdr, CLUSTERTYPE clno);
BOOLEAN pc_pfaxx(DDRIVE *pdr, CLUSTERTYPE clno, CLUSTERTYPE value);
PFBYTE pc_pfswap(DDRIVE *pdr, CLUSTERTYPE index, BOOLEAN for_write);
BOOLEAN pc_fword(DDRIVE *pdr, CLUSTERTYPE index, word *pvalue, BOOLEAN putting);
BOOLEAN pc_pfpdword(DDRIVE *pdr, dword index, dword *pvalue);
BOOLEAN pc_pfgdword(DDRIVE *pdr, dword index, dword *value);
BOOLEAN pc_pfflush(DDRIVE *pdr);
BOOLEAN pc_gblk0(word driveno, struct pcblk0 *pbl0);
BOOLEAN pc_clzero(DDRIVE *pdrive, CLUSTERTYPE cluster);
DDRIVE *pc_drno2dr(int driveno);
DDRIVE *pc_drno_to_drive_struct(int driveno);
BOOLEAN pc_dskfree(int driveno);
dword pc_ifree(int driveno);
CLUSTERTYPE pc_sec2cluster(DDRIVE *pdrive, BLOCKT blockno);
word pc_sec2index(DDRIVE *pdrive, BLOCKT blockno);
BLOCKT pc_cl2sector(DDRIVE *pdrive, CLUSTERTYPE cluster);
int ext_partition_init(int driveno, dword *pstart, dword *pend);
CLUSTERTYPE pc_finode_cluster(DDRIVE *pdr, FINODE *finode);
void pc_pfinode_cluster(DDRIVE *pdr, FINODE *finode, CLUSTERTYPE value);
// File MINIEXEC.C:
void pc_report_error(int error_number);
DATESTR *pc_getsysdate(DATESTR *pd);
byte os_floppy_type(int driveno);
// File PCKERNEL.C:
BOOLEAN pc_kernel_init(void);
#if (defined(ERTFS_SA))
void pc_kernel_shutdown(void);
void pc_free_user(void);
//DM: added:
// SPR: added INCLUDE_RTIP
#if (!INCLUDE_RTIP)
void os_exit_task(void);
#endif
#endif
void pc_free_all_users(int driveno);
// File POWMGMT.C
int pcntrl_get_power_count(void);
// File PC_MEMRY.C:
int pc_num_drives(void);
int pc_num_users(void);
int pc_nuserfiles(void);
BOOLEAN pc_validate_driveno(int driveno);
BOOLEAN pc_memory_init(void);
void pc_memory_close(void);
DROBJ *pc_memory_drobj(DROBJ *pobj);
FINODE *pc_memory_finode(FINODE *pinode);
// File UTIL.C:
int pc_parse_raw_drive(char *path);
BOOLEAN pc_allspace(byte *p, int i);
void pc_cppad(byte *to, byte *from, int size);
BOOLEAN pc_isdot(byte *fname, byte *fext);
BOOLEAN pc_isdotdot(byte *fname, byte *fext);
byte *pc_mfile(byte *to, byte *filename, byte *ext);
byte *pc_mpath(byte *to, byte *path, byte *filename);
char *pc_parsedrive(int *driveno, char *path);
BOOLEAN pc_fileparse(char *filename, char *fileext, char *p);
char *pc_nibbleparse(char *filename, char *fileext, char *path);
#if (VFAT)
BOOLEAN pc_parsepath(char *topath, char *filename, char *fileext, char *path);
#else
BOOLEAN pc_parsepath(char *topath, char *filename, char *fileext, char *path);
#endif
#if (VFAT)
BOOLEAN pc_patcmp(byte *pat, byte *name, BOOLEAN dowildcard);
#else
BOOLEAN pc_patcmp(byte *p, byte *pattern, int size, BOOLEAN dowildcard);
#endif
char pc_byte2upper(char c);
void pc_str2upper(char *to, char *from);
void pc_strn2upper(char *to, char *from, int n);
BOOLEAN validate_filename(PFCHAR name, int len);
BOOLEAN pc_valid_sfn(char *filename);
BOOLEAN pc_valid_lfn(char *filename);
BOOLEAN pc_malias(char *fname, char *fext, byte *input_file, DROBJ *dest);
byte pc_cksum(byte *test);
dword to_DWORD ( byte *from);
word to_WORD ( byte *from);
void fr_WORD ( byte *to, word from);
void fr_DWORD ( byte *to, dword from);
#if (defined(ERTFS_SA))
void ARGSUSED_PVOID(PFVOID p);
void ARGSUSED_INT(int i);
int tc_strcpy(PFCHAR targ, PFCCHAR src);
int tc_strcmp(PFCCHAR s1, PFCCHAR s2);
#ifndef tc_comparen
BOOLEAN tc_comparen(PFBYTE a, PFBYTE b, int n);
#endif
#ifndef tc_memset
void tc_memset(PFBYTE p, byte b, int n);
#endif
PFCHAR tc_strcat(PFCHAR targ, PFCCHAR src);
BOOLEAN tc_isdigit(char ch);
int tc_atoi(PFCHAR s);
long tc_atol(PFCHAR s);
#endif /* ERTFS_SA */
int critical_error_handler(int driveno, int media_status, dword sector);
#endif /* INCLUDE_ERTFS */
#if (defined(ERTFS_SA))
/* User structure management */
typedef struct system_user
{
KS_TASK_HANDLE task_handle; // Task this is for
int rtfs_errno; // current errno value for the task
int dfltdrv; // Default drive to use if no drive specified
PFVOID lcwd[10]; // current working enough for 10 drives
} SYSTEM_USER;
typedef struct system_user KS_FAR *PSYSTEM_USER;
// portkern.c
PSYSTEM_USER get_system_user(void);
void pc_free_user(void);
void pc_free_all_users(int driveno);
int set_errno(int error);
int get_errno(void);
#endif
/* Parameter block for formatting: Used by format.c */
typedef struct fmtparms {
char oemname[9]; /* Only first 8 bytes are used */
byte secpalloc; /* Sectors per cluster */
word secreserved; /* Reserved sectors before the FAT */
byte numfats; /* Number of FATS on the disk */
#if (FAT32)
dword secpfat; /* Sectors per fat */
byte fmttype; /* As defined below */
#define FMT_FAT32 0x01
#define FMT_DOS 0x00
#else
word secpfat; /* Sectors per fat */
#endif
dword numhide; /* Hidden sectors */
word numroot; /* Maximum # of root dir entries */
byte mediadesc; /* Media descriptor byte */
word secptrk; /* sectors per track */
word numhead; /* number of heads */
word numcyl; /* number of cylinders */
byte physical_drive_no;
dword binary_volume_label;
char text_volume_label[12];
} FMTPARMS;
/* These opcodes must be supported by the device driver's
perform_device_ioctl() routine.
*/
#define DEVCTL_CHECKSTATUS 0
/* DEVCTL_WARMSTART - Called when RTIP initializes.
When ERTFS initializes it calls xxx_device_ioctl() with this
argument in ascending order for each possible logical device.
The device driver may use this call to perform spin up of the
device or to clear driver specific information. In most cases
this routine can do nothing and simply return zero.
The device driver must return zero. There is no error condition
*/
#define DEVCTL_WARMSTART 1
/* This is called by RTFS when it notices that power has been restored. IE
if current power count is not the same as it was the last time that the
device was accessed. */
#define DEVCTL_POWER_RESTORE 2
/* Called when RTFS when power is going down.
!!! RTFS does not make this call. It is provided as a mechanism
that that system power management system may use to communicate a power
down event to the device driver */
#define DEVCTL_POWER_LOSS 3
/* Perform a low level format on the media. (If required). Return 0 on
success or return a driver specific format error code. ERTFS does not
interpret the error code but it will abort a file system format operation
if anything but zero is returned. */
#define DEVCTL_FORMAT 4
/*
DEVCTL_GET_GEOMETRY - Report back to ertfs the geometry of the
device in the structure pointed to by the arg pointer.
The structure pointed to at parg is of type PDEV_GEOMETRY:
Note: The geometry must be in DOS HCN format. If the device is a
logical block oriented device (where blocks are a contiguous
array of blocks) then the device must convert lba units to HCN units.
The device should return zero if it can report the geometry.
Any other return code will cause ERTFS to abort a file
system format operation.
*/
#define DEVCTL_GET_GEOMETRY 5
typedef struct dev_geometry {
int dev_geometry_heads; //- Must be < 256
dword dev_geometry_cylinders; //- Must be < 1024
int dev_geometry_secptrack; //- Must be < 64
dword dev_geometry_lbas; //- For oversize media
BOOLEAN fmt_parms_valid; //If the device io control call sets this
//TRUE then it it telling the applications
//layer that these format parameters should
//be used. This is a way to format floppy
//disks exactly as they are fromatted by dos.
FMTPARMS fmt;
} DEV_GEOMETRY;
#define DEVCTL_REPORT_REMOVE 6 // this can be called by an external
// interrupt to tell the driver that
// the device has been removed. For
// pcmcia management interrupt calls
// this and the pcmcia aware drivers
// become aware tht they have to re-mount
typedef struct dev_geometry KS_FAR *PDEV_GEOMETRY;
/* These codes are to be returned from the device driver's
perform_device_ioctl() function when presented with
DEVCTL_CHECKSTATUS as an opcode.
*/
#define DEVTEST_NOCHANGE 0 // Status is 'UP'
#define DEVTEST_NOMEDIA 1 // The device is empty
#define DEVTEST_UNKMEDIA 2 // Contains unknown media
#define DEVTEST_CHANGED 3 // Controller recognized and cleared a
// change condition
#define BIN_VOL_LABEL 0x12345678L
#define STR_VOL_LABEL "VOLUMELABE" /* 11 chars max */
#define READ_PARTION_OK 0 // Partition read succesfully
#define READ_PARTION_ERR -1 // Internal error (couldn't allocate buffers ?)
#define READ_PARTION_NO_TABLE -2 // No partition table found
#define READ_PARTION_NO_ENTRY -3 // Request entry not found
#define READ_PARTION_IOERROR -4 // Device IO error
// File FORMAT.C:
// See end of pcdisk.h for prototypes
BOOLEAN pc_get_media_parms(char *path, PDEV_GEOMETRY pgeometry);
BOOLEAN pc_format_media(char *path, PDEV_GEOMETRY pgeometry);
BOOLEAN pc_partition_media(char *path, PDEV_GEOMETRY pgeometry, PFDWORD partition_list);
BOOLEAN pc_format_volume(char *path, PDEV_GEOMETRY pgeometry);
#endif /* __PCDISK__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -