Commit b67cfdb8 authored by Trond Myklebust's avatar Trond Myklebust

Merge http://nfsclient.bkbits.net/linux-2.5

into fys.uio.no:/home/linux/bitkeeper/nfsclient-2.5
parents b8ddcbf2 e214725f
......@@ -35,9 +35,6 @@
#include <asm/cacheflush.h>
#include <asm/vga.h>
#define __KERNEL_SYSCALLS__
#include <asm/unistd.h>
extern struct hwrpb_struct *hwrpb;
extern void dump_thread(struct pt_regs *, struct user *);
extern spinlock_t rtc_lock;
......
......@@ -39,9 +39,6 @@
#include <asm/mmu_context.h>
#include <asm/tlbflush.h>
#define __KERNEL_SYSCALLS__
#include <asm/unistd.h>
#include "proto.h"
#include "irq_impl.h"
......
......@@ -91,8 +91,6 @@
* This file handles the architecture-dependent parts of process handling..
*/
#define __KERNEL_SYSCALLS__
#include <asm/atomic.h>
#include <asm/pgtable.h>
#include <asm/uaccess.h>
......
......@@ -832,6 +832,13 @@ static unsigned long __init setup_memory(void)
*/
reserve_bootmem(0, PAGE_SIZE);
/* could be an AMD 768MPX chipset. Reserve a page before VGA to prevent
PCI prefetch into it (errata #56). Usually the page is reserved anyways,
unless you have no PS/2 mouse plugged in. */
if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
boot_cpu_data.x86 == 6)
reserve_bootmem(0xa0000 - 4096, 4096);
#ifdef CONFIG_SMP
/*
* But first pinch a few for the stack/trampoline stuff
......
......@@ -32,7 +32,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define __KERNEL_SYSCALLS__
#include <stdarg.h>
#include <linux/elf.h>
......
......@@ -16,7 +16,6 @@
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
*/
#define __KERNEL_SYSCALLS__
#undef ENTRY_SYS_CPUS /* syscall support for iCOD-like functionality */
#include <linux/autoconf.h>
......
......@@ -1108,17 +1108,7 @@ _GLOBAL(name) \
li r3,-1; \
blr
#define __NR__exit __NR_exit
SYSCALL(setsid)
SYSCALL(open)
SYSCALL(read)
SYSCALL(write)
SYSCALL(lseek)
SYSCALL(close)
SYSCALL(dup)
SYSCALL(execve)
SYSCALL(waitpid)
/* Why isn't this a) automatic, b) written in 'C'? */
.data
......
......@@ -32,8 +32,6 @@
#include <linux/pmu.h>
#include <asm/prom.h>
#include <asm/system.h>
#define __KERNEL_SYSCALLS__
#include <asm/unistd.h>
#include <asm/pci-bridge.h>
#include <asm/irq.h>
#include <asm/pmac_feature.h>
......@@ -189,10 +187,6 @@ EXPORT_SYMBOL(consistent_sync);
EXPORT_SYMBOL(flush_dcache_all);
#endif
EXPORT_SYMBOL(open);
EXPORT_SYMBOL(read);
EXPORT_SYMBOL(lseek);
EXPORT_SYMBOL(close);
EXPORT_SYMBOL(start_thread);
EXPORT_SYMBOL(kernel_thread);
......
......@@ -17,8 +17,6 @@
#include <linux/interrupt.h>
#include <linux/kernel_stat.h>
#include <linux/delay.h>
#define __KERNEL_SYSCALLS__
#include <linux/unistd.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/cache.h>
......
......@@ -16,8 +16,6 @@
#include <linux/interrupt.h>
#include <linux/kernel_stat.h>
#include <linux/delay.h>
#define __KERNEL_SYSCALLS__
#include <linux/unistd.h>
#include <linux/init.h>
#include <linux/spinlock.h>
......
......@@ -29,8 +29,6 @@
#include <linux/interrupt.h>
#include <linux/kernel_stat.h>
#include <linux/delay.h>
#define __KERNEL_SYSCALLS__
#include <linux/unistd.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/errno.h>
......
......@@ -29,8 +29,6 @@
#include <linux/interrupt.h>
#include <linux/kernel_stat.h>
#include <linux/delay.h>
#define __KERNEL_SYSCALLS__
#include <linux/unistd.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/errno.h>
......
......@@ -9,7 +9,6 @@
* This file handles the architecture-dependent parts of process handling..
*/
#define __KERNEL_SYSCALLS__
#include <stdarg.h>
#include <linux/errno.h>
......@@ -19,7 +18,6 @@
#include <linux/kallsyms.h>
#include <linux/mm.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/ptrace.h>
#include <linux/slab.h>
#include <linux/user.h>
......
......@@ -33,9 +33,6 @@
#include <asm/cacheflush.h>
#include <asm/tlbflush.h>
#define __KERNEL_SYSCALLS__
#include <linux/unistd.h>
#define IRQ_RESCHEDULE 13
#define IRQ_STOP_CPU 14
#define IRQ_CROSS_CALL 15
......
......@@ -32,9 +32,6 @@
#include <asm/sbus.h>
#include <asm/sbi.h>
#define __KERNEL_SYSCALLS__
#include <linux/unistd.h>
#define IRQ_CROSS_CALL 15
extern ctxd_t *srmmu_ctx_table_phys;
......
......@@ -27,9 +27,6 @@
#include <asm/oplib.h>
#include <asm/hardirq.h>
#define __KERNEL_SYSCALLS__
#include <linux/unistd.h>
#define IRQ_RESCHEDULE 13
#define IRQ_STOP_CPU 14
#define IRQ_CROSS_CALL 15
......
......@@ -10,7 +10,6 @@
* This file handles the architecture-dependent parts of process handling..
*/
#define __KERNEL_SYSCALLS__
#include <stdarg.h>
#include <linux/errno.h>
......@@ -22,7 +21,6 @@
#include <linux/smp.h>
#include <linux/smp_lock.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/ptrace.h>
#include <linux/slab.h>
#include <linux/user.h>
......@@ -43,6 +41,7 @@
#include <asm/fpumacro.h>
#include <asm/head.h>
#include <asm/cpudata.h>
#include <asm/unistd.h>
/* #define VERBOSE_SHOWREGS */
......
......@@ -36,9 +36,6 @@
#include <asm/timer.h>
#include <asm/starfire.h>
#define __KERNEL_SYSCALLS__
#include <linux/unistd.h>
extern int linux_num_cpus;
extern void calibrate_delay(void);
......
......@@ -16,7 +16,6 @@
* This file handles the architecture-dependent parts of process handling..
*/
#define __KERNEL_SYSCALLS__
#include <stdarg.h>
#include <linux/errno.h>
......@@ -25,7 +24,6 @@
#include <linux/mm.h>
#include <linux/elfcore.h>
#include <linux/smp.h>
#include <linux/unistd.h>
#include <linux/slab.h>
#include <linux/user.h>
#include <linux/module.h>
......
......@@ -10,8 +10,6 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#define __KERNEL_SYSCALLS__
#include <linux/config.h>
#include <linux/types.h>
#include <linux/errno.h>
......@@ -21,7 +19,6 @@
#include <linux/timer.h>
#include <linux/hdreg.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/init.h>
#include <linux/ide.h>
#include <asm/prom.h>
......
......@@ -57,7 +57,7 @@
#ifndef MODULE
static void autostart_arrays (void);
static void autostart_arrays (int part);
#endif
static mdk_personality_t *pers[MAX_PERSONALITY];
......@@ -1447,7 +1447,7 @@ static int analyze_sbs(mddev_t * mddev)
return 1;
}
static int mdp_major = 0;
int mdp_major = 0;
static struct kobject *md_probe(dev_t dev, int *part, void *data)
{
......@@ -1792,7 +1792,7 @@ static void autorun_array(mddev_t *mddev)
*
* If "unit" is allocated, then bump its reference count
*/
static void autorun_devices(void)
static void autorun_devices(int part)
{
struct list_head candidates;
struct list_head *tmp;
......@@ -1825,7 +1825,12 @@ static void autorun_devices(void)
bdevname(rdev0->bdev, b), rdev0->preferred_minor);
break;
}
if (part)
dev = MKDEV(mdp_major,
rdev0->preferred_minor << MdpMinorShift);
else
dev = MKDEV(MD_MAJOR, rdev0->preferred_minor);
md_probe(dev, NULL, NULL);
mddev = mddev_find(dev);
if (!mddev) {
......@@ -1922,7 +1927,7 @@ static int autostart_array(dev_t startdev)
/*
* possibly return codes
*/
autorun_devices();
autorun_devices(0);
return 0;
}
......@@ -2407,7 +2412,7 @@ static int md_ioctl(struct inode *inode, struct file *file,
#ifndef MODULE
case RAID_AUTORUN:
err = 0;
autostart_arrays();
autostart_arrays(arg);
goto done;
#endif
default:;
......@@ -3577,7 +3582,7 @@ void md_autodetect_dev(dev_t dev)
}
static void autostart_arrays(void)
static void autostart_arrays(int part)
{
char b[BDEVNAME_SIZE];
mdk_rdev_t *rdev;
......@@ -3602,7 +3607,7 @@ static void autostart_arrays(void)
}
dev_cnt = 0;
autorun_devices();
autorun_devices(part);
}
#endif
......
......@@ -1409,7 +1409,8 @@ static int sync_request (mddev_t *mddev, sector_t sector_nr, int go_faster)
/* make sure we don't swamp the stripe cache if someone else
* is trying to get access
*/
yield();
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1);
}
spin_lock(&sh->lock);
set_bit(STRIPE_SYNCING, &sh->state);
......
......@@ -1571,7 +1571,8 @@ static int sync_request (mddev_t *mddev, sector_t sector_nr, int go_faster)
/* make sure we don't swamp the stripe cache if someone else
* is trying to get access
*/
yield();
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1);
}
spin_lock(&sh->lock);
set_bit(STRIPE_SYNCING, &sh->state);
......
......@@ -29,8 +29,6 @@
*/
#define __KERNEL_SYSCALLS__
#include <linux/module.h>
#include <linux/init.h>
#include <linux/vmalloc.h>
......@@ -58,8 +56,6 @@ static int debug = 0;
#define SP8870_FIRMWARE_OFFSET 0x0A
static int errno;
static struct dvb_frontend_info tdlb7_info = {
.name = "Alps TDLB7",
.type = FE_OFDM,
......@@ -174,13 +170,13 @@ static int sp8870_read_firmware_file (const char *fn, char **fp)
loff_t filesize;
char *dp;
fd = open(fn, 0, 0);
fd = sys_open(fn, 0, 0);
if (fd == -1) {
printk("%s: unable to open '%s'.\n", __FUNCTION__, fn);
return -EIO;
}
filesize = lseek(fd, 0L, 2);
filesize = sys_lseek(fd, 0L, 2);
if (filesize <= 0 || filesize < SP8870_FIRMWARE_OFFSET + SP8870_FIRMWARE_SIZE) {
printk("%s: firmware filesize to small '%s'\n", __FUNCTION__, fn);
sys_close(fd);
......@@ -194,8 +190,8 @@ static int sp8870_read_firmware_file (const char *fn, char **fp)
return -EIO;
}
lseek(fd, SP8870_FIRMWARE_OFFSET, 0);
if (read(fd, dp, SP8870_FIRMWARE_SIZE) != SP8870_FIRMWARE_SIZE) {
sys_lseek(fd, SP8870_FIRMWARE_OFFSET, 0);
if (sys_read(fd, dp, SP8870_FIRMWARE_SIZE) != SP8870_FIRMWARE_SIZE) {
printk("%s: failed to read '%s'.\n",__FUNCTION__, fn);
vfree(dp);
sys_close(fd);
......
......@@ -12,7 +12,6 @@
next 0x4000 loaded. This may change in future versions.
*/
#define __KERNEL_SYSCALLS__
#include <linux/kernel.h>
#include <linux/vmalloc.h>
#include <linux/module.h>
......@@ -68,8 +67,6 @@ struct dvb_frontend_info sp887x_info = {
FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_RECOVER
};
static int errno;
static
int i2c_writebytes (struct dvb_frontend *fe, u8 addr, u8 *buf, u8 len)
{
......@@ -216,13 +213,13 @@ int sp887x_initial_setup (struct dvb_frontend *fe)
// Load the firmware
set_fs(get_ds());
fd = open(sp887x_firmware, 0, 0);
fd = sys_open(sp887x_firmware, 0, 0);
if (fd < 0) {
printk(KERN_WARNING "%s: Unable to open firmware %s\n", __FUNCTION__,
sp887x_firmware);
return -EIO;
}
filesize = lseek(fd, 0L, 2);
filesize = sys_lseek(fd, 0L, 2);
if (filesize <= 0) {
printk(KERN_WARNING "%s: Firmware %s is empty\n", __FUNCTION__,
sp887x_firmware);
......@@ -244,8 +241,8 @@ int sp887x_initial_setup (struct dvb_frontend *fe)
// read it!
// read the first 16384 bytes from the file
// ignore the first 10 bytes
lseek(fd, 10, 0);
if (read(fd, firmware, fw_size) != fw_size) {
sys_lseek(fd, 10, 0);
if (sys_read(fd, firmware, fw_size) != fw_size) {
printk(KERN_WARNING "%s: Failed to read firmware\n", __FUNCTION__);
vfree(firmware);
sys_close(fd);
......
......@@ -32,7 +32,6 @@
*/
#define __KERNEL_SYSCALLS__
#include <linux/kernel.h>
#include <linux/vmalloc.h>
#include <linux/module.h>
......@@ -41,7 +40,6 @@
#include <linux/slab.h>
#include <linux/syscalls.h>
#include <linux/fs.h>
#include <linux/unistd.h>
#include <linux/fcntl.h>
#include <linux/errno.h>
#include "dvb_frontend.h"
......@@ -399,13 +397,13 @@ static int tda1004x_fwupload(struct dvb_i2c_bus *i2c, struct tda1004x_state *tda
// Load the firmware
set_fs(get_ds());
fd = open(tda1004x_firmware, 0, 0);
fd = sys_open(tda1004x_firmware, 0, 0);
if (fd < 0) {
printk("%s: Unable to open firmware %s\n", __FUNCTION__,
tda1004x_firmware);
return -EIO;
}
filesize = lseek(fd, 0L, 2);
filesize = sys_lseek(fd, 0L, 2);
if (filesize <= 0) {
printk("%s: Firmware %s is empty\n", __FUNCTION__,
tda1004x_firmware);
......@@ -436,8 +434,8 @@ static int tda1004x_fwupload(struct dvb_i2c_bus *i2c, struct tda1004x_state *tda
}
// read it!
lseek(fd, fw_offset, 0);
if (read(fd, firmware, fw_size) != fw_size) {
sys_lseek(fd, fw_offset, 0);
if (sys_read(fd, firmware, fw_size) != fw_size) {
printk("%s: Failed to read firmware\n", __FUNCTION__);
vfree(firmware);
sys_close(fd);
......
......@@ -46,10 +46,6 @@
#include <linux/ioport.h> // request_region() prototype
#include <linux/completion.h>
#ifdef __alpha__
#define __KERNEL_SYSCALLS__
#endif
#include <asm/unistd.h>
#include <asm/io.h>
#include <asm/uaccess.h> // ioctl related
#include <asm/irq.h>
......
......@@ -12,7 +12,6 @@
#define USE_BOTTOM_HALF
#endif
#define __KERNEL_SYSCALLS__
#include <linux/module.h>
#include <linux/kernel.h>
......@@ -43,8 +42,6 @@
#include <linux/interrupt.h>
#endif
#include <linux/unistd.h>
/* The controller registers can be found in the Z2 config area at these
* offsets:
*/
......
......@@ -954,6 +954,7 @@ asmlinkage long sys_open(const char __user * filename, int flags, int mode)
fd = error;
goto out;
}
EXPORT_SYMBOL_GPL(sys_open);
#ifndef __alpha__
......
......@@ -361,7 +361,8 @@ int show_stat(struct seq_file *p, void *v)
int i;
extern unsigned long total_forks;
unsigned long jif;
unsigned int sum = 0, user = 0, nice = 0, system = 0, idle = 0, iowait = 0, irq = 0, softirq = 0;
u64 sum = 0, user = 0, nice = 0, system = 0,
idle = 0, iowait = 0, irq = 0, softirq = 0;
jif = - wall_to_monotonic.tv_sec;
if (wall_to_monotonic.tv_nsec)
......@@ -381,26 +382,35 @@ int show_stat(struct seq_file *p, void *v)
sum += kstat_cpu(i).irqs[j];
}
seq_printf(p, "cpu %u %u %u %u %u %u %u\n",
jiffies_to_clock_t(user),
jiffies_to_clock_t(nice),
jiffies_to_clock_t(system),
jiffies_to_clock_t(idle),
jiffies_to_clock_t(iowait),
jiffies_to_clock_t(irq),
jiffies_to_clock_t(softirq));
seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu\n",
(unsigned long long)jiffies_64_to_clock_t(user),
(unsigned long long)jiffies_64_to_clock_t(nice),
(unsigned long long)jiffies_64_to_clock_t(system),
(unsigned long long)jiffies_64_to_clock_t(idle),
(unsigned long long)jiffies_64_to_clock_t(iowait),
(unsigned long long)jiffies_64_to_clock_t(irq),
(unsigned long long)jiffies_64_to_clock_t(softirq));
for_each_cpu(i) {
seq_printf(p, "cpu%d %u %u %u %u %u %u %u\n",
/* two separate calls here to work around gcc-2.95.3 ICE */
seq_printf(p, "cpu%d %llu %llu %llu ",
i,
jiffies_to_clock_t(kstat_cpu(i).cpustat.user),
jiffies_to_clock_t(kstat_cpu(i).cpustat.nice),
jiffies_to_clock_t(kstat_cpu(i).cpustat.system),
jiffies_to_clock_t(kstat_cpu(i).cpustat.idle),
jiffies_to_clock_t(kstat_cpu(i).cpustat.iowait),
jiffies_to_clock_t(kstat_cpu(i).cpustat.irq),
jiffies_to_clock_t(kstat_cpu(i).cpustat.softirq));
(unsigned long long)
jiffies_64_to_clock_t(kstat_cpu(i).cpustat.user),
(unsigned long long)
jiffies_64_to_clock_t(kstat_cpu(i).cpustat.nice),
(unsigned long long)
jiffies_64_to_clock_t(kstat_cpu(i).cpustat.system));
seq_printf(p, "%llu %llu %llu %llu\n",
(unsigned long long)
jiffies_64_to_clock_t(kstat_cpu(i).cpustat.idle),
(unsigned long long)
jiffies_64_to_clock_t(kstat_cpu(i).cpustat.iowait),
(unsigned long long)
jiffies_64_to_clock_t(kstat_cpu(i).cpustat.irq),
(unsigned long long)
jiffies_64_to_clock_t(kstat_cpu(i).cpustat.softirq));
}
seq_printf(p, "intr %u", sum);
seq_printf(p, "intr %llu", (unsigned long long)sum);
#if !defined(CONFIG_PPC64) && !defined(CONFIG_ALPHA)
for (i = 0; i < NR_IRQS; i++)
......@@ -408,7 +418,7 @@ int show_stat(struct seq_file *p, void *v)
#endif
seq_printf(p,
"\nctxt %lu\n"
"\nctxt %llu\n"
"btime %lu\n"
"processes %lu\n"
"procs_running %lu\n"
......
......@@ -143,6 +143,7 @@ asmlinkage off_t sys_lseek(unsigned int fd, off_t offset, unsigned int origin)
bad:
return retval;
}
EXPORT_SYMBOL_GPL(sys_lseek);
#if !defined(__alpha__)
asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
......@@ -281,6 +282,7 @@ asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count)
return ret;
}
EXPORT_SYMBOL_GPL(sys_read);
asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t count)
{
......
......@@ -375,6 +375,7 @@ __syscall_return(type,__res); \
#include <linux/compiler.h>
#include <linux/types.h>
#include <linux/linkage.h>
#include <asm/ptrace.h>
/*
......
......@@ -14,13 +14,13 @@
*/
struct cpu_usage_stat {
unsigned int user;
unsigned int nice;
unsigned int system;
unsigned int softirq;
unsigned int irq;
unsigned int idle;
unsigned int iowait;
u64 user;
u64 nice;
u64 system;
u64 softirq;
u64 irq;
u64 idle;
u64 iowait;
};
struct kernel_stat {
......@@ -34,7 +34,7 @@ DECLARE_PER_CPU(struct kernel_stat, kstat);
/* Must have preemption disabled for this to be meaningful. */
#define kstat_this_cpu __get_cpu_var(kstat)
extern unsigned long nr_context_switches(void);
extern unsigned long long nr_context_switches(void);
/*
* Number of interrupts per specific IRQ source, since bootup
......
......@@ -66,11 +66,11 @@ static dev_t __init try_name(char *name, int part)
/* read device number from .../dev */
sprintf(path, "/sys/block/%s/dev", name);
fd = open(path, 0, 0);
fd = sys_open(path, 0, 0);
if (fd < 0)
goto fail;
len = read(fd, buf, 32);
close(fd);
len = sys_read(fd, buf, 32);
sys_close(fd);
if (len <= 0 || len == 32 || buf[len - 1] != '\n')
goto fail;
buf[len - 1] = '\0';
......@@ -96,11 +96,11 @@ static dev_t __init try_name(char *name, int part)
/* otherwise read range from .../range */
sprintf(path, "/sys/block/%s/range", name);
fd = open(path, 0, 0);
fd = sys_open(path, 0, 0);
if (fd < 0)
goto fail;
len = read(fd, buf, 32);
close(fd);
len = sys_read(fd, buf, 32);
sys_close(fd);
if (len <= 0 || len == 32 || buf[len - 1] != '\n')
goto fail;
buf[len - 1] = '\0';
......@@ -288,7 +288,7 @@ void __init mount_block_root(char *name, int flags)
continue;
}
/*
* Allow the user to distinguish between failed open
* Allow the user to distinguish between failed sys_open
* and bad superblock on root device.
*/
__bdevname(ROOT_DEV, b);
......@@ -327,21 +327,21 @@ void __init change_floppy(char *fmt, ...)
va_start(args, fmt);
vsprintf(buf, fmt, args);
va_end(args);
fd = open("/dev/root", O_RDWR | O_NDELAY, 0);
fd = sys_open("/dev/root", O_RDWR | O_NDELAY, 0);
if (fd >= 0) {
sys_ioctl(fd, FDEJECT, 0);
close(fd);
sys_close(fd);
}
printk(KERN_NOTICE "VFS: Insert %s and press ENTER\n", buf);
fd = open("/dev/console", O_RDWR, 0);
fd = sys_open("/dev/console", O_RDWR, 0);
if (fd >= 0) {
sys_ioctl(fd, TCGETS, (long)&termios);
termios.c_lflag &= ~ICANON;
sys_ioctl(fd, TCSETSF, (long)&termios);
read(fd, &c, 1);
sys_read(fd, &c, 1);
termios.c_lflag |= ICANON;
sys_ioctl(fd, TCSETSF, (long)&termios);
close(fd);
sys_close(fd);
}
}
#endif
......
#define __KERNEL_SYSCALLS__
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/devfs_fs_kernel.h>
......
......@@ -24,7 +24,7 @@ static int __init do_read_dir(int fd, void *buf, int len)
{
long bytes, n;
char *p = buf;
lseek(fd, 0, 0);
sys_lseek(fd, 0, 0);
for (bytes = 0; bytes < len; bytes += n) {
n = sys_getdents64(fd, (struct linux_dirent64 *)(p + bytes),
......@@ -45,7 +45,7 @@ static int __init do_read_dir(int fd, void *buf, int len)
static void * __init read_dir(char *path, int *len)
{
int size;
int fd = open(path, 0, 0);
int fd = sys_open(path, 0, 0);
*len = 0;
if (fd < 0)
......@@ -58,7 +58,7 @@ static void * __init read_dir(char *path, int *len)
break;
n = do_read_dir(fd, p, size);
if (n > 0) {
close(fd);
sys_close(fd);
*len = n;
return p;
}
......@@ -68,7 +68,7 @@ static void * __init read_dir(char *path, int *len)
if (n < 0)
break;
}
close(fd);
sys_close(fd);
return NULL;
}
......
#define __KERNEL_SYSCALLS__
#include <linux/unistd.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/minix_fs.h>
......@@ -28,12 +29,12 @@ static int __init do_linuxrc(void * shell)
static char *argv[] = { "linuxrc", NULL, };
extern char * envp_init[];
close(old_fd);close(root_fd);
close(0);close(1);close(2);
setsid();
(void) open("/dev/console",O_RDWR,0);
(void) dup(0);
(void) dup(0);
sys_close(old_fd);sys_close(root_fd);
sys_close(0);sys_close(1);sys_close(2);
sys_setsid();
(void) sys_open("/dev/console",O_RDWR,0);
(void) sys_dup(0);
(void) sys_dup(0);
return execve(shell, argv, envp_init);
}
......@@ -47,8 +48,8 @@ static void __init handle_initrd(void)
/* mount initrd on rootfs' /root */
mount_block_root("/dev/root.old", root_mountflags & ~MS_RDONLY);
sys_mkdir("/old", 0700);
root_fd = open("/", 0, 0);
old_fd = open("/old", 0, 0);
root_fd = sys_open("/", 0, 0);
old_fd = sys_open("/old", 0, 0);
/* move initrd over / and chdir/chroot in initrd root */
sys_chdir("/root");
sys_mount(".", "/", NULL, MS_MOVE, NULL);
......@@ -57,7 +58,7 @@ static void __init handle_initrd(void)
pid = kernel_thread(do_linuxrc, "/linuxrc", SIGCHLD);
if (pid > 0) {
while (pid != waitpid(-1, &i, 0))
while (pid != sys_wait4(-1, &i, 0, 0))
yield();
}
......@@ -67,8 +68,8 @@ static void __init handle_initrd(void)
/* switch root and cwd back to / of rootfs */
sys_fchdir(root_fd);
sys_chroot(".");
close(old_fd);
close(root_fd);
sys_close(old_fd);
sys_close(root_fd);
umount_devfs("/old/dev");
if (new_decode_dev(real_root_dev) == Root_RAM0) {
......@@ -84,7 +85,7 @@ static void __init handle_initrd(void)
if (!error)
printk("okay\n");
else {
int fd = open("/dev/root.old", O_RDWR, 0);
int fd = sys_open("/dev/root.old", O_RDWR, 0);
printk("failed\n");
printk(KERN_NOTICE "Unmounting old root\n");
sys_umount("/old", MNT_DETACH);
......@@ -93,7 +94,7 @@ static void __init handle_initrd(void)
error = fd;
} else {
error = sys_ioctl(fd, BLKFLSBUF, 0);
close(fd);
sys_close(fd);
}
printk(!error ? "okay\n" : "failed\n");
}
......
......@@ -12,15 +12,19 @@
* The code for that is here.
*/
static int __initdata raid_noautodetect;
static int __initdata raid_noautodetect, raid_autopart;
static struct {
char device_set [MAX_MD_DEVS];
int pers[MAX_MD_DEVS];
int chunk[MAX_MD_DEVS];
char *device_names[MAX_MD_DEVS];
} md_setup_args __initdata;
int minor;
int partitioned;
int pers;
int chunk;
char *device_names;
} md_setup_args[MAX_MD_DEVS] __initdata;
static int md_setup_ents __initdata;
extern int mdp_major;
/*
* Parse the command-line parameters given our kernel, but do not
* actually try to invoke the MD device now; that is handled by
......@@ -43,21 +47,37 @@ static struct {
*/
static int __init md_setup(char *str)
{
int minor, level, factor, fault, pers;
int minor, level, factor, fault, pers, partitioned = 0;
char *pername = "";
char *str1 = str;
char *str1;
int ent;
if (*str == 'd') {
partitioned = 1;
str++;
}
if (get_option(&str, &minor) != 2) { /* MD Number */
printk(KERN_WARNING "md: Too few arguments supplied to md=.\n");
return 0;
}
str1 = str;
if (minor >= MAX_MD_DEVS) {
printk(KERN_WARNING "md: md=%d, Minor device number too high.\n", minor);
return 0;
} else if (md_setup_args.device_names[minor]) {
printk(KERN_WARNING "md: md=%d, Specified more than once. "
"Replacing previous definition.\n", minor);
}
for (ent=0 ; ent< md_setup_ents ; ent++)
if (md_setup_args[ent].minor == minor &&
md_setup_args[ent].partitioned == partitioned) {
printk(KERN_WARNING "md: md=%s%d, Specified more than once. "
"Replacing previous definition.\n", partitioned?"d":"", minor);
break;
}
if (ent >= MAX_MD_DEVS) {
printk(KERN_WARNING "md: md=%s%d - too many md initialisations\n", partitioned?"d":"", minor);
return 0;
}
if (ent >= md_setup_ents)
md_setup_ents++;
switch (get_option(&str, &level)) { /* RAID Personality */
case 2: /* could be 0 or -1.. */
if (level == 0 || level == LEVEL_LINEAR) {
......@@ -66,24 +86,16 @@ static int __init md_setup(char *str)
printk(KERN_WARNING "md: Too few arguments supplied to md=.\n");
return 0;
}
md_setup_args.pers[minor] = level;
md_setup_args.chunk[minor] = 1 << (factor+12);
switch(level) {
case LEVEL_LINEAR:
md_setup_args[ent].pers = level;
md_setup_args[ent].chunk = 1 << (factor+12);
if (level == LEVEL_LINEAR) {
pers = LINEAR;
pername = "linear";
break;
case 0:
} else {
pers = RAID0;
pername = "raid0";
break;
default:
printk(KERN_WARNING
"md: The kernel has not been configured for raid%d support!\n",
level);
return 0;
}
md_setup_args.pers[minor] = pers;
md_setup_args[ent].pers = pers;
break;
}
/* FALL THROUGH */
......@@ -91,36 +103,45 @@ static int __init md_setup(char *str)
str = str1;
/* FALL THROUGH */
case 0:
md_setup_args.pers[minor] = 0;
md_setup_args[ent].pers = 0;
pername="super-block";
}
printk(KERN_INFO "md: Will configure md%d (%s) from %s, below.\n",
minor, pername, str);
md_setup_args.device_names[minor] = str;
md_setup_args[ent].device_names = str;
md_setup_args[ent].partitioned = partitioned;
md_setup_args[ent].minor = minor;
return 1;
}
#define MdpMinorShift 6
static void __init md_setup_drive(void)
{
int minor, i;
int minor, i, ent, partitioned;
dev_t dev;
dev_t devices[MD_SB_DISKS+1];
for (minor = 0; minor < MAX_MD_DEVS; minor++) {
for (ent = 0; ent < md_setup_ents ; ent++) {
int fd;
int err = 0;
char *devname;
mdu_disk_info_t dinfo;
char name[16], devfs_name[16];
if (!(devname = md_setup_args.device_names[minor]))
continue;
minor = md_setup_args[ent].minor;
partitioned = md_setup_args[ent].partitioned;
devname = md_setup_args[ent].device_names;
sprintf(name, "/dev/md%d", minor);
sprintf(devfs_name, "/dev/md/%d", minor);
create_dev(name, MKDEV(MD_MAJOR, minor), devfs_name);
sprintf(name, "/dev/md%s%d", partitioned?"_d":"", minor);
sprintf(devfs_name, "/dev/md/%s%d", partitioned?"d":"", minor);
if (partitioned)
dev = MKDEV(mdp_major, minor << MdpMinorShift);
else
dev = MKDEV(MD_MAJOR, minor);
create_dev(name, dev, devfs_name);
for (i = 0; i < MD_SB_DISKS && devname != 0; i++) {
char *p;
char comp_name[64];
......@@ -143,34 +164,36 @@ static void __init md_setup_drive(void)
}
devices[i] = dev;
md_setup_args.device_set[minor] = 1;
devname = p;
}
devices[i] = 0;
if (!md_setup_args.device_set[minor])
if (!i)
continue;
printk(KERN_INFO "md: Loading md%d: %s\n", minor, md_setup_args.device_names[minor]);
printk(KERN_INFO "md: Loading md%s%d: %s\n",
partitioned ? "_d" : "", minor,
md_setup_args[ent].device_names);
fd = open(name, 0, 0);
fd = sys_open(name, 0, 0);
if (fd < 0) {
printk(KERN_ERR "md: open failed - cannot start array %d\n", minor);
printk(KERN_ERR "md: open failed - cannot start "
"array %s\n", name);
continue;
}
if (sys_ioctl(fd, SET_ARRAY_INFO, 0) == -EBUSY) {
printk(KERN_WARNING
"md: Ignoring md=%d, already autodetected. (Use raid=noautodetect)\n",
minor);
close(fd);
sys_close(fd);
continue;
}
if (md_setup_args.pers[minor]) {
if (md_setup_args[ent].pers) {
/* non-persistent */
mdu_array_info_t ainfo;
ainfo.level = pers_to_level(md_setup_args.pers[minor]);
ainfo.level = pers_to_level(md_setup_args[ent].pers);
ainfo.size = 0;
ainfo.nr_disks =0;
ainfo.raid_disks =0;
......@@ -181,7 +204,7 @@ static void __init md_setup_drive(void)
ainfo.state = (1 << MD_SB_CLEAN);
ainfo.layout = 0;
ainfo.chunk_size = md_setup_args.chunk[minor];
ainfo.chunk_size = md_setup_args[ent].chunk;
err = sys_ioctl(fd, SET_ARRAY_INFO, (long)&ainfo);
for (i = 0; !err && i <= MD_SB_DISKS; i++) {
dev = devices[i];
......@@ -209,7 +232,7 @@ static void __init md_setup_drive(void)
err = sys_ioctl(fd, RUN_ARRAY, 0);
if (err)
printk(KERN_WARNING "md: starting md%d failed\n", minor);
close(fd);
sys_close(fd);
}
}
......@@ -229,6 +252,10 @@ static int __init raid_setup(char *str)
if (!strncmp(str, "noautodetect", wlen))
raid_noautodetect = 1;
if (strncmp(str, "partitionable", wlen)==0)
raid_autopart = 1;
if (strncmp(str, "part", wlen)==0)
raid_autopart = 1;
pos += wlen+1;
}
return 1;
......@@ -243,10 +270,10 @@ void __init md_run_setup(void)
if (raid_noautodetect)
printk(KERN_INFO "md: Skipping autodetection of RAID arrays. (raid=noautodetect)\n");
else {
int fd = open("/dev/md0", 0, 0);
int fd = sys_open("/dev/md0", 0, 0);
if (fd >= 0) {
sys_ioctl(fd, RAID_AUTORUN, 0);
close(fd);
sys_ioctl(fd, RAID_AUTORUN, raid_autopart);
sys_close(fd);
}
}
md_setup_drive();
......
......@@ -69,8 +69,8 @@ identify_ramdisk_image(int fd, int start_block)
/*
* Read block 0 to test for gzipped kernel
*/
lseek(fd, start_block * BLOCK_SIZE, 0);
read(fd, buf, size);
sys_lseek(fd, start_block * BLOCK_SIZE, 0);
sys_read(fd, buf, size);
/*
* If it matches the gzip magic numbers, return -1
......@@ -104,8 +104,8 @@ identify_ramdisk_image(int fd, int start_block)
/*
* Read block 1 to test for minix and ext2 superblock
*/
lseek(fd, (start_block+1) * BLOCK_SIZE, 0);
read(fd, buf, size);
sys_lseek(fd, (start_block+1) * BLOCK_SIZE, 0);
sys_read(fd, buf, size);
/* Try minix */
if (minixsb->s_magic == MINIX_SUPER_MAGIC ||
......@@ -131,7 +131,7 @@ identify_ramdisk_image(int fd, int start_block)
start_block);
done:
lseek(fd, start_block * BLOCK_SIZE, 0);
sys_lseek(fd, start_block * BLOCK_SIZE, 0);
kfree(buf);
return nblocks;
}
......@@ -148,11 +148,11 @@ int __init rd_load_image(char *from)
char rotator[4] = { '|' , '/' , '-' , '\\' };
#endif
out_fd = open("/dev/ram", O_RDWR, 0);
out_fd = sys_open("/dev/ram", O_RDWR, 0);
if (out_fd < 0)
goto out;
in_fd = open(from, O_RDONLY, 0);
in_fd = sys_open(from, O_RDONLY, 0);
if (in_fd < 0)
goto noclose_input;
......@@ -217,20 +217,20 @@ int __init rd_load_image(char *from)
if (i && (i % devblocks == 0)) {
printk("done disk #%d.\n", disk++);
rotate = 0;
if (close(in_fd)) {
if (sys_close(in_fd)) {
printk("Error closing the disk.\n");
goto noclose_input;
}
change_floppy("disk #%d", disk);
in_fd = open(from, O_RDONLY, 0);
in_fd = sys_open(from, O_RDONLY, 0);
if (in_fd < 0) {
printk("Error opening disk.\n");
goto noclose_input;
}
printk("Loading disk #%d... ", disk);
}
read(in_fd, buf, BLOCK_SIZE);
write(out_fd, buf, BLOCK_SIZE);
sys_read(in_fd, buf, BLOCK_SIZE);
sys_write(out_fd, buf, BLOCK_SIZE);
#if !defined(CONFIG_ARCH_S390) && !defined(CONFIG_PPC_ISERIES)
if (!(i % 16)) {
printk("%c\b", rotator[rotate & 0x3]);
......@@ -243,9 +243,9 @@ int __init rd_load_image(char *from)
successful_load:
res = 1;
done:
close(in_fd);
sys_close(in_fd);
noclose_input:
close(out_fd);
sys_close(out_fd);
out:
kfree(buf);
sys_unlink("/dev/ram");
......@@ -342,7 +342,7 @@ static int __init fill_inbuf(void)
{
if (exit_code) return -1;
insize = read(crd_infd, inbuf, INBUFSIZ);
insize = sys_read(crd_infd, inbuf, INBUFSIZ);
if (insize == 0) {
error("RAMDISK: ran out of compressed data");
return -1;
......@@ -363,7 +363,7 @@ static void __init flush_window(void)
unsigned n, written;
uch *in, ch;
written = write(crd_outfd, window, outcnt);
written = sys_write(crd_outfd, window, outcnt);
if (written != outcnt && unzip_error == 0) {
printk(KERN_ERR "RAMDISK: incomplete write (%d != %d) %ld\n",
written, outcnt, bytes_out);
......
#define __KERNEL_SYSCALLS__
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/unistd.h>
#include <linux/delay.h>
#include <linux/string.h>
#include <linux/syscalls.h>
......
......@@ -18,7 +18,6 @@
#include <linux/devfs_fs_kernel.h>
#include <linux/kernel.h>
#include <linux/syscalls.h>
#include <linux/unistd.h>
#include <linux/string.h>
#include <linux/ctype.h>
#include <linux/delay.h>
......@@ -42,6 +41,7 @@
#include <linux/writeback.h>
#include <linux/cpu.h>
#include <linux/efi.h>
#include <linux/unistd.h>
#include <asm/io.h>
#include <asm/bugs.h>
......@@ -612,11 +612,11 @@ static int init(void * unused)
unlock_kernel();
system_running = 1;
if (open("/dev/console", O_RDWR, 0) < 0)
if (sys_open("/dev/console", O_RDWR, 0) < 0)
printk("Warning: unable to open an initial console.\n");
(void) dup(0);
(void) dup(0);
(void) sys_dup(0);
(void) sys_dup(0);
/*
* We try each of these until one succeeds.
......
......@@ -91,7 +91,6 @@ static void keventd_create_kthread(void *_create)
} else {
wait_for_completion(&create->started);
create->result = find_task_by_pid(pid);
wait_task_inactive(create->result);
}
complete(&create->done);
}
......@@ -131,7 +130,9 @@ struct task_struct *kthread_create(int (*threadfn)(void *data),
void kthread_bind(struct task_struct *k, unsigned int cpu)
{
BUG_ON(k->state != TASK_INTERRUPTIBLE);
k->thread_info->cpu = cpu;
/* Must have done schedule() in kthread() before we set_task_cpu */
wait_task_inactive(k);
set_task_cpu(k, cpu);
k->cpus_allowed = cpumask_of_cpu(cpu);
}
......
......@@ -201,8 +201,9 @@ struct prio_array {
*/
struct runqueue {
spinlock_t lock;
unsigned long nr_running, nr_switches, expired_timestamp,
nr_uninterruptible, timestamp_last_tick;
unsigned long long nr_switches;
unsigned long nr_running, expired_timestamp, nr_uninterruptible,
timestamp_last_tick;
task_t *curr, *idle;
struct mm_struct *prev_mm;
prio_array_t *active, *expired, arrays[2];
......@@ -950,9 +951,9 @@ unsigned long nr_uninterruptible(void)
return sum;
}
unsigned long nr_context_switches(void)
unsigned long long nr_context_switches(void)
{
unsigned long i, sum = 0;
unsigned long long i, sum = 0;
for_each_cpu(i)
sum += cpu_rq(i)->nr_switches;
......
......@@ -690,6 +690,42 @@ __alloc_pages(unsigned int gfp_mask, unsigned int order,
EXPORT_SYMBOL(__alloc_pages);
#ifdef CONFIG_NUMA
/* Early boot: Everything is done by one cpu, but the data structures will be
* used by all cpus - spread them on all nodes.
*/
static __init unsigned long get_boot_pages(unsigned int gfp_mask, unsigned int order)
{
static int nodenr;
int i = nodenr;
struct page *page;
for (;;) {
if (i > nodenr + numnodes)
return 0;
if (node_present_pages(i%numnodes)) {
struct zone **z;
/* The node contains memory. Check that there is
* memory in the intended zonelist.
*/
z = NODE_DATA(i%numnodes)->node_zonelists[gfp_mask & GFP_ZONEMASK].zones;
while (*z) {
if ( (*z)->free_pages > (1UL<<order))
goto found_node;
z++;
}
}
i++;
}
found_node:
nodenr = i+1;
page = alloc_pages_node(i%numnodes, gfp_mask, order);
if (!page)
return 0;
return (unsigned long) page_address(page);
}
#endif
/*
* Common helper functions.
*/
......@@ -697,6 +733,10 @@ fastcall unsigned long __get_free_pages(unsigned int gfp_mask, unsigned int orde
{
struct page * page;
#ifdef CONFIG_NUMA
if (unlikely(!system_running))
return get_boot_pages(gfp_mask, order);
#endif
page = alloc_pages(gfp_mask, order);
if (!page)
return 0;
......@@ -1115,6 +1155,8 @@ static int __init find_next_best_node(int node, void *used_node_mask)
int best_node = -1;
for (i = 0; i < numnodes; i++) {
cpumask_t tmp;
/* Start from local node */
n = (node+i)%numnodes;
......@@ -1126,7 +1168,8 @@ static int __init find_next_best_node(int node, void *used_node_mask)
val = node_distance(node, n);
/* Give preference to headless and unused nodes */
if (!cpus_empty(node_to_cpumask(n)))
tmp = node_to_cpumask(n);
if (!cpus_empty(tmp))
val += PENALTY_FOR_NODE_WITH_CPUS;
/* Slight preference for less loaded node */
......
......@@ -1913,11 +1913,11 @@ wavefront_reset_to_cleanliness (snd_wavefront_t *dev)
return (1);
}
#define __KERNEL_SYSCALLS__
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/unistd.h>
#include <linux/syscalls.h>
#include <asm/uaccess.h>
static int errno;
......@@ -1947,7 +1947,7 @@ wavefront_download_firmware (snd_wavefront_t *dev, char *path)
fs = get_fs();
set_fs (get_ds());
if ((fd = open (path, 0, 0)) < 0) {
if ((fd = sys_open (path, 0, 0)) < 0) {
snd_printk ("Unable to load \"%s\".\n",
path);
return 1;
......@@ -1956,7 +1956,7 @@ wavefront_download_firmware (snd_wavefront_t *dev, char *path)
while (1) {
int x;
if ((x = read (fd, &section_length, sizeof (section_length))) !=
if ((x = sys_read (fd, &section_length, sizeof (section_length))) !=
sizeof (section_length)) {
snd_printk ("firmware read error.\n");
goto failure;
......@@ -1966,7 +1966,7 @@ wavefront_download_firmware (snd_wavefront_t *dev, char *path)
break;
}
if (read (fd, section, section_length) != section_length) {
if (sys_read (fd, section, section_length) != section_length) {
snd_printk ("firmware section "
"read error.\n");
goto failure;
......@@ -2005,12 +2005,12 @@ wavefront_download_firmware (snd_wavefront_t *dev, char *path)
}
close (fd);
sys_close (fd);
set_fs (fs);
return 0;
failure:
close (fd);
sys_close (fd);
set_fs (fs);
snd_printk ("firmware download failed!!!\n");
return 1;
......
......@@ -2490,11 +2490,9 @@ static int __init detect_wavefront (int irq, int io_base)
}
#include "os.h"
#define __KERNEL_SYSCALLS__
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/unistd.h>
#include <asm/uaccess.h>
static int errno;
......@@ -2524,7 +2522,7 @@ wavefront_download_firmware (char *path)
fs = get_fs();
set_fs (get_ds());
if ((fd = open (path, 0, 0)) < 0) {
if ((fd = sys_open (path, 0, 0)) < 0) {
printk (KERN_WARNING LOGNAME "Unable to load \"%s\".\n",
path);
return 1;
......@@ -2533,7 +2531,7 @@ wavefront_download_firmware (char *path)
while (1) {
int x;
if ((x = read (fd, &section_length, sizeof (section_length))) !=
if ((x = sys_read (fd, &section_length, sizeof (section_length))) !=
sizeof (section_length)) {
printk (KERN_ERR LOGNAME "firmware read error.\n");
goto failure;
......@@ -2543,7 +2541,7 @@ wavefront_download_firmware (char *path)
break;
}
if (read (fd, section, section_length) != section_length) {
if (sys_read (fd, section, section_length) != section_length) {
printk (KERN_ERR LOGNAME "firmware section "
"read error.\n");
goto failure;
......@@ -2582,12 +2580,12 @@ wavefront_download_firmware (char *path)
}
close (fd);
sys_close (fd);
set_fs (fs);
return 0;
failure:
close (fd);
sys_close (fd);
set_fs (fs);
printk (KERN_ERR "\nWaveFront: firmware download failed!!!\n");
return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment