?? linux.hhf
字號:
// Constants for fcntl f_dupfd := 0; f_getfd := 1; f_setfd := 2; f_getfl := 3; f_setfl := 4; f_getlk := 5; f_setlk := 6; f_setlkw := 7; f_setown := 8; f_getown := 9; f_setsig := 10; f_getsig := 11; f_getlk64 := 12; f_setlk64 := 13; f_setlkw64 := 14; fd_cloexec := 1; f_rdlck := 0; f_wrlck := 1; f_unlck := 2; f_exlck := 4; f_shlck := 8; f_inprogress := 16; f_linux_specific_base := 1024;type // Lock data structures: flock_t:record l_type :word; l_whence :word; l_start :off_t; l_len :off_t; l_pid :pid_t; align(4); endrecord; flock64:record l_type :word; l_whence :word; l_start :loff_t; l_len :loff_t; l_pid :pid_t; align(4); endrecord; end linux;#endif //fcntl_hhf#if( !@defined( unistd_hhf ))?unistd_hhf := true;namespace linux; //@fast;const // Constants for the lseek calls: seek_set := 0; set_seek := seek_set; seek_cur := 1; cur_seek := seek_cur; seek_end := 2; end_seek := seek_end; end linux;#endif //unistd_hhf#if( !@defined( syscall_hhf ))?syscall_hhf := true;#if( !@defined( dirent_hhf ))?dirent_hhf := true;namespace linux; //@fast;type dirent: record d_ino :dword; d_off :off_t; d_reclen:uns16; d_name :char[256]; align(4); endrecord; dirent64: record d_ino :qword; d_off :qword; d_reclen:uns16; d_type :byte; d_name :char[256]; endrecord; end linux;#endif //dirent_hhf#if( !@defined( sysctl_hhf ))?sysctl_hhf := true;namespace linux; //@fast;type __sysctl_args: record theName :pointer to char; nlen :int32; oldval :dword; oldlenp :pointer to size_t; newval :dword; newlen :size_t; __unused :dword[4]; endrecord;end linux;#endif //sysctl_hhf#if( !@defined( utsname_hhf ))?utsname_hhf := true;namespace linux; //@fast;type utsname: record sysname :char[65]; nodename :char[65]; release :char[65]; version :char[65]; machine :char[65]; domainname :char[65]; endrecord; end linux;#endif //utsname_hhf#if( !@defined( kernel_hhf ))?kernel_hhf := true;#if( !@defined( fs_hhf ))?fs_hhf := true;#if( !@defined( quota_hhf ))?quota_hhf := true;namespace linux; //@fast;const // quotactl constants: max_iq_time := 7*24*60*60; // 1 week; max_dq_time := 7*24*60*60; maxquotas := 2; usrquota := 0; grpquota := 1; subcmdmask := $ff; subcmdshift := 8; q_quotaon := $100; q_quotaoff := $200; q_getquota := $300; q_setquota := $400; q_setuse := $500; q_sync := $600; q_setqlim := $700; q_getstats := $800; q_rsquash := $1000; #macro qcmd( cmd, typ ); (((cmd) << linux.subcmdshift ) | ((typ) & linux.sumcmdmask)) #endmacroend linux;#endif //quota_hhfnamespace linux; //@fast;const // Filesystem constants nr_open := 1024*1024; inr_open := 1024; block_size_bits := 10; block_size := 1 << block_size_bits; maxpathlen := 1024; max_iovec := 10; nr_file := 8192; nr_reserved_files := 10; nr_super := 256; may_exec := 1; may_write := 2; may_read := 4; fmode_read := 1; fmode_write := 2; fs_read := 0; fs_write := 1; fs_reada := 2; fs_special := 4; sel_in := 1; sel_out := 2; sel_ex := 4; fs_requires_dev := 1; fs_no_dcache := 2; fs_no_prelim := 4; fs_single := 8; fs_nomount := 16; fs_litter := 32; fs_odd_rename := 32768; ms_rdonly := 1; ms_nosuid := 2; ms_nodev := 4; ms_noexec := 8; ms_synchronous := 16; ms_remount := 32; ms_mandlock := 64; ms_noatime := 1024; ms_nodiratime := 2048; ms_bind := 4096; ms_rmt_mask := ms_rdonly | ms_nosuid | ms_nodev | ms_noexec | ms_synchronous | ms_mandlock | ms_noatime | ms_nodiratime; ms_mgc_val := $c0ed_0000; ms_mgc_mask := $ffff_0000; s_sync := 1; s_noatime := 2; s_quota := 4; s_append := 8; s_immutable := 16; s_dead := 32; type address_space: record clean_pages :list_head; dirty_pages :list_head; locked_pages:list_head; nrpages :dword; page_lock :spinlock_t; a_ops :dword; // pointer to address_space_operations host :dword; // pointer to inode; i_mmap :dword; // pointer to vm_area_struct i_mmap_shared :dword; // pointer to vm_area_struct i_shared_lock :spinlock_t; gfp_mask :dword; endrecord; statfs_t:record f_type :dword; f_bsize :dword; f_blocks :dword; f_bfree :dword; f_bavail :dword; f_files :dword; f_ffree :dword; f_fsid :__kernel_fsid_t; f_namelen :dword; f_frsize :dword; f_spare :dword[4]; align(4); endrecord; statfs64_t:record f_type :dword; f_bsize :dword; f_blocks :qword; f_bfree :qword; f_bavail :qword; f_files :qword; f_ffree :qword; f_fsid :__kernel_fsid_t; f_namelen :dword; f_frsize :dword; f_spare :dword[5]; align(4); endrecord; ustat_t: record f_tfree :__kernel_daddr_t; f_tinode :__kernel_ino_t; f_fname :char[6]; f_fpack :char[6]; align( 4 ); endrecord; #if( @defined( __kernel__ )) // Kernel file owner structure: fown_struct: record pid :dword; uid :uid_t; align(4); euid :uid_t; align(4); signum :dword; endrecord; // Kernel file structure: file: record f_list :list_head; f_dentry :dword; //pointer to dentry. f_vfsmnt :dword; //pointer to vfsmount. f_op :dword; //pointer to file_operations. f_count :atomic_t; f_flags :dword; f_mode :mode_t; align(4); f_pos :loff_t; freada :dword; framax :dword; fraend :dword; fralen :dword; frawin :dword; f_owner :fown_struct; f_uid :dword; f_gid :dword; f_error :int32; f_version :dword; private_data:dword; endrecord; // file_operations record for drivers: file_operations:record owner :dword; // Pointer to module_t; llseek :procedure ( file :dword; // Pointer to file offset :qword; // 64-bit offset whence :dword // Type of seek. ); @cdecl; read :procedure ( file :dword; // Pointer to file buf :dword; // Buffer address. size :dword; // Size of transfer var offset :qword // Store new ofs here. ); @cdecl; write :procedure ( file :dword; // Pointer to file buf :dword; // Buffer address. size :dword; // Size of transfer var offset :qword // Store new ofs here. ); @cdecl; readdir :procedure ( file :dword; // Pointer to file. buf :dword; // data buffer. count :dword // ignored (?) ); @cdecl; poll :procedure ( file:dword; poll_table_struct:dword ); @cdecl; _ioctl :procedure( inode:dword; file:dword ); @cdecl; mmap :procedure ( file:dword; // pointer to file vmas:dword // pointer to vm_area_struct ); @cdecl; open :procedure ( inod :dword; //pointer to inode file :dword //pointer to file ); @cdecl; flush :procedure ( file :dword //pointer to file ); @cdecl; release :procedure ( inod :dword; //pointer to inode file :dword //pointer to file ); fsync :procedure ( inod :dword; //pointer to inode de :dword; //pointer to dentry datasync:dword ); @cdecl; fasync :procedure ( fd :dword; //file descriptor file :dword; //pointer to file on :dword ); @cdecl; lock :procedure ( file :dword; //file pointer typ :dword; filock :dword //pointer to file_lock ); @cdecl; readv :procedure ( file :dword; //pointer to file iov :dword; //pointer to iovec count :dword; offs :dword ); @cdecl; writev :procedure ( file :dword; //pointer to file iov :dword; //pointer to iovec count :dword; offs :dword ); @cdecl; // New entries I haven't yet looked up: sendpage :procedure ( file :dword; // Pointer to file. thePage :dword; // Pointer to page struct. pgNum :dword; // ??? size :dword; var offset :qword ); get_unmapped_area: procedure ( file :dword; u1 :dword; u2 :dword; u3 :dword; u4 :dword ); endrecord; // The fileops_c macro allows the user to create // a file_operations record constant whose fields // are specified by name rather than position, e.g., // // linux.fileops_c // ( // read:&readproc, // open:&openproc, // release:&releaseproc, // llseek:&llseekproc // ); // // Entries that are absent in the list are filled with NULLs. // The entries may appear in any order. // // Using this macro rather than a file_operations record // constant to initialize a file_operations variable helps // reduce maintenence of your driver when the file_operations // record structure changes (as it does every now and then). const _fops_fields:= @localsyms( file_operations ); #macro fileops_c(__ops[]): __opsIndex, __exit, __syntaxError, __namesIndex, __maxIndex, __maxNames, __curLine, __curVal, __curName, __curField, __thisField; // This is a file_operations record constant, so output // some syntax to begin the constant: linux.file_operations:[ // Now generate the "guts" for this constant: ?__curVal :string; ?__curName :string; ?__maxIndex := @elements( __ops ); ?__maxNames := @elements( linux._fops_fields ); ?__namesIndex := 0; ?__syntaxError := false; #while( __namesIndex < __maxNames & !__syntaxError ) ?__curField := linux._fops_fields[ __namesIndex ]; ?__opsIndex := 0; ?__exit := false; ?__thisField := "NULL"; #while( __opsIndex < __maxIndex & !__exit ) ?__curLine :string := __ops[ __opsIndex ]; ?__exit := @uptoChar ( __curLine, ':', __curVal, __curName ); #if( !__exit ) #error ( "Syntax error in file_operations constant: "+ __curLine ) ?__exit := true; ?__syntaxError := true; #else ?__curName := @trim( __curName, 0 ); ?__exit := __curName = __curField; #if( __exit ) ?__thisField := @substr( __curVal, 1, 1024 ); #endif #endif ?__opsIndex += 1; #endwhile // If not the first table entry, emit a comma: #if( __namesIndex <> 0 ) , #endif // emit the table entry: @text( __thisField ) ?__namesIndex += 1; #endwhile // Okay, close up the constant: ] // Now, to be on the safe side, verify that there // weren't any extra fields in the parameter list: ?__opsIndex := 0; #while( __opsIndex < __maxIndex & !__syntaxError ) ?__namesIndex := 0; ?__exit := false; #while( __namesIndex < __maxNames & !__exit ) ?__exit := @uptoChar ( __ops[ __opsIndex ], ':', __curVal, __curName ); ?__curName := @trim( __curName, 0 ); ?__exit := __curName = linux._fops_fields[ __namesIndex ]; ?__namesIndex += 1; #endwhile #if( !__exit ) #error ( "Unexpected field in fileops_c (" + __curName + ")" ) #endif ?__opsIndex += 1; #endwhile #endmacro type //?ext3_fragments := @global:true; //?ext3_preallocate := @global:true; ext3_inode_info: record i_data :dword[15]; i_flags :dword; #if( @defined( ext3_fragments )) i_faddr :dword; i_frag_no :byte; i_frag_size :byte; i_osync :word; #endif i_file_acl :dword; i_dir_acl :dword; i_dtime :dword; i_block_group :dword; i_state :dword; i_next_alloc_block :dword; i_next_alloc_goal :dword; #if( @defined( ext3_preallocate )) i_prealloc_block :dword; i_prealloc_count :dword; #endif i_orphan :list_head; i_disksize :loff_t; truncate_sem :rw_semaphore; endrecord; ext2_inode_info: record i_data :dword[15]; i_flags :dword; i_faddr :dword; i_frag_no :byte; i_frag_size :byte; i_osync :word; i_file_acl :dword; i_dir_acl :dword; i_dtime :dword; i_block_group :dword; i_next_alloc_block :dword; i_next_alloc_goal :dword; i_prealloc_block :dword; i_prealloc_count :dword; i_new_node :dword; endrecord; inode: record i_hash :list_head; i_list :list_head; i_dentry :list_head; i_dirty_buffers :list_head; i_no :dword; i_count :atomic_t; i_dev :kdev_t; i_mode :umode_t; i_nlink :nlink_t; align(4); i_uid :uid_t; align(4); i_gid :gid_t; align(4); i_rdev :kdev_t; align(4); i_size :loff_t; i_atime :time_t; i_mtime :time_t; i_ctime :time_t; i_blksize :dword; i_blocks :dword; i_version :dword;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -