📄 phile.h
字号:
/***********************************************************************//* *//* MODULE: phile.h 1.4 *//* DATE: 18:29:31 - 98/09/23 *//* PURPOSE: Structure definitions, function prototypes, and *//* symbol definitions for pHILE+ *//* *//*---------------------------------------------------------------------*//* *//* Copyright 1991 - 1995, Integrated Systems, Inc. *//* ALL RIGHTS RESERVED *//* *//* Permission is hereby granted to licensees of Integrated Systems, *//* Inc. products to use or abstract this computer program for the *//* sole purpose of implementing a product based on Integrated *//* Systems, Inc. products. No other rights to reproduce, use, *//* or disseminate this computer program, whether in part or in *//* whole, are granted. *//* *//* Integrated Systems, Inc. makes no representation or warranties *//* with respect to the performance of this computer program, and *//* specifically disclaims any responsibility for any damages, *//* special or consequential, connected with the use of this program. *//* *//***********************************************************************/#if defined(__cplusplus)extern "C" {#endif/*---------------------------------------------------------------------*//* Don't allow this file to be included more than once. *//*---------------------------------------------------------------------*/#ifndef _PHILE_H#define _PHILE_H/***********************************************************************//* General Definitions *//***********************************************************************/#include <types.h>/***********************************************************************//* pHILE+ Structure Definitions *//***********************************************************************//*---------------------------------------------------------------------*//* init_vol() Parameter Structure *//*---------------------------------------------------------------------*/typedef struct init_vol_params { char volume_label[12]; ULONG volume_size; ULONG num_of_file_descriptors; ULONG starting_bitmap_block_number; ULONG starting_data_block_number; } INIT_VOL_PARAMS;/*---------------------------------------------------------------------*//* verify_vol() Fault Descriptor Block Structure *//*---------------------------------------------------------------------*/typedef struct fault_desc_block { ULONG fdb_code; ULONG fdb_fn1; ULONG fdb_fn2; char *fdb_path1; char *fdb_path2; ULONG fdb_bn; ULONG fdb_fixable; } FAULT_DESC_BLOCK;/*---------------------------------------------------------------------*//* verify_vol() Parameter Structure *//*---------------------------------------------------------------------*/typedef struct verify_vol_params { void *pb_dataptr; ULONG pb_datalen; ULONG pb_maxdepth; FAULT_DESC_BLOCK *pb_fdbptr; ULONG (*pb_faultp)(); ULONG *pb_badblkptr; } VERIFY_VOL_PARAMS;/*---------------------------------------------------------------------*//* nfsmount_vol() Parameter Structure *//*---------------------------------------------------------------------*/typedef struct nfsmount_vol_params { ULONG ipaddr; char *pathname; ULONG flags; ULONG reserved[6]; } NFSMOUNT_VOL_PARAMS;/*---------------------------------------------------------------------*//* Device Driver Buffer Header Structure *//*---------------------------------------------------------------------*/typedef struct buffer_header { ULONG b_device; ULONG b_blockno; USHORT b_flags; USHORT b_bcount; void *b_devforw; void *b_devback; void *b_avlforw; void *b_avlback; void *b_bufptr; void *b_bufwaitf; void *b_bufwaitb; void *b_volptr; USHORT b_blksize; USHORT b_dsktype; } BUFFER_HEADER;/***********************************************************************//* Readdir() directory entry *//***********************************************************************/#define MAXNAMLEN 255typedef struct XDIR { int dd_fd; /* file descriptor */ long dd_loc; /* buf offset of entry from last readdir() */ long dd_size; /* amount of valid data in buffer */ long dd_bsize; /* amount of entries read at a time */ long dd_off; /* current offset in dir */ char *dd_buf; /* directory data buffer pointer */ char dd_buffer[300]; /* directory data buffer */} XDIR; struct dirent { unsigned long d_filno; char d_name[MAXNAMLEN+1]; }; typedef unsigned long mode_t;typedef unsigned long ino_t;typedef unsigned long dev_t;typedef unsigned long nlink_t;typedef unsigned long uid_t;typedef unsigned long gid_t;typedef unsigned long off_t;typedef unsigned long time_t; /***********************************************************************//* utimes() access and modification times *//***********************************************************************/struct utimbuf { time_t actime; time_t modtime; }; /***********************************************************************//* stat_f(): read status of a file; *//* stat_vfs(): read statistics of a file system. *//***********************************************************************/struct stat { mode_t st_mode; /* ownership/protection */ ino_t st_ino; /* file id */ dev_t st_dev; /* file system id */ dev_t st_rdev; nlink_t st_nlink; /* number of links */ uid_t st_uid; /* user id */ gid_t st_gid; /* group id */ off_t st_size; /* file size in # of bytes */ time_t st_atime; /* time file was last accessed */ time_t st_mtime; /* time file was last modified */ time_t st_ctime; /* time file status was last changed */ unsigned long st_blksize; /* block size */ unsigned long st_blocks; /* file size in # of blocks */}; typedef struct { long val[2]; } fsid_t;#define FSTYPSZ 16#define FSSTRSZ 32 struct statvfs { unsigned long f_bsize; /* preferred file system block size */ unsigned long f_frsize; /* fundamental fs block size */ unsigned long f_blocks; /* total blocks in the volume */ unsigned long f_bfree; /* free blocks */ unsigned long f_bavail; /* free blocks available to non-super-user */ unsigned long f_files; /* total file nodes in file system */ unsigned long f_ffree; /* free file nodes in volume */ unsigned long f_favail; /* free file nodes to non-super-user */ fsid_t vol_fsid; /* volume (file system) id */ char f_basetype[FSTYPSZ]; /* target fs type name, null terminated */ unsigned long f_flag; /* bit mask of flags */ unsigned long f_namemax; /* maximum specific string */ char f_fstr[FSSTRSZ]; /* file system specific string */ unsigned long f_fstype; /* file system type number */ unsigned long f_filler[15]; /* reserved for future expansion */ }; /***********************************************************************//* pHILE+ System Calls (defined in fim.s) *//***********************************************************************/ULONG access_f(char *name, int mode);ULONG annex_f(ULONG fid, ULONG alloc_size, ULONG *blkcount);ULONG cdmount_vol(char *device, ULONG sync_mode);ULONG change_dir(char *name);ULONG chmod_f(char *name, int mode);ULONG chown_f(char *name, int owner, int group);ULONG close_dir(XDIR *dir);ULONG close_f(ULONG fid);ULONG create_f(char *name, ULONG expand_unit, ULONG mode);ULONG fchmod_f(ULONG fid, int mode);ULONG fchown_f(ULONG fid, int owner, int group);ULONG fstat_f(ULONG fid, struct stat *buf);ULONG fstat_vfs(ULONG fid, struct statvfs *buf);ULONG ftruncate_f(ULONG fid, ULONG length);ULONG get_fn(char *name, ULONG *fn);ULONG init_vol(char *dev, INIT_VOL_PARAMS *parameters, void *scratchbuf);ULONG link_f(char *name1, char *name2);ULONG lock_f(ULONG fid, ULONG startpos, ULONG bcount);ULONG lseek_f(ULONG fid, ULONG position, long offset, ULONG *old_ptr);ULONG lstat_f(char *name, struct stat *buf);ULONG make_dir(char *name, ULONG mode);ULONG mount_vol(char *device, ULONG sync_mode);ULONG move_f(char *oldname, char *newname);ULONG nfsmount_vol(char *device, NFSMOUNT_VOL_PARAMS *nfs_parms);ULONG open_dir(char *dirname, XDIR *dir);ULONG open_f(ULONG *fid, char *name, ULONG mode);ULONG open_fn(ULONG *fid, char *device, ULONG fn, ULONG mode);ULONG pcinit_vol(char *device, void *scratch_buf, ULONG dktype);ULONG pcmount_vol(char *device, ULONG sync_mode);ULONG read_dir(XDIR *dir, struct dirent *buf);ULONG read_f(ULONG fid, void *buffer, ULONG bcount, ULONG *tcount);ULONG read_link(char *name, char *buf, ULONG *bufsize);ULONG read_vol(char *device, ULONG block, ULONG index, ULONG bcount, void *buffer);ULONG remove_f(char *name);ULONG stat_f(char *name, struct stat *buf);ULONG stat_vfs(char *name, struct statvfs *buf);ULONG symlink_f(char *name1, char *name2);ULONG sync_vol(char *device);ULONG truncate_f(char *name, ULONG length);ULONG unmount_vol(char *device);ULONG utime_f(char *name, struct utimbuf *times);ULONG verify_vol(char *device, VERIFY_VOL_PARAMS *parameters);ULONG write_f(ULONG fid, void *buffer, ULONG bcount);ULONG write_vol(char *device, ULONG block, ULONG index, ULONG bcount, void *buffer);/***********************************************************************//* pHILE+ Symbol Definitions *//***********************************************************************//***********************************************************************//* stat_f(): read status of a file; *//* stat_vfs(): read statistics of a file system. *//***********************************************************************/#define _IFMT 0170000 /* type of file */#define _IFDIR 0040000 /* directory */#define _IFCHR 0020000 /* character special */#define _IFBLK 0060000 /* block special */#define _IFREG 0100000 /* regular */#define _IFLNK 0120000 /* symbolic link */#define _IFSOCK 0140000 /* named socket */ #define S_ISBLK(m) (((m)&_IFMT) == _IFBLK)#define S_ISCHR(m) (((m)&_IFMT) == _IFCHR)#define S_ISDIR(m) (((m)&_IFMT) == _IFDIR)#define S_ISREG(m) (((m)&_IFMT) == _IFREG)#define S_ISLNK(m) (((m)&_IFMT) == _IFLNK)#define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -