summaryrefslogtreecommitdiffstats
path: root/fs/ufs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ufs')
-rw-r--r--fs/ufs/acl.c9
-rw-r--r--fs/ufs/balloc.c4
-rw-r--r--fs/ufs/cylinder.c8
-rw-r--r--fs/ufs/dir.c6
-rw-r--r--fs/ufs/file.c3
-rw-r--r--fs/ufs/ialloc.c2
-rw-r--r--fs/ufs/inode.c4
-rw-r--r--fs/ufs/namei.c249
-rw-r--r--fs/ufs/super.c75
-rw-r--r--fs/ufs/symlink.c4
10 files changed, 159 insertions, 205 deletions
diff --git a/fs/ufs/acl.c b/fs/ufs/acl.c
index 2b6768352..b002d3398 100644
--- a/fs/ufs/acl.c
+++ b/fs/ufs/acl.c
@@ -58,8 +58,11 @@ int ufs_permission (struct inode * inode, int mask)
* Access is always granted for root. We now check last,
* though, for BSD process accounting correctness
*/
- if (((mode & mask & S_IRWXO) == mask) || fsuser())
+ if (((mode & mask & S_IRWXO) == mask) || capable(CAP_DAC_OVERRIDE))
return 0;
- else
- return -EACCES;
+ if ((mask == S_IROTH) ||
+ (S_ISDIR(mode) && !(mask & ~(S_IROTH | S_IXOTH))))
+ if (capable(CAP_DAC_READ_SEARCH))
+ return 0;
+ return -EACCES;
}
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index ed71ec179..b464318a7 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -93,7 +93,7 @@ void ufs_free_fragments (struct inode * inode, unsigned fragment, unsigned count
ufs_fragacct(sb, blkmap, ucg->cg_frsum, 1);
/*
- * Trying to reasembly free fragments into block
+ * Trying to reassemble free fragments into block
*/
blkno = ufs_fragstoblks (bbase);
if (ubh_isblockset(UCPI_UBH, ucpi->c_freeoff, blkno)) {
@@ -436,7 +436,7 @@ unsigned ufs_add_fragments (struct inode * inode, unsigned fragment,
fragsize = i - oldcount;
if (!SWAB32(ucg->cg_frsum[fragsize]))
ufs_panic (sb, "ufs_add_fragments",
- "internal error or corruted bitmap on cg %u", cgno);
+ "internal error or corrupted bitmap on cg %u", cgno);
DEC_SWAB32(ucg->cg_frsum[fragsize]);
if (fragsize != count)
INC_SWAB32(ucg->cg_frsum[fragsize - count]);
diff --git a/fs/ufs/cylinder.c b/fs/ufs/cylinder.c
index 295332d17..ed261321d 100644
--- a/fs/ufs/cylinder.c
+++ b/fs/ufs/cylinder.c
@@ -86,7 +86,7 @@ failed:
}
/*
- * Remove cylinder group from cache, does'n release memory
+ * Remove cylinder group from cache, doesn't release memory
* allocated for cylinder group (this is done at ufs_put_super only).
*/
void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr)
@@ -132,7 +132,7 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr)
* Find cylinder group in cache and return it as pointer.
* If cylinder group is not in cache, we will load it from disk.
*
- * The cache is managed by LRU alghoritm.
+ * The cache is managed by LRU algorithm.
*/
struct ufs_cg_private_info * ufs_load_cylinder (
struct super_block * sb, unsigned cgno)
@@ -161,7 +161,7 @@ struct ufs_cg_private_info * ufs_load_cylinder (
if (uspi->s_ncg <= UFS_MAX_GROUP_LOADED) {
if (sb->u.ufs_sb.s_cgno[cgno] != UFS_CGNO_EMPTY) {
if (sb->u.ufs_sb.s_cgno[cgno] != cgno) {
- ufs_panic (sb, "ufs_load_cylinder", "internal error, wrog number of cg in cache");
+ ufs_panic (sb, "ufs_load_cylinder", "internal error, wrong number of cg in cache");
UFSD(("EXIT (FAILED)\n"))
return NULL;
}
@@ -191,7 +191,7 @@ struct ufs_cg_private_info * ufs_load_cylinder (
sb->u.ufs_sb.s_ucpi[0] = ucpi;
/*
* Cylinder group number cg is not in cache, we will read it from disk
- * and put it to the first possition
+ * and put it to the first position
*/
} else {
if (sb->u.ufs_sb.s_cg_loaded < UFS_MAX_GROUP_LOADED)
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c
index 6fc224512..24810fe48 100644
--- a/fs/ufs/dir.c
+++ b/fs/ufs/dir.c
@@ -14,6 +14,7 @@
*/
#include <linux/fs.h>
+#include <linux/ufs_fs.h>
#include "swab.h"
#include "util.h"
@@ -110,9 +111,7 @@ revalidate:
brelse(bh);
return stored;
}
-#if 0 /* XXX */
- if (!ext2_check_dir_entry ("ext2_readdir", inode, de,
- /* XXX - beware about de having to be swabped somehow */
+ if (!ufs_check_dir_entry ("ufs_readdir", inode, de,
bh, offset)) {
/* On error, skip the f_pos to the
next block. */
@@ -122,7 +121,6 @@ revalidate:
brelse (bh);
return stored;
}
-#endif /* XXX */
offset += SWAB16(de->d_reclen);
if (de->d_ino) {
/* SWAB16() was unneeded -- compare to 0 */
diff --git a/fs/ufs/file.c b/fs/ufs/file.c
index d6bd7c139..7e94bfd1c 100644
--- a/fs/ufs/file.c
+++ b/fs/ufs/file.c
@@ -41,9 +41,6 @@
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
-#include <linux/fs.h>
-#include <linux/ufs_fs.h>
-
static long long ufs_file_lseek(struct file *, long long, int);
static ssize_t ufs_file_write (struct file *, const char *, size_t, loff_t *);
static int ufs_release_file (struct inode *, struct file *);
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index c592009bc..fa4dfa06a 100644
--- a/fs/ufs/ialloc.c
+++ b/fs/ufs/ialloc.c
@@ -150,7 +150,7 @@ void ufs_free_inode (struct inode * inode)
* the groups with above-average free space, that group with the fewest
* directories already is chosen.
*
- * For other inodes, search forward from the parent directory\'s block
+ * For other inodes, search forward from the parent directory's block
* group to find a free inode.
*/
struct inode * ufs_new_inode (const struct inode * dir, int mode, int * err )
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index 699d4d2c9..84e003d2d 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -1,5 +1,5 @@
/*
- * linux/ufs/ufs/inode.c
+ * linux/fs/ufs/inode.c
*
* Copyright (C) 1998
* Daniel Pirkl <daniel.pirkl@email.cz>
@@ -254,7 +254,7 @@ repeat:
SWAB32(*p), required + (blockoff - lastblockoff), err);
}
/*
- * We will allocated new block before last allocat block
+ * We will allocate new block before last allocated block
*/
else /* (lastblock > block) */ {
if (lastblock && (tmp = SWAB32(inode->u.ufs_i.i_u1.i_data[lastblock-1])))
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c
index 130d53bb5..dc5dccf4c 100644
--- a/fs/ufs/namei.c
+++ b/fs/ufs/namei.c
@@ -34,6 +34,7 @@
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/locks.h>
+#include <linux/quotaops.h>
#include "swab.h"
#include "util.h"
@@ -56,20 +57,16 @@
/*
* NOTE! unlike strncmp, ufs_match returns 1 for success, 0 for failure.
+ *
+ * len <= UFS_MAXNAMLEN and de != NULL are guaranteed by caller.
*/
-static int ufs_match (int len, const char * const name,
+static inline int ufs_match (int len, const char * const name,
struct ufs_dir_entry * de, unsigned flags, unsigned swab)
{
- if (!de || !SWAB32(de->d_ino) || len > UFS_MAXNAMLEN)
- return 0;
- /*
- * "" means "." ---> so paths like "/usr/lib//libc.a" work
- */
- if (!len && ufs_get_de_namlen(de) == 1 && (de->d_name[0] == '.') &&
- (de->d_name[1] == '\0'))
- return 1;
if (len != ufs_get_de_namlen(de))
return 0;
+ if (!de->d_ino)
+ return 0;
return !memcmp(name, de->d_name, len);
}
@@ -128,8 +125,9 @@ static struct buffer_head * ufs_find_entry (struct inode * dir,
}
bh = bh_use[block % NAMEI_RA_SIZE];
if (!bh) {
- ufs_error (sb, "ufs_find_entry",
- "directory #%lu contains a hole at offset %lu", dir->i_ino, offset);
+ ufs_error (sb, "ufs_find_entry",
+ "directory #%lu contains a hole at offset %lu",
+ dir->i_ino, offset);
offset += sb->s_blocksize;
continue;
}
@@ -144,20 +142,30 @@ static struct buffer_head * ufs_find_entry (struct inode * dir,
de = (struct ufs_dir_entry *) bh->b_data;
dlimit = bh->b_data + sb->s_blocksize;
while ((char *) de < dlimit && offset < dir->i_size) {
- if (!ufs_check_dir_entry ("ufs_find_entry", dir, de, bh, offset))
- goto failed;
- if (SWAB32(de->d_ino) != 0 && ufs_match (namelen, name, de, flags, swab)) {
+ /* this code is executed quadratically often */
+ /* do minimal checking by hand */
+ int de_len;
+
+ if ((char *) de + namelen <= dlimit &&
+ ufs_match (namelen, name, de, flags, swab)) {
+ /* found a match -
+ just to be sure, do a full check */
+ if (!ufs_check_dir_entry("ufs_find_entry",
+ dir, de, bh, offset))
+ goto failed;
for (i = 0; i < NAMEI_RA_SIZE; ++i) {
if (bh_use[i] != bh)
brelse (bh_use[i]);
}
*res_dir = de;
- UFSD(("EXIT\n"))
return bh;
}
- offset += SWAB16(de->d_reclen);
- de = (struct ufs_dir_entry *)
- ((char *) de + SWAB16(de->d_reclen));
+ /* prevent looping on a bad block */
+ de_len = SWAB16(de->d_reclen);
+ if (de_len <= 0)
+ goto failed;
+ offset += de_len;
+ de = (struct ufs_dir_entry *) ((char *) de + de_len);
}
brelse (bh);
@@ -173,7 +181,7 @@ static struct buffer_head * ufs_find_entry (struct inode * dir,
failed:
for (i = 0; i < NAMEI_RA_SIZE; ++i) brelse (bh_use[i]);
- UFSD(("EXIT (FAILED)\n"))
+ UFSD(("EXIT\n"))
return NULL;
}
@@ -298,7 +306,7 @@ static struct buffer_head * ufs_add_entry (struct inode * dir,
brelse (bh);
return NULL;
}
- if (SWAB32(de->d_ino) != 0 && ufs_match (namelen, name, de, flags, swab)) {
+ if (ufs_match (namelen, name, de, flags, swab)) {
*err = -EEXIST;
brelse (bh);
return NULL;
@@ -475,13 +483,6 @@ int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, int rdev)
inode->i_op = NULL;
if (S_ISREG(inode->i_mode))
inode->i_op = &ufs_file_inode_operations;
- else if (S_ISDIR(inode->i_mode)) {
- inode->i_op = &ufs_dir_inode_operations;
- if (dir->i_mode & S_ISGID)
- inode->i_mode |= S_ISGID;
- }
- else if (S_ISLNK(inode->i_mode))
- inode->i_op = &ufs_symlink_inode_operations;
else if (S_ISCHR(inode->i_mode))
inode->i_op = &chrdev_inode_operations;
else if (S_ISBLK(inode->i_mode))
@@ -680,49 +681,17 @@ int ufs_rmdir (struct inode * dir, struct dentry *dentry)
goto end_rmdir;
inode = dentry->d_inode;
- if (inode->i_sb->dq_op)
- inode->i_sb->dq_op->initialize (inode, -1);
-
- retval = -EPERM;
- if ((dir->i_mode & S_ISVTX) &&
- current->fsuid != inode->i_uid &&
- current->fsuid != dir->i_uid && !fsuser())
- goto end_rmdir;
- if (inode == dir) /* we may not delete ".", but "../dir" is ok */
- goto end_rmdir;
-
- retval = -ENOTDIR;
- if (!S_ISDIR(inode->i_mode))
- goto end_rmdir;
+ DQUOT_INIT(inode);
retval = -EIO;
- if (inode->i_dev != dir->i_dev)
- goto end_rmdir;
if (SWAB32(de->d_ino) != inode->i_ino)
goto end_rmdir;
- /*
- * Prune any child dentries so that this dentry becomes negative.
- */
- if (dentry->d_count > 1) {
- ufs_warning (sb, "ufs_rmdir", "d_count=%d, pruning\n", dentry->d_count);
- shrink_dcache_parent(dentry);
- }
if (!ufs_empty_dir (inode))
retval = -ENOTEMPTY;
else if (SWAB32(de->d_ino) != inode->i_ino)
retval = -ENOENT;
else {
- if (dentry->d_count > 1) {
- /*
- * Are we deleting the last instance of a busy directory?
- * Better clean up if so.
- *
- * Make directory empty (it will be truncated when finally
- * dereferenced). This also inhibits ufs_add_entry.
- */
- inode->i_size = 0;
- }
retval = ufs_delete_entry (dir, de, bh);
dir->i_version = ++event;
}
@@ -739,6 +708,7 @@ int ufs_rmdir (struct inode * dir, struct dentry *dentry)
inode->i_nlink);
inode->i_version = ++event;
inode->i_nlink = 0;
+ inode->i_size = 0;
mark_inode_dirty(inode);
dir->i_nlink--;
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
@@ -778,16 +748,7 @@ int ufs_unlink(struct inode * dir, struct dentry *dentry)
goto end_unlink;
inode = dentry->d_inode;
- if (inode->i_sb->dq_op)
- inode->i_sb->dq_op->initialize (inode, -1);
-
- retval = -EPERM;
- if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
- goto end_unlink;
- if ((dir->i_mode & S_ISVTX) &&
- current->fsuid != inode->i_uid &&
- current->fsuid != dir->i_uid && !fsuser())
- goto end_unlink;
+ DQUOT_INIT(inode);
retval = -EIO;
if (SWAB32(de->d_ino) != inode->i_ino)
@@ -823,49 +784,6 @@ out:
}
-int ufs_link (struct dentry * old_dentry, struct inode * dir,
- struct dentry *dentry)
-{
- struct super_block * sb;
- struct inode *inode = old_dentry->d_inode;
- struct ufs_dir_entry * de;
- struct buffer_head * bh;
- int err;
- unsigned swab;
-
- inode = old_dentry->d_inode;
- sb = inode->i_sb;
- swab = sb->u.ufs_sb.s_swab;
-
- if (S_ISDIR(inode->i_mode))
- return -EPERM;
-
- if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
- return -EPERM;
-
- if (inode->i_nlink >= UFS_LINK_MAX)
- return -EMLINK;
-
- bh = ufs_add_entry (dir, dentry->d_name.name, dentry->d_name.len, &de, &err);
- if (!bh)
- return err;
-
- de->d_ino = SWAB32(inode->i_ino);
- dir->i_version = ++event;
- mark_buffer_dirty(bh, 1);
- if (IS_SYNC(dir)) {
- ll_rw_block (WRITE, 1, &bh);
- wait_on_buffer (bh);
- }
- brelse (bh);
- inode->i_nlink++;
- inode->i_ctime = CURRENT_TIME;
- mark_inode_dirty(inode);
- inode->i_count++;
- d_instantiate(dentry, inode);
- return 0;
-}
-
/*
* Create symbolic link. We use only slow symlinks at this time.
*/
@@ -946,6 +864,49 @@ out_no_entry:
goto out;
}
+int ufs_link (struct dentry * old_dentry, struct inode * dir,
+ struct dentry *dentry)
+{
+ struct super_block * sb;
+ struct inode *inode = old_dentry->d_inode;
+ struct ufs_dir_entry * de;
+ struct buffer_head * bh;
+ int err;
+ unsigned swab;
+
+ inode = old_dentry->d_inode;
+ sb = inode->i_sb;
+ swab = sb->u.ufs_sb.s_swab;
+
+ if (S_ISDIR(inode->i_mode))
+ return -EPERM;
+
+ if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
+ return -EPERM;
+
+ if (inode->i_nlink >= UFS_LINK_MAX)
+ return -EMLINK;
+
+ bh = ufs_add_entry (dir, dentry->d_name.name, dentry->d_name.len, &de, &err);
+ if (!bh)
+ return err;
+
+ de->d_ino = SWAB32(inode->i_ino);
+ dir->i_version = ++event;
+ mark_buffer_dirty(bh, 1);
+ if (IS_SYNC(dir)) {
+ ll_rw_block (WRITE, 1, &bh);
+ wait_on_buffer (bh);
+ }
+ brelse (bh);
+ inode->i_nlink++;
+ inode->i_ctime = CURRENT_TIME;
+ mark_inode_dirty(inode);
+ inode->i_count++;
+ d_instantiate(dentry, inode);
+ return 0;
+}
+
#define PARENT_INO(buffer) \
((struct ufs_dir_entry *) ((char *) buffer + \
@@ -984,69 +945,47 @@ static int do_ufs_rename (struct inode * old_dir, struct dentry * old_dentry,
if (old_dentry->d_name.len > UFS_MAXNAMLEN)
goto end_rename;
- UFSD(("name %s, len %u\n", old_dentry->d_name.name, old_dentry->d_name.len))
old_bh = ufs_find_entry (old_dir, old_dentry->d_name.name, old_dentry->d_name.len, &old_de);
- UFSD(("ino %u, reclen %u, namlen %u, name %s\n", SWAB32(old_de->d_ino),
- SWAB16(old_de->d_reclen), ufs_get_de_namlen(old_de), old_de->d_name))
-
+ /*
+ * Check for inode number is _not_ due to possible IO errors.
+ * We might rmdir the source, keep it as pwd of some process
+ * and merrily kill the link to whatever was created under the
+ * same name. Goodbye sticky bit ;-<
+ */
retval = -ENOENT;
- if (!old_bh)
- goto end_rename;
old_inode = old_dentry->d_inode;
-
- retval = -EPERM;
- if ((old_dir->i_mode & S_ISVTX) &&
- current->fsuid != old_inode->i_uid &&
- current->fsuid != old_dir->i_uid && !fsuser())
- goto end_rename;
- if (IS_APPEND(old_inode) || IS_IMMUTABLE(old_inode))
+ if (!old_bh || SWAB32(old_de->d_ino) != old_inode->i_ino)
goto end_rename;
new_inode = new_dentry->d_inode;
- UFSD(("name %s, len %u\n", new_dentry->d_name.name, new_dentry->d_name.len))
new_bh = ufs_find_entry (new_dir, new_dentry->d_name.name, new_dentry->d_name.len, &new_de);
if (new_bh) {
if (!new_inode) {
brelse (new_bh);
new_bh = NULL;
} else {
- if (new_inode->i_sb->dq_op)
- new_inode->i_sb->dq_op->initialize (new_inode, -1);
+ DQUOT_INIT(new_inode);
}
}
retval = 0;
if (new_inode == old_inode)
goto end_rename;
- if (new_inode && S_ISDIR(new_inode->i_mode)) {
- retval = -EISDIR;
- if (!S_ISDIR(old_inode->i_mode))
- goto end_rename;
- retval = -EINVAL;
- if (is_subdir(new_dentry, old_dentry))
- goto end_rename;
- retval = -ENOTEMPTY;
- if (!ufs_empty_dir (new_inode))
- goto end_rename;
- retval = -EBUSY;
- if (new_dentry->d_count > 1)
- goto end_rename;
- }
- retval = -EPERM;
- if (new_inode) {
- if ((new_dir->i_mode & S_ISVTX) &&
- current->fsuid != new_inode->i_uid &&
- current->fsuid != new_dir->i_uid && !fsuser())
- goto end_rename;
- if (IS_APPEND(new_inode) || IS_IMMUTABLE(new_inode))
- goto end_rename;
- }
if (S_ISDIR(old_inode->i_mode)) {
- retval = -ENOTDIR;
- if (new_inode && !S_ISDIR(new_inode->i_mode))
- goto end_rename;
retval = -EINVAL;
if (is_subdir(new_dentry, old_dentry))
goto end_rename;
+ if (new_inode) {
+ /* Prune any children before testing for busy */
+ if (new_dentry->d_count > 1)
+ shrink_dcache_parent(new_dentry);
+ retval = -EBUSY;
+ if (new_dentry->d_count > 1)
+ goto end_rename;
+ retval = -ENOTEMPTY;
+ if (!ufs_empty_dir (new_inode))
+ goto end_rename;
+ }
+
dir_bh = ufs_bread (old_inode, 0, 0, &retval);
if (!dir_bh)
goto end_rename;
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index dd4815469..1abdbe038 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -6,7 +6,7 @@
* Charles University, Faculty of Mathematics and Physics
*/
-/* Derivated from
+/* Derived from
*
* linux/fs/ext2/super.c
*
@@ -26,7 +26,7 @@
*/
/*
- * Inspirated by
+ * Inspired by
*
* linux/fs/ufs/super.c
*
@@ -58,6 +58,7 @@
*/
+#include <linux/config.h>
#include <linux/module.h>
#include <stdarg.h>
@@ -91,7 +92,7 @@
#ifdef UFS_SUPER_DEBUG_MORE
/*
- * Print contents of ufs_super_block, useful for debuging
+ * Print contents of ufs_super_block, useful for debugging
*/
void ufs_print_super_stuff(struct ufs_super_block_first * usb1,
struct ufs_super_block_second * usb2,
@@ -136,7 +137,7 @@ void ufs_print_super_stuff(struct ufs_super_block_first * usb1,
/*
- * Print contents of ufs_cylinder_group, useful for debuging
+ * Print contents of ufs_cylinder_group, useful for debugging
*/
void ufs_print_cylinder_stuff(struct ufs_cylinder_group *cg, unsigned swab)
{
@@ -230,10 +231,6 @@ void ufs_panic (struct super_block * sb, const char * function,
sb->s_flags |= MS_RDONLY;
printk (KERN_CRIT "UFS-fs panic (device %s): %s: %s\n",
kdevname(sb->s_dev), function, error_buf);
-/***
- panic ("UFS-fs panic (device %s): %s: %s\n",
- kdevname(sb->s_dev), function, error_buf);
-***/
}
void ufs_warning (struct super_block * sb, const char * function,
@@ -274,6 +271,8 @@ static int ufs_parse_options (char * options, unsigned * mount_options)
ufs_set_opt (*mount_options, UFSTYPE_44BSD);
else if (!strcmp (value, "next"))
ufs_set_opt (*mount_options, UFSTYPE_NEXT);
+ else if (!strcmp (value, "openstep"))
+ ufs_set_opt (*mount_options, UFSTYPE_OPENSTEP);
else {
printk ("UFS-fs: Invalid type option: %s\n", value);
return 0;
@@ -306,7 +305,7 @@ static int ufs_parse_options (char * options, unsigned * mount_options)
}
/*
- * Read on-disk structures asscoiated with cylinder groups
+ * Read on-disk structures associated with cylinder groups
*/
int ufs_read_cylinder_structures (struct super_block * sb) {
struct ufs_sb_private_info * uspi;
@@ -388,7 +387,7 @@ failed:
}
/*
- * Put on-disk structures associated with cylidner groups and
+ * Put on-disk structures associated with cylinder groups and
* write them back to disk
*/
void ufs_put_cylinder_structures (struct super_block * sb) {
@@ -449,6 +448,9 @@ struct super_block * ufs_read_super (struct super_block * sb, void * data,
MOD_INC_USE_COUNT;
lock_super (sb);
+#ifndef CONFIG_UFS_FS_WRITE
+ sb->s_flags |= MS_RDONLY;
+#endif
/*
* Set default mount options
* Parse mount options
@@ -460,10 +462,10 @@ struct super_block * ufs_read_super (struct super_block * sb, void * data,
goto failed;
}
if (!(sb->u.ufs_sb.s_mount_opt & UFS_MOUNT_UFSTYPE)) {
- printk("You didn't specify type of your ufs file system\n\n"
- " mount -t ufs -o ufstype=sun|44bsd|old|next ....\n\n"
- "!!! WARNING !!! wrong value may corrupt you file system\n"
- "default value is ufstype=old\n");
+ printk("You didn't specify the type of your ufs filesystem\n\n"
+ " mount -t ufs -o ufstype=sun|44bsd|old|next|openstep ....\n\n"
+ ">>>WARNING<<< Wrong ufstype may corrupt your filesystem, "
+ "default is ufstype=old\n");
ufs_set_opt (sb->u.ufs_sb.s_mount_opt, UFSTYPE_OLD);
}
@@ -474,7 +476,7 @@ struct super_block * ufs_read_super (struct super_block * sb, void * data,
switch (sb->u.ufs_sb.s_mount_opt & UFS_MOUNT_UFSTYPE) {
case UFS_MOUNT_UFSTYPE_44BSD:
- UFSD(("44bsd ufstype\n"))
+ UFSD(("ufstype=44bsd\n"))
uspi->s_fsize = block_size = 512;
uspi->s_fmask = ~(512 - 1);
uspi->s_fshift = 9;
@@ -484,7 +486,7 @@ struct super_block * ufs_read_super (struct super_block * sb, void * data,
break;
case UFS_MOUNT_UFSTYPE_SUN:
- UFSD(("sun ufstype\n"))
+ UFSD(("ufstype=sun\n"))
uspi->s_fsize = block_size = 1024;
uspi->s_fmask = ~(1024 - 1);
uspi->s_fshift = 10;
@@ -494,7 +496,7 @@ struct super_block * ufs_read_super (struct super_block * sb, void * data,
break;
case UFS_MOUNT_UFSTYPE_OLD:
- UFSD(("old ufstype\n"))
+ UFSD(("ufstype=old\n"))
uspi->s_fsize = block_size = 1024;
uspi->s_fmask = ~(1024 - 1);
uspi->s_fshift = 10;
@@ -502,13 +504,13 @@ struct super_block * ufs_read_super (struct super_block * sb, void * data,
uspi->s_sbbase = 0;
flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD;
if (!(sb->s_flags & MS_RDONLY)) {
- printk("old type of ufs is supported read-only\n");
- goto failed;
+ printk(KERN_INFO "ufstype=old is supported read-only\n");
+ sb->s_flags |= MS_RDONLY;
}
break;
case UFS_MOUNT_UFSTYPE_NEXT:
- UFSD(("next ufstype\n"))
+ UFSD(("ufstype=next\n"))
uspi->s_fsize = block_size = 1024;
uspi->s_fmask = ~(1024 - 1);
uspi->s_fshift = 10;
@@ -516,20 +518,30 @@ struct super_block * ufs_read_super (struct super_block * sb, void * data,
uspi->s_sbbase = 0;
flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD;
if (!(sb->s_flags & MS_RDONLY)) {
- printk("nextstep type of ufs is supported read-only\n");
- goto failed;
+ printk(KERN_INFO "ufstype=next is supported read-only\n");
+ sb->s_flags |= MS_RDONLY;
}
break;
+ case UFS_MOUNT_UFSTYPE_OPENSTEP:
+ UFSD(("ufstype=openstep\n"))
+ uspi->s_fsize = block_size = 1024;
+ uspi->s_fmask = ~(1024 - 1);
+ uspi->s_fshift = 10;
+ uspi->s_sbsize = super_block_size = 2048;
+ uspi->s_sbbase = 0;
+ flags |= UFS_DE_44BSD | UFS_UID_44BSD | UFS_ST_44BSD | UFS_CG_44BSD;
+ if (!(sb->s_flags & MS_RDONLY)) {
+ printk(KERN_INFO "ufstype=openstep is supported read-only\n");
+ sb->s_flags |= MS_RDONLY;
+ }
+ break;
default:
- printk("this fs type of ufs is not supported\n");
+ printk("unknown ufstype\n");
goto failed;
}
- if (!(sb->s_flags & MS_RDONLY))
- printk("!!! warning !!! write support of ufs is still in experimental state\n");
-
again:
set_blocksize (sb->s_dev, block_size);
@@ -567,8 +579,10 @@ again:
}
#endif
- if ((sb->u.ufs_sb.s_mount_opt & UFS_MOUNT_UFSTYPE) ==
- UFS_MOUNT_UFSTYPE_NEXT && uspi->s_sbbase < 256) {
+ if ((((sb->u.ufs_sb.s_mount_opt & UFS_MOUNT_UFSTYPE) ==
+ UFS_MOUNT_UFSTYPE_NEXT) ||
+ ((sb->u.ufs_sb.s_mount_opt & UFS_MOUNT_UFSTYPE) ==
+ UFS_MOUNT_UFSTYPE_OPENSTEP)) && uspi->s_sbbase < 256) {
ubh_brelse_uspi(uspi);
ubh = NULL;
uspi->s_sbbase += 8;
@@ -623,11 +637,14 @@ magic_found:
case UFS_FSSTABLE:
UFSD(("fs is stable\n"))
break;
+ case UFS_FSOSF1:
+ UFSD(("fs is DEC OSF/1\n"))
+ break;
case UFS_FSACTIVE:
printk("ufs_read_super: fs is active\n");
sb->s_flags |= MS_RDONLY;
break;
- case UFS_FSBAD:
+ case UFS_FSBAD:
printk("ufs_read_super: fs is bad\n");
sb->s_flags |= MS_RDONLY;
break;
diff --git a/fs/ufs/symlink.c b/fs/ufs/symlink.c
index bdc38e9fe..39b54e05d 100644
--- a/fs/ufs/symlink.c
+++ b/fs/ufs/symlink.c
@@ -1,5 +1,5 @@
/*
- * linux/ufs/ufs/symlink.c
+ * linux/fs/ufs/symlink.c
*
* Copyright (C) 1998
* Daniel Pirkl <daniel.pirkl@emai.cz>
@@ -27,7 +27,7 @@
#include <linux/errno.h>
#include <linux/fs.h>
-#include <linux/ext2_fs.h>
+#include <linux/ufs_fs.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/stat.h>