📄 api.h
字号:
// Proto: int kernelTextInputStreamRemove(kernelTextInputStream *); // Desc : Remove one character from the start of the specified input stream. return (sysCall_1(_fnum_textInputStreamRemove, strm));}_X_ static inline int textInputRemove(void){ // Proto: int kernelTextInputRemove(void); // Desc : Remove one character from the start of the default input stream. return (sysCall_0(_fnum_textInputRemove));}_X_ static inline int textInputStreamRemoveN(objectKey strm, int num){ // Proto: int kernelTextInputStreamRemoveN(kernelTextInputStream *, int); // Desc : Remove 'num' characters from the start of the specified input stream. return (sysCall_2(_fnum_textInputStreamRemoveN, strm, (void *) num));}_X_ static inline int textInputRemoveN(int num){ // Proto: int kernelTextInputRemoveN(int); // Desc : Remove 'num' characters from the start of the default input stream. return (sysCall_1(_fnum_textInputRemoveN, (void *) num));}_X_ static inline int textInputStreamRemoveAll(objectKey strm){ // Proto: int kernelTextInputStreamRemoveAll(kernelTextInputStream *); // Desc : Empty the specified input stream. return (sysCall_1(_fnum_textInputStreamRemoveAll, strm));}_X_ static inline int textInputRemoveAll(void){ // Proto: int kernelTextInputRemoveAll(void); // Desc : Empty the default input stream. return (sysCall_0(_fnum_textInputRemoveAll));}_X_ static inline void textInputStreamSetEcho(objectKey strm, int onOff){ // Proto: void kernelTextInputStreamSetEcho(kernelTextInputStream *, int); // Desc : Set echo on (1) or off (0) for the specified input stream. When on, any characters typed will be automatically printed to the text area. When off, they won't. sysCall_2(_fnum_textInputStreamSetEcho, strm, (void *) onOff);}_X_ static inline void textInputSetEcho(int onOff){ // Proto: void kernelTextInputSetEcho(int); // Desc : Set echo on (1) or off (0) for the default input stream. When on, any characters typed will be automatically printed to the text area. When off, they won't. sysCall_1(_fnum_textInputSetEcho, (void *) onOff);}// // Disk functions//_X_ static inline int diskReadPartitions(void){ // Proto: int kernelDiskReadPartitions(void); // Desc : Tells the kernel to (re)read the disk partition tables. return (sysCall_0(_fnum_diskReadPartitions));}_X_ static inline int diskSync(void){ // Proto: int kernelDiskSync(void); // Desc : Tells the kernel to synchronize all the disks, flushing any output. return (sysCall_0(_fnum_diskSync));}_X_ static inline int diskGetBoot(char *name){ // Proto: int kernelDiskGetBoot(char *) // Desc : Get the disk name of the boot device. Normally this will contain the root filesystem. return (sysCall_1(_fnum_diskGetBoot, name));}_X_ static inline int diskGetCount(void){ // Proto: int kernelDiskGetCount(void); // Desc : Get the number of logical disk volumes recognized by the system return (sysCall_0(_fnum_diskGetCount));}_X_ static inline int diskGetPhysicalCount(void){ // Proto: int kernelDiskGetPhysicalCount(void); // Desc : Get the number of physical disk devices recognized by the system return (sysCall_0(_fnum_diskGetPhysicalCount));}_X_ static inline int diskGet(const char *name, disk *userDisk){ // Proto: int kernelDiskGet(const char *, disk *); // Desc : Given a disk name string 'name', fill in the corresponding user space disk structure 'userDisk. return(sysCall_2(_fnum_diskGet, (void *) name, userDisk));}_X_ static inline int diskGetAll(disk *userDiskArray, unsigned buffSize){ // Proto: int kernelDiskGetAll(disk *, unsigned); // Desc : Return user space disk structures in 'userDiskArray' for each logical disk, up to 'buffSize' bytes. return(sysCall_2(_fnum_diskGetAll, userDiskArray, (void *) buffSize));}_X_ static inline int diskGetAllPhysical(disk *userDiskArray, unsigned buffSize){ // Proto: int kernelDiskGetAllPhysical(disk *, unsigned); // Desc : Return user space disk structures in 'userDiskArray' for each physical disk, up to 'buffSize' bytes. return(sysCall_2(_fnum_diskGetAllPhysical, userDiskArray, (void *) buffSize));}_X_ static inline int diskGetPartType(int code, partitionType *p){ // Proto: int kernelDiskGetPartType(int, partitionType *); // Desc : Gets the partition type data for the corresponding code. This function was added specifically by use by programs such as 'fdisk' to get descriptions of different types known to the kernel. return (sysCall_2(_fnum_diskGetPartType, (void *) code, p));}_X_ static inline partitionType *diskGetPartTypes(void){ // Proto: partitionType *kernelDiskGetPartTypes(void); // Desc : Like diskGetPartType(), but returns a pointer to a list of all known types. return ((partitionType *) sysCall_0(_fnum_diskGetPartTypes));}_X_ static inline int diskSetLockState(const char *name, int state){ // Proto: int kernelDiskSetLockState(const char *diskName, int state); // Desc : Set the locked state of the disk 'name' to either unlocked (0) or locked (1) return (sysCall_2(_fnum_diskSetLockState, (void *) name, (void *) state));}_X_ static inline int diskSetDoorState(const char *name, int state){ // Proto: int kernelDiskSetDoorState(const char *, int); // Desc : Open (1) or close (0) the disk 'name'. May require a unlocking the door first, see diskSetLockState(). return (sysCall_2(_fnum_diskSetDoorState, (void *) name, (void *) state));}_X_ static inline int diskGetMediaState(const char *diskName){ // Proto: int kernelDiskGetMediaState(const char *diskName) // Desc : Returns 1 if the removable disk 'diskName' is known to have media present. return (sysCall_1(_fnum_diskGetMediaState, (void *) diskName));}_X_ static inline int diskReadSectors(const char *name, unsigned sect, unsigned count, void *buf){ // Proto: int kernelDiskReadSectors(const char *, unsigned, unsigned, void *) // Desc : Read 'count' sectors from disk 'name', starting at (zero-based) logical sector number 'sect'. Put the data in memory area 'buf'. This function requires supervisor privilege. return (sysCall_4(_fnum_diskReadSectors, (void *) name, (void *) sect, (void *) count, buf));}_X_ static inline int diskWriteSectors(const char *name, unsigned sect, unsigned count, void *buf){ // Proto: int kernelDiskWriteSectors(const char *, unsigned, unsigned, void *) // Desc : Write 'count' sectors to disk 'name', starting at (zero-based) logical sector number 'sect'. Get the data from memory area 'buf'. This function requires supervisor privilege. return (sysCall_4(_fnum_diskWriteSectors, (void *) name, (void *) sect, (void *) count, buf));}//// Filesystem functions//_X_ static inline int filesystemFormat(const char *theDisk, const char *type, const char *label, int longFormat, progress *prog){ // Proto: int kernelFilesystemFormat(const char *, const char *, const char *, int, progress *); // Desc : Format the logical volume 'theDisk', with a string 'type' representing the preferred filesystem type (for example, "fat", "fat16", "fat32, etc). Label it with 'label'. 'longFormat' will do a sector-by-sector format, if supported, and progress can optionally be monitored by passing a non-NULL progress structure pointer 'prog'. It is optional for filesystem drivers to implement this function. return (sysCall_5(_fnum_filesystemFormat, (void *) theDisk, (void *) type, (void *) label, (void *) longFormat, prog));}_X_ static inline int filesystemClobber(const char *theDisk){ // Proto: int kernelFilesystemClobber(const char *); // Desc : Clobber all known filesystem types on the logical volume 'theDisk'. It is optional for filesystem drivers to implement this function. return (sysCall_1(_fnum_filesystemClobber, (void *) theDisk));}_X_ static inline int filesystemCheck(const char *name, int force, int repair, progress *prog){ // Proto: int kernelFilesystemCheck(const char *, int, int, progress *) // Desc : Check the filesystem on disk 'name'. If 'force' is non-zero, the filesystem will be checked regardless of whether the filesystem driver thinks it needs to be. If 'repair' is non-zero, the filesystem driver will attempt to repair any errors found. If 'repair' is zero, a non-zero return value may indicate that errors were found. If 'repair' is non-zero, a non-zero return value may indicate that errors were found but could not be fixed. Progress can optionally be monitored by passing a non-NULL progress structure pointer 'prog'. It is optional for filesystem drivers to implement this function. return (sysCall_4(_fnum_filesystemCheck, (void *) name, (void *) force, (void *) repair, prog));}_X_ static inline int filesystemDefragment(const char *name, progress *prog){ // Proto: int kernelFilesystemDefragment(const char *, progress *) // Desc : Defragment the filesystem on disk 'name'. Progress can optionally be monitored by passing a non-NULL progress structure pointer 'prog'. It is optional for filesystem drivers to implement this function. return (sysCall_2(_fnum_filesystemDefragment, (void *) name, prog));}_X_ static inline int filesystemMount(const char *name, const char *mp){ // Proto: int kernelFilesystemMount(const char *, const char *) // Desc : Mount the filesystem on disk 'name', using the mount point specified by the absolute pathname 'mp'. Note that no file or directory called 'mp' should exist, as the mount function will expect to be able to create it. return (sysCall_2(_fnum_filesystemMount, (void *) name, (void *) mp));}_X_ static inline int filesystemUnmount(const char *mp){ // Proto: int kernelFilesystemUnmount(const char *); // Desc : Unmount the filesystem mounted represented by the mount point 'fs'. return (sysCall_1(_fnum_filesystemUnmount, (void *)mp));}_X_ static inline int filesystemGetFree(const char *fs){ // Proto: unsigned kernelFilesystemGetFree(const char *); // Desc : Returns the amount of free space on the filesystem represented by the mount point 'fs'. return (sysCall_1(_fnum_filesystemGetFree, (void *) fs));}_X_ static inline unsigned filesystemGetBlockSize(const char *fs){ // Proto: unsigned kernelFilesystemGetBlockSize(const char *); // Desc : Returns the block size (for example, 512 or 1024) of the filesystem represented by the mount point 'fs'. return (sysCall_1(_fnum_filesystemGetBlockSize, (void *) fs));}//// File functions//_X_ static inline int fileFixupPath(const char *orig, char *new){ // Proto: int kernelFileFixupPath(const char *, char *); // Desc : Take the absolute pathname in 'orig' and fix it up. This means eliminating extra file separator characters (for example) and resolving links or '.' or '..' components in the pathname. return (sysCall_2(_fnum_fileFixupPath, (void *) orig, new));}_X_ static inline int fileSeparateLast(const char *origPath, char *pathName, char *fileName){ // Proto: int kernelFileSeparateLast(const char *, char *, char *); // Desc : This function will take a combined pathname/filename string and separate the two. The user will pass in the "combined" string along with two pre-allocated char arrays to hold the resulting separated elements. return (sysCall_3(_fnum_fileSeparateLast, (char *) origPath, pathName, fileName));}_X_ static inline int fileGetDisk(const char *path, disk *d){ // Proto: int kernelFileGetDisk(const char *, disk *); // Desc : Given the file name 'path', return the user space structure for the logical disk that the file resides on. return (sysCall_2(_fnum_fileGetDisk, (void *) path, (void *) d));}_X_ static inline int fileCount(const char *path){ // Proto: int kernelFileCount(const char *); // Desc : Get the count of file entries from the directory referenced by 'path'. return (sysCall_1(_fnum_fileCount, (void *) path));}_X_ static inline int fileFirst(const char *path, file *f){ // Proto: int kernelFileFirst(const char *, file *); // Desc : Get the first file from the directory referenced by 'path'. Put the information in the file structure 'f'. return (sysCall_2(_fnum_fileFirst, (void *) path, (void *) f));}_X_ static inline int fileNext(const char *path, file *f){ // Proto: int kernelFileNext(const char *, file *); // Desc : Get the next file from the directory referenced by 'path'. 'f' should be a file structure previously filled by a call to either fileFirst() or fileNext(). return (sysCall_2(_fnum_fileNext, (void *) path, (void *) f));}_X_ static inline int fileFind(const char *name, file *f){ // Proto: int kernelFileFind(const char *, kernelFile *); // Desc : Find the file referenced by 'name', and fill the file data structure 'f' with the results if successful. return (sysCall_2(_fnum_fileFind, (void *) name, (void *) f));}_X_ static inline int fileOpen(const char *name, int mode, file *f){ // Proto: int kernelFileOpen(const char *, int, file *); // Desc : Open the file referenced by 'name' using the file open mode 'mode' (defined in <sys/file.h>). Update the file data structure 'f' if successful. return (sysCall_3(_fnum_fileOpen, (void *) name, (void *) mode, (void *) f));}_X_ static inline int fileClose(file *f){ // Proto: int kernelFileClose(const char *, file *); // Desc : Close the previously opened file 'f'. return (sysCall_1(_fnum_fileClose, (void *) f));}_X_ static inline int fileRead(file *f, unsigned blocknum, unsigned blocks, unsigned char *buff){ // Proto: int kernelFileRead(file *, unsigned int, unsigned int, unsigned char *); // Desc : Read data from the previously opened file 'f'. 'f' should have been opened in a read or read/write mode. Read 'blocks' blocks (see the filesystem functions for information about getting the block size of a given filesystem) and put them in buffer 'buff'.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -