Sponsored Content
Full Discussion: Help with Inodes please
Top Forums UNIX for Advanced & Expert Users Help with Inodes please Post 302567242 by Group_Inode on Sunday 23rd of October 2011 11:19:20 AM
Old 10-23-2011
OS : freebsd 8.2 release

As of now we have understood that any program uses struct stat structure to store temporary inode info and display it. The struct stat structure gets info from struct inode (defined in inode.h) which in turn gets info from struct dinode. The struct dinode is (or may be, I am not sure) is the actual physical representation of the inode structure.

I also tried studying ls.c source code. I found that it uses another important structures struct FTS and struct FTSENT for traversing the file system hierarchy using functions defined in fts.c. Now the problem is that fts.c uses systemcalls like fstat() and open() for accessing inode information
I'm trying to find how the information is retrieved from dinode and printed on the console or to the file. Once I know how it is retrieved, I'll try to add a field to dinode structure last_modified_by i.e it would have the username who lastly modified that file. I'll probably try to modify ls.c also to display information on console.

I think the path for the system calls are two fold:
1. Filesystem Independent system calls present in /usr/src/lib/libstand
2. Filesystem Dependent system calls present in /usr/src/lib/libstand/<file_system.c>

I have read /usr/src/lib/libstand/stand.h which I think is the periphery of Platform Independence. I t has a structure called struct fs_ops which has function pointers for system calls like *open(), *stat(), *fstat() etc.
These function pointers are made to point to actual system calls from different Platform Dependent file systems like ext2fs , ufs etc.
This is done by the open system call ( by reading from the struct open_file files] and struct fs_ops *file_system[).
I think if we want to add thi field for a particular file system, then I should try to make changes in file system C files like ufs.c and vfs.c ( and so on ...)

Now I was thinking that modifying already implemented file systems is a messy thing. So, I was planning to make my own file system. This file system code will only include the necessary fs_ops (File system Operations i.e. system calls) and putting the appropriate pointers in stand.h. Am I thinking right?

I read an IBM Developer Forum for FUSE which explained how to create a File System in User Space which explained something very similar. The link is as follows:
http://www.ibm.com/developerworks/linux/library/l-fuse/

Can you please suggest if I am on the right track or not. And also can you suggest some links I can read, that might help me for the same( ie For creating or modifying the file system)

Last edited by Group_Inode; 01-08-2012 at 01:31 AM..
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

INodes...

Could someone please explain to me the concept of INodes? Colour me a DOS/MacOS junkie, but I don't quite understand. Is there any relation to clusters, or physical distro.? ty. (3 Replies)
Discussion started by: boris888
3 Replies

2. Solaris

inodes???

Does anyone know what command I can run to check how many inodes are in use on a specific filesystem. On Data General servers I used to run the df -k command to check the status of the inodes for all file system.s (1 Reply)
Discussion started by: soliberus
1 Replies

3. Solaris

inodes

hi i need to find all the files that r linked to the current file as i need to delete the file as well as few of its links :confused: thnx in advance (1 Reply)
Discussion started by: livemyway
1 Replies

4. UNIX for Dummies Questions & Answers

inodes

how is the location of inodes in the physical disk. are they sequential like: bootblock|superblock|inode1|inode2| ....| datablock1|datablock2|datablock3 or are they distributed among data blocks like: bootblock|superblock|inode1|datablock1|inode2|datablock2|datablock3|inode3 |datablock4 (3 Replies)
Discussion started by: gfhgfnhhn
3 Replies

5. Linux

Inodes

Any good sites, tutorials that explain Inodes clearly and completely ? (3 Replies)
Discussion started by: nitin09
3 Replies

6. Solaris

Number of used inodes..?

Hello Experts How can i know Number of used and free inodes in a file system? thanx in advance.. (3 Replies)
Discussion started by: younus_syed
3 Replies

7. Solaris

Increasing inodes

Hi , Can someone help me to increase "inode" in solaris 9? Thanks in advance, Gowtham (8 Replies)
Discussion started by: gowthamakanthan
8 Replies

8. Filesystems, Disks and Memory

inodes

Hi, sorry to have written in other language i think i could do that. I would to know A file system use inodes indexed allocation as a method of allocating space. In the inode blocks are 10 references to direct, 1 indirect reference to a single block, 1 block indirect reference to a reference to... (1 Reply)
Discussion started by: maryprin
1 Replies

9. Solaris

/var: out of inodes

Dear Forum, Please help me i have SUNW,Sun-Fire-V240 with sun solaris 8,if i check inode in /var like below: # df -F ufs -o i Filesystem iused ifree %iused Mounted on /dev/md/dsk/d0 62354 310638 17% / /dev/md/dsk/d3 372992 0 100% /var... (2 Replies)
Discussion started by: fredginting
2 Replies

10. Shell Programming and Scripting

Maximum inodes

Hi, Is there a restriction in the number of inodes a particular directory can have in Solaris. If so how can we determine that. Regards (3 Replies)
Discussion started by: @bhi
3 Replies
jfs_debugfs(8)						      JFS file system editor						    jfs_debugfs(8)

NAME
jfs_debugfs - shell-type JFS file system editor SYNOPSIS
jfs_debugfs device DESCRIPTION
jfs_debugfs is a program which can be used to perform various low-level actions on a JFS formatted device. device is the special file name corresponding to the actual device to be edited (e.g. /dev/hdb1). jfs_debugfs must be run as root. COMMANDS
a[lter] <block> <offset> <hex_string> replaces the data located at the <offset> of <block> with <hex_string> <block> is the block number - given in decimal <offset> is the offset within that block - given in hexadecimal <hex_string> is an even-numbered string of hexadecimal digits to write to the disk b[tree] <block> [<offset>] * not implemented yet * displays one node of the btree located at <offset> of <block> and enters a subcommand mode to navigate the btree SUBCOMMANDS: l => visit left sibling m => modify current node p => visit parent node r => visit right sibling [0-9] => visit the n'th child node x => exit subcommand mode cb[blfsck] displays the area used by ClearBadBlockList for communication with fsck SUBCOMMANDS: m => modify entries x => exit subcommand mode dir[ectory] <inode_number> [<file_set>] displays the directory entries at <inode_number> and enters subcommand mode <inode_number> is the directory's inode - given in decimal <file_set> currently must be zero SUBCOMMANDS: m => modify entries x => exit subcommand mode d[isplay] [<block> [<offset> [<format> [<count>]]]] displays <count> objects located at the <offset> of <block> in <format> <block> is the block number - given in decimal <offset> is the offset within <block> - given in hexadecimal <format> is one of the following: a => ascii b => block allocation map d => decimal i => inode I => inode allocation map s => superblock x => hexadecimal X => extent allocation descriptor <count> is the number of objects to display - given in decimal dm[ap] displays aggregate disk (block) map SUBCOMMANDS m => modify map fields f => display free count t => display tree levels x => exit subcommand mode dt[ree] <inode_number> [<file_set>] displays root of the directory btree located at <inode_number> and enters a subcommand mode to navigate the btree <inode_number> is the directory's inode - given in decimal <file_set> currently must be zero SUBCOMMANDS l => visit left sibling m => modify current node p => visit parent node (not parent directory) r => visit right sibling [0-9] => visit the n'th child node x => exit subcommand mode fsckw[sphdr] displays the header of the fsck workspace in the aggregate SUBCOMMANDS: m => modify entries x => exit subcommand mode h[elp] [<command>] displays help for <command> if no command is given, all possible commands are displayed ia[g] [<IAG_number>] [a | s | <file_set>] displays IAG information for <IAG_number> and enters subcommand mode <IAG_number> is given in decimal a is to use the primary aggregate inode table s is to use the secondary aggregate inode table <file_set> currently must be zero SUBCOMMANDS e => display/modify inode extents map m => modify IAG p => display/modify persistent map w => display/modify working map x => exit subcommand mode i[node] [<inode_number>] [a | s | <file_set>] displays inode information for <inode_number> and enters subcommand mode <inode_number> is given in decimal a is to use the primary aggregate inode table s is to use the secondary aggregate inode table <file_set> currently must be zero SUBCOMMANDS a => display/modify inode's ACL m => modify inode x => exit subcommand mode logs[uper] displays the journal log superblock and enters subcommand mode SUBCOMMANDS m => modify journal log superblock x => exit subcommand mode q[uit] exits jfs_debugfs se[t] [<variable> <value>] * not implemented yet * set user-defined <variable> to <value> if no arguments are given, displays all set variables <variable> must begin with an alphabetic character su[perblock] [p | s] displays superblock data p displays the primary superblock s displays the secondary superblock SUBCOMMANDS: m => modify entries x => exit subcommand mode s2p[erblock] [p | s] displays alternate superblock data p displays the primary superblock s displays the secondary superblock SUBCOMMANDS: m => modify entries x => exit subcommand mode u[nset] <variable> * not implemented yet * deletes user-defined <variable> xt[ree] <inode_number> [<file_set>] displays root of the non-directory btree located at <inode_number> and enters a subcommand mode to navigate the btree <inode_number> is the directory's inode - given in decimal <file_set> currently must be zero SUBCOMMANDS l => visit left sibling m => modify current node p => visit parent node (not parent directory) r => visit right sibling [0-9] => visit the n'th child node x => exit subcommand mode REPORTING BUGS
If you find a bug in JFS or jfs_debugfs, please report it via the bug tracking system ("Report Bugs" section) of the JFS project web site: http://jfs.sourceforge.net/ Please send as much pertinent information as possible, including the complete output of running jfs_fsck with the -v and -n options on the JFS device. SEE ALSO
jfs_fsck(8), jfs_mkfs(8), jfs_fscklog(8), jfs_logdump(8), jfs_tune(8), AUTHORS
Barry Arndt (barndt@us.ibm.com) William Braswell, Jr. jfs_debugfs is maintained by IBM. See the JFS project web site for more details: http://jfs.sourceforge.net/ October 29, 2002 jfs_debugfs(8)
All times are GMT -4. The time now is 01:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy