实验5linux文件管理,实验5 Linux文件管理.doc

实验5Linux文件管理

一、实验目的

1.掌握Linux文件系统的基本原理、结构和实现方法

2.掌握Linux文件系统中文件的建立、打开、读/写、执行、属性等系统调用的使用

3.学会设计简单的文件系统并实现一组操作

4.通过实验学习文件系统的系统调用命令,提高对文件系统实现功能的理解和掌握

二、实验内容

设计并实现一个一级文件系统程序,要求实现以下功能:

1.提供文件创建/删除接口命令create / delete、目录创建/删除接口命令mkdir / rmdir、显示目录内容命令ls等。

2.创建的文件不要求格式和内容。

三、实验结果

1.程序源代码

main.cpp

#include

#include

#include

#include

#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;

/*kkkkk*/

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);

/* printf("\nsuccess\n");*/

if(!login(usr_id,usr_p))

return;

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':

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值