Visit Our UNIX and Linux User Community


structure of regular file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers structure of regular file
# 1  
Old 12-12-2001
structure of regular file

hi,

I am reading 'the design of the unix os' by Bach and I find the 'regular file structure' details with the 'direct and indirect blocks of the inode' difficult to understand.

Thanks
# 2  
Old 12-13-2001
I dug out my copy of Bach last night and reviewed chapter 4, "Internal Representations of Files". My copy of Bach is from 1986, you may have a newer version. My copy is describing Ken Thompson's original unix filesystem. This filesystem was a commercial failure and I doubt if it is still used anywhere. Section 4.1.2 "Accessing Inodes" describes how all the inodes are together. This caused massive arm movement because the heads had to repeatedly access the inode list at the start of the disk.

Marshall McKusick wrote a much better filesystem which he called the Berkeley Fast File System. It really conquered the commercial world. HP-UX calls it hfs and SunOS calls it vfs. It has large blocks, cylinder groups, distributed inodes, bitmaps of free blocks rather than a single free list, blocks/fragments, long filenames and symbolic links. If your copy of Bach is not describing this filesystem, you may be confusing yourself. In this case, I would suggest switching to a more modern book.

But the block pointers in an inode have not changed very much. My book's figure 4.6 is similiar to the diagram on this page. Let's say that your file had the following 15 data blocks assigned to it: 4096, 228, 45423, 11111, 101, 367, 428, 9156, 824, 747, 4351, 171, 987, 654, and 594. For the first ten block numbers it's easy, they go in slots 0 though 9. But what do we do with the other 5 block numbers? We get another data block, let's assume that we get block 908. We take block 908 and write the numbers 4351, 171, 987, 654, and 594 in it. Then we put 908 in the single indirect slot. When we read the file, we just read the first 10 blocks from the numbers in the inode. The we see that 908 is our single indirect block so we read it. It has the the list of the final five blocks.

I hope this has helped.
# 3  
Old 12-14-2001
Hammer & Screwdriver

Hi,

Thanks a lot Smilie I have a reprint of the same 1986 version.This book is the standard book that all follow over here.Too bad that we are following an outdated book.

I referred to the link you gave me and went through all the lecture pages. It really helped me to get things clear.
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #868
Difficulty: Medium
Maclisp is a successor to Common Lisp.
True or False?

10 More Discussions You Might Find Interesting

1. Programming

Perl: How to read from a file, do regular expression and then replace the found regular expression

Hi all, How am I read a file, find the match regular expression and overwrite to the same files. open DESTINATION_FILE, "<tmptravl.dat" or die "tmptravl.dat"; open NEW_DESTINATION_FILE, ">new_tmptravl.dat" or die "new_tmptravl.dat"; while (<DESTINATION_FILE>) { # print... (1 Reply)
Discussion started by: jessy83
1 Replies

2. Red Hat

Copy certain file types recursively while maintaining file structure on destination?

Hi guys, I have just been bothered by a fairly small issue for some time now. I am trying to search (using find -name) for some .jpg files recursively. This is a Redhat environment with bash. I get this job done though I need to copy ALL of them and put them in a separate folder BUT I also... (1 Reply)
Discussion started by: rockf1bull
1 Replies

3. Programming

FILE structure - stdio.h

Hi All, I am new to linux and Programming. Inside the file stdio.h, there is a description about FILE structure. Which has many internal data members like _p, _r, _flags etc. I have written a sample code to find out the contents of the FILE structure. It opens a sample file ( FILE *fp ),... (5 Replies)
Discussion started by: nikunjbadjatya
5 Replies

4. Shell Programming and Scripting

drop down structure in file

I have file like this 120, rahim, d40 115, rahul, d40 113, begum, d40 I want to group this file like this 120, rahim, d40 115, rahul, 113, begum, can any one help me on this thanks in advance (1 Reply)
Discussion started by: trichyselva
1 Replies

5. Programming

compare XML/flat file with UNIX file system structure

Before i start doing something, I wanted to know whether the approach to compare XML file with UNIX file system structure. I have a pre-configured file(contains a list of paths to executables) and i need to check against the UNIX directory structure. what are the various approches should i use ? I... (6 Replies)
Discussion started by: shafi2all
6 Replies

6. Programming

Search attributes in one structure using the values from another structure

Hello Groups I am trying to find out ways of comparing a value from a 'c' structure to a value in another 'C' structure. the 'C' structure can be a List or liked list as it contains lot many records. if we loop it in both the structures it is going to consume time. I am looking for a simple... (3 Replies)
Discussion started by: dhanamurthy
3 Replies

7. Shell Programming and Scripting

file structure

Hi, Is there a command that can help me to determain a unix file structure ? Thanks (7 Replies)
Discussion started by: yoavbe
7 Replies

8. Shell Programming and Scripting

using regular expressions in c shell control structure

i cant get around using regular expressions in if/else statements. it simply doesnt give me the right results. i've tried using switch/case but that is just as sh!tty as well. (pardon my french but im getting frustrated with c shell..only reason why im writing in it is because it's a hwk... (3 Replies)
Discussion started by: ballazrus
3 Replies

9. UNIX for Dummies Questions & Answers

TAR only the file structure

Hi, I need to tar only the file structures in Unix. I dont want to create the tar with the files in it. I tried to use a find with type -d and xargs the tar. It still tar's the file. Can anybody can help in this? Regards Anand (1 Reply)
Discussion started by: Andysundar
1 Replies

10. UNIX for Dummies Questions & Answers

Copying a Directory Structure to a new structure

Hi all Is it possible to copy a structure of a directory only. e.g. I have a file with the following entries that is a result of a find :- /dir1/dir2/file.dbf /dir1/dir2/dir3/file1.dbf /dir1/file.dbf I want to copy these to a directory and keep the structure however starting at a new dir... (8 Replies)
Discussion started by: jhansrod
8 Replies

Featured Tech Videos