#!/bin/sh -x
# this is part 171 of a 197 - part archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patch-2.4.10 continued
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 171; then
echo "Please unpack part $Scheck next!"
exit 1
else
exit 0
fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping patch-2.4.10'
else
echo 'x - continuing with patch-2.4.10'
sed 's/^X//' << 'SHAR_EOF' >> 'patch-2.4.10' &&
- cnt--;
- locit++;
- }
- /* reset to start */
- io.param = bits;
- io.size = bsize;
- error = ntfs_write_attr(bitmap, bitmap->vol->at_data, 0, loc >> 3, &io);
- ntfs_free(bits);
- if (error)
- return error;
- if (io.size != bsize)
- return -EIO;
- return 0;
-}
-
-/* Allocate count clusters around location. If location is -1, it does not
- * matter where the clusters are. Result is 0 if success, in which case
- * location and count says what they really got. */
-int ntfs_search_bits(ntfs_inode* bitmap, ntfs_cluster_t *location, int *count,
- int flags)
-{
- unsigned char *bits;
- ntfs_io io;
- int error = 0, found = 0;
- int cnt, bloc = -1, bcnt = 0;
- int start;
- ntfs_cluster_t loc;
-
- bits = ntfs_malloc(2048);
- if (!bits)
+ /* Calculate the required buffer size in bytes. */
+ buf_size = (ntfs_cluster_t)((start_bit & 7) + nr_bits + 7) >> 3;
+ if (buf_size <= (ntfs_cluster_t)(64 * 1024))
+ buf = ntfs_malloc(buf_size);
+ else
+ buf = ntfs_vmalloc(buf_size);
+ if (!buf)
X return -ENOMEM;
- io.fn_put = ntfs_put;
- io.fn_get = ntfs_get;
- io.param = bits;
-
- /* first search within +/- 8192 clusters */
- start = *location >> 3;
- start = start > 1024 ? start - 1024 : 0;
- io.size = 2048;
- error = ntfs_read_attr(bitmap, bitmap->vol->at_data, 0, start, &io);
- if (error)
- goto fail;
- loc = start * 8;
- cnt = *count;
- error = search_bits(bits, &loc, &cnt, io.size);
- if (error)
- goto fail;
- if (*count == cnt){
- bloc = loc;
- bcnt = cnt;
- goto success;
- }
- /* Now search from the beginning. */
- for (start = 0; 1; start += 2048) {
- io.param = bits;
- io.size = 2048;
- error = ntfs_read_attr(bitmap, bitmap->vol->at_data, 0, start,
- &io);
- if (error)
- goto fail;
- if (io.size == 0) {
- if(found)
- goto success;
- else {
- error = -ENOSPC;
- goto fail;
- }
- }
- loc = start * 8;
- cnt = *count;
- error = search_bits(bits, &loc, &cnt, io.size);
- if (error)
- goto fail;
- if (*count == cnt)
- goto success;
- if (bcnt < cnt) {
- bcnt = cnt;
- bloc = loc;
- found = 1;
- }
- }
- success:
- ntfs_free(bits);
- /* check flags */
- if ((flags & ALLOC_REQUIRE_LOCATION) && *location != bloc)
- error = -ENOSPC;
- else if ((flags & ALLOC_REQUIRE_SIZE) && *count != bcnt)
- error = -ENOSPC;
+ /* Read the bitmap from the data attribute. */
+ io.param = byte = buf;
+ io.size = buf_size;
+ err = ntfs_read_attr(bitmap, bitmap->vol->at_data, 0, start_bit >> 3,
+ &io);
+ if (err || io.size != buf_size)
+ goto err_out;
+ /* Now clear the bits in the read bitmap. */
+ bit = start_bit & 7;
+ while (bit && nr_bits) { /* Process first partial byte, if present. */
+ *byte &= ~(1 << bit++);
+ nr_bits--;
+ bit &= 7;
+ if (!bit)
+ byte++;
+ }
+ while (nr_bits >= 8) { /* Process full bytes. */
+ *byte = 0;
+ nr_bits -= 8;
+ byte++;
+ }
+ bit = 0;
+ while (nr_bits) { /* Process last partial byte, if present. */
+ *byte &= ~(1 << bit);
+ nr_bits--;
+ bit++;
+ }
+ /* Write the modified bitmap back to disk. */
+ io.param = buf;
+ io.size = buf_size;
+ err = ntfs_write_attr(bitmap, bitmap->vol->at_data, 0, start_bit >> 3,
+ &io);
+err_out:
+ if (buf_size <= (ntfs_cluster_t)(64 * 1024))
+ ntfs_free(buf);
X else
- ntfs_set_bitrange(bitmap, bloc, bcnt, 1);
- /* If allocation failed due to the flags, tell the caller what he could
- * have gotten */
- *location = bloc;
- *count = bcnt;
- return 0;
- fail:
- *location = -1;
- *count = 0;
- ntfs_free(bits);
- return error;
+ ntfs_vfree(buf);
+ if (!err && io.size != buf_size)
+ err = -EIO;
+ return err;
X }
X
-int ntfs_allocate_clusters(ntfs_volume *vol, ntfs_cluster_t *location,
- int *count, int flags)
+/*
+ * See comments for lack of zone adjustments below in the description of the
+ * function ntfs_deallocate_clusters().
+ */
+int ntfs_deallocate_cluster_run(const ntfs_volume *vol,
+ const ntfs_cluster_t lcn, const ntfs_cluster_t len)
X {
- int error;
- error = ntfs_search_bits(vol->bitmap, location, count, flags);
- return error;
+ int err;
+
+ lock_kernel();
+ err = ntfs_clear_bitrange(vol->bitmap, lcn, len);
+ unlock_kernel();
+ return err;
X }
X
-int ntfs_deallocate_clusters(ntfs_volume *vol, ntfs_cluster_t location,
- int count)
+/*
+ * This is inefficient, but logically trivial, so will do for now. Note, we
+ * do not touch the mft nor the data zones here because we want to minimize
+ * recycling of clusters to enhance the chances of data being undeleteable.
+ * Also we don't want the overhead. Instead we do one additional sweep of the
+ * current data zone during cluster allocation to check for freed clusters.
+ */
+int ntfs_deallocate_clusters(const ntfs_volume *vol, const ntfs_runlist *rl,
+ const int rl_len)
X {
- int error;
- error = ntfs_set_bitrange(vol->bitmap, location, count, 0);
- return error;
+ int i, err;
+
+ lock_kernel();
+ for (i = err = 0; i < rl_len && !err; i++)
+ err = ntfs_clear_bitrange(vol->bitmap, rl[i].lcn, rl[i].len);
+ unlock_kernel();
+ return err;
X }
X
diff -u --recursive --new-file v2.4.9/linux/fs/ntfs/super.h linux/fs/ntfs/super.h
--- v2.4.9/linux/fs/ntfs/super.h Wed Jul 25 17:10:24 2001
+++ linux/fs/ntfs/super.h Sat Sep 8 12:24:40 2001
@@ -3,11 +3,9 @@
X *
X * Copyright (C) 1995-1997 Martin von Löwis
X * Copyright (C) 1996-1997 Régis Duchesne
+ * Copyright (c) 2001 Anton Altaparmakov
X */
X
-#define ALLOC_REQUIRE_LOCATION 1
-#define ALLOC_REQUIRE_SIZE 2
-
X int ntfs_get_free_cluster_count(ntfs_inode *bitmap);
X
X int ntfs_get_volumesize(ntfs_volume *vol, __s64 *vol_size);
@@ -18,13 +16,17 @@
X
X int ntfs_release_volume(ntfs_volume *vol);
X
-void ntfs_insert_fixups(unsigned char *rec, int secsize);
+int ntfs_insert_fixups(unsigned char *rec, int rec_size);
X
-int ntfs_fixup_record(ntfs_volume *vol, char *record, char *magic, int size);
+int ntfs_fixup_record(char *record, char *magic, int size);
X
X int ntfs_allocate_clusters(ntfs_volume *vol, ntfs_cluster_t *location,
- int *count, int flags);
+ ntfs_cluster_t *count, ntfs_runlist **rl, int *rl_len,
+ const NTFS_CLUSTER_ALLOCATION_ZONES zone);
+
+int ntfs_deallocate_cluster_run(const ntfs_volume *vol,
+ const ntfs_cluster_t lcn, const ntfs_cluster_t len);
X
-int ntfs_deallocate_clusters(ntfs_volume *vol, ntfs_cluster_t location,
- int count);
+int ntfs_deallocate_clusters(const ntfs_volume *vol, const ntfs_runlist *rl,
+ const int rl_len);
X
diff -u --recursive --new-file v2.4.9/linux/fs/ntfs/support.c linux/fs/ntfs/support.c
--- v2.4.9/linux/fs/ntfs/support.c Mon Aug 27 12:41:46 2001
+++ linux/fs/ntfs/support.c Tue Sep 11 17:02:46 2001
@@ -17,10 +17,7 @@
X #include "util.h"
X #include "inode.h"
X #include "macros.h"
-
-#ifndef NLS_MAX_CHARSET_SIZE
X #include <linux/nls.h>
-#endif
X
X static char print_buf[1024];
X
@@ -36,8 +33,8 @@
X /* Filter it with the debugging level required */
X if (ntdebug & mask) {
X va_start(ap,fmt);
- strcpy(print_buf, KERN_DEBUG);
- vsprintf(print_buf + 3, fmt, ap);
+ strcpy(print_buf, KERN_DEBUG "NTFS: ");
+ vsprintf(print_buf + 9, fmt, ap);
X printk(print_buf);
X va_end(ap);
X }
@@ -65,9 +62,6 @@
X }
X #endif
X #else /* End of DEBUG functions. Normal ones below... */
-void ntfs_debug(int mask, const char *fmt, ...)
-{
-}
X
X #ifndef ntfs_malloc
X void *ntfs_malloc(int size)
@@ -108,8 +102,8 @@
X va_list ap;
X
X va_start(ap, fmt);
- strcpy(print_buf, KERN_ERR);
- vsprintf(print_buf + 3, fmt, ap);
+ strcpy(print_buf, KERN_ERR "NTFS: ");
+ vsprintf(print_buf + 9, fmt, ap);
X printk(print_buf);
X va_end(ap);
X }
@@ -120,7 +114,7 @@
X ntfs_io io;
X
X ntfs_debug(DEBUG_OTHER, "read_mft_record 0x%x\n", mftno);
- if (mftno == FILE_$Mft)
+ if (mftno == FILE_Mft)
X {
X ntfs_memcpy(buf, vol->mft, vol->mft_record_size);
X return 0;
@@ -162,8 +156,8 @@
X return 0;
X }
X
-int ntfs_getput_clusters(ntfs_volume *vol, int cluster, ntfs_size_t start_offs,
- ntfs_io *buf)
+int ntfs_getput_clusters(ntfs_volume *vol, int cluster, ntfs_size_t start_offs,
+ ntfs_io *buf)
X {
X struct super_block *sb = NTFS_SB(vol);
X struct buffer_head *bh;
@@ -173,6 +167,7 @@
X
X ntfs_debug(DEBUG_OTHER, "%s_clusters %d %d %d\n",
X buf->do_read ? "get" : "put", cluster, start_offs, length);
+ to_copy = vol->cluster_size - start_offs;
X while (length) {
X if (!(bh = bread(sb->s_dev, cluster, vol->cluster_size))) {
X ntfs_debug(DEBUG_OTHER, "%s failed\n",
@@ -180,7 +175,8 @@
X error = -EIO;
X goto error_ret;
X }
- to_copy = min(unsigned int, vol->cluster_size - start_offs, length);
+ if (to_copy > length)
+ to_copy = length;
X lock_buffer(bh);
X if (buf->do_read) {
X buf->fn_put(buf, bh->b_data + start_offs, to_copy);
@@ -211,10 +207,11 @@
X }
X }
X }
+ brelse(bh);
X length -= to_copy;
X start_offs = 0;
+ to_copy = vol->cluster_size;
X cluster++;
- brelse(bh);
X }
X error_ret:
X return error;
@@ -245,8 +242,8 @@
X if (chl > 1) {
X buf = ntfs_malloc(*out_len + chl - 1);
X if (!buf) {
- ntfs_free(result);
- return -ENOMEM;
+ i = -ENOMEM;
+ goto err_ret;
X }
X memcpy(buf, result, o);
X ntfs_free(result);
@@ -262,13 +259,18 @@
X "to chosen character set. Remount "
X "with utf8 encoding and this should "
X "work.\n");
- ntfs_free(result);
- return -EILSEQ;
+ i = -EILSEQ;
+ goto err_ret;
X }
X }
X result[*out_len] = '\0';
X *out = result;
X return 0;
+err_ret:
+ ntfs_free(result);
+ *out_len = 0;
+ *out = NULL;
+ return i;
X }
X
X int ntfs_dupmap2uni(ntfs_volume *vol, char* in, int in_len, ntfs_u16 **out,
@@ -279,8 +281,10 @@
X struct nls_table *nls = vol->nls_map;
X
X *out = result = ntfs_malloc(2 * in_len);
- if (!result)
+ if (!result) {
+ *out_len = 0;
X return -ENOMEM;
+ }
X *out_len = in_len;
X for (i = o = 0; i < in_len; i++, o++) {
X wchar_t uni;
@@ -288,22 +292,25 @@
X
X charlen = nls->char2uni(&in[i], in_len - i, &uni);
X if (charlen < 0) {
- printk(KERN_ERR "NTFS: Name contains a character that "
- "cannot be converted to Unicode.\n");
- ntfs_free(result);
- return charlen;
+ i = charlen;
+ goto err_ret;
X }
X *out_len -= charlen - 1;
X i += charlen - 1;
X /* FIXME: Byte order? */
X result[o] = uni;
X if (!result[o]) {
- printk(KERN_ERR "NTFS: Name contains a character that "
- "cannot be converted to Unicode.\n");
- ntfs_free(result);
- return -EILSEQ;
+ i = -EILSEQ;
+ goto err_ret;
X }
X }
X return 0;
+err_ret:
+ printk(KERN_ERR "NTFS: Name contains a character that cannot be "
+ "converted to Unicode.\n");
+ ntfs_free(result);
+ *out_len = 0;
+ *out = NULL;
+ return i;
X }
X
diff -u --recursive --new-file v2.4.9/linux/fs/ntfs/support.h linux/fs/ntfs/support.h
--- v2.4.9/linux/fs/ntfs/support.h Wed Jul 25 17:10:24 2001
+++ linux/fs/ntfs/support.h Sun Sep 9 16:45:12 2001
@@ -19,7 +19,11 @@
X #define DEBUG_NAME1 1024
X #define DEBUG_NAME2 2048
X
+#ifdef DEBUG
X void ntfs_debug(int mask, const char *fmt, ...);
+#else
+#define ntfs_debug(mask, fmt...) do {} while (0)
+#endif
X
X #include <linux/slab.h>
X #include <linux/vmalloc.h>
diff -u --recursive --new-file v2.4.9/linux/fs/ntfs/unistr.c linux/fs/ntfs/unistr.c
--- v2.4.9/linux/fs/ntfs/unistr.c Mon Aug 27 12:41:46 2001
+++ linux/fs/ntfs/unistr.c Tue Aug 28 06:57:18 2001
@@ -1,6 +1,4 @@
X /*
- * $Id: unistr.c,v 1.4 2001/04/08 03:02:55 antona Exp $
- *
X * unistr.c - Unicode string handling. Part of the Linux-NTFS project.
X *
X * Copyright (c) 2000,2001 Anton Altaparmakov.
@@ -93,11 +91,13 @@
X wchar_t *name2, __u32 name2_len,
X int ic, int err_val)
X {
- __u32 cnt;
+ __u32 cnt, min_len;
X wchar_t c1, c2;
X
- for (cnt = 0; cnt < min(unsigned int, name1_len, name2_len); ++cnt)
- {
+ min_len = name1_len;
+ if (min_len > name2_len)
+ min_len = name2_len;
+ for (cnt = 0; cnt < min_len; ++cnt) {
X c1 = le16_to_cpu(*name1++);
X c2 = le16_to_cpu(*name2++);
X if (ic) {
@@ -106,7 +106,7 @@
X if (c2 < upcase_len)
X c2 = le16_to_cpu(upcase[c2]);
X }
- if (c1 < 64 && legal_ansi_char_array[c1] & 8);
+ if (c1 < 64 && legal_ansi_char_array[c1] & 8)
X return err_val;
X if (c1 < c2)
X return -1;
diff -u --recursive --new-file v2.4.9/linux/fs/ntfs/unistr.h linux/fs/ntfs/unistr.h
--- v2.4.9/linux/fs/ntfs/unistr.h Wed Jul 25 17:10:24 2001
+++ linux/fs/ntfs/unistr.h Tue Aug 28 06:57:18 2001
@@ -1,6 +1,4 @@
X /*
- * $Id: unistr.h,v 1.5 2001/04/11 11:49:16 antona Exp $
- *
X * unistr.h - Exports for unicode string handling. Part of the Linux-NTFS
X * project.
X *
diff -u --recursive --new-file v2.4.9/linux/fs/ntfs/util.h linux/fs/ntfs/util.h
--- v2.4.9/linux/fs/ntfs/util.h Mon Aug 27 12:41:46 2001
+++ linux/fs/ntfs/util.h Sat Sep 8 12:24:40 2001
@@ -7,18 +7,18 @@
X
X /* The first 16 inodes correspond to NTFS special files. */
X typedef enum {
- FILE_$Mft = 0,
- FILE_$MftMirr = 1,
- FILE_$LogFile = 2,
- FILE_$Volume = 3,
- FILE_$AttrDef = 4,
- FILE_$root = 5,
- FILE_$BitMap = 6,
- FILE_$Boot = 7,
- FILE_$BadClus = 8,
- FILE_$Secure = 9,
- FILE_$UpCase = 10,
- FILE_$Extend = 11,
+ FILE_Mft = 0,
+ FILE_MftMirr = 1,
+ FILE_LogFile = 2,
+ FILE_Volume = 3,
+ FILE_AttrDef = 4,
+ FILE_root = 5,
+ FILE_BitMap = 6,
+ FILE_Boot = 7,
+ FILE_BadClus = 8,
+ FILE_Secure = 9,
+ FILE_UpCase = 10,
+ FILE_Extend = 11,
X FILE_Reserved12 = 12,
X FILE_Reserved13 = 13,
X FILE_Reserved14 = 14,
diff -u --recursive --new-file v2.4.9/linux/fs/open.c linux/fs/open.c
--- v2.4.9/linux/fs/open.c Mon Aug 27 12:41:46 2001
+++ linux/fs/open.c Mon Sep 17 13:16:30 2001
@@ -14,6 +14,7 @@
X #include <linux/module.h>
X #include <linux/slab.h>
X #include <linux/tty.h>
+#include <linux/iobuf.h>
X
X #include <asm/uaccess.h>
X
@@ -634,6 +635,7 @@
X {
X struct file * f;
X struct inode *inode;
+ static LIST_HEAD(kill_list);
X int error;
X
X error = -ENFILE;
@@ -654,8 +656,17 @@
X f->f_pos = 0;
X f->f_reada = 0;
X f->f_op = fops_get(inode->i_fop);
- if (inode->i_sb)
- file_move(f, &inode->i_sb->s_files);
+ file_move(f, &inode->i_sb->s_files);
+
+ /* preallocate kiobuf for O_DIRECT */
+ f->f_iobuf = NULL;
+ f->f_iobuf_lock = 0;
+ if (f->f_flags & O_DIRECT) {
+ error = alloc_kiovec(1, &f->f_iobuf);
+ if (error)
+ goto cleanup_all;
+ }
+
X if (f->f_op && f->f_op->open) {
X error = f->f_op->open(inode,f);
X if (error)
@@ -666,9 +677,12 @@
X return f;
X
X cleanup_all:
+ if (f->f_iobuf)
+ free_kiovec(1, &f->f_iobuf);
X fops_put(f->f_op);
X if (f->f_mode & FMODE_WRITE)
X put_write_access(inode);
+ file_move(f, &kill_list); /* out of the way.. */
X f->f_dentry = NULL;
X f->f_vfsmnt = NULL;
X cleanup_file:
diff -u --recursive --new-file v2.4.9/linux/fs/partitions/check.c linux/fs/partitions/check.c
--- v2.4.9/linux/fs/partitions/check.c Sun Aug 12 13:28:00 2001
+++ linux/fs/partitions/check.c Sat Sep 8 12:02:32 2001
@@ -36,7 +36,6 @@
X
X extern int *blk_size[];
X
-struct gendisk *gendisk_head;
X int warn_no_part = 1; /*This is ugly: should make genhd removable media aware*/
X
X static int (*check_part[])(struct gendisk *hd, kdev_t dev, unsigned long first_sect, int first_minor) = {
@@ -96,12 +95,11 @@
X
X char *disk_name (struct gendisk *hd, int minor, char *buf)
X {
- unsigned int part;
X const char *maj = hd->major_name;
- int unit = (minor >> hd->minor_shift) + 'a';
+ unsigned int unit = (minor >> hd->minor_shift);
+ unsigned int part = (minor & ((1 << hd->minor_shift) -1 ));
X
- part = minor & ((1 << hd->minor_shift) - 1);
- if (hd->part[minor].de) {
+ if ((unit < hd->nr_real) && hd->part[minor].de) {
X int pos;
X
X pos = devfs_generate_path (hd->part[minor].de, buf, 64);
@@ -111,7 +109,7 @@
X
X #ifdef CONFIG_ARCH_S390
X if (genhd_dasd_name
- && genhd_dasd_name (buf, unit - 'a', part, hd) == 0)
+ && genhd_dasd_name (buf, unit, part, hd) == 0)
X return buf;
X #endif
X /*
@@ -142,13 +140,13 @@
X maj = "hd";
X break;
X case MD_MAJOR:
- sprintf(buf, "%s%d", maj, unit - 'a');
+ sprintf(buf, "%s%d", maj, unit);
X return buf;
X }
X if (hd->major >= SCSI_DISK1_MAJOR && hd->major <= SCSI_DISK7_MAJOR) {
X unit = unit + (hd->major - SCSI_DISK1_MAJOR + 1) * 16;
- if (unit > 'z') {
- unit -= 'z' + 1;
+ if (unit+'a' > 'z') {
+ unit -= 26;
X sprintf(buf, "sd%c%c", 'a' + unit / 26, 'a' + unit % 26);
X if (part)
X sprintf(buf + 4, "%d", part);
@@ -157,38 +155,32 @@
X }
X if (hd->major >= COMPAQ_SMART2_MAJOR && hd->major <= COMPAQ_SMART2_MAJOR+7) {
X int ctlr = hd->major - COMPAQ_SMART2_MAJOR;
- int disk = minor >> hd->minor_shift;
- int part = minor & (( 1 << hd->minor_shift) - 1);
X if (part == 0)
- sprintf(buf, "%s/c%dd%d", maj, ctlr, disk);
+ sprintf(buf, "%s/c%dd%d", maj, ctlr, unit);
X else
- sprintf(buf, "%s/c%dd%dp%d", maj, ctlr, disk, part);
+ sprintf(buf, "%s/c%dd%dp%d", maj, ctlr, unit, part);
X return buf;
X }
X if (hd->major >= COMPAQ_CISS_MAJOR && hd->major <= COMPAQ_CISS_MAJOR+7) {
X int ctlr = hd->major - COMPAQ_CISS_MAJOR;
- int disk = minor >> hd->minor_shift;
- int part = minor & (( 1 << hd->minor_shift) - 1);
X if (part == 0)
- sprintf(buf, "%s/c%dd%d", maj, ctlr, disk);
+ sprintf(buf, "%s/c%dd%d", maj, ctlr, unit);
X else
- sprintf(buf, "%s/c%dd%dp%d", maj, ctlr, disk, part);
+ sprintf(buf, "%s/c%dd%dp%d", maj, ctlr, unit, part);
X return buf;
X }
X if (hd->major >= DAC960_MAJOR && hd->major <= DAC960_MAJOR+7) {
X int ctlr = hd->major - DAC960_MAJOR;
- int disk = minor >> hd->minor_shift;
- int part = minor & (( 1 << hd->minor_shift) - 1);
X if (part == 0)
- sprintf(buf, "%s/c%dd%d", maj, ctlr, disk);
+ sprintf(buf, "%s/c%dd%d", maj, ctlr, unit);
X else
- sprintf(buf, "%s/c%dd%dp%d", maj, ctlr, disk, part);
+ sprintf(buf, "%s/c%dd%dp%d", maj, ctlr, unit, part);
X return buf;
X }
X if (part)
- sprintf(buf, "%s%c%d", maj, unit, part);
+ sprintf(buf, "%s%c%d", maj, unit+'a', part);
X else
- sprintf(buf, "%s%c", maj, unit);
+ sprintf(buf, "%s%c", maj, unit+'a');
X return buf;
X }
X
@@ -256,39 +248,6 @@
X
X return ret;
X }
-
-#ifdef CONFIG_PROC_FS
-int get_partition_list(char *page, char **start, off_t offset, int count)
-{
- struct gendisk *dsk;
- int len;
-
- len = sprintf(page, "major minor #blocks name\n\n");
- for (dsk = gendisk_head; dsk; dsk = dsk->next) {
- int n;
-
- for (n = 0; n < (dsk->nr_real << dsk->minor_shift); n++)
- if (dsk->part[n].nr_sects) {
- char buf[64];
-
- len += sprintf(page + len,
- "%4d %4d %10d %s\n",
- dsk->major, n, dsk->sizes[n],
- disk_name(dsk, n, buf));
- if (len < offset)
- offset -= len, len = 0;
- else if (len >= offset + count)
- goto leave_loops;
- }
- }
-leave_loops:
- *start = page + offset;
- len -= offset;
- if (len < 0)
- len = 0;
- return len > count ? count : len;
-}
-#endif
X
X static void check_partition(struct gendisk *hd, kdev_t dev, int first_part_minor)
X {
diff -u --recursive --new-file v2.4.9/linux/fs/partitions/ibm.c linux/fs/partitions/ibm.c
--- v2.4.9/linux/fs/partitions/ibm.c Sun Aug 12 13:28:00 2001
+++ linux/fs/partitions/ibm.c Sat Sep 22 20:35:43 2001
@@ -45,67 +45,24 @@
X static int
X get_drive_geometry(int kdev,struct hd_geometry *geo)
X {
- int rc = 0;
- mm_segment_t old_fs;
- struct file *filp;
- struct inode *inode;
- /* find out offset of volume label (partn table) */
- filp = (struct file *)kmalloc (sizeof(struct file),GFP_KERNEL);
- if ( filp == NULL ) {
- printk (KERN_WARNING __FILE__ " ibm_partition: kmalloc failed fo
-r filp\n");
- return -ENOMEM;
- }
- memset(filp,0,sizeof(struct file));
- filp ->f_mode = 1; /* read only */
- inode = get_empty_inode();
- if ( inode == NULL )
- return -ENOMEM;
- inode -> i_rdev = kdev;
- inode -> i_bdev = bdget(kdev_t_to_nr(kdev));
- rc = blkdev_open(inode,filp);
+ struct block_device *bdev = bdget(kdev_t_to_nr(kdev));
+ int rc = blkdev_get(bdev, 0, 1, BDEV_FILE);
X if ( rc == 0 ) {
- old_fs=get_fs();
- set_fs(KERNEL_DS);
- rc = inode-> i_bdev -> bd_op->ioctl (inode, filp, HDIO_GETGEO,
- (unsigned long)(geo))
- ;
- set_fs(old_fs);
+ rc = ioctl_by_bdev(bdev, HDIO_GETGEO, (unsigned long)geo);
+ blkdev_put(bdev, BDEV_FILE);
X }
- blkdev_put(inode->i_bdev,BDEV_FILE);
X return rc;
X }
X
X static int
X get_drive_info(int kdev,dasd_information_t *info)
X {
- int rc = 0;
- mm_segment_t old_fs;
- struct file *filp;
- struct inode *inode;
- /* find out offset of volume label (partn table) */
- filp = (struct file *)kmalloc (sizeof(struct file),GFP_KERNEL);
- if ( filp == NULL ) {
- printk (KERN_WARNING __FILE__ " ibm_partition: kmalloc failed fo
-r filp\n");
- return -ENOMEM;
- }
- memset(filp,0,sizeof(struct file));
- filp ->f_mode = 1; /* read only */
- inode = get_empty_inode();
- if ( inode == NULL )
- return -ENOMEM;
- inode -> i_rdev = kdev;
- inode -> i_bdev = bdget(kdev_t_to_nr(kdev));
- rc = blkdev_open(inode,filp);
+ struct block_device *bdev = bdget(kdev_t_to_nr(kdev));
+ int rc = blkdev_get(bdev, 0, 1, BDEV_FILE);
X if ( rc == 0 ) {
- old_fs=get_fs();
- set_fs(KERNEL_DS);
- rc = inode-> i_bdev -> bd_op->ioctl (inode, filp, BIODASDINFO,
- (unsigned long)(info));
- set_fs(old_fs);
+ rc = ioctl_by_bdev(bdev, BIODASDINFO, (unsigned long)(info));
+ blkdev_put(bdev, BDEV_FILE);
X }
- blkdev_put(inode->i_bdev,BDEV_FILE);
X return rc;
X }
X
diff -u --recursive --new-file v2.4.9/linux/fs/partitions/ldm.c linux/fs/partitions/ldm.c
--- v2.4.9/linux/fs/partitions/ldm.c Sun Aug 12 13:28:00 2001
+++ linux/fs/partitions/ldm.c Fri Sep 7 09:28:38 2001
@@ -23,7 +23,7 @@
X * in the file COPYING); if not, write to the Free Software Foundation,
X * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
X */
-#include <asm/types.h>
+#include <linux/types.h>
X #include <asm/unaligned.h>
X #include <asm/byteorder.h>
X #include <linux/genhd.h>
@@ -141,7 +141,8 @@
X printk(LDM_CRIT "Cannot find VBLK, database may be corrupt.\n");
X return -1;
X }
- if (BE16(buffer + 0x0E) == 0) /* Record is not in use. */
+ if ((BE16(buffer + 0x0E) == 0) || /* Record is not in use. */
+ (BE16(buffer + 0x0C) != 0)) /* Part 2 of an ext. record */
X return 0;
X /* FIXME: What about extended VBLKs? */
X switch (buffer[0x13]) {
diff -u --recursive --new-file v2.4.9/linux/fs/pipe.c linux/fs/pipe.c
--- v2.4.9/linux/fs/pipe.c Fri Feb 9 11:29:44 2001
+++ linux/fs/pipe.c Tue Aug 28 10:56:06 2001
@@ -630,8 +630,7 @@
X return sb;
X }
X
-static DECLARE_FSTYPE(pipe_fs_type, "pipefs", pipefs_read_super,
- FS_NOMOUNT|FS_SINGLE);
+static DECLARE_FSTYPE(pipe_fs_type, "pipefs", pipefs_read_super, FS_NOMOUNT);
X
X static int __init init_pipe_fs(void)
X {
@@ -650,7 +649,7 @@
X static void __exit exit_pipe_fs(void)
X {
X unregister_filesystem(&pipe_fs_type);
- kern_umount(pipe_mnt);
+ mntput(pipe_mnt);
X }
X
X module_init(init_pipe_fs)
diff -u --recursive --new-file v2.4.9/linux/fs/proc/array.c linux/fs/proc/array.c
--- v2.4.9/linux/fs/proc/array.c Sun Aug 12 13:28:00 2001
+++ linux/fs/proc/array.c Wed Sep 19 16:18:31 2001
@@ -522,11 +522,8 @@
X /*
X * For the /proc/<pid>/maps file, we use fixed length records, each containing
X * a single line.
- */
-#define MAPS_LINE_LENGTH 4096
-#define MAPS_LINE_SHIFT 12
-/*
- * f_pos = (number of the vma in the task->mm->mmap list) * MAPS_LINE_LENGTH
+ *
+ * f_pos = (number of the vma in the task->mm->mmap list) * PAGE_SIZE
X * + (index into the line)
X */
X /* for systems with sizeof(void*) == 4: */
@@ -537,136 +534,142 @@
X #define MAPS_LINE_FORMAT8 "%016lx-%016lx %s %016lx %s %lu"
X #define MAPS_LINE_MAX8 73 /* sum of 16 1 16 1 4 1 16 1 5 1 10 1 */
X
-#define MAPS_LINE_MAX MAPS_LINE_MAX8
+#define MAPS_LINE_FORMAT (sizeof(void*) == 4 ? MAPS_LINE_FORMAT4 : MAPS_LINE_FORMAT8)
+#define MAPS_LINE_MAX (sizeof(void*) == 4 ? MAPS_LINE_MAX4 : MAPS_LINE_MAX8)
X
+static int proc_pid_maps_get_line (char *buf, struct vm_area_struct *map)
+{
+ /* produce the next line */
+ char *line;
+ char str[5];
+ int flags;
+ kdev_t dev;
+ unsigned long ino;
+ int len;
+
+ flags = map->vm_flags;
+
+ str[0] = flags & VM_READ ? 'r' : '-';
+ str[1] = flags & VM_WRITE ? 'w' : '-';
+ str[2] = flags & VM_EXEC ? 'x' : '-';
+ str[3] = flags & VM_MAYSHARE ? 's' : 'p';
+ str[4] = 0;
+
+ dev = 0;
+ ino = 0;
+ if (map->vm_file != NULL) {
+ dev = map->vm_file->f_dentry->d_inode->i_dev;
+ ino = map->vm_file->f_dentry->d_inode->i_ino;
+ line = d_path(map->vm_file->f_dentry,
+ map->vm_file->f_vfsmnt,
+ buf, PAGE_SIZE);
+ buf[PAGE_SIZE-1] = '\n';
+ line -= MAPS_LINE_MAX;
+ if(line < buf)
+ line = buf;
+ } else
+ line = buf;
+
+ len = sprintf(line,
+ MAPS_LINE_FORMAT,
+ map->vm_start, map->vm_end, str, map->vm_pgoff << PAGE_SHIFT,
+ kdevname(dev), ino);
+
+ if(map->vm_file) {
+ int i;
+ for(i = len; i < MAPS_LINE_MAX; i++)
+ line[i] = ' ';
+ len = buf + PAGE_SIZE - line;
+ memmove(buf, line, len);
+ } else
+ line[len++] = '\n';
+ return len;
+}
X
X ssize_t proc_pid_read_maps (struct task_struct *task, struct file * file, char * buf,
X size_t count, loff_t *ppos)
X {
X struct mm_struct *mm;
- struct vm_area_struct * map, * next;
- char * destptr = buf, * buffer;
- loff_t lineno;
- ssize_t column, i;
- int volatile_task;
+ struct vm_area_struct * map;
+ char *tmp, *kbuf;
X long retval;
+ int off, lineno, loff;
X
+ /* reject calls with out of range parameters immediately */
+ retval = 0;
+ if (*ppos > LONG_MAX)
+ goto out;
+ if (count == 0)
+ goto out;
+ off = (long)*ppos;
X /*
X * We might sleep getting the page, so get it first.
X */
X retval = -ENOMEM;
- buffer = (char*)__get_free_page(GFP_KERNEL);
- if (!buffer)
+ kbuf = (char*)__get_free_page(GFP_KERNEL);
+ if (!kbuf)
X goto out;
X
- if (count == 0)
- goto getlen_out;
+ tmp = (char*)__get_free_page(GFP_KERNEL);
+ if (!tmp)
+ goto out_free1;
+
X task_lock(task);
X mm = task->mm;
X if (mm)
X atomic_inc(&mm->mm_users);
X task_unlock(task);
+ retval = 0;
X if (!mm)
- goto getlen_out;
-
- /* Check whether the mmaps could change if we sleep */
- volatile_task = (task != current || atomic_read(&mm->mm_users) > 2);
+ goto out_free2;
X
- /* decode f_pos */
- lineno = *ppos >> MAPS_LINE_SHIFT;
- column = *ppos & (MAPS_LINE_LENGTH-1);
-
- /* quickly go to line lineno */
X down_read(&mm->mmap_sem);
- for (map = mm->mmap, i = 0; map && (i < lineno); map = map->vm_next, i++)
- continue;
-
- for ( ; map ; map = next ) {
- /* produce the next line */
- char *line;
- char str[5], *cp = str;
- int flags;
- kdev_t dev;
- unsigned long ino;
- int maxlen = (sizeof(void*) == 4) ?
- MAPS_LINE_MAX4 : MAPS_LINE_MAX8;
+ map = mm->mmap;
+ lineno = 0;
+ loff = 0;
+ if (count > PAGE_SIZE)
+ count = PAGE_SIZE;
+ while (map) {
X int len;
-
- /*
- * Get the next vma now (but it won't be used if we sleep).
- */
- next = map->vm_next;
- flags = map->vm_flags;
-
- *cp++ = flags & VM_READ ? 'r' : '-';
- *cp++ = flags & VM_WRITE ? 'w' : '-';
- *cp++ = flags & VM_EXEC ? 'x' : '-';
- *cp++ = flags & VM_MAYSHARE ? 's' : 'p';
- *cp++ = 0;
-
- dev = 0;
- ino = 0;
- if (map->vm_file != NULL) {
- dev = map->vm_file->f_dentry->d_inode->i_dev;
- ino = map->vm_file->f_dentry->d_inode->i_ino;
- line = d_path(map->vm_file->f_dentry,
- map->vm_file->f_vfsmnt,
- buffer, PAGE_SIZE);
- buffer[PAGE_SIZE-1] = '\n';
- line -= maxlen;
- if(line < buffer)
- line = buffer;
- } else
- line = buffer;
-
- len = sprintf(line,
- sizeof(void*) == 4 ? MAPS_LINE_FORMAT4 : MAPS_LINE_FORMAT8,
- map->vm_start, map->vm_end, str, map->vm_pgoff << PAGE_SHIFT,
- kdevname(dev), ino);
-
- if(map->vm_file) {
- for(i = len; i < maxlen; i++)
- line[i] = ' ';
- len = buffer + PAGE_SIZE - line;
- } else
- line[len++] = '\n';
- if (column >= len) {
- column = 0; /* continue with next line at column 0 */
- lineno++;
- continue; /* we haven't slept */
+ if (off > PAGE_SIZE) {
+ off -= PAGE_SIZE;
+ goto next;
X }
-
- i = len-column;
- if (i > count)
- i = count;
- copy_to_user(destptr, line+column, i); /* may have slept */
- destptr += i;
- count -= i;
- column += i;
- if (column >= len) {
- column = 0; /* next time: next line at column 0 */
- lineno++;
+ len = proc_pid_maps_get_line(tmp, map);
+ len -= off;
+ if (len > 0) {
+ if (retval+len > count) {
+ /* only partial line transfer possible */
+ len = count - retval;
+ /* save the offset where the next read
+ * must start */
+ loff = len+off;
+ }
+ memcpy(kbuf+retval, tmp+off, len);
+ retval += len;
X }
-
- /* done? */
- if (count == 0)
- break;
-
- /* By writing to user space, we might have slept.
- * Stop the loop, to avoid a race condition.
- */
- if (volatile_task)
+ off = 0;
+next:
+ if (!loff)
+ lineno++;
+ if (retval >= count)
X break;
+ if (loff) BUG();
+ map = map->vm_next;
X }
X up_read(&mm->mmap_sem);
-
- /* encode f_pos */
- *ppos = (lineno << MAPS_LINE_SHIFT) + column;
X mmput(mm);
X
-getlen_out:
- retval = destptr - buf;
- free_page((unsigned long)buffer);
+ if (retval > count) BUG();
+ if (copy_to_user(buf, kbuf, retval))
+ retval = -EFAULT;
+ else
+ *ppos = (lineno << PAGE_SHIFT) + loff;
+
+out_free2:
+ free_page((unsigned long)tmp);
+out_free1:
+ free_page((unsigned long)kbuf);
X out:
X return retval;
X }
diff -u --recursive --new-file v2.4.9/linux/fs/proc/generic.c linux/fs/proc/generic.c
--- v2.4.9/linux/fs/proc/generic.c Tue Jul 3 17:08:21 2001
+++ linux/fs/proc/generic.c Fri Sep 7 10:53:59 2001
@@ -397,19 +397,18 @@
X file_list_lock();
X for (p = sb->s_files.next; p != &sb->s_files; p = p->next) {
X struct file * filp = list_entry(p, struct file, f_list);
- struct dentry * dentry;
+ struct dentry * dentry = filp->f_dentry;
X struct inode * inode;
+ struct file_operations *fops;
X
- dentry = filp->f_dentry;
- if (!dentry)
- continue;
X if (dentry->d_op != &proc_dentry_operations)
X continue;
X inode = dentry->d_inode;
X if (inode->u.generic_ip != de)
X continue;
- fops_put(filp->f_op);
+ fops = filp->f_op;
X filp->f_op = NULL;
+ fops_put(fops);
X }
X file_list_unlock();
X }
diff -u --recursive --new-file v2.4.9/linux/fs/proc/kcore.c linux/fs/proc/kcore.c
--- v2.4.9/linux/fs/proc/kcore.c Mon Jan 15 16:54:20 2001
+++ linux/fs/proc/kcore.c Thu Sep 13 16:04:43 2001
@@ -42,7 +42,7 @@
X ssize_t count1;
X char * pnt;
X struct user dump;
-#if defined (__i386__) || defined (__mc68000__)
+#if defined (__i386__) || defined (__mc68000__) || defined(__x86_64__)
X # define FIRST_MAPPED PAGE_SIZE /* we don't have page 0 mapped on x86.. */
X #else
X # define FIRST_MAPPED 0
@@ -51,7 +51,7 @@
X memset(&dump, 0, sizeof(struct user));
X dump.magic = CMAGIC;
X dump.u_dsize = (virt_to_phys(high_memory) >> PAGE_SHIFT);
-#if defined (__i386__)
+#if defined (__i386__) || defined(__x86_64__)
X dump.start_code = PAGE_OFFSET;
X #endif
X #ifdef __alpha__
@@ -361,7 +361,7 @@
X read_unlock(&vmlist_lock);
X
X /* where page 0 not mapped, write zeros into buffer */
-#if defined (__i386__) || defined (__mc68000__)
+#if defined (__i386__) || defined (__mc68000__) || defined(__x86_64__)
X if (*fpos < PAGE_SIZE + elf_buflen) {
X /* work out how much to clear */
X tsz = PAGE_SIZE + elf_buflen - *fpos;
diff -u --recursive --new-file v2.4.9/linux/fs/proc/kmsg.c linux/fs/proc/kmsg.c
--- v2.4.9/linux/fs/proc/kmsg.c Sat Feb 26 20:33:07 2000
+++ linux/fs/proc/kmsg.c Sun Sep 16 21:22:40 2001
@@ -14,7 +14,6 @@
X #include <asm/uaccess.h>
X #include <asm/io.h>
X
-extern unsigned long log_size;
X extern wait_queue_head_t log_wait;
X
X extern int do_syslog(int type, char * bug, int count);
@@ -39,7 +38,7 @@
X static unsigned int kmsg_poll(struct file *file, poll_table * wait)
X {
X poll_wait(file, &log_wait, wait);
- if (log_size)
+ if (do_syslog(9, 0, 0))
X return POLLIN | POLLRDNORM;
X return 0;
X }
diff -u --recursive --new-file v2.4.9/linux/fs/proc/proc_misc.c linux/fs/proc/proc_misc.c
--- v2.4.9/linux/fs/proc/proc_misc.c Wed Jul 25 17:10:24 2001
+++ linux/fs/proc/proc_misc.c Mon Sep 17 16:15:02 2001
@@ -145,12 +145,12 @@
X * display in kilobytes.
X */
X #define K(x) ((x) << (PAGE_SHIFT - 10))
-#define B(x) ((x) << PAGE_SHIFT)
+#define B(x) ((unsigned long long)(x) << PAGE_SHIFT)
X si_meminfo(&i);
X si_swapinfo(&i);
X len = sprintf(page, " total: used: free: shared: buffers: cached:\n"
- "Mem: %8lu %8lu %8lu %8lu %8lu %8u\n"
- "Swap: %8lu %8lu %8lu\n",
+ "Mem: %8Lu %8Lu %8Lu %8Lu %8Lu %8Lu\n"
+ "Swap: %8Lu %8Lu %8Lu\n",
X B(i.totalram), B(i.totalram-i.freeram), B(i.freeram),
X B(i.sharedram), B(i.bufferram),
X B(atomic_read(&page_cache_size)), B(i.totalswap),
@@ -168,9 +168,7 @@
X "Cached: %8lu kB\n"
X "SwapCached: %8lu kB\n"
X "Active: %8u kB\n"
- "Inact_dirty: %8u kB\n"
- "Inact_clean: %8u kB\n"
- "Inact_target: %8lu kB\n"
+ "Inactive: %8u kB\n"
X "HighTotal: %8lu kB\n"
X "HighFree: %8lu kB\n"
X "LowTotal: %8lu kB\n"
@@ -184,9 +182,7 @@
X K(atomic_read(&page_cache_size) - swapper_space.nrpages),
X K(swapper_space.nrpages),
X K(nr_active_pages),
- K(nr_inactive_dirty_pages),
- K(nr_inactive_clean_pages()),
- K(inactive_target),
+ K(nr_inactive_pages),
X K(i.totalhigh),
X K(i.freehigh),
X K(i.totalram-i.totalhigh),
@@ -573,7 +569,7 @@
X entry->size = (1+prof_len) * sizeof(unsigned int);
X }
X }
-#ifdef __powerpc__
+#ifdef CONFIG_PPC32
X {
X extern struct file_operations ppc_htab_operations;
X entry = create_proc_entry("ppc_htab", S_IRUGO|S_IWUSR, NULL);
diff -u --recursive --new-file v2.4.9/linux/fs/qnx4/inode.c linux/fs/qnx4/inode.c
--- v2.4.9/linux/fs/qnx4/inode.c Tue Apr 17 23:16:39 2001
+++ linux/fs/qnx4/inode.c Fri Sep 7 09:28:38 2001
@@ -396,7 +396,6 @@
X goto outi;
X
X brelse(bh);
- s->s_dirt = 1;
X
X return s;
X
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/bitmap.c linux/fs/reiserfs/bitmap.c
--- v2.4.9/linux/fs/reiserfs/bitmap.c Fri Apr 27 14:18:08 2001
+++ linux/fs/reiserfs/bitmap.c Sat Sep 8 12:05:32 2001
@@ -1,7 +1,6 @@
X /*
X * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
X */
-#ifdef __KERNEL__
X
X #include <linux/config.h>
X #include <linux/sched.h>
@@ -10,13 +9,6 @@
X #include <asm/bitops.h>
X #include <linux/list.h>
X
-#else
-
-#include "nokernel.h"
-
-#endif
-
-
X #ifdef CONFIG_REISERFS_CHECK
X
X /* this is a safety check to make sure
@@ -499,6 +491,7 @@
X unsigned long border = 0;
X unsigned long bstart = 0;
X unsigned long hash_in, hash_out;
+ unsigned long saved_search_start=search_start;
X int allocated[PREALLOCATION_SIZE];
X int blks;
X
@@ -604,7 +597,15 @@
X ** and should probably be removed
X */
X if ( search_start < border ) search_start=border;
-
+
+ /* If the disk free space is already below 10% we should
+ ** start looking for the free blocks from the beginning
+ ** of the partition, before the border line.
+ */
+ if ( SB_FREE_BLOCKS(th->t_super) <= (SB_BLOCK_COUNT(th->t_super) / 10) ) {
+ search_start=saved_search_start;
+ }
+
X *free_blocknrs = 0;
X blks = PREALLOCATION_SIZE-1;
X for (blks_gotten=0; blks_gotten<PREALLOCATION_SIZE; blks_gotten++) {
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/buffer2.c linux/fs/reiserfs/buffer2.c
--- v2.4.9/linux/fs/reiserfs/buffer2.c Mon Jan 15 15:31:19 2001
+++ linux/fs/reiserfs/buffer2.c Sat Sep 8 12:05:32 2001
@@ -10,20 +10,12 @@
X *
X * Copyright (C) 1991, 1992 Linus Torvalds
X */
-#ifdef __KERNEL__
X
X #include <linux/config.h>
X #include <linux/sched.h>
X #include <linux/locks.h>
X #include <linux/reiserfs_fs.h>
X #include <linux/smp_lock.h>
-
-#else
-
-#include "nokernel.h"
-
-#endif
-
X
X /*
X * wait_buffer_until_released
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/dir.c linux/fs/reiserfs/dir.c
--- v2.4.9/linux/fs/reiserfs/dir.c Wed Jul 25 17:10:25 2001
+++ linux/fs/reiserfs/dir.c Sat Sep 8 12:05:32 2001
@@ -2,8 +2,6 @@
X * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
X */
X
-#ifdef __KERNEL__
-
X #include <linux/config.h>
X #include <linux/string.h>
X #include <linux/errno.h>
@@ -12,12 +10,6 @@
X #include <linux/stat.h>
X #include <linux/smp_lock.h>
X #include <asm/uaccess.h>
-
-#else
-
-#include "nokernel.h"
-
-#endif
X
X extern struct key MIN_KEY;
X
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/do_balan.c linux/fs/reiserfs/do_balan.c
--- v2.4.9/linux/fs/reiserfs/do_balan.c Wed Jul 25 17:10:25 2001
+++ linux/fs/reiserfs/do_balan.c Sat Sep 8 12:05:32 2001
@@ -16,20 +16,11 @@
X **
X **/
X
-#ifdef __KERNEL__
-
X #include <linux/config.h>
X #include <asm/uaccess.h>
X #include <linux/sched.h>
X #include <linux/reiserfs_fs.h>
X
-#else
-
-#include "nokernel.h"
-
-#endif
-
-
X #ifdef CONFIG_REISERFS_CHECK
X
X struct tree_balance * cur_tb = NULL; /* detects whether more than one
@@ -662,11 +653,7 @@
X {
X struct item_head * pasted;
X
-#ifdef REISERFS_FSCK
- if ( ! item_pos && is_left_mergeable (tb->tb_sb, tb->tb_path) == 1 )
-#else
X if ( ! item_pos && op_is_left_mergeable (B_N_PKEY (tbS0, 0), tbS0->b_size) )
-#endif
X { /* if we paste into first item of S[0] and it is left mergable */
X /* then increment pos_in_item by the size of the last item in L[0] */
X pasted = B_N_PITEM_HEAD(tb->L[0],n-1);
@@ -1606,10 +1593,6 @@
X tb->FEB[i] = 0;
X tb->used[i] = first_b;
X
-#ifdef REISERFS_FSCK
- mark_block_formatted (first_b->b_blocknr);
-#endif
-
X return(first_b);
X }
X
@@ -1656,20 +1639,6 @@
X */
X
X store_thrown (tb, bh);
-#if 0
-#ifdef REISERFS_FSCK
- {
- struct buffer_head * to_be_forgotten;
-
- to_be_forgotten = find_buffer (bh->b_dev, bh->b_blocknr, bh->b_size);
- if (to_be_forgotten) {
- to_be_forgotten->b_count ++;
- bforget (to_be_forgotten);
- }
- unmark_block_formatted (bh->b_blocknr);
- }
-#endif
-#endif
X }
X
X /* Replace n_dest'th key in buffer dest by n_src'th key of buffer src.*/
@@ -1915,13 +1884,6 @@
X if (check_before_balancing (tb))
X reiserfs_panic (tb->tb_sb, "PAP-12340: do_balance: locked buffers in TB");
X
-#ifndef __KERNEL__
- if ( atomic_read(&(PATH_PLAST_BUFFER(tb->tb_path)->b_count)) > 1 || (tb->L[0] && atomic_read(&(tb->L[0]->b_count)) > 1) ||
- (tb->R[0] && atomic_read(&(tb->R[0]->b_count)) > 1) ) {
- print_cur_tb ("first three parameters are invalid");
- reiserfs_panic (tb->tb_sb, "PAP-12345: do_balance: counter too big");
- }
-#endif /* !__KERNEL__ */
X cur_tb = tb;
X
X #endif /* CONFIG_REISERFS_CHECK */
@@ -2003,26 +1965,6 @@
X atomic_inc (&(fs_generation (tb->tb_sb)));
X do_balance_starts (tb);
X
-#ifdef REISERFS_FSCK
- if (flag == M_INTERNAL) {
- insert_ptr[0] = (struct buffer_head *)body;
- /* we must prepare insert_key */
-
- if (PATH_H_B_ITEM_ORDER (tb->tb_path, 0)/*LAST_POSITION (tb->tb_path)*//*item_pos*/ == -1) {
- /* get delimiting key from buffer in tree */
- copy_key (&insert_key[0].ih_key, B_N_PKEY (PATH_PLAST_BUFFER (tb->tb_path), 0));
- /*insert_ptr[0]->b_item_order = 0;*/
- } else {
- /* get delimiting key from new buffer */
- copy_key (&insert_key[0].ih_key, B_N_PKEY((struct buffer_head *)body,0));
- /*insert_ptr[0]->b_item_order = item_pos;*/
- }
-
- /* and insert_ptr instead of balance_leaf */
- child_pos = PATH_H_B_ITEM_ORDER (tb->tb_path, 0)/*item_pos*/;
- } else
-#endif
-
X /* balance leaf returns 0 except if combining L R and S into
X one node. see balance_internal() for explanation of this
X line of code.*/
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/file.c linux/fs/reiserfs/file.c
--- v2.4.9/linux/fs/reiserfs/file.c Thu Apr 26 10:44:10 2001
+++ linux/fs/reiserfs/file.c Mon Sep 17 13:16:30 2001
@@ -3,18 +3,10 @@
X */
X
X
-#ifdef __KERNEL__
-
X #include <linux/sched.h>
X #include <linux/reiserfs_fs.h>
X #include <linux/smp_lock.h>
X
-#else
-
-#include "nokernel.h"
-
-#endif
-
X /*
X ** We pack the tails of files on file close, not at the time they are written.
X ** This implies an unnecessary copy of the tail and an unnecessary indirect item
@@ -84,7 +76,7 @@
X ) {
X struct inode * p_s_inode = p_s_dentry->d_inode;
X struct reiserfs_transaction_handle th ;
- int n_err = 0;
+ int n_err;
X int windex ;
X int jbegin_count = 1 ;
X
@@ -94,6 +86,7 @@
X BUG ();
X
X n_err = fsync_inode_buffers(p_s_inode) ;
+ n_err |= fsync_inode_data_buffers(p_s_inode);
X /* commit the current transaction to flush any metadata
X ** changes. sys_fsync takes care of flushing the dirty pages for us
X */
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/fix_node.c linux/fs/reiserfs/fix_node.c
--- v2.4.9/linux/fs/reiserfs/fix_node.c Wed Jul 25 17:10:25 2001
+++ linux/fs/reiserfs/fix_node.c Sat Sep 8 12:05:32 2001
@@ -35,21 +35,12 @@
X **/
X
X
-#ifdef __KERNEL__
-
X #include <linux/config.h>
X #include <linux/sched.h>
X #include <linux/string.h>
X #include <linux/locks.h>
X #include <linux/reiserfs_fs.h>
X
-#else
-
-#include "nokernel.h"
-
-#endif
-
-
X
X /* To make any changes in the tree we find a node, that contains item
X to be changed/deleted or position in the node we insert a new item
@@ -122,11 +113,7 @@
X ih = B_N_PITEM_HEAD (Sh, 0);
X
X /* define the mergeability for 0-th item (if it is not being deleted) */
-#ifdef REISERFS_FSCK
- if (is_left_mergeable (tb->tb_sb, tb->tb_path) == 1 && (vn->vn_mode != M_DELETE || vn->vn_affected_item_num))
-#else
X if (op_is_left_mergeable (&(ih->ih_key), Sh->b_size) && (vn->vn_mode != M_DELETE || vn->vn_affected_item_num))
-#endif
X vn->vn_vi[0].vi_type |= VI_TYPE_LEFT_MERGEABLE;
X
X /* go through all items those remain in the virtual node (except for the new (inserted) one) */
@@ -207,13 +194,8 @@
X struct key * key;
X
X key = B_N_PDELIM_KEY (tb->CFR[0], tb->rkey[0]);
-#ifdef REISERFS_FSCK
- if (is_right_mergeable (tb->tb_sb, tb->tb_path) == 1 && (vn->vn_mode != M_DELETE ||
- vn->vn_affected_item_num != B_NR_ITEMS (Sh) - 1))
-#else
X if (op_is_left_mergeable (key, Sh->b_size) && (vn->vn_mode != M_DELETE ||
X vn->vn_affected_item_num != B_NR_ITEMS (Sh) - 1))
-#endif
X vn->vn_vi[vn->vn_nr_item-1].vi_type |= VI_TYPE_RIGHT_MERGEABLE;
X
X #ifdef CONFIG_REISERFS_CHECK
@@ -717,8 +699,6 @@
X ih = B_N_PITEM_HEAD (S0, 0);
X if (tb->CFR[0] && !comp_short_le_keys (&(ih->ih_key), B_N_PDELIM_KEY (tb->CFR[0], tb->rkey[0])))
X if (is_direntry_le_ih (ih)) {
-#ifndef REISERFS_FSCK
-
X /* Directory must be in correct state here: that is
X somewhere at the left side should exist first directory
X item. But the item being deleted can not be that first
@@ -735,30 +715,6 @@
X reiserfs_panic (tb->tb_sb, "vs-8130: are_leaves_removable: "
X "first directory item can not be removed until directory is not empty");
X #endif
-
-
-#else /* REISERFS_FSCK */
-
- /* we can delete any directory item in fsck (if it is unreachable) */
- if (ih->ih_key.k_offset != DOT_OFFSET) {
- /* must get left neighbor here to make sure, that left
- neighbor is of the same directory */
- struct buffer_head * left;
-
- left = get_left_neighbor (tb->tb_sb, tb->tb_path);
- if (left) {
- struct item_head * last;
-
- if (B_NR_ITEMS (left) == 0)
- reiserfs_panic (tb->tb_sb, "vs-8135: are_leaves_removable: "
- "empty node in the tree");
- last = B_N_PITEM_HEAD (left, B_NR_ITEMS (left) - 1);
- if (!comp_short_keys (&last->ih_key, &ih->ih_key))
- ih_size = IH_SIZE;
- brelse (left);
- }
- }
-#endif
X }
X
X }
@@ -860,11 +816,6 @@
X struct super_block * p_s_sb = p_s_tb->tb_sb;
X
X
-#ifdef REISERFS_FSCK
- if (n_h == 0 && p_s_tb->insert_size[n_h] == 0x7fff)
- return CARRY_ON;
-#endif
-
X /* number_of_freeblk is the number of empty blocks which have been
X acquired for use by the balancing algorithm minus the number of
X empty blocks used in the previous levels of the analysis,
@@ -1311,13 +1262,8 @@
X if (
X lfree + rfree + sfree < MAX_CHILD_SIZE(Sh) + levbytes
X /* shifting may merge items which might save space */
-#ifdef REISERFS_FSCK
- - (( ! h && is_left_mergeable (tb->tb_sb, tb->tb_path) == 1 ) ? IH_SIZE : 0)
- - (( ! h && r_ih && is_right_mergeable (tb->tb_sb, tb->tb_path) == 1 ) ? IH_SIZE : 0)
-#else
X - (( ! h && op_is_left_mergeable (&(ih->ih_key), Sh->b_size) ) ? IH_SIZE : 0)
X - (( ! h && r_key && op_is_left_mergeable (r_key, Sh->b_size) ) ? IH_SIZE : 0)
-#endif
X + (( h ) ? KEY_SIZE : 0))
X {
X /* node can not be removed */
@@ -1387,15 +1333,6 @@
X /* Sh is the node whose balance is currently being checked */
X struct buffer_head * Sh;
X
-#ifdef REISERFS_FSCK
- /* special mode for insert pointer to the most low internal node */
- if (h == 0 && vn->vn_mode == M_INTERNAL) {
- /* blk_num == 2 is to get pointer inserted to the next level */
- set_parameters (tb, h, 0, 0, 2, NULL, -1, -1);
- return 0;
- }
-#endif
-
X Sh = PATH_H_PBUFFER (tb->tb_path, h);
X levbytes = tb->insert_size[h];
X
@@ -2514,16 +2451,6 @@
X return REPEAT_SEARCH;
X }
X
-#ifndef __KERNEL__
- if ( atomic_read (&(p_s_tbS0->b_count)) > 1 ||
- (p_s_tb->L[0] && atomic_read (&(p_s_tb->L[0]->b_count)) > 1) ||
- (p_s_tb->R[0] && atomic_read (&(p_s_tb->R[0]->b_count)) > 1) ) {
- printk ("mode=%c, insert_size=%d\n", n_op_mode, p_s_tb->insert_size[0]);
- print_cur_tb ("first three parameters are invalid");
- reiserfs_panic (p_s_tb->tb_sb, "PAP-8310: fix_nodes: all buffers must be hold once in one thread processing");
- }
-#endif
-
X #ifdef CONFIG_REISERFS_CHECK
X if ( cur_tb ) {
X print_cur_tb ("fix_nodes");
@@ -2546,19 +2473,10 @@
X
X /* Check parameters. */
X switch (n_op_mode) {
-#ifdef REISERFS_FSCK
- case M_INTERNAL:
- break;
- case M_INSERT:
- if ( n_item_num < 0 || n_item_num > B_NR_ITEMS(p_s_tbS0) )
- reiserfs_panic(p_s_tb->tb_sb,"PAP-8325: fix_nodes: Incorrect item number %d (in S0 - %d) in case of insert",
- n_item_num, B_NR_ITEMS(p_s_tbS0));
-#else
X case M_INSERT:
X if ( n_item_num <= 0 || n_item_num > B_NR_ITEMS(p_s_tbS0) )
X reiserfs_panic(p_s_tb->tb_sb,"PAP-8330: fix_nodes: Incorrect item number %d (in S0 - %d) in case of insert",
X n_item_num, B_NR_ITEMS(p_s_tbS0));
-#endif
X break;
X case M_PASTE:
X case M_DELETE:
@@ -2754,151 +2672,10 @@
X brelse (tb->used[i]);
X }
X }
-
-#if 0 /* shouldn't this be in CONFIG_REISERFS_CHECK??? */
- /* make sure, that all we have released got really freed */
- for (i = 0; i < sizeof (tb->thrown) / sizeof (tb->thrown[0]); i ++)
- if (tb->thrown[i]) {
- if (atomic_read (&(tb->thrown[i]->b_count))) {
- /* the log will have the count at one and the buffers marked */
- if (atomic_read(&(tb->thrown[i]->b_count)) > 1 ||
- !(buffer_journaled(tb->thrown[i]) ||
- buffer_journal_dirty(tb->thrown[i]))) {
- foo_print (tb->thrown[i], tb->tb_sb);
- printk ("unfix_nodes: Waiting...(block %lu, count %d)\n",
- tb->thrown[i]->b_blocknr,
- atomic_read (&(tb->thrown[i]->b_count)));
- wait_buffer_until_released (tb->thrown[i]);
- printk ("unfix_nodes: Done (block %lu, count %d)\n",
- tb->thrown[i]->b_blocknr,
- atomic_read (&(tb->thrown[i]->b_count)));
- }
- }
- }
-#endif /* 0 */
X if (tb->vn_buf)
X reiserfs_kfree (tb->vn_buf, tb->vn_buf_size, tb->tb_sb);
X
X }
-
-
-
-#ifndef REISERFS_FSCK
-
-// is_left_mergeable is now one of the item methods
-
-#else
-
-// this works only in fsck
-
-int are_items_mergeable (struct item_head * left, struct item_head * right, int bsize)
-{
- if (comp_keys (&left->ih_key, &right->ih_key) != -1) {
- reiserfs_panic (0, "vs-16070: are_items_mergeable: left %k, right %k", &(left->ih_key), &(right->ih_key));
- }
-
- if (comp_short_keys (&left->ih_key, &right->ih_key))
- return 0;
-
- if (I_IS_DIRECTORY_ITEM (left)) {
- return 1;
- }
-
- if ((I_IS_DIRECT_ITEM (left) && I_IS_DIRECT_ITEM (right)) ||
- (I_IS_INDIRECT_ITEM (left) && I_IS_INDIRECT_ITEM (right)))
- return (left->ih_key.k_offset + I_BYTES_NUMBER (left, bsize) == right->ih_key.k_offset) ? 1 : 0;
-
- return 0;
-}
-
-/* get left neighbor of the leaf node */
-static struct buffer_head * get_left_neighbor (struct super_block * s, struct path * path)
-{
- struct key key;
- INITIALIZE_PATH (path_to_left_neighbor);
- struct buffer_head * bh;
-
- copy_key (&key, B_N_PKEY (PATH_PLAST_BUFFER (path), 0));
- decrement_key (&key);
-
-/* init_path (&path_to_left_neighbor);*/
- search_by_key (s, &key, &path_to_left_neighbor, DISK_LEAF_NODE_LEVEL, READ_BLOCKS);
- // FIXME: fsck is to handle I/O failures somehow as well
- if (PATH_LAST_POSITION (&path_to_left_neighbor) == 0) {
- pathrelse (&path_to_left_neighbor);
- return 0;
- }
- bh = PATH_PLAST_BUFFER (&path_to_left_neighbor);
- bh->b_count ++;
- pathrelse (&path_to_left_neighbor);
- return bh;
-}
-
-extern struct key MIN_KEY;
-static struct buffer_head * get_right_neighbor (struct super_block * s, struct path * path)
-{
- struct key key;
- struct key * rkey;
- INITIALIZE_PATH (path_to_right_neighbor);
- struct buffer_head * bh;
-
- rkey = get_rkey (path, s);
- if (comp_keys (rkey, &MIN_KEY) == 0)
- reiserfs_panic (s, "vs-16080: get_right_neighbor: get_rkey returned min key (path has changed)");
- copy_key (&key, rkey);
-
-
- /*init_path (&path_to_right_neighbor);*/
- search_by_key (s, &key, &path_to_right_neighbor, DISK_LEAF_NODE_LEVEL, READ_BLOCKS);
- if (PATH_PLAST_BUFFER (&path_to_right_neighbor) == PATH_PLAST_BUFFER (path)) {
- pathrelse (&path_to_right_neighbor);
- return 0;
- }
- bh = PATH_PLAST_BUFFER (&path_to_right_neighbor);
- bh->b_count ++;
- pathrelse (&path_to_right_neighbor);
- return bh;
-}
-
-
-int is_left_mergeable (struct super_block * s, struct path * path)
-{
- struct item_head * right;
- struct buffer_head * bh;
- int retval;
-
- right = B_N_PITEM_HEAD (PATH_PLAST_BUFFER (path), 0);
-
- bh = get_left_neighbor (s, path);
- if (bh == 0) {
- return 0;
- }
- retval = are_items_mergeable (B_N_PITEM_HEAD (bh, B_NR_ITEMS (bh) - 1), right, bh->b_size);
- brelse (bh);
- return retval;
-}
-
-
-int is_right_mergeable (struct super_block * s, struct path * path)
-{
- struct item_head * left;
- struct buffer_head * bh;
- int retval;
-
- left = B_N_PITEM_HEAD (PATH_PLAST_BUFFER (path), B_NR_ITEMS (PATH_PLAST_BUFFER (path)) - 1);
-
- bh = get_right_neighbor (s, path);
- if (bh == 0) {
- return 0;
- }
- retval = are_items_mergeable (left, B_N_PITEM_HEAD (bh, 0), bh->b_size);
- brelse (bh);
- return retval;
-}
-
-#endif /* REISERFS_FSCK */
-
-
X
X
X
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/hashes.c linux/fs/reiserfs/hashes.c
--- v2.4.9/linux/fs/reiserfs/hashes.c Mon Jan 15 12:42:32 2001
+++ linux/fs/reiserfs/hashes.c Sat Sep 8 12:05:32 2001
@@ -26,10 +26,6 @@
X #define FULLROUNDS 10 /* 32 is overkill, 16 is strong crypto */
X #define PARTROUNDS 6 /* 6 gets complete mixing */
X
-#ifndef __KERNEL__
-typedef __u32 u32;
-#endif
-
X /* a, b, c, d - data; h0, h1 - accumulated hash */
X #define TEACORE(rounds) \
X do { \
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/ibalance.c linux/fs/reiserfs/ibalance.c
--- v2.4.9/linux/fs/reiserfs/ibalance.c Mon Jan 15 15:31:19 2001
+++ linux/fs/reiserfs/ibalance.c Sat Sep 8 12:05:32 2001
@@ -2,21 +2,12 @@
X * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
X */
X
-#ifdef __KERNEL__
-
X #include <linux/config.h>
X #include <asm/uaccess.h>
X #include <linux/string.h>
X #include <linux/sched.h>
X #include <linux/reiserfs_fs.h>
X
-#else
-
-#include "nokernel.h"
-
-#endif
-
-
X /* this is one and only function that is used outside (do_balance.c) */
X int balance_internal (
X struct tree_balance * ,
@@ -1103,25 +1094,11 @@
X
X n = B_NR_ITEMS (tbSh); /*number of items in S[h] */
X
-#ifdef REISERFS_FSCK
- if ( -1 <= child_pos && child_pos <= n && insert_num > 0 ) {
-#else
X if ( 0 <= child_pos && child_pos <= n && insert_num > 0 ) {
-#endif
X bi.tb = tb;
X bi.bi_bh = tbSh;
X bi.bi_parent = PATH_H_PPARENT (tb->tb_path, h);
X bi.bi_position = PATH_H_POSITION (tb->tb_path, h + 1);
-#ifdef REISERFS_FSCK
- if (child_pos == -1) {
- /* this is a little different from original do_balance:
- here we insert the minimal keys in the tree, that has never happened when file system works */
- if (tb->CFL[h-1] || insert_num != 1 || h != 1)
- die ("balance_internal: invalid child_pos");
-/* insert_child (tb->S[h], tb->S[h-1], child_pos, insert_num, B_N_ITEM_HEAD(tb->S[0],0), insert_ptr);*/
- internal_insert_childs (&bi, child_pos, insert_num, B_N_PITEM_HEAD (PATH_PLAST_BUFFER (tb->tb_path), 0), insert_ptr);
- } else
-#endif
X internal_insert_childs (
X &bi,/*tbSh,*/
X /* ( tb->S[h-1]->b_parent == tb->S[h] ) ? tb->S[h-1]->b_next : tb->S[h]->b_child->b_next,*/
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/inode.c linux/fs/reiserfs/inode.c
--- v2.4.9/linux/fs/reiserfs/inode.c Wed Jul 25 17:10:25 2001
+++ linux/fs/reiserfs/inode.c Mon Sep 17 13:16:30 2001
@@ -1,7 +1,6 @@
X /*
X * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
X */
-#ifdef __KERNEL__
X
X #include <linux/config.h>
X #include <linux/sched.h>
@@ -10,12 +9,6 @@
X #include <linux/smp_lock.h>
X #include <asm/uaccess.h>
X
-#else
-
-#include "nokernel.h"
-
-#endif
-
X /* args for the create parameter of reiserfs_get_block */
X #define GET_BLOCK_NO_CREATE 0 /* don't create new blocks or convert tails */
X #define GET_BLOCK_CREATE 1 /* add anything you need to find block */
@@ -55,6 +48,7 @@
X ;
X }
X clear_inode (inode); /* note this must go after the journal_end to prevent deadlock */
+ inode->i_blocks = 0;
X unlock_kernel() ;
X }
X
@@ -525,16 +519,26 @@
X int fs_gen;
X int windex ;
X struct reiserfs_transaction_handle th ;
- int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 ;
+ /* space reserved in transaction batch:
+ . 3 balancings in direct->indirect conversion
+ . 1 block involved into reiserfs_update_sd()
+ XXX in practically impossible worst case direct2indirect()
+ can incur (much) more that 3 balancings. */
+ int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 1;
X int version;
X int transaction_started = 0 ;
- loff_t new_offset = (block << inode->i_sb->s_blocksize_bits) + 1 ;
+ loff_t new_offset = (((loff_t)block) << inode->i_sb->s_blocksize_bits) + 1 ;
X
X /* bad.... */
X lock_kernel() ;
X th.t_trans_id = 0 ;
X version = inode_items_version (inode);
X
+ if (block < 0) {
+ unlock_kernel();
+ return -EIO;
+ }
+
X if (!file_capable (inode, block)) {
X unlock_kernel() ;
X return -EFBIG;
@@ -552,20 +556,14 @@
X return ret;
X }
X
- if (block < 0) {
- unlock_kernel();
- return -EIO;
- }
-
X inode->u.reiserfs_i.i_pack_on_close = 1 ;
X
X windex = push_journal_writer("reiserfs_get_block") ;
X
X /* set the key of the first byte in the 'block'-th block of file */
- make_cpu_key (&key, inode,
- (loff_t)block * inode->i_sb->s_blocksize + 1, // k_offset
+ make_cpu_key (&key, inode, new_offset,
X TYPE_ANY, 3/*key length*/);
- if ((new_offset + inode->i_sb->s_blocksize) >= inode->i_size) {
+ if ((new_offset + inode->i_sb->s_blocksize - 1) > inode->i_size) {
X journal_begin(&th, inode->i_sb, jbegin_count) ;
X transaction_started = 1 ;
X }
@@ -618,10 +616,13 @@
X }
X
X if (indirect_item_found (retval, ih)) {
+ b_blocknr_t unfm_ptr;
+
X /* 'block'-th block is in the file already (there is
X corresponding cell in some indirect item). But it may be
X zero unformatted node pointer (hole) */
- if (!item[pos_in_item]) {
+ unfm_ptr = le32_to_cpu (item[pos_in_item]);
+ if (unfm_ptr == 0) {
X /* use allocated block to plug the hole */
X reiserfs_prepare_for_journal(inode->i_sb, bh, 1) ;
X if (fs_changed (fs_gen, inode->i_sb) && item_moved (&tmp_ih, &path)) {
@@ -630,15 +631,14 @@
X }
X bh_result->b_state |= (1UL << BH_New);
X item[pos_in_item] = cpu_to_le32 (allocated_block_nr);
+ unfm_ptr = allocated_block_nr;
X journal_mark_dirty (&th, inode->i_sb, bh);
X inode->i_blocks += (inode->i_sb->s_blocksize / 512) ;
X reiserfs_update_sd(&th, inode) ;
X }
- set_block_dev_mapped(bh_result, le32_to_cpu (item[pos_in_item]), inode);
+ set_block_dev_mapped(bh_result, unfm_ptr, inode);
X pathrelse (&path);
-#ifdef REISERFS_CHECK
X pop_journal_writer(windex) ;
-#endif /* REISERFS_CHECK */
X if (transaction_started)
X journal_end(&th, inode->i_sb, jbegin_count) ;
X
@@ -815,8 +815,8 @@
X goto failure;
X }
X if (retval == POSITION_FOUND) {
- reiserfs_warning ("vs-: reiserfs_get_block: "
- "%k should not be found", &key);
+ reiserfs_warning ("vs-825: reiserfs_get_block: "
+ "%k should not be found\n", &key);
X retval = -EEXIST;
X if (allocated_block_nr)
X reiserfs_free_block (&th, allocated_block_nr);
@@ -1139,7 +1139,7 @@
X args.objectid = key->on_disk_key.k_dir_id ;
X inode = iget4 (s, key->on_disk_key.k_objectid, 0, (void *)(&args));
X if (!inode)
- return inode ;
+ return ERR_PTR(-ENOMEM) ;
X
X if (comp_short_keys (INODE_PKEY (inode), key) || is_bad_inode (inode)) {
X /* either due to i/o error or a stale NFS handle */
SHAR_EOF
true || echo 'restore of patch-2.4.10 failed'
fi
echo 'End of part 171'
echo 'File patch-2.4.10 is continued in part 172'
echo "172" > _shar_seq_.tmp
exit 0
#!/bin/sh -x
# this is part 172 of a 197 - part archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patch-2.4.10 continued
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 172; then
echo "Please unpack part $Scheck next!"
exit 1
else
exit 0
fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping patch-2.4.10'
else
echo 'x - continuing with patch-2.4.10'
sed 's/^X//' << 'SHAR_EOF' >> 'patch-2.4.10' &&
@@ -1156,6 +1156,24 @@
X struct list_head *lp;
X struct dentry *result;
X
+ /* fhtype happens to reflect the number of u32s encoded.
+ * due to a bug in earlier code, fhtype might indicate there
+ * are more u32s then actually fitted.
+ * so if fhtype seems to be more than len, reduce fhtype.
+ * Valid types are:
+ * 2 - objectid + dir_id - legacy support
+ * 3 - objectid + dir_id + generation
+ * 4 - objectid + dir_id + objectid and dirid of parent - legacy
+ * 5 - objectid + dir_id + generation + objectid and dirid of parent
+ * 6 - as above plus generation of directory
+ * 6 does not fit in NFSv2 handles
+ */
+ if (fhtype > len) {
+ if (fhtype != 6 || len != 5)
+ printk(KERN_WARNING "nfsd/reiserfs, fhtype=%d, len=%d - odd\n",
+ fhtype, len);
+ fhtype = 5;
+ }
X if (fhtype < 2 || (parent && fhtype < 4))
X goto out ;
X
@@ -1166,22 +1184,24 @@
X key.on_disk_key.k_objectid = data[0] ;
X key.on_disk_key.k_dir_id = data[1] ;
X inode = reiserfs_iget(sb, &key) ;
- if (inode && (fhtype == 3 || fhtype == 6) &&
+ if (inode && !IS_ERR(inode) && (fhtype == 3 || fhtype >= 5) &&
X data[2] != inode->i_generation) {
X iput(inode) ;
X inode = NULL ;
X }
X } else {
- key.on_disk_key.k_objectid = data[fhtype==6?3:2] ;
- key.on_disk_key.k_dir_id = data[fhtype==6?4:3] ;
+ key.on_disk_key.k_objectid = data[fhtype>=5?3:2] ;
+ key.on_disk_key.k_dir_id = data[fhtype>=5?4:3] ;
X inode = reiserfs_iget(sb, &key) ;
- if (inode && fhtype == 6 &&
+ if (inode && !IS_ERR(inode) && fhtype == 6 &&
X data[5] != inode->i_generation) {
X iput(inode) ;
X inode = NULL ;
X }
X }
X out:
+ if (IS_ERR(inode))
+ return ERR_PTR(PTR_ERR(inode));
X if (!inode)
X return ERR_PTR(-ESTALE) ;
X
@@ -1220,17 +1240,20 @@
X data[0] = inode->i_ino ;
X data[1] = le32_to_cpu(INODE_PKEY (inode)->k_dir_id) ;
X data[2] = inode->i_generation ;
- *lenp = 3;
+ *lenp = 3 ;
X /* no room for directory info? return what we've stored so far */
- if (maxlen < 6 || ! need_parent)
- return 3;
+ if (maxlen < 5 || ! need_parent)
+ return 3 ;
X
X inode = dentry->d_parent->d_inode ;
X data[3] = inode->i_ino ;
X data[4] = le32_to_cpu(INODE_PKEY (inode)->k_dir_id) ;
+ *lenp = 5 ;
+ if (maxlen < 6)
+ return 5 ;
X data[5] = inode->i_generation ;
- *lenp = 6;
- return 6;
+ *lenp = 6 ;
+ return 6 ;
X }
X
X
@@ -1790,7 +1813,6 @@
X for(i = 0 ; i < nr ; i++) {
X bh = bhp[i] ;
X lock_buffer(bh) ;
- get_bh(bh) ; /* async end_io handler puts this */
X set_buffer_async_io(bh) ;
X /* submit_bh doesn't care if the buffer is dirty, but nobody
X ** later on in the call chain will be cleaning it. So, we
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/ioctl.c linux/fs/reiserfs/ioctl.c
--- v2.4.9/linux/fs/reiserfs/ioctl.c Wed Mar 21 20:28:56 2001
+++ linux/fs/reiserfs/ioctl.c Sat Sep 8 12:05:32 2001
@@ -2,20 +2,12 @@
X * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
X */
X
-#ifdef __KERNEL__
-
X #include <linux/fs.h>
X #include <linux/reiserfs_fs.h>
X #include <linux/sched.h>
X #include <asm/uaccess.h>
X #include <linux/smp_lock.h>
X #include <linux/locks.h>
-
-#else
-
-#include "nokernel.h"
-
-#endif
X
X /*
X ** reiserfs_ioctl - handler for ioctl for inode
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/item_ops.c linux/fs/reiserfs/item_ops.c
--- v2.4.9/linux/fs/reiserfs/item_ops.c Mon Jan 15 12:42:32 2001
+++ linux/fs/reiserfs/item_ops.c Sat Sep 8 12:05:32 2001
@@ -2,18 +2,9 @@
X * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
X */
X
-#ifdef __KERNEL__
-
X #include <linux/sched.h>
X #include <linux/reiserfs_fs.h>
X
-#else
-
-#include "nokernel.h"
-
-#endif
-
-
X // this contains item handlers for old item types: sd, direct,
X // indirect, directory
X
@@ -46,14 +37,7 @@
X {
X static char timebuf[256];
X
-#ifndef __KERNEL__
-// struct tm *loctime;
-// loctime = localtime (&t);
- sprintf (timebuf, "%s", asctime (localtime (&t)));
- timebuf[strlen (timebuf) - 1] = 0;
-#else
X sprintf (timebuf, "%ld", t);
-#endif
X return timebuf;
X }
X
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/journal.c linux/fs/reiserfs/journal.c
--- v2.4.9/linux/fs/reiserfs/journal.c Wed Jul 25 17:10:25 2001
+++ linux/fs/reiserfs/journal.c Sun Sep 23 09:49:45 2001
@@ -41,8 +41,6 @@
X ** log blocks to hit disk if it doesn't want to.
X */
X
-#ifdef __KERNEL__
-
X #include <linux/config.h>
X #include <asm/uaccess.h>
X #include <asm/system.h>
@@ -61,13 +59,6 @@
X #include <linux/string.h>
X #include <linux/smp_lock.h>
X
-#else
-
-#include "nokernel.h"
-
-#endif
-
-
X /* the number of mounted filesystems. This is used to decide when to
X ** start and kill the commit thread
X */
@@ -755,6 +746,8 @@
X }
X atomic_set(&(jl->j_commit_flushing), 0) ;
X wake_up(&(jl->j_commit_wait)) ;
+
+ s->s_dirt = 1 ;
X return 0 ;
X }
X
@@ -815,7 +808,7 @@
X ** called by flush_journal_list, before it calls remove_all_from_journal_list
X **
X */
-static int update_journal_header_block(struct super_block *p_s_sb, unsigned long offset, unsigned long trans_id) {
+static int _update_journal_header_block(struct super_block *p_s_sb, unsigned long offset, unsigned long trans_id) {
X struct reiserfs_journal_header *jh ;
X if (trans_id >= SB_JOURNAL(p_s_sb)->j_last_flush_trans_id) {
X if (buffer_locked((SB_JOURNAL(p_s_sb)->j_header_bh))) {
@@ -834,12 +827,21 @@
X ll_rw_block(WRITE, 1, &(SB_JOURNAL(p_s_sb)->j_header_bh)) ;
X wait_on_buffer((SB_JOURNAL(p_s_sb)->j_header_bh)) ;
X if (!buffer_uptodate(SB_JOURNAL(p_s_sb)->j_header_bh)) {
- reiserfs_panic(p_s_sb, "journal-712: buffer write failed\n") ;
+ printk( "reiserfs: journal-837: IO error during journal replay\n" );
+ return -EIO ;
X }
X }
X return 0 ;
X }
X
+static int update_journal_header_block(struct super_block *p_s_sb,
+ unsigned long offset,
+ unsigned long trans_id) {
+ if (_update_journal_header_block(p_s_sb, offset, trans_id)) {
+ reiserfs_panic(p_s_sb, "journal-712: buffer write failed\n") ;
+ }
+ return 0 ;
+}
X /*
X ** flush any and all journal lists older than you are
X ** can only be called from flush_journal_list
@@ -1374,6 +1376,9 @@
X struct buffer_head *c_bh ;
X unsigned long offset ;
X
+ if (!d_bh)
+ return 0 ;
+
X desc = (struct reiserfs_journal_desc *)d_bh->b_data ;
X if (le32_to_cpu(desc->j_len) > 0 && !memcmp(desc->j_magic, JOURNAL_DESC_MAGIC, 8)) {
X if (oldest_invalid_trans_id && *oldest_invalid_trans_id && le32_to_cpu(desc->j_trans_id) > *oldest_invalid_trans_id) {
@@ -1641,8 +1646,6 @@
X
X if (continue_replay && is_read_only(p_s_sb->s_dev)) {
X printk("clm-2076: device is readonly, unable to replay log\n") ;
- brelse(SB_JOURNAL(p_s_sb)->j_header_bh) ;
- SB_JOURNAL(p_s_sb)->j_header_bh = NULL ;
X return -1 ;
X }
X if (continue_replay && (p_s_sb->s_flags & MS_RDONLY)) {
@@ -1734,9 +1737,14 @@
X printk("reiserfs: replayed %d transactions in %lu seconds\n", replay_count,
X CURRENT_TIME - start) ;
X }
- if (!is_read_only(p_s_sb->s_dev)) {
- update_journal_header_block(p_s_sb, SB_JOURNAL(p_s_sb)->j_start,
- SB_JOURNAL(p_s_sb)->j_last_flush_trans_id) ;
+ if (!is_read_only(p_s_sb->s_dev) &&
+ _update_journal_header_block(p_s_sb, SB_JOURNAL(p_s_sb)->j_start,
+ SB_JOURNAL(p_s_sb)->j_last_flush_trans_id))
+ {
+ /* replay failed, caller must call free_journal_ram and abort
+ ** the mount
+ */
+ return -1 ;
X }
X return 0 ;
X }
@@ -2318,7 +2326,6 @@
X return do_journal_end(th, p_s_sb, nblocks, COMMIT_NOW | WAIT) ;
X }
X
-#ifdef __KERNEL__
X int show_reiserfs_locks(void) {
X
X dump_journal_writers() ;
@@ -2338,7 +2345,6 @@
X #endif
X return 0 ;
X }
-#endif
X
X /*
X ** used to get memory back from async commits that are floating around
@@ -2374,7 +2380,6 @@
X int count = 0;
X int start ;
X time_t now ;
- int keep_dirty = 0 ;
X struct reiserfs_transaction_handle th ;
X
X start = SB_JOURNAL_LIST_INDEX(p_s_sb) ;
@@ -2384,10 +2389,6 @@
X if (SB_JOURNAL_LIST_INDEX(p_s_sb) < 0) {
X return 0 ;
X }
- if (!strcmp(current->comm, "kupdate")) {
- immediate = 0 ;
- keep_dirty = 1 ;
- }
X /* starting with oldest, loop until we get to the start */
X i = (SB_JOURNAL_LIST_INDEX(p_s_sb) + 1) % JOURNAL_LIST_COUNT ;
X while(i != start) {
@@ -2412,7 +2413,6 @@
X reiserfs_prepare_for_journal(p_s_sb, SB_BUFFER_WITH_SB(p_s_sb), 1) ;
X journal_mark_dirty(&th, p_s_sb, SB_BUFFER_WITH_SB(p_s_sb)) ;
X do_journal_end(&th, p_s_sb,1, COMMIT_NOW) ;
- keep_dirty = 0 ;
X } else if (immediate) { /* belongs above, but I wanted this to be very explicit as a special case. If they say to
X flush, we must be sure old transactions hit the disk too. */
X journal_join(&th, p_s_sb, 1) ;
@@ -2420,8 +2420,8 @@
X journal_mark_dirty(&th, p_s_sb, SB_BUFFER_WITH_SB(p_s_sb)) ;
X do_journal_end(&th, p_s_sb,1, COMMIT_NOW | WAIT) ;
X }
- keep_dirty |= reiserfs_journal_kupdate(p_s_sb) ;
- return keep_dirty ;
+ reiserfs_journal_kupdate(p_s_sb) ;
+ return 0 ;
X }
X
X /*
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/lbalance.c linux/fs/reiserfs/lbalance.c
--- v2.4.9/linux/fs/reiserfs/lbalance.c Mon Jan 15 15:31:19 2001
+++ linux/fs/reiserfs/lbalance.c Sat Sep 8 12:05:32 2001
@@ -2,20 +2,12 @@
X * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
X */
X
-#ifdef __KERNEL__
-
X #include <linux/config.h>
X #include <asm/uaccess.h>
X #include <linux/string.h>
X #include <linux/sched.h>
X #include <linux/reiserfs_fs.h>
X
-#else
-
-#include "nokernel.h"
-
-#endif
-
X /* these are used in do_balance.c */
X
X /* leaf_move_items
@@ -66,13 +58,8 @@
X
X /* if there are no items in dest or the first/last item in dest is not item of the same directory */
X if ( (item_num_in_dest == - 1) ||
-#ifdef REISERFS_FSCK
- (last_first == FIRST_TO_LAST && are_items_mergeable (B_N_PITEM_HEAD (dest, item_num_in_dest), ih, dest->b_size) == 0) ||
- (last_first == LAST_TO_FIRST && are_items_mergeable (ih, B_N_PITEM_HEAD (dest, item_num_in_dest), dest->b_size) == 0)) {
-#else
X (last_first == FIRST_TO_LAST && le_key_k_offset (ih_version (ih), &(ih->ih_key)) == DOT_OFFSET) ||
X (last_first == LAST_TO_FIRST && comp_short_le_keys/*COMP_SHORT_KEYS*/ (&ih->ih_key, B_N_PKEY (dest, item_num_in_dest)))) {
-#endif
X /* create new item in dest */
X struct item_head new_ih;
X
@@ -135,11 +122,7 @@
X that we copy, so we return */
X ih = B_N_PITEM_HEAD (src, 0);
X dih = B_N_PITEM_HEAD (dest, dest_nr_item - 1);
-#ifdef REISERFS_FSCK
- if (!dest_nr_item || (are_items_mergeable (dih, ih, src->b_size) == 0))
-#else
X if (!dest_nr_item || (!op_is_left_mergeable (&(ih->ih_key), src->b_size)))
-#endif
X /* there is nothing to merge */
X return 0;
X
@@ -202,11 +185,7 @@
X ih = B_N_PITEM_HEAD (src, src_nr_item - 1);
X dih = B_N_PITEM_HEAD (dest, 0);
X
-#ifdef REISERFS_FSCK
- if (!dest_nr_item || are_items_mergeable (ih, dih, src->b_size) == 0)
-#else
X if (!dest_nr_item || !op_is_left_mergeable (&(dih->ih_key), src->b_size))
-#endif
X return 0;
X
X if ( is_direntry_le_ih (ih)) {
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/namei.c linux/fs/reiserfs/namei.c
--- v2.4.9/linux/fs/reiserfs/namei.c Wed Jul 25 17:10:25 2001
+++ linux/fs/reiserfs/namei.c Fri Sep 14 14:16:08 2001
@@ -11,20 +11,12 @@
X * NO WARRANTY
X */
X
-#ifdef __KERNEL__
-
X #include <linux/config.h>
X #include <linux/sched.h>
X #include <linux/bitops.h>
X #include <linux/reiserfs_fs.h>
X #include <linux/smp_lock.h>
X
-#else
-
-#include "nokernel.h"
-
-#endif
-
X /* there should be an overview right
X here, as there should be in every
X conceptual grouping of code. This
@@ -382,7 +374,7 @@
X pathrelse (&path_to_entry);
X if (retval == NAME_FOUND) {
X inode = reiserfs_iget (dir->i_sb, (struct cpu_key *)&(de.de_dir_id));
- if (!inode) {
+ if (!inode || IS_ERR(inode)) {
X return ERR_PTR(-EACCES);
X }
X }
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/objectid.c linux/fs/reiserfs/objectid.c
--- v2.4.9/linux/fs/reiserfs/objectid.c Fri Apr 27 14:18:08 2001
+++ linux/fs/reiserfs/objectid.c Sat Sep 8 12:05:32 2001
@@ -1,19 +1,12 @@
X /*
X * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
X */
-#ifdef __KERNEL__
X
X #include <linux/config.h>
X #include <linux/string.h>
X #include <linux/locks.h>
X #include <linux/sched.h>
X #include <linux/reiserfs_fs.h>
-
-#else
-
-#include "nokernel.h"
-
-#endif
X
X
X // find where objectid map starts
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/prints.c linux/fs/reiserfs/prints.c
--- v2.4.9/linux/fs/reiserfs/prints.c Wed May 16 10:31:27 2001
+++ linux/fs/reiserfs/prints.c Sat Sep 8 12:05:32 2001
@@ -1,7 +1,6 @@
X /*
X * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
X */
-#ifdef __KERNEL__
X
X #include <linux/config.h>
X #include <linux/sched.h>
@@ -9,13 +8,6 @@
X #include <linux/reiserfs_fs.h>
X #include <linux/string.h>
X
-#else
-
-#include "nokernel.h"
-#include <limits.h>
-
-#endif
-
X #include <stdarg.h>
X
X static char error_buf[1024];
@@ -324,17 +316,13 @@
X
X void reiserfs_panic (struct super_block * sb, const char * fmt, ...)
X {
-#ifdef __KERNEL__
X show_reiserfs_locks() ;
-#endif
X do_reiserfs_warning;
X printk ("%s", error_buf);
X BUG ();
X // console_print (error_buf);
X // for (;;);
X
-#ifdef __KERNEL__
-
X /* comment before release */
X //for (;;);
X
@@ -354,9 +342,6 @@
X
X panic ("REISERFS: panic (device %s): %s\n",
X sb ? kdevname(sb->s_dev) : "sb == 0", error_buf);
-#else
- exit (0);
-#endif
X }
X
X
@@ -676,142 +661,6 @@
X {
X printk ("%s\n%s", mes, print_tb_buf);
X }
-
-
-#ifndef __KERNEL__
-
-void print_bmap_block (int i, char * data, int size, int silent)
-{
- int j, k;
- int bits = size * 8;
- int zeros = 0, ones = 0;
-
-
- if (test_bit (0, data)) {
- /* first block addressed by this bitmap block is used */
- ones ++;
- if (!silent)
- printf ("Busy (%d-", i * bits);
- for (j = 1; j < bits; j ++) {
- while (test_bit (j, data)) {
- ones ++;
- if (j == bits - 1) {
- if (!silent)
- printf ("%d)\n", j + i * bits);
- goto end;
- }
- j++;
- }
- if (!silent)
- printf ("%d) Free(%d-", j - 1 + i * bits, j + i * bits);
-
- while (!test_bit (j, data)) {
- zeros ++;
- if (j == bits - 1) {
- if (!silent)
- printf ("%d)\n", j + i * bits);
- goto end;
- }
- j++;
- }
- if (!silent)
- printf ("%d) Busy(%d-", j - 1 + i * bits, j + i * bits);
-
- j --;
- end:
- }
- } else {
- /* first block addressed by this bitmap is free */
- zeros ++;
- if (!silent)
- printf ("Free (%d-", i * bits);
- for (j = 1; j < bits; j ++) {
- k = 0;
- while (!test_bit (j, data)) {
- k ++;
- if (j == bits - 1) {
- if (!silent)
- printf ("%d)\n", j + i * bits);
- zeros += k;
- goto end2;
- }
- j++;
- }
- zeros += k;
- if (!silent)
- printf ("%d) Busy(%d-", j - 1 + i * bits, j + i * bits);
-
- k = 0;
- while (test_bit (j, data)) {
- ones ++;
- if (j == bits - 1) {
- if (!silent)
- printf ("%d)\n", j + i * bits);
- ones += k;
- goto end2;
- }
- j++;
- }
- ones += k;
- if (!silent)
- printf ("%d) Busy(%d-", j - 1 + i * bits, j + i * bits);
-
- j --;
- end2:
- }
- }
-
- printf ("used %d, free %d\n", ones, zeros);
-}
-
-
-/* if silent == 1, do not print details */
-void print_bmap (struct super_block * s, int silent)
-{
- int bmapnr = SB_BMAP_NR (s);
- int i;
-
- printf ("Bitmap blocks are:\n");
- for (i = 0; i < bmapnr; i ++) {
- printf ("#%d: block %lu: ", i, SB_AP_BITMAP(s)[i]->b_blocknr);
- print_bmap_block (i, SB_AP_BITMAP(s)[i]->b_data, s->s_blocksize, silent);
- }
-
-}
-
-
-
-
-void print_objectid_map (struct super_block * s)
-{
- int i;
- struct reiserfs_super_block * rs;
- unsigned long * omap;
-
- rs = SB_DISK_SUPER_BLOCK (s);
- omap = (unsigned long *)(rs + 1);
- printk ("Map of objectids\n");
-
- for (i = 0; i < rs->s_oid_cursize; i ++) {
- if (i % 2 == 0)
- printk ("busy(%lu-%lu) ", omap[i], omap[i+1] - 1);
- else
- printk ("free(%lu-%lu) ",
- omap[i], ((i+1) == rs->s_oid_cursize) ? -1 : omap[i+1] - 1);
- }
- printk ("\n");
-
- printk ("Object id array has size %d (max %d):", rs->s_oid_cursize,
- rs->s_oid_maxsize);
-
- for (i = 0; i < rs->s_oid_cursize; i ++)
- printk ("%lu ", omap[i]);
- printk ("\n");
-
-}
-
-#endif /* #ifndef __KERNEL__ */
-
X
X static void check_leaf_block_head (struct buffer_head * bh)
X {
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/resize.c linux/fs/reiserfs/resize.c
--- v2.4.9/linux/fs/reiserfs/resize.c Mon Jan 15 12:42:32 2001
+++ linux/fs/reiserfs/resize.c Sat Sep 8 12:05:32 2001
@@ -8,8 +8,6 @@
X * The kernel part of the (on-line) reiserfs resizer.
X */
X
-#ifdef __KERNEL__
-
X #include <linux/kernel.h>
X #include <linux/vmalloc.h>
X #include <linux/locks.h>
@@ -17,12 +15,6 @@
X #include <linux/errno.h>
X #include <linux/reiserfs_fs.h>
X #include <linux/reiserfs_fs_sb.h>
-
-#else
-
-#include "nokernel.h"
-
-#endif
X
X int reiserfs_resize (struct super_block * s, unsigned long block_count_new)
X {
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/stree.c linux/fs/reiserfs/stree.c
--- v2.4.9/linux/fs/reiserfs/stree.c Wed Jul 25 17:10:25 2001
+++ linux/fs/reiserfs/stree.c Sat Sep 8 12:05:32 2001
@@ -52,7 +52,6 @@
X * reiserfs_paste_into_item
X * reiserfs_insert_item
X */
-#ifdef __KERNEL__
X
X #include <linux/config.h>
X #include <linux/sched.h>
@@ -62,14 +61,6 @@
X #include <linux/reiserfs_fs.h>
X #include <linux/smp_lock.h>
X
-#else
-
-#include "nokernel.h"
-
-#endif
-
-
-
X /* Does the buffer contain a disk block which is in the tree. */
X inline int B_IS_IN_TREE (struct buffer_head * p_s_bh)
X {
@@ -1212,10 +1203,6 @@
X /* Block is locked or held more than by one holder and by
X journal. */
X
-#ifndef __KERNEL__
- reiserfs_panic(p_s_sb, "PAP-5270: prepare_for_delete_or_cut: b_count != 1");
-#endif
-
X #ifdef CONFIG_REISERFS_CHECK
X if (n_repeat_counter && (n_repeat_counter % 100000) == 0) {
X printk("prepare_for_delete, waiting on buffer %lu, b_count %d, %s%cJDIRTY %cJDIRTY_WAIT\n",
@@ -1280,11 +1267,9 @@
X }
X #endif
X
-#ifdef __KERNEL__
X run_task_queue(&tq_disk);
X current->policy |= SCHED_YIELD;
X schedule();
-#endif
X }
X /* This loop can be optimized. */
X } while ( (*p_n_removed < n_unfm_number || need_research) &&
@@ -1857,6 +1842,7 @@
X return;
X }
X if (retval == POSITION_FOUND || retval == FILE_NOT_FOUND) {
+ pathrelse (&s_search_path);
X reiserfs_warning ("PAP-5660: reiserfs_do_truncate: "
X "wrong result %d of search for %K\n", retval, &s_item_key);
X return;
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/super.c linux/fs/reiserfs/super.c
--- v2.4.9/linux/fs/reiserfs/super.c Tue Jul 3 17:08:21 2001
+++ linux/fs/reiserfs/super.c Sat Sep 8 12:05:32 2001
@@ -11,8 +11,6 @@
X * NO WARRANTY
X */
X
-#ifdef __KERNEL__
-
X #include <linux/config.h>
X #include <linux/module.h>
X #include <linux/sched.h>
@@ -22,26 +20,10 @@
X #include <linux/locks.h>
X #include <linux/init.h>
X
-#else
-
-#include "nokernel.h"
-#include <stdlib.h> // for simple_strtoul
-
-#endif
-
-#define SUPPORT_OLD_FORMAT
-
X #define REISERFS_OLD_BLOCKSIZE 4096
X #define REISERFS_SUPER_MAGIC_STRING_OFFSET_NJ 20
X
X
-#if 0
-// this one is not used currently
-inline void reiserfs_mark_buffer_dirty (struct buffer_head * bh, int flag)
-{
- mark_buffer_dirty (bh, flag);
-}
-#endif
X
X //
X // a portion of this function, particularly the VFS interface portion,
@@ -367,98 +349,34 @@
X free, SB_FREE_BLOCKS (s));
X }
X
-#ifdef SUPPORT_OLD_FORMAT
X
-/* support old disk layout */
-static int read_old_super_block (struct super_block * s, int size)
-{
- struct buffer_head * bh;
- struct reiserfs_super_block * rs;
X
- printk("read_old_super_block: try to find super block in old location\n");
- /* there are only 4k-sized blocks in v3.5.10 */
- if (size != REISERFS_OLD_BLOCKSIZE)
- set_blocksize(s->s_dev, REISERFS_OLD_BLOCKSIZE);
- bh = bread (s->s_dev,
- REISERFS_OLD_DISK_OFFSET_IN_BYTES / REISERFS_OLD_BLOCKSIZE,
- REISERFS_OLD_BLOCKSIZE);
- if (!bh) {
- printk("read_old_super_block: unable to read superblock on dev %s\n", kdevname(s->s_dev));
- return 1;
- }
-
- rs = (struct reiserfs_super_block *)bh->b_data;
- if (strncmp (rs->s_magic, REISERFS_SUPER_MAGIC_STRING, strlen ( REISERFS_SUPER_MAGIC_STRING))) {
- /* pre-journaling version check */
- if(!strncmp((char*)rs + REISERFS_SUPER_MAGIC_STRING_OFFSET_NJ,
- REISERFS_SUPER_MAGIC_STRING, strlen(REISERFS_SUPER_MAGIC_STRING))) {
- printk("read_old_super_blockr: a pre-journaling reiserfs filesystem isn't suitable there.\n");
- brelse(bh);
- return 1;
- }
-
- brelse (bh);
- printk ("read_old_super_block: can't find a reiserfs filesystem on dev %s.\n", kdevname(s->s_dev));
- return 1;
- }
-
- if(REISERFS_OLD_BLOCKSIZE != le16_to_cpu (rs->s_blocksize)) {
- printk("read_old_super_block: blocksize mismatch, super block corrupted\n");
- brelse(bh);
- return 1;
- }
-
- s->s_blocksize = REISERFS_OLD_BLOCKSIZE;
- s->s_blocksize_bits = 0;
- while ((1 << s->s_blocksize_bits) != s->s_blocksize)
- s->s_blocksize_bits ++;
-
- SB_BUFFER_WITH_SB (s) = bh;
- SB_DISK_SUPER_BLOCK (s) = rs;
- s->s_op = &reiserfs_sops;
- return 0;
-}
-#endif
-
-//
-// FIXME: mounting old filesystems we _must_ change magic string to
-// make then unmountable by reiserfs of 3.5.x
-//
-static int read_super_block (struct super_block * s, int size)
+static int read_super_block (struct super_block * s, int size, int offset)
X {
X struct buffer_head * bh;
X struct reiserfs_super_block * rs;
X
- bh = bread (s->s_dev, REISERFS_DISK_OFFSET_IN_BYTES / size, size);
+
+ bh = bread (s->s_dev, offset / size, size);
X if (!bh) {
- printk("read_super_block: unable to read superblock on dev %s\n", kdevname(s->s_dev));
+ printk ("read_super_block: "
+ "bread failed (dev %s, block %d, size %d)\n",
+ kdevname (s->s_dev), offset / size, size);
X return 1;
X }
X
X rs = (struct reiserfs_super_block *)bh->b_data;
X if (!is_reiserfs_magic_string (rs)) {
- printk ("read_super_block: can't find a reiserfs filesystem on dev %s\n",
- kdevname(s->s_dev));
+ printk ("read_super_block: "
+ "can't find a reiserfs filesystem on (dev %s, block %lu, size %d)\n",
+ kdevname(s->s_dev), bh->b_blocknr, size);
X brelse (bh);
X return 1;
X }
X
X //
- // ok, reiserfs signature (old or new) found in 64-th 1k block of
- // the device
+ // ok, reiserfs signature (old or new) found in at the given offset
X //
-
-#ifndef SUPPORT_OLD_FORMAT
- // with SUPPORT_OLD_FORMAT undefined - detect old format by
- // checking super block version
- if (le16_to_cpu (rs->s_version) != REISERFS_VERSION_2) {
- brelse (bh);
- printk ("read_super_block: unsupported version (%d) of reiserfs found on dev %s\n",
- le16_to_cpu (rs->s_version), kdevname(s->s_dev));
- return 1;
- }
-#endif
-
X s->s_blocksize = le16_to_cpu (rs->s_blocksize);
X s->s_blocksize_bits = 0;
X while ((1 << s->s_blocksize_bits) != s->s_blocksize)
@@ -468,17 +386,22 @@
X
X if (s->s_blocksize != size)
X set_blocksize (s->s_dev, s->s_blocksize);
- bh = reiserfs_bread (s->s_dev, REISERFS_DISK_OFFSET_IN_BYTES / s->s_blocksize, s->s_blocksize);
+
+ bh = bread (s->s_dev, offset / s->s_blocksize, s->s_blocksize);
X if (!bh) {
- printk("read_super_block: unable to read superblock on dev %s\n", kdevname(s->s_dev));
+ printk ("read_super_block: "
+ "bread failed (dev %s, block %d, size %d)\n",
+ kdevname (s->s_dev), offset / size, size);
X return 1;
X }
X
X rs = (struct reiserfs_super_block *)bh->b_data;
X if (!is_reiserfs_magic_string (rs) ||
X le16_to_cpu (rs->s_blocksize) != s->s_blocksize) {
+ printk ("read_super_block: "
+ "can't find a reiserfs filesystem on (dev %s, block %lu, size %d)\n",
+ kdevname(s->s_dev), bh->b_blocknr, size);
X brelse (bh);
- printk ("read_super_block: can't find a reiserfs filesystem on dev %s.\n", kdevname(s->s_dev));
X return 1;
X }
X /* must check to be sure we haven't pulled an old format super out
@@ -489,7 +412,8 @@
X if (bh->b_blocknr >= le32_to_cpu(rs->s_journal_block) &&
X bh->b_blocknr < (le32_to_cpu(rs->s_journal_block) + JOURNAL_BLOCK_COUNT)) {
X brelse(bh) ;
- printk("super-459: read_super_block: super found at block %lu is within its own log. "
+ printk("super-459: read_super_block: "
+ "super found at block %lu is within its own log. "
X "It must not be of this format type.\n", bh->b_blocknr) ;
X return 1 ;
X }
@@ -504,6 +428,8 @@
X return 0;
X }
X
+
+
X /* after journal replay, reread all bitmap and super blocks */
X static int reread_meta_blocks(struct super_block *s) {
X int i ;
@@ -712,15 +638,12 @@
X }
X
X /* read block (64-th 1k block), which can contain reiserfs super block */
- if (read_super_block (s, size)) {
-#ifdef SUPPORT_OLD_FORMAT
+ if (read_super_block (s, size, REISERFS_DISK_OFFSET_IN_BYTES)) {
X // try old format (undistributed bitmap, super block in 8-th 1k block of a device)
- if(read_old_super_block(s,size))
+ if (read_super_block (s, size, REISERFS_OLD_DISK_OFFSET_IN_BYTES))
X goto error;
X else
X old_format = 1;
-#endif
- goto error ;
X }
X
X s->u.reiserfs_sb.s_mount_state = le16_to_cpu (SB_DISK_SUPER_BLOCK (s)->s_state); /* journal victim */
@@ -779,16 +702,23 @@
X
X if (!(s->s_flags & MS_RDONLY)) {
X struct reiserfs_super_block * rs = SB_DISK_SUPER_BLOCK (s);
+ int old_magic;
+
+ old_magic = strncmp (rs->s_magic, REISER2FS_SUPER_MAGIC_STRING,
+ strlen ( REISER2FS_SUPER_MAGIC_STRING));
+ if( old_magic && le16_to_cpu(rs->s_version) != 0 ) {
+ dput(s->s_root) ;
+ s->s_root = NULL ;
+ reiserfs_warning("reiserfs: wrong version/magic combination in the super-block\n") ;
+ goto error ;
+ }
X
X journal_begin(&th, s, 1) ;
X reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1) ;
X
X rs->s_state = cpu_to_le16 (REISERFS_ERROR_FS);
X
- if (strncmp (rs->s_magic, REISER2FS_SUPER_MAGIC_STRING,
- strlen ( REISER2FS_SUPER_MAGIC_STRING))) {
- if (le16_to_cpu(rs->s_version) != 0)
- BUG ();
+ if ( old_magic ) {
X // filesystem created under 3.5.x found
X if (!old_format_only (s)) {
X reiserfs_warning("reiserfs: converting 3.5.x filesystem to the new format\n") ;
@@ -866,8 +796,6 @@
X return 0;
X }
X
-#ifdef __KERNEL__
-
X static DECLARE_FSTYPE_DEV(reiserfs_fs_type,"reiserfs",reiserfs_read_super);
X
X //
@@ -890,8 +818,6 @@
X
X module_init(init_reiserfs_fs) ;
X module_exit(exit_reiserfs_fs) ;
-
-#endif
X
X
X
diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/tail_conversion.c linux/fs/reiserfs/tail_conversion.c
--- v2.4.9/linux/fs/reiserfs/tail_conversion.c Thu Apr 26 10:44:10 2001
+++ linux/fs/reiserfs/tail_conversion.c Sat Sep 8 12:05:32 2001
@@ -2,20 +2,11 @@
X * Copyright 1999 Hans Reiser, see reiserfs/README for licensing and copyright details
X */
X
-#ifdef __KERNEL__
-
X #include <linux/config.h>
X #include <linux/sched.h>
X #include <linux/pagemap.h>
X #include <linux/reiserfs_fs.h>
X #include <linux/locks.h>
-
-#else
-
-#include "nokernel.h"
-
-#endif
-
X
X /* access to tail : when one is going to read tail it must make sure, that is not running.
X direct2indirect and indirect2direct can not run concurrently */
diff -u --recursive --new-file v2.4.9/linux/fs/romfs/inode.c linux/fs/romfs/inode.c
--- v2.4.9/linux/fs/romfs/inode.c Mon Aug 27 12:41:46 2001
+++ linux/fs/romfs/inode.c Mon Sep 10 09:04:53 2001
@@ -124,7 +124,7 @@
X "%s.\n", kdevname(dev));
X goto out;
X }
- if (romfs_checksum(rsb, min(int, sz, 512))) {
+ if (romfs_checksum(rsb, min_t(int, sz, 512))) {
X printk ("romfs: bad initial checksum on dev "
X "%s.\n", kdevname(dev));
X goto out;
@@ -193,7 +193,7 @@
X return -1; /* error */
X
X avail = ROMBSIZE - (offset & ROMBMASK);
- maxsize = min(unsigned long, count, avail);
+ maxsize = min_t(unsigned long, count, avail);
X res = strnlen(((char *)bh->b_data)+(offset&ROMBMASK), maxsize);
X brelse(bh);
X
@@ -206,7 +206,7 @@
X bh = bread(i->i_dev, offset>>ROMBSBITS, ROMBSIZE);
X if (!bh)
X return -1;
- maxsize = min(unsigned long, count - res, ROMBSIZE);
+ maxsize = min_t(unsigned long, count - res, ROMBSIZE);
X avail = strnlen(bh->b_data, maxsize);
X res += avail;
X brelse(bh);
@@ -231,7 +231,7 @@
X return -1; /* error */
X
X avail = ROMBSIZE - (offset & ROMBMASK);
- maxsize = min(unsigned long, count, avail);
+ maxsize = min_t(unsigned long, count, avail);
X memcpy(dest, ((char *)bh->b_data) + (offset & ROMBMASK), maxsize);
X brelse(bh);
X
@@ -244,7 +244,7 @@
X bh = bread(i->i_dev, offset>>ROMBSBITS, ROMBSIZE);
X if (!bh)
X return -1;
- maxsize = min(unsigned long, count - res, ROMBSIZE);
+ maxsize = min_t(unsigned long, count - res, ROMBSIZE);
X memcpy(dest, bh->b_data, maxsize);
X brelse(bh);
X res += maxsize;
@@ -408,7 +408,7 @@
X offset = page->index << PAGE_CACHE_SHIFT;
X if (offset < inode->i_size) {
X avail = inode->i_size-offset;
- readlen = min(unsigned long, avail, PAGE_SIZE);
+ readlen = min_t(unsigned long, avail, PAGE_SIZE);
X if (romfs_copyfrom(inode, buf, inode->u.romfs_i.i_dataoffset+offset, readlen) == readlen) {
X if (readlen < PAGE_SIZE) {
X memset(buf + readlen,0,PAGE_SIZE-readlen);
diff -u --recursive --new-file v2.4.9/linux/fs/select.c linux/fs/select.c
--- v2.4.9/linux/fs/select.c Mon Aug 27 12:41:46 2001
+++ linux/fs/select.c Mon Sep 10 13:04:33 2001
@@ -17,6 +17,7 @@
X #include <linux/slab.h>
X #include <linux/smp_lock.h>
X #include <linux/poll.h>
+#include <linux/personality.h> /* for STICKY_TIMEOUTS */
X #include <linux/file.h>
X
X #include <asm/uaccess.h>
diff -u --recursive --new-file v2.4.9/linux/fs/smbfs/inode.c linux/fs/smbfs/inode.c
--- v2.4.9/linux/fs/smbfs/inode.c Tue Jul 3 17:08:21 2001
+++ linux/fs/smbfs/inode.c Mon Sep 10 07:31:30 2001
@@ -544,7 +544,9 @@
X attr->ia_size);
X if (error)
X goto out;
- vmtruncate(inode, attr->ia_size);
+ error = vmtruncate(inode, attr->ia_size);
+ if (error)
+ goto out;
X refresh = 1;
X }
X
diff -u --recursive --new-file v2.4.9/linux/fs/stat.c linux/fs/stat.c
--- v2.4.9/linux/fs/stat.c Wed Apr 18 11:49:12 2001
+++ linux/fs/stat.c Thu Sep 13 16:04:43 2001
@@ -26,7 +26,7 @@
X }
X
X
-#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) && !defined(CONFIG_ARCH_S390) && !defined(__hppa__)
+#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) && !defined(CONFIG_ARCH_S390) && !defined(__hppa__) && !defined(__x86_64__)
X
X /*
X * For backward compatibility? Maybe this should be moved
@@ -127,7 +127,7 @@
X }
X
X
-#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) && !defined(CONFIG_ARCH_S390) && !defined(__hppa__)
+#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) && !defined(CONFIG_ARCH_S390) && !defined(__hppa__) && !defined(__x86_64__)
X /*
X * For backward compatibility? Maybe this should be moved
X * into arch/i386 instead?
@@ -163,7 +163,7 @@
X return error;
X }
X
-#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) && !defined(CONFIG_ARCH_S390) && !defined(__hppa__)
+#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) && !defined(CONFIG_ARCH_S390) && !defined(__hppa__) && !defined(__x86_64__)
X
X /*
X * For backward compatibility? Maybe this should be moved
@@ -201,7 +201,7 @@
X return error;
X }
X
-#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) && !defined(CONFIG_ARCH_S390) && !defined(__hppa__)
+#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) && !defined(CONFIG_ARCH_S390) && !defined(__hppa__) && !defined(__x86_64__)
X
X /*
X * For backward compatibility? Maybe this should be moved
@@ -268,7 +268,7 @@
X
X
X /* ---------- LFS-64 ----------- */
-#if !defined(__alpha__) && !defined(__ia64__) && !defined(__mips64) && !defined(CONFIG_ARCH_S390X)
+#if !defined(__alpha__) && !defined(__ia64__) && !defined(__mips64) && !defined(__x86_64__) && !defined(CONFIG_ARCH_S390X)
X
X static long cp_new_stat64(struct inode * inode, struct stat64 * statbuf)
X {
diff -u --recursive --new-file v2.4.9/linux/fs/super.c linux/fs/super.c
--- v2.4.9/linux/fs/super.c Sun Aug 12 13:28:00 2001
+++ linux/fs/super.c Sat Sep 22 20:35:43 2001
@@ -122,6 +122,7 @@
X return -EINVAL;
X if (fs->next)
X return -EBUSY;
+ INIT_LIST_HEAD(&fs->fs_supers);
X write_lock(&file_systems_lock);
X p = find_filesystem(fs->name);
X if (*p)
@@ -288,8 +289,8 @@
X {
X unsigned long tmp = ((unsigned long) mnt / L1_CACHE_BYTES);
X tmp += ((unsigned long) dentry / L1_CACHE_BYTES);
- tmp = tmp + (tmp >> hash_mask);
- return tmp & hash_bits;
+ tmp = tmp + (tmp >> hash_bits);
+ return tmp & hash_mask;
X }
X
X struct vfsmount *alloc_vfsmnt(void)
@@ -387,8 +388,6 @@
X spin_lock(&dcache_lock);
X list_add(&mnt->mnt_list, vfsmntlist.prev);
X spin_unlock(&dcache_lock);
- if (sb->s_type->fs_flags & FS_SINGLE)
- get_filesystem(sb->s_type);
X out:
X return mnt;
X }
@@ -411,6 +410,7 @@
X mnt->mnt_root = dget(root);
X mnt->mnt_mountpoint = mnt->mnt_root;
X mnt->mnt_parent = mnt;
+ mnt->mnt_flags = old->mnt_flags;
X
X atomic_inc(&sb->s_active);
X out:
@@ -419,6 +419,9 @@
X
X static int graft_tree(struct vfsmount *mnt, struct nameidata *nd)
X {
+ if (mnt->mnt_sb->s_flags & MS_NOUSER)
+ return -EINVAL;
+
X if (S_ISDIR(nd->dentry->d_inode->i_mode) !=
X S_ISDIR(mnt->mnt_root->d_inode->i_mode))
X return -ENOTDIR;
@@ -435,8 +438,6 @@
X list_add(&mnt->mnt_list, vfsmntlist.prev);
X spin_unlock(&dcache_lock);
X up(&nd->dentry->d_inode->i_zombie);
- if (mnt->mnt_sb->s_type->fs_flags & FS_SINGLE)
- get_filesystem(mnt->mnt_sb->s_type);
X mntget(mnt);
X return 0;
X fail:
@@ -520,16 +521,17 @@
X int flag;
X char *str;
X } fs_info[] = {
- { MS_NOEXEC, ",noexec" },
- { MS_NOSUID, ",nosuid" },
- { MS_NODEV, ",nodev" },
X { MS_SYNCHRONOUS, ",sync" },
X { MS_MANDLOCK, ",mand" },
X { MS_NOATIME, ",noatime" },
X { MS_NODIRATIME, ",nodiratime" },
-#ifdef MS_NOSUB /* Can't find this except in mount.c */
- { MS_NOSUB, ",nosub" },
-#endif
+ { 0, NULL }
+};
+
+static struct proc_fs_info mnt_info[] = {
+ { MNT_NOSUID, ",nosuid" },
+ { MNT_NODEV, ",nodev" },
+ { MNT_NOEXEC, ",noexec" },
X { 0, NULL }
X };
X
@@ -580,6 +582,10 @@
X if (tmp->mnt_sb->s_flags & fs_infop->flag)
X MANGLE(fs_infop->str);
X }
+ for (fs_infop = mnt_info; fs_infop->flag; fs_infop++) {
+ if (tmp->mnt_flags & fs_infop->flag)
+ MANGLE(fs_infop->str);
+ }
X if (!strcmp("nfs", tmp->mnt_sb->s_type->name)) {
X nfss = &tmp->mnt_sb->u.nfs_sb.s_server;
X len += sprintf(buf+len, ",v%d", nfss->rpc_ops->version);
@@ -669,6 +675,7 @@
X
X static void put_super(struct super_block *sb)
X {
+ atomic_dec(&sb->s_active);
X up_write(&sb->s_umount);
X __put_super(sb);
X }
@@ -735,10 +742,6 @@
X s = find_super(dev);
X if (s) {
X spin_unlock(&sb_lock);
- /* Yes, it sucks. As soon as we get refcounting... */
- /* Almost there - next two lines will go away RSN */
- lock_super(s);
- unlock_super(s);
X down_read(&s->s_umount);
X if (s->s_root)
X return s;
@@ -792,6 +795,7 @@
X INIT_LIST_HEAD(&s->s_dirty);
X INIT_LIST_HEAD(&s->s_locked_inodes);
X INIT_LIST_HEAD(&s->s_files);
+ INIT_LIST_HEAD(&s->s_instances);
X init_rwsem(&s->s_umount);
X sema_init(&s->s_lock, 1);
X s->s_count = 1;
@@ -819,7 +823,10 @@
X s->s_type = type;
X spin_lock(&sb_lock);
X list_add (&s->s_list, super_blocks.prev);
+ list_add (&s->s_instances, &type->fs_supers);
+ s->s_count += S_BIAS;
X spin_unlock(&sb_lock);
+ down_write(&s->s_umount);
X lock_super(s);
X if (!type->read_super(s, data, silent))
X goto out_fail;
@@ -835,11 +842,12 @@
X s->s_bdev = 0;
X s->s_type = NULL;
X unlock_super(s);
- atomic_dec(&s->s_active);
X spin_lock(&sb_lock);
X list_del(&s->s_list);
+ list_del(&s->s_instances);
+ s->s_count -= S_BIAS;
X spin_unlock(&sb_lock);
- __put_super(s);
+ put_super(s);
X return NULL;
X }
X
@@ -871,16 +879,38 @@
X kdevname(dev));
X }
X
+static int grab_super(struct super_block *sb)
+{
+ sb->s_count++;
+ atomic_inc(&sb->s_active);
+ spin_unlock(&sb_lock);
+ down_write(&sb->s_umount);
+ if (sb->s_root) {
+ spin_lock(&sb_lock);
+ if (sb->s_count > S_BIAS) {
+ sb->s_count--;
+ spin_unlock(&sb_lock);
+ return 1;
+ }
+ spin_unlock(&sb_lock);
+ }
+ put_super(sb);
+ return 0;
+}
+
X static struct super_block *get_sb_bdev(struct file_system_type *fs_type,
X char *dev_name, int flags, void * data)
X {
X struct inode *inode;
X struct block_device *bdev;
X struct block_device_operations *bdops;
- struct super_block * sb;
+ struct super_block * s;
X struct nameidata nd;
+ struct list_head *p;
X kdev_t dev;
X int error = 0;
+ mode_t mode = FMODE_READ; /* we always need it ;-) */
+
X /* What device it is? */
X if (!dev_name || !*dev_name)
X return ERR_PTR(-EINVAL);
@@ -893,61 +923,85 @@
X if (!S_ISBLK(inode->i_mode))
X goto out;
X error = -EACCES;
- if (IS_NODEV(inode))
+ if (nd.mnt->mnt_flags & MNT_NODEV)
X goto out;
+ bd_acquire(inode);
X bdev = inode->i_bdev;
X bdops = devfs_get_ops ( devfs_get_handle_from_inode (inode) );
X if (bdops) bdev->bd_op = bdops;
X /* Done with lookups, semaphore down */
- down(&mount_sem);
X dev = to_kdev_t(bdev->bd_dev);
- sb = get_super(dev);
- if (sb) {
- if (fs_type == sb->s_type &&
- ((flags ^ sb->s_flags) & MS_RDONLY) == 0) {
-/*
- * We are heavily relying on mount_sem here. We _will_ get rid of that
- * ugliness RSN (and then atomicity of ->s_active will play), but first
- * we need to get rid of "reuse" branch of get_empty_super() and that
- * requires reference counters. Chicken and egg problem, but fortunately
- * we can use the fact that right now all accesses to ->s_active are
- * under mount_sem.
- */
- if (atomic_read(&sb->s_active)) {
- spin_lock(&sb_lock);
- sb->s_count--;
- spin_unlock(&sb_lock);
- }
- atomic_inc(&sb->s_active);
- up_read(&sb->s_umount);
- path_release(&nd);
- return sb;
- }
- drop_super(sb);
- } else {
- mode_t mode = FMODE_READ; /* we always need it ;-) */
- if (!(flags & MS_RDONLY))
- mode |= FMODE_WRITE;
- error = blkdev_get(bdev, mode, 0, BDEV_FS);
- if (error)
- goto out;
- check_disk_change(dev);
- error = -EACCES;
- if (!(flags & MS_RDONLY) && is_read_only(dev))
+ if (!(flags & MS_RDONLY))
+ mode |= FMODE_WRITE;
+ error = blkdev_get(bdev, mode, 0, BDEV_FS);
+ if (error)
+ goto out;
+ check_disk_change(dev);
+ error = -EACCES;
+ if (!(flags & MS_RDONLY) && is_read_only(dev))
+ goto out1;
+
+ error = -ENOMEM;
+ s = alloc_super();
+ if (!s)
+ goto out1;
+ down_write(&s->s_umount);
+
+ error = -EBUSY;
+restart:
+ spin_lock(&sb_lock);
+
+ list_for_each(p, &super_blocks) {
+ struct super_block *old = sb_entry(p);
+ if (old->s_dev != dev)
+ continue;
+ if (old->s_type != fs_type ||
+ ((flags ^ old->s_flags) & MS_RDONLY)) {
+ spin_unlock(&sb_lock);
+ put_super(s);
X goto out1;
- error = -EINVAL;
- sb = read_super(dev, bdev, fs_type, flags, data, 0);
- if (sb) {
- get_filesystem(fs_type);
- path_release(&nd);
- return sb;
X }
-out1:
+ if (!grab_super(old))
+ goto restart;
+ put_super(s);
X blkdev_put(bdev, BDEV_FS);
+ path_release(&nd);
+ return old;
X }
+ s->s_dev = dev;
+ s->s_bdev = bdev;
+ s->s_flags = flags;
+ s->s_type = fs_type;
+ list_add (&s->s_list, super_blocks.prev);
+ list_add (&s->s_instances, &fs_type->fs_supers);
+ s->s_count += S_BIAS;
+
+ spin_unlock(&sb_lock);
+
+ error = -EINVAL;
+ lock_super(s);
+ if (!fs_type->read_super(s, data, 0))
+ goto out_fail;
+ unlock_super(s);
+ get_filesystem(fs_type);
+ path_release(&nd);
+ return s;
+
+out_fail:
+ s->s_dev = 0;
+ s->s_bdev = 0;
+ s->s_type = NULL;
+ unlock_super(s);
+ spin_lock(&sb_lock);
+ list_del(&s->s_list);
+ list_del(&s->s_instances);
+ s->s_count -= S_BIAS;
+ spin_unlock(&sb_lock);
+ put_super(s);
+out1:
+ blkdev_put(bdev, BDEV_FS);
X out:
X path_release(&nd);
- up(&mount_sem);
X return ERR_PTR(error);
X }
X
@@ -956,7 +1010,6 @@
X {
X kdev_t dev;
X int error = -EMFILE;
- down(&mount_sem);
X dev = get_unnamed_dev();
X if (dev) {
X struct super_block * sb;
@@ -968,25 +1021,65 @@
X }
X put_unnamed_dev(dev);
X }
- up(&mount_sem);
X return ERR_PTR(error);
X }
X
X static struct super_block *get_sb_single(struct file_system_type *fs_type,
X int flags, void *data)
X {
- struct super_block * sb;
+ struct super_block * s = alloc_super();
+ if (!s)
+ return ERR_PTR(-ENOMEM);
+ down_write(&s->s_umount);
X /*
X * Get the superblock of kernel-wide instance, but
X * keep the reference to fs_type.
X */
- down(&mount_sem);
- sb = fs_type->kern_mnt->mnt_sb;
- if (!sb)
- BUG();
- atomic_inc(&sb->s_active);
- do_remount_sb(sb, flags, data);
- return sb;
+retry:
+ spin_lock(&sb_lock);
+ if (!list_empty(&fs_type->fs_supers)) {
+ struct super_block *old;
+ old = list_entry(fs_type->fs_supers.next, struct super_block,
+ s_instances);
+ if (!grab_super(old))
+ goto retry;
+ put_super(s);
+ do_remount_sb(old, flags, data);
+ return old;
+ } else {
+ kdev_t dev = get_unnamed_dev();
+ if (!dev) {
+ put_super(s);
+ return ERR_PTR(-EMFILE);
+ }
+ s->s_dev = dev;
+ s->s_flags = flags;
+ s->s_type = fs_type;
+ list_add (&s->s_list, super_blocks.prev);
+ list_add (&s->s_instances, &fs_type->fs_supers);
+ s->s_count += S_BIAS;
+ spin_unlock(&sb_lock);
+ lock_super(s);
+ if (!fs_type->read_super(s, data, 0))
+ goto out_fail;
+ unlock_super(s);
+ get_filesystem(fs_type);
+ return s;
+
+ out_fail:
+ s->s_dev = 0;
+ s->s_bdev = 0;
+ s->s_type = NULL;
+ unlock_super(s);
+ spin_lock(&sb_lock);
+ list_del(&s->s_list);
+ list_del(&s->s_instances);
+ s->s_count -= S_BIAS;
+ spin_unlock(&sb_lock);
+ put_super(s);
+ put_unnamed_dev(dev);
+ return ERR_PTR(-EINVAL);
+ }
X }
X
X static void kill_super(struct super_block *sb)
@@ -997,8 +1090,12 @@
X struct file_system_type *fs = sb->s_type;
X struct super_operations *sop = sb->s_op;
X
- if (!atomic_dec_and_test(&sb->s_active))
+ if (!atomic_dec_and_lock(&sb->s_active, &sb_lock))
X return;
+
+ sb->s_count -= S_BIAS;
+ spin_unlock(&sb_lock);
+
X down_write(&sb->s_umount);
X lock_kernel();
X sb->s_root = NULL;
@@ -1030,14 +1127,15 @@
X sb->s_type = NULL;
X unlock_super(sb);
X unlock_kernel();
- if (bdev) {
+ if (bdev)
X blkdev_put(bdev, BDEV_FS);
- bdput(bdev);
- } else
+ else
X put_unnamed_dev(dev);
X spin_lock(&sb_lock);
X list_del(&sb->s_list);
+ list_del(&sb->s_instances);
X spin_unlock(&sb_lock);
+ atomic_inc(&sb->s_active);
X put_super(sb);
X }
X
@@ -1056,7 +1154,7 @@
X if (flags & MS_RDONLY)
X acct_auto_close(sb->s_dev);
X shrink_dcache_sb(sb);
- fsync_dev(sb->s_dev);
+ fsync_super(sb);
X /* If we are remounting RDONLY, make sure there are no rw files open */
X if ((flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY))
X if (!fs_may_remount_ro(sb))
@@ -1079,34 +1177,6 @@
X return 0;
X }
X
-struct vfsmount *kern_mount(struct file_system_type *type)
-{
- struct super_block *sb;
- struct vfsmount *mnt = alloc_vfsmnt();
- kdev_t dev;
-
- if (!mnt)
- return ERR_PTR(-ENOMEM);
-
- dev = get_unnamed_dev();
- if (!dev) {
- kmem_cache_free(mnt_cache, mnt);
- return ERR_PTR(-EMFILE);
- }
- sb = read_super(dev, NULL, type, 0, NULL, 0);
- if (!sb) {
- put_unnamed_dev(dev);
- kmem_cache_free(mnt_cache, mnt);
- return ERR_PTR(-EINVAL);
- }
- mnt->mnt_sb = sb;
- mnt->mnt_root = dget(sb->s_root);
- mnt->mnt_mountpoint = mnt->mnt_root;
- mnt->mnt_parent = mnt;
- type->kern_mnt = mnt;
- return mnt;
-}
-
X /*
X * Doesn't take quota and stuff into account. IOW, in some cases it will
X * give false negatives. The main reason why it's here is that we need
@@ -1140,8 +1210,11 @@
X * Special case for "unmounting" root ...
X * we just try to remount it readonly.
X */
- if (!(sb->s_flags & MS_RDONLY))
+ if (!(sb->s_flags & MS_RDONLY)) {
+ down_write(&sb->s_umount);
X retval = do_remount_sb(sb, MS_RDONLY, 0);
+ up_write(&sb->s_umount);
+ }
X return retval;
X }
X
@@ -1152,8 +1225,6 @@
X spin_unlock(&dcache_lock);
X return -EBUSY;
X }
- if (sb->s_type->fs_flags & FS_SINGLE)
- put_filesystem(sb->s_type);
X detach_mnt(mnt, &parent_nd);
X list_del(&mnt->mnt_list);
X spin_unlock(&dcache_lock);
@@ -1315,84 +1386,112 @@
X * on it - tough luck.
X */
X
-static int do_remount(struct nameidata *nd, int flags, char *data)
+static int do_remount(struct nameidata *nd,int flags,int mnt_flags,char *data)
X {
+ int err;
+ struct super_block * sb = nd->mnt->mnt_sb;
+
X if (!capable(CAP_SYS_ADMIN))
X return -EPERM;
X
X if (nd->dentry != nd->mnt->mnt_root)
X return -EINVAL;
X
- return do_remount_sb(nd->mnt->mnt_sb, flags, data);
+ down_write(&sb->s_umount);
+ err = do_remount_sb(sb, flags, data);
+ if (!err)
+ nd->mnt->mnt_flags=mnt_flags;
+ up_write(&sb->s_umount);
+ return err;
X }
X
-static int do_add_mount(struct nameidata *nd, char *type, int flags,
- char *name, void *data)
+struct vfsmount *do_kern_mount(char *type, int flags, char *name, void *data)
X {
X struct file_system_type * fstype;
X struct vfsmount *mnt = NULL;
X struct super_block *sb;
- int retval = 0;
X
X if (!type || !memchr(type, 0, PAGE_SIZE))
- return -EINVAL;
+ return ERR_PTR(-EINVAL);
X
X /* we need capabilities... */
X if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
+ return ERR_PTR(-EPERM);
X
X /* ... filesystem driver... */
X fstype = get_fs_type(type);
X if (!fstype)
- return -ENODEV;
+ return ERR_PTR(-ENODEV);
X
X /* ... allocated vfsmount... */
- retval = -ENOMEM;
X mnt = alloc_vfsmnt();
- if (!mnt)
+ if (!mnt) {
+ mnt = ERR_PTR(-ENOMEM);
X goto fs_out;
+ }
X if (name) {
X mnt->mnt_devname = kmalloc(strlen(name)+1, GFP_KERNEL);
X if (mnt->mnt_devname)
X strcpy(mnt->mnt_devname, name);
X }
X
- /* get superblock, locks mount_sem on success */
- if (fstype->fs_flags & FS_NOMOUNT)
- sb = ERR_PTR(-EINVAL);
- else if (fstype->fs_flags & FS_REQUIRES_DEV)
+ /* get locked superblock */
+ if (fstype->fs_flags & FS_REQUIRES_DEV)
X sb = get_sb_bdev(fstype, name, flags, data);
X else if (fstype->fs_flags & FS_SINGLE)
X sb = get_sb_single(fstype, flags, data);
X else
X sb = get_sb_nodev(fstype, flags, data);
X
- retval = PTR_ERR(sb);
X if (IS_ERR(sb)) {
X if (mnt->mnt_devname)
X kfree(mnt->mnt_devname);
X kmem_cache_free(mnt_cache, mnt);
+ mnt = (struct vfsmount *)sb;
X goto fs_out;
X }
+ if (fstype->fs_flags & FS_NOMOUNT)
+ sb->s_flags |= MS_NOUSER;
X
X mnt->mnt_sb = sb;
X mnt->mnt_root = dget(sb->s_root);
X mnt->mnt_mountpoint = mnt->mnt_root;
X mnt->mnt_parent = mnt;
+ up_write(&sb->s_umount);
+fs_out:
+ put_filesystem(fstype);
+ return mnt;
+}
X
+struct vfsmount *kern_mount(struct file_system_type *type)
+{
+ return do_kern_mount((char *)type->name, 0, (char *)type->name, NULL);
+}
+
+static int do_add_mount(struct nameidata *nd, char *type, int flags,
+ int mnt_flags, char *name, void *data)
+{
+ struct vfsmount *mnt = do_kern_mount(type, flags, name, data);
+ int retval = PTR_ERR(mnt);
+
+ if (IS_ERR(mnt))
+ goto out;
+
+ mnt->mnt_flags = mnt_flags;
+
+ down(&mount_sem);
X /* Something was mounted here while we slept */
X while(d_mountpoint(nd->dentry) && follow_down(&nd->mnt, &nd->dentry))
X ;
X
X /* Refuse the same filesystem on the same mount point */
- if (nd->mnt->mnt_sb == sb && nd->mnt->mnt_root == nd->dentry)
+ if (nd->mnt->mnt_sb == mnt->mnt_sb && nd->mnt->mnt_root == nd->dentry)
X retval = -EBUSY;
X else
X retval = graft_tree(mnt, nd);
- mntput(mnt);
X up(&mount_sem);
-fs_out:
- put_filesystem(fstype);
+ mntput(mnt);
+out:
X return retval;
X }
X
@@ -1448,6 +1547,7 @@
X {
X struct nameidata nd;
X int retval = 0;
+ int mnt_flags = 0;
X
X /* Discard magic */
X if ((flags & MS_MGC_MSK) == MS_MGC_VAL)
@@ -1460,6 +1560,15 @@
X if (dev_name && !memchr(dev_name, 0, PAGE_SIZE))
X return -EINVAL;
X
+ /* Separate the per-mountpoint flags */
+ if (flags & MS_NOSUID)
+ mnt_flags |= MNT_NOSUID;
+ if (flags & MS_NODEV)
+ mnt_flags |= MNT_NODEV;
+ if (flags & MS_NOEXEC)
+ mnt_flags |= MNT_NOEXEC;
+ flags &= ~(MS_NOSUID|MS_NOEXEC|MS_NODEV);
+
X /* ... and get the mountpoint */
X if (path_init(dir_name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd))
X retval = path_walk(dir_name, &nd);
@@ -1467,12 +1576,12 @@
X return retval;
X
X if (flags & MS_REMOUNT)
- retval = do_remount(&nd, flags&~MS_REMOUNT,
+ retval = do_remount(&nd, flags&~MS_REMOUNT, mnt_flags,
X (char *)data_page);
X else if (flags & MS_BIND)
X retval = do_loopback(&nd, dev_name);
X else
- retval = do_add_mount(&nd, type_page, flags,
+ retval = do_add_mount(&nd, type_page, flags, mnt_flags,
X dev_name, data_page);
X path_release(&nd);
X return retval;
@@ -1607,6 +1716,7 @@
X if (!ROOT_DEV)
X panic("I have no root and I want to scream");
X
+retry:
X bdev = bdget(kdev_t_to_nr(ROOT_DEV));
X if (!bdev)
X panic(__FUNCTION__ ": unable to allocate root device");
@@ -1618,7 +1728,7 @@
X retval = blkdev_get(bdev, mode, 0, BDEV_FS);
X if (retval == -EROFS) {
X root_mountflags |= MS_RDONLY;
- retval = blkdev_get(bdev, FMODE_READ, 0, BDEV_FS);
+ goto retry;
X }
X if (retval) {
X /*
@@ -1639,6 +1749,7 @@
X fs_type = sb->s_type;
X atomic_inc(&sb->s_active);
X up_read(&sb->s_umount);
+ down_write(&sb->s_umount);
X goto mount_it;
X }
X
@@ -1659,6 +1770,8 @@
X panic("VFS: Unable to mount root fs on %s", kdevname(ROOT_DEV));
X
X mount_it:
+ /* FIXME */
+ up_write(&sb->s_umount);
X printk ("VFS: Mounted root (%s filesystem)%s.\n",
X fs_type->name,
X (sb->s_flags & MS_RDONLY) ? " readonly" : "");
@@ -1863,13 +1976,18 @@
X int blivet;
X struct block_device *ramdisk = old_rootmnt->mnt_sb->s_bdev;
X
+ atomic_inc(&ramdisk->bd_count);
X blivet = blkdev_get(ramdisk, FMODE_READ, 0, BDEV_FS);
X printk(KERN_NOTICE "Trying to unmount old root ... ");
X if (!blivet) {
X blivet = do_umount(old_rootmnt, 0);
X mntput(old_rootmnt);
X if (!blivet) {
- ioctl_by_bdev(ramdisk, BLKFLSBUF, 0);
+ int ioctl_err;
+
+ ioctl_err = ioctl_by_bdev(ramdisk, BLKFLSBUF, 0);
+ if (ioctl_err)
+ printk("failed to release ramdisk %d...", ioctl_err);
X printk("okay\n");
X error = 0;
X }
@@ -1906,27 +2024,36 @@
X ;
X
X do {
- unsigned long tmp;
-
- nr_hash = (1UL << order) * PAGE_SIZE /
- sizeof(struct list_head);
- hash_mask = (nr_hash - 1);
-
- tmp = nr_hash;
- hash_bits = 0;
- while ((tmp >>= 1UL) != 0UL)
- hash_bits++;
-
X mount_hashtable = (struct list_head *)
X __get_free_pages(GFP_ATOMIC, order);
X } while (mount_hashtable == NULL && --order >= 0);
X
- printk("Mount-cache hash table entries: %d (order: %ld, %ld bytes)\n",
- nr_hash, order, (PAGE_SIZE << order));
-
X if (!mount_hashtable)
X panic("Failed to allocate mount hash table\n");
X
+ /*
+ * Find the power-of-two list-heads that can fit into the allocation..
+ * We don't guarantee that "sizeof(struct list_head)" is necessarily
+ * a power-of-two.
+ */
+ nr_hash = (1UL << order) * PAGE_SIZE / sizeof(struct list_head);
+ hash_bits = 0;
+ do {
+ hash_bits++;
+ } while ((nr_hash >> hash_bits) != 0);
+ hash_bits--;
+
+ /*
+ * Re-calculate the actual number of entries and the mask
+ * from the number of bits we can fit.
+ */
+ nr_hash = 1UL << hash_bits;
+ hash_mask = nr_hash-1;
+
+ printk("Mount-cache hash table entries: %d (order: %ld, %ld bytes)\n",
+ nr_hash, order, (PAGE_SIZE << order));
+
+ /* And initialize the newly allocated array */
X d = mount_hashtable;
X i = nr_hash;
X do {
diff -u --recursive --new-file v2.4.9/linux/fs/sysv/Makefile linux/fs/sysv/Makefile
--- v2.4.9/linux/fs/sysv/Makefile Tue Jul 3 17:08:21 2001
+++ linux/fs/sysv/Makefile Sun Sep 2 10:34:36 2001
@@ -9,7 +9,8 @@
X
X O_TARGET := sysv.o
X
-obj-y := ialloc.o balloc.o inode.o itree.o file.o dir.o namei.o super.o
+obj-y := ialloc.o balloc.o inode.o itree.o file.o dir.o \
+ namei.o super.o symlink.o
X obj-m := $(O_TARGET)
X
X include $(TOPDIR)/Rules.make
diff -u --recursive --new-file v2.4.9/linux/fs/sysv/balloc.c linux/fs/sysv/balloc.c
--- v2.4.9/linux/fs/sysv/balloc.c Tue Jul 3 17:08:21 2001
+++ linux/fs/sysv/balloc.c Sun Sep 2 10:34:36 2001
@@ -46,6 +46,14 @@
X unsigned count;
X unsigned block = fs32_to_cpu(sb, nr);
X
+ /*
+ * This code does not work at all for AFS (it has a bitmap
+ * free list). As AFS is supposed to be read-only no one
+ * should call this for an AFS filesystem anyway...
+ */
+ if (sb->sv_type == FSTYPE_AFS)
+ return;
+
X if (block < sb->sv_firstdatazone || block >= sb->sv_nzones) {
X printk("sysv_free_block: trying to free block not in datazone\n");
X return;
@@ -153,6 +161,14 @@
X u32 *blocks;
X unsigned block;
X int n;
+
+ /*
+ * This code does not work at all for AFS (it has a bitmap
+ * free list). As AFS is supposed to be read-only we just
+ * lie and say it has no free block at all.
+ */
+ if (sb->sv_type == FSTYPE_AFS)
+ return 0;
X
X lock_super(sb);
X sb_count = fs32_to_cpu(sb, *sb->sv_free_blocks);
diff -u --recursive --new-file v2.4.9/linux/fs/sysv/inode.c linux/fs/sysv/inode.c
--- v2.4.9/linux/fs/sysv/inode.c Wed Jul 25 17:10:25 2001
+++ linux/fs/sysv/inode.c Mon Sep 10 07:31:30 2001
@@ -131,8 +131,11 @@
X inode->i_fop = &sysv_dir_operations;
X inode->i_mapping->a_ops = &sysv_aops;
X } else if (S_ISLNK(inode->i_mode)) {
- inode->i_op = &sysv_symlink_inode_operations;
- inode->i_mapping->a_ops = &sysv_aops;
+ if (inode->i_blocks) {
+ inode->i_op = &sysv_symlink_inode_operations;
+ inode->i_mapping->a_ops = &sysv_aops;
+ } else
+ inode->i_op = &sysv_fast_symlink_inode_operations;
X } else
X init_special_inode(inode, inode->i_mode, rdev);
X }
@@ -195,9 +198,7 @@
X if (attr->ia_mode == COH_KLUDGE_SYMLINK_MODE)
X attr->ia_mode = COH_KLUDGE_NOT_SYMLINK;
X
- inode_setattr(inode, attr);
-
- return 0;
+ return inode_setattr(inode, attr);
X }
X
X static struct buffer_head * sysv_update_inode(struct inode * inode)
diff -u --recursive --new-file v2.4.9/linux/fs/sysv/super.c linux/fs/sysv/super.c
--- v2.4.9/linux/fs/sysv/super.c Tue Jul 3 17:08:21 2001
+++ linux/fs/sysv/super.c Sun Sep 2 10:34:36 2001
@@ -26,11 +26,16 @@
X #include <linux/sysv_fs.h>
X #include <linux/init.h>
X
-/* The following functions try to recognize specific filesystems.
+/*
+ * The following functions try to recognize specific filesystems.
+ *
X * We recognize:
X * - Xenix FS by its magic number.
X * - SystemV FS by its magic number.
X * - Coherent FS by its funny fname/fpack field.
+ * - SCO AFS by s_nfree == 0xffff
+ * - V7 FS has no distinguishing features.
+ *
X * We discriminate among SystemV4 and SystemV2 FS by the assumption that
X * the time stamp is not < 01-01-1980.
X */
@@ -197,7 +202,19 @@
X sb->sv_bytesex = BYTESEX_BE;
X else
X return 0;
- if (sbd->s_time < JAN_1_1980) {
+
+ if (fs16_to_cpu(sb, sbd->s_nfree) == 0xffff) {
+ sb->sv_type = FSTYPE_AFS;
+ if (!(sb->s_flags & MS_RDONLY)) {
+ printk("SysV FS: SCO EAFS on %s detected, "
+ "forcing read-only mode.\n",
+ bdevname(sb->s_dev));
+ sb->s_flags |= MS_RDONLY;
+ }
+ return sbd->s_type;
+ }
+
+ if (fs32_to_cpu(sb, sbd->s_time) < JAN_1_1980) {
X /* this is likely to happen on SystemV2 FS */
X if (sbd->s_type > 3 || sbd->s_type < 1)
X return 0;
@@ -261,6 +278,7 @@
X [FSTYPE_SYSV2] "SystemV Release 2",
X [FSTYPE_COH] "Coherent",
X [FSTYPE_V7] "V7",
+ [FSTYPE_AFS] "AFS",
X };
X
X static void (*flavour_setup[])(struct super_block *) = {
@@ -269,6 +287,7 @@
X [FSTYPE_SYSV2] detected_sysv2,
X [FSTYPE_COH] detected_coherent,
X [FSTYPE_V7] detected_v7,
+ [FSTYPE_AFS] detected_sysv4,
X };
X
X static int complete_read_super(struct super_block *sb, int silent, int size)
@@ -294,7 +313,8 @@
X sb->sv_toobig_block = 10 + bsize_4 * (1 + bsize_4 * (1 + bsize_4));
X sb->sv_ind_per_block_bits = n_bits-2;
X
- sb->sv_ninodes = (sb->sv_firstdatazone - sb->sv_firstinodezone) << sb->sv_inodes_per_block_bits;
+ sb->sv_ninodes = (sb->sv_firstdatazone - sb->sv_firstinodezone)
+ << sb->sv_inodes_per_block_bits;
X
X sb->s_blocksize = bsize;
X sb->s_blocksize_bits = n_bits;
@@ -346,13 +366,10 @@
X sb->sv_block_base = 0;
X
X for (i = 0; i < sizeof(flavours)/sizeof(flavours[0]) && !size; i++) {
- struct buffer_head *next_bh;
- next_bh = bread(dev, flavours[i].block, BLOCK_SIZE);
- if (!next_bh)
- continue;
X brelse(bh);
- bh = next_bh;
-
+ bh = bread(dev, flavours[i].block, BLOCK_SIZE);
+ if (!bh)
+ continue;
X size = flavours[i].test(sb, bh);
X }
X
@@ -411,8 +428,10 @@
X static struct super_block *v7_read_super(struct super_block *sb,void *data,
X int silent)
X {
- struct buffer_head *bh;
+ struct buffer_head *bh, *bh2 = NULL;
X kdev_t dev = sb->s_dev;
+ struct v7_super_block *v7sb;
+ struct sysv_inode *v7i;
X
X if (440 != sizeof (struct v7_super_block))
X panic("V7 FS: bad super-block size");
SHAR_EOF
true || echo 'restore of patch-2.4.10 failed'
fi
echo 'End of part 172'
echo 'File patch-2.4.10 is continued in part 173'
echo "173" > _shar_seq_.tmp
exit 0
#!/bin/sh -x
# this is part 173 of a 197 - part archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patch-2.4.10 continued
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 173; then
echo "Please unpack part $Scheck next!"
exit 1
else
exit 0
fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping patch-2.4.10'
else
echo 'x - continuing with patch-2.4.10'
sed 's/^X//' << 'SHAR_EOF' >> 'patch-2.4.10' &&
@@ -422,23 +441,41 @@
X sb->sv_type = FSTYPE_V7;
X sb->sv_bytesex = BYTESEX_PDP;
X
- set_blocksize(dev,512);
+ set_blocksize(dev, 512);
X
X if ((bh = bread(dev, 1, 512)) == NULL) {
X if (!silent)
- printk("VFS: unable to read V7 FS superblock on device "
- "%s.\n", bdevname(dev));
+ printk("VFS: unable to read V7 FS superblock on "
+ "device %s.\n", bdevname(dev));
X goto failed;
X }
X
+ /* plausibility check on superblock */
+ v7sb = (struct v7_super_block *) bh->b_data;
+ if (fs16_to_cpu(sb,v7sb->s_nfree) > V7_NICFREE ||
+ fs16_to_cpu(sb,v7sb->s_ninode) > V7_NICINOD ||
+ fs32_to_cpu(sb,v7sb->s_time) == 0)
+ goto failed;
+
+ /* plausibility check on root inode: it is a directory,
+ with a nonzero size that is a multiple of 16 */
+ if ((bh2 = bread(dev, 2, 512)) == NULL)
+ goto failed;
+ v7i = (struct sysv_inode *)(bh2->b_data + 64);
+ if ((fs16_to_cpu(sb,v7i->i_mode) & ~0777) != S_IFDIR ||
+ (fs32_to_cpu(sb,v7i->i_size) == 0) ||
+ (fs32_to_cpu(sb,v7i->i_size) & 017) != 0)
+ goto failed;
+ brelse(bh2);
X
X sb->sv_bh1 = bh;
X sb->sv_bh2 = bh;
X if (complete_read_super(sb, silent, 1))
X return sb;
X
- brelse(bh);
X failed:
+ brelse(bh2);
+ brelse(bh);
X return NULL;
X }
X
diff -u --recursive --new-file v2.4.9/linux/fs/sysv/symlink.c linux/fs/sysv/symlink.c
--- v2.4.9/linux/fs/sysv/symlink.c Wed Dec 31 16:00:00 1969
+++ linux/fs/sysv/symlink.c Sun Sep 2 10:34:36 2001
@@ -0,0 +1,25 @@
+/*
+ * linux/fs/sysv/symlink.c
+ *
+ * Handling of System V filesystem fast symlinks extensions.
+ * Aug 2001, Christoph Hellwig (h...@caldera.de)
+ */
+
+#include <linux/fs.h>
+
+static int sysv_readlink(struct dentry *dentry, char *buffer, int buflen)
+{
+ char *s = (char *)dentry->d_inode->u.sysv_i.i_data;
+ return vfs_readlink(dentry, buffer, buflen, s);
+}
+
+static int sysv_follow_link(struct dentry *dentry, struct nameidata *nd)
+{
+ char *s = (char *)dentry->d_inode->u.sysv_i.i_data;
+ return vfs_follow_link(nd, s);
+}
+
+struct inode_operations sysv_fast_symlink_inode_operations = {
+ readlink: sysv_readlink,
+ follow_link: sysv_follow_link,
+};
diff -u --recursive --new-file v2.4.9/linux/fs/ufs/balloc.c linux/fs/ufs/balloc.c
--- v2.4.9/linux/fs/ufs/balloc.c Mon Aug 27 12:41:47 2001
+++ linux/fs/ufs/balloc.c Thu Sep 13 16:04:43 2001
@@ -271,6 +271,7 @@
X if (!tmp) {
X ufs_error (sb, "ufs_new_fragments", "internal error, "
X "fragment %u, tmp %u\n", fragment, tmp);
+ unlock_super (sb);
X return (unsigned)-1;
X }
X if (fragment < inode->u.ufs_i.i_lastfrag) {
@@ -312,7 +313,7 @@
X *p = SWAB32(result);
X *err = 0;
X inode->i_blocks += count << uspi->s_nspfshift;
- inode->u.ufs_i.i_lastfrag = max(u32, inode->u.ufs_i.i_lastfrag, fragment + count);
+ inode->u.ufs_i.i_lastfrag = max_t(u32, inode->u.ufs_i.i_lastfrag, fragment + count);
X NULLIFY_FRAGMENTS
X }
X unlock_super(sb);
@@ -327,7 +328,7 @@
X if (result) {
X *err = 0;
X inode->i_blocks += count << uspi->s_nspfshift;
- inode->u.ufs_i.i_lastfrag = max(u32, inode->u.ufs_i.i_lastfrag, fragment + count);
+ inode->u.ufs_i.i_lastfrag = max_t(u32, inode->u.ufs_i.i_lastfrag, fragment + count);
X NULLIFY_FRAGMENTS
X unlock_super(sb);
X UFSD(("EXIT, result %u\n", result))
@@ -380,7 +381,7 @@
X *p = SWAB32(result);
X *err = 0;
X inode->i_blocks += count << uspi->s_nspfshift;
- inode->u.ufs_i.i_lastfrag = max(u32, inode->u.ufs_i.i_lastfrag, fragment + count);
+ inode->u.ufs_i.i_lastfrag = max_t(u32, inode->u.ufs_i.i_lastfrag, fragment + count);
X NULLIFY_FRAGMENTS
X unlock_super(sb);
X if (newcount < request)
diff -u --recursive --new-file v2.4.9/linux/fs/ufs/truncate.c linux/fs/ufs/truncate.c
--- v2.4.9/linux/fs/ufs/truncate.c Mon Aug 27 12:41:47 2001
+++ linux/fs/ufs/truncate.c Mon Sep 10 09:06:10 2001
@@ -88,7 +88,7 @@
X retry = 0;
X
X frag1 = DIRECT_FRAGMENT;
- frag4 = min(u32, UFS_NDIR_FRAGMENT, inode->u.ufs_i.i_lastfrag);
+ frag4 = min_t(u32, UFS_NDIR_FRAGMENT, inode->u.ufs_i.i_lastfrag);
X frag2 = ((frag1 & uspi->s_fpbmask) ? ((frag1 | uspi->s_fpbmask) + 1) : frag1);
X frag3 = frag4 & ~uspi->s_fpbmask;
X block1 = block2 = 0;
diff -u --recursive --new-file v2.4.9/linux/fs/ufs/util.c linux/fs/ufs/util.c
--- v2.4.9/linux/fs/ufs/util.c Mon Aug 27 12:41:47 2001
+++ linux/fs/ufs/util.c Mon Sep 10 09:04:53 2001
@@ -170,7 +170,7 @@
X size = ubh->count << uspi->s_fshift;
X bhno = 0;
X while (size) {
- len = min(unsigned int, size, uspi->s_fsize);
+ len = min_t(unsigned int, size, uspi->s_fsize);
X memcpy (mem, ubh->bh[bhno]->b_data, len);
X mem += uspi->s_fsize;
X size -= len;
@@ -186,7 +186,7 @@
X size = ubh->count << uspi->s_fshift;
X bhno = 0;
X while (size) {
- len = min(unsigned int, size, uspi->s_fsize);
+ len = min_t(unsigned int, size, uspi->s_fsize);
X memcpy (ubh->bh[bhno]->b_data, mem, len);
X mem += uspi->s_fsize;
X size -= len;
diff -u --recursive --new-file v2.4.9/linux/fs/ufs/util.h linux/fs/ufs/util.h
--- v2.4.9/linux/fs/ufs/util.h Mon Aug 27 12:41:47 2001
+++ linux/fs/ufs/util.h Mon Sep 10 09:04:53 2001
@@ -331,7 +331,7 @@
X base = offset >> uspi->s_bpfshift;
X offset &= uspi->s_bpfmask;
X for (;;) {
- count = min(unsigned int, size + offset, uspi->s_bpf);
+ count = min_t(unsigned int, size + offset, uspi->s_bpf);
X size -= count - offset;
X pos = ext2_find_next_zero_bit (ubh->bh[base]->b_data, count, offset);
X if (pos < count || !size)
@@ -378,7 +378,7 @@
X base = start >> uspi->s_bpfshift;
X start &= uspi->s_bpfmask;
X for (;;) {
- count = min(unsigned int,
+ count = min_t(unsigned int,
X size + (uspi->s_bpf - start), uspi->s_bpf)
X - (uspi->s_bpf - start);
X size -= count;
diff -u --recursive --new-file v2.4.9/linux/fs/umsdos/README-WIP.txt linux/fs/umsdos/README-WIP.txt
--- v2.4.9/linux/fs/umsdos/README-WIP.txt Thu Dec 9 13:22:21 1999
+++ linux/fs/umsdos/README-WIP.txt Sat Sep 1 10:59:08 2001
@@ -5,18 +5,11 @@
X There is no warning any more.
X Both read-only and read-write stuff is fixed, both in
X msdos-compatibile mode, and in umsdos EMD mode, and it seems stable.
-There are still few hardlink nuisances, but those are not fatal.
-
-I'd call it pre-release, and ask for as many people as possible to
-come and test it! See notes below for some more information, or if
-you are trying to use UMSDOS as root partition.
X
X Userland NOTE: new umsdos_progs (umssync, umssetup, udosctl & friends) that
-will compile and work on 2.2.x kernels and glibc based systems may be found
-at http://cvs.linux.hr/
-
-Also look at the quick-hack "homepage" for umsdos filesystem at
-http://www.voyager.hr/~mnalis/umsdos
+will compile and work on 2.2.x+ kernels and glibc based systems, as well as
+kernel patches and other umsdos related information may be found at
+http://linux.voyager.hr/umsdos/
X
X Information below is getting outdated slowly -- I'll fix it one day when I
X get enough time - there are more important things to fix right now.
@@ -24,7 +17,7 @@
X Legend: those lines marked with '+' on the beggining of line indicates it
X passed all of my tests, and performed perfect in all of them.
X
-Current status (990202) - UMSDOS 0.85:
+Current status (010125) - UMSDOS 0.86j:
X
X (1) pure MSDOS (no --linux-.--- EMD file):
X
@@ -35,7 +28,7 @@
X
X WRITE:
X + creat file - works
-+ delete file - works
++ unlink file - works
X + write file - works
X + rename file (same dir) - works
X + rename file (dif. dir) - works
@@ -66,21 +59,22 @@
X
X WRITE:
X + create symlink - works
-- create hardlink - works
++ create hardlink - works
X + create file - works
X + create special file - works
X + write to file - works
X + rename file (same dir) - works
X + rename file (dif. dir) - works
-- rename hardlink (same dir) -
-- rename hardlink (dif. dir) -
++ rename hardlink (same dir) - works
+- rename hardlink (dif. dir) - works, but see notes below.
X + rename symlink (same dir) - works
X + rename symlink (dif. dir) - works
X + rename dir (same dir) - works
X + rename dir (dif. dir) - works
-+ delete file - works
++ unlink file - works
X + notify_change (chown,perms) - works
-+ delete hardlink - works
++ notify_change for hardlinks - works
++ unlink hardlink - works
X + mkdir - works
X + rmdir - works
X + umssyncing (many ioctls) - works
@@ -99,24 +93,11 @@
X example is specs file about it. Specifically, moving directory which
X contains hardlinks will break them.
X
-Note: (about pseudoroot) If you are currently trying to use UMSDOS as root
-partition (with linux installed in c:\linux) it will boot, but there may be
-some problems. Volunteers ready to test pseudoroot are needed (preferably
-ones with working backups or unimportant data). For example, '/DOS' pseudo
-directory is only partially re-implemented and buggy. It works most of the
-time, though. Update: should work ok in 0.84, although it still does not
-work correctly in combination with initrd featere. Working on this!
-
X Note: (about creating hardlinks in pseudoroot mode) - hardlinks created in
X pseudoroot mode are now again compatibile with 'normal' hardlinks, and vice
X versa. Thanks to Sorin Iordachescu <so...@rodae.ro> for providing fix.
-
-Warning: (about hardlinks) - modifying hardlinks (esp. if they are in
-different directories) are currently somewhat broken, I'm working on it.
-Problem seems to be that code uses and updates EMD of directory where 'real
-hardlink' is stored, not EMD of directory where our pseudo-hardlink is
-located! I'm looking for ideas how to work around this in clean way, since
-without it modifying hardlinks in any but most simple ways is broken!
+See http://linux.voyager.hr/umsdos/hlbug.html for more info and upgrade
+procedure if you used broken versions...
X
X ------------------------------------------------------------------------------
X
@@ -130,6 +111,4 @@
X I'm unfortunately somewhat out of time to read linux-kernel@vger, but I do
X check for messages having "UMSDOS" in the subject, and read them. I might
X miss some in all that volume, though. I should reply to any direct e-mail
-in few days. If I don't, probably I never got your message. You can try
-mnalis...@voyager.hr; however mna...@jagor.srce.hr is preferable.
-
+in few days. If I don't, probably I never got your message.
diff -u --recursive --new-file v2.4.9/linux/fs/umsdos/dir.c linux/fs/umsdos/dir.c
--- v2.4.9/linux/fs/umsdos/dir.c Fri Feb 9 11:29:44 2001
+++ linux/fs/umsdos/dir.c Sat Sep 1 10:59:08 2001
@@ -67,7 +67,7 @@
X static int umsdos_dir_once ( void *buf,
X const char *name,
X int len,
- off_t offset,
+ loff_t offset,
X ino_t ino,
X unsigned type)
X {
@@ -651,13 +651,13 @@
X old_root = dget(current->fs->root);
X read_unlock(¤t->fs->lock);
X spin_lock(&dcache_lock);
- path = __d_path(dentry, NULL, dentry->d_sb->s_root, NULL, buffer, len);
+ path = __d_path(dentry, current->fs->rootmnt, dentry->d_sb->s_root, current->fs->rootmnt, buffer, len); /* FIXME: current->fs->rootmnt */
X spin_unlock(&dcache_lock);
X
X if (*path == '/')
X path++; /* skip leading '/' */
X
- if (old_root->d_inode == pseudo_root)
+ if (current->fs->root->d_inode == pseudo_root)
X {
X *(path-1) = '/';
X path -= (UMSDOS_PSDROOT_LEN+1);
diff -u --recursive --new-file v2.4.9/linux/fs/umsdos/emd.c linux/fs/umsdos/emd.c
--- v2.4.9/linux/fs/umsdos/emd.c Tue Mar 6 19:44:37 2001
+++ linux/fs/umsdos/emd.c Sat Sep 1 10:59:08 2001
@@ -18,7 +18,21 @@
X #include <linux/pagemap.h>
X #include <linux/delay.h>
X
-static void copy_entry(struct umsdos_dirent *p, struct umsdos_dirent *q)
+void put_entry (struct umsdos_dirent *p, struct umsdos_dirent *q)
+{
+ p->name_len = q->name_len;
+ p->flags = q->flags;
+ p->nlink = cpu_to_le16(q->nlink);
+ p->uid = cpu_to_le16(q->uid);
+ p->gid = cpu_to_le16(q->gid);
+ p->atime = cpu_to_le32(q->atime);
+ p->mtime = cpu_to_le32(q->mtime);
+ p->ctime = cpu_to_le32(q->ctime);
+ p->rdev = cpu_to_le16(q->rdev);
+ p->mode = cpu_to_le16(q->mode);
+}
+
+static void get_entry(struct umsdos_dirent *p, struct umsdos_dirent *q)
X {
X p->name_len = q->name_len;
X p->name[p->name_len]='\0';
@@ -136,6 +150,7 @@
X printk (KERN_WARNING "Ignoring invalid EMD entry with size %d\n", entry->name_len);
X p->name_len = 0;
X ret = -ENAMETOOLONG; /* notify umssync(8) code that something is wrong */
+ /* FIXME: does not work if we did 'ls -l' before 'udosctl uls' ?! */
X }
X
X recsize = umsdos_evalrecsize(p->name_len);
@@ -163,7 +178,7 @@
X page_cache_release(page2);
X } else
X memcpy(entry->spare,p->spare,((char*)p+recsize)-p->spare);
- copy_entry(entry, p);
+ get_entry(entry, p);
X kunmap(page);
X page_cache_release(page);
X *pos += recsize;
@@ -249,20 +264,11 @@
X offs+info->recsize-PAGE_CACHE_SIZE);
X if (ret)
X goto out_unlock3;
- p->name_len = entry->name_len;
- p->flags = entry->flags;
- p->nlink = cpu_to_le16(entry->nlink);
- p->uid = cpu_to_le16(entry->uid);
- p->gid = cpu_to_le16(entry->gid);
- p->atime = cpu_to_le32(entry->atime);
- p->mtime = cpu_to_le32(entry->mtime);
- p->ctime = cpu_to_le32(entry->ctime);
- p->rdev = cpu_to_le16(entry->rdev);
- p->mode = cpu_to_le16(entry->mode);
- memcpy(p->name,entry->name,
+ put_entry (p, entry);
+ memcpy(p->spare,entry->spare,
X (char *)(page_address(page) + PAGE_CACHE_SIZE) - p->spare);
X memcpy(page_address(page2),
- entry->spare+PAGE_CACHE_SIZE-offs,
+ ((char*)entry)+PAGE_CACHE_SIZE-offs,
X offs+info->recsize-PAGE_CACHE_SIZE);
X ret = mapping->a_ops->commit_write(NULL,page2,0,
X offs+info->recsize-PAGE_CACHE_SIZE);
@@ -279,16 +285,7 @@
X offs + info->recsize);
X if (ret)
X goto out_unlock;
- p->name_len = entry->name_len;
- p->flags = entry->flags;
- p->nlink = cpu_to_le16(entry->nlink);
- p->uid = cpu_to_le16(entry->uid);
- p->gid = cpu_to_le16(entry->gid);
- p->atime = cpu_to_le32(entry->atime);
- p->mtime = cpu_to_le32(entry->mtime);
- p->ctime = cpu_to_le32(entry->ctime);
- p->rdev = cpu_to_le16(entry->rdev);
- p->mode = cpu_to_le16(entry->mode);
+ put_entry (p, entry);
X memcpy(p->spare,entry->spare,((char*)p+info->recsize)-p->spare);
X ret = mapping->a_ops->commit_write(NULL,page,offs,
X offs + info->recsize);
@@ -463,7 +460,7 @@
X goto skip_it;
X
X info->f_pos = pos;
- copy_entry(entry, rentry);
+ get_entry(entry, rentry);
X ret = 0;
X break;
X skip_it:
diff -u --recursive --new-file v2.4.9/linux/fs/umsdos/inode.c linux/fs/umsdos/inode.c
--- v2.4.9/linux/fs/umsdos/inode.c Sat May 19 18:02:45 2001
+++ linux/fs/umsdos/inode.c Mon Sep 10 07:31:30 2001
@@ -38,7 +38,7 @@
X ,atomic_read(&inode->i_count)));
X
X if (inode == pseudo_root) {
- printk (KERN_ERR "Umsdos: debug: releasing pseudo_root - ino=%lu count=%d\n", inode->i_ino, atomic_read(&inode->i_count));
+ Printk ((KERN_ERR "Umsdos: debug: releasing pseudo_root - ino=%lu count=%d\n", inode->i_ino, atomic_read(&inode->i_count)));
X }
X
X if (atomic_read(&inode->i_count) == 1)
@@ -49,7 +49,7 @@
X void UMSDOS_put_super (struct super_block *sb)
X {
X Printk ((KERN_DEBUG "UMSDOS_put_super: entering\n"));
- if (saved_root) {
+ if (saved_root && pseudo_root && sb->s_dev == ROOT_DEV) {
X shrink_dcache_parent(saved_root);
X dput(saved_root);
X saved_root = NULL;
@@ -153,16 +153,56 @@
X }
X
X
-int umsdos_notify_change_locked(struct dentry *, struct iattr *);
X /*
X * lock the parent dir before starting ...
+ * also handles hardlink converting
X */
X int UMSDOS_notify_change (struct dentry *dentry, struct iattr *attr)
X {
- struct inode *dir = dentry->d_parent->d_inode;
- struct inode *inode = dentry->d_inode;
+ struct inode *dir, *inode;
+ struct umsdos_info info;
+ struct dentry *temp, *old_dentry = NULL;
X int ret;
X
+ ret = umsdos_parse (dentry->d_name.name, dentry->d_name.len,
+ &info);
+ if (ret)
+ goto out;
+ ret = umsdos_findentry (dentry->d_parent, &info, 0);
+ if (ret) {
+printk("UMSDOS_notify_change: %s/%s not in EMD, ret=%d\n",
+dentry->d_parent->d_name.name, dentry->d_name.name, ret);
+ goto out;
+ }
+
+ if (info.entry.flags & UMSDOS_HLINK) {
+ /*
+ * In order to get the correct (real) inode, we just drop
+ * the original dentry.
+ */
+ d_drop(dentry);
+Printk(("UMSDOS_notify_change: hard link %s/%s, fake=%s\n",
+dentry->d_parent->d_name.name, dentry->d_name.name, info.fake.fname));
+
+ /* Do a real lookup to get the short name dentry */
+ temp = umsdos_covered(dentry->d_parent, info.fake.fname,
+ info.fake.len);
+ ret = PTR_ERR(temp);
+ if (IS_ERR(temp))
+ goto out;
+
+ /* now resolve the link ... */
+ temp = umsdos_solve_hlink(temp);
+ ret = PTR_ERR(temp);
+ if (IS_ERR(temp))
+ goto out;
+ old_dentry = dentry;
+ dentry = temp; /* so umsdos_notify_change_locked will operate on that */
+ }
+
+ dir = dentry->d_parent->d_inode;
+ inode = dentry->d_inode;
+
X ret = inode_change_ok (inode, attr);
X if (ret)
X goto out;
@@ -171,11 +211,14 @@
X ret = umsdos_notify_change_locked(dentry, attr);
X up(&dir->i_sem);
X if (ret == 0)
- inode_setattr (inode, attr);
+ ret = inode_setattr (inode, attr);
X out:
+ if (old_dentry)
+ dput (dentry); /* if we had to use fake dentry for hardlinks, dput() it now */
X return ret;
X }
X
+
X /*
X * Must be called with the parent lock held.
X */
@@ -316,16 +359,16 @@
X struct super_block *res;
X struct dentry *new_root;
X
- MSDOS_SB(sb)->options.isvfat = 0;
X /*
X * Call msdos-fs to mount the disk.
X * Note: this returns res == sb or NULL
X */
X res = msdos_read_super (sb, data, silent);
+
X if (!res)
X goto out_fail;
X
- printk (KERN_INFO "UMSDOS 0.86i "
+ printk (KERN_INFO "UMSDOS 0.86k "
X "(compatibility level %d.%d, fast msdos)\n",
X UMSDOS_VERSION, UMSDOS_RELEASE);
X
@@ -334,6 +377,7 @@
X
X /* install our dentry operations ... */
X sb->s_root->d_op = &umsdos_dentry_operations;
+
X umsdos_patch_dentry_inode(sb->s_root, 0);
X
X /* Check whether to change to the /linux root */
@@ -345,10 +389,9 @@
X printk("umsdos_read_super: pseudo-root wrong ops!\n");
X
X pseudo_root = new_root->d_inode;
-
X saved_root = sb->s_root;
- sb->s_root = new_root;
X printk(KERN_INFO "UMSDOS: changed to alternate root\n");
+ dget (sb->s_root); sb->s_root = dget(new_root);
X }
X return sb;
X
@@ -381,10 +424,12 @@
X root = lookup_one_len(UMSDOS_PSDROOT_NAME, sb->s_root,UMSDOS_PSDROOT_LEN);
X if (IS_ERR(root))
X goto out_noroot;
+
X if (!root->d_inode || !S_ISDIR(root->d_inode->i_mode))
X goto out_dput;
X
- printk(KERN_INFO "check_pseudo_root: found %s/%s\n", root->d_parent->d_name.name, root->d_name.name);
+printk(KERN_INFO "check_pseudo_root: found %s/%s\n",
+root->d_parent->d_name.name, root->d_name.name);
X
X /* look for /sbin/init */
X sbin = lookup_one_len("sbin", root, 4);
diff -u --recursive --new-file v2.4.9/linux/fs/umsdos/ioctl.c linux/fs/umsdos/ioctl.c
--- v2.4.9/linux/fs/umsdos/ioctl.c Wed Apr 18 11:49:13 2001
+++ linux/fs/umsdos/ioctl.c Tue Aug 28 08:16:07 2001
@@ -28,7 +28,7 @@
X void *buf,
X const char *name,
X int name_len,
- off_t offset,
+ loff_t offset,
X ino_t ino,
X unsigned type)
X {
diff -u --recursive --new-file v2.4.9/linux/fs/umsdos/namei.c linux/fs/umsdos/namei.c
--- v2.4.9/linux/fs/umsdos/namei.c Mon Aug 27 12:41:47 2001
+++ linux/fs/umsdos/namei.c Sat Sep 1 10:59:08 2001
@@ -405,8 +405,15 @@
X goto out_unlock;
X /* make sure it's the same inode! */
X ret = -ENOENT;
- if (old->d_inode != old_inode)
- goto out_dput;
+ /*
+ * note: for hardlinks they will be different!
+ * old_inode will contain inode of .LINKxxx file containing data, and
+ * old->d_inode will contain inode of file containing path to .LINKxxx file
+ */
+ if (!(old_info.entry.flags & UMSDOS_HLINK)) {
+ if (old->d_inode != old_inode)
+ goto out_dput;
+ }
X
X new = umsdos_covered(new_dentry->d_parent, new_info.fake.fname,
X new_info.fake.len);
@@ -531,7 +538,7 @@
X struct umsdos_info hid_info;
X
X #ifdef UMSDOS_DEBUG_VERBOSE
-printk("umsdos_link: new %s%s -> %s/%s\n",
+printk("umsdos_link: new %s/%s -> %s/%s\n",
X dentry->d_parent->d_name.name, dentry->d_name.name,
X olddentry->d_parent->d_name.name, olddentry->d_name.name);
X #endif
@@ -698,17 +705,36 @@
X if (ret == 0) {
X struct iattr newattrs;
X
+ /* Do a real lookup to get the short name dentry */
+ temp = umsdos_covered(olddentry->d_parent,
+ old_info.fake.fname,
+ old_info.fake.len);
+ ret = PTR_ERR(temp);
+ if (IS_ERR(temp))
+ goto out_unlock2;
+
+ /* now resolve the link ... */
+ temp = umsdos_solve_hlink(temp);
+ ret = PTR_ERR(temp);
+ if (IS_ERR(temp))
+ goto out_unlock2;
+
+
X #ifdef UMSDOS_PARANOIA
X if (!oldinode->u.umsdos_i.i_is_hlink)
X printk("UMSDOS_link: %s/%s, ino=%ld, not marked as hlink!\n",
X olddentry->d_parent->d_name.name, olddentry->d_name.name, oldinode->i_ino);
X #endif
- oldinode->i_nlink++;
+ temp->d_inode->i_nlink++;
X Printk(("UMSDOS_link: linked %s/%s, ino=%ld, nlink=%d\n",
X olddentry->d_parent->d_name.name, olddentry->d_name.name,
X oldinode->i_ino, oldinode->i_nlink));
X newattrs.ia_valid = 0;
- ret = umsdos_notify_change_locked(olddentry, &newattrs);
+ ret = umsdos_notify_change_locked(temp, &newattrs);
+ if (ret == 0)
+ mark_inode_dirty(temp->d_inode);
+ dput(temp);
+out_unlock2:
X if (ret == 0)
X mark_inode_dirty(olddentry->d_inode);
X }
diff -u --recursive --new-file v2.4.9/linux/fs/umsdos/rdir.c linux/fs/umsdos/rdir.c
--- v2.4.9/linux/fs/umsdos/rdir.c Fri Feb 9 11:29:44 2001
+++ linux/fs/umsdos/rdir.c Sat Sep 1 10:59:08 2001
@@ -32,7 +32,7 @@
X static int rdir_filldir ( void *buf,
X const char *name,
X int name_len,
- off_t offset,
+ loff_t offset,
X ino_t ino,
X unsigned int d_type)
X {
@@ -111,6 +111,9 @@
X */
X Printk ((KERN_DEBUG "umsdos_rlookup_x: patch_dentry_inode %s/%s\n",
X dentry->d_parent->d_name.name, dentry->d_name.name));
+/* only patch if needed (because we get called even for lookup
+ (not only rlookup) stuff sometimes, like in umsdos_covered() */
+ if (dentry->d_inode->u.umsdos_i.i_patched == 0)
X umsdos_patch_dentry_inode(dentry, 0);
X
X }
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/core_apecs.h linux/include/asm-alpha/core_apecs.h
--- v2.4.9/linux/include/asm-alpha/core_apecs.h Fri Mar 17 13:01:37 2000
+++ linux/include/asm-alpha/core_apecs.h Thu Sep 13 15:21:32 2001
@@ -495,11 +495,18 @@
X *(vulp)addr = b;
X }
X
-__EXTERN_INLINE unsigned long apecs_ioremap(unsigned long addr)
+__EXTERN_INLINE unsigned long apecs_ioremap(unsigned long addr,
+ unsigned long size
+ __attribute__((unused)))
X {
X return addr + APECS_DENSE_MEM;
X }
X
+__EXTERN_INLINE void apecs_iounmap(unsigned addr)
+{
+ return;
+}
+
X __EXTERN_INLINE int apecs_is_ioaddr(unsigned long addr)
X {
X return addr >= IDENT_ADDR + 0x180000000UL;
@@ -525,7 +532,8 @@
X #define __writew(x,a) apecs_writew((x),(unsigned long)(a))
X #define __writel(x,a) apecs_writel((x),(unsigned long)(a))
X #define __writeq(x,a) apecs_writeq((x),(unsigned long)(a))
-#define __ioremap(a) apecs_ioremap((unsigned long)(a))
+#define __ioremap(a,s) apecs_ioremap((unsigned long)(a),(s))
+#define __iounmap(a) apecs_iounmap((unsigned long)(a))
X #define __is_ioaddr(a) apecs_is_ioaddr((unsigned long)(a))
X
X #define __raw_readl(a) __readl(a)
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/core_cia.h linux/include/asm-alpha/core_cia.h
--- v2.4.9/linux/include/asm-alpha/core_cia.h Sun Mar 19 10:26:21 2000
+++ linux/include/asm-alpha/core_cia.h Thu Sep 13 15:21:32 2001
@@ -470,11 +470,18 @@
X *(vulp)addr = b;
X }
X
-__EXTERN_INLINE unsigned long cia_ioremap(unsigned long addr)
+__EXTERN_INLINE unsigned long cia_ioremap(unsigned long addr,
+ unsigned long size
+ __attribute__((unused)))
X {
X return addr + CIA_DENSE_MEM;
X }
X
+__EXTERN_INLINE void cia_iounmap(unsigned long addr)
+{
+ return;
+}
+
X __EXTERN_INLINE unsigned long cia_bwx_readb(unsigned long addr)
X {
X return __kernel_ldbu(*(vucp)addr);
@@ -515,11 +522,17 @@
X *(vulp)addr = b;
X }
X
-__EXTERN_INLINE unsigned long cia_bwx_ioremap(unsigned long addr)
+__EXTERN_INLINE unsigned long cia_bwx_ioremap(unsigned long addr,
+ unsigned long size)
X {
X return addr + CIA_BW_MEM;
X }
X
+__EXTERN_INLINE void cia_bwx_iounmap(unsigned long addr)
+{
+ return;
+}
+
X __EXTERN_INLINE int cia_is_ioaddr(unsigned long addr)
X {
X return addr >= IDENT_ADDR + 0x8000000000UL;
@@ -548,7 +561,8 @@
X # define __writew(x,a) cia_bwx_writew((x),(unsigned long)(a))
X # define __writel(x,a) cia_bwx_writel((x),(unsigned long)(a))
X # define __writeq(x,a) cia_bwx_writeq((x),(unsigned long)(a))
-# define __ioremap(a) cia_bwx_ioremap((unsigned long)(a))
+# define __ioremap(a,s) cia_bwx_ioremap((unsigned long)(a),(s))
+# define __iounmap(a) cia_bwx_iounmap((unsigned long)(a))
X # define inb(p) __inb(p)
X # define inw(p) __inw(p)
X # define inl(p) __inl(p)
@@ -578,7 +592,8 @@
X # define __writew(x,a) cia_writew((x),(unsigned long)(a))
X # define __writel(x,a) cia_writel((x),(unsigned long)(a))
X # define __writeq(x,a) cia_writeq((x),(unsigned long)(a))
-# define __ioremap(a) cia_ioremap((unsigned long)(a))
+# define __ioremap(a,s) cia_ioremap((unsigned long)(a),(s))
+# define __iounmap(a) cia_iounmap((unsigned long)(a))
X # define __raw_readl(a) __readl(a)
X # define __raw_readq(a) __readq(a)
X # define __raw_writel(v,a) __writel((v),(a))
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/core_irongate.h linux/include/asm-alpha/core_irongate.h
--- v2.4.9/linux/include/asm-alpha/core_irongate.h Mon Aug 28 21:21:57 2000
+++ linux/include/asm-alpha/core_irongate.h Thu Sep 13 15:21:32 2001
@@ -267,10 +267,8 @@
X *(vulp)addr = b;
X }
X
-__EXTERN_INLINE unsigned long irongate_ioremap(unsigned long addr)
-{
- return addr + IRONGATE_MEM;
-}
+extern unsigned long irongate_ioremap(unsigned long addr, unsigned long size);
+extern void irongate_iounmap(unsigned long addr);
X
X __EXTERN_INLINE int irongate_is_ioaddr(unsigned long addr)
X {
@@ -298,7 +296,8 @@
X #define __writew(x,a) irongate_writew((x),(unsigned long)(a))
X #define __writel(x,a) irongate_writel((x),(unsigned long)(a))
X #define __writeq(x,a) irongate_writeq((x),(unsigned long)(a))
-#define __ioremap(a) irongate_ioremap((unsigned long)(a))
+#define __ioremap(a,s) irongate_ioremap((unsigned long)(a),(s))
+#define __iounmap(a) irongate_iounmap((unsigned long)(a))
X #define __is_ioaddr(a) irongate_is_ioaddr((unsigned long)(a))
X
X #define inb(p) __inb(p)
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/core_lca.h linux/include/asm-alpha/core_lca.h
--- v2.4.9/linux/include/asm-alpha/core_lca.h Fri Mar 17 13:01:38 2000
+++ linux/include/asm-alpha/core_lca.h Thu Sep 13 15:21:32 2001
@@ -344,11 +344,18 @@
X *(vulp)addr = b;
X }
X
-__EXTERN_INLINE unsigned long lca_ioremap(unsigned long addr)
+__EXTERN_INLINE unsigned long lca_ioremap(unsigned long addr,
+ unsigned long size
+ __attribute__((unused)))
X {
X return addr + LCA_DENSE_MEM;
X }
X
+__EXTERN_INLINE void lca_iounmap(unsigned long addr)
+{
+ return;
+}
+
X __EXTERN_INLINE int lca_is_ioaddr(unsigned long addr)
X {
X return addr >= IDENT_ADDR + 0x120000000UL;
@@ -374,7 +381,8 @@
X #define __writew(x,a) lca_writew((x),(unsigned long)(a))
X #define __writel(x,a) lca_writel((x),(unsigned long)(a))
X #define __writeq(x,a) lca_writeq((x),(unsigned long)(a))
-#define __ioremap(a) lca_ioremap((unsigned long)(a))
+#define __ioremap(a,s) lca_ioremap((unsigned long)(a),(s))
+#define __iounmap(a) lca_iounmap((unsigned long)(a))
X #define __is_ioaddr(a) lca_is_ioaddr((unsigned long)(a))
X
X #define __raw_readl(a) __readl(a)
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/core_mcpcia.h linux/include/asm-alpha/core_mcpcia.h
--- v2.4.9/linux/include/asm-alpha/core_mcpcia.h Fri Mar 17 13:01:38 2000
+++ linux/include/asm-alpha/core_mcpcia.h Thu Sep 13 15:21:32 2001
@@ -326,11 +326,18 @@
X *
X */
X
-__EXTERN_INLINE unsigned long mcpcia_ioremap(unsigned long addr)
+__EXTERN_INLINE unsigned long mcpcia_ioremap(unsigned long addr,
+ unsigned long size
+ __attribute__((unused)))
X {
X return addr + MCPCIA_MEM_BIAS;
X }
X
+__EXTERN_INLINE void mcpcia_iounmap(unsigned long addr)
+{
+ return;
+}
+
X __EXTERN_INLINE int mcpcia_is_ioaddr(unsigned long addr)
X {
X return addr >= MCPCIA_SPARSE(0);
@@ -452,7 +459,8 @@
X #define __writew(x,a) mcpcia_writew((x),(unsigned long)(a))
X #define __writel(x,a) mcpcia_writel((x),(unsigned long)(a))
X #define __writeq(x,a) mcpcia_writeq((x),(unsigned long)(a))
-#define __ioremap(a) mcpcia_ioremap((unsigned long)(a))
+#define __ioremap(a,s) mcpcia_ioremap((unsigned long)(a),(s))
+#define __iounmap(a) mcpcia_iounmap((unsigned long)(a))
X #define __is_ioaddr(a) mcpcia_is_ioaddr((unsigned long)(a))
X
X #define __raw_readl(a) __readl(a)
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/core_polaris.h linux/include/asm-alpha/core_polaris.h
--- v2.4.9/linux/include/asm-alpha/core_polaris.h Fri Mar 17 13:01:38 2000
+++ linux/include/asm-alpha/core_polaris.h Thu Sep 13 15:21:32 2001
@@ -153,11 +153,18 @@
X *(vulp)addr = b;
X }
X
-__EXTERN_INLINE unsigned long polaris_ioremap(unsigned long addr)
+__EXTERN_INLINE unsigned long polaris_ioremap(unsigned long addr,
+ unsigned long size
+ __attribute__((unused)))
X {
X return addr + POLARIS_DENSE_MEM_BASE;
X }
X
+__EXTERN_INLINE void polaris_iounmap(unsigned long addr)
+{
+ return;
+}
+
X __EXTERN_INLINE int polaris_is_ioaddr(unsigned long addr)
X {
X return addr >= POLARIS_SPARSE_MEM_BASE;
@@ -184,7 +191,8 @@
X #define __writew(x,a) polaris_writew((x),(unsigned long)(a))
X #define __writel(x,a) polaris_writel((x),(unsigned long)(a))
X #define __writeq(x,a) polaris_writeq((x),(unsigned long)(a))
-#define __ioremap(a) polaris_ioremap((unsigned long)(a))
+#define __ioremap(a,s) polaris_ioremap((unsigned long)(a),(s))
+#define __iounmap(a) polaris_iounmap((unsigned long)(a))
X #define __is_ioaddr(a) polaris_is_ioaddr((unsigned long)(a))
X
X #define inb(p) __inb(p)
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/core_t2.h linux/include/asm-alpha/core_t2.h
--- v2.4.9/linux/include/asm-alpha/core_t2.h Fri Mar 17 13:01:38 2000
+++ linux/include/asm-alpha/core_t2.h Thu Sep 13 15:21:32 2001
@@ -501,11 +501,18 @@
X *(vuip)(work + (4 << 5)) = b >> 32;
X }
X
-__EXTERN_INLINE unsigned long t2_ioremap(unsigned long addr)
+__EXTERN_INLINE unsigned long t2_ioremap(unsigned long addr,
+ unsigned long size
+ __attribute__((unused)))
X {
X return addr;
X }
X
+__EXTERN_INLINE void t2_iounmap(unsigned long addr)
+{
+ return;
+}
+
X __EXTERN_INLINE int t2_is_ioaddr(unsigned long addr)
X {
X return (long)addr >= 0;
@@ -530,7 +537,8 @@
X #define __writew(x,a) t2_writew((x),(unsigned long)(a))
X #define __writel(x,a) t2_writel((x),(unsigned long)(a))
X #define __writeq(x,a) t2_writeq((x),(unsigned long)(a))
-#define __ioremap(a) t2_ioremap((unsigned long)(a))
+#define __ioremap(a,s) t2_ioremap((unsigned long)(a),(s))
+#define __iounmap(a) t2_iounmap((unsigned long)(a))
X #define __is_ioaddr(a) t2_is_ioaddr((unsigned long)(a))
X
X #endif /* __WANT_IO_DEF */
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/core_titan.h linux/include/asm-alpha/core_titan.h
--- v2.4.9/linux/include/asm-alpha/core_titan.h Mon Jun 19 17:59:33 2000
+++ linux/include/asm-alpha/core_titan.h Thu Sep 13 15:21:32 2001
@@ -423,11 +423,18 @@
X * Memory functions. all accesses are done through linear space.
X */
X
-__EXTERN_INLINE unsigned long titan_ioremap(unsigned long addr)
+__EXTERN_INLINE unsigned long titan_ioremap(unsigned long addr,
+ unsigned long size
+ __attribute__((unused)))
X {
X return addr + TITAN_MEM_BIAS;
X }
X
+__EXTERN_INLINE void titan_iounmap(unsigned long addr)
+{
+ return;
+}
+
X __EXTERN_INLINE int titan_is_ioaddr(unsigned long addr)
X {
X return addr >= TITAN_BASE;
@@ -480,29 +487,30 @@
X
X #ifdef __WANT_IO_DEF
X
-#define __inb titan_inb
-#define __inw titan_inw
-#define __inl titan_inl
-#define __outb titan_outb
-#define __outw titan_outw
-#define __outl titan_outl
-#define __readb titan_readb
-#define __readw titan_readw
-#define __writeb titan_writeb
-#define __writew titan_writew
-#define __readl titan_readl
-#define __readq titan_readq
-#define __writel titan_writel
-#define __writeq titan_writeq
-#define __ioremap titan_ioremap
-#define __is_ioaddr titan_is_ioaddr
-
-#define inb(port) __inb((port))
-#define inw(port) __inw((port))
-#define inl(port) __inl((port))
-#define outb(v, port) __outb((v),(port))
-#define outw(v, port) __outw((v),(port))
-#define outl(v, port) __outl((v),(port))
+#define __inb(p) titan_inb((unsigned long)(p))
+#define __inw(p) titan_inw((unsigned long)(p))
+#define __inl(p) titan_inl((unsigned long)(p))
+#define __outb(x,p) titan_outb((x),(unsigned long)(p))
+#define __outw(x,p) titan_outw((x),(unsigned long)(p))
+#define __outl(x,p) titan_outl((x),(unsigned long)(p))
+#define __readb(a) titan_readb((unsigned long)(a))
+#define __readw(a) titan_readw((unsigned long)(a))
+#define __readl(a) titan_readl((unsigned long)(a))
+#define __readq(a) titan_readq((unsigned long)(a))
+#define __writeb(x,a) titan_writeb((x),(unsigned long)(a))
+#define __writew(x,a) titan_writew((x),(unsigned long)(a))
+#define __writel(x,a) titan_writel((x),(unsigned long)(a))
+#define __writeq(x,a) titan_writeq((x),(unsigned long)(a))
+#define __ioremap(a,s) titan_ioremap((unsigned long)(a),(s))
+#define __iounmap(a) titan_iounmap((unsigned long)(a))
+#define __is_ioaddr(a) titan_is_ioaddr((unsigned long)(a))
+
+#define inb(port) __inb((port))
+#define inw(port) __inw((port))
+#define inl(port) __inl((port))
+#define outb(v, port) __outb((v),(port))
+#define outw(v, port) __outw((v),(port))
+#define outl(v, port) __outl((v),(port))
X
X #define __raw_readb(a) __readb((unsigned long)(a))
X #define __raw_readw(a) __readw((unsigned long)(a))
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/core_tsunami.h linux/include/asm-alpha/core_tsunami.h
--- v2.4.9/linux/include/asm-alpha/core_tsunami.h Thu May 24 15:24:37 2001
+++ linux/include/asm-alpha/core_tsunami.h Thu Sep 13 15:21:32 2001
@@ -352,11 +352,18 @@
X * Memory functions. all accesses are done through linear space.
X */
X
-__EXTERN_INLINE unsigned long tsunami_ioremap(unsigned long addr)
+__EXTERN_INLINE unsigned long tsunami_ioremap(unsigned long addr,
+ unsigned long size
+ __attribute__((unused)))
X {
X return addr + TSUNAMI_MEM_BIAS;
X }
X
+__EXTERN_INLINE void tsunami_iounmap(unsigned long addr)
+{
+ return;
+}
+
X __EXTERN_INLINE int tsunami_is_ioaddr(unsigned long addr)
X {
X return addr >= TSUNAMI_BASE;
@@ -423,7 +430,8 @@
X #define __writew(x,a) tsunami_writew((x),(unsigned long)(a))
X #define __writel(x,a) tsunami_writel((x),(unsigned long)(a))
X #define __writeq(x,a) tsunami_writeq((x),(unsigned long)(a))
-#define __ioremap(a) tsunami_ioremap((unsigned long)(a))
+#define __ioremap(a,s) tsunami_ioremap((unsigned long)(a),(s))
+#define __iounmap(a) tsunami_iounmap((unsigned long)(a))
X #define __is_ioaddr(a) tsunami_is_ioaddr((unsigned long)(a))
X
X #define inb(p) __inb(p)
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/core_wildfire.h linux/include/asm-alpha/core_wildfire.h
--- v2.4.9/linux/include/asm-alpha/core_wildfire.h Mon Jun 19 17:59:33 2000
+++ linux/include/asm-alpha/core_wildfire.h Thu Sep 13 15:21:32 2001
@@ -326,11 +326,18 @@
X * Memory functions. all accesses are done through linear space.
X */
X
-__EXTERN_INLINE unsigned long wildfire_ioremap(unsigned long addr)
+__EXTERN_INLINE unsigned long wildfire_ioremap(unsigned long addr,
+ unsigned long size
+ __attribute__((unused)))
X {
X return addr + WILDFIRE_MEM_BIAS;
X }
X
+__EXTERN_INLINE void wildfire_iounmap(unsigned long addr)
+{
+ return;
+}
+
X __EXTERN_INLINE int wildfire_is_ioaddr(unsigned long addr)
X {
X return addr >= WILDFIRE_BASE;
@@ -397,7 +404,8 @@
X #define __writew(x,a) wildfire_writew((x),(unsigned long)(a))
X #define __writel(x,a) wildfire_writel((x),(unsigned long)(a))
X #define __writeq(x,a) wildfire_writeq((x),(unsigned long)(a))
-#define __ioremap(a) wildfire_ioremap((unsigned long)(a))
+#define __ioremap(a,s) wildfire_ioremap((unsigned long)(a),(s))
+#define __iounmap(a) wildfire_iounmap((unsigned long)(a))
X #define __is_ioaddr(a) wildfire_is_ioaddr((unsigned long)(a))
X
X #define inb(p) __inb(p)
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/fcntl.h linux/include/asm-alpha/fcntl.h
--- v2.4.9/linux/include/asm-alpha/fcntl.h Sun Oct 8 09:04:04 2000
+++ linux/include/asm-alpha/fcntl.h Mon Sep 17 13:16:30 2001
@@ -17,10 +17,10 @@
X #define O_NDELAY O_NONBLOCK
X #define O_SYNC 040000
X #define FASYNC 020000 /* fcntl, for BSD compatibility */
-#define O_DIRECT 040000 /* direct disk access - should check with OSF/1 */
X #define O_DIRECTORY 0100000 /* must be a directory */
X #define O_NOFOLLOW 0200000 /* don't follow links */
X #define O_LARGEFILE 0400000 /* will be set by the kernel on every open */
+#define O_DIRECT 02000000 /* direct disk access - should check with OSF/1 */
X
X #define F_DUPFD 0 /* dup */
X #define F_GETFD 1 /* get close_on_exec */
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/hw_irq.h linux/include/asm-alpha/hw_irq.h
--- v2.4.9/linux/include/asm-alpha/hw_irq.h Mon Feb 28 07:18:20 2000
+++ linux/include/asm-alpha/hw_irq.h Thu Sep 13 15:21:32 2001
@@ -5,6 +5,8 @@
X
X static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
X
+extern volatile unsigned long irq_err_count;
+
X #ifdef CONFIG_ALPHA_GENERIC
X #define ACTUAL_NR_IRQS alpha_mv.nr_irqs
X #else
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/io.h linux/include/asm-alpha/io.h
--- v2.4.9/linux/include/asm-alpha/io.h Fri Apr 13 20:26:07 2001
+++ linux/include/asm-alpha/io.h Thu Sep 13 15:21:32 2001
@@ -127,7 +127,8 @@
X # define __writel(v,a) alpha_mv.mv_writel((v),(unsigned long)(a))
X # define __writeq(v,a) alpha_mv.mv_writeq((v),(unsigned long)(a))
X
-# define __ioremap(a) alpha_mv.mv_ioremap((unsigned long)(a))
+# define __ioremap(a,s) alpha_mv.mv_ioremap((unsigned long)(a),(s))
+# define __iounmap(a) alpha_mv.mv_iounmap((unsigned long)(a))
X # define __is_ioaddr(a) alpha_mv.mv_is_ioaddr((unsigned long)(a))
X
X # define inb __inb
@@ -280,15 +281,24 @@
X * discontinuities are all across busses, so we need not care for that
X * for any one device.
X *
+ * The DRM drivers need to be able to map contiguously a (potentially)
+ * discontiguous set of I/O pages. This set of pages is scatter-gather
+ * mapped contiguously from the perspective of the bus, but we can't
+ * directly access DMA addresses from the CPU, these addresses need to
+ * have a real ioremap. Therefore, iounmap and the size argument to
+ * ioremap are needed to give the platforms the ability to fully implement
+ * ioremap.
+ *
X * Map the I/O space address into the kernel's virtual address space.
X */
X static inline void * ioremap(unsigned long offset, unsigned long size)
X {
- return (void *) __ioremap(offset);
+ return (void *) __ioremap(offset, size);
X }
X
X static inline void iounmap(void *addr)
X {
+ __iounmap(addr);
X }
X
X static inline void * ioremap_nocache(unsigned long offset, unsigned long size)
@@ -444,15 +454,15 @@
X * ISA space is mapped to some machine-specific location on Alpha.
X * Call into the existing hooks to get the address translated.
X */
-#define isa_readb(a) readb(__ioremap(a))
-#define isa_readw(a) readw(__ioremap(a))
-#define isa_readl(a) readl(__ioremap(a))
-#define isa_writeb(b,a) writeb((b),__ioremap(a))
-#define isa_writew(w,a) writew((w),__ioremap(a))
-#define isa_writel(l,a) writel((l),__ioremap(a))
-#define isa_memset_io(a,b,c) memset_io(__ioremap(a),(b),(c))
-#define isa_memcpy_fromio(a,b,c) memcpy_fromio((a),__ioremap(b),(c))
-#define isa_memcpy_toio(a,b,c) memcpy_toio(__ioremap(a),(b),(c))
+#define isa_readb(a) readb(__ioremap((a),1))
+#define isa_readw(a) readw(__ioremap((a),2))
+#define isa_readl(a) readl(__ioremap((a),4))
+#define isa_writeb(b,a) writeb((b),__ioremap((a),1))
+#define isa_writew(w,a) writew((w),__ioremap((a),2))
+#define isa_writel(l,a) writel((l),__ioremap((a),4))
+#define isa_memset_io(a,b,c) memset_io(__ioremap((a),(c)),(b),(c))
+#define isa_memcpy_fromio(a,b,c) memcpy_fromio((a),__ioremap((b),(c)),(c))
+#define isa_memcpy_toio(a,b,c) memcpy_toio(__ioremap((a),(c)),(b),(c))
X
X static inline int
X isa_check_signature(unsigned long io_addr, const unsigned char *signature,
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/jensen.h linux/include/asm-alpha/jensen.h
--- v2.4.9/linux/include/asm-alpha/jensen.h Mon Feb 7 20:09:05 2000
+++ linux/include/asm-alpha/jensen.h Thu Sep 13 15:21:32 2001
@@ -274,11 +274,17 @@
X *(vuip) (addr + (4 << 7)) = b >> 32;
X }
X
-__EXTERN_INLINE unsigned long jensen_ioremap(unsigned long addr)
+__EXTERN_INLINE unsigned long jensen_ioremap(unsigned long addr,
+ unsigned long size)
X {
X return addr;
X }
X
+__EXTERN_INLINE void jensen_iounmap(unsigned long addr)
+{
+ return;
+}
+
X __EXTERN_INLINE int jensen_is_ioaddr(unsigned long addr)
X {
X return (long)addr >= 0;
@@ -303,6 +309,7 @@
X #define __writel jensen_writel
X #define __writeq jensen_writeq
X #define __ioremap jensen_ioremap
+#define __iounmap(a) jensen_iounmap((unsigned long)a)
X #define __is_ioaddr jensen_is_ioaddr
X
X /*
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/keyboard.h linux/include/asm-alpha/keyboard.h
--- v2.4.9/linux/include/asm-alpha/keyboard.h Mon Aug 27 12:41:47 2001
+++ linux/include/asm-alpha/keyboard.h Thu Sep 13 15:21:32 2001
@@ -13,8 +13,13 @@
X
X #ifdef __KERNEL__
X
-#define KEYBOARD_IRQ 1
-#define DISABLE_KBD_DURING_INTERRUPTS 0
+#include <linux/kernel.h>
+#include <linux/ioport.h>
+#include <linux/kd.h>
+#include <asm/io.h>
+
+#define KEYBOARD_IRQ 1
+#define DISABLE_KBD_DURING_INTERRUPTS 0
X
X extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
X extern int pckbd_getkeycode(unsigned int scancode);
@@ -22,7 +27,6 @@
X char raw_mode);
X extern char pckbd_unexpected_up(unsigned char keycode);
X extern void pckbd_leds(unsigned char leds);
-extern int pckbd_rate(struct kbd_repeat *rep);
X extern void pckbd_init_hw(void);
X extern unsigned char pckbd_sysrq_xlate[128];
X
@@ -31,7 +35,6 @@
X #define kbd_translate pckbd_translate
X #define kbd_unexpected_up pckbd_unexpected_up
X #define kbd_leds pckbd_leds
-#define kbd_rate pckbd_rate
X #define kbd_init_hw pckbd_init_hw
X #define kbd_sysrq_xlate pckbd_sysrq_xlate
X
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/machvec.h linux/include/asm-alpha/machvec.h
--- v2.4.9/linux/include/asm-alpha/machvec.h Fri Mar 2 11:12:07 2001
+++ linux/include/asm-alpha/machvec.h Thu Sep 13 15:21:32 2001
@@ -61,7 +61,8 @@
X void (*mv_writel)(unsigned int, unsigned long);
X void (*mv_writeq)(unsigned long, unsigned long);
X
- unsigned long (*mv_ioremap)(unsigned long);
+ unsigned long (*mv_ioremap)(unsigned long, unsigned long);
+ void (*mv_iounmap)(unsigned long);
X int (*mv_is_ioaddr)(unsigned long);
X
X void (*mv_switch_mm)(struct mm_struct *, struct mm_struct *,
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/module.h linux/include/asm-alpha/module.h
--- v2.4.9/linux/include/asm-alpha/module.h Tue Nov 7 10:46:04 2000
+++ linux/include/asm-alpha/module.h Thu Sep 13 15:21:32 2001
@@ -6,6 +6,23 @@
X
X #define module_map(x) vmalloc(x)
X #define module_unmap(x) vfree(x)
-#define module_arch_init(x) (0)
+#define module_arch_init(x) alpha_module_init(x)
+#define arch_init_modules(x) alpha_init_modules(x)
+
+static inline int
+alpha_module_init(struct module *mod)
+{
+ if (!mod_bound(mod->gp - 0x8000, 0, mod)) {
+ printk(KERN_ERR "module_arch_init: mod->gp out of bounds.\n");
+ return 1;
+ }
+ return 0;
+}
+
+static inline void
+alpha_init_modules(struct module *mod)
+{
+ __asm__("stq $29,%0" : "=m" (mod->gp));
+}
X
X #endif /* _ASM_ALPHA_MODULE_H */
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/pgtable.h linux/include/asm-alpha/pgtable.h
--- v2.4.9/linux/include/asm-alpha/pgtable.h Mon Aug 27 12:41:47 2001
+++ linux/include/asm-alpha/pgtable.h Thu Sep 13 15:21:32 2001
@@ -346,7 +346,7 @@
X #endif
X
X #define io_remap_page_range(start, busaddr, size, prot) \
- remap_page_range(start, virt_to_phys(__ioremap(busaddr)), size, prot)
+ remap_page_range(start, virt_to_phys(__ioremap(busaddr, size)), size, prot)
X
X #define pte_ERROR(e) \
X printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e))
@@ -358,5 +358,10 @@
X extern void paging_init(void);
X
X #include <asm-generic/pgtable.h>
+
+/*
+ * No page table caches to initialise
+ */
+#define pgtable_cache_init() do { } while (0)
X
X #endif /* _ALPHA_PGTABLE_H */
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/processor.h linux/include/asm-alpha/processor.h
--- v2.4.9/linux/include/asm-alpha/processor.h Sat Dec 30 09:35:40 2000
+++ linux/include/asm-alpha/processor.h Mon Sep 17 15:30:14 2001
@@ -7,6 +7,8 @@
X #ifndef __ASM_ALPHA_PROCESSOR_H
X #define __ASM_ALPHA_PROCESSOR_H
X
+#include <linux/personality.h> /* for ADDR_LIMIT_32BIT */
+
X /*
X * Returns current instruction pointer ("program counter").
X */
@@ -70,9 +72,6 @@
X int bpt_nsaved;
X };
X
-#define INIT_MMAP { &init_mm, PAGE_OFFSET, PAGE_OFFSET+0x10000000, \
- NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
-
X #define INIT_THREAD { \
X 0, 0, 0, \
X 0, 0, 0, \
@@ -148,5 +147,26 @@
X
X #define init_task (init_task_union.task)
X #define init_stack (init_task_union.stack)
+
+#define ARCH_HAS_PREFETCH
+#define ARCH_HAS_PREFETCHW
+#define ARCH_HAS_SPINLOCK_PREFETCH
+
+extern inline void prefetch(const void *ptr)
+{
+ __asm__ ("ldl $31,%0" : : "m"(*(char *)ptr));
+}
+
+extern inline void prefetchw(const void *ptr)
+{
+ __asm__ ("ldl $31,%0" : : "m"(*(char *)ptr));
+}
+
+extern inline void spin_lock_prefetch(const void *ptr)
+{
+ __asm__ ("ldl $31,%0" : : "m"(*(char *)ptr));
+}
+
+
X
X #endif /* __ASM_ALPHA_PROCESSOR_H */
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/smp.h linux/include/asm-alpha/smp.h
--- v2.4.9/linux/include/asm-alpha/smp.h Thu May 24 15:20:18 2001
+++ linux/include/asm-alpha/smp.h Thu Sep 13 15:21:32 2001
@@ -60,6 +60,12 @@
X extern unsigned long cpu_present_mask;
X #define cpu_online_map cpu_present_mask
X
+extern int smp_call_function_on_cpu(void (*func) (void *info), void *info,int retry, int wait, unsigned long cpu);
+
+#else /* CONFIG_SMP */
+
+#define smp_call_function_on_cpu(func,info,retry,wait,cpu) ({ 0; })
+
X #endif /* CONFIG_SMP */
X
X #define NO_PROC_ID (-1)
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/softirq.h linux/include/asm-alpha/softirq.h
--- v2.4.9/linux/include/asm-alpha/softirq.h Wed Jul 25 17:10:25 2001
+++ linux/include/asm-alpha/softirq.h Sat Sep 8 12:02:31 2001
@@ -32,6 +32,4 @@
X
X #define in_softirq() (local_bh_count(smp_processor_id()) != 0)
X
-#define __cpu_raise_softirq(cpu, nr) set_bit(nr, &softirq_pending(cpu))
-
X #endif /* _ALPHA_SOFTIRQ_H */
diff -u --recursive --new-file v2.4.9/linux/include/asm-alpha/tlb.h linux/include/asm-alpha/tlb.h
--- v2.4.9/linux/include/asm-alpha/tlb.h Wed Dec 31 16:00:00 1969
+++ linux/include/asm-alpha/tlb.h Fri Sep 14 08:41:04 2001
@@ -0,0 +1 @@
+#include <asm-generic/tlb.h>
diff -u --recursive --new-file v2.4.9/linux/include/asm-arm/module.h linux/include/asm-arm/module.h
--- v2.4.9/linux/include/asm-arm/module.h Tue Nov 7 10:46:04 2000
+++ linux/include/asm-arm/module.h Thu Sep 13 16:33:03 2001
@@ -7,5 +7,6 @@
X #define module_map(x) vmalloc(x)
X #define module_unmap(x) vfree(x)
X #define module_arch_init(x) (0)
+#define arch_init_modules(x) do { } while (0)
X
X #endif /* _ASM_ARM_MODULE_H */
diff -u --recursive --new-file v2.4.9/linux/include/asm-arm/processor.h linux/include/asm-arm/processor.h
--- v2.4.9/linux/include/asm-arm/processor.h Mon Aug 27 12:41:47 2001
+++ linux/include/asm-arm/processor.h Mon Sep 17 15:30:14 2001
@@ -68,13 +68,6 @@
X EXTRA_THREAD_STRUCT
X };
X
-#define INIT_MMAP { \
- vm_mm: &init_mm, \
- vm_page_prot: PAGE_SHARED, \
- vm_flags: VM_READ | VM_WRITE | VM_EXEC, \
- vm_avl_height: 1, \
-}
-
X #define INIT_THREAD { \
X refcount: ATOMIC_INIT(1), \
X EXTRA_THREAD_STRUCT_INIT \
diff -u --recursive --new-file v2.4.9/linux/include/asm-arm/softirq.h linux/include/asm-arm/softirq.h
--- v2.4.9/linux/include/asm-arm/softirq.h Mon Aug 27 12:41:47 2001
+++ linux/include/asm-arm/softirq.h Sat Sep 8 12:02:31 2001
@@ -21,6 +21,4 @@
X __asm__("bl%? __do_softirq": : : "lr");/* out of line */\
X } while (0)
X
-#define __cpu_raise_softirq(cpu, nr) __set_bit(nr, &softirq_pending(cpu))
-
X #endif /* __ASM_SOFTIRQ_H */
diff -u --recursive --new-file v2.4.9/linux/include/asm-arm/tlb.h linux/include/asm-arm/tlb.h
--- v2.4.9/linux/include/asm-arm/tlb.h Wed Dec 31 16:00:00 1969
+++ linux/include/asm-arm/tlb.h Fri Sep 14 08:41:04 2001
@@ -0,0 +1 @@
+#include <asm-generic/tlb.h>
diff -u --recursive --new-file v2.4.9/linux/include/asm-cris/module.h linux/include/asm-cris/module.h
--- v2.4.9/linux/include/asm-cris/module.h Thu Feb 8 16:32:44 2001
+++ linux/include/asm-cris/module.h Thu Sep 13 16:33:03 2001
@@ -7,5 +7,6 @@
X #define module_map(x) vmalloc(x)
X #define module_unmap(x) vfree(x)
X #define module_arch_init(x) (0)
+#define arch_init_modules(x) do { } while (0)
X
X #endif /* _ASM_CRIS_MODULE_H */
diff -u --recursive --new-file v2.4.9/linux/include/asm-cris/processor.h linux/include/asm-cris/processor.h
--- v2.4.9/linux/include/asm-cris/processor.h Sun Aug 12 13:28:00 2001
+++ linux/include/asm-cris/processor.h Mon Sep 17 15:30:14 2001
@@ -77,16 +77,6 @@
X
X #define current_regs() user_regs(current)
X
-/* INIT_MMAP is the kernels map of memory, between KSEG_C and KSEG_D */
-
-#ifdef CONFIG_CRIS_LOW_MAP
-#define INIT_MMAP { &init_mm, KSEG_6, KSEG_7, NULL, PAGE_SHARED, \
- VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
-#else
-#define INIT_MMAP { &init_mm, KSEG_C, KSEG_D, NULL, PAGE_SHARED, \
- VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
-#endif
-
X #define INIT_THREAD { \
X 0, 0, 0x20 } /* ccr = int enable, nothing else */
X
diff -u --recursive --new-file v2.4.9/linux/include/asm-cris/softirq.h linux/include/asm-cris/softirq.h
--- v2.4.9/linux/include/asm-cris/softirq.h Sun Aug 12 13:28:00 2001
+++ linux/include/asm-cris/softirq.h Sat Sep 8 12:02:31 2001
@@ -27,6 +27,4 @@
X
X #define in_softirq() (local_bh_count(smp_processor_id()) != 0)
X
-#define __cpu_raise_softirq(cpu,nr) set_bit((nr), &softirq_pending(cpu))
-
X #endif /* __ASM_SOFTIRQ_H */
diff -u --recursive --new-file v2.4.9/linux/include/asm-generic/tlb.h linux/include/asm-generic/tlb.h
--- v2.4.9/linux/include/asm-generic/tlb.h Wed Dec 31 16:00:00 1969
+++ linux/include/asm-generic/tlb.h Fri Sep 14 08:41:04 2001
@@ -0,0 +1,113 @@
+/* asm-generic/tlb.h
+ *
+ * Generic TLB shootdown code
+ *
+ * Copyright 2001 Red Hat, Inc.
+ * Based on code from mm/memory.c Copyright Linus Torvalds and others.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#ifndef _ASM_GENERIC__TLB_H
+#define _ASM_GENERIC__TLB_H
+
+#include <linux/config.h>
+
+#ifdef CONFIG_SMP
+/* aim for something that fits in the L1 cache */
+#define FREE_PTE_NR 508
+
+/* mmu_gather_t is an opaque type used by the mm code for passing around any
+ * data needed by arch specific code for tlb_remove_page. This structure can
+ * be per-CPU or per-MM as the page table lock is held for the duration of TLB
+ * shootdown.
+ */
+typedef struct free_pte_ctx {
+ struct mm_struct *mm;
+ unsigned long nr; /* set to ~0UL means fast mode */
+ unsigned long start_addr, end_addr;
+ pte_t ptes[FREE_PTE_NR];
+} mmu_gather_t;
+
+/* Users of the generic TLB shootdown code must declare this storage space. */
+extern mmu_gather_t mmu_gathers[NR_CPUS];
+
+/* tlb_gather_mmu
+ * Return a pointer to an initialized mmu_gather_t.
+ */
+static inline mmu_gather_t *tlb_gather_mmu(struct mm_struct *mm)
+{
+ mmu_gather_t *tlb = &mmu_gathers[smp_processor_id()];
+
+ tlb->mm = mm;
+ /* Use fast mode if there is only one user of this mm (this process) */
+ tlb->nr = (atomic_read(&(mm)->mm_users) == 1) ? ~0UL : 0UL;
+ return tlb;
+}
+
+/* void tlb_remove_page(mmu_gather_t *tlb, pte_t *ptep, unsigned long addr)
+ * Must perform the equivalent to __free_pte(pte_get_and_clear(ptep)), while
+ * handling the additional races in SMP caused by other CPUs caching valid
+ * mappings in their TLBs.
+ */
+#define tlb_remove_page(ctxp, pte, addr) do {\
+ /* Handle the common case fast, first. */\
+ if ((ctxp)->nr == ~0UL) {\
+ __free_pte(*(pte));\
+ pte_clear((pte));\
+ break;\
+ }\
+ if (!(ctxp)->nr) \
+ (ctxp)->start_addr = (addr);\
+ (ctxp)->ptes[(ctxp)->nr++] = ptep_get_and_clear(pte);\
+ (ctxp)->end_addr = (addr) + PAGE_SIZE;\
+ if ((ctxp)->nr >= FREE_PTE_NR)\
+ tlb_finish_mmu((ctxp), 0, 0);\
+ } while (0)
+
+/* tlb_finish_mmu
+ * Called at the end of the shootdown operation to free up any resources
+ * that were required. The page talbe lock is still held at this point.
+ */
+static inline void tlb_finish_mmu(struct free_pte_ctx *ctx, unsigned long start, unsigned long end)
+{
+ unsigned long i, nr;
+
+ /* Handle the fast case first. */
+ if (ctx->nr == ~0UL) {
+ flush_tlb_range(ctx->mm, start, end);
+ return;
+ }
+ nr = ctx->nr;
+ ctx->nr = 0;
+ if (nr)
+ flush_tlb_range(ctx->mm, ctx->start_addr, ctx->end_addr);
+ for (i=0; i < nr; i++) {
+ pte_t pte = ctx->ptes[i];
+ __free_pte(pte);
+ }
+}
+
+#else
+
+/* The uniprocessor functions are quite simple and are inline macros in an
+ * attempt to get gcc to generate optimal code since this code is run on each
+ * page in a process at exit.
+ */
+typedef struct mm_struct mmu_gather_t;
+
+#define tlb_gather_mmu(mm) (mm)
+#define tlb_finish_mmu(tlb, start, end) flush_tlb_range(tlb, start, end)
+#define tlb_remove_page(tlb, ptep, addr) do {\
+ pte_t __pte = *(ptep);\
+ pte_clear(ptep);\
+ __free_pte(__pte);\
+ } while (0)
+
+#endif
+
+
+#endif /* _ASM_GENERIC__TLB_H */
+
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/apic.h linux/include/asm-i386/apic.h
--- v2.4.9/linux/include/asm-i386/apic.h Sun Aug 12 13:28:00 2001
+++ linux/include/asm-i386/apic.h Sun Sep 23 10:31:02 2001
@@ -2,13 +2,14 @@
X #define __ASM_APIC_H
X
X #include <linux/config.h>
+#include <linux/pm.h>
X #include <asm/apicdef.h>
X #include <asm/system.h>
X
-#define APIC_DEBUG 1
-
X #ifdef CONFIG_X86_LOCAL_APIC
X
+#define APIC_DEBUG 0
+
X #if APIC_DEBUG
X #define Dprintk(x...) printk(x)
X #else
@@ -39,8 +40,6 @@
X do { } while ( apic_read( APIC_ICR ) & APIC_ICR_BUSY );
X }
X
-extern unsigned int apic_timer_irqs [NR_CPUS];
-
X #ifdef CONFIG_X86_GOOD_APIC
X # define FORCE_READ_AROUND_WRITE 0
X # define apic_read_around(x)
@@ -70,11 +69,28 @@
X extern void disable_local_APIC (void);
X extern int verify_local_APIC (void);
X extern void cache_APIC_registers (void);
-extern void sync_Arb_IDs(void);
+extern void sync_Arb_IDs (void);
+extern void init_bsp_APIC (void);
X extern void setup_local_APIC (void);
-extern void init_apic_mappings(void);
-extern void smp_local_timer_interrupt(struct pt_regs * regs);
-extern void setup_APIC_clocks(void);
-#endif
+extern void init_apic_mappings (void);
+extern void smp_local_timer_interrupt (struct pt_regs * regs);
+extern void setup_APIC_clocks (void);
+extern void setup_apic_nmi_watchdog (void);
+extern inline void nmi_watchdog_tick (struct pt_regs * regs);
+extern int APIC_init_uniprocessor (void);
X
-#endif
+extern struct pm_dev *apic_pm_register(pm_dev_t, unsigned long, pm_callback);
+extern void apic_pm_unregister(struct pm_dev*);
+
+extern unsigned int apic_timer_irqs [NR_CPUS];
+extern int check_nmi_watchdog (void);
+
+extern unsigned int nmi_watchdog;
+#define NMI_NONE 0
+#define NMI_IO_APIC 1
+#define NMI_LOCAL_APIC 2
+#define NMI_INVALID 3
+
+#endif /* CONFIG_X86_LOCAL_APIC */
+
+#endif /* __ASM_APIC_H */
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/fcntl.h linux/include/asm-i386/fcntl.h
--- v2.4.9/linux/include/asm-i386/fcntl.h Fri Sep 22 14:21:19 2000
+++ linux/include/asm-i386/fcntl.h Mon Sep 17 13:16:30 2001
@@ -16,7 +16,7 @@
X #define O_NDELAY O_NONBLOCK
X #define O_SYNC 010000
X #define FASYNC 020000 /* fcntl, for BSD compatibility */
-#define O_DIRECT 040000 /* direct disk access hint - currently ignored */
+#define O_DIRECT 040000 /* direct disk access hint */
X #define O_LARGEFILE 0100000
X #define O_DIRECTORY 0200000 /* must be a directory */
X #define O_NOFOLLOW 0400000 /* don't follow links */
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/hw_irq.h linux/include/asm-i386/hw_irq.h
--- v2.4.9/linux/include/asm-i386/hw_irq.h Tue Aug 7 12:48:42 2001
+++ linux/include/asm-i386/hw_irq.h Sun Sep 23 10:31:01 2001
@@ -130,7 +130,7 @@
X __asm__( \
X "\n"__ALIGN_STR"\n" \
X SYMBOL_NAME_STR(x) ":\n\t" \
- "pushl $"#v"\n\t" \
+ "pushl $"#v"-256\n\t" \
X SAVE_ALL \
X SYMBOL_NAME_STR(call_##x)":\n\t" \
X "call "SYMBOL_NAME_STR(smp_##x)"\n\t" \
@@ -143,7 +143,7 @@
X __asm__( \
X "\n"__ALIGN_STR"\n" \
X SYMBOL_NAME_STR(x) ":\n\t" \
- "pushl $"#v"\n\t" \
+ "pushl $"#v"-256\n\t" \
X SAVE_ALL \
X "movl %esp,%eax\n\t" \
SHAR_EOF
true || echo 'restore of patch-2.4.10 failed'
fi
echo 'End of part 173'
echo 'File patch-2.4.10 is continued in part 174'
echo "174" > _shar_seq_.tmp
exit 0
#!/bin/sh -x
# this is part 174 of a 197 - part archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patch-2.4.10 continued
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 174; then
echo "Please unpack part $Scheck next!"
exit 1
else
exit 0
fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping patch-2.4.10'
else
echo 'x - continuing with patch-2.4.10'
sed 's/^X//' << 'SHAR_EOF' >> 'patch-2.4.10' &&
X "pushl %eax\n\t" \
@@ -158,9 +158,9 @@
X "\n" __ALIGN_STR"\n" \
X "common_interrupt:\n\t" \
X SAVE_ALL \
- "pushl $ret_from_intr\n\t" \
X SYMBOL_NAME_STR(call_do_IRQ)":\n\t" \
- "jmp "SYMBOL_NAME_STR(do_IRQ));
+ "call " SYMBOL_NAME_STR(do_IRQ) "\n\t" \
+ "jmp ret_from_intr\n");
X
X /*
X * subtle. orig_eax is used by the signal code to distinct between
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/io.h linux/include/asm-i386/io.h
--- v2.4.9/linux/include/asm-i386/io.h Mon Aug 27 12:41:48 2001
+++ linux/include/asm-i386/io.h Sun Sep 23 10:31:22 2001
@@ -1,6 +1,8 @@
X #ifndef _ASM_IO_H
X #define _ASM_IO_H
X
+#include <linux/config.h>
+
X /*
X * This file contains the definitions for the x86 IO instructions
X * inb/inw/inl/outb/outw/outl and the "string versions" of the same
@@ -111,7 +113,7 @@
X * Temporary debugging check to catch old code using
X * unmapped ISA addresses. Will be removed in 2.4.
X */
-#if 0
+#if CONFIG_DEBUG_IOVIRT
X extern void *__io_virt_debug(unsigned long x, const char *file, int line);
X extern unsigned long __io_phys_debug(unsigned long x, const char *file, int line);
X #define __io_virt(x) __io_virt_debug((unsigned long)(x), __FILE__, __LINE__)
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/io_apic.h linux/include/asm-i386/io_apic.h
--- v2.4.9/linux/include/asm-i386/io_apic.h Tue Aug 7 12:48:42 2001
+++ linux/include/asm-i386/io_apic.h Sun Sep 23 10:31:01 2001
@@ -130,10 +130,8 @@
X (void) *(IO_APIC_BASE(apic)+4);
X }
X
-extern int nmi_watchdog;
X /* 1 if "noapic" boot option passed */
X extern int skip_ioapic_setup;
-extern void IO_APIC_init_uniprocessor (void);
X
X /*
X * If we use the IO-APIC for IRQ routing, disable automatic
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/irq.h linux/include/asm-i386/irq.h
--- v2.4.9/linux/include/asm-i386/irq.h Thu Oct 7 10:17:09 1999
+++ linux/include/asm-i386/irq.h Sun Sep 23 10:31:01 2001
@@ -10,6 +10,8 @@
X * <tom...@informatik.tu-chemnitz.de>
X */
X
+#include <linux/config.h>
+
X #define TIMER_IRQ 0
X
X /*
@@ -31,5 +33,9 @@
X extern void disable_irq(unsigned int);
X extern void disable_irq_nosync(unsigned int);
X extern void enable_irq(unsigned int);
+
+#ifdef CONFIG_X86_LOCAL_APIC
+#define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */
+#endif
X
X #endif /* _ASM_IRQ_H */
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/keyboard.h linux/include/asm-i386/keyboard.h
--- v2.4.9/linux/include/asm-i386/keyboard.h Mon Aug 27 12:41:48 2001
+++ linux/include/asm-i386/keyboard.h Sun Sep 23 10:31:59 2001
@@ -27,7 +27,6 @@
X char raw_mode);
X extern char pckbd_unexpected_up(unsigned char keycode);
X extern void pckbd_leds(unsigned char leds);
-extern int pckbd_rate(struct kbd_repeat *rep);
X extern void pckbd_init_hw(void);
X extern void pckbd_pm_resume(void);
X extern unsigned char pckbd_sysrq_xlate[128];
@@ -37,7 +36,6 @@
X #define kbd_translate pckbd_translate
X #define kbd_unexpected_up pckbd_unexpected_up
X #define kbd_leds pckbd_leds
-#define kbd_rate pckbd_rate
X #define kbd_init_hw pckbd_init_hw
X #define kbd_sysrq_xlate pckbd_sysrq_xlate
X
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/kmap_types.h linux/include/asm-i386/kmap_types.h
--- v2.4.9/linux/include/asm-i386/kmap_types.h Thu Apr 12 12:11:39 2001
+++ linux/include/asm-i386/kmap_types.h Mon Sep 17 13:16:30 2001
@@ -3,9 +3,10 @@
X
X enum km_type {
X KM_BOUNCE_READ,
- KM_BOUNCE_WRITE,
X KM_SKB_DATA,
X KM_SKB_DATA_SOFTIRQ,
+ KM_USER0,
+ KM_USER1,
X KM_TYPE_NR
X };
X
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/module.h linux/include/asm-i386/module.h
--- v2.4.9/linux/include/asm-i386/module.h Tue Nov 7 10:46:04 2000
+++ linux/include/asm-i386/module.h Thu Sep 13 16:33:03 2001
@@ -7,5 +7,6 @@
X #define module_map(x) vmalloc(x)
X #define module_unmap(x) vfree(x)
X #define module_arch_init(x) (0)
+#define arch_init_modules(x) do { } while (0)
X
X #endif /* _ASM_I386_MODULE_H */
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/mpspec.h linux/include/asm-i386/mpspec.h
--- v2.4.9/linux/include/asm-i386/mpspec.h Fri Sep 8 07:37:08 2000
+++ linux/include/asm-i386/mpspec.h Tue Sep 18 11:21:04 2001
@@ -182,6 +182,7 @@
X extern int mp_current_pci_id;
X extern unsigned long mp_lapic_addr;
X extern int pic_mode;
+extern int using_apic_timer;
X
X #endif
X
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/msr.h linux/include/asm-i386/msr.h
--- v2.4.9/linux/include/asm-i386/msr.h Mon Dec 11 13:42:08 2000
+++ linux/include/asm-i386/msr.h Sat Sep 1 11:01:28 2001
@@ -1,3 +1,6 @@
+#ifndef __ASM_MSR_H
+#define __ASM_MSR_H
+
X /*
X * Access to machine-specific registers (available on 586 and better only)
X * Note: the rd* operations modify the parameters directly (without using
@@ -5,9 +8,9 @@
X */
X
X #define rdmsr(msr,val1,val2) \
- __asm__ __volatile__("rdmsr" \
- : "=a" (val1), "=d" (val2) \
- : "c" (msr))
+ __asm__ __volatile__("rdmsr" \
+ : "=a" (val1), "=d" (val2) \
+ : "c" (msr))
X
X #define wrmsr(msr,val1,val2) \
X __asm__ __volatile__("wrmsr" \
@@ -18,10 +21,10 @@
X __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
X
X #define rdtscl(low) \
- __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx")
+ __asm__ __volatile__("rdtsc" : "=a" (low) : : "edx")
X
X #define rdtscll(val) \
- __asm__ __volatile__ ("rdtsc" : "=A" (val))
+ __asm__ __volatile__("rdtsc" : "=A" (val))
X
X #define write_tsc(val1,val2) wrmsr(0x10, val1, val2)
X
@@ -31,6 +34,71 @@
X : "c" (counter))
X
X /* symbolic names for some interesting MSRs */
-#define MSR_IA32_PLATFORM_ID 0x17
-#define MSR_IA32_UCODE_WRITE 0x79
-#define MSR_IA32_UCODE_REV 0x8B
+/* Intel defined MSRs. */
+#define MSR_IA32_P5_MC_ADDR 0
+#define MSR_IA32_P5_MC_TYPE 1
+#define MSR_IA32_PLATFORM_ID 0x17
+#define MSR_IA32_EBL_CR_POWERON 0x2a
+
+#define MSR_IA32_APICBASE 0x1b
+#define MSR_IA32_APICBASE_BSP (1<<8)
+#define MSR_IA32_APICBASE_ENABLE (1<<11)
+#define MSR_IA32_APICBASE_BASE (0xfffff<<12)
+
+#define MSR_IA32_UCODE_WRITE 0x79
+#define MSR_IA32_UCODE_REV 0x8b
+
+#define MSR_IA32_PERFCTR0 0xc1
+#define MSR_IA32_PERFCTR1 0xc2
+
+#define MSR_IA32_BBL_CR_CTL 0x119
+
+#define MSR_IA32_MCG_CAP 0x179
+#define MSR_IA32_MCG_STATUS 0x17a
+#define MSR_IA32_MCG_CTL 0x17b
+
+#define MSR_IA32_EVNTSEL0 0x186
+#define MSR_IA32_EVNTSEL1 0x187
+
+#define MSR_IA32_DEBUGCTLMSR 0x1d9
+#define MSR_IA32_LASTBRANCHFROMIP 0x1db
+#define MSR_IA32_LASTBRANCHTOIP 0x1dc
+#define MSR_IA32_LASTINTFROMIP 0x1dd
+#define MSR_IA32_LASTINTTOIP 0x1de
+
+#define MSR_IA32_MC0_CTL 0x400
+#define MSR_IA32_MC0_STATUS 0x401
+#define MSR_IA32_MC0_ADDR 0x402
+#define MSR_IA32_MC0_MISC 0x403
+
+/* AMD Defined MSRs */
+#define MSR_K6_EFER 0xC0000080
+#define MSR_K6_STAR 0xC0000081
+#define MSR_K6_WHCR 0xC0000082
+#define MSR_K6_UWCCR 0xC0000085
+#define MSR_K6_PSOR 0xC0000087
+#define MSR_K6_PFIR 0xC0000088
+
+#define MSR_K7_EVNTSEL0 0xC0010000
+#define MSR_K7_PERFCTR0 0xC0010004
+
+/* Centaur-Hauls/IDT defined MSRs. */
+#define MSR_IDT_FCR1 0x107
+#define MSR_IDT_FCR2 0x108
+#define MSR_IDT_FCR3 0x109
+#define MSR_IDT_FCR4 0x10a
+
+#define MSR_IDT_MCR0 0x110
+#define MSR_IDT_MCR1 0x111
+#define MSR_IDT_MCR2 0x112
+#define MSR_IDT_MCR3 0x113
+#define MSR_IDT_MCR4 0x114
+#define MSR_IDT_MCR5 0x115
+#define MSR_IDT_MCR6 0x116
+#define MSR_IDT_MCR7 0x117
+#define MSR_IDT_MCR_CTRL 0x120
+
+/* VIA Cyrix defined MSRs*/
+#define MSR_VIA_FCR 0x1107
+
+#endif /* __ASM_MSR_H */
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/page.h linux/include/asm-i386/page.h
--- v2.4.9/linux/include/asm-i386/page.h Mon Aug 27 12:41:48 2001
+++ linux/include/asm-i386/page.h Sun Sep 23 10:31:01 2001
@@ -86,10 +86,16 @@
X * Tell the user there is some problem. Beep too, so we can
X * see^H^H^Hhear bugs in early bootup as well!
X */
-#define BUG() do { \
- printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
- __asm__ __volatile__(".byte 0x0f,0x0b"); \
+
+#ifdef CONFIG_DEBUG_BUGVERBOSE
+extern void do_BUG(const char *file, int line);
+#define BUG() do { \
+ do_BUG(__FILE__, __LINE__); \
+ __asm__ __volatile__("ud2"); \
X } while (0)
+#else
+#define BUG() __asm__ __volatile__(".byte 0x0f,0x0b")
+#endif
X
X #define PAGE_BUG(page) do { \
X BUG(); \
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/pgalloc.h linux/include/asm-i386/pgalloc.h
--- v2.4.9/linux/include/asm-i386/pgalloc.h Sun Aug 12 13:28:00 2001
+++ linux/include/asm-i386/pgalloc.h Sun Sep 23 10:31:02 2001
@@ -128,9 +128,14 @@
X free_page((unsigned long)pte);
X }
X
-#define pte_free(pte) pte_free_slow(pte)
+#define pte_free(pte) pte_free_fast(pte)
+#ifdef CONFIG_X86_PAE
+#define pgd_alloc(mm) get_pgd_slow()
X #define pgd_free(pgd) free_pgd_slow(pgd)
+#else
X #define pgd_alloc(mm) get_pgd_fast()
+#define pgd_free(pgd) free_pgd_fast(pgd)
+#endif
X
X /*
X * allocating and freeing a pmd is trivial: the 1-entry pmd is
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/processor.h linux/include/asm-i386/processor.h
--- v2.4.9/linux/include/asm-i386/processor.h Sun Aug 12 13:28:00 2001
+++ linux/include/asm-i386/processor.h Sun Sep 23 10:31:02 2001
@@ -14,6 +14,7 @@
X #include <asm/types.h>
X #include <asm/sigcontext.h>
X #include <asm/cpufeature.h>
+#include <linux/cache.h>
X #include <linux/config.h>
X #include <linux/threads.h>
X
@@ -52,7 +53,7 @@
X unsigned long *pmd_quick;
X unsigned long *pte_quick;
X unsigned long pgtable_cache_sz;
-};
+} __attribute__((__aligned__(SMP_CACHE_BYTES)));
X
X #define X86_VENDOR_INTEL 0
X #define X86_VENDOR_CYRIX 1
@@ -88,6 +89,7 @@
X #define cpu_has_fxsr (test_bit(X86_FEATURE_FXSR, boot_cpu_data.x86_capability))
X #define cpu_has_xmm (test_bit(X86_FEATURE_XMM, boot_cpu_data.x86_capability))
X #define cpu_has_fpu (test_bit(X86_FEATURE_FPU, boot_cpu_data.x86_capability))
+#define cpu_has_apic (test_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability))
X
X extern char ignore_irq13;
X
@@ -391,9 +393,6 @@
X 0,{~0,} /* io permissions */ \
X }
X
-#define INIT_MMAP \
-{ &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
-
X #define INIT_TSS { \
X 0,0, /* back_link, __blh */ \
X sizeof(init_stack) + (long) &init_stack, /* esp0 */ \
@@ -476,5 +475,33 @@
X {
X __asm__ __volatile__("rep;nop");
X }
+
+/* Prefetch instructions for Pentium III and AMD Athlon */
+#ifdef CONFIG_MPENTIUMIII
+
+#define ARCH_HAS_PREFETCH
+extern inline void prefetch(const void *x)
+{
+ __asm__ __volatile__ ("prefetchnta (%0)" : : "r"(x));
+}
+
+#elif CONFIG_X86_USE_3DNOW
+
+#define ARCH_HAS_PREFETCH
+#define ARCH_HAS_PREFETCHW
+#define ARCH_HAS_SPINLOCK_PREFETCH
+
+extern inline void prefetch(const void *x)
+{
+ __asm__ __volatile__ ("prefetch (%0)" : : "r"(x));
+}
+
+extern inline void prefetchw(const void *x)
+{
+ __asm__ __volatile__ ("prefetchw (%0)" : : "r"(x));
+}
+#define spin_lock_prefetch(x) prefetchw(x)
+
+#endif
X
X #endif /* __ASM_I386_PROCESSOR_H */
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/ptrace.h linux/include/asm-i386/ptrace.h
--- v2.4.9/linux/include/asm-i386/ptrace.h Mon Oct 30 14:46:53 2000
+++ linux/include/asm-i386/ptrace.h Fri Sep 14 14:04:08 2001
@@ -18,7 +18,7 @@
X #define EFL 14
X #define UESP 15
X #define SS 16
-
+#define FRAME_SIZE 17
X
X /* this struct defines the way the registers are stored on the
X stack during a system call. */
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/semaphore.h linux/include/asm-i386/semaphore.h
--- v2.4.9/linux/include/asm-i386/semaphore.h Tue Aug 7 12:48:43 2001
+++ linux/include/asm-i386/semaphore.h Sun Sep 23 10:31:02 2001
@@ -131,6 +131,10 @@
X :"memory");
X }
X
+/*
+ * Interruptible try to acquire a semaphore. If we obtained
+ * it, return zero. If we were interrupted, returns -EINTR
+ */
X static inline int down_interruptible(struct semaphore * sem)
X {
X int result;
@@ -155,6 +159,10 @@
X return result;
X }
X
+/*
+ * Non-blockingly attempt to down() a semaphore.
+ * Returns zero if we acquired it
+ */
X static inline int down_trylock(struct semaphore * sem)
X {
X int result;
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/softirq.h linux/include/asm-i386/softirq.h
--- v2.4.9/linux/include/asm-i386/softirq.h Tue Aug 7 12:48:43 2001
+++ linux/include/asm-i386/softirq.h Sun Sep 23 10:31:02 2001
@@ -45,6 +45,4 @@
X /* no registers clobbered */ ); \
X } while (0)
X
-#define __cpu_raise_softirq(cpu, nr) __set_bit(nr, &softirq_pending(cpu))
-
X #endif /* __ASM_SOFTIRQ_H */
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/spinlock.h linux/include/asm-i386/spinlock.h
--- v2.4.9/linux/include/asm-i386/spinlock.h Tue Aug 7 12:48:42 2001
+++ linux/include/asm-i386/spinlock.h Sun Sep 23 10:31:02 2001
@@ -4,6 +4,7 @@
X #include <asm/atomic.h>
X #include <asm/rwlock.h>
X #include <asm/page.h>
+#include <linux/config.h>
X
X extern int printk(const char * fmt, ...)
X __attribute__ ((format (printf, 1, 2)));
@@ -12,7 +13,11 @@
X * initialize their spinlocks properly, tsk tsk.
X * Remember to turn this off in 2.4. -ben
X */
+#if defined(CONFIG_DEBUG_SPINLOCK)
+#define SPINLOCK_DEBUG 1
+#else
X #define SPINLOCK_DEBUG 0
+#endif
X
X /*
X * Your basic SMP spinlocks, allowing only a single CPU anywhere
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/system.h linux/include/asm-i386/system.h
--- v2.4.9/linux/include/asm-i386/system.h Sun Aug 12 13:28:00 2001
+++ linux/include/asm-i386/system.h Sun Sep 23 10:31:01 2001
@@ -110,9 +110,22 @@
X })
X #define write_cr0(x) \
X __asm__("movl %0,%%cr0": :"r" (x));
+
+#define read_cr4() ({ \
+ unsigned int __dummy; \
+ __asm__( \
+ "movl %%cr4,%0\n\t" \
+ :"=r" (__dummy)); \
+ __dummy; \
+})
+#define write_cr4(x) \
+ __asm__("movl %0,%%cr4": :"r" (x));
X #define stts() write_cr0(8 | read_cr0())
X
X #endif /* __KERNEL__ */
+
+#define wbinvd() \
+ __asm__ __volatile__ ("wbinvd": : :"memory");
X
X static inline unsigned long get_limit(unsigned long segment)
X {
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/timex.h linux/include/asm-i386/timex.h
--- v2.4.9/linux/include/asm-i386/timex.h Tue Aug 7 12:48:42 2001
+++ linux/include/asm-i386/timex.h Sun Sep 23 10:31:01 2001
@@ -45,4 +45,6 @@
X #endif
X }
X
+extern unsigned long cpu_khz;
+
X #endif
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/tlb.h linux/include/asm-i386/tlb.h
--- v2.4.9/linux/include/asm-i386/tlb.h Wed Dec 31 16:00:00 1969
+++ linux/include/asm-i386/tlb.h Fri Sep 14 08:41:04 2001
@@ -0,0 +1 @@
+#include <asm-generic/tlb.h>
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/uaccess.h linux/include/asm-i386/uaccess.h
--- v2.4.9/linux/include/asm-i386/uaccess.h Sun Aug 12 13:28:00 2001
+++ linux/include/asm-i386/uaccess.h Sun Sep 23 10:31:06 2001
@@ -6,6 +6,7 @@
X */
X #include <linux/config.h>
X #include <linux/sched.h>
+#include <linux/prefetch.h>
X #include <asm/page.h>
X
X #define VERIFY_READ 0
@@ -126,6 +127,7 @@
X extern void __put_user_1(void);
X extern void __put_user_2(void);
X extern void __put_user_4(void);
+extern void __put_user_8(void);
X
X extern void __put_user_bad(void);
X
@@ -154,6 +156,23 @@
X __pu_err; \
X })
X
+#define __put_user_u64(x, addr, err) \
+ __asm__ __volatile__( \
+ "1: movl %%eax,0(%2)\n" \
+ "2: movl %%edx,4(%2)\n" \
+ "3:\n" \
+ ".section .fixup,\"ax\"\n" \
+ "4: movl %3,%0\n" \
+ " jmp 3b\n" \
+ ".previous\n" \
+ ".section __ex_table,\"a\"\n" \
+ " .align 4\n" \
+ " .long 1b,4b\n" \
+ " .long 2b,4b\n" \
+ ".previous" \
+ : "=r"(err) \
+ : "A" (x), "r" (addr), "i"(-EFAULT), "0"(err))
+
X #define __put_user_size(x,ptr,size,retval) \
X do { \
X retval = 0; \
@@ -161,6 +180,7 @@
X case 1: __put_user_asm(x,ptr,retval,"b","b","iq"); break; \
X case 2: __put_user_asm(x,ptr,retval,"w","w","ir"); break; \
X case 4: __put_user_asm(x,ptr,retval,"l","","ir"); break; \
+ case 8: __put_user_u64(x,ptr,retval); break; \
X default: __put_user_bad(); \
X } \
X } while (0)
@@ -526,6 +546,7 @@
X static inline unsigned long
X __constant_copy_to_user(void *to, const void *from, unsigned long n)
X {
+ prefetch(from);
X if (access_ok(VERIFY_WRITE, to, n))
X __constant_copy_user(to,from,n);
X return n;
diff -u --recursive --new-file v2.4.9/linux/include/asm-i386/xor.h linux/include/asm-i386/xor.h
--- v2.4.9/linux/include/asm-i386/xor.h Thu Jan 11 18:01:03 2001
+++ linux/include/asm-i386/xor.h Fri Sep 14 14:25:21 2001
@@ -555,19 +555,20 @@
X : "memory")
X
X #define OFFS(x) "16*("#x")"
-#define PF0(x) " prefetcht0 "OFFS(x)"(%1) ;\n"
-#define LD(x,y) " movaps "OFFS(x)"(%1), %%xmm"#y" ;\n"
-#define ST(x,y) " movaps %%xmm"#y", "OFFS(x)"(%1) ;\n"
-#define PF1(x) " prefetchnta "OFFS(x)"(%2) ;\n"
-#define PF2(x) " prefetchnta "OFFS(x)"(%3) ;\n"
-#define PF3(x) " prefetchnta "OFFS(x)"(%4) ;\n"
-#define PF4(x) " prefetchnta "OFFS(x)"(%5) ;\n"
-#define PF5(x) " prefetchnta "OFFS(x)"(%6) ;\n"
-#define XO1(x,y) " xorps "OFFS(x)"(%2), %%xmm"#y" ;\n"
-#define XO2(x,y) " xorps "OFFS(x)"(%3), %%xmm"#y" ;\n"
-#define XO3(x,y) " xorps "OFFS(x)"(%4), %%xmm"#y" ;\n"
-#define XO4(x,y) " xorps "OFFS(x)"(%5), %%xmm"#y" ;\n"
-#define XO5(x,y) " xorps "OFFS(x)"(%6), %%xmm"#y" ;\n"
+#define PF_OFFS(x) "256+16*("#x")"
+#define PF0(x) " prefetchnta "PF_OFFS(x)"(%1) ;\n"
+#define LD(x,y) " movaps "OFFS(x)"(%1), %%xmm"#y" ;\n"
+#define ST(x,y) " movaps %%xmm"#y", "OFFS(x)"(%1) ;\n"
+#define PF1(x) " prefetchnta "PF_OFFS(x)"(%2) ;\n"
+#define PF2(x) " prefetchnta "PF_OFFS(x)"(%3) ;\n"
+#define PF3(x) " prefetchnta "PF_OFFS(x)"(%4) ;\n"
+#define PF4(x) " prefetchnta "PF_OFFS(x)"(%5) ;\n"
+#define PF5(x) " prefetchnta "PF_OFFS(x)"(%6) ;\n"
+#define XO1(x,y) " xorps "OFFS(x)"(%2), %%xmm"#y" ;\n"
+#define XO2(x,y) " xorps "OFFS(x)"(%3), %%xmm"#y" ;\n"
+#define XO3(x,y) " xorps "OFFS(x)"(%4), %%xmm"#y" ;\n"
+#define XO4(x,y) " xorps "OFFS(x)"(%5), %%xmm"#y" ;\n"
+#define XO5(x,y) " xorps "OFFS(x)"(%6), %%xmm"#y" ;\n"
X
X
X static void
diff -u --recursive --new-file v2.4.9/linux/include/asm-ia64/module.h linux/include/asm-ia64/module.h
--- v2.4.9/linux/include/asm-ia64/module.h Thu Apr 12 12:16:36 2001
+++ linux/include/asm-ia64/module.h Thu Sep 13 16:33:03 2001
@@ -14,6 +14,7 @@
X #define module_map(x) vmalloc(x)
X #define module_unmap(x) ia64_module_unmap(x)
X #define module_arch_init(x) ia64_module_init(x)
+#define arch_init_modules(x) do { } while (0)
X
X /*
X * This must match in size and layout the data created by
@@ -46,27 +47,27 @@
X
X if (archdata->unw_table)
X {
- printk(KERN_ERR "arch_init_module: archdata->unw_table must be zero.\n");
+ printk(KERN_ERR "module_arch_init: archdata->unw_table must be zero.\n");
X return 1;
X }
X if (!mod_bound(archdata->gp, 0, mod))
X {
- printk(KERN_ERR "arch_init_module: archdata->gp out of bounds.\n");
+ printk(KERN_ERR "module_arch_init: archdata->gp out of bounds.\n");
X return 1;
X }
X if (!mod_bound(archdata->unw_start, 0, mod))
X {
- printk(KERN_ERR "arch_init_module: archdata->unw_start out of bounds.\n");
+ printk(KERN_ERR "module_arch_init: archdata->unw_start out of bounds.\n");
X return 1;
X }
X if (!mod_bound(archdata->unw_end, 0, mod))
X {
- printk(KERN_ERR "arch_init_module: archdata->unw_end out of bounds.\n");
+ printk(KERN_ERR "module_arch_init: archdata->unw_end out of bounds.\n");
X return 1;
X }
X if (!mod_bound(archdata->segment_base, 0, mod))
X {
- printk(KERN_ERR "arch_init_module: archdata->unw_table out of bounds.\n");
+ printk(KERN_ERR "module_arch_init: archdata->unw_table out of bounds.\n");
X return 1;
X }
X
diff -u --recursive --new-file v2.4.9/linux/include/asm-ia64/processor.h linux/include/asm-ia64/processor.h
--- v2.4.9/linux/include/asm-ia64/processor.h Sun Aug 12 13:28:00 2001
+++ linux/include/asm-ia64/processor.h Mon Sep 17 15:30:14 2001
@@ -364,11 +364,6 @@
X struct ia64_fpreg fph[96]; /* saved/loaded on demand */
X };
X
-#define INIT_MMAP { \
- &init_mm, PAGE_OFFSET, PAGE_OFFSET + 0x10000000, NULL, PAGE_SHARED, \
- VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL \
-}
-
X #define INIT_THREAD { \
X 0, /* ksp */ \
X 0, /* flags */ \
@@ -974,6 +969,25 @@
X return result;
X }
X
+
+#define ARCH_HAS_PREFETCH
+#define ARCH_HAS_PREFETCHW
+#define ARCH_HAS_SPINLOCK_PREFETCH
+#define PREFETCH_STRIDE 256
+
+extern inline void prefetch(const void *x)
+{
+ __asm__ __volatile__ ("lfetch [%0]" : : "r"(x));
+}
+
+extern inline void prefetchw(const void *x)
+{
+ __asm__ __volatile__ ("lfetch.excl [%0]" : : "r"(x));
+}
+
+#define spin_lock_prefetch(x) prefetchw(x)
+
+
X #endif /* !__ASSEMBLY__ */
X
X #endif /* _ASM_IA64_PROCESSOR_H */
diff -u --recursive --new-file v2.4.9/linux/include/asm-ia64/softirq.h linux/include/asm-ia64/softirq.h
--- v2.4.9/linux/include/asm-ia64/softirq.h Sun Aug 12 13:28:00 2001
+++ linux/include/asm-ia64/softirq.h Sat Sep 8 12:02:31 2001
@@ -18,8 +18,6 @@
X } while (0)
X
X
-#define __cpu_raise_softirq(cpu,nr) set_bit((nr), &softirq_pending(cpu))
-
X #define in_softirq() (local_bh_count() != 0)
X
X #endif /* _ASM_IA64_SOFTIRQ_H */
diff -u --recursive --new-file v2.4.9/linux/include/asm-ia64/tlb.h linux/include/asm-ia64/tlb.h
--- v2.4.9/linux/include/asm-ia64/tlb.h Wed Dec 31 16:00:00 1969
+++ linux/include/asm-ia64/tlb.h Fri Sep 14 08:41:04 2001
@@ -0,0 +1 @@
+#include <asm-generic/tlb.h>
diff -u --recursive --new-file v2.4.9/linux/include/asm-m68k/module.h linux/include/asm-m68k/module.h
--- v2.4.9/linux/include/asm-m68k/module.h Tue Nov 7 10:46:04 2000
+++ linux/include/asm-m68k/module.h Thu Sep 13 16:33:03 2001
@@ -7,5 +7,6 @@
X #define module_map(x) vmalloc(x)
X #define module_unmap(x) vfree(x)
X #define module_arch_init(x) (0)
+#define arch_init_modules(x) do { } while (0)
X
X #endif /* _ASM_M68K_MODULE_H */
diff -u --recursive --new-file v2.4.9/linux/include/asm-m68k/processor.h linux/include/asm-m68k/processor.h
--- v2.4.9/linux/include/asm-m68k/processor.h Sat Dec 30 09:35:40 2000
+++ linux/include/asm-m68k/processor.h Mon Sep 17 15:30:14 2001
@@ -78,8 +78,6 @@
X unsigned char fpstate[FPSTATESIZE]; /* floating point state */
X };
X
-#define INIT_MMAP { &init_mm, 0, 0x40000000, NULL, __pgprot(_PAGE_PRESENT|_PAGE_ACCESSED), VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
-
X #define INIT_THREAD { \
X sizeof(init_stack) + (unsigned long) init_stack, 0, \
X PS_S, __KERNEL_DS, \
diff -u --recursive --new-file v2.4.9/linux/include/asm-m68k/tlb.h linux/include/asm-m68k/tlb.h
--- v2.4.9/linux/include/asm-m68k/tlb.h Wed Dec 31 16:00:00 1969
+++ linux/include/asm-m68k/tlb.h Fri Sep 14 08:41:04 2001
@@ -0,0 +1 @@
+#include <asm-generic/tlb.h>
diff -u --recursive --new-file v2.4.9/linux/include/asm-mips/asm.h linux/include/asm-mips/asm.h
--- v2.4.9/linux/include/asm-mips/asm.h Thu Feb 24 22:52:30 2000
+++ linux/include/asm-mips/asm.h Sun Sep 9 10:43:01 2001
@@ -84,11 +84,19 @@
X /*
X * EXPORT - export definition of symbol
X */
-#define EXPORT(symbol) \
+#define EXPORT(symbol) \
X .globl symbol; \
X symbol:
X
X /*
+ * FEXPORT - export definition of a function symbol
+ */
+#define FEXPORT(symbol) \
+ .globl symbol; \
+ .type symbol,@function; \
+symbol:
+
+/*
X * ABS - export absolute symbol
X */
X #define ABS(symbol,value) \
@@ -105,7 +113,7 @@
X TEXT(msg)
X
X /*
- * Print formated string
+ * Print formatted string
X */
X #define PRINT(string) \
X .set push; \
@@ -138,7 +146,8 @@
X * MIPS IV implementations are free to treat this as a nop. The R5000
X * is one of them. So we should have an option not to use this instruction.
X */
-#if (_MIPS_ISA == _MIPS_ISA_MIPS4) || (_MIPS_ISA == _MIPS_ISA_MIPS5)
+#if (_MIPS_ISA == _MIPS_ISA_MIPS4 ) || (_MIPS_ISA == _MIPS_ISA_MIPS5) || \
+ (_MIPS_ISA == _MIPS_ISA_MIPS64)
X #define PREF(hint,addr) \
X pref hint,addr
X #define PREFX(hint,addr) \
@@ -183,22 +192,24 @@
X .set pop; \
X 9:
X #endif /* (_MIPS_ISA == _MIPS_ISA_MIPS2) || (_MIPS_ISA == _MIPS_ISA_MIPS3) */
-#if (_MIPS_ISA == _MIPS_ISA_MIPS4) || (_MIPS_ISA == _MIPS_ISA_MIPS5)
+#if (_MIPS_ISA == _MIPS_ISA_MIPS4 ) || (_MIPS_ISA == _MIPS_ISA_MIPS5) || \
+ (_MIPS_ISA == _MIPS_ISA_MIPS64)
X #define MOVN(rd,rs,rt) \
X movn rd,rs,rt
X #define MOVZ(rd,rs,rt) \
X movz rd,rs,rt
-#endif /* (_MIPS_ISA == _MIPS_ISA_MIPS4) || (_MIPS_ISA == _MIPS_ISA_MIPS5) */
+#endif /* MIPS IV, MIPS V or MIPS64 */
X
X /*
X * Stack alignment
X */
-#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2)
+#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2) || \
+ (_MIPS_ISA == _MIPS_ISA_MIPS32)
X #define ALSZ 7
X #define ALMASK ~7
X #endif
X #if (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4) || \
- (_MIPS_ISA == _MIPS_ISA_MIPS5)
+ (_MIPS_ISA == _MIPS_ISA_MIPS5) || (_MIPS_ISA == _MIPS_ISA_MIPS64)
X #define ALSZ 15
X #define ALMASK ~15
X #endif
@@ -216,14 +227,15 @@
X * Use the following macros in assemblercode to load/store registers,
X * pointers etc.
X */
-#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2)
+#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2) || \
+ (_MIPS_ISA == _MIPS_ISA_MIPS32)
X #define REG_S sw
X #define REG_L lw
X #define PTR_SUBU subu
X #define PTR_ADDU addu
X #endif
X #if (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4) || \
- (_MIPS_ISA == _MIPS_ISA_MIPS5)
+ (_MIPS_ISA == _MIPS_ISA_MIPS5) || (_MIPS_ISA == _MIPS_ISA_MIPS64)
X #define REG_S sd
X #define REG_L ld
X /* We still live in a 32 bit address space ... */
@@ -361,12 +373,13 @@
X /*
X * Some cp0 registers were extended to 64bit for MIPS III.
X */
-#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2)
+#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2) || \
+ (_MIPS_ISA == _MIPS_ISA_MIPS32)
X #define MFC0 mfc0
X #define MTC0 mtc0
X #endif
X #if (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4) || \
- (_MIPS_ISA == _MIPS_ISA_MIPS5)
+ (_MIPS_ISA == _MIPS_ISA_MIPS5) || (_MIPS_ISA == _MIPS_ISA_MIPS64)
X #define MFC0 dmfc0
X #define MTC0 dmtc0
X #endif
diff -u --recursive --new-file v2.4.9/linux/include/asm-mips/atomic.h linux/include/asm-mips/atomic.h
--- v2.4.9/linux/include/asm-mips/atomic.h Wed Jul 25 17:10:25 2001
+++ linux/include/asm-mips/atomic.h Sun Sep 9 10:43:01 2001
@@ -40,7 +40,7 @@
X */
X #define atomic_set(v,i) ((v)->counter = (i))
X
-#if !defined(CONFIG_CPU_HAS_LLSC)
+#ifndef CONFIG_CPU_HAS_LLSC
X
X #include <asm/system.h>
X
diff -u --recursive --new-file v2.4.9/linux/include/asm-mips/au1000.h linux/include/asm-mips/au1000.h
--- v2.4.9/linux/include/asm-mips/au1000.h Wed Dec 31 16:00:00 1969
+++ linux/include/asm-mips/au1000.h Sun Sep 9 10:43:01 2001
@@ -0,0 +1,635 @@
+/*
+ *
+ * BRIEF MODULE DESCRIPTION
+ * Include file for Alchemy Semiconductor's Au1000 CPU.
+ *
+ * Copyright 2000 MontaVista Software Inc.
+ * Author: MontaVista Software, Inc.
+ * ppo...@mvista.com or sou...@mvista.com
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef _AU1000_H_
+#define _AU1000_H_
+
+/* SDRAM Controller */
+#define CS_MODE_0 0x14000000
+#define CS_MODE_1 0x14000004
+#define CS_MODE_2 0x14000008
+
+#define CS_CONFIG_0 0x1400000C
+#define CS_CONFIG_1 0x14000010
+#define CS_CONFIG_2 0x14000014
+
+#define REFRESH_CONFIG 0x14000018
+#define PRECHARGE_CMD 0x1400001C
+#define AUTO_REFRESH_CMD 0x14000020
+
+#define WRITE_EXTERN_0 0x14000024
+#define WRITE_EXTERN_1 0x14000028
+#define WRITE_EXTERN_2 0x1400002C
+
+#define SDRAM_SLEEP 0x14000030
+#define TOGGLE_CKE 0x14000034
+
+/* Static Bus Controller */
+#define STATIC_CONFIG_0 0x14001000
+#define STATIC_TIMING_0 0x14001004
+#define STATIC_ADDRESS_0 0x14001008
+
+#define STATIC_CONFIG_1 0x14001010
+#define STATIC_TIMING_1 0x14001014
+#define STATIC_ADDRESS_1 0x14001018
+
+#define STATIC_CONFIG_2 0x14001020
+#define STATIC_TIMING_2 0x14001024
+#define STATIC_ADDRESS_2 0x14001028
+
+#define STATIC_CONFIG_3 0x14001030
+#define STATIC_TIMING_3 0x14001034
+#define STATIC_ADDRESS_3 0x14001038
+
+/* DMA Controller 0 */
+#define DMA0_MODE_SET 0x14002000
+#define DMA0_MODE_CLEAR 0x14002004
+#define DMA0_PERIPHERAL_ADDR 0x14002008
+#define DMA0_BUFFER0_START 0x1400200C
+#define DMA0_BUFFER0_COUNT 0x14002010
+#define DMA0_BUFFER1_START 0x14002014
+#define DMA0_BUFFER1_COUNT 0x14002018
+
+/* DMA Controller 1 */
+#define DMA1_MODE_SET 0x14002100
+#define DMA1_MODE_CLEAR 0x14002104
+#define DMA1_PERIPHERAL_ADDR 0x14002108
+#define DMA1_BUFFER0_START 0x1400210C
+#define DMA1_BUFFER0_COUNT 0x14002110
+#define DMA1_BUFFER1_START 0x14002114
+#define DMA1_BUFFER1_COUNT 0x14002118
+
+/* DMA Controller 2 */
+#define DMA2_MODE_SET 0x14002200
+#define DMA2_MODE_CLEAR 0x14002204
+#define DMA2_PERIPHERAL_ADDR 0x14002208
+#define DMA2_BUFFER0_START 0x1400220C
+#define DMA2_BUFFER0_COUNT 0x14002210
+#define DMA2_BUFFER1_START 0x14002214
+#define DMA2_BUFFER1_COUNT 0x14002218
+
+/* DMA Controller 3 */
+#define DMA3_MODE_SET 0x14002300
+#define DMA3_MODE_CLEAR 0x14002304
+#define DMA3_PERIPHERAL_ADDR 0x14002308
+#define DMA3_BUFFER0_START 0x1400230C
+#define DMA3_BUFFER0_COUNT 0x14002310
+#define DMA3_BUFFER1_START 0x14002314
+#define DMA3_BUFFER1_COUNT 0x14002318
+
+/* DMA Controller 4 */
+#define DMA4_MODE_SET 0x14002400
+#define DMA4_MODE_CLEAR 0x14002404
+#define DMA4_PERIPHERAL_ADDR 0x14002408
+#define DMA4_BUFFER0_START 0x1400240C
+#define DMA4_BUFFER0_COUNT 0x14002410
+#define DMA4_BUFFER1_START 0x14002414
+#define DMA4_BUFFER1_COUNT 0x14002418
+
+/* DMA Controller 5 */
+#define DMA5_MODE_SET 0x14002500
+#define DMA5_MODE_CLEAR 0x14002504
+#define DMA5_PERIPHERAL_ADDR 0x14002508
+#define DMA5_BUFFER0_START 0x1400250C
+#define DMA5_BUFFER0_COUNT 0x14002510
+#define DMA5_BUFFER1_START 0x14002514
+#define DMA5_BUFFER1_COUNT 0x14002518
+
+/* DMA Controller 6 */
+#define DMA6_MODE_SET 0x14002600
+#define DMA6_MODE_CLEAR 0x14002604
+#define DMA6_PERIPHERAL_ADDR 0x14002608
+#define DMA6_BUFFER0_START 0x1400260C
+#define DMA6_BUFFER0_COUNT 0x14002610
+#define DMA6_BUFFER1_START 0x14002614
+#define DMA6_BUFFER1_COUNT 0x14002618
+
+/* DMA Controller 7 */
+#define DMA7_MODE_SET 0x14002700
+#define DMA7_MODE_CLEAR 0x14002704
+#define DMA7_PERIPHERAL_ADDR 0x14002708
+#define DMA7_BUFFER0_START 0x1400270C
+#define DMA7_BUFFER0_COUNT 0x14002710
+#define DMA7_BUFFER1_START 0x14002714
+#define DMA7_BUFFER1_COUNT 0x14002718
+
+/* Interrupt Controller 0 */
+#define INTC0_CONFIG0_READ 0x10400040
+#define INTC0_CONFIG0_SET 0x10400040
+#define INTC0_CONFIG0_CLEAR 0x10400044
+
+#define INTC0_CONFIG1_READ 0x10400048
+#define INTC0_CONFIG1_SET 0x10400048
+#define INTC0_CONFIG1_CLEAR 0x1040004C
+
+#define INTC0_CONFIG2_READ 0x10400050
+#define INTC0_CONFIG2_SET 0x10400050
+#define INTC0_CONFIG2_CLEAR 0x10400054
+
+#define INTC0_REQ0_INT 0x10400054
+#define INTC0_SOURCE_READ 0x10400058
+#define INTC0_SOURCE_SET 0x10400058
+#define INTC0_SOURCE_CLEAR 0x1040005C
+#define INTC0_REQ1_INT 0x1040005C
+
+#define INTC0_ASSIGN_REQ_READ 0x10400060
+#define INTC0_ASSIGN_REQ_SET 0x10400060
+#define INTC0_ASSIGN_REQ_CLEAR 0x10400064
+
+#define INTC0_WAKEUP_READ 0x10400068
+#define INTC0_WAKEUP_SET 0x10400068
+#define INTC0_WAKEUP_CLEAR 0x1040006C
+
+#define INTC0_MASK_READ 0x10400070
+#define INTC0_MASK_SET 0x10400070
+#define INTC0_MASK_CLEAR 0x10400074
+
+#define INTC0_R_EDGE_DETECT 0x10400078
+#define INTC0_R_EDGE_DETECT_CLEAR 0x10400078
+#define INTC0_F_EDGE_DETECT_CLEAR 0x1040007C
+
+#define INTC0_TEST_BIT 0x10400080
+
+/* Interrupt Controller 1 */
+#define INTC1_CONFIG0_READ 0x11800040
+#define INTC1_CONFIG0_SET 0x11800040
+#define INTC1_CONFIG0_CLEAR 0x11800044
+
+#define INTC1_CONFIG1_READ 0x11800048
+#define INTC1_CONFIG1_SET 0x11800048
+#define INTC1_CONFIG1_CLEAR 0x1180004C
+
+#define INTC1_CONFIG2_READ 0x11800050
+#define INTC1_CONFIG2_SET 0x11800050
+#define INTC1_CONFIG2_CLEAR 0x11800054
+
+#define INTC1_REQ0_INT 0x11800054
+#define INTC1_SOURCE_READ 0x11800058
+#define INTC1_SOURCE_SET 0x11800058
+#define INTC1_SOURCE_CLEAR 0x1180005C
+#define INTC1_REQ1_INT 0x1180005C
+
+#define INTC1_ASSIGN_REQ_READ 0x11800060
+#define INTC1_ASSIGN_REQ_SET 0x11800060
+#define INTC1_ASSIGN_REQ_CLEAR 0x11800064
+
+#define INTC1_WAKEUP_READ 0x11800068
+#define INTC1_WAKEUP_SET 0x11800068
+#define INTC1_WAKEUP_CLEAR 0x1180006C
+
+#define INTC1_MASK_READ 0x11800070
+#define INTC1_MASK_SET 0x11800070
+#define INTC1_MASK_CLEAR 0x11800074
+
+#define INTC1_R_EDGE_DETECT 0x11800078
+#define INTC1_R_EDGE_DETECT_CLEAR 0x11800078
+#define INTC1_F_EDGE_DETECT_CLEAR 0x1180007C
+
+#define INTC1_TEST_BIT 0x11800080
+
+/* Interrupt Configuration Modes */
+#define INTC_INT_DISABLED 0
+#define INTC_INT_RISE_EDGE 0x1
+#define INTC_INT_FALL_EDGE 0x2
+#define INTC_INT_RISE_AND_FALL_EDGE 0x3
+#define INTC_INT_HIGH_LEVEL 0x5
+#define INTC_INT_LOW_LEVEL 0x6
+#define INTC_INT_HIGH_AND_LOW_LEVEL 0x7
+
+/* Interrupt Numbers */
+#define AU1000_UART0_INT 0
+#define AU1000_UART1_INT 1
+#define AU1000_UART2_INT 2
+#define AU1000_UART3_INT 3
+#define AU1000_SSI0_INT 4
+#define AU1000_SSI1_INT 5
+#define AU1000_DMA0_INT 6
+#define AU1000_DMA1_INT 7
+#define AU1000_DMA2_INT 8
+#define AU1000_DMA3_INT 9
+#define AU1000_DMA4_INT 10
+#define AU1000_DMA5_INT 11
+#define AU1000_DMA6_INT 12
+#define AU1000_DMA7_INT 13
+#define AU1000_PC0_INT 14
+#define AU1000_PC0_MATCH0_INT 15
+#define AU1000_PC0_MATCH1_INT 16
+#define AU1000_PC0_MATCH2_INT 17
+#define AU1000_PC1_INT 18
+#define AU1000_PC1_MATCH0_INT 19
+#define AU1000_PC1_MATCH1_INT 20
+#define AU1000_PC1_MATCH2_INT 21
+#define AU1000_IRDA_TX_INT 22
+#define AU1000_IRDA_RX_INT 23
+#define AU1000_USB_DEV_REQ_INT 24
+#define AU1000_USB_DEV_SUS_INT 25
+#define AU1000_USB_HOST_INT 26
+#define AU1000_ACSYNC_INT 27
+#define AU1000_MAC0_DMA_INT 28
+#define AU1000_MAC1_DMA_INT 29
+#define AU1000_ETH0_IRQ AU1000_MAC0_DMA_INT
+#define AU1000_ETH1_IRQ AU1000_MAC1_DMA_INT
+#define AU1000_I2S_UO_INT 30
+#define AU1000_AC97_INT 31
+#define AU1000_LAST_INTC0_INT AU1000_AC97_INT
+#define AU1000_GPIO_0 32
+#define AU1000_GPIO_1 33
+#define AU1000_GPIO_2 34
+#define AU1000_GPIO_3 35
+#define AU1000_GPIO_4 36
+#define AU1000_GPIO_5 37
+#define AU1000_GPIO_6 38
+#define AU1000_GPIO_7 39
+#define AU1000_GPIO_8 40
+#define AU1000_GPIO_9 41
+#define AU1000_GPIO_10 42
+#define AU1000_GPIO_11 43
+#define AU1000_GPIO_12 44
+#define AU1000_GPIO_13 45
+#define AU1000_GPIO_14 46
+#define AU1000_GPIO_15 47
+#define AU1000_GPIO_16 48
+#define AU1000_GPIO_17 49
+#define AU1000_GPIO_18 50
+#define AU1000_GPIO_19 51
+#define AU1000_GPIO_20 52
+#define AU1000_GPIO_21 53
+#define AU1000_GPIO_22 54
+#define AU1000_GPIO_23 55
+#define AU1000_GPIO_24 56
+#define AU1000_GPIO_25 57
+#define AU1000_GPIO_26 58
+#define AU1000_GPIO_27 59
+#define AU1000_GPIO_28 60
+#define AU1000_GPIO_29 61
+#define AU1000_GPIO_30 62
+#define AU1000_GPIO_31 63
+
+/* Programmable Counters 0 and 1 */
+#define PC_BASE 0x11900000
+#define PC_COUNTER_CNTRL (PC_BASE + 0x14)
+ #define PC_CNTRL_E1S (1<<23)
+ #define PC_CNTRL_T1S (1<<20)
+ #define PC_CNTRL_M21 (1<<19)
+ #define PC_CNTRL_M11 (1<<18)
+ #define PC_CNTRL_M01 (1<<17)
+ #define PC_CNTRL_C1S (1<<16)
+ #define PC_CNTRL_BP (1<<14)
+ #define PC_CNTRL_EN1 (1<<13)
+ #define PC_CNTRL_BT1 (1<<12)
+ #define PC_CNTRL_EN0 (1<<11)
+ #define PC_CNTRL_BT0 (1<<10)
+ #define PC_CNTRL_E0 (1<<8)
+ #define PC_CNTRL_E0S (1<<7)
+ #define PC_CNTRL_32S (1<<5)
+ #define PC_CNTRL_T0S (1<<4)
+ #define PC_CNTRL_M20 (1<<3)
+ #define PC_CNTRL_M10 (1<<2)
+ #define PC_CNTRL_M00 (1<<1)
+ #define PC_CNTRL_C0S (1<<0)
+
+/* Programmable Counter 0 Registers */
+#define PC0_TRIM (PC_BASE + 0)
+#define PC0_COUNTER_WRITE (PC_BASE + 4)
+#define PC0_MATCH0 (PC_BASE + 8)
+#define PC0_MATCH1 (PC_BASE + 0xC)
+#define PC0_MATCH2 (PC_BASE + 0x10)
+#define PC0_COUNTER_READ (PC_BASE + 0x40)
+
+/* Programmable Counter 1 Registers */
+#define PC1_TRIM (PC_BASE + 0x44)
+#define PC1_COUNTER_WRITE (PC_BASE + 0x48)
+#define PC1_MATCH0 (PC_BASE + 0x4C)
+#define PC1_MATCH1 (PC_BASE + 0x50)
+#define PC1_MATCH2 (PC_BASE + 0x54)
+#define PC1_COUNTER_READ (PC_BASE + 0x58)
+
+
+/* I2S Controller */
+#define I2S_DATA 0x11000000
+#define I2S_CONFIG_STATUS 0x11000001
+#define I2S_CONTROL 0x11000002
+
+/* Ethernet Controllers */
+#define AU1000_ETH0_BASE 0x10500000
+#define AU1000_ETH1_BASE 0x10510000
+
+/* 4 byte offsets from AU1000_ETH_BASE */
+#define MAC_CONTROL 0x0
+ #define MAC_RX_ENABLE (1<<2)
+ #define MAC_TX_ENABLE (1<<3)
+ #define MAC_DEF_CHECK (1<<5)
+ #define MAC_SET_BL(X) (((X)&0x3)<<6)
+ #define MAC_AUTO_PAD (1<<8)
+ #define MAC_DISABLE_RETRY (1<<10)
+ #define MAC_DISABLE_BCAST (1<<11)
+ #define MAC_LATE_COL (1<<12)
+ #define MAC_HASH_MODE (1<<13)
+ #define MAC_HASH_ONLY (1<<15)
+ #define MAC_PASS_ALL (1<<16)
+ #define MAC_INVERSE_FILTER (1<<17)
+ #define MAC_PROMISCUOUS (1<<18)
+ #define MAC_PASS_ALL_MULTI (1<<19)
+ #define MAC_FULL_DUPLEX (1<<20)
+ #define MAC_NORMAL_MODE 0
+ #define MAC_INT_LOOPBACK (1<<21)
+ #define MAC_EXT_LOOPBACK (1<<22)
+ #define MAC_DISABLE_RX_OWN (1<<23)
+ #define MAC_BIG_ENDIAN (1<<30)
+ #define MAC_RX_ALL (1<<31)
+#define MAC_ADDRESS_HIGH 0x4
+#define MAC_ADDRESS_LOW 0x8
+#define MAC_MCAST_HIGH 0xC
+#define MAC_MCAST_LOW 0x10
+#define MAC_MII_CNTRL 0x14
+ #define MAC_MII_BUSY (1<<0)
+ #define MAC_MII_READ 0
+ #define MAC_MII_WRITE (1<<1)
+ #define MAC_SET_MII_SELECT_REG(X) (((X)&0x1f)<<6)
+ #define MAC_SET_MII_SELECT_PHY(X) (((X)&0x1f)<<11)
+#define MAC_MII_DATA 0x18
+#define MAC_FLOW_CNTRL 0x1C
+ #define MAC_FLOW_CNTRL_BUSY (1<<0)
+ #define MAC_FLOW_CNTRL_ENABLE (1<<1)
+ #define MAC_PASS_CONTROL (1<<2)
+ #define MAC_SET_PAUSE(X) (((X)&0xffff)<<16)
+#define MAC_VLAN1_TAG 0x20
+#define MAC_VLAN2_TAG 0x24
+
+/* Ethernet Controller Enable */
+#define MAC0_ENABLE 0x10520000
+#define MAC1_ENABLE 0x10520004
+ #define MAC_EN_CLOCK_ENABLE (1<<0)
+ #define MAC_EN_RESET0 (1<<1)
+ #define MAC_EN_TOSS (1<<2)
+ #define MAC_EN_CACHEABLE (1<<3)
+ #define MAC_EN_RESET1 (1<<4)
+ #define MAC_EN_RESET2 (1<<5)
+ #define MAC_DMA_RESET (1<<6)
+
+/* Ethernet Controller DMA Channels */
+
+#define MAC0_TX_DMA_ADDR 0x14004000
+#define MAC1_TX_DMA_ADDR 0x14004200
+/* offsets from MAC_TX_RING_ADDR address */
+#define MAC_TX_BUFF0_STATUS 0x0
+ #define TX_FRAME_ABORTED (1<<0)
+ #define TX_JAB_TIMEOUT (1<<1)
+ #define TX_NO_CARRIER (1<<2)
+ #define TX_LOSS_CARRIER (1<<3)
+ #define TX_EXC_DEF (1<<4)
+ #define TX_LATE_COLL_ABORT (1<<5)
+ #define TX_EXC_COLL (1<<6)
+ #define TX_UNDERRUN (1<<7)
+ #define TX_DEFERRED (1<<8)
+ #define TX_LATE_COLL (1<<9)
+ #define TX_COLL_CNT_MASK (0xF<<10)
+ #define TX_PKT_RETRY (1<<31)
+#define MAC_TX_BUFF0_ADDR 0x4
+ #define TX_DMA_ENABLE (1<<0)
+ #define TX_T_DONE (1<<1)
+ #define TX_GET_DMA_BUFFER(X) (((X)>>2)&0x3)
+#define MAC_TX_BUFF0_LEN 0x8
+#define MAC_TX_BUFF1_STATUS 0x10
+#define MAC_TX_BUFF1_ADDR 0x14
+#define MAC_TX_BUFF1_LEN 0x18
+#define MAC_TX_BUFF2_STATUS 0x20
+#define MAC_TX_BUFF2_ADDR 0x24
+#define MAC_TX_BUFF2_LEN 0x28
+#define MAC_TX_BUFF3_STATUS 0x30
+#define MAC_TX_BUFF3_ADDR 0x34
+#define MAC_TX_BUFF3_LEN 0x38
+
+#define MAC0_RX_DMA_ADDR 0x14004100
+#define MAC1_RX_DMA_ADDR 0x14004300
+/* offsets from MAC_RX_RING_ADDR */
+#define MAC_RX_BUFF0_STATUS 0x0
+ #define RX_FRAME_LEN_MASK 0x3fff
+ #define RX_WDOG_TIMER (1<<14)
+ #define RX_RUNT (1<<15)
+ #define RX_OVERLEN (1<<16)
+ #define RX_COLL (1<<17)
+ #define RX_ETHER (1<<18)
+ #define RX_MII_ERROR (1<<19)
+ #define RX_DRIBBLING (1<<20)
+ #define RX_CRC_ERROR (1<<21)
+ #define RX_VLAN1 (1<<22)
+ #define RX_VLAN2 (1<<23)
+ #define RX_LEN_ERROR (1<<24)
+ #define RX_CNTRL_FRAME (1<<25)
+ #define RX_U_CNTRL_FRAME (1<<26)
+ #define RX_MCAST_FRAME (1<<27)
+ #define RX_BCAST_FRAME (1<<28)
+ #define RX_FILTER_FAIL (1<<29)
+ #define RX_PACKET_FILTER (1<<30)
+ #define RX_MISSED_FRAME (1<<31)
+
+ #define RX_ERROR (RX_WDOG_TIMER | RX_RUNT | RX_OVERLEN | \
+ RX_COLL | RX_MII_ERROR | RX_CRC_ERROR | \
+ RX_LEN_ERROR | RX_U_CNTRL_FRAME | RX_MISSED_FRAME)
+#define MAC_RX_BUFF0_ADDR 0x4
+ #define RX_DMA_ENABLE (1<<0)
+ #define RX_T_DONE (1<<1)
+ #define RX_GET_DMA_BUFFER(X) (((X)>>2)&0x3)
+ #define RX_SET_BUFF_ADDR(X) ((X)&0xffffffc0)
+#define MAC_RX_BUFF1_STATUS 0x10
+#define MAC_RX_BUFF1_ADDR 0x14
+#define MAC_RX_BUFF2_STATUS 0x20
+#define MAC_RX_BUFF2_ADDR 0x24
+#define MAC_RX_BUFF3_STATUS 0x30
+#define MAC_RX_BUFF3_ADDR 0x34
+
+
+/* UARTS 0-3 */
+#define UART0_ADDR 0x11100000
+#define UART1_ADDR 0x11200000
+#define UART2_ADDR 0x11300000
+#define UART3_ADDR 0x11400000
+
+#define UART_RX 0 /* Receive buffer */
+#define UART_TX 4 /* Transmit buffer */
+#define UART_IER 8 /* Interrupt Enable Register */
+#define UART_IIR 0xC /* Interrupt ID Register */
+#define UART_FCR 0x10 /* FIFO Control Register */
+#define UART_LCR 0x14 /* Line Control Register */
+#define UART_MCR 0x18 /* Modem Control Register */
+#define UART_LSR 0x1C /* Line Status Register */
+#define UART_MSR 0x20 /* Modem Status Register */
+#define UART_CLK 0x28 /* Baud Rat4e Clock Divider */
+#define UART_MOD_CNTRL 0x100 /* Module Control */
+
+#define UART_FCR_ENABLE_FIFO 0x01 /* Enable the FIFO */
+#define UART_FCR_CLEAR_RCVR 0x02 /* Clear the RCVR FIFO */
+#define UART_FCR_CLEAR_XMIT 0x04 /* Clear the XMIT FIFO */
+#define UART_FCR_DMA_SELECT 0x08 /* For DMA applications */
+#define UART_FCR_TRIGGER_MASK 0xF0 /* Mask for the FIFO trigger range */
+#define UART_FCR_R_TRIGGER_1 0x00 /* Mask for receive trigger set at 1 */
+#define UART_FCR_R_TRIGGER_4 0x40 /* Mask for receive trigger set at 4 */
+#define UART_FCR_R_TRIGGER_8 0x80 /* Mask for receive trigger set at 8 */
+#define UART_FCR_R_TRIGGER_14 0xA0 /* Mask for receive trigger set at 14 */
+#define UART_FCR_T_TRIGGER_0 0x00 /* Mask for transmit trigger set at 0 */
+#define UART_FCR_T_TRIGGER_4 0x10 /* Mask for transmit trigger set at 4 */
+#define UART_FCR_T_TRIGGER_8 0x20 /* Mask for transmit trigger set at 8 */
+#define UART_FCR_T_TRIGGER_12 0x30 /* Mask for transmit trigger set at 12 */
+
+/*
+ * These are the definitions for the Line Control Register
+ */
+#define UART_LCR_SBC 0x40 /* Set break control */
+#define UART_LCR_SPAR 0x20 /* Stick parity (?) */
+#define UART_LCR_EPAR 0x10 /* Even parity select */
+#define UART_LCR_PARITY 0x08 /* Parity Enable */
+#define UART_LCR_STOP 0x04 /* Stop bits: 0=1 stop bit, 1= 2 stop bits */
+#define UART_LCR_WLEN5 0x00 /* Wordlength: 5 bits */
+#define UART_LCR_WLEN6 0x01 /* Wordlength: 6 bits */
+#define UART_LCR_WLEN7 0x02 /* Wordlength: 7 bits */
+#define UART_LCR_WLEN8 0x03 /* Wordlength: 8 bits */
+
+/*
+ * These are the definitions for the Line Status Register
+ */
+#define UART_LSR_TEMT 0x40 /* Transmitter empty */
+#define UART_LSR_THRE 0x20 /* Transmit-hold-register empty */
+#define UART_LSR_BI 0x10 /* Break interrupt indicator */
+#define UART_LSR_FE 0x08 /* Frame error indicator */
+#define UART_LSR_PE 0x04 /* Parity error indicator */
+#define UART_LSR_OE 0x02 /* Overrun error indicator */
+#define UART_LSR_DR 0x01 /* Receiver data ready */
+
+/*
+ * These are the definitions for the Interrupt Identification Register
+ */
+#define UART_IIR_NO_INT 0x01 /* No interrupts pending */
+#define UART_IIR_ID 0x06 /* Mask for the interrupt ID */
+#define UART_IIR_MSI 0x00 /* Modem status interrupt */
+#define UART_IIR_THRI 0x02 /* Transmitter holding register empty */
+#define UART_IIR_RDI 0x04 /* Receiver data interrupt */
+#define UART_IIR_RLSI 0x06 /* Receiver line status interrupt */
+
+/*
+ * These are the definitions for the Interrupt Enable Register
+ */
+#define UART_IER_MSI 0x08 /* Enable Modem status interrupt */
+#define UART_IER_RLSI 0x04 /* Enable receiver line status interrupt */
+#define UART_IER_THRI 0x02 /* Enable Transmitter holding register int. */
+#define UART_IER_RDI 0x01 /* Enable receiver data interrupt */
+
+/*
+ * These are the definitions for the Modem Control Register
+ */
+#define UART_MCR_LOOP 0x10 /* Enable loopback test mode */
+#define UART_MCR_OUT2 0x08 /* Out2 complement */
+#define UART_MCR_OUT1 0x04 /* Out1 complement */
+#define UART_MCR_RTS 0x02 /* RTS complement */
+#define UART_MCR_DTR 0x01 /* DTR complement */
+
+/*
+ * These are the definitions for the Modem Status Register
+ */
+#define UART_MSR_DCD 0x80 /* Data Carrier Detect */
+#define UART_MSR_RI 0x40 /* Ring Indicator */
+#define UART_MSR_DSR 0x20 /* Data Set Ready */
+#define UART_MSR_CTS 0x10 /* Clear to Send */
+#define UART_MSR_DDCD 0x08 /* Delta DCD */
+#define UART_MSR_TERI 0x04 /* Trailing edge ring indicator */
+#define UART_MSR_DDSR 0x02 /* Delta DSR */
+#define UART_MSR_DCTS 0x01 /* Delta CTS */
+#define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */
+
+
+
+/* SSIO */
+#define SSI0_STATUS 0x11600000
+#define SSI0_INT 0x11600004
+#define SSI0_INT_ENABLE 0x11600008
+#define SSI0_CONFIG 0x11600020
+#define SSI0_ADATA 0x11600024
+#define SSI0_CLKDIV 0x11600028
+#define SSI0_CONTROL 0x11600100
+
+/* SSI1 */
+#define SSI1_STATUS 0x11680000
+#define SSI1_INT 0x11680004
+#define SSI1_INT_ENABLE 0x11680008
+#define SSI1_CONFIG 0x11680020
+#define SSI1_ADATA 0x11680024
+#define SSI1_CLKDIV 0x11680028
+#define SSI1_CONTROL 0x11680100
+
+/* IrDA Controller */
+#define IR_RING_PTR_STATUS 0x11500000
+#define IR_RING_BASE_ADDR_H 0x11500004
+#define IR_RING_BASE_ADDR_L 0x11500008
+#define IR_RING_SIZE 0x1150000C
+#define IR_RING_PROMPT 0x11500010
+#define IR_RING_ADDR_CMPR 0x11500014
+#define IR_CONFIG_1 0x11500020
+#define IR_SIR_FLAGS 0x11500024
+#define IR_ENABLE 0x11500028
+#define IR_READ_PHY_CONFIG 0x1150002C
+#define IR_WRITE_PHY_CONFIG 0x11500030
+#define IR_MAX_PKT_LEN 0x11500034
+#define IR_RX_BYTE_CNT 0x11500038
+#define IR_CONFIG_2 0x1150003C
+#define IR_INTERFACE_CONFIG 0x11500040
+
+/* GPIO */
+#define TSTATE_STATE_READ 0x11900100
+#define TSTATE_STATE_SET 0x11900100
+#define OUTPUT_STATE_READ 0x11900108
+#define OUTPUT_STATE_SET 0x11900108
+#define OUTPUT_STATE_CLEAR 0x1190010C
+#define PIN_STATE 0x11900110
+
+/* Power Management */
+#define PM_SCRATCH_0 0x11900018
+#define PM_SCRATCH_1 0x1190001C
+#define PM_WAKEUP_SOURCE_MASK 0x11900034
+#define PM_ENDIANESS 0x11900038
+#define PM_POWERUP_CONTROL 0x1190003C
+#define PM_WAKEUP_CAUSE 0x1190005C
+#define PM_SLEEP_POWER 0x11900078
+#define PM_SLEEP 0x1190007C
+
+/* Clock Controller */
+#define FQ_CNTRL_1 0x11900020
+#define FQ_CNTRL_2 0x11900024
+#define CLOCK_SOURCE_CNTRL 0x11900028
+#define CPU_PLL_CNTRL 0x11900060
+#define AUX_PLL_CNTRL 0x11900064
+
+/* AC97 Controller */
+#define AC97_CONFIG 0x10000000
+#define AC97_STATUS 0x10000004
+#define AC97_DATA 0x10000008
+#define AC97_CMD 0x1000000C
+#define AC97_CNTRL 0x10000010
+
+#endif
diff -u --recursive --new-file v2.4.9/linux/include/asm-mips/bitops.h linux/include/asm-mips/bitops.h
--- v2.4.9/linux/include/asm-mips/bitops.h Tue Jul 3 17:08:21 2001
+++ linux/include/asm-mips/bitops.h Sun Sep 9 10:43:01 2001
@@ -41,7 +41,7 @@
X #define __bi_restore_flags(x)
X #endif /* __KERNEL__ */
X
-#if defined(CONFIG_CPU_HAS_LLSC)
+#ifdef CONFIG_CPU_HAS_LLSC
X
X #include <asm/mipsregs.h>
X
@@ -596,8 +596,9 @@
X "blez\t$1,2f\n\t"
X "lw\t$1,(%5)\n\t"
X "addiu\t%5,4\n\t"
-#if (_MIPS_ISA == _MIPS_ISA_MIPS2) || (_MIPS_ISA == _MIPS_ISA_MIPS3) || \
- (_MIPS_ISA == _MIPS_ISA_MIPS4) || (_MIPS_ISA == _MIPS_ISA_MIPS5)
+#if (_MIPS_ISA == _MIPS_ISA_MIPS2 ) || (_MIPS_ISA == _MIPS_ISA_MIPS3 ) || \
+ (_MIPS_ISA == _MIPS_ISA_MIPS4 ) || (_MIPS_ISA == _MIPS_ISA_MIPS5 ) || \
+ (_MIPS_ISA == _MIPS_ISA_MIPS32) || (_MIPS_ISA == _MIPS_ISA_MIPS64)
X "beql\t%1,$1,1b\n\t"
X "addiu\t%0,32\n\t"
X #else
@@ -795,11 +796,12 @@
X /* Now for the ext2 filesystem bit operations and helper routines. */
X
X #ifdef __MIPSEB__
-extern __inline__ int ext2_set_bit(int nr,void * addr)
+extern __inline__ int ext2_set_bit(int nr, void * addr)
X {
X int mask, retval, flags;
X unsigned char *ADDR = (unsigned char *) addr;
X
+ ADDR += nr >> 3;
X mask = 1 << (nr & 0x07);
X save_and_cli(flags);
X retval = (mask & *ADDR) != 0;
diff -u --recursive --new-file v2.4.9/linux/include/asm-mips/bootinfo.h linux/include/asm-mips/bootinfo.h
--- v2.4.9/linux/include/asm-mips/bootinfo.h Tue Jul 3 17:08:21 2001
+++ linux/include/asm-mips/bootinfo.h Sun Sep 9 10:43:01 2001
@@ -235,9 +235,11 @@
X #define CPU_TX3922 35
X #define CPU_TX3927 36
X #define CPU_AU1000 37
-#define CPU_4KEC 37
-#define CPU_4KSC 38
-#define CPU_LAST 39
+#define CPU_4KEC 38
+#define CPU_4KSC 39
+#define CPU_VR41XX 40
+#define CPU_LAST 40
+
X
X #define CPU_NAMES { "unknown", "R2000", "R3000", "R3000A", "R3041", "R3051", \
X "R3052", "R3081", "R3081E", "R4000PC", "R4000SC", "R4000MC", \
@@ -245,7 +247,7 @@
X "R6000A", "R8000", "R10000", "R4300", "R4650", "R4700", "R5000", \
X "R5000A", "R4640", "Nevada", "RM7000", "R5432", "MIPS 4Kc", \
X "MIPS 5Kc", "R4310", "SiByte SB1", "TX3912", "TX3922", "TX3927", \
- "Au1000", "MIPS 4KEc", "MIPS 4KSc" }
+ "Au1000", "MIPS 4KEc", "MIPS 4KSc", "NEC Vr41xx" }
X
X #define COMMAND_LINE_SIZE 256
X
diff -u --recursive --new-file v2.4.9/linux/include/asm-mips/cachectl.h linux/include/asm-mips/cachectl.h
--- v2.4.9/linux/include/asm-mips/cachectl.h Thu Jun 26 12:33:39 1997
+++ linux/include/asm-mips/cachectl.h Sun Sep 9 10:43:01 2001
@@ -16,7 +16,7 @@
X /*
X * Caching modes for the cachectl(2) call
X *
- * cachctl(2) is currently not supported and returns ENOSYS.
+ * cachectl(2) is currently not supported and returns ENOSYS.
X */
X #define CACHEABLE 0 /* make pages cacheable */
X #define UNCACHEABLE 1 /* make pages uncacheable */
diff -u --recursive --new-file v2.4.9/linux/include/asm-mips/cpu.h linux/include/asm-mips/cpu.h
--- v2.4.9/linux/include/asm-mips/cpu.h Tue Jul 3 17:08:21 2001
+++ linux/include/asm-mips/cpu.h Sun Sep 9 10:43:01 2001
@@ -8,6 +8,7 @@
X #define _ASM_CPU_H
X
X #include <asm/cache.h>
+
X /* Assigned Company values for bits 23:16 of the PRId Register
X (CP0 register 15, select 0). As of the MIPS32 and MIPS64 specs from
X MTI, the PRId register is defined in this (backwards compatible)
@@ -44,6 +45,7 @@
X #define PRID_IMP_R6000A 0x0600
X #define PRID_IMP_R10000 0x0900
X #define PRID_IMP_R4300 0x0b00
+#define PRID_IMP_VR41XX 0x0c00
X #define PRID_IMP_R12000 0x0e00
X #define PRID_IMP_R8000 0x1000
X #define PRID_IMP_R4600 0x2000
@@ -52,11 +54,11 @@
X #define PRID_IMP_R4640 0x2200
X #define PRID_IMP_R4650 0x2200 /* Same as R4640 */
X #define PRID_IMP_R5000 0x2300
-#define PRID_IMP_R5432 0x5400
X #define PRID_IMP_SONIC 0x2400
X #define PRID_IMP_MAGIC 0x2500
X #define PRID_IMP_RM7000 0x2700
X #define PRID_IMP_NEVADA 0x2800 /* RM5260 ??? */
+#define PRID_IMP_R5432 0x5400
X #define PRID_IMP_4KC 0x8000
X #define PRID_IMP_5KC 0x8100
X #define PRID_IMP_4KEC 0x8400
@@ -122,7 +124,7 @@
X #define MIPS_CPU_4KTLB 0x00000008 /* "R4K" TLB handler */
X #define MIPS_CPU_FPU 0x00000010 /* CPU has FPU */
X #define MIPS_CPU_32FPR 0x00000020 /* 32 dbl. prec. FP registers */
-#define MIPS_CPU_COUNTER 0x00000040 /* Cycle count/compare */
+#define MIPS_CPU_COUNTER 0x00000040 /* Cycle count/compare */
X #define MIPS_CPU_WATCH 0x00000080 /* watchpoint registers */
X #define MIPS_CPU_MIPS16 0x00000100 /* code compression */
X #define MIPS_CPU_DIVEC 0x00000200 /* dedicated interrupt vector */
diff -u --recursive --new-file v2.4.9/linux/include/asm-mips/ddb5xxx/ddb5477.h linux/include/asm-mips/ddb5xxx/ddb5477.h
--- v2.4.9/linux/include/asm-mips/ddb5xxx/ddb5477.h Wed Dec 31 16:00:00 1969
+++ linux/include/asm-mips/ddb5xxx/ddb5477.h Sun Sep 9 10:43:01 2001
@@ -0,0 +1,238 @@
+/***********************************************************************
+ *
+ * Copyright 2001 MontaVista Software Inc.
SHAR_EOF
true || echo 'restore of patch-2.4.10 failed'
fi
echo 'End of part 174'
echo 'File patch-2.4.10 is continued in part 175'
echo "175" > _shar_seq_.tmp
exit 0