summaryrefslogtreecommitdiffstats
path: root/fs/affs
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1998-08-25 09:12:35 +0000
committerRalf Baechle <ralf@linux-mips.org>1998-08-25 09:12:35 +0000
commitc7fc24dc4420057f103afe8fc64524ebc25c5d37 (patch)
tree3682407a599b8f9f03fc096298134cafba1c9b2f /fs/affs
parent1d793fade8b063fde3cf275bf1a5c2d381292cd9 (diff)
o Merge with Linux 2.1.116.
o New Newport console code. o New G364 console code.
Diffstat (limited to 'fs/affs')
-rw-r--r--fs/affs/Changes28
-rw-r--r--fs/affs/Makefile6
-rw-r--r--fs/affs/amigaffs.c16
-rw-r--r--fs/affs/bitmap.c21
-rw-r--r--fs/affs/dir.c2
-rw-r--r--fs/affs/file.c210
-rw-r--r--fs/affs/inode.c7
-rw-r--r--fs/affs/namei.c6
-rw-r--r--fs/affs/super.c12
9 files changed, 176 insertions, 132 deletions
diff --git a/fs/affs/Changes b/fs/affs/Changes
index 851b0514a..0432bdd0d 100644
--- a/fs/affs/Changes
+++ b/fs/affs/Changes
@@ -28,13 +28,33 @@ Known bugs:
Please direct bug reports to: hjw@zvw.de
+Version 3.9
+-----------
+
+- Moved cleanup from release_file() to put_inode().
+ This makes the first one obsolete.
+
+- truncate() zeroes the unused remainder of a
+ partially used last block when a file is truncated.
+ It also marks the inode dirty now (which is not
+ really necessary as notify_change() will do
+ it anyway).
+
+- Added a few comments, fixed some typos (and
+ introduced some new ones), made the debug messages
+ more consistent. Changed a bad example in the
+ doc file (affs.txt).
+
+- Sets the NOEXEC flag in read_super() for old file
+ systems, since you can't run programs on them.
+
Version 3.8
-----------
Bill Hawes kindly reviewed the affs and sent me the
patches he did. They're marked (BH). Thanks, Bill!
- Cleanup of error handling in read_super().
- Didn't release all ressources in case of an
+ Didn't release all resources in case of an
error. (BH)
- put_inode() releases the ext cache only if it's
@@ -52,7 +72,7 @@ patches he did. They're marked (BH). Thanks, Bill!
- getblock() did not invalidate the key cache
when it allocated a new block.
-- Removed some unneccessary locks as Bill
+- Removed some unnecessary locks as Bill
suggested.
- Simplified match_name(), changed all hashing
@@ -109,7 +129,7 @@ Version 3.6
directory changes).
- Handling of hard links rewritten. To the VFS
- they appear now as normal unix links. They are
+ they appear now as normal Unix links. They are
now resolved only once in lookup(). The backside
is that unlink(), rename() and rmdir() have to
be smart about them, but the result is worth the
@@ -145,7 +165,7 @@ Version 3.6
- Argument to volume option could overflow the
name buffer. It is now silently truncated to
- 30 characters. (Damnit! This kind of bug
+ 30 characters. (Damn it! This kind of bug
is too embarrassing.)
- Split inode.c into 2 files, the superblock
diff --git a/fs/affs/Makefile b/fs/affs/Makefile
index 1dba61b41..c0def3c92 100644
--- a/fs/affs/Makefile
+++ b/fs/affs/Makefile
@@ -1,11 +1,11 @@
#
-# Makefile for the linux affs-filesystem routines.
+# Makefile for the Linux affs filesystem routines.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
+# unless it's something special (not a .c file).
#
-# Note 2! The CFLAGS definitions are now in the main makefile...
+# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := affs.o
O_OBJS := super.o namei.o inode.o file.o dir.o amigaffs.o bitmap.o symlink.o
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
index 68c61753b..d01f618c8 100644
--- a/fs/affs/amigaffs.c
+++ b/fs/affs/amigaffs.c
@@ -24,7 +24,6 @@ static char ErrorBuffer[256];
/*
* Functions for accessing Amiga-FFS structures.
- *
*/
/* Set *NAME to point to the file name in a file header block in memory
@@ -85,7 +84,7 @@ affs_insert_hash(unsigned long next, struct buffer_head *file, struct inode *ino
return 0;
}
-/* Remove a header block from it's hash table (directory).
+/* Remove a header block from its hash table (directory).
* 'inode' may be any inode on the partition, it's only
* used for calculating the block size and superblock
* reference.
@@ -214,7 +213,7 @@ affs_remove_header(struct buffer_head *bh, struct inode *inode)
/* Mark directory as changed. We do this before anything else,
* as it must be done anyway and doesn't hurt even if an
- * error occures later.
+ * error occurs later.
*/
dir = iget(inode->i_sb,be32_to_cpu(FILE_END(bh->b_data,inode)->parent));
if (!dir)
@@ -226,7 +225,7 @@ affs_remove_header(struct buffer_head *bh, struct inode *inode)
orig_ino = be32_to_cpu(FILE_END(bh->b_data,inode)->original);
if (orig_ino) { /* This is just a link. Nothing much to do. */
- pr_debug(" Removing link.\n");
+ pr_debug("AFFS: Removing link.\n");
if ((error = affs_remove_link(bh,inode)))
return error;
if ((error = affs_remove_hash(bh,inode)))
@@ -237,7 +236,7 @@ affs_remove_header(struct buffer_head *bh, struct inode *inode)
link_ino = be32_to_cpu(FILE_END(bh->b_data,inode)->link_chain);
if (link_ino) { /* This is the complicated case. Yuck. */
- pr_debug(" Removing original with links to it.\n");
+ pr_debug("AFFS: Removing original with links to it.\n");
/* Unlink the object and its first link from their directories. */
if ((error = affs_remove_hash(bh,inode)))
return error;
@@ -275,7 +274,7 @@ affs_remove_header(struct buffer_head *bh, struct inode *inode)
return 1;
}
/* Plain file/dir. This is the simplest case. */
- pr_debug(" Removing plain file/dir.\n");
+ pr_debug("AFFS: Removing plain file/dir.\n");
if ((error = affs_remove_hash(bh,inode)))
return error;
return 0;
@@ -308,6 +307,11 @@ affs_checksum_block(int bsize, void *data, s32 *ptype, s32 *stype)
return sum;
}
+/*
+ * Calculate the checksum of a disk block and store it
+ * at the indicated position.
+ */
+
void
affs_fix_checksum(int bsize, void *data, int cspos)
{
diff --git a/fs/affs/bitmap.c b/fs/affs/bitmap.c
index 26098dd19..718a73970 100644
--- a/fs/affs/bitmap.c
+++ b/fs/affs/bitmap.c
@@ -103,6 +103,15 @@ affs_free_block(struct super_block *sb, s32 block)
unlock_super(sb);
}
+/*
+ * Allocate a block in the given allocation zone.
+ * Since we have to byte-swap the bitmap on little-endian
+ * machines, this is rather expensive. Therefor we will
+ * preallocate up to 16 blocks from the same word, if
+ * possible. We are not doing preallocations in the
+ * header zone, though.
+ */
+
static s32
affs_balloc(struct inode *inode, int zone_no)
{
@@ -174,6 +183,8 @@ found:
return block;
}
+/* Find a new allocation zone, starting at zone_no. */
+
static int
affs_find_new_zone(struct super_block *sb, int zone_no)
{
@@ -257,12 +268,14 @@ affs_find_new_zone(struct super_block *sb, int zone_no)
zone->z_end = zone->z_start + az->az_size;
zone->z_az_no = i;
zone->z_lru_time = jiffies;
- pr_debug(" ++ found zone (%d) in bm %d at lw offset %d with %d free blocks\n",
+ pr_debug("AFFS: found zone (%d) in bm %d at lw offset %d with %d free blocks\n",
i,(i >> (sb->s_blocksize_bits - 7)),zone->z_start,az->az_free);
unlock_super(sb);
return az->az_free;
}
+/* Allocate a new header block. */
+
s32
affs_new_header(struct inode *inode)
{
@@ -292,6 +305,8 @@ init_block:
return block;
}
+/* Allocate a new data block. */
+
s32
affs_new_data(struct inode *inode)
{
@@ -378,9 +393,7 @@ affs_make_zones(struct super_block *sb)
pr_debug("AFFS: make_zones(): num_zones=%d\n",sb->u.affs_sb.s_num_az);
mid = (sb->u.affs_sb.s_num_az + 1) / 2;
- sb->u.affs_sb.s_zones[0].z_az_no = mid;
- affs_find_new_zone(sb,0);
- for (i = 1; i < MAX_ZONES; i++) {
+ for (i = 0; i < MAX_ZONES; i++) {
sb->u.affs_sb.s_zones[i].z_az_no = mid;
affs_find_new_zone(sb,i);
}
diff --git a/fs/affs/dir.c b/fs/affs/dir.c
index d98ab280d..4cc742179 100644
--- a/fs/affs/dir.c
+++ b/fs/affs/dir.c
@@ -5,7 +5,7 @@
*
* (C) 1993 Ray Burr - Modified for Amiga FFS filesystem.
*
- * (C) 1992 Eric Youngdale Modified for ISO9660 filesystem.
+ * (C) 1992 Eric Youngdale Modified for ISO 9660 filesystem.
*
* (C) 1991 Linus Torvalds - minix filesystem
*
diff --git a/fs/affs/file.c b/fs/affs/file.c
index d0d4bd7bc..6f0db87fd 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -5,7 +5,7 @@
*
* (C) 1993 Ray Burr - Modified for Amiga FFS filesystem.
*
- * (C) 1992 Eric Youngdale Modified for ISO9660 filesystem.
+ * (C) 1992 Eric Youngdale Modified for ISO 9660 filesystem.
*
* (C) 1991 Linus Torvalds - minix filesystem
*
@@ -41,7 +41,6 @@ static struct buffer_head *affs_getblock(struct inode *inode, s32 block);
static ssize_t affs_file_read_ofs(struct file *filp, char *buf, size_t count, loff_t *ppos);
static ssize_t affs_file_write(struct file *filp, const char *buf, size_t count, loff_t *ppos);
static ssize_t affs_file_write_ofs(struct file *filp, const char *buf, size_t cnt, loff_t *ppos);
-static int affs_release_file(struct inode *inode, struct file *filp);
static int alloc_ext_cache(struct inode *inode);
static struct file_operations affs_file_operations = {
@@ -53,7 +52,7 @@ static struct file_operations affs_file_operations = {
NULL, /* ioctl - default */
generic_file_mmap, /* mmap */
NULL, /* no special open */
- affs_release_file, /* release */
+ NULL, /* release */
file_fsync, /* brute force, but works */
NULL, /* fasync */
NULL, /* check_media_change */
@@ -93,7 +92,7 @@ static struct file_operations affs_file_operations_ofs = {
NULL, /* ioctl - default */
NULL, /* mmap */
NULL, /* no special open */
- affs_release_file, /* release */
+ NULL, /* release */
file_fsync, /* brute force, but works */
NULL, /* fasync */
NULL, /* check_media_change */
@@ -135,7 +134,7 @@ struct inode_operations affs_file_inode_operations_ofs = {
/* The keys of the extension blocks are stored in a 512-entry
* deep cache. In order to save memory, not every key of later
* extension blocks is stored - the larger the file gets, the
- * bigger the holes inbetween.
+ * bigger the holes in between.
*/
static int
@@ -184,7 +183,7 @@ seqnum_to_index(int seqnum)
}
/* Now the other way round: Calculate the sequence
- * number of a extension block of a key at the
+ * number of an extension block of a key at the
* given index in the cache.
*/
@@ -350,8 +349,8 @@ affs_bmap(struct inode *inode, int block)
/* With the affs, getting a random block from a file is not
* a simple business. Since this fs does not allow holes,
- * it may be neccessary to allocate all the missing blocks
- * inbetween, as well as some new extension blocks. The OFS
+ * it may be necessary to allocate all the missing blocks
+ * in between, as well as some new extension blocks. The OFS
* is even worse: All data blocks contain pointers to the
* next ones, so you have to fix [n-1] after allocating [n].
* What a mess.
@@ -545,7 +544,7 @@ affs_file_read_ofs(struct file *filp, char *buf, size_t count, loff_t *ppos)
}
blocksize = AFFS_I2BSIZE(inode) - 24;
if (!(S_ISREG(inode->i_mode))) {
- pr_debug("affs_file_read: mode = %07o",inode->i_mode);
+ pr_debug("AFFS: file_read: mode = %07o",inode->i_mode);
return -EINVAL;
}
if (*ppos >= inode->i_size || count <= 0)
@@ -680,11 +679,8 @@ affs_file_write_ofs(struct file *filp, const char *buf, size_t count, loff_t *pp
inode->i_mode);
return -EINVAL;
}
- if (!inode->u.affs_i.i_ec) {
- if (alloc_ext_cache(inode)) {
- return -ENOMEM;
- }
- }
+ if (!inode->u.affs_i.i_ec && alloc_ext_cache(inode))
+ return -ENOMEM;
if (filp->f_flags & O_APPEND)
pos = inode->i_size;
else
@@ -740,11 +736,13 @@ affs_file_write_ofs(struct file *filp, const char *buf, size_t count, loff_t *pp
return written;
}
-/* Free any preallocated blocks */
+/* Free any preallocated blocks. */
+
void
affs_free_prealloc(struct inode *inode)
{
- struct super_block *sb = inode->i_sb;
+ struct super_block *sb = inode->i_sb;
+ struct affs_zone *zone;
int block;
pr_debug("AFFS: free_prealloc(ino=%lu)\n", inode->i_ino);
@@ -755,123 +753,141 @@ affs_free_prealloc(struct inode *inode)
inode->u.affs_i.i_pa_cnt--;
affs_free_block(sb, block);
}
+ if (inode->u.affs_i.i_zone) {
+ zone = &sb->u.affs_sb.s_zones[inode->u.affs_i.i_zone];
+ if (zone->z_ino == inode->i_ino)
+ zone->z_ino = 0;
+ }
}
+/* Truncate (or enlarge) a file to the requested size. */
+
void
affs_truncate(struct inode *inode)
{
- struct buffer_head *bh;
- struct buffer_head *ebh;
- struct affs_zone *zone;
- int first;
+ struct buffer_head *bh = NULL;
+ int first; /* First block to be thrown away */
int block;
s32 key;
s32 *keyp;
s32 ekey;
s32 ptype, stype;
int freethis;
- int blocksize;
+ int net_blocksize;
+ int blocksize = AFFS_I2BSIZE(inode);
int rem;
int ext;
pr_debug("AFFS: truncate(inode=%ld,size=%lu)\n",inode->i_ino,inode->i_size);
- blocksize = AFFS_I2BSIZE(inode) - ((inode->i_sb->u.affs_sb.s_flags & SF_OFS) ? 24 : 0);
- first = (inode->i_size + blocksize - 1) / blocksize;
+ net_blocksize = blocksize - ((inode->i_sb->u.affs_sb.s_flags & SF_OFS) ? 24 : 0);
+ first = (inode->i_size + net_blocksize - 1) / net_blocksize;
if (inode->u.affs_i.i_lastblock < first - 1) {
- if (!inode->u.affs_i.i_ec) {
- if (alloc_ext_cache(inode)) {
- /* Fine! No way to indicate an error. What can we do? */
- return;
- }
+ /* There has to be at least one new block to be allocated */
+ if (!inode->u.affs_i.i_ec && alloc_ext_cache(inode)) {
+ /* XXX Fine! No way to indicate an error. */
+ return /* -ENOSPC */;
}
bh = affs_getblock(inode,first - 1);
-
- affs_free_prealloc(inode);
- if (inode->u.affs_i.i_zone) {
- lock_super(inode->i_sb);
- zone = &inode->i_sb->u.affs_sb.s_zones[inode->u.affs_i.i_zone];
- if (zone->z_ino == inode->i_ino)
- zone->z_ino = 0;
- unlock_super(inode->i_sb);
- }
if (!bh) {
affs_warning(inode->i_sb,"truncate","Cannot extend file");
- inode->i_size = blocksize * (inode->u.affs_i.i_lastblock + 1);
+ inode->i_size = net_blocksize * (inode->u.affs_i.i_lastblock + 1);
} else if (inode->i_sb->u.affs_sb.s_flags & SF_OFS) {
- rem = inode->i_size % blocksize;
- DATA_FRONT(bh)->data_size = cpu_to_be32(rem ? rem : blocksize);
- affs_fix_checksum(AFFS_I2BSIZE(inode),bh->b_data,5);
+ rem = inode->i_size % net_blocksize;
+ DATA_FRONT(bh)->data_size = cpu_to_be32(rem ? rem : net_blocksize);
+ affs_fix_checksum(blocksize,bh->b_data,5);
mark_buffer_dirty(bh,0);
}
- affs_brelse(bh);
- return;
+ goto out_truncate;
}
- ekey = inode->i_ino;
- ext = 0;
+ ekey = inode->i_ino;
+ ext = 0;
+ /* Free all blocks starting at 'first' and all then-empty
+ * extension blocks. Do not free the header block, though.
+ */
while (ekey) {
- if (!(bh = affs_bread(inode->i_dev,ekey,AFFS_I2BSIZE(inode)))) {
+ if (!(bh = affs_bread(inode->i_dev,ekey,blocksize))) {
affs_error(inode->i_sb,"truncate","Cannot read block %d",ekey);
- break;
+ goto out_truncate;
+ }
+ if (affs_checksum_block(blocksize,bh->b_data,&ptype,&stype)) {
+ affs_error(inode->i_sb,"truncate","Checksum error in header/ext block %d",
+ ekey);
+ goto out_truncate;
}
- ptype = be32_to_cpu(((struct file_front *)bh->b_data)->primary_type);
- stype = be32_to_cpu(FILE_END(bh->b_data,inode)->secondary_type);
if (stype != ST_FILE || (ptype != T_SHORT && ptype != T_LIST)) {
- affs_error(inode->i_sb,"truncate","Bad block (ptype=%d, stype=%d)",
- ptype,stype);
- affs_brelse(bh);
- break;
+ affs_error(inode->i_sb,"truncate",
+ "Bad block (key=%d, ptype=%d, stype=%d)",ekey,ptype,stype);
+ goto out_truncate;
}
- /* Do not throw away file header */
+ /* Do we have to free this extension block after
+ * freeing the data blocks pointed to?
+ */
freethis = first == 0 && ekey != inode->i_ino;
+
+ /* Free the data blocks. 'first' is relative to this
+ * extension block and may well lie behind this block.
+ */
for (block = first; block < AFFS_I2HSIZE(inode); block++) {
keyp = &AFFS_BLOCK(bh->b_data,inode,block);
key = be32_to_cpu(*keyp);
if (key) {
*keyp = 0;
affs_free_block(inode->i_sb,key);
- } else {
- block = AFFS_I2HSIZE(inode);
+ } else
break;
- }
}
- keyp = &GET_END_PTR(struct file_end,bh->b_data,AFFS_I2BSIZE(inode))->extension;
+ keyp = &GET_END_PTR(struct file_end,bh->b_data,blocksize)->extension;
key = be32_to_cpu(*keyp);
+
+ /* If 'first' is in this block or is the first
+ * in the next one, this will be the last in
+ * the list, thus we have to adjust the count
+ * and zero the pointer to the next ext block.
+ */
if (first <= AFFS_I2HSIZE(inode)) {
- ((struct file_front *)bh->b_data)->block_count = be32_to_cpu(first);
+ ((struct file_front *)bh->b_data)->block_count = cpu_to_be32(first);
first = 0;
*keyp = 0;
- if ((inode->i_sb->u.affs_sb.s_flags & SF_OFS) && first > 0) {
- block = be32_to_cpu(AFFS_BLOCK(bh->b_data,inode,first - 1));
- if ((ebh = affs_bread(inode->i_dev,block,AFFS_I2BSIZE(inode)))) {
- if(!(affs_checksum_block(AFFS_I2BSIZE(inode),ebh->b_data,
- &ptype,NULL))) {
- rem = inode->i_size % blocksize;
- rem = cpu_to_be32(rem ? blocksize : rem);
- ((struct data_front *)ebh->b_data)->data_size = rem;
- ((struct data_front *)ebh->b_data)->next_data = 0;
- affs_fix_checksum(AFFS_I2BSIZE(inode),ebh->b_data,5);
- mark_buffer_dirty(ebh,1);
- }
- affs_brelse(ebh);
- }
- }
- } else {
+ affs_fix_checksum(blocksize,bh->b_data,5);
+ mark_buffer_dirty(bh,1);
+ } else
first -= AFFS_I2HSIZE(inode);
- }
- if (freethis) { /* Don't bother fixing checksum */
- affs_brelse(bh);
+ affs_brelse(bh);
+ bh = NULL;
+ if (freethis) /* Don't bother fixing checksum */
affs_free_block(inode->i_sb,ekey);
- } else {
- affs_fix_checksum(AFFS_I2BSIZE(inode),bh->b_data,5);
- mark_buffer_dirty(bh,1);
- affs_brelse(bh);
- }
ekey = key;
}
- inode->u.affs_i.i_lastblock = ((inode->i_size + blocksize - 1) / blocksize) - 1;
+ block = ((inode->i_size + net_blocksize - 1) / net_blocksize) - 1;
+ inode->u.affs_i.i_lastblock = block;
+
+ /* If the file is not truncated to a block boundary,
+ * the partial block after the EOF must be zeroed
+ * so it cannot become accessible again.
+ */
+
+ rem = inode->i_size % net_blocksize;
+ if (rem) {
+ if ((inode->i_sb->u.affs_sb.s_flags & SF_OFS))
+ rem += 24;
+ pr_debug("AFFS: Zeroing from offset %d in block %d\n",rem,block);
+ bh = affs_getblock(inode,block);
+ if (bh) {
+ memset(bh->b_data + rem,0,blocksize - rem);
+ if ((inode->i_sb->u.affs_sb.s_flags & SF_OFS)) {
+ ((struct data_front *)bh->b_data)->data_size = cpu_to_be32(rem);
+ ((struct data_front *)bh->b_data)->next_data = 0;
+ affs_fix_checksum(blocksize,bh->b_data,5);
+ }
+ mark_buffer_dirty(bh,1);
+ } else
+ affs_error(inode->i_sb,"truncate","Cannot read block %d",block);
+ }
+out_truncate:
+ affs_brelse(bh);
/* Invalidate cache */
if (inode->u.affs_i.i_ec) {
inode->u.affs_i.i_ec->max_ext = 0;
@@ -880,31 +896,13 @@ affs_truncate(struct inode *inode)
inode->u.affs_i.i_ec->kc[key].kc_last = -1;
}
}
-
-}
-
-static int
-affs_release_file(struct inode *inode, struct file *filp)
-{
- struct super_block *sb = inode->i_sb;
- struct affs_zone *zone;
-
- pr_debug("AFFS: release_file(ino=%lu)\n",inode->i_ino);
-
- if (filp->f_mode & 2) { /* Free preallocated blocks */
- affs_free_prealloc(inode);
- if (inode->u.affs_i.i_zone) {
- zone = &sb->u.affs_sb.s_zones[inode->u.affs_i.i_zone];
- if (zone->z_ino == inode->i_ino)
- zone->z_ino = 0;
- }
- }
- return 0;
+ mark_inode_dirty(inode);
}
/*
* Called only when we need to allocate the extension cache.
*/
+
static int
alloc_ext_cache(struct inode *inode)
{
@@ -928,9 +926,7 @@ alloc_ext_cache(struct inode *inode)
/* We only have to initialize non-zero values.
* get_free_page() zeroed the page already.
*/
- key = inode->u.affs_i.i_original;
- if (!inode->u.affs_i.i_original)
- key = inode->i_ino;
+ key = inode->i_ino;
inode->u.affs_i.i_ec->ec[0] = key;
for (i = 0; i < 4; i++) {
inode->u.affs_i.i_ec->kc[i].kc_this_key = key;
diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index 9dc72d6e0..55243ab83 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -255,6 +255,8 @@ affs_put_inode(struct inode *inode)
{
pr_debug("AFFS: put_inode(ino=%lu, nlink=%u)\n",
inode->i_ino,inode->i_nlink);
+
+ affs_free_prealloc(inode);
if (inode->i_count == 1) {
unsigned long cache_page = (unsigned long) inode->u.affs_i.i_ec;
if (cache_page) {
@@ -324,6 +326,11 @@ affs_new_inode(const struct inode *dir)
return inode;
}
+/*
+ * Add an entry to a directory. Create the header block
+ * and insert it into the hash table.
+ */
+
int
affs_add_entry(struct inode *dir, struct inode *link, struct inode *inode,
struct dentry *dentry, int type)
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index d6480b4ee..74d62f54e 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -253,6 +253,7 @@ affs_unlink(struct inode *dir, struct dentry *dentry)
inode->i_nlink = retval;
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+ dir->i_version = ++event;
mark_inode_dirty(inode);
d_delete(dentry);
mark_inode_dirty(dir);
@@ -277,7 +278,7 @@ affs_create(struct inode *dir, struct dentry *dentry, int mode)
if (!inode)
goto out;
- pr_debug(" -- ino=%lu\n",inode->i_ino);
+ pr_debug("AFFS: ino=%lu\n",inode->i_ino);
if (dir->i_sb->u.affs_sb.s_flags & SF_OFS)
inode->i_op = &affs_file_inode_operations_ofs;
else
@@ -390,6 +391,7 @@ affs_rmdir(struct inode *dir, struct dentry *dentry)
inode->i_nlink = retval;
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
retval = 0;
+ dir->i_version = ++event;
mark_inode_dirty(dir);
mark_inode_dirty(inode);
d_delete(dentry);
@@ -546,7 +548,7 @@ affs_rename(struct inode *old_dir, struct dentry *old_dentry,
unsigned long new_ino;
int retval;
- pr_debug("AFFS: rename(old=%lu,\"%*s\" (inode=%p) to new=%lu,\"%*s\" (inode=%p) )\n",
+ pr_debug("AFFS: rename(old=%lu,\"%*s\" (inode=%p) to new=%lu,\"%*s\" (inode=%p))\n",
old_dir->i_ino,old_dentry->d_name.len,old_dentry->d_name.name,old_inode,
new_dir->i_ino,new_dentry->d_name.len,new_dentry->d_name.name,new_inode);
diff --git a/fs/affs/super.c b/fs/affs/super.c
index ed6ae67b3..464b6df8a 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -5,7 +5,7 @@
*
* (C) 1993 Ray Burr - Modified for Amiga FFS filesystem.
*
- * (C) 1992 Eric Youngdale Modified for ISO9660 filesystem.
+ * (C) 1992 Eric Youngdale Modified for ISO 9660 filesystem.
*
* (C) 1991 Linus Torvalds - minix filesystem
*/
@@ -44,7 +44,7 @@ affs_put_super(struct super_block *sb)
{
int i;
- pr_debug("affs_put_super()\n");
+ pr_debug("AFFS: put_super()\n");
for (i = 0; i < sb->u.affs_sb.s_bm_count; i++)
affs_brelse(sb->u.affs_sb.s_bitmap[i].bm_bh);
@@ -262,7 +262,7 @@ affs_read_super(struct super_block *s, void *data, int silent)
unsigned long mount_flags;
unsigned long offset;
- pr_debug("affs_read_super(%s)\n",data ? (const char *)data : "no options");
+ pr_debug("AFFS: read_super(%s)\n",data ? (const char *)data : "no options");
MOD_INC_USE_COUNT;
lock_super(s);
@@ -396,6 +396,7 @@ got_root:
/* fall thru */
case FS_OFS:
s->u.affs_sb.s_flags |= SF_OFS;
+ s->s_flags |= MS_NOEXEC;
break;
case MUFS_DCOFS:
case MUFS_INTLOFS:
@@ -403,6 +404,7 @@ got_root:
case FS_DCOFS:
case FS_INTLOFS:
s->u.affs_sb.s_flags |= SF_INTL | SF_OFS;
+ s->s_flags |= MS_NOEXEC;
break;
default:
goto out_unknown_fs;
@@ -433,7 +435,7 @@ got_root:
ptype = num_bm * sizeof(struct affs_bm_info) +
az_no * sizeof(struct affs_alloc_zone) +
MAX_ZONES * sizeof(struct affs_zone);
- pr_debug("num_bm=%d, az_no=%d, sum=%d\n",num_bm,az_no,ptype);
+ pr_debug("AFFS: num_bm=%d, az_no=%d, sum=%d\n",num_bm,az_no,ptype);
if (!(s->u.affs_sb.s_bitmap = kmalloc(ptype, GFP_KERNEL)))
goto out_no_bitmap;
memset(s->u.affs_sb.s_bitmap,0,ptype);
@@ -597,7 +599,7 @@ out_bad_num:
mapidx, num_bm);
goto out_free_bitmap;
out_no_root:
- printk(KERN_ERR "AFFS: get root inode failed\n");
+ printk(KERN_ERR "AFFS: Get root inode failed\n");
/*
* Begin the cascaded cleanup ...