資源簡介
一個操作系統的實現 全部源代碼 于淵
代碼片段和文件信息
/*************************************************************************//**
?*****************************************************************************
?*?@file???disklog.c
?*?@brief??
?*?@author?Forrest?Y.?Yu
?*?@date???Thu?Nov?20?16:22:45?2008
?*****************************************************************************
?*****************************************************************************/
#include?“type.h“
#include?“config.h“
#include?“stdio.h“
#include?“const.h“
#include?“protect.h“
#include?“string.h“
#include?“fs.h“
#include?“proc.h“
#include?“tty.h“
#include?“console.h“
#include?“global.h“
#include?“keyboard.h“
#include?“proto.h“
#include?“hd.h“
#include?“fs.h“
#define?DISKLOG_RD_SECT(devsect_nr)?rw_sector(DEV_READ?\
???????dev \
???????(sect_nr)?*?SECTOR_SIZE \
???????SECTOR_SIZE?/*?read?one?sector?*/?\
???????getpid() \
???????logdiskbuf);
#define?DISKLOG_WR_SECT(devsect_nr)?rw_sector(DEV_WRITE?\
???????dev \
???????(sect_nr)?*?SECTOR_SIZE \
???????SECTOR_SIZE?/*?write?one?sector?*/?\
???????getpid() \
???????logdiskbuf);
/*?/\*****************************************************************************?*/
/*??*????????????????????????????????do_disklog?*/
/*??*****************************************************************************\/?*/
/*?/\**?*/
/*??*?Perform?syslog()?system?call?.?*/
/*??*?*/
/*??*?@return??*/
/*??*****************************************************************************\/?*/
/*?PUBLIC?int?do_disklog()?*/
/*?{?*/
/*? char?buf[STR_DEFAULT_LEN];?*/
/*? /\*?get?parameters?from?the?message?*\/?*/
/*? int?str_len?=?fs_msg.CNT; /\*?length?of?filename?*\/?*/
/*? int?src?=?fs_msg.source; /\*?caller?proc?nr.?*\/?*/
/*? assert(str_len?/*? phys_copy((void*)va2la(TASK_FS?buf)????/\*?to???*\/?*/
/*? ??(void*)va2la(src?fs_msg.BUF)?/\*?from?*\/?*/
/*? ??str_len);?*/
/*? buf[str_len]?=?0; /\*?terminate?the?string?*\/?*/
/*? return?disklog(buf);?*/
/*?}?*/
/*****************************************************************************
?*????????????????????????????????disklog
?*****************************************************************************/
/**
?*??Write?log?string?directly?into?disk.
?*?
?*?@param?p??Ptr?to?the?MESSAGE.
?*****************************************************************************/
PUBLIC?int?disklog(char?*?logstr)
{
int?device?=?root_inode->i_dev;
struct?super_block?*?sb?=?get_super_block(device);
int?nr_log_blk0_nr?=?sb->nr_sects?-?NR_SECTS_FOR_LOG;?/*?0x9D41-0x800=0x9541?*/
static?int?pos?=?0;
if?(!pos)?{?/*?first?time?invoking?this?routine?*/
#ifdef?SET_LOG_SECT_SMAP_AT_STARTUP
/*
?*?set?sector-map?so?that?other?files?cannot?use?the?log?sectors
?*/
int?bits_per_sect?=?SECTOR_SIZE?*?8;?/*?4096?*/
int?smap_blk0_nr?=?1?+?1?+?sb->nr_imap_sects;?/*?3?*/
int?sect_nr??=?smap_blk0_nr?+?nr_log_blk0_nr?/?bits_per_sect;?/*?3+9=12?*/
int?byte_off?=?(nr_log
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????1474560??2009-03-30?16:16??于淵操作系統光盤\chapter1\a\a.img
?????文件????????661??2009-03-30?16:16??于淵操作系統光盤\chapter1\a\bochsrc
?????文件????????563??2009-03-30?16:16??于淵操作系統光盤\chapter1\a\boot.asm
?????文件????1474560??2009-03-30?16:16??于淵操作系統光盤\chapter1\b\a.img
?????文件????????661??2009-03-30?16:16??于淵操作系統光盤\chapter1\b\bochsrc
?????文件????????821??2009-03-30?16:16??于淵操作系統光盤\chapter1\b\boot.asm
?????文件??????81567??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\80m.img.gz
?????文件????1474560??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\a.img
?????文件???????1000??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\bochsrc
?????文件??????10018??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\boot\boot.asm
?????文件???????2222??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\boot\include\fat12hdr.inc
?????文件???????1552??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\boot\include\load.inc
?????文件??????13873??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\boot\include\pm.inc
?????文件??????29754??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\boot\loader.asm
?????文件??????25149??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\fs\disklog.c
?????文件???????6075??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\fs\li
?????文件??????16086??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\fs\main.c
?????文件???????3923??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\fs\misc.c
?????文件??????11610??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\fs\open.c
?????文件???????3777??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\fs\read_write.c
?????文件???????2897??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\include\stdio.h
?????文件????????979??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\include\string.h
?????文件????????931??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\include\sys\config.h
?????文件????????913??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\include\sys\console.h
?????文件???????8289??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\include\sys\const.h
?????文件???????4370??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\include\sys\fs.h
?????文件???????1725??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\include\sys\global.h
?????文件??????11657??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\include\sys\hd.h
?????文件???????5124??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\include\sys\keyboard.h
?????文件???????7831??2009-03-30?16:17??于淵操作系統光盤\chapter10\a\include\sys\keymap.h
............此處省略2748個文件信息
評論
共有 條評論