⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 api.h

📁 上一个上传的有问题,这个是好的。visopsys包括系统内核和GUI的全部SOURCE code ,还包括一些基本的docs文档。里面src子目录对应所有SOURCE code.对于想研究操作系统的朋
💻 H
📖 第 1 页 / 共 5 页
字号:
_X_ static inline int diskSync(const char *name){  // Proto: int kernelDiskSync(const char *);  // Desc : Tells the kernel to synchronize  the named disk, flushing any output.    return (syscall_1(_fnum_diskSync, name));}_X_ static inline int diskSyncAll(void){  // Proto: int kernelDiskSyncAll(void);  // Desc : Tells the kernel to synchronize all the disks, flushing any output.  return (syscall_0(_fnum_diskSyncAll));}_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 diskGetFilesystemType(const char *name, char *buf, unsigned bufSize){  // Proto: int kernelDiskGetFilesystemType(const char *, char *, unsigned);  // Desc : This function attempts to explicitly detect the filesystem type on disk 'name', and copy up to 'bufSize' bytes of the filesystem type name into 'buf'.  Particularly useful for things like removable media where the correct info may not be automatically provided in the disk structure.  return (syscall_3(_fnum_diskGetFilesystemType, (void *) name, buf,		    (void *) bufSize));}_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.  The memory is allocated dynamically and should be deallocated with a call to memoryRelease()  return ((partitionType *) syscall_0(_fnum_diskGetPartTypes));}_X_ static inline int diskSetFlags(const char *name, unsigned flags, int set){  // Proto: int kernelDiskSetFlags(const char *, unsigned, int);  // Desc : Set or clear the (user-settable) disk flags bits in 'flags' of the disk 'name'.  return (syscall_3(_fnum_diskSetFlags, (void *) name, (void *) flags,		    (void *) set));}_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, const void *buf){  // Proto: int kernelDiskWriteSectors(const char *, unsigned, unsigned, const 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, (void *) buf));}_X_ static inline int diskEraseSectors(const char *name, unsigned sect, unsigned count, int passes){  // Proto: int kernelDiskEraseSectors(const char *, unsigned, unsigned, int);  // Desc : Synchronously and securely erases disk sectors.  It writes ('passes' - 1) successive passes of random data followed by a final pass of NULLs, to disk 'name' starting at (zero-based) logical sector number 'sect'.  This function requires supervisor privilege.  return (syscall_4(_fnum_diskEraseSectors, (void *) name, (void *) sect,		    (void *) count, (void *) passes));}_X_ static inline int diskGetStats(const char *name, diskStats *stats){  // Proto: int kernelDiskGetStats(const char *, diskStats *);  // Desc: Return performance stats about the disk 'name' (if non-NULL,  // otherwise about all the disks combined).  return (syscall_2(_fnum_diskGetStats, (void *) name, stats));}//// 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, (void *) 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, (void *) 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, (void *) prog));}_X_ static inline int filesystemResizeConstraints(const char *name, unsigned *minBlocks, unsigned *maxBlocks){  // Proto: int kernelFilesystemResizeConstraints(const char *, unsigned *, unsigned *);  // Desc : Get the minimum ('minBlocks') and maximum ('maxBlocks') number of blocks for a filesystem resize on disk 'name'.  It is optional for filesystem drivers to implement this function.  return (syscall_3(_fnum_filesystemResizeConstraints, (void *) name,		    (void *) minBlocks, (void *) maxBlocks));}_X_ static inline int filesystemResize(const char *name, unsigned blocks, progress *prog){  // Proto: int kernelFilesystemResize(const char *, unsigned, progress *);  // Desc : Resize the filesystem on disk 'name' to the given number of blocks 'blocks'.  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_3(_fnum_filesystemResize, (void *) name, (void *) blocks,		    (void *) 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 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));}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -