2005-04-21 16:53:53 +02:00
|
|
|
/* This file manages the inode table. There are procedures to allocate and
|
|
|
|
* deallocate inodes, acquire, erase, and release them, and read and write
|
|
|
|
* them from the disk.
|
|
|
|
*
|
|
|
|
* The entry points into this file are
|
2005-08-29 18:47:18 +02:00
|
|
|
* get_inode: search inode table for a given inode; if not there,
|
|
|
|
* read it
|
2005-04-21 16:53:53 +02:00
|
|
|
* put_inode: indicate that an inode is no longer needed in memory
|
|
|
|
* alloc_inode: allocate a new, unused inode
|
|
|
|
* wipe_inode: erase some fields of a newly allocated inode
|
|
|
|
* free_inode: mark an inode as available for a new file
|
|
|
|
* update_times: update atime, ctime, and mtime
|
|
|
|
* rw_inode: read a disk block and extract an inode, or corresp. write
|
|
|
|
* dup_inode: indicate that someone else is using an inode table entry
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
* find_inode: retrieve pointer to inode in inode cache
|
2008-02-06 16:05:57 +01:00
|
|
|
*
|
2005-04-21 16:53:53 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "fs.h"
|
|
|
|
#include "buf.h"
|
|
|
|
#include "inode.h"
|
|
|
|
#include "super.h"
|
2006-10-25 15:40:36 +02:00
|
|
|
#include <minix/vfsif.h>
|
2013-09-16 22:52:36 +02:00
|
|
|
#include <assert.h>
|
2006-10-25 15:40:36 +02:00
|
|
|
|
2012-03-25 20:25:53 +02:00
|
|
|
static void addhash_inode(struct inode *node);
|
2010-06-01 14:35:33 +02:00
|
|
|
|
2013-03-07 15:46:21 +01:00
|
|
|
static void free_inode(dev_t dev, pino_t numb);
|
2012-03-25 20:25:53 +02:00
|
|
|
static void new_icopy(struct inode *rip, d2_inode *dip, int direction,
|
2012-03-24 16:16:34 +01:00
|
|
|
int norm);
|
2012-03-25 20:25:53 +02:00
|
|
|
static void unhash_inode(struct inode *node);
|
|
|
|
static void wipe_inode(struct inode *rip);
|
2005-04-21 16:53:53 +02:00
|
|
|
|
2006-10-25 15:40:36 +02:00
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* fs_putnode *
|
|
|
|
*===========================================================================*/
|
2012-03-25 20:25:53 +02:00
|
|
|
int fs_putnode(void)
|
2006-10-25 15:40:36 +02:00
|
|
|
{
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
/* Find the inode specified by the request message and decrease its counter.*/
|
|
|
|
|
2006-10-25 15:40:36 +02:00
|
|
|
struct inode *rip;
|
2007-01-05 17:36:55 +01:00
|
|
|
int count;
|
2006-10-25 15:40:36 +02:00
|
|
|
|
2013-03-07 15:46:21 +01:00
|
|
|
rip = find_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR);
|
2006-10-25 15:40:36 +02:00
|
|
|
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
if(!rip) {
|
2013-11-15 19:01:25 +01:00
|
|
|
printf("%s:%d put_inode: inode #%u dev: %llx not found\n", __FILE__,
|
2013-03-07 15:46:21 +01:00
|
|
|
__LINE__, (pino_t) fs_m_in.REQ_INODE_NR, fs_dev);
|
2010-03-05 16:05:11 +01:00
|
|
|
panic("fs_putnode failed");
|
2007-01-05 17:36:55 +01:00
|
|
|
}
|
2006-10-25 15:40:36 +02:00
|
|
|
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
count = fs_m_in.REQ_COUNT;
|
|
|
|
if (count <= 0) {
|
|
|
|
printf("%s:%d put_inode: bad value for count: %d\n", __FILE__,
|
|
|
|
__LINE__, count);
|
2010-03-05 16:05:11 +01:00
|
|
|
panic("fs_putnode failed");
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
} else if(count > rip->i_count) {
|
|
|
|
printf("%s:%d put_inode: count too high: %d > %d\n", __FILE__,
|
|
|
|
__LINE__, count, rip->i_count);
|
2010-03-05 16:05:11 +01:00
|
|
|
panic("fs_putnode failed");
|
2007-01-05 17:36:55 +01:00
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
/* Decrease reference counter, but keep one reference; it will be consumed by
|
|
|
|
* put_inode(). */
|
2009-07-22 10:54:28 +02:00
|
|
|
rip->i_count -= count - 1;
|
|
|
|
put_inode(rip);
|
|
|
|
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
return(OK);
|
2006-10-25 15:40:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* init_inode_cache *
|
|
|
|
*===========================================================================*/
|
2012-03-25 20:25:53 +02:00
|
|
|
void init_inode_cache()
|
2006-10-25 15:40:36 +02:00
|
|
|
{
|
|
|
|
struct inode *rip;
|
|
|
|
struct inodelist *rlp;
|
|
|
|
|
|
|
|
inode_cache_hit = 0;
|
|
|
|
inode_cache_miss = 0;
|
|
|
|
|
|
|
|
/* init free/unused list */
|
|
|
|
TAILQ_INIT(&unused_inodes);
|
|
|
|
|
|
|
|
/* init hash lists */
|
|
|
|
for (rlp = &hash_inodes[0]; rlp < &hash_inodes[INODE_HASH_SIZE]; ++rlp)
|
|
|
|
LIST_INIT(rlp);
|
|
|
|
|
|
|
|
/* add free inodes to unused/free list */
|
|
|
|
for (rip = &inode[0]; rip < &inode[NR_INODES]; ++rip) {
|
2010-06-01 14:35:33 +02:00
|
|
|
rip->i_num = NO_ENTRY;
|
2006-10-25 15:40:36 +02:00
|
|
|
TAILQ_INSERT_HEAD(&unused_inodes, rip, i_unused);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* addhash_inode *
|
|
|
|
*===========================================================================*/
|
2012-03-25 20:25:53 +02:00
|
|
|
static void addhash_inode(struct inode *node)
|
2006-10-25 15:40:36 +02:00
|
|
|
{
|
2010-06-01 14:35:33 +02:00
|
|
|
int hashi = (int) (node->i_num & INODE_HASH_MASK);
|
2006-10-25 15:40:36 +02:00
|
|
|
|
|
|
|
/* insert into hash table */
|
|
|
|
LIST_INSERT_HEAD(&hash_inodes[hashi], node, i_hash);
|
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
|
2006-10-25 15:40:36 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* unhash_inode *
|
|
|
|
*===========================================================================*/
|
2012-03-25 20:25:53 +02:00
|
|
|
static void unhash_inode(struct inode *node)
|
2006-10-25 15:40:36 +02:00
|
|
|
{
|
|
|
|
/* remove from hash table */
|
|
|
|
LIST_REMOVE(node, i_hash);
|
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* get_inode *
|
|
|
|
*===========================================================================*/
|
2012-03-25 20:25:53 +02:00
|
|
|
struct inode *get_inode(
|
2010-04-13 12:58:41 +02:00
|
|
|
dev_t dev, /* device on which inode resides */
|
2013-03-07 15:46:21 +01:00
|
|
|
pino_t numb /* inode number */
|
2010-04-13 12:58:41 +02:00
|
|
|
)
|
2005-04-21 16:53:53 +02:00
|
|
|
{
|
2006-10-25 15:40:36 +02:00
|
|
|
/* Find the inode in the hash table. If it is not there, get a free inode
|
|
|
|
* load it from the disk if it's necessary and put on the hash list
|
2005-04-21 16:53:53 +02:00
|
|
|
*/
|
2010-04-01 15:25:05 +02:00
|
|
|
register struct inode *rip;
|
2006-10-25 15:40:36 +02:00
|
|
|
int hashi;
|
2005-04-21 16:53:53 +02:00
|
|
|
|
2010-06-01 14:35:33 +02:00
|
|
|
hashi = (int) (numb & INODE_HASH_MASK);
|
2006-10-25 15:40:36 +02:00
|
|
|
|
|
|
|
/* Search inode in the hash table */
|
|
|
|
LIST_FOREACH(rip, &hash_inodes[hashi], i_hash) {
|
|
|
|
if (rip->i_num == numb && rip->i_dev == dev) {
|
|
|
|
/* If unused, remove it from the unused/free list */
|
|
|
|
if (rip->i_count == 0) {
|
|
|
|
inode_cache_hit++;
|
|
|
|
TAILQ_REMOVE(&unused_inodes, rip, i_unused);
|
|
|
|
}
|
|
|
|
++rip->i_count;
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
return(rip);
|
2006-10-25 15:40:36 +02:00
|
|
|
}
|
2005-04-21 16:53:53 +02:00
|
|
|
}
|
|
|
|
|
2006-10-25 15:40:36 +02:00
|
|
|
inode_cache_miss++;
|
|
|
|
|
|
|
|
/* Inode is not on the hash, get a free one */
|
|
|
|
if (TAILQ_EMPTY(&unused_inodes)) {
|
|
|
|
err_code = ENFILE;
|
2010-05-10 15:26:00 +02:00
|
|
|
return(NULL);
|
2005-04-21 16:53:53 +02:00
|
|
|
}
|
2006-10-25 15:40:36 +02:00
|
|
|
rip = TAILQ_FIRST(&unused_inodes);
|
|
|
|
|
|
|
|
/* If not free unhash it */
|
2010-06-01 14:35:33 +02:00
|
|
|
if (rip->i_num != NO_ENTRY)
|
2006-10-25 15:40:36 +02:00
|
|
|
unhash_inode(rip);
|
|
|
|
|
|
|
|
/* Inode is not unused any more */
|
|
|
|
TAILQ_REMOVE(&unused_inodes, rip, i_unused);
|
|
|
|
|
|
|
|
/* Load the inode. */
|
|
|
|
rip->i_dev = dev;
|
|
|
|
rip->i_num = numb;
|
|
|
|
rip->i_count = 1;
|
|
|
|
if (dev != NO_DEV) rw_inode(rip, READING); /* get inode from disk */
|
|
|
|
rip->i_update = 0; /* all the times are initially up-to-date */
|
2008-02-06 16:05:57 +01:00
|
|
|
rip->i_zsearch = NO_ZONE; /* no zones searched for yet */
|
2007-08-07 14:38:35 +02:00
|
|
|
rip->i_mountpoint= FALSE;
|
2011-08-11 17:12:07 +02:00
|
|
|
rip->i_last_dpos = 0; /* no dentries searched for yet */
|
2005-04-21 16:53:53 +02:00
|
|
|
|
2006-10-25 15:40:36 +02:00
|
|
|
/* Add to hash */
|
|
|
|
addhash_inode(rip);
|
|
|
|
|
|
|
|
return(rip);
|
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
|
2006-10-25 15:40:36 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* find_inode *
|
|
|
|
*===========================================================================*/
|
2012-03-25 20:25:53 +02:00
|
|
|
struct inode *find_inode(
|
2010-04-13 12:58:41 +02:00
|
|
|
dev_t dev, /* device on which inode resides */
|
2013-03-07 15:46:21 +01:00
|
|
|
pino_t numb /* inode number */
|
2010-04-13 12:58:41 +02:00
|
|
|
)
|
2006-10-25 15:40:36 +02:00
|
|
|
{
|
|
|
|
/* Find the inode specified by the inode and device number.
|
|
|
|
*/
|
|
|
|
struct inode *rip;
|
|
|
|
int hashi;
|
|
|
|
|
2010-06-01 14:35:33 +02:00
|
|
|
hashi = (int) (numb & INODE_HASH_MASK);
|
2005-04-21 16:53:53 +02:00
|
|
|
|
2006-10-25 15:40:36 +02:00
|
|
|
/* Search inode in the hash table */
|
|
|
|
LIST_FOREACH(rip, &hash_inodes[hashi], i_hash) {
|
|
|
|
if (rip->i_count > 0 && rip->i_num == numb && rip->i_dev == dev) {
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
return(rip);
|
2006-10-25 15:40:36 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-10 15:26:00 +02:00
|
|
|
return(NULL);
|
2005-04-21 16:53:53 +02:00
|
|
|
}
|
|
|
|
|
2006-10-25 15:40:36 +02:00
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* put_inode *
|
|
|
|
*===========================================================================*/
|
2012-03-25 20:25:53 +02:00
|
|
|
void put_inode(rip)
|
2005-04-21 16:53:53 +02:00
|
|
|
register struct inode *rip; /* pointer to inode to be released */
|
|
|
|
{
|
|
|
|
/* The caller is no longer using this inode. If no one else is using it either
|
|
|
|
* write it back to the disk immediately. If it has no links, truncate it and
|
|
|
|
* return it to the pool of available inodes.
|
|
|
|
*/
|
|
|
|
|
2010-05-10 15:26:00 +02:00
|
|
|
if (rip == NULL) return; /* checking here is easier than in caller */
|
2006-10-25 15:40:36 +02:00
|
|
|
|
2009-07-22 10:54:28 +02:00
|
|
|
if (rip->i_count < 1)
|
2010-03-05 16:05:11 +01:00
|
|
|
panic("put_inode: i_count already below 1: %d", rip->i_count);
|
2009-07-22 10:54:28 +02:00
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
if (--rip->i_count == 0) { /* i_count == 0 means no one is using it now */
|
2010-06-01 14:35:33 +02:00
|
|
|
if (rip->i_nlinks == NO_LINK) {
|
|
|
|
/* i_nlinks == NO_LINK means free the inode. */
|
|
|
|
/* return all the disk blocks */
|
2010-06-09 13:05:16 +02:00
|
|
|
|
|
|
|
/* Ignore errors by truncate_inode in case inode is a block
|
|
|
|
* special or character special file.
|
|
|
|
*/
|
|
|
|
(void) truncate_inode(rip, (off_t) 0);
|
2010-06-01 14:35:33 +02:00
|
|
|
rip->i_mode = I_NOT_ALLOC; /* clear I_TYPE field */
|
2011-12-22 01:29:27 +01:00
|
|
|
IN_MARKDIRTY(rip);
|
2005-04-21 16:53:53 +02:00
|
|
|
free_inode(rip->i_dev, rip->i_num);
|
2006-10-25 15:40:36 +02:00
|
|
|
}
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
|
2007-08-07 14:38:35 +02:00
|
|
|
rip->i_mountpoint = FALSE;
|
2011-12-22 01:29:27 +01:00
|
|
|
if (IN_ISDIRTY(rip)) rw_inode(rip, WRITING);
|
2007-01-05 17:36:55 +01:00
|
|
|
|
2010-06-01 14:35:33 +02:00
|
|
|
if (rip->i_nlinks == NO_LINK) {
|
2006-10-25 15:40:36 +02:00
|
|
|
/* free, put at the front of the LRU list */
|
|
|
|
unhash_inode(rip);
|
2010-06-01 14:35:33 +02:00
|
|
|
rip->i_num = NO_ENTRY;
|
2006-10-25 15:40:36 +02:00
|
|
|
TAILQ_INSERT_HEAD(&unused_inodes, rip, i_unused);
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
} else {
|
2006-10-25 15:40:36 +02:00
|
|
|
/* unused, put at the back of the LRU (cache it) */
|
|
|
|
TAILQ_INSERT_TAIL(&unused_inodes, rip, i_unused);
|
|
|
|
}
|
2005-04-21 16:53:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-25 15:40:36 +02:00
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* alloc_inode *
|
|
|
|
*===========================================================================*/
|
2013-03-07 15:46:21 +01:00
|
|
|
struct inode *alloc_inode(dev_t dev, pmode_t bits)
|
2005-04-21 16:53:53 +02:00
|
|
|
{
|
|
|
|
/* Allocate a free inode on 'dev', and return a pointer to it. */
|
|
|
|
|
|
|
|
register struct inode *rip;
|
|
|
|
register struct super_block *sp;
|
|
|
|
int major, minor, inumb;
|
|
|
|
bit_t b;
|
|
|
|
|
|
|
|
sp = get_super(dev); /* get pointer to super_block */
|
|
|
|
if (sp->s_rd_only) { /* can't allocate an inode on a read only device. */
|
|
|
|
err_code = EROFS;
|
2010-05-10 15:26:00 +02:00
|
|
|
return(NULL);
|
2005-04-21 16:53:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Acquire an inode from the bit map. */
|
|
|
|
b = alloc_bit(sp, IMAP, sp->s_isearch);
|
|
|
|
if (b == NO_BIT) {
|
2010-08-05 13:37:06 +02:00
|
|
|
err_code = ENOSPC;
|
2012-12-12 14:30:19 +01:00
|
|
|
major = major(sp->s_dev);
|
|
|
|
minor = minor(sp->s_dev);
|
2006-10-25 15:40:36 +02:00
|
|
|
printf("Out of i-nodes on device %d/%d\n", major, minor);
|
2010-05-10 15:26:00 +02:00
|
|
|
return(NULL);
|
2005-04-21 16:53:53 +02:00
|
|
|
}
|
|
|
|
sp->s_isearch = b; /* next time start here */
|
|
|
|
inumb = (int) b; /* be careful not to pass unshort as param */
|
|
|
|
|
|
|
|
/* Try to acquire a slot in the inode table. */
|
2010-05-10 15:26:00 +02:00
|
|
|
if ((rip = get_inode(NO_DEV, inumb)) == NULL) {
|
2005-04-21 16:53:53 +02:00
|
|
|
/* No inode table slots available. Free the inode just allocated. */
|
|
|
|
free_bit(sp, IMAP, b);
|
|
|
|
} else {
|
|
|
|
/* An inode slot is available. Put the inode just allocated into it. */
|
|
|
|
rip->i_mode = bits; /* set up RWX bits */
|
2010-06-01 14:35:33 +02:00
|
|
|
rip->i_nlinks = NO_LINK; /* initial no links */
|
2006-10-25 15:40:36 +02:00
|
|
|
rip->i_uid = caller_uid; /* file's uid is owner's */
|
|
|
|
rip->i_gid = caller_gid; /* ditto group id */
|
2005-04-21 16:53:53 +02:00
|
|
|
rip->i_dev = dev; /* mark which device it is on */
|
|
|
|
rip->i_ndzones = sp->s_ndzones; /* number of direct zones */
|
|
|
|
rip->i_nindirs = sp->s_nindirs; /* number of indirect zones per blk*/
|
|
|
|
rip->i_sp = sp; /* pointer to super block */
|
|
|
|
|
|
|
|
/* Fields not cleared already are cleared in wipe_inode(). They have
|
|
|
|
* been put there because truncate() needs to clear the same fields if
|
|
|
|
* the file happens to be open while being truncated. It saves space
|
|
|
|
* not to repeat the code twice.
|
|
|
|
*/
|
|
|
|
wipe_inode(rip);
|
|
|
|
}
|
|
|
|
|
|
|
|
return(rip);
|
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* wipe_inode *
|
|
|
|
*===========================================================================*/
|
2012-03-25 20:25:53 +02:00
|
|
|
static void wipe_inode(rip)
|
2005-04-21 16:53:53 +02:00
|
|
|
register struct inode *rip; /* the inode to be erased */
|
|
|
|
{
|
|
|
|
/* Erase some fields in the inode. This function is called from alloc_inode()
|
|
|
|
* when a new inode is to be allocated, and from truncate(), when an existing
|
|
|
|
* inode is to be truncated.
|
|
|
|
*/
|
|
|
|
|
|
|
|
register int i;
|
|
|
|
|
|
|
|
rip->i_size = 0;
|
|
|
|
rip->i_update = ATIME | CTIME | MTIME; /* update all times later */
|
2011-12-22 01:29:27 +01:00
|
|
|
IN_MARKDIRTY(rip);
|
2005-04-21 16:53:53 +02:00
|
|
|
for (i = 0; i < V2_NR_TZONES; i++) rip->i_zone[i] = NO_ZONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* free_inode *
|
|
|
|
*===========================================================================*/
|
2012-03-25 20:25:53 +02:00
|
|
|
static void free_inode(
|
2010-04-13 12:58:41 +02:00
|
|
|
dev_t dev, /* on which device is the inode? */
|
2013-03-07 15:46:21 +01:00
|
|
|
pino_t inumb /* number of the inode to be freed */
|
2010-04-13 12:58:41 +02:00
|
|
|
)
|
2005-04-21 16:53:53 +02:00
|
|
|
{
|
|
|
|
/* Return an inode to the pool of unallocated inodes. */
|
|
|
|
|
|
|
|
register struct super_block *sp;
|
|
|
|
bit_t b;
|
|
|
|
|
|
|
|
/* Locate the appropriate super_block. */
|
|
|
|
sp = get_super(dev);
|
2010-06-09 11:56:43 +02:00
|
|
|
if (inumb == NO_ENTRY || inumb > sp->s_ninodes) return;
|
2010-06-01 14:35:33 +02:00
|
|
|
b = (bit_t) inumb;
|
2005-04-21 16:53:53 +02:00
|
|
|
free_bit(sp, IMAP, b);
|
|
|
|
if (b < sp->s_isearch) sp->s_isearch = b;
|
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* update_times *
|
|
|
|
*===========================================================================*/
|
2012-03-25 20:25:53 +02:00
|
|
|
void update_times(rip)
|
2005-04-21 16:53:53 +02:00
|
|
|
register struct inode *rip; /* pointer to inode to be read/written */
|
|
|
|
{
|
|
|
|
/* Various system calls are required by the standard to update atime, ctime,
|
|
|
|
* or mtime. Since updating a time requires sending a message to the clock
|
|
|
|
* task--an expensive business--the times are marked for update by setting
|
|
|
|
* bits in i_update. When a stat, fstat, or sync is done, or an inode is
|
|
|
|
* released, update_times() may be called to actually fill in the times.
|
|
|
|
*/
|
|
|
|
|
|
|
|
time_t cur_time;
|
|
|
|
struct super_block *sp;
|
|
|
|
|
|
|
|
sp = rip->i_sp; /* get pointer to super block. */
|
|
|
|
if (sp->s_rd_only) return; /* no updates for read-only file systems */
|
|
|
|
|
|
|
|
cur_time = clock_time();
|
|
|
|
if (rip->i_update & ATIME) rip->i_atime = cur_time;
|
|
|
|
if (rip->i_update & CTIME) rip->i_ctime = cur_time;
|
|
|
|
if (rip->i_update & MTIME) rip->i_mtime = cur_time;
|
|
|
|
rip->i_update = 0; /* they are all up-to-date now */
|
|
|
|
}
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* rw_inode *
|
|
|
|
*===========================================================================*/
|
2012-03-25 20:25:53 +02:00
|
|
|
void rw_inode(rip, rw_flag)
|
2005-04-21 16:53:53 +02:00
|
|
|
register struct inode *rip; /* pointer to inode to be read/written */
|
|
|
|
int rw_flag; /* READING or WRITING */
|
|
|
|
{
|
|
|
|
/* An entry in the inode table is to be copied to or from the disk. */
|
|
|
|
|
|
|
|
register struct buf *bp;
|
|
|
|
register struct super_block *sp;
|
|
|
|
d2_inode *dip2;
|
|
|
|
block_t b, offset;
|
|
|
|
|
|
|
|
/* Get the block where the inode resides. */
|
|
|
|
sp = get_super(rip->i_dev); /* get pointer to super block */
|
|
|
|
rip->i_sp = sp; /* inode must contain super block pointer */
|
2009-12-21 12:20:30 +01:00
|
|
|
offset = START_BLOCK + sp->s_imap_blocks + sp->s_zmap_blocks;
|
2005-04-21 16:53:53 +02:00
|
|
|
b = (block_t) (rip->i_num - 1)/sp->s_inodes_per_block + offset;
|
|
|
|
bp = get_block(rip->i_dev, b, NORMAL);
|
2012-10-16 17:40:39 +02:00
|
|
|
dip2 = b_v2_ino(bp) + (rip->i_num - 1) %
|
2005-08-29 18:47:18 +02:00
|
|
|
V2_INODES_PER_BLOCK(sp->s_block_size);
|
2005-04-21 16:53:53 +02:00
|
|
|
|
|
|
|
/* Do the read or write. */
|
|
|
|
if (rw_flag == WRITING) {
|
|
|
|
if (rip->i_update) update_times(rip); /* times need updating */
|
2011-12-22 01:29:27 +01:00
|
|
|
if (sp->s_rd_only == FALSE) MARKDIRTY(bp);
|
2005-04-21 16:53:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy the inode from the disk block to the in-core table or vice versa.
|
|
|
|
* If the fourth parameter below is FALSE, the bytes are swapped.
|
|
|
|
*/
|
2013-09-16 22:52:36 +02:00
|
|
|
assert(sp->s_version == V3);
|
|
|
|
new_icopy(rip, dip2, rw_flag, sp->s_native);
|
2005-04-21 16:53:53 +02:00
|
|
|
|
|
|
|
put_block(bp, INODE_BLOCK);
|
2011-12-22 01:29:27 +01:00
|
|
|
IN_MARKCLEAN(rip);
|
2005-04-21 16:53:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* new_icopy *
|
|
|
|
*===========================================================================*/
|
2012-03-25 20:25:53 +02:00
|
|
|
static void new_icopy(rip, dip, direction, norm)
|
2005-04-21 16:53:53 +02:00
|
|
|
register struct inode *rip; /* pointer to the in-core inode struct */
|
|
|
|
register d2_inode *dip; /* pointer to the d2_inode struct */
|
|
|
|
int direction; /* READING (from disk) or WRITING (to disk) */
|
|
|
|
int norm; /* TRUE = do not swap bytes; FALSE = swap */
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (direction == READING) {
|
|
|
|
/* Copy V2.x inode to the in-core table, swapping bytes if need be. */
|
2013-03-07 15:46:21 +01:00
|
|
|
rip->i_mode = (pmode_t) conv2(norm,dip->d2_mode);
|
2010-06-01 14:35:33 +02:00
|
|
|
rip->i_uid = (uid_t) conv2(norm,dip->d2_uid);
|
|
|
|
rip->i_nlinks = (nlink_t) conv2(norm,dip->d2_nlinks);
|
|
|
|
rip->i_gid = (gid_t) conv2(norm,dip->d2_gid);
|
|
|
|
rip->i_size = (off_t) conv4(norm,dip->d2_size);
|
|
|
|
rip->i_atime = (time_t) conv4(norm,dip->d2_atime);
|
|
|
|
rip->i_ctime = (time_t) conv4(norm,dip->d2_ctime);
|
|
|
|
rip->i_mtime = (time_t) conv4(norm,dip->d2_mtime);
|
2005-04-21 16:53:53 +02:00
|
|
|
rip->i_ndzones = V2_NR_DZONES;
|
|
|
|
rip->i_nindirs = V2_INDIRECTS(rip->i_sp->s_block_size);
|
|
|
|
for (i = 0; i < V2_NR_TZONES; i++)
|
2010-06-01 14:35:33 +02:00
|
|
|
rip->i_zone[i] = (zone_t) conv4(norm, (long) dip->d2_zone[i]);
|
2005-04-21 16:53:53 +02:00
|
|
|
} else {
|
|
|
|
/* Copying V2.x inode to disk from the in-core table. */
|
2010-06-01 14:35:33 +02:00
|
|
|
dip->d2_mode = (u16_t) conv2(norm,rip->i_mode);
|
|
|
|
dip->d2_uid = (i16_t) conv2(norm,rip->i_uid);
|
|
|
|
dip->d2_nlinks = (u16_t) conv2(norm,rip->i_nlinks);
|
|
|
|
dip->d2_gid = (u16_t) conv2(norm,rip->i_gid);
|
|
|
|
dip->d2_size = (i32_t) conv4(norm,rip->i_size);
|
|
|
|
dip->d2_atime = (i32_t) conv4(norm,rip->i_atime);
|
|
|
|
dip->d2_ctime = (i32_t) conv4(norm,rip->i_ctime);
|
|
|
|
dip->d2_mtime = (i32_t) conv4(norm,rip->i_mtime);
|
2005-04-21 16:53:53 +02:00
|
|
|
for (i = 0; i < V2_NR_TZONES; i++)
|
2010-06-01 14:35:33 +02:00
|
|
|
dip->d2_zone[i] = (zone_t) conv4(norm, (long) rip->i_zone[i]);
|
2005-04-21 16:53:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* dup_inode *
|
|
|
|
*===========================================================================*/
|
2012-03-25 20:25:53 +02:00
|
|
|
void dup_inode(ip)
|
2005-04-21 16:53:53 +02:00
|
|
|
struct inode *ip; /* The inode to be duplicated. */
|
|
|
|
{
|
|
|
|
/* This routine is a simplified form of get_inode() for the case where
|
|
|
|
* the inode pointer is already known.
|
|
|
|
*/
|
|
|
|
|
|
|
|
ip->i_count++;
|
|
|
|
}
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
|