- 15
- 0
- 约6.67千字
- 约 8页
- 2019-03-17 发布于广东
- 举报
课程名: 计算机操作系统 地点:
姓名:
班级:
学号:
成绩
项目: 文件操作
实验目的
掌握文件系统的工作机理
理解文件系统的主要数据结构
学习较为复杂的 Linux 下的编程
实验内容
设计并实现一个一级(单用户)文件系统程序
1、提供以下操作
文件创建/删除接口命令create/delete
目录创建/删除接口命令midair/rmdir
显示目录内容命令ls
2、创建的文件不要求格式和内容
在以上基础上设计并实现一个二级文件系统
具备提供用户登录
文件、目录要有权限
程序主文件代码:
#include stdio.h
#include malloc.h
#include stdlib.h
#include string.h
#include structure.h
#include creat.h
#include access.h
#include ballfre.h
#include close.h
#include delete.h
#include dir.h
#include format.h
#include halt.h
#include iallfre.h
#include install.h
#include log.h
#include name.h
#include open.h
#include rdwt.h
#include igetput.h
struct hinode hinode[NHINO];
struct dir dir;
struct file sys_ofile[SYSOPENFILE];
struct filsys filsys;
struct pwd pwd[PWDNUM];
struct user user[USERNUM];
FILE *fd;
struct inode *cur_path_inode;
int user_id;
unsigned short usr_id;
char usr_p[12];
char sel;
char temp_dir[12];
main()
{
unsigned short ab_fd1,ab_fd2,ab_fd3,ab_fd4,i,j;
char *buf;
int done=1;
printf(\nDo you want to format the disk(y or n)?\n);
if(getchar()==y)
{
printf(\nFormat will erase all context on the disk \n);
printf(Formating...\n);
format();
printf(\nNow will install the fillsystem,please wait...\n);
install();
printf(\n----Login----\nPlease input your userid:);
scanf(%u,usr_id);
printf(\nPlease input your password:);
scanf(%s,usr_p);
if(!login(usr_id,usr_p))
return;
/*login(2118,abcd);*/
while(done)
{
printf(\n Please Select Your Operating\n);
printf( -1----ls\n -2----mkdir\n -3----change dir\n -4----create file\n -0----Logout\n);
sel=getchar();
sel=getchar();
switch(sel)
{
case 1:
_dir();
break;
case 2:
printf(please input dir name:);
scanf(%s,temp_dir);
mkdir(temp_dir);
break;
case 3:
printf(please input dir name:);
scanf(%s,temp_dir);
chdir(temp_dir);
break;
case 4:
printf(please input file name:);
scanf(%s,temp_dir);
ab_fd1=creat(2118,temp_dir,01777);
buf=(char *)malloc(BLOCKSIZ*6+5);
write(ab_fd1,buf,BLOCKSIZ*6+5)
您可能关注的文档
- 大学生创业计划书范文5000字.doc
- 餐盒注塑模具计算机辅助设计(含CAD图).doc
- 车辆挂名协议书(居住证办不了).docx
- 成本管理课程设计报告.doc
- 初中新教师教学心得体会.doc
- 产品购销合同(袜子)律师拟定版本.doc
- 部编二年级语文上册【多音字 形近字】组词汇总.doc
- 车间主任绩效考核表.doc
- 第6并行机系统结构:-对称多处理机Symmetric.ppt
- 北邮操作系统试验页面置换算法.docx
- 2026西咸新区秦汉陵召中心小学就业见习岗位招聘考试笔试备考题库及答案解析.docx
- 2026年度黑龙江省文化和旅游厅所属事业单位公开招聘工作人员21人考试笔试备考题库及答案解析.docx
- 助学金申请书格式及范文5篇.docx
- 2026内蒙古民族大学招聘银龄教师17人考试笔试备考题库及答案解析.docx
- 2026江西赣州市第五人民医院招募见习检验技师2人考试笔试备考试题及答案解析.docx
- 2026广东东莞市第二人民法院招聘劳动合同制审判辅助人员44人考试笔试备考试题及答案解析.docx
- 2026河北石家庄市规划馆招聘派遣制人员3人考试笔试备考题库及答案解析.docx
- 2026广东清远市连山壮族瑶族自治县太保镇招聘公益性岗位1人考试笔试参考题库及答案解析.docx
- 2026全国工商联直属单位招聘工作人员5人考试笔试参考题库及答案解析.docx
- 2026年福建泉州惠安高级中学春季教师招聘考试笔试模拟试题及答案解析.docx
原创力文档

文档评论(0)