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

📄 halt.c

📁 基于UNIX6的文件系统模拟程序
💻 C
字号:
#include <stdio.h>
#include <stdlib.h>#include "filesys.h"halt(){	struct inode *inode;	int i,j;	/* 1. write back the current dir */	chdir("..");	iput(cur_path_inode);	/* 2.free the u_ofile and sys_ofile and inode */	for(i=0;i<USERNUM;i++)	{		if(user[i].u_uid != 0)		{			for(j=0;j<NOFILE;j++)			{				if(user[i].u_ofile[j] != SYSOPENFILE+1)				{					close(user[i].u_ofile[j]);					user[i].u_ofile[j] = SYSOPENFILE+1;				}			}		}	}	/* 3. write back the filesus to the disk */	fseek(fd,BLOCKSIZ,SEEK_SET);		fwrite(&filsys,1,sizeof(struct filsys),fd);	/* 4. close the file system column */	fclose(fd);	/* 5. say GOOD BYE to all the user */	printf("\nThe FileSystem is terminated!\nPress any to exit...");
	getch();	//exit(0);}

⌨️ 快捷键说明

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