English 中文(简体)
在批发式2号档案系统中,拉开超级块和集团描述器很容易。 但是,随着许多居住点的到来,在吸引特定居住点方面究竟是什么。
原标题:In ext2 file system pulling super block & group descriptor is easy. But what about pulling specific inode as there can be many inodes

在档案系统中 pull倒(即如果我储存的胎盘是铺面式的)很容易。 我只需要tes光1024,才能得到超级块块 f蒸 storage的储存。

lseek(fd, 1024, SEEK_SET);
read(fd, &super_block, sizeof(super_block));

并且把集团的描述拖得太容易(只有我正确理解从看法则)

lseek(fd, 1024 + [block_size_ext_1024_bytes]=1024, SEEK_SET);
read(fd, &block_group, sizeof(block_group));
or
lseek(fd, 1024 + 1024, SEEK_SET);
read(fd, &block_group, sizeof(block_group));

页: 1

但是,我感到不舒服,因为我发现的真正挑战是拉登正,只有我有名字。 我知道档案名称存放在目录结构中,因此首先的挑战是从那里提取目录结构,从目录中获取图像。 从原第1号中可以提取ode。 我怎么能够用外表2的图像提取目录。

问题回答

Yes起超级块只是一个 matter光基-Offset=1024的 by子,然后读像样。

lseek(fd, BASE_OFFSET + block_size, SEEK_SET);
//BASE_OFFSET for EXT2 == 1024
改为:(fd, &super_block, sizeof(super_block));
block_size = 1024 << super_block.s_log_block_size;
printf("Block size is [%d]
",super_block.s_log_block_size);

超级锁体的大小由log子-锁定。 这一数值表示,一个区块面积为2台,使用1024台(具体为批号)作为单位。 因此,0个字标为1024个区块,1个指2048个区块,等等。 计算一个区块的大小:

unsigned int block_size = 1024 << super.s_log_block_size;   /* block 

超级.s_log_block_size persistent 0 if need tohardcode 1024 and Super.s_log_block_size is multi of 2 so if 1024堵塞的规模超级.s_log_block_size be 0

然后,我可以提取团体描述。 因此,就我的形象而言,只有一个群体是 des。 我知道,如果我有1TB储存,那么我有多少描述者会知道,档案系统是分机4。 愿有人告诉我这一点。

Like this to extract group descriptor by further moving forward 1024 bytes

  lseek(fd, BASE_OFFSET + block_size, SEEK_SET);
  改为:(fd, &block_group, sizeof(block_group));

I think this gives the idea of finding out how many group desciptors are there in storage in ext2

unsigned int group_count = 1 + (super_block.s_blocks_count-1) / super_block.s_blocks_per_group;

例如 在我的装置图象上,它有128个区块,因此,第2个区块是超级区块,第3个区块是第一组描述人——如果我有更多的空间储存的话,仍然想知道我的第二组描述员会被抵消什么。 请有人说明这一点。

接着,为了从具体方式推断出具体做法,就是要设法抵消特定行为。

lseek(fd, BLOCK_OFFSET(block_group->bg_inode_table)+(inode_no-1)*sizeof(struct ext2_inode), SEEK_SET);

bg_inode_table 可用于提取住所

该团体的描述者告诉我们,块地/[比图]和地表(后来描述的)的位置是通过布克_block_bitmap、bg_inode_bitmap和bg_inode_table油田。

现在要从原样中提取根基=(可能为 in-num=2),例如,我刚刚需要这样做。

lseek(fd, BLOCK_OFFSET(block_group->bg_inode_table)+(2-1)*sizeof(struct    ext2_inode),
   SEEK_SET);

排位表第一栏块的整数储存在集团名稿人的bg_inode-table领域。

因此,在座桌上帮助找到了特定的住所。

摘取《指南》第1部分只是需要使用正文。 最后一步填满

每一单单单锁元素都是可以用这种方式使用的编号。 基本点指含有阳性档案内容的实际区块

  lseek(...BASE_OFFSET+(i_block[x]-1)*block_size...)

封面——总宽度为1024

这样一来,我就可以读到其基数包含深2个档案系统的目录构件。

改为:

  void *block;
  改为:(fd, block, block_size);  

以及以上一线,我首先向我提供一张地图,绘制具体位置。

我可以简单地看一看一看一去看所有条目。

http://www.science.undp.htm。





相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签