#include <linux/random.h>
#include <linux/init.h>
#include <linux/delay.h>
+#include <linux/irq.h>
#include <asm/system.h>
#include <asm/io.h>
-#include <asm/irq.h>
#include <asm/bitops.h>
#include <asm/machvec.h>
+#include <asm/spinlock.h>
#include "proto.h"
-#include "irq_impl.h"
#define vulp volatile unsigned long *
#define vuip volatile unsigned int *
*/
static struct irqaction timer_irq = { NULL, 0, 0, NULL, NULL, NULL};
-static struct irqaction *irq_action[NR_IRQS];
+spinlock_t irq_controller_lock = SPIN_LOCK_UNLOCKED;
+irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = { [0 ... NR_IRQS-1] = {0,} };
static inline void
int
check_irq(unsigned int irq)
{
- struct irqaction **p;
-
- p = irq_action + irq;
- if (*p == NULL)
- return 0;
- return -EBUSY;
+ return irq_desc[irq].action ? -EBUSY : 0;
}
int
if (!handler)
return -EINVAL;
- p = irq_action + irq;
+ p = &irq_desc[irq].action;
action = *p;
if (action) {
/* Can't share interrupts unless both agree to */
printk("Trying to free reserved IRQ %d\n", irq);
return;
}
- for (p = irq + irq_action; (action = *p) != NULL; p = &action->next) {
+ for (p = &irq_desc[irq].action; (action = *p) != NULL; p = &action->next) {
if (action->dev_id != dev_id)
continue;
/* Found it - now free it */
save_and_cli(flags);
*p = action->next;
- if (!irq[irq_action])
+ if (!irq_desc[irq].action)
mask_irq(irq);
restore_flags(flags);
kfree(action);
#endif
for (i = 0; i < NR_IRQS; i++) {
- action = irq_action[i];
+ action = irq_desc[i].action;
if (!action)
continue;
p += sprintf(p, "%3d: ",i);
}
}
-#undef INIT_STUCK
-#define INIT_STUCK (1<<26)
-
-#undef STUCK
-#define STUCK \
- if (!--stuck) { \
- printk("irq_enter stuck (irq=%d, cpu=%d, global=%d)\n", \
- irq, cpu, global_irq_holder); \
- stuck = INIT_STUCK; \
- }
-
-#undef VERBOSE_IRQLOCK_DEBUGGING
-
-void
-irq_enter(int cpu, int irq)
-{
-#ifdef VERBOSE_IRQLOCK_DEBUGGING
- extern void smp_show_backtrace_all_cpus(void);
-#endif
- int stuck = INIT_STUCK;
-
- hardirq_enter(cpu, irq);
- barrier();
- while (spin_is_locked(&global_irq_lock)) {
- if (cpu == global_irq_holder) {
- int globl_locked = spin_is_locked(&global_irq_lock);
- int globl_icount = atomic_read(&global_irq_count);
- int local_count = local_irq_count(cpu);
-
- /* It is very important that we load the state
- variables before we do the first call to
- printk() as printk() could end up changing
- them... */
-
- printk("CPU[%d]: where [%p] glocked[%d] gicnt[%d]"
- " licnt[%d]\n",
- cpu, previous_irqholder, globl_locked,
- globl_icount, local_count);
-#ifdef VERBOSE_IRQLOCK_DEBUGGING
- printk("Performing backtrace on all CPUs,"
- " write this down!\n");
- smp_show_backtrace_all_cpus();
-#endif
- break;
- }
- STUCK;
- barrier();
- }
-}
-
-void
-irq_exit(int cpu, int irq)
-{
- hardirq_exit(cpu, irq);
- release_irqlock(cpu);
-}
-
static void
show(char * str, void *where)
{
}
#endif
}
-
-#else /* !__SMP__ */
-
-#define irq_enter(cpu, irq) (++local_irq_count(cpu))
-#define irq_exit(cpu, irq) (--local_irq_count(cpu))
-
#endif /* __SMP__ */
static void
printk("PC = %016lx PS=%04lx\n", regs->pc, regs->ps);
printk("Expecting: ");
for (i = 0; i < ACTUAL_NR_IRQS; i++)
- if ((action = irq_action[i]))
+ if ((action = irq_desc[i].action))
while (action->handler) {
printk("[%s:%d] ", action->name, i);
action = action->next;
irq_enter(cpu, irq);
kstat.irqs[cpu][irq] += 1;
- action = irq_action[irq];
+ action = irq_desc[irq].action;
/*
* For normal interrupts, we mask it out, and then ACK it.
if (!(PROBE_MASK & (1UL << i))) {
continue;
}
- action = irq_action[i];
+ action = irq_desc[i].action;
if (!action) {
enable_irq(i);
irqs |= (1UL << i);
+++ /dev/null
-/*
- * linux/arch/alpha/kernel/irq.h
- *
- * Copyright (C) 1995 Linus Torvalds
- * Copyright (C) 1998 Richard Henderson
- *
- * This file contains declarations and inline functions for interfacing
- * with the IRQ handling routines in irq.c.
- */
-
-#include <linux/config.h>
-
-#define STANDARD_INIT_IRQ_PROLOG \
- outb(0, DMA1_RESET_REG); \
- outb(0, DMA2_RESET_REG); \
- outb(0, DMA1_CLR_MASK_REG); \
- outb(0, DMA2_CLR_MASK_REG)
-
-extern unsigned long _alpha_irq_masks[2];
-#define alpha_irq_mask _alpha_irq_masks[0]
-
-extern void common_ack_irq(unsigned long irq);
-extern void isa_device_interrupt(unsigned long vector, struct pt_regs * regs);
-extern void srm_device_interrupt(unsigned long vector, struct pt_regs * regs);
-
-extern void handle_irq(int irq, int ack, struct pt_regs * regs);
-
-#define RTC_IRQ 8
-#ifdef CONFIG_RTC
-#define TIMER_IRQ 0 /* timer is the pit */
-#else
-#define TIMER_IRQ RTC_IRQ /* timer is the rtc */
-#endif
-
-/*
- * PROBE_MASK is the bitset of irqs that we consider for autoprobing.
- */
-
-/* NOTE: we only handle the first 64 IRQs in this code. */
-
-/* The normal mask includes all the IRQs except timer IRQ 0. */
-#define _PROBE_MASK(nr_irqs) \
- (((nr_irqs > 63) ? ~0UL : ((1UL << (nr_irqs & 63)) - 1)) & ~1UL)
-
-/* Mask out unused timer irq 0 and RTC irq 8. */
-#define P2K_PROBE_MASK (_PROBE_MASK(16) & ~0x101UL)
-
-/* Mask out unused timer irq 0, "irqs" 20-30, and the EISA cascade. */
-#define ALCOR_PROBE_MASK (_PROBE_MASK(48) & ~0xfff000000001UL)
-
-/* Leave timer IRQ 0 in the mask. */
-#define RUFFIAN_PROBE_MASK (_PROBE_MASK(48) | 1UL)
-
-/* Do not probe/enable beyond the PCI devices. */
-#define TSUNAMI_PROBE_MASK _PROBE_MASK(48)
-
-#if defined(CONFIG_ALPHA_GENERIC)
-# define PROBE_MASK alpha_mv.irq_probe_mask
-#elif defined(CONFIG_ALPHA_P2K)
-# define PROBE_MASK P2K_PROBE_MASK
-#elif defined(CONFIG_ALPHA_ALCOR) || defined(CONFIG_ALPHA_XLT)
-# define PROBE_MASK ALCOR_PROBE_MASK
-#elif defined(CONFIG_ALPHA_RUFFIAN)
-# define PROBE_MASK RUFFIAN_PROBE_MASK
-#elif defined(CONFIG_ALPHA_DP264)
-# define PROBE_MASK TSUNAMI_PROBE_MASK
-#else
-# define PROBE_MASK _PROBE_MASK(NR_IRQS)
-#endif
-
-
-extern char _stext;
-static inline void alpha_do_profile (unsigned long pc)
-{
- if (prof_buffer && current->pid) {
- pc -= (unsigned long) &_stext;
- pc >>= prof_shift;
- /*
- * Don't ignore out-of-bounds PC values silently,
- * put them into the last histogram slot, so if
- * present, they will show up as a sharp peak.
- */
- if (pc > prof_len - 1)
- pc = prof_len - 1;
- atomic_inc((atomic_t *)&prof_buffer[pc]);
- }
-}
dev->class = PCI_CLASS_BRIDGE_ISA;
}
+static void __init
+quirk_vga_enable_rom(struct pci_dev *dev)
+{
+ /* If it's a VGA, enable its BIOS ROM at C0000.
+ But if its a Cirrus 543x/544x DISABLE it, since
+ enabling ROM disables the memory... */
+ if ((dev->class >> 8) == PCI_CLASS_DISPLAY_VGA &&
+ /* But if its a Cirrus 543x/544x DISABLE it */
+ (dev->vendor != PCI_VENDOR_ID_CIRRUS ||
+ (dev->device < 0x00a0) || (dev->device > 0x00ac)))
+ {
+ u32 reg;
+
+ pci_read_config_dword(dev, dev->rom_base_reg, ®);
+ reg |= PCI_ROM_ADDRESS_ENABLE;
+ pci_write_config_dword(dev, dev->rom_base_reg, reg);
+ dev->resource[PCI_ROM_RESOURCE].flags |= PCI_ROM_ADDRESS_ENABLE;
+ }
+}
+
struct pci_fixup pcibios_fixups[] __initdata = {
{ PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82375,
quirk_eisa_bridge },
{ PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82378,
quirk_isa_bridge },
+ { PCI_FIXUP_FINAL, PCI_ANY_ID, PCI_ANY_ID, quirk_vga_enable_rom },
{ 0 }
};
#define MB (1024*KB)
#define GB (1024*MB)
-void __init
+void
pcibios_align_resource(void *data, struct resource *res, unsigned long size)
{
struct pci_dev * dev = data;
static void __init
pcibios_assign_special(struct pci_dev * dev)
{
+ int i;
+
/* The first three resources of an IDE controler are often magic,
so leave them unchanged. This is true, for instance, of the
Contaq 82C693 as seen on SX164 and DP264. */
if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE) {
- int i;
-
/* Resource 1 of IDE controller is the address of HD_CMD
register which actually occupies a single byte (0x3f6
for ide0) in reported 0x3f4-3f7 range. We have to fix
if (dev->resource[i].flags && dev->resource[i].start)
pci_claim_resource(dev, i);
}
+ /*
+ * We don't have code that will init the CYPRESS bridge correctly
+ * so we do the next best thing, and depend on the previous
+ * console code to do the right thing, and ignore it here... :-\
+ */
+ else if (dev->vendor == PCI_VENDOR_ID_CONTAQ &&
+ dev->device == PCI_DEVICE_ID_CONTAQ_82C693)
+ for (i = 0; i < PCI_NUM_RESOURCES; i++)
+ if (dev->resource[i].flags && dev->resource[i].start)
+ pci_claim_resource(dev, i);
}
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/spinlock.h>
+#include <linux/irq.h>
#include <asm/hwrpb.h>
#include <asm/ptrace.h>
#include <asm/unistd.h>
#include "proto.h"
-#include "irq_impl.h"
#define DEBUG_SMP 0
/* A collection of single bit ipi messages. */
static struct {
- unsigned long bits __cacheline_aligned;
-} ipi_data[NR_CPUS];
+ unsigned long bits ____cacheline_aligned;
+} ipi_data[NR_CPUS] __cacheline_aligned;
enum ipi_message_type {
IPI_RESCHEDULE,
IPI_CPU_STOP,
};
-spinlock_t kernel_flag __cacheline_aligned = SPIN_LOCK_UNLOCKED;
+spinlock_t kernel_flag = SPIN_LOCK_UNLOCKED;
/* Set to a secondary's cpuid when it comes online. */
static unsigned long smp_secondary_alive;
#include <asm/core_cia.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
#include <asm/core_pyxis.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
init_irq: cabriolet_init_irq,
init_pit: common_init_pit,
init_pci: cabriolet_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: cabriolet_map_irq,
pci_swizzle: common_swizzle,
};
init_irq: cabriolet_init_irq,
init_pit: common_init_pit,
init_pci: cabriolet_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: eb66p_map_irq,
pci_swizzle: common_swizzle,
};
init_irq: cabriolet_init_irq,
init_pit: common_init_pit,
init_pci: alphapc164_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: alphapc164_map_irq,
pci_swizzle: common_swizzle,
};
init_irq: cabriolet_init_irq,
init_pit: common_init_pit,
init_pci: alphapc164_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: alphapc164_map_irq,
pci_swizzle: common_swizzle,
};
#include <asm/hwrpb.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
static void
dp264_update_irq_hw(unsigned long irq, unsigned long mask, int unmask_p)
{
- if (irq >= 16) {
- volatile unsigned long *csr;
+ volatile unsigned long *csr;
- if (TSUNAMI_bootcpu < 2)
- if (!TSUNAMI_bootcpu)
- csr = &TSUNAMI_cchip->dim0.csr;
- else
- csr = &TSUNAMI_cchip->dim1.csr;
+ if (TSUNAMI_bootcpu < 2) {
+ if (!TSUNAMI_bootcpu)
+ csr = &TSUNAMI_cchip->dim0.csr;
else
- if (TSUNAMI_bootcpu == 2)
- csr = &TSUNAMI_cchip->dim2.csr;
- else
- csr = &TSUNAMI_cchip->dim3.csr;
-
- *csr = ~mask;
- mb();
- *csr;
+ csr = &TSUNAMI_cchip->dim1.csr;
+ } else {
+ if (TSUNAMI_bootcpu == 2)
+ csr = &TSUNAMI_cchip->dim2.csr;
+ else
+ csr = &TSUNAMI_cchip->dim3.csr;
+ }
+
+ *csr = ~mask;
+ mb();
+ *csr;
+
+ if (irq < 16) {
+ if (irq >= 8)
+ outb(mask >> 8, 0xA1); /* ISA PIC2 */
+ else
+ outb(mask, 0x21); /* ISA PIC1 */
}
- else if (irq >= 8)
- outb(mask >> 8, 0xA1); /* ISA PIC2 */
- else
- outb(mask, 0x21); /* ISA PIC1 */
}
static void
struct pci_controler *hose = dev->sysdata;
int irq = COMMON_TABLE_LOOKUP;
- if (irq > 0)
+ if (irq > 0) {
irq += 16 * hose->index;
+ } else {
+ /* ??? The Contaq IDE controler on the ISA bridge uses
+ "legacy" interrupts 14 and 15. I don't know if anything
+ can wind up at the same slot+pin on hose1, so we'll
+ just have to trust whatever value the console might
+ have assigned. */
+
+ u8 irq8;
+ pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq8);
+ irq = irq8;
+ }
return irq;
}
#include <asm/core_lca.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
init_irq: eb64p_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: eb64p_map_irq,
pci_swizzle: common_swizzle,
};
#include <asm/hwrpb.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
#include <asm/pgtable.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "machvec_impl.h"
#include <asm/core_pyxis.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
#include <asm/core_cia.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
init_irq: mikasa_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: mikasa_map_irq,
pci_swizzle: common_swizzle,
};
#include <asm/hwrpb.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
#include <asm/core_cia.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
init_irq: noritake_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: noritake_map_irq,
pci_swizzle: noritake_swizzle,
};
#include <asm/core_mcpcia.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
#include <asm/core_pyxis.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
#include <asm/core_polaris.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
#include <asm/core_t2.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
init_irq: sable_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: sable_map_irq,
pci_swizzle: common_swizzle,
#include <asm/core_lca.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
init_irq: sio_init_irq,
init_pit: common_init_pit,
init_pci: noname_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: noname_map_irq,
pci_swizzle: common_swizzle,
init_irq: sio_init_irq,
init_pit: common_init_pit,
init_pci: noname_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: noname_map_irq,
pci_swizzle: common_swizzle,
init_irq: sio_init_irq,
init_pit: common_init_pit,
init_pci: noname_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: p2k_map_irq,
pci_swizzle: common_swizzle,
init_irq: sio_init_irq,
init_pit: common_init_pit,
init_pci: noname_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: noname_map_irq,
pci_swizzle: common_swizzle,
#include <asm/core_pyxis.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
#include <asm/core_cia.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
#include <linux/timex.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
extern rwlock_t xtime_lock;
extern volatile unsigned long lost_ticks; /* kernel/sched.c */
lo->lo_flags |= LO_FLAGS_READ_ONLY;
set_device_ro(dev, 1);
} else {
- invalidate_inode_pages (inode);
+ vmtruncate (inode, 0);
set_device_ro(dev, 0);
}
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/mm.h>
+#include <linux/cache.h>
#include <net/sock.h>
#include <asm/system.h>
-#include <asm/cache.h>
#include <asm/byteorder.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <linux/pci.h>
#include <linux/errno.h>
#include <linux/ioport.h>
-
-#include <asm/cache.h>
+#include <linux/cache.h>
#define DEBUG_CONFIG 0
pbus_set_ranges(bus, NULL);
}
-static void
+static void __init
pdev_fixup_irq(struct pci_dev *dev,
u8 (*swizzle)(struct pci_dev *, u8 *),
int (*map_irq)(struct pci_dev *, u8, u8))
/*****************************************************************************/
+#include <linux/config.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/string.h>
dquot->dq_flags |= DQ_MOD;
}
-static inline char need_print_warning(short type, uid_t initiator, struct dquot *dquot)
+static inline int need_print_warning(struct dquot *dquot, int flag)
{
- switch (type) {
+ switch (dquot->dq_type) {
case USRQUOTA:
- return(initiator == dquot->dq_id);
+ return current->fsuid == dquot->dq_id && !(dquot->dq_flags & flag);
case GRPQUOTA:
- return(initiator == dquot->dq_id);
+ return in_group_p(dquot->dq_id) && !(dquot->dq_flags & flag);
}
- return(0);
+ return 0;
}
-static inline char ignore_hardlimit(struct dquot *dquot, uid_t initiator)
+static void print_warning(struct dquot *dquot, int flag, char *fmtstr, ...)
{
- return(initiator == 0 && dquot->dq_mnt->mnt_dquot.rsquash[dquot->dq_type] == 0);
+ va_list args;
+
+ if (!need_print_warning(dquot, flag))
+ return;
+ va_start(args, fmtstr);
+ vsprintf(quotamessage, fmtstr, args);
+ va_end(args);
+ tty_write_message(current->tty, quotamessage);
+ dquot->dq_flags |= flag;
}
-static int check_idq(struct dquot *dquot, short type, u_long inodes, uid_t initiator,
- struct tty_struct *tty)
+static inline char ignore_hardlimit(struct dquot *dquot)
{
+ return capable(CAP_SYS_RESOURCE) && !dquot->dq_mnt->mnt_dquot.rsquash[dquot->dq_type];
+}
+
+static int check_idq(struct dquot *dquot, u_long inodes)
+{
+ short type = dquot->dq_type;
+
if (inodes <= 0 || dquot->dq_flags & DQ_FAKE)
- return(QUOTA_OK);
+ return QUOTA_OK;
if (dquot->dq_ihardlimit &&
(dquot->dq_curinodes + inodes) > dquot->dq_ihardlimit &&
- !ignore_hardlimit(dquot, initiator)) {
- if ((dquot->dq_flags & DQ_INODES) == 0 &&
- need_print_warning(type, initiator, dquot)) {
- sprintf(quotamessage, "%s: write failed, %s file limit reached\n",
- dquot->dq_mnt->mnt_dirname, quotatypes[type]);
- tty_write_message(tty, quotamessage);
- dquot->dq_flags |= DQ_INODES;
- }
- return(NO_QUOTA);
+ !ignore_hardlimit(dquot)) {
+ print_warning(dquot, DQ_INODES, "%s: write failed, %s file limit reached\n",
+ dquot->dq_mnt->mnt_dirname, quotatypes[type]);
+ return NO_QUOTA;
}
if (dquot->dq_isoftlimit &&
(dquot->dq_curinodes + inodes) > dquot->dq_isoftlimit &&
dquot->dq_itime && CURRENT_TIME >= dquot->dq_itime &&
- !ignore_hardlimit(dquot, initiator)) {
- if (need_print_warning(type, initiator, dquot)) {
- sprintf(quotamessage, "%s: warning, %s file quota exceeded too long.\n",
- dquot->dq_mnt->mnt_dirname, quotatypes[type]);
- tty_write_message(tty, quotamessage);
- }
- return(NO_QUOTA);
+ !ignore_hardlimit(dquot)) {
+ print_warning(dquot, DQ_INODES, "%s: warning, %s file quota exceeded too long.\n",
+ dquot->dq_mnt->mnt_dirname, quotatypes[type]);
+ return NO_QUOTA;
}
if (dquot->dq_isoftlimit &&
(dquot->dq_curinodes + inodes) > dquot->dq_isoftlimit &&
dquot->dq_itime == 0) {
- if (need_print_warning(type, initiator, dquot)) {
- sprintf(quotamessage, "%s: warning, %s file quota exceeded\n",
- dquot->dq_mnt->mnt_dirname, quotatypes[type]);
- tty_write_message(tty, quotamessage);
- }
+ print_warning(dquot, 0, "%s: warning, %s file quota exceeded\n",
+ dquot->dq_mnt->mnt_dirname, quotatypes[type]);
dquot->dq_itime = CURRENT_TIME + dquot->dq_mnt->mnt_dquot.inode_expire[type];
}
- return(QUOTA_OK);
+ return QUOTA_OK;
}
-static int check_bdq(struct dquot *dquot, short type, u_long blocks, uid_t initiator,
- struct tty_struct *tty, char warn)
+static int check_bdq(struct dquot *dquot, u_long blocks, char prealloc)
{
+ short type = dquot->dq_type;
+
if (blocks <= 0 || dquot->dq_flags & DQ_FAKE)
- return(QUOTA_OK);
+ return QUOTA_OK;
if (dquot->dq_bhardlimit &&
(dquot->dq_curblocks + blocks) > dquot->dq_bhardlimit &&
- !ignore_hardlimit(dquot, initiator)) {
- if (warn && (dquot->dq_flags & DQ_BLKS) == 0 &&
- need_print_warning(type, initiator, dquot)) {
- sprintf(quotamessage, "%s: write failed, %s disk limit reached.\n",
- dquot->dq_mnt->mnt_dirname, quotatypes[type]);
- tty_write_message(tty, quotamessage);
- dquot->dq_flags |= DQ_BLKS;
- }
- return(NO_QUOTA);
+ !ignore_hardlimit(dquot)) {
+ if (!prealloc)
+ print_warning(dquot, DQ_BLKS, "%s: write failed, %s disk limit reached.\n",
+ dquot->dq_mnt->mnt_dirname, quotatypes[type]);
+ return NO_QUOTA;
}
if (dquot->dq_bsoftlimit &&
(dquot->dq_curblocks + blocks) > dquot->dq_bsoftlimit &&
dquot->dq_btime && CURRENT_TIME >= dquot->dq_btime &&
- !ignore_hardlimit(dquot, initiator)) {
- if (warn && need_print_warning(type, initiator, dquot)) {
- sprintf(quotamessage, "%s: write failed, %s disk quota exceeded too long.\n",
- dquot->dq_mnt->mnt_dirname, quotatypes[type]);
- tty_write_message(tty, quotamessage);
- }
- return(NO_QUOTA);
+ !ignore_hardlimit(dquot)) {
+ if (!prealloc)
+ print_warning(dquot, DQ_BLKS, "%s: write failed, %s disk quota exceeded too long.\n",
+ dquot->dq_mnt->mnt_dirname, quotatypes[type]);
+ return NO_QUOTA;
}
if (dquot->dq_bsoftlimit &&
(dquot->dq_curblocks + blocks) > dquot->dq_bsoftlimit &&
dquot->dq_btime == 0) {
- if (warn && need_print_warning(type, initiator, dquot)) {
- sprintf(quotamessage, "%s: warning, %s disk quota exceeded\n",
- dquot->dq_mnt->mnt_dirname, quotatypes[type]);
- tty_write_message(tty, quotamessage);
+ if (!prealloc) {
+ print_warning(dquot, 0, "%s: warning, %s disk quota exceeded\n",
+ dquot->dq_mnt->mnt_dirname, quotatypes[type]);
+ dquot->dq_btime = CURRENT_TIME + dquot->dq_mnt->mnt_dquot.block_expire[type];
}
- dquot->dq_btime = CURRENT_TIME + dquot->dq_mnt->mnt_dquot.block_expire[type];
+ else
+ /*
+ * We don't allow preallocation to exceed softlimit so exceeding will
+ * be always printed
+ */
+ return NO_QUOTA;
}
- return(QUOTA_OK);
+ return QUOTA_OK;
}
/*
/*
* Note: this is a blocking operation.
*/
-int dquot_alloc_block(const struct inode *inode, unsigned long number, uid_t initiator,
- char warn)
+int dquot_alloc_block(const struct inode *inode, unsigned long number, char warn)
{
int cnt;
- struct tty_struct *tty = current->tty;
struct dquot *dquot[MAXQUOTAS];
for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
if (dquot[cnt] == NODQUOT)
continue;
lock_dquot(dquot[cnt]);
- if (check_bdq(dquot[cnt], cnt, number, initiator, tty, warn))
+ if (check_bdq(dquot[cnt], number, warn))
goto put_all;
}
/*
* Note: this is a blocking operation.
*/
-int dquot_alloc_inode(const struct inode *inode, unsigned long number, uid_t initiator)
+int dquot_alloc_inode(const struct inode *inode, unsigned long number)
{
int cnt;
- struct tty_struct *tty = current->tty;
struct dquot *dquot[MAXQUOTAS];
for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
if (dquot[cnt] == NODQUOT)
continue;
lock_dquot(dquot[cnt]);
- if (check_idq(dquot[cnt], cnt, number, initiator, tty))
+ if (check_idq(dquot[cnt], number))
goto put_all;
}
*
* Note: this is a blocking operation.
*/
-int dquot_transfer(struct dentry *dentry, struct iattr *iattr, uid_t initiator)
+int dquot_transfer(struct dentry *dentry, struct iattr *iattr)
{
struct inode *inode = dentry -> d_inode;
unsigned long blocks;
struct dquot *transfer_from[MAXQUOTAS];
struct dquot *transfer_to[MAXQUOTAS];
- struct tty_struct *tty = current->tty;
short cnt, disc;
int error = -EDQUOT;
* invalidated or locked...
*/
if (!transfer_to[cnt]->dq_mnt || !transfer_from[cnt]->dq_mnt ||
- check_idq(transfer_to[cnt], cnt, 1, initiator, tty) == NO_QUOTA ||
- check_bdq(transfer_to[cnt], cnt, blocks, initiator, tty, 0) == NO_QUOTA) {
+ check_idq(transfer_to[cnt], 1) == NO_QUOTA ||
+ check_bdq(transfer_to[cnt], blocks, 0) == NO_QUOTA) {
cnt++;
goto put_all;
}
static inline int check_quotafile_size(loff_t size)
{
ulong blocks = size >> BLOCK_SIZE_BITS;
- size_t off = size & ~(BLOCK_SIZE - 1);
+ size_t off = size & (BLOCK_SIZE - 1);
- return !((blocks % sizeof(struct dqblk) + off % sizeof(struct dqblk)) % sizeof(struct dqblk));
+ return !(((blocks % sizeof(struct dqblk)) * BLOCK_SIZE + off % sizeof(struct dqblk)) % sizeof(struct dqblk));
}
int quota_on(kdev_t dev, short type, char *path)
break;
case Q_GETQUOTA:
if (((type == USRQUOTA && current->euid != id) ||
- (type == GRPQUOTA && in_group_p(id))) &&
+ (type == GRPQUOTA && in_egroup_p(id))) &&
!capable(CAP_SYS_RESOURCE))
goto out;
break;
#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
#define SMP_CACHE_BYTES L1_CACHE_BYTES
-#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
-
#endif
#define hardirq_trylock(cpu) (local_irq_count(cpu) == 0)
#define hardirq_endlock(cpu) ((void) 0)
-#define hardirq_enter(cpu, irq) (local_irq_count(cpu)++)
-#define hardirq_exit(cpu, irq) (local_irq_count(cpu)--)
+#define irq_enter(cpu, irq) (local_irq_count(cpu)++)
+#define irq_exit(cpu, irq) (local_irq_count(cpu)--)
#define synchronize_irq() barrier()
}
}
-static inline void hardirq_enter(int cpu, int irq)
+static inline void irq_enter(int cpu, int irq)
{
++local_irq_count(cpu);
atomic_inc(&global_irq_count);
+
+ while (spin_is_locked(&global_irq_lock))
+ barrier();
}
-static inline void hardirq_exit(int cpu, int irq)
+static inline void irq_exit(int cpu, int irq)
{
atomic_dec(&global_irq_count);
--local_irq_count(cpu);
static inline int hardirq_trylock(int cpu)
{
- return (!atomic_read(&global_irq_count)
- && !spin_is_locked(&global_irq_lock));
+ return !local_irq_count(cpu) && !spin_is_locked(&global_irq_lock);
}
-#define hardirq_endlock(cpu) ((void)0)
+#define hardirq_endlock(cpu) do { } while (0)
extern void synchronize_irq(void);
--- /dev/null
+#ifndef _ALPHA_HW_IRQ_H
+#define _ALPHA_HW_IRQ_H
+/*
+ * linux/arch/alpha/kernel/irq.h
+ *
+ * Copyright (C) 1995 Linus Torvalds
+ * Copyright (C) 1998 Richard Henderson
+ *
+ * This file contains declarations and inline functions for interfacing
+ * with the IRQ handling routines in irq.c.
+ */
+
+#include <linux/config.h>
+
+#define STANDARD_INIT_IRQ_PROLOG \
+ outb(0, DMA1_RESET_REG); \
+ outb(0, DMA2_RESET_REG); \
+ outb(0, DMA1_CLR_MASK_REG); \
+ outb(0, DMA2_CLR_MASK_REG)
+
+extern unsigned long _alpha_irq_masks[2];
+#define alpha_irq_mask _alpha_irq_masks[0]
+
+extern void common_ack_irq(unsigned long irq);
+extern void isa_device_interrupt(unsigned long vector, struct pt_regs * regs);
+extern void srm_device_interrupt(unsigned long vector, struct pt_regs * regs);
+
+extern void handle_irq(int irq, int ack, struct pt_regs * regs);
+
+#define RTC_IRQ 8
+#ifdef CONFIG_RTC
+#define TIMER_IRQ 0 /* timer is the pit */
+#else
+#define TIMER_IRQ RTC_IRQ /* timer is the rtc */
+#endif
+
+/*
+ * PROBE_MASK is the bitset of irqs that we consider for autoprobing.
+ */
+
+/* NOTE: we only handle the first 64 IRQs in this code. */
+
+/* The normal mask includes all the IRQs except timer IRQ 0. */
+#define _PROBE_MASK(nr_irqs) \
+ (((nr_irqs > 63) ? ~0UL : ((1UL << (nr_irqs & 63)) - 1)) & ~1UL)
+
+/* Mask out unused timer irq 0 and RTC irq 8. */
+#define P2K_PROBE_MASK (_PROBE_MASK(16) & ~0x101UL)
+
+/* Mask out unused timer irq 0, "irqs" 20-30, and the EISA cascade. */
+#define ALCOR_PROBE_MASK (_PROBE_MASK(48) & ~0xfff000000001UL)
+
+/* Leave timer IRQ 0 in the mask. */
+#define RUFFIAN_PROBE_MASK (_PROBE_MASK(48) | 1UL)
+
+/* Do not probe/enable beyond the PCI devices. */
+#define TSUNAMI_PROBE_MASK _PROBE_MASK(48)
+
+#if defined(CONFIG_ALPHA_GENERIC)
+# define PROBE_MASK alpha_mv.irq_probe_mask
+#elif defined(CONFIG_ALPHA_P2K)
+# define PROBE_MASK P2K_PROBE_MASK
+#elif defined(CONFIG_ALPHA_ALCOR) || defined(CONFIG_ALPHA_XLT)
+# define PROBE_MASK ALCOR_PROBE_MASK
+#elif defined(CONFIG_ALPHA_RUFFIAN)
+# define PROBE_MASK RUFFIAN_PROBE_MASK
+#elif defined(CONFIG_ALPHA_DP264)
+# define PROBE_MASK TSUNAMI_PROBE_MASK
+#else
+# define PROBE_MASK _PROBE_MASK(NR_IRQS)
+#endif
+
+
+extern char _stext;
+static inline void alpha_do_profile (unsigned long pc)
+{
+ if (prof_buffer && current->pid) {
+ pc -= (unsigned long) &_stext;
+ pc >>= prof_shift;
+ /*
+ * Don't ignore out-of-bounds PC values silently,
+ * put them into the last histogram slot, so if
+ * present, they will show up as a sharp peak.
+ */
+ if (pc > prof_len - 1)
+ pc = prof_len - 1;
+ atomic_inc((atomic_t *)&prof_buffer[pc]);
+ }
+}
+
+#endif
extern void disable_irq_nosync(unsigned int);
extern void enable_irq(unsigned int);
-extern void irq_enter(int cpu, int irq);
-extern void irq_exit(int cpu, int irq);
-
struct pt_regs;
extern void (*perf_irq)(unsigned long, struct pt_regs *);
#define L1_CACHE_BYTES 16
#endif
-#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
-
-#define SMP_CACHE_BYTES L1_CACHE_BYTES
-
-#ifdef MODULE
-#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
-#else
-#define __cacheline_aligned \
- __attribute__((__aligned__(L1_CACHE_BYTES), \
- __section__(".data.cacheline_aligned")))
-#endif
-
#endif
#define hardirq_trylock(cpu) (local_irq_count[cpu] == 0)
#define hardirq_endlock(cpu) do { } while (0)
-#define hardirq_enter(cpu) (local_irq_count[cpu]++)
-#define hardirq_exit(cpu) (local_irq_count[cpu]--)
+#define irq_enter(cpu, irq) (local_irq_count[cpu]++)
+#define irq_exit(cpu, irq) (local_irq_count[cpu]--)
#define synchronize_irq() barrier()
}
}
-static inline void hardirq_enter(int cpu)
+static inline void irq_enter(int cpu, int irq)
{
++local_irq_count[cpu];
atomic_inc(&global_irq_count);
+
+ while (test_bit(0,&global_irq_lock)) {
+ /* nothing */;
+ }
}
-static inline void hardirq_exit(int cpu)
+static inline void irq_exit(int cpu, int irq)
{
atomic_dec(&global_irq_count);
--local_irq_count[cpu];
* the 4 pgd entries internally, so there is no extra memory
* load on TLB miss, despite one more level of indirection.
*/
-#define pgd_none(x) (pgd_val(x) == 1ULL)
+#define EMPTY_PGD (__pa(empty_zero_page) + 1)
+#define pgd_none(x) (pgd_val(x) == EMPTY_PGD)
extern inline int pgd_bad(pgd_t pgd) { return 0; }
extern inline int pgd_present(pgd_t pgd) { return !pgd_none(pgd); }
*/
extern inline void __pgd_clear (pgd_t * pgd)
{
- set_pgd(pgd, __pgd(1ULL));
+ set_pgd(pgd, __pgd(EMPTY_PGD));
}
extern inline void pgd_clear (pgd_t * pgd)
__asm__ __volatile__("invlpg %0": :"m" (*(char *) addr))
#endif
+/*
+ * ZERO_PAGE is a global shared page that is always zero: used
+ * for zero-mapped memory areas etc..
+ */
+extern unsigned long empty_zero_page[1024];
+#define ZERO_PAGE(vaddr) (mem_map + MAP_NR(empty_zero_page))
+
#endif /* !__ASSEMBLY__ */
/*
/* page table for 0-4MB for everybody */
extern unsigned long pg0[1024];
-/*
- * ZERO_PAGE is a global shared page that is always zero: used
- * for zero-mapped memory areas etc..
- */
-extern unsigned long empty_zero_page[1024];
-#define ZERO_PAGE(vaddr) (mem_map + MAP_NR(empty_zero_page))
-
/*
* Handling allocation failures during page table setup.
*/
__asm__ __volatile__ (
"1: movl (%0), %%eax;
movl 4(%0), %%edx;
- lock; cmpxchg8b (%0);
+ cmpxchg8b (%0);
jnz 1b"
:: "D"(ptr),
"b"(low),
#include <asm/pgtable.h>
#include <asm/dma.h>
-#include <asm/cache.h>
+#include <linux/cache.h>
#include <linux/init.h>
/*
--- /dev/null
+#ifndef __LINUX_CACHE_H
+#define __LINUX_CACHE_H
+
+#include <asm/cache.h>
+
+#ifndef L1_CACHE_ALIGN
+#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
+#endif
+
+#ifndef SMP_CACHE_BYTES
+#define SMP_CACHE_BYTES L1_CACHE_BYTES
+#endif
+
+#ifndef ____cacheline_aligned
+#define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
+#endif
+
+#ifndef __cacheline_aligned
+#ifdef MODULE
+#define __cacheline_aligned ____cacheline_aligned
+#else
+#define __cacheline_aligned \
+ __attribute__((__aligned__(SMP_CACHE_BYTES), \
+ __section__(".data.cacheline_aligned")))
+#endif
+#endif /* __cacheline_aligned */
+
+#endif /* __LINUX_CACHE_H */
#include <linux/list.h>
#include <linux/dcache.h>
#include <linux/stat.h>
+#include <linux/cache.h>
#include <asm/atomic.h>
#include <asm/bitops.h>
-#include <asm/cache.h>
struct poll_table_struct;
struct dquot_operations {
void (*initialize) (struct inode *, short);
void (*drop) (struct inode *);
- int (*alloc_block) (const struct inode *, unsigned long, uid_t, char);
- int (*alloc_inode) (const struct inode *, unsigned long, uid_t);
+ int (*alloc_block) (const struct inode *, unsigned long, char);
+ int (*alloc_inode) (const struct inode *, unsigned long);
void (*free_block) (const struct inode *, unsigned long);
void (*free_inode) (const struct inode *, unsigned long);
- int (*transfer) (struct dentry *, struct iattr *, uid_t);
+ int (*transfer) (struct dentry *, struct iattr *);
};
struct file_system_type {
independent code */
struct irqaction *action; /* IRQ action list */
unsigned int depth; /* Disable depth for nested irq disables */
-} irq_desc_t;
+} ____cacheline_aligned irq_desc_t;
#include <asm/hw_irq.h> /* the arch dependent stuff */
extern spinlock_t irq_controller_lock;
extern int setup_irq(unsigned int , struct irqaction * );
-#ifdef __SMP__
-
-#include <asm/atomic.h>
-
-static inline void irq_enter(int cpu, unsigned int irq)
-{
- hardirq_enter(cpu);
- while (test_bit(0,&global_irq_lock)) {
- /* nothing */;
- }
-}
-
-static inline void irq_exit(int cpu, unsigned int irq)
-{
- hardirq_exit(cpu);
-}
-#else
-#define irq_enter(cpu, irq) (++local_irq_count[cpu])
-#define irq_exit(cpu, irq) (--local_irq_count[cpu])
-#endif
-
extern hw_irq_controller no_irq_type; /* needed in every arch ? */
#endif /* __asm_h */
/*
* Convert diskblocks to blocks and the other way around.
*/
-#define dbtob(num) (num << 10)
-#define btodb(num) (num >> 10)
+#define dbtob(num) (num << BLOCK_SIZE_BITS)
+#define btodb(num) (num >> BLOCK_SIZE_BITS)
/*
* Convert count of filesystem blocks to diskquota blocks, meant
extern int quota_off(kdev_t dev, short type);
extern int sync_dquots(kdev_t dev, short type);
-extern int dquot_alloc_block(const struct inode *inode, unsigned long number,
- uid_t initiator, char warn);
-extern int dquot_alloc_inode(const struct inode *inode, unsigned long number,
- uid_t initiator);
+extern int dquot_alloc_block(const struct inode *inode, unsigned long number, char prealloc);
+extern int dquot_alloc_inode(const struct inode *inode, unsigned long number);
extern void dquot_free_block(const struct inode *inode, unsigned long number);
extern void dquot_free_inode(const struct inode *inode, unsigned long number);
-extern int dquot_transfer(struct dentry *dentry, struct iattr *iattr,
- uid_t initiator);
+extern int dquot_transfer(struct dentry *dentry, struct iattr *iattr);
/*
* Operations supported for diskquotas.
extern __inline__ int DQUOT_PREALLOC_BLOCK(struct super_block *sb, const struct inode *inode, int nr)
{
if (sb->dq_op) {
- if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize),
- current->fsuid, 0) == NO_QUOTA)
+ if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize), 1) == NO_QUOTA)
return 1;
}
return 0;
extern __inline__ int DQUOT_ALLOC_BLOCK(struct super_block *sb, const struct inode *inode, int nr)
{
if (sb->dq_op) {
- if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize),
- current->fsuid, 1) == NO_QUOTA)
+ if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize), 0) == NO_QUOTA)
return 1;
}
return 0;
{
if (sb->dq_op) {
sb->dq_op->initialize (inode, -1);
- if (sb->dq_op->alloc_inode (inode, 1, current->fsuid))
+ if (sb->dq_op->alloc_inode (inode, 1))
return 1;
}
inode->i_flags |= S_QUOTA;
if (dentry->d_inode->i_sb->dq_op) {
dentry->d_inode->i_sb->dq_op->initialize(dentry->d_inode, -1);
- error = dentry->d_inode->i_sb->dq_op->transfer(dentry, iattr, current->fsuid);
+ error = dentry->d_inode->i_sb->dq_op->transfer(dentry, iattr);
} else {
error = notify_change(dentry, iattr);
}
#define wake_up_interruptible_sync(x) __wake_up_sync((x),TASK_INTERRUPTIBLE)
extern int in_group_p(gid_t);
+extern int in_egroup_p(gid_t);
extern void flush_signals(struct task_struct *);
extern void flush_signal_handlers(struct task_struct *);
typedef struct kmem_cache_s kmem_cache_t;
#include <linux/mm.h>
-#include <asm/cache.h>
+#include <linux/cache.h>
/* flags for kmem_cache_alloc() */
#define SLAB_BUFFER GFP_BUFFER
}
/* Like in_group_p, but testing against egid, not fsgid */
-static int in_egroup_p(gid_t grp)
+int in_egroup_p(gid_t grp)
{
if (grp != current->egid) {
int i = current->ngroups;
/* is it a page-cache page? */
if (page->mapping) {
- dispose = &old;
if (!pgcache_under_min())
{
remove_page_from_inode_queue(page);
It sends the data to the socket indicated by desc->buf.
*/
-static int sock_send_actor(read_descriptor_t * desc, const char *area, unsigned long size)
+static int sock_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size)
{
int written;
+ unsigned long kaddr;
unsigned long count = desc->count;
struct socket *sock = (struct socket *) desc->buf;
+ mm_segment_t old_fs;
if (size > count)
size = count;
- written = SendBuffer_async(sock,(char *)area,size);
+ old_fs = get_fs();
+ set_fs(KERNEL_DS);
+ kaddr = kmap(page);
+ written = SendBuffer_async(sock,(char *)kaddr + offset,size);
+ kunmap(page);
+ set_fs(old_fs);
if (written < 0) {
desc->error = written;
written = 0;
*
****************************************************************/
+
+static int errno;
+#define __KERNEL_SYSCALLS__
+
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
static int CountBuf[CONFIG_KHTTPD_NUMCPU];
-static int errno;
-inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options);
-
/*
# Change a lot of places to call set_x_info uniformly.
# Take out message about preparing version (old sound driver cruft).
#
-# 13 Dec 1998, Riley H Williams (rhw@bigfoot.com)
+# 13 Dec 1998, Riley H Williams <rhw@memalpha.cx>
# When an error occurs, actually display the error message as well as
# our comments thereon.
#