how to access inode structure based on inode number ?

how to access inode structure based on inode number ?

Post by vide.. » Fri, 21 Apr 2000 04:00:00



Hello,

I would like to understand how do you read an inode structure by its
inode number. I use stat function to obtain the necessary information
(inode number, etc.) about a file (given its path/name) and at this
point I would like to access the inode structure for this file. I'm
trying to obtain a file list for a given directory and I would like to
do it this way, i.e. use the inodes list. I'm not very good at
filesystems in general, but it looks like the inode structure is loaded
into memory at startup and then when you need info on a particular file,
you traverse that structure. And I would like to do the same.
Note: I'm aware of opendir/readdir/closedir functions. However, I would
like to do it the other way (if it's feasible) for educational purposes.
I would appreciate any help on this subject.
Thank you in advance,

Martin

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

how to access inode structure based on inode number ?

Post by phil-news-nos.. » Sat, 22 Apr 2000 04:00:00



| I would like to understand how do you read an inode structure by its
| inode number. I use stat function to obtain the necessary information
| (inode number, etc.) about a file (given its path/name) and at this
| point I would like to access the inode structure for this file. I'm
| trying to obtain a file list for a given directory and I would like to
| do it this way, i.e. use the inodes list. I'm not very good at
| filesystems in general, but it looks like the inode structure is loaded
| into memory at startup and then when you need info on a particular file,
| you traverse that structure. And I would like to do the same.
| Note: I'm aware of opendir/readdir/closedir functions. However, I would
| like to do it the other way (if it's feasible) for educational purposes.
| I would appreciate any help on this subject.
| Thank you in advance,

Being able to directly access an inode, whether it be a file or a directory,
means that you are bypassing the security mechanisms of execute permission
in its parent directories.  Now if you are root, that may not matter, since
root in theory has access to everything.  It should be possible to do (and
restricted to root) but I don't know of it being implemented anywhere.

Since you are mentioning educational and structures, perhaps what you
really want to dive into is the filesystem structure itself.  You could
(as root) open the actual filesystem partition and traverse things that
way.  Programs like fsck do that.

--
| Phil Howard - KA9WGN | My current boycotts: Amazon.Com, DVDs, Mattel, Sony

| Dallas - Texas - USA | My current websites: linuxhomepage.com, ham.org

 
 
 

1. I have filled up with inodes on /usr, can I change inode withour reinstall?

I have FreeBSD 4.5, a recent install. When trying to install Pine, and a couple of small apps, I
ran into inode trouble.
I am full of inodes in /usr and have searched everywhere for information about it.
The best so far is http://www.freebsddiary.org/inodes.php
However, I do not know if it is possible to change inode on /usr without corrupting what's there
already? Is it, and if so how?
Furthermore, if it isn't possible, how do I change the inode during sysinstall? I don't think I
have seen it anywhere.

Another inode question. when using the pc, will the inodes slowly increase until I have filled it
again?
I am concerned that after xx months of use, I decide to install another application, and i run
into the same problem again.
If I delete an application, will the inodes connected with that app. disappear, and will it be
available for the next app?

So many questions and hopefully so many answers.
Please cc: me if replying.
Thanks in advance for all help.

kolsen
a fresh, and interested new FreeBSD user

2. need backupscript

3. grow inodes: inode-max limit reached error.

4. SCO Free ODT Install Problem w/ PAS16 SCSI

5. Bad blocks, inodes and .badblocks -> Make root inode 2

6. Help w/modem and dialing out

7. Question about deleting inode / drop inode

8. allowed login times

9. directory inode from file inode?

10. grow-inodes: inode-max limit reached

11. BSD inodes vs. SYSV inodes?

12. fs/inode.c sync fix and fs/ext2/inode.c tidy

13. Help: XFS Superblock & Inode structure