N: Tim Waugh
E: tim@cyberelk.demon.co.uk
D: Co-architect of the parallel-port sharing system
-S: 4 Fox Close
-S: Bishopstoke
-S: SO50 8NB
+S: 34 Bladon Close
+S: GUILDFORD
+S: Surrey
+S: GU1 1TY
S: United Kingdom
N: Juergen Weigert
# LocalWords: EBSA chattr RiscOS Winmodem AGP Atomwide DUALSP pcsp robinson CT
# LocalWords: SGALAXY Waverider DSPxxx TRXPRO AudioTrix OSWF MOT CFB DSY kbps
# LocalWords: tuwien kkudielk LVD mega lun MAXTAGS Gbps arcnet Olicom SKTR SNA
-# LocalWords: SysKonnect sktr sna etherboot ufs NetBEUI MultiSound MSNDCLAS GX
+# LocalWords: SysKonnect tms380tr sna etherboot ufs NetBEUI MultiSound MSNDCLAS GX
# LocalWords: MSNDINIT MSNDPERM MSNDPIN PNDSPINI PNDSPERM Ensoniq's RetinaZ SS
# LocalWords: AudioPCI lspci SonicVibes sonicvibes SPARCs roadrunner CLgen UPA
# LocalWords: swansea shtml Zoltrix zoltrix BINUTILS EGCS binutils VIDC DACs
symlinks:
rm -f include/asm
( cd include ; ln -sf asm-$(ARCH) asm)
- @if [ ! -d modules ]; then \
- mkdir modules; \
- fi
@if [ ! -d include/linux/modules ]; then \
mkdir include/linux/modules; \
fi
modules: $(patsubst %, _mod_%, $(SUBDIRS))
-$(patsubst %, _mod_%, $(SUBDIRS)) : include/linux/version.h include/config/MARKER
+modules/MARKER:
+ mkdir modules
+ touch modules/MARKER
+
+$(patsubst %, _mod_%, $(SUBDIRS)) : include/linux/version.h include/config/MARKER modules/MARKER
$(MAKE) -C $(patsubst _mod_%, %, $@) CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules
modules_install:
#include "map.h"
+#define SIZE(x) (sizeof(x) / sizeof(x[0]))
+
const struct map_desc io_desc[] __initdata = {
{ IO_BASE - PGDIR_SIZE, 0xc0000000, PGDIR_SIZE, DOMAIN_IO, 0, 1, 0, 0 },
{ IO_BASE , IO_START , IO_SIZE , DOMAIN_IO, 0, 1, 0, 0 }
};
-#define SIZEOFMAP (sizeof(mapping) / sizeof(mapping[0]))
-
-unsigned int __initdata io_desc_size = SIZEOFMAP;
+unsigned int __initdata io_desc_size = SIZE(io_desc);
#include "map.h"
+#define SIZE(x) (sizeof(x) / sizeof(x[0]))
+
/*
* The first entry allows us to fiddle with the EEPROM from user-space.
* This entry will go away in time, once the fmu32 can mmap() the
MAPPING
};
-#define SIZE(x) (sizeof(x) / sizeof(x[0]))
-
unsigned int __initdata io_desc_size = SIZE(io_desc);
#include "map.h"
+#define SIZE(x) (sizeof(x) / sizeof(x[0]))
+
const struct map_desc io_desc[] __initdata = {
{ 0xfff00000, 0x10000000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 },
{ 0xffe00000, 0x20000000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 },
{ 0xfd000000, 0x88000000, 0x00100000, DOMAIN_IO, 0, 1, 0, 0 }
};
-#define SIZEOFMAP (sizeof(mapping) / sizeof(mapping[0]))
-
-unsigned int __initdata io_desc_size = SIZEOFMAP;
+unsigned int __initdata io_desc_size = SIZE(io_desc);
#include "map.h"
+#define SIZE(x) (sizeof(x) / sizeof(x[0]))
+
/* Logical Physical
* 0xffff1000 0x00100000 DMA registers
* 0xffff2000 0x00200000 MPEG
{ 0xffffe000, 0x00e00000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }
};
-#define SIZEOFMAP (sizeof(mapping) / sizeof(mapping[0]))
-
-unsigned int __initdata io_desc_size = SIZEOFMAP;
+unsigned int __initdata io_desc_size = SIZE(io_desc);
.long SYMBOL_NAME(sys_sigpending)
.long SYMBOL_NAME(sys_sethostname)
.long SYMBOL_NAME(sys_setrlimit) /* 75 */
- .long SYMBOL_NAME(sys_getrlimit)
+ .long SYMBOL_NAME(sys_old_getrlimit)
.long SYMBOL_NAME(sys_getrusage)
.long SYMBOL_NAME(sys_gettimeofday)
.long SYMBOL_NAME(sys_settimeofday)
.long SYMBOL_NAME(sys_ni_syscall) /* streams1 */
.long SYMBOL_NAME(sys_ni_syscall) /* streams2 */
.long SYMBOL_NAME(sys_vfork) /* 190 */
+ .long SYMBOL_NAME(sys_getrlimit)
/*
* NOTE!! This doesn't have to be exact - we just have
* entries. Don't panic if you notice that this hasn't
* been shrunk every time we add a new system call.
*/
- .rept NR_syscalls-190
+ .rept NR_syscalls-191
.long SYMBOL_NAME(sys_ni_syscall)
.endr
/*
* Has to be called with the request spinlock aquired
*/
-static inline void attempt_merge (struct request *req, int max_sectors)
+static inline void attempt_merge (struct request *req,
+ int max_sectors,
+ int max_segments)
{
struct request *next = req->next;
+ int total_segments;
if (!next)
return;
return;
if (next->sem || req->cmd != next->cmd || req->rq_dev != next->rq_dev || req->nr_sectors + next->nr_sectors > max_sectors)
return;
+ total_segments = req->nr_segments + next->nr_segments;
+ if (req->bhtail->b_data + req->bhtail->b_size == next->bh->b_data)
+ total_segments--;
+ if (total_segments > max_segments)
+ return;
req->bhtail->b_reqnext = next->bh;
req->bhtail = next->bhtail;
req->nr_sectors += next->nr_sectors;
+ req->nr_segments = total_segments;
next->rq_status = RQ_INACTIVE;
req->next = next->next;
wake_up (&wait_for_request);
{
unsigned int sector, count;
struct request * req;
- int rw_ahead, max_req, max_sectors;
+ int rw_ahead, max_req, max_sectors, max_segments;
unsigned long flags;
count = bh->b_size >> 9;
* Try to coalesce the new request with old requests
*/
max_sectors = get_max_sectors(bh->b_rdev);
+ max_segments = get_max_segments(bh->b_rdev);
/*
* Now we acquire the request spinlock, we have to be mega careful
continue;
/* Can we add it to the end of this request? */
if (req->sector + req->nr_sectors == sector) {
+ if (req->bhtail->b_data + req->bhtail->b_size
+ != bh->b_data) {
+ if (req->nr_segments < max_segments)
+ req->nr_segments++;
+ else continue;
+ }
req->bhtail->b_reqnext = bh;
req->bhtail = bh;
req->nr_sectors += count;
drive_stat_acct(req, count, 0);
/* Can we now merge this req with the next? */
- attempt_merge(req, max_sectors);
+ attempt_merge(req, max_sectors, max_segments);
/* or to the beginning? */
} else if (req->sector - count == sector) {
+ if (bh->b_data + bh->b_size
+ != req->bh->b_data) {
+ if (req->nr_segments < max_segments)
+ req->nr_segments++;
+ else continue;
+ }
bh->b_reqnext = req->bh;
req->bh = bh;
req->buffer = bh->b_data;
req->errors = 0;
req->sector = sector;
req->nr_sectors = count;
+ req->nr_segments = 1;
req->current_nr_sectors = count;
req->buffer = bh->b_data;
req->sem = NULL;
if [ "$CONFIG_RADIO_TERRATEC" = "y" ]; then
hex ' Terratec i/o port (normally 0x590)' CONFIG_RADIO_TERRATEC_PORT 590
fi
+ dep_tristate 'Trust FM radio card' CONFIG_RADIO_TRUST $CONFIG_VIDEO_DEV
+ if [ "$CONFIG_RADIO_TRUST" = "y" ]; then
+ hex ' Trust i/o port (usually 0x350 or 0x358)' CONFIG_RADIO_TRUST_PORT 350
+ fi
if [ "$CONFIG_PCI" != "n" ]; then
dep_tristate 'BT848 Video For Linux' CONFIG_VIDEO_BT848 $CONFIG_VIDEO_DEV
fi
else
ifeq ($(CONFIG_SOFT_WATCHDOG),m)
M_OBJS += softdog.o
- endif
+ endif
endif
ifeq ($(CONFIG_PCWATCHDOG),y)
ifeq ($(CONFIG_RADIO_AZTECH),m)
M_OBJS += radio-aztech.o
endif
-endif
+endif
+
+ifeq ($(CONFIG_RADIO_RTRACK2),y)
+O_OBJS += radio-rtrack2.o
+else
+ ifeq ($(CONFIG_RADIO_RTRACK2),m)
+ M_OBJS += radio-rtrack2.o
+ endif
+endif
ifeq ($(CONFIG_RADIO_SF16FMI),y)
O_OBJS += radio-sf16fmi.o
ifeq ($(CONFIG_RADIO_SF16FMI),m)
M_OBJS += radio-sf16fmi.o
endif
-endif
-
-ifeq ($(CONFIG_RADIO_RTRACK),y)
-O_OBJS += radio-aimslab.o
-else
- ifeq ($(CONFIG_RADIO_RTRACK),m)
- M_OBJS += radio-aimslab.o
- endif
-endif
+endif
-ifeq ($(CONFIG_RADIO_RTRACK2),y)
-O_OBJS += radio-rtrack2.o
+ifeq ($(CONFIG_RADIO_CADET),y)
+O_OBJS += radio-cadet.o
else
- ifeq ($(CONFIG_RADIO_RTRACK2),m)
- M_OBJS += radio-rtrack2.o
+ ifeq ($(CONFIG_RADIO_CADET),m)
+ M_OBJS += radio-cadet.o
endif
-endif
+endif
ifeq ($(CONFIG_RADIO_TYPHOON),y)
O_OBJS += radio-typhoon.o
ifeq ($(CONFIG_RADIO_TYPHOON),m)
M_OBJS += radio-typhoon.o
endif
-endif
+endif
+
+ifeq ($(CONFIG_RADIO_TERRATEC),y)
+O_OBJS += radio-terratec.o
+else
+ ifeq ($(CONFIG_RADIO_TERRATEC),m)
+ M_OBJS += radio-terratec.o
+ endif
+endif
+
+ifeq ($(CONFIG_RADIO_RTRACK),y)
+O_OBJS += radio-aimslab.o
+else
+ ifeq ($(CONFIG_RADIO_RTRACK),m)
+ M_OBJS += radio-aimslab.o
+ endif
+endif
ifeq ($(CONFIG_RADIO_ZOLTRIX),y)
O_OBJS += radio-zoltrix.o
ifeq ($(CONFIG_RADIO_ZOLTRIX),m)
M_OBJS += radio-zoltrix.o
endif
-endif
-
-ifeq ($(CONFIG_RADIO_CADET),y)
-O_OBJS += radio-cadet.o
-else
- ifeq ($(CONFIG_RADIO_CADET),m)
- M_OBJS += radio-cadet.o
- endif
-endif
+endif
ifeq ($(CONFIG_RADIO_MIROPCM20),y)
O_OBJS += radio-miropcm20.o
ifeq ($(CONFIG_RADIO_GEMTEK),m)
M_OBJS += radio-gemtek.o
endif
-endif
+endif
-ifeq ($(CONFIG_RADIO_TERRATEC),y)
-O_OBJS += radio-terratec.o
+ifeq ($(CONFIG_RADIO_TRUST),y)
+O_OBJS += radio-trust.o
else
- ifeq ($(CONFIG_RADIO_TERRATEC),m)
- M_OBJS += radio-terratec.o
+ ifeq ($(CONFIG_RADIO_TRUST),m)
+ M_OBJS += radio-trust.o
endif
endif
}
-#ifdef CONFIG_PROC_FS
+#ifndef CONFIG_PROC_FS
static int nvram_read_proc( char *buffer, char **start, off_t offset,
- int size, int *eof,
- void *data) {}
+ int size, int *eof, void *data) { return 0; }
#else
static int nvram_read_proc( char *buffer, char **start, off_t offset,
if (!pp)
return -ENOMEM;
+ memset (pp, 0, sizeof (struct pp_struct));
pp->state.mode = IEEE1284_MODE_COMPAT;
pp->state.phase = init_phase (pp->state.mode);
pp->flags = 0;
static int typhoon_open(struct video_device *dev, int flags);
static void typhoon_close(struct video_device *dev);
#ifdef CONFIG_RADIO_TYPHOON_PROC_FS
-static int typhoon_read_proc(char *buf, char **start, off_t offset, int len,
- int unused);
+static int typhoon_get_info(char *buf, char **start, off_t offset, int len,
+ int unused);
#endif
static void typhoon_setvol_generic(struct typhoon_device *dev, int vol)
#ifdef CONFIG_RADIO_TYPHOON_PROC_FS
-static int typhoon_read_proc(char *buf, char **start, off_t offset, int len,
- int unused)
+static int typhoon_get_info(char *buf, char **start, off_t offset, int len,
+ int unused)
{
#ifdef MODULE
#define MODULEPROCSTRING "Driver loaded as a module"
typhoon_mute(&typhoon_unit);
#ifdef CONFIG_RADIO_TYPHOON_PROC_FS
- if (!create_proc_read_entry("driver/radio-typhoon", 0, NULL,
- typhoon_read_proc, NULL))
+ if (!create_proc_info_entry("driver/radio-typhoon", 0, NULL,
+ typhoon_get_info))
printk(KERN_ERR "radio-typhoon: registering /proc/driver/radio-typhoon failed\n");
#endif
{
#ifdef CONFIG_RADIO_TYPHOON_PROC_FS
- remove_proc_entry("driver/radio-typhoon");
+ remove_proc_entry("driver/radio-typhoon", NULL);
#endif
video_unregister_device(&typhoon_radio);
return 1;
if (net_debug > 1)
printk("%s: transmit timed out, %s? ", dev->name,
- readw(shmem+iSCB_STATUS) & 0x8000 ? "IRQ conflict" :
+ isa_readw(shmem+iSCB_STATUS) & 0x8000 ? "IRQ conflict" :
"network cable problem");
/* Try to restart the adaptor. */
if (lp->last_restart == lp->stats.tx_packets) {
} else {
/* Issue the channel attention signal and hope it "gets better". */
if (net_debug > 1) printk("Kicking board.\n");
- writew(0xf000|CUC_START|RX_START,shmem+iSCB_CMD);
+ isa_writew(0xf000|CUC_START|RX_START,shmem+iSCB_CMD);
outb(0, ioaddr + SIGNAL_CA); /* Issue channel-attn. */
lp->last_restart = lp->stats.tx_packets;
}
spin_lock(&lp->lock);
- status = readw(shmem+iSCB_STATUS);
+ status = isa_readw(shmem+iSCB_STATUS);
if (net_debug > 4) {
printk("%s: 3c507 interrupt, status %4.4x.\n", dev->name, status);
/* Reap the Tx packet buffers. */
while (lp->tx_reap != lp->tx_head) {
- unsigned short tx_status = readw(shmem+lp->tx_reap);
+ unsigned short tx_status = isa_readw(shmem+lp->tx_reap);
if (tx_status == 0) {
if (net_debug > 5) printk("Couldn't reap %#x.\n", lp->tx_reap);
printk("%s: Rx unit stopped, status %04x, restarting.\n",
dev->name, status);
init_rx_bufs(dev);
- writew(RX_BUF_START,shmem+iSCB_RFA);
+ isa_writew(RX_BUF_START,shmem+iSCB_RFA);
ack_cmd |= RX_START;
}
- writew(ack_cmd,shmem+iSCB_CMD);
+ isa_writew(ack_cmd,shmem+iSCB_CMD);
outb(0, ioaddr + SIGNAL_CA); /* Issue channel-attn. */
/* Clear the latched interrupt. */
dev->start = 0;
/* Flush the Tx and disable Rx. */
- writew(RX_SUSPEND | CUC_SUSPEND,shmem+iSCB_CMD);
+ isa_writew(RX_SUSPEND | CUC_SUSPEND,shmem+iSCB_CMD);
outb(0, ioaddr + SIGNAL_CA);
/* Disable the 82586's input to the interrupt line. */
write_ptr = dev->mem_start + cur_rxbuf;
- writew(0x0000,write_ptr); /* Status */
- writew(0x0000,write_ptr+=2); /* Command */
- writew(cur_rxbuf + RX_BUF_SIZE,write_ptr+=2); /* Link */
- writew(cur_rxbuf + 22,write_ptr+=2); /* Buffer offset */
- writew(0x0000,write_ptr+=2); /* Pad for dest addr. */
- writew(0x0000,write_ptr+=2);
- writew(0x0000,write_ptr+=2);
- writew(0x0000,write_ptr+=2); /* Pad for source addr. */
- writew(0x0000,write_ptr+=2);
- writew(0x0000,write_ptr+=2);
- writew(0x0000,write_ptr+=2); /* Pad for protocol. */
-
- writew(0x0000,write_ptr+=2); /* Buffer: Actual count */
- writew(-1,write_ptr+=2); /* Buffer: Next (none). */
- writew(cur_rxbuf + 0x20 + SCB_base,write_ptr+=2);/* Buffer: Address low */
- writew(0x0000,write_ptr+=2);
+ isa_writew(0x0000,write_ptr); /* Status */
+ isa_writew(0x0000,write_ptr+=2); /* Command */
+ isa_writew(cur_rxbuf + RX_BUF_SIZE,write_ptr+=2); /* Link */
+ isa_writew(cur_rxbuf + 22,write_ptr+=2); /* Buffer offset */
+ isa_writew(0x0000,write_ptr+=2); /* Pad for dest addr. */
+ isa_writew(0x0000,write_ptr+=2);
+ isa_writew(0x0000,write_ptr+=2);
+ isa_writew(0x0000,write_ptr+=2); /* Pad for source addr. */
+ isa_writew(0x0000,write_ptr+=2);
+ isa_writew(0x0000,write_ptr+=2);
+ isa_writew(0x0000,write_ptr+=2); /* Pad for protocol. */
+
+ isa_writew(0x0000,write_ptr+=2); /* Buffer: Actual count */
+ isa_writew(-1,write_ptr+=2); /* Buffer: Next (none). */
+ isa_writew(cur_rxbuf + 0x20 + SCB_base,write_ptr+=2);/* Buffer: Address low */
+ isa_writew(0x0000,write_ptr+=2);
/* Finally, the number of bytes in the buffer. */
- writew(0x8000 + RX_BUF_SIZE-0x20,write_ptr+=2);
+ isa_writew(0x8000 + RX_BUF_SIZE-0x20,write_ptr+=2);
lp->rx_tail = cur_rxbuf;
cur_rxbuf += RX_BUF_SIZE;
/* Terminate the list by setting the EOL bit, and wrap the pointer to make
the list a ring. */
write_ptr = dev->mem_start + lp->rx_tail + 2;
- writew(0xC000,write_ptr); /* Command, mark as last. */
- writew(lp->rx_head,write_ptr+2); /* Link */
+ isa_writew(0xC000,write_ptr); /* Command, mark as last. */
+ isa_writew(lp->rx_head,write_ptr+2); /* Link */
}
static void init_82586_mem(struct net_device *dev)
init_words[7] = SCB_BASE;
/* Write the words at 0xfff6 (address-aliased to 0xfffff6). */
- memcpy_toio(dev->mem_end-10, init_words, 10);
+ isa_memcpy_toio(dev->mem_end-10, init_words, 10);
/* Write the words at 0x0000. */
- memcpy_toio(dev->mem_start, init_words + 5, sizeof(init_words) - 10);
+ isa_memcpy_toio(dev->mem_start, init_words + 5, sizeof(init_words) - 10);
/* Fill in the station address. */
- memcpy_toio(dev->mem_start+SA_OFFSET, dev->dev_addr,
+ isa_memcpy_toio(dev->mem_start+SA_OFFSET, dev->dev_addr,
sizeof(dev->dev_addr));
/* The Tx-block list is written as needed. We just set up the values. */
{
int boguscnt = 50;
- while (readw(shmem+iSCB_STATUS) == 0)
+ while (isa_readw(shmem+iSCB_STATUS) == 0)
if (--boguscnt == 0) {
printk("%s: i82586 initialization timed out with status %04x,"
"cmd %04x.\n", dev->name,
- readw(shmem+iSCB_STATUS), readw(shmem+iSCB_CMD));
+ isa_readw(shmem+iSCB_STATUS), isa_readw(shmem+iSCB_CMD));
break;
}
/* Issue channel-attn -- the 82586 won't start. */
outb(0x84, ioaddr + MISC_CTRL);
if (net_debug > 4)
printk("%s: Initialized 82586, status %04x.\n", dev->name,
- readw(shmem+iSCB_STATUS));
+ isa_readw(shmem+iSCB_STATUS));
return;
}
unsigned long write_ptr = dev->mem_start + tx_block;
/* Set the write pointer to the Tx block, and put out the header. */
- writew(0x0000,write_ptr); /* Tx status */
- writew(CMD_INTR|CmdTx,write_ptr+=2); /* Tx command */
- writew(tx_block+16,write_ptr+=2); /* Next command is a NoOp. */
- writew(tx_block+8,write_ptr+=2); /* Data Buffer offset. */
+ isa_writew(0x0000,write_ptr); /* Tx status */
+ isa_writew(CMD_INTR|CmdTx,write_ptr+=2); /* Tx command */
+ isa_writew(tx_block+16,write_ptr+=2); /* Next command is a NoOp. */
+ isa_writew(tx_block+8,write_ptr+=2); /* Data Buffer offset. */
/* Output the data buffer descriptor. */
- writew(length | 0x8000,write_ptr+=2); /* Byte count parameter. */
- writew(-1,write_ptr+=2); /* No next data buffer. */
- writew(tx_block+22+SCB_BASE,write_ptr+=2); /* Buffer follows the NoOp command. */
- writew(0x0000,write_ptr+=2); /* Buffer address high bits (always zero). */
+ isa_writew(length | 0x8000,write_ptr+=2); /* Byte count parameter. */
+ isa_writew(-1,write_ptr+=2); /* No next data buffer. */
+ isa_writew(tx_block+22+SCB_BASE,write_ptr+=2); /* Buffer follows the NoOp command. */
+ isa_writew(0x0000,write_ptr+=2); /* Buffer address high bits (always zero). */
/* Output the Loop-back NoOp command. */
- writew(0x0000,write_ptr+=2); /* Tx status */
- writew(CmdNOp,write_ptr+=2); /* Tx command */
- writew(tx_block+16,write_ptr+=2); /* Next is myself. */
+ isa_writew(0x0000,write_ptr+=2); /* Tx status */
+ isa_writew(CmdNOp,write_ptr+=2); /* Tx command */
+ isa_writew(tx_block+16,write_ptr+=2); /* Next is myself. */
/* Output the packet at the write pointer. */
- memcpy_toio(write_ptr+2, buf, length);
+ isa_memcpy_toio(write_ptr+2, buf, length);
/* Set the old command link pointing to this send packet. */
- writew(tx_block,dev->mem_start + lp->tx_cmd_link);
+ isa_isa_writew(tx_block,dev->mem_start + lp->tx_cmd_link);
lp->tx_cmd_link = tx_block + 20;
/* Set the next free tx region. */
ushort boguscount = 10;
short frame_status;
- while ((frame_status = readw(shmem+rx_head)) < 0) { /* Command complete */
+ while ((frame_status = isa_readw(shmem+rx_head)) < 0) { /* Command complete */
unsigned long read_frame = dev->mem_start + rx_head;
- ushort rfd_cmd = readw(read_frame+2);
- ushort next_rx_frame = readw(read_frame+4);
- ushort data_buffer_addr = readw(read_frame+6);
+ ushort rfd_cmd = isa_readw(read_frame+2);
+ ushort next_rx_frame = isa_readw(read_frame+4);
+ ushort data_buffer_addr = isa_readw(read_frame+6);
unsigned long data_frame = dev->mem_start + data_buffer_addr;
- ushort pkt_len = readw(data_frame);
+ ushort pkt_len = isa_readw(data_frame);
if (rfd_cmd != 0 || data_buffer_addr != rx_head + 22
|| (pkt_len & 0xC000) != 0xC000) {
skb->dev = dev;
/* 'skb->data' points to the start of sk_buff data area. */
- memcpy_fromio(skb_put(skb,pkt_len), data_frame + 10, pkt_len);
+ isa_memcpy_fromio(skb_put(skb,pkt_len), data_frame + 10, pkt_len);
skb->protocol=eth_type_trans(skb,dev);
netif_rx(skb);
}
/* Clear the status word and set End-of-List on the rx frame. */
- writew(0,read_frame);
- writew(0xC000,read_frame+2);
+ isa_writew(0,read_frame);
+ isa_writew(0xC000,read_frame+2);
/* Clear the end-of-list on the prev. RFD. */
- writew(0x0000,dev->mem_start + rx_tail + 2);
+ isa_writew(0x0000,dev->mem_start + rx_tail + 2);
rx_tail = rx_head;
rx_head = next_rx_frame;
ac_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
{
unsigned long hdr_start = dev->mem_start + ((ring_page - AC_START_PG)<<8);
- memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
+ isa_memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
}
/* Block input and output are easy on shared memory ethercards, the only
if (xfer_start + count > dev->rmem_end) {
/* We must wrap the input move. */
int semi_count = dev->rmem_end - xfer_start;
- memcpy_fromio(skb->data, xfer_start, semi_count);
+ isa_memcpy_fromio(skb->data, xfer_start, semi_count);
count -= semi_count;
- memcpy_fromio(skb->data + semi_count, dev->rmem_start, count);
+ isa_memcpy_fromio(skb->data + semi_count, dev->rmem_start, count);
} else {
/* Packet is in one chunk -- we can copy + cksum. */
- eth_io_copy_and_sum(skb, xfer_start, count, 0);
+ isa_eth_io_copy_and_sum(skb, xfer_start, count, 0);
}
}
{
unsigned long shmem = dev->mem_start + ((start_page - AC_START_PG)<<8);
- memcpy_toio(shmem, buf, count);
+ isa_memcpy_toio(shmem, buf, count);
}
static int ac_close_card(struct net_device *dev)
es_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
{
unsigned long hdr_start = dev->mem_start + ((ring_page - ES_START_PG)<<8);
- memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
+ isa_memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
hdr->count = (hdr->count + 3) & ~3; /* Round up allocation. */
}
if (xfer_start + count > dev->rmem_end) {
/* Packet wraps over end of ring buffer. */
int semi_count = dev->rmem_end - xfer_start;
- memcpy_fromio(skb->data, xfer_start, semi_count);
+ isa_memcpy_fromio(skb->data, xfer_start, semi_count);
count -= semi_count;
- memcpy_fromio(skb->data + semi_count, dev->rmem_start, count);
+ isa_memcpy_fromio(skb->data + semi_count, dev->rmem_start, count);
} else {
/* Packet is in one chunk. */
- memcpy_fromio(skb->data, xfer_start, count);
+ isa_eth_io_copy_and_csum(skb, xfer_start, count, 0);
}
}
unsigned long shmem = dev->mem_start + ((start_page - ES_START_PG)<<8);
count = (count + 3) & ~3; /* Round up to doubleword */
- memcpy_toio(shmem, buf, count);
+ isa_memcpy_toio(shmem, buf, count);
}
static int es_open(struct net_device *dev)
writeb(0x04, (char *) buf); /* index byte */
buf += 1;
writeb(0x00, (char *) (buf + skb->len)); /* Write the XCT flag */
- memcpy_toio(buf, skb->data, PRELOAD); /* Write PRELOAD bytes */
+ isa_memcpy_toio(buf, skb->data, PRELOAD); /* Write PRELOAD bytes */
outb(page, EWRK3_TQ); /* Start sending pkt */
- memcpy_toio(buf + PRELOAD, skb->data + PRELOAD, skb->len - PRELOAD);
+ isa_memcpy_toio(buf + PRELOAD, skb->data + PRELOAD, skb->len - PRELOAD);
writeb(0xff, (char *) (buf + skb->len)); /* Write the XCT flag */
} else {
writeb((char) ((skb->len >> 8) & 0xff), (char *) buf);
buf += 1;
writeb(0x04, (char *) buf); /* index byte */
buf += 1;
- memcpy_toio((char *) buf, skb->data, skb->len); /* Write data bytes */
+ isa_memcpy_toio(buf, skb->data, skb->len); /* Write data bytes */
outb(page, EWRK3_TQ); /* Start sending pkt */
}
}
*p++ = inb(EWRK3_DATA);
}
} else {
- memcpy_fromio(p, buf, pkt_len);
+ isa_memcpy_fromio(p, buf, pkt_len);
}
/*
}
} else {
outb(0, EWRK3_MPR);
- memcpy_fromio(tmp.addr, (char *) (lp->shmem_base + PAGE0_HTE), (HASH_TABLE_LEN >> 3));
+ isa_memcpy_fromio(tmp.addr, lp->shmem_base + PAGE0_HTE, (HASH_TABLE_LEN >> 3));
}
ioc->len = (HASH_TABLE_LEN >> 3);
if (copy_to_user(ioc->data, tmp.addr, ioc->len)) {
outw((ring_page<<8), ioaddr + HPP_IN_ADDR);
outw(option_reg & ~(MemDisable + BootROMEnb), ioaddr + HPP_OPTION);
- memcpy_fromio(hdr, dev->mem_start, sizeof(struct e8390_pkt_hdr));
+ isa_memcpy_fromio(hdr, dev->mem_start, sizeof(struct e8390_pkt_hdr));
outw(option_reg, ioaddr + HPP_OPTION);
hdr->count = (hdr->count + 3) & ~3; /* Round up allocation. */
}
Also note that we *can't* use eth_io_copy_and_sum() because
it will not always copy "count" bytes (e.g. padded IP). */
- memcpy_fromio(skb->data, dev->mem_start, count);
+ isa_memcpy_fromio(skb->data, dev->mem_start, count);
outw(option_reg, ioaddr + HPP_OPTION);
}
outw(start_page << 8, ioaddr + HPP_OUT_ADDR);
outw(option_reg & ~(MemDisable + BootROMEnb), ioaddr + HPP_OPTION);
- memcpy_toio(dev->mem_start, buf, (count + 3) & ~3);
+ isa_memcpy_toio(dev->mem_start, buf, (count + 3) & ~3);
outw(option_reg, ioaddr + HPP_OPTION);
return;
lne390_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
{
unsigned long hdr_start = dev->mem_start + ((ring_page - LNE390_START_PG)<<8);
- memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
+ isa_memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
hdr->count = (hdr->count + 3) & ~3; /* Round up allocation. */
}
if (xfer_start + count > dev->rmem_end) {
/* Packet wraps over end of ring buffer. */
int semi_count = dev->rmem_end - xfer_start;
- memcpy_fromio(skb->data, xfer_start, semi_count);
+ isa_memcpy_fromio(skb->data, xfer_start, semi_count);
count -= semi_count;
- memcpy_fromio(skb->data + semi_count, dev->rmem_start, count);
+ isa_memcpy_fromio(skb->data + semi_count, dev->rmem_start, count);
} else {
/* Packet is in one chunk. */
- memcpy_fromio(skb->data, xfer_start, count);
+ isa_memcpy_fromio(skb->data, xfer_start, count);
}
}
unsigned long shmem = dev->mem_start + ((start_page - LNE390_START_PG)<<8);
count = (count + 3) & ~3; /* Round up to doubleword */
- memcpy_toio(shmem, buf, count);
+ isa_memcpy_toio(shmem, buf, count);
}
static int lne390_open(struct net_device *dev)
ne3210_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
{
unsigned long hdr_start = dev->mem_start + ((ring_page - NE3210_START_PG)<<8);
- memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
+ isa_memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
hdr->count = (hdr->count + 3) & ~3; /* Round up allocation. */
}
if (xfer_start + count > dev->rmem_end) {
/* Packet wraps over end of ring buffer. */
int semi_count = dev->rmem_end - xfer_start;
- memcpy_fromio(skb->data, xfer_start, semi_count);
+ isa_memcpy_fromio(skb->data, xfer_start, semi_count);
count -= semi_count;
- memcpy_fromio(skb->data + semi_count, dev->rmem_start, count);
+ isa_memcpy_fromio(skb->data + semi_count, dev->rmem_start, count);
} else {
/* Packet is in one chunk. */
- memcpy_fromio(skb->data, xfer_start, count);
+ isa_memcpy_fromio(skb->data, xfer_start, count);
}
}
unsigned long shmem = dev->mem_start + ((start_page - NE3210_START_PG)<<8);
count = (count + 3) & ~3; /* Round up to doubleword */
- memcpy_toio(shmem, buf, count);
+ isa_memcpy_toio(shmem, buf, count);
}
static int ne3210_open(struct net_device *dev)
descr.Flags = 0;
descr.Len = 0xf000;
descr.Status = 0;
- memcpy_toio(dev->mem_start + RAM_TXBASE + (z * sizeof(LANCE_TxDescr)),
+ isa_memcpy_toio(dev->mem_start + RAM_TXBASE + (z * sizeof(LANCE_TxDescr)),
&descr, sizeof(LANCE_TxDescr));
memset_io(dev->mem_start + bufaddr, 0, RAM_BUFSIZE);
bufaddr += RAM_BUFSIZE;
descr.Flags = RXDSCR_FLAGS_OWN;
descr.MaxLen = -RAM_BUFSIZE;
descr.Len = 0;
- memcpy_toio(dev->mem_start + RAM_RXBASE + (z * sizeof(LANCE_RxDescr)),
+ isa_memcpy_toio(dev->mem_start + RAM_RXBASE + (z * sizeof(LANCE_RxDescr)),
&descr, sizeof(LANCE_RxDescr));
- memset_io(dev->mem_start + bufaddr, 0, RAM_BUFSIZE);
+ isa_memset_io(dev->mem_start + bufaddr, 0, RAM_BUFSIZE);
bufaddr += RAM_BUFSIZE;
}
}
block.RdrP = (RAM_RXBASE & 0xffffff) | (LRXCOUNT << 29);
block.TdrP = (RAM_TXBASE & 0xffffff) | (LTXCOUNT << 29);
- memcpy_toio(dev->mem_start + RAM_INITBASE, &block, sizeof(block));
+ isa_memcpy_toio(dev->mem_start + RAM_INITBASE, &block, sizeof(block));
/* initialize LANCE. Implicitly sets up other structures in RAM. */
while (1)
{
/* read descriptor */
- memcpy_fromio(&descr, dev->mem_start + descraddr, sizeof(LANCE_RxDescr));
+ isa_memcpy_fromio(&descr, dev->mem_start + descraddr, sizeof(LANCE_RxDescr));
/* if we reach a descriptor we do not own, we're done */
if ((descr.Flags & RXDSCR_FLAGS_OWN) != 0)
priv->stat.rx_dropped++;
else
{
- memcpy_fromio(skb_put(skb, descr.Len),
+ isa_memcpy_fromio(skb_put(skb, descr.Len),
dev->mem_start + descr.LowAddr, descr.Len);
skb->dev = dev;
skb->protocol = eth_type_trans(skb, dev);
descr.Flags |= RXDSCR_FLAGS_OWN;
/* update descriptor in shared RAM */
- memcpy_toio(dev->mem_start + descraddr, &descr, sizeof(LANCE_RxDescr));
+ isa_memcpy_toio(dev->mem_start + descraddr, &descr, sizeof(LANCE_RxDescr));
/* go to next descriptor */
priv->nextrx++; descraddr += sizeof(LANCE_RxDescr);
while (priv->txbusy > 0)
{
/* read descriptor */
- memcpy_fromio(&descr, dev->mem_start + descraddr, sizeof(LANCE_TxDescr));
+ isa_memcpy_fromio(&descr, dev->mem_start + descraddr, sizeof(LANCE_TxDescr));
/* if the LANCE still owns this one, we've worked out all sent packets */
if ((descr.Flags & TXDSCR_FLAGS_OWN) != 0)
/* get TX descriptor */
address = RAM_TXBASE + (priv->nexttxput * sizeof(LANCE_TxDescr));
- memcpy_fromio(&descr, dev->mem_start + address, sizeof(LANCE_TxDescr));
+ isa_memcpy_fromio(&descr, dev->mem_start + address, sizeof(LANCE_TxDescr));
/* enter packet length as 2s complement - assure minimum length */
tmplen = skb->len;
while (destoffs < tmplen)
{
- memcpy_toio(dev->mem_start + descr.LowAddr + destoffs, fill, l);
+ isa_memcpy_toio(dev->mem_start + descr.LowAddr + destoffs, fill, l);
destoffs += l;
}
}
/* do the real data copying */
- memcpy_toio(dev->mem_start + descr.LowAddr, skb->data, skb->len);
+ isa_memcpy_toio(dev->mem_start + descr.LowAddr, skb->data, skb->len);
/* hand descriptor over to LANCE - this is the first and last chunk */
descr.Flags = TXDSCR_FLAGS_OWN | TXDSCR_FLAGS_STP | TXDSCR_FLAGS_ENP;
dev->tbusy = (priv->txbusy >= TXCOUNT);
/* write descriptor back to RAM */
- memcpy_toio(dev->mem_start + address, &descr, sizeof(LANCE_TxDescr));
+ isa_memcpy_toio(dev->mem_start + address, &descr, sizeof(LANCE_TxDescr));
/* if no descriptors were active, give the LANCE a hint to read it
immediately */
StopLANCE(dev);
/* ...then modify the initialization block... */
- memcpy_fromio(&block, dev->mem_start + RAM_INITBASE, sizeof(block));
+ isa_memcpy_fromio(&block, dev->mem_start + RAM_INITBASE, sizeof(block));
if (dev->flags & IFF_PROMISC)
block.Mode |= LANCE_INIT_PROM;
else
}
}
- memcpy_toio(dev->mem_start + RAM_INITBASE, &block, sizeof(block));
+ isa_memcpy_toio(dev->mem_start + RAM_INITBASE, &block, sizeof(block));
/* ...then reinit LANCE with the correct flags */
InitLANCE(dev);
outb(ULTRA_MEMENB, dev->base_addr - ULTRA_NIC_OFFSET); /* shmem on */
#ifdef notdef
/* Officially this is what we are doing, but the readl() is faster */
- memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
+ isa_memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
#else
- ((unsigned int*)hdr)[0] = readl(hdr_start);
+ ((unsigned int*)hdr)[0] = isa_readl(hdr_start);
#endif
outb(0x00, dev->base_addr - ULTRA_NIC_OFFSET); /* shmem off */
}
if (xfer_start + count > dev->rmem_end) {
/* We must wrap the input move. */
int semi_count = dev->rmem_end - xfer_start;
- memcpy_fromio(skb->data, xfer_start, semi_count);
+ isa_memcpy_fromio(skb->data, xfer_start, semi_count);
count -= semi_count;
- memcpy_fromio(skb->data + semi_count, dev->rmem_start, count);
+ isa_memcpy_fromio(skb->data + semi_count, dev->rmem_start, count);
} else {
/* Packet is in one chunk -- we can copy + cksum. */
- eth_io_copy_and_sum(skb, xfer_start, count, 0);
+ isa_eth_io_copy_and_sum(skb, xfer_start, count, 0);
}
outb(0x00, dev->base_addr - ULTRA_NIC_OFFSET); /* Disable memory. */
/* Enable shared memory. */
outb(ULTRA_MEMENB, dev->base_addr - ULTRA_NIC_OFFSET);
- memcpy_toio(shmem, buf, count);
+ isa_memcpy_toio(shmem, buf, count);
outb(0x00, dev->base_addr - ULTRA_NIC_OFFSET); /* Disable memory. */
}
#ifdef notdef
/* Officially this is what we are doing, but the readl() is faster */
- memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
+ isa_memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
#else
- ((unsigned int*)hdr)[0] = readl(hdr_start);
+ ((unsigned int*)hdr)[0] = isa_readl(hdr_start);
#endif
}
if ((ring_offset & ~0x1fff) != ((ring_offset + count - 1) & ~0x1fff)) {
int semi_count = 8192 - (ring_offset & 0x1FFF);
- memcpy_fromio(skb->data, xfer_start, semi_count);
+ isa_memcpy_fromio(skb->data, xfer_start, semi_count);
count -= semi_count;
if (ring_offset < 96*256) {
/* Select next 8KB Window. */
ring_offset += semi_count;
outb(ei_status.reg0 | ((ring_offset & 0x6000) >> 13), RamReg);
- memcpy_fromio(skb->data + semi_count, dev->mem_start, count);
+ isa_memcpy_fromio(skb->data + semi_count, dev->mem_start, count);
} else {
/* Select first 8KB Window. */
outb(ei_status.reg0, RamReg);
- memcpy_fromio(skb->data + semi_count, dev->rmem_start, count);
+ isa_memcpy_fromio(skb->data + semi_count, dev->rmem_start, count);
}
} else {
/* Packet is in one chunk -- we can copy + cksum. */
- eth_io_copy_and_sum(skb, xfer_start, count, 0);
+ isa_eth_io_copy_and_sum(skb, xfer_start, count, 0);
}
}
/* Select first 8KB Window. */
outb(ei_status.reg0, RamReg);
- memcpy_toio(xfer_start, buf, count);
+ isa_memcpy_toio(xfer_start, buf, count);
}
\f
#ifdef MODULE
isa_memcpy_fromio(skb->data + semi_count, dev->rmem_start, count);
} else {
/* Packet is in one chunk -- we can copy + cksum. */
- isa_eth_io_copy_and_csum(skb, xfer_start, count, 0);
+ isa_eth_io_copy_and_sum(skb, xfer_start, count, 0);
}
/* Turn off 16 bit access so that reboot works. ISA brain-damage */
{ PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_DUAL_PAR_B,
PCI_ANY_ID, PCI_ANY_ID,
1, { { 0, -1 }, } },
+ { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_BOCA_IOPPAR,
+ PCI_ANY_ID, PCI_ANY_ID,
+ 1, { { 0, -1 }, } },
{ PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
PCI_SUBVENDOR_ID_EXSYS, PCI_SUBDEVICE_ID_EXSYS_4014,
2, { { 4, -1 }, { 5, -1 }, } },
DEVICE( MOTOROLA_OOPS, MOTOROLA_FALCON,"Falcon")
ENDVENDOR()
+VENDOR( LAVA, "Lava Computer MFG" )
+ DEVICE( LAVA, LAVA_PARALLEL, "Lava Parallel")
+ DEVICE( LAVA, LAVA_DUAL_PAR_A,"Lava Dual Parallel (A)")
+ DEVICE( LAVA, LAVA_DUAL_PAR_B,"Lava Dual Parallel (B)")
+ DEVICE( LAVA, LAVA_BOCA_IOPPAR,"BOCA Research IOPPAR")
+ENDVENDOR()
+
VENDOR( SYMPHONY, "Symphony" )
DEVICE( SYMPHONY, SYMPHONY_101, "82C101")
ENDVENDOR()
#include <linux/pci.h>
-int pci_simple_probe (struct pci_simple_probe_entry *list, size_t match_limit,
- pci_simple_probe_callback cb, void *drvr_data)
+int pci_simple_probe (const struct pci_simple_probe_entry *list,
+ size_t match_limit, pci_simple_probe_callback cb,
+ void *drvr_data)
{
struct pci_dev *dev;
- struct pci_simple_probe_entry *ent;
+ const struct pci_simple_probe_entry *ent;
size_t matches = 0;
unsigned short vendor, device;
int rc;
unsigned long addr;
unsigned long size;
- if (vma->vm_offset & ~(PAGE_MASK))
- return -ENXIO;
-
if (flash.read_base == flash.write_base) {
addr = flash.read_base;
size = flash.read_size;
-u32 SCRIPT[] = {
+static u32 SCRIPT[] = {
/*
};
#define A_NCR53c7xx_msg_abort 0x00000000
-u32 A_NCR53c7xx_msg_abort_used[] = {
+static u32 A_NCR53c7xx_msg_abort_used[] __attribute((unused)) = {
0x00000249,
};
#define A_NCR53c7xx_msg_reject 0x00000000
-u32 A_NCR53c7xx_msg_reject_used[] = {
+static u32 A_NCR53c7xx_msg_reject_used[] __attribute((unused)) = {
0x00000172,
};
#define A_NCR53c7xx_sink 0x00000000
-u32 A_NCR53c7xx_sink_used[] = {
+static u32 A_NCR53c7xx_sink_used[] __attribute((unused)) = {
0x00000233,
0x00000239,
0x0000023f,
};
#define A_NCR53c7xx_zero 0x00000000
-u32 A_NCR53c7xx_zero_used[] = {
+static u32 A_NCR53c7xx_zero_used[] __attribute((unused)) = {
0x0000022f,
0x00000245,
};
#define A_NOP_insn 0x00000000
-u32 A_NOP_insn_used[] = {
+static u32 A_NOP_insn_used[] __attribute((unused)) = {
0x00000010,
};
#define A_addr_reconnect_dsa_head 0x00000000
-u32 A_addr_reconnect_dsa_head_used[] = {
+static u32 A_addr_reconnect_dsa_head_used[] __attribute((unused)) = {
0x000001a7,
};
#define A_addr_scratch 0x00000000
-u32 A_addr_scratch_used[] = {
+static u32 A_addr_scratch_used[] __attribute((unused)) = {
0x00000004,
0x0000001b,
0x00000046,
};
#define A_addr_temp 0x00000000
-u32 A_addr_temp_used[] = {
+static u32 A_addr_temp_used[] __attribute((unused)) = {
0x00000025,
0x00000034,
};
#define A_dmode_memory_to_memory 0x00000000
-u32 A_dmode_memory_to_memory_used[] = {
+static u32 A_dmode_memory_to_memory_used[] __attribute((unused)) = {
0x00000005,
0x0000001c,
0x00000027,
};
#define A_dmode_memory_to_ncr 0x00000000
-u32 A_dmode_memory_to_ncr_used[] = {
+static u32 A_dmode_memory_to_ncr_used[] __attribute((unused)) = {
0x00000000,
0x00000017,
0x00000030,
};
#define A_dmode_ncr_to_memory 0x00000000
-u32 A_dmode_ncr_to_memory_used[] = {
+static u32 A_dmode_ncr_to_memory_used[] __attribute((unused)) = {
0x00000022,
0x00000064,
0x00000070,
};
#define A_dsa_check_reselect 0x00000000
-u32 A_dsa_check_reselect_used[] = {
+static u32 A_dsa_check_reselect_used[] __attribute((unused)) = {
0x000001bd,
};
#define A_dsa_cmdout 0x00000048
-u32 A_dsa_cmdout_used[] = {
+static u32 A_dsa_cmdout_used[] __attribute((unused)) = {
0x00000094,
};
#define A_dsa_cmnd 0x00000038
-u32 A_dsa_cmnd_used[] = {
+static u32 A_dsa_cmnd_used[] __attribute((unused)) = {
};
#define A_dsa_datain 0x00000054
-u32 A_dsa_datain_used[] = {
+static u32 A_dsa_datain_used[] __attribute((unused)) = {
0x000000bb,
};
#define A_dsa_dataout 0x00000050
-u32 A_dsa_dataout_used[] = {
+static u32 A_dsa_dataout_used[] __attribute((unused)) = {
0x000000a5,
};
#define A_dsa_end 0x00000070
-u32 A_dsa_end_used[] = {
+static u32 A_dsa_end_used[] __attribute((unused)) = {
};
#define A_dsa_fields_start 0x00000000
-u32 A_dsa_fields_start_used[] = {
+static u32 A_dsa_fields_start_used[] __attribute((unused)) = {
};
#define A_dsa_msgin 0x00000058
-u32 A_dsa_msgin_used[] = {
+static u32 A_dsa_msgin_used[] __attribute((unused)) = {
0x00000188,
};
#define A_dsa_msgout 0x00000040
-u32 A_dsa_msgout_used[] = {
+static u32 A_dsa_msgout_used[] __attribute((unused)) = {
0x00000086,
};
#define A_dsa_msgout_other 0x00000068
-u32 A_dsa_msgout_other_used[] = {
+static u32 A_dsa_msgout_other_used[] __attribute((unused)) = {
0x00000180,
};
#define A_dsa_next 0x00000030
-u32 A_dsa_next_used[] = {
+static u32 A_dsa_next_used[] __attribute((unused)) = {
0x0000005c,
};
#define A_dsa_restore_pointers 0x00000000
-u32 A_dsa_restore_pointers_used[] = {
+static u32 A_dsa_restore_pointers_used[] __attribute((unused)) = {
0x0000012e,
};
#define A_dsa_save_data_pointer 0x00000000
-u32 A_dsa_save_data_pointer_used[] = {
+static u32 A_dsa_save_data_pointer_used[] __attribute((unused)) = {
0x00000115,
};
#define A_dsa_select 0x0000003c
-u32 A_dsa_select_used[] = {
+static u32 A_dsa_select_used[] __attribute((unused)) = {
0x00000081,
};
#define A_dsa_status 0x00000060
-u32 A_dsa_status_used[] = {
+static u32 A_dsa_status_used[] __attribute((unused)) = {
0x00000184,
};
#define A_dsa_temp_addr_array_value 0x00000000
-u32 A_dsa_temp_addr_array_value_used[] = {
+static u32 A_dsa_temp_addr_array_value_used[] __attribute((unused)) = {
};
#define A_dsa_temp_addr_dsa_value 0x00000000
-u32 A_dsa_temp_addr_dsa_value_used[] = {
+static u32 A_dsa_temp_addr_dsa_value_used[] __attribute((unused)) = {
0x00000003,
};
#define A_dsa_temp_addr_new_value 0x00000000
-u32 A_dsa_temp_addr_new_value_used[] = {
+static u32 A_dsa_temp_addr_new_value_used[] __attribute((unused)) = {
};
#define A_dsa_temp_addr_next 0x00000000
-u32 A_dsa_temp_addr_next_used[] = {
+static u32 A_dsa_temp_addr_next_used[] __attribute((unused)) = {
0x00000015,
0x0000004e,
};
#define A_dsa_temp_addr_residual 0x00000000
-u32 A_dsa_temp_addr_residual_used[] = {
+static u32 A_dsa_temp_addr_residual_used[] __attribute((unused)) = {
0x0000002a,
0x00000039,
};
#define A_dsa_temp_addr_saved_pointer 0x00000000
-u32 A_dsa_temp_addr_saved_pointer_used[] = {
+static u32 A_dsa_temp_addr_saved_pointer_used[] __attribute((unused)) = {
0x00000026,
0x00000033,
};
#define A_dsa_temp_addr_saved_residual 0x00000000
-u32 A_dsa_temp_addr_saved_residual_used[] = {
+static u32 A_dsa_temp_addr_saved_residual_used[] __attribute((unused)) = {
0x0000002b,
0x00000038,
};
#define A_dsa_temp_lun 0x00000000
-u32 A_dsa_temp_lun_used[] = {
+static u32 A_dsa_temp_lun_used[] __attribute((unused)) = {
0x0000004b,
};
#define A_dsa_temp_next 0x00000000
-u32 A_dsa_temp_next_used[] = {
+static u32 A_dsa_temp_next_used[] __attribute((unused)) = {
0x0000001a,
};
#define A_dsa_temp_sync 0x00000000
-u32 A_dsa_temp_sync_used[] = {
+static u32 A_dsa_temp_sync_used[] __attribute((unused)) = {
0x00000053,
};
#define A_dsa_temp_target 0x00000000
-u32 A_dsa_temp_target_used[] = {
+static u32 A_dsa_temp_target_used[] __attribute((unused)) = {
0x00000040,
};
#define A_int_debug_break 0x03000000
-u32 A_int_debug_break_used[] = {
+static u32 A_int_debug_break_used[] __attribute((unused)) = {
0x00000217,
};
#define A_int_debug_panic 0x030b0000
-u32 A_int_debug_panic_used[] = {
+static u32 A_int_debug_panic_used[] __attribute((unused)) = {
0x000001e8,
0x000001f8,
};
#define A_int_err_check_condition 0x00030000
-u32 A_int_err_check_condition_used[] = {
+static u32 A_int_err_check_condition_used[] __attribute((unused)) = {
0x00000194,
};
#define A_int_err_no_phase 0x00040000
-u32 A_int_err_no_phase_used[] = {
+static u32 A_int_err_no_phase_used[] __attribute((unused)) = {
};
#define A_int_err_selected 0x00010000
-u32 A_int_err_selected_used[] = {
+static u32 A_int_err_selected_used[] __attribute((unused)) = {
0x000001da,
};
#define A_int_err_unexpected_phase 0x00000000
-u32 A_int_err_unexpected_phase_used[] = {
+static u32 A_int_err_unexpected_phase_used[] __attribute((unused)) = {
0x0000008c,
0x00000092,
0x0000009a,
};
#define A_int_err_unexpected_reselect 0x00020000
-u32 A_int_err_unexpected_reselect_used[] = {
+static u32 A_int_err_unexpected_reselect_used[] __attribute((unused)) = {
0x000001ba,
};
#define A_int_msg_1 0x01020000
-u32 A_int_msg_1_used[] = {
+static u32 A_int_msg_1_used[] __attribute((unused)) = {
0x0000010e,
0x00000110,
};
#define A_int_msg_sdtr 0x01010000
-u32 A_int_msg_sdtr_used[] = {
+static u32 A_int_msg_sdtr_used[] __attribute((unused)) = {
0x0000016c,
};
#define A_int_msg_wdtr 0x01000000
-u32 A_int_msg_wdtr_used[] = {
+static u32 A_int_msg_wdtr_used[] __attribute((unused)) = {
0x00000160,
};
#define A_int_norm_aborted 0x02040000
-u32 A_int_norm_aborted_used[] = {
+static u32 A_int_norm_aborted_used[] __attribute((unused)) = {
0x0000024d,
};
#define A_int_norm_command_complete 0x02020000
-u32 A_int_norm_command_complete_used[] = {
+static u32 A_int_norm_command_complete_used[] __attribute((unused)) = {
};
#define A_int_norm_disconnected 0x02030000
-u32 A_int_norm_disconnected_used[] = {
+static u32 A_int_norm_disconnected_used[] __attribute((unused)) = {
};
#define A_int_norm_reselect_complete 0x02010000
-u32 A_int_norm_reselect_complete_used[] = {
+static u32 A_int_norm_reselect_complete_used[] __attribute((unused)) = {
};
#define A_int_norm_reset 0x02050000
-u32 A_int_norm_reset_used[] = {
+static u32 A_int_norm_reset_used[] __attribute((unused)) = {
};
#define A_int_norm_select_complete 0x02000000
-u32 A_int_norm_select_complete_used[] = {
+static u32 A_int_norm_select_complete_used[] __attribute((unused)) = {
};
#define A_int_test_1 0x04000000
-u32 A_int_test_1_used[] = {
+static u32 A_int_test_1_used[] __attribute((unused)) = {
0x000001fd,
};
#define A_int_test_2 0x04010000
-u32 A_int_test_2_used[] = {
+static u32 A_int_test_2_used[] __attribute((unused)) = {
0x00000215,
};
#define A_int_test_3 0x04020000
-u32 A_int_test_3_used[] = {
+static u32 A_int_test_3_used[] __attribute((unused)) = {
};
#define A_msg_buf 0x00000000
-u32 A_msg_buf_used[] = {
+static u32 A_msg_buf_used[] __attribute((unused)) = {
0x00000102,
0x0000014e,
0x00000158,
};
#define A_reconnect_dsa_head 0x00000000
-u32 A_reconnect_dsa_head_used[] = {
+static u32 A_reconnect_dsa_head_used[] __attribute((unused)) = {
0x0000006c,
0x00000074,
0x000001a0,
};
#define A_reselected_identify 0x00000000
-u32 A_reselected_identify_used[] = {
+static u32 A_reselected_identify_used[] __attribute((unused)) = {
0x00000045,
0x0000019c,
};
#define A_reselected_tag 0x00000000
-u32 A_reselected_tag_used[] = {
+static u32 A_reselected_tag_used[] __attribute((unused)) = {
};
#define A_schedule 0x00000000
-u32 A_schedule_used[] = {
+static u32 A_schedule_used[] __attribute((unused)) = {
0x0000007e,
0x00000192,
0x000001e2,
};
#define A_test_dest 0x00000000
-u32 A_test_dest_used[] = {
+static u32 A_test_dest_used[] __attribute((unused)) = {
0x000001fb,
};
#define A_test_src 0x00000000
-u32 A_test_src_used[] = {
+static u32 A_test_src_used[] __attribute((unused)) = {
0x000001fa,
};
#define Ent_test_2 0x000007f8
#define Ent_test_2_msgout 0x00000810
#define Ent_wait_reselect 0x00000654
-u32 LABELPATCHES[] = {
+static u32 LABELPATCHES[] __attribute((unused)) = {
0x00000008,
0x0000000a,
0x00000013,
0x00000243,
};
-struct {
+static struct {
u32 offset;
void *address;
-} EXTERNAL_PATCHES[] = {
+} EXTERNAL_PATCHES[] __attribute((unused)) = {
};
-u32 INSTRUCTIONS = 301;
-u32 PATCHES = 81;
-u32 EXTERNAL_PATCHES_LEN = 0;
+static u32 INSTRUCTIONS __attribute((unused)) = 301;
+static u32 PATCHES __attribute((unused)) = 81;
+static u32 EXTERNAL_PATCHES_LEN __attribute((unused)) = 0;
-u32 SCRIPT[] = {
+static u32 SCRIPT[] = {
/*
};
#define A_dsa_cmnd 0x00000010
-u32 A_dsa_cmnd_used[] = {
+static u32 A_dsa_cmnd_used[] __attribute((unused)) = {
0x0000001d,
};
#define A_dsa_datain 0x00000028
-u32 A_dsa_datain_used[] = {
+static u32 A_dsa_datain_used[] __attribute((unused)) = {
0x0000003d,
0x0000003f,
0x00000041,
};
#define A_dsa_dataout 0x00000428
-u32 A_dsa_dataout_used[] = {
+static u32 A_dsa_dataout_used[] __attribute((unused)) = {
0x00000143,
0x00000145,
0x00000147,
};
#define A_dsa_msgin 0x00000020
-u32 A_dsa_msgin_used[] = {
+static u32 A_dsa_msgin_used[] __attribute((unused)) = {
0x0000002f,
};
#define A_dsa_msgout 0x00000008
-u32 A_dsa_msgout_used[] = {
+static u32 A_dsa_msgout_used[] __attribute((unused)) = {
0x00000013,
0x00000285,
0x000002c5,
};
#define A_dsa_select 0x00000000
-u32 A_dsa_select_used[] = {
+static u32 A_dsa_select_used[] __attribute((unused)) = {
0x00000006,
};
#define A_dsa_size 0x00000828
-u32 A_dsa_size_used[] = {
+static u32 A_dsa_size_used[] __attribute((unused)) = {
};
#define A_dsa_status 0x00000018
-u32 A_dsa_status_used[] = {
+static u32 A_dsa_status_used[] __attribute((unused)) = {
0x0000002b,
};
#define A_had_cmdout 0x00000004
-u32 A_had_cmdout_used[] = {
+static u32 A_had_cmdout_used[] __attribute((unused)) = {
0x0000001a,
};
#define A_had_datain 0x00000008
-u32 A_had_datain_used[] = {
+static u32 A_had_datain_used[] __attribute((unused)) = {
0x00000038,
};
#define A_had_dataout 0x00000010
-u32 A_had_dataout_used[] = {
+static u32 A_had_dataout_used[] __attribute((unused)) = {
0x0000013e,
};
#define A_had_extmsg 0x00000080
-u32 A_had_extmsg_used[] = {
+static u32 A_had_extmsg_used[] __attribute((unused)) = {
0x0000025a,
0x0000029a,
0x000002da,
};
#define A_had_msgin 0x00000040
-u32 A_had_msgin_used[] = {
+static u32 A_had_msgin_used[] __attribute((unused)) = {
0x00000248,
0x00000288,
0x000002c8,
};
#define A_had_msgout 0x00000002
-u32 A_had_msgout_used[] = {
+static u32 A_had_msgout_used[] __attribute((unused)) = {
0x00000010,
0x00000282,
0x000002c2,
};
#define A_had_select 0x00000001
-u32 A_had_select_used[] = {
+static u32 A_had_select_used[] __attribute((unused)) = {
0x0000000c,
};
#define A_had_status 0x00000020
-u32 A_had_status_used[] = {
+static u32 A_had_status_used[] __attribute((unused)) = {
};
#define A_int_bad_extmsg1a 0xab930000
-u32 A_int_bad_extmsg1a_used[] = {
+static u32 A_int_bad_extmsg1a_used[] __attribute((unused)) = {
0x00000263,
};
#define A_int_bad_extmsg1b 0xab930001
-u32 A_int_bad_extmsg1b_used[] = {
+static u32 A_int_bad_extmsg1b_used[] __attribute((unused)) = {
0x0000026b,
};
#define A_int_bad_extmsg2a 0xab930002
-u32 A_int_bad_extmsg2a_used[] = {
+static u32 A_int_bad_extmsg2a_used[] __attribute((unused)) = {
0x000002a3,
};
#define A_int_bad_extmsg2b 0xab930003
-u32 A_int_bad_extmsg2b_used[] = {
+static u32 A_int_bad_extmsg2b_used[] __attribute((unused)) = {
0x000002ab,
};
#define A_int_bad_extmsg3a 0xab930004
-u32 A_int_bad_extmsg3a_used[] = {
+static u32 A_int_bad_extmsg3a_used[] __attribute((unused)) = {
0x000002e3,
};
#define A_int_bad_extmsg3b 0xab930005
-u32 A_int_bad_extmsg3b_used[] = {
+static u32 A_int_bad_extmsg3b_used[] __attribute((unused)) = {
0x000002eb,
};
#define A_int_bad_msg1 0xab930006
-u32 A_int_bad_msg1_used[] = {
+static u32 A_int_bad_msg1_used[] __attribute((unused)) = {
0x00000255,
};
#define A_int_bad_msg2 0xab930007
-u32 A_int_bad_msg2_used[] = {
+static u32 A_int_bad_msg2_used[] __attribute((unused)) = {
0x00000295,
};
#define A_int_bad_msg3 0xab930008
-u32 A_int_bad_msg3_used[] = {
+static u32 A_int_bad_msg3_used[] __attribute((unused)) = {
0x000002d5,
};
#define A_int_cmd_bad_phase 0xab930009
-u32 A_int_cmd_bad_phase_used[] = {
+static u32 A_int_cmd_bad_phase_used[] __attribute((unused)) = {
0x00000027,
};
#define A_int_cmd_complete 0xab93000a
-u32 A_int_cmd_complete_used[] = {
+static u32 A_int_cmd_complete_used[] __attribute((unused)) = {
0x00000037,
};
#define A_int_data_bad_phase 0xab93000b
-u32 A_int_data_bad_phase_used[] = {
+static u32 A_int_data_bad_phase_used[] __attribute((unused)) = {
0x00000247,
};
#define A_int_disc1 0xab930019
-u32 A_int_disc1_used[] = {
+static u32 A_int_disc1_used[] __attribute((unused)) = {
0x00000277,
};
#define A_int_disc2 0xab93001a
-u32 A_int_disc2_used[] = {
+static u32 A_int_disc2_used[] __attribute((unused)) = {
0x000002b7,
};
#define A_int_disc3 0xab93001b
-u32 A_int_disc3_used[] = {
+static u32 A_int_disc3_used[] __attribute((unused)) = {
0x000002f7,
};
#define A_int_msg_sdtr1 0xab93000c
-u32 A_int_msg_sdtr1_used[] = {
+static u32 A_int_msg_sdtr1_used[] __attribute((unused)) = {
0x00000271,
};
#define A_int_msg_sdtr2 0xab93000d
-u32 A_int_msg_sdtr2_used[] = {
+static u32 A_int_msg_sdtr2_used[] __attribute((unused)) = {
0x000002b1,
};
#define A_int_msg_sdtr3 0xab93000e
-u32 A_int_msg_sdtr3_used[] = {
+static u32 A_int_msg_sdtr3_used[] __attribute((unused)) = {
0x000002f1,
};
#define A_int_no_msgout1 0xab93000f
-u32 A_int_no_msgout1_used[] = {
+static u32 A_int_no_msgout1_used[] __attribute((unused)) = {
0x00000281,
};
#define A_int_no_msgout2 0xab930010
-u32 A_int_no_msgout2_used[] = {
+static u32 A_int_no_msgout2_used[] __attribute((unused)) = {
0x000002c1,
};
#define A_int_no_msgout3 0xab930011
-u32 A_int_no_msgout3_used[] = {
+static u32 A_int_no_msgout3_used[] __attribute((unused)) = {
0x00000301,
};
#define A_int_not_cmd_complete 0xab930012
-u32 A_int_not_cmd_complete_used[] = {
+static u32 A_int_not_cmd_complete_used[] __attribute((unused)) = {
0x00000031,
};
#define A_int_not_rej 0xab93001c
-u32 A_int_not_rej_used[] = {
+static u32 A_int_not_rej_used[] __attribute((unused)) = {
0x0000030d,
};
#define A_int_resel_not_msgin 0xab930016
-u32 A_int_resel_not_msgin_used[] = {
+static u32 A_int_resel_not_msgin_used[] __attribute((unused)) = {
0x00000317,
};
#define A_int_reselected 0xab930017
-u32 A_int_reselected_used[] = {
+static u32 A_int_reselected_used[] __attribute((unused)) = {
0x0000031b,
};
#define A_int_sel_no_ident 0xab930013
-u32 A_int_sel_no_ident_used[] = {
+static u32 A_int_sel_no_ident_used[] __attribute((unused)) = {
0x0000000f,
};
#define A_int_sel_not_cmd 0xab930014
-u32 A_int_sel_not_cmd_used[] = {
+static u32 A_int_sel_not_cmd_used[] __attribute((unused)) = {
0x00000019,
};
#define A_int_selected 0xab930018
-u32 A_int_selected_used[] = {
+static u32 A_int_selected_used[] __attribute((unused)) = {
0x0000032d,
};
#define A_int_status_not_msgin 0xab930015
-u32 A_int_status_not_msgin_used[] = {
+static u32 A_int_status_not_msgin_used[] __attribute((unused)) = {
0x0000002d,
};
#define A_msgin_buf 0x00000000
-u32 A_msgin_buf_used[] = {
+static u32 A_msgin_buf_used[] __attribute((unused)) = {
0x0000024b,
0x0000025f,
0x00000267,
};
#define A_reselected_identify 0x00000000
-u32 A_reselected_identify_used[] = {
+static u32 A_reselected_identify_used[] __attribute((unused)) = {
0x00000319,
};
#define Ent_wait_disc2 0x00000ad0
#define Ent_wait_disc3 0x00000bd0
#define Ent_wait_disc_complete 0x000000d0
-u32 LABELPATCHES[] = {
+static u32 LABELPATCHES[] __attribute((unused)) = {
0x00000007,
0x00000009,
0x00000015,
0x0000032b,
};
-struct {
+static struct {
u32 offset;
void *address;
-} EXTERNAL_PATCHES[] = {
+} EXTERNAL_PATCHES[] __attribute((unused)) = {
};
-u32 INSTRUCTIONS = 407;
-u32 PATCHES = 42;
-u32 EXTERNAL_PATCHES_LEN = 0;
+static u32 INSTRUCTIONS __attribute((unused)) = 407;
+static u32 PATCHES __attribute((unused)) = 42;
+static u32 EXTERNAL_PATCHES_LEN __attribute((unused)) = 0;
#define su_lf_ioff u.bfs_sb.si_lf_ioff
#define su_lf_sblk u.bfs_sb.si_lf_sblk
#define su_lf_eblk u.bfs_sb.si_lf_eblk
-#define su_imap_len u.bfs_sb.si_imap_len
#define su_imap u.bfs_sb.si_imap
#define su_sbh u.bfs_sb.si_sbh
#define su_bfs_sb u.bfs_sb.si_bfs_sb
if (!inode)
return -ENOSPC;
inode->i_sb = s;
- ino = find_first_zero_bit(s->su_imap, s->su_imap_len);
- if (ino >= s->su_lasti) {
+ ino = find_first_zero_bit(s->su_imap, s->su_lasti);
+ if (ino > s->su_lasti) {
iput(inode);
return -ENOSPC;
}
#include <linux/config.h>
#include <linux/module.h>
-#include <linux/malloc.h>
+#include <linux/mm.h>
+#include <linux/slab.h>
#include <linux/init.h>
#include <linux/locks.h>
#include <linux/bfs_fs.h>
void dump_imap(const char *prefix, struct super_block * s)
{
#if 0
- int i, hibit = 8 * (s->su_imap_len) - 1;
- char tmpbuf[400];
+ int i;
+ char *tmpbuf = (char *)get_free_page(GFP_KERNEL);
+ if (!tmpbuf)
+ return;
memset(tmpbuf, 0, 400);
- for (i=hibit; i>=0; i--) {
- if (i>390) break;
+ for (i=s->su_lasti; i>=0; i--) {
+ if (i>PAGE_SIZE-100) break;
if (test_bit(i, s->su_imap))
strcat(tmpbuf, "1");
else
strcat(tmpbuf, "0");
}
- printk(KERN_ERR "BFS-fs: %s: lasti=%d <%s> (%d*8 bits)\n",
- prefix, s->su_lasti, tmpbuf, s->su_imap_len);
+ printk(KERN_ERR "BFS-fs: %s: lasti=%d <%s>\n", prefix, s->su_lasti, tmpbuf);
+ free_page((unsigned long)tmpbuf);
#endif
}
struct buffer_head * bh;
struct bfs_super_block * bfs_sb;
struct inode * inode;
- unsigned long i;
+ int i, imap_len;
MOD_INC_USE_COUNT;
lock_super(s);
s->su_lasti = (bfs_sb->s_start - BFS_BSIZE)/sizeof(struct bfs_inode)
+ BFS_ROOT_INO - 1;
- s->su_imap_len = s->su_lasti/8 + 1; /* 1 byte is 8 bit */
- s->su_imap = kmalloc(s->su_imap_len, GFP_KERNEL);
+ imap_len = s->su_lasti/8 + 1;
+ s->su_imap = kmalloc(imap_len, GFP_KERNEL);
if (!s->su_imap)
goto out;
- memset(s->su_imap, 0, s->su_imap_len);
+ memset(s->su_imap, 0, imap_len);
for (i=0; i<BFS_ROOT_INO; i++)
set_bit(i, s->su_imap);
retval = -ENOEXEC;
/* First of all, some simple consistency checks */
- if (elf_ex.e_ident[0] != 0x7f ||
- strncmp(&elf_ex.e_ident[1], "ELF", 3) != 0)
+ if (memcmp(elf_ex.e_ident, ELFMAG, SELFMAG) != 0)
goto out;
if (elf_ex.e_type != ET_EXEC && elf_ex.e_type != ET_DYN)
(N_MAGIC(interp_ex) != QMAGIC))
interpreter_type = INTERPRETER_ELF;
- if (interp_elf_ex.e_ident[0] != 0x7f ||
- strncmp(&interp_elf_ex.e_ident[1], "ELF", 3) != 0)
+ if (memcmp(interp_elf_ex.e_ident, ELFMAG, SELFMAG) != 0)
interpreter_type &= ~INTERPRETER_ELF;
retval = -ELIBBAD;
if (retval != sizeof(elf_ex))
goto out_putf;
- if (elf_ex.e_ident[0] != 0x7f ||
- strncmp(&elf_ex.e_ident[1], "ELF", 3) != 0)
+ if (memcmp(elf_ex.e_ident, ELFMAG, SELFMAG) != 0)
goto out_putf;
/* First of all, some simple consistency checks */
/* Make sure this is a Linux/Intel ELF executable... */
elf_ex = *((struct elfhdr *)bprm->buf);
- if (elf_ex.e_ident[0] != 0x7f ||
- strncmp(&elf_ex.e_ident[1], "ELF",3) != 0) {
- return -ENOEXEC;
- }
-
-
- /* First of all, some simple consistency checks */
- if ((elf_ex.e_type != ET_EXEC &&
- elf_ex.e_type != ET_DYN) ||
- (!((elf_ex.e_machine == EM_386) || (elf_ex.e_machine == EM_486))) ||
- (!bprm->dentry->d_inode->i_op || !bprm->dentry->d_inode->i_op->default_file_ops ||
- !bprm->dentry->d_inode->i_op->default_file_ops->mmap)){
- return -ENOEXEC;
- }
+ if (memcmp(elf_ex.e_ident, ELFMAG, SELFMAG) != 0)
+ return -ENOEXEC;
+
+ /* First of all, some simple consistency checks */
+ if ((elf_ex.e_type != ET_EXEC && elf_ex.e_type != ET_DYN) ||
+ (!((elf_ex.e_machine == EM_386) || (elf_ex.e_machine == EM_486))) ||
+ (!bprm->dentry->d_inode->i_op ||
+ !bprm->dentry->d_inode->i_op->default_file_ops ||
+ !bprm->dentry->d_inode->i_op->default_file_ops->mmap)) {
+ return -ENOEXEC;
+ }
bprm->sh_bang++; /* Well, the bang-shell is implicit... */
dput(bprm->dentry);
static void unmap_underlying_metadata(struct buffer_head * bh)
{
#if 0
- bh = get_hash_table(bh->b_dev, bh->b_blocknr, bh->b_size);
- if (bh) {
- unmap_buffer(bh);
- /* Here we could run brelse or bforget. We use
- bforget because it will try to put the buffer
- in the freelist. */
- __bforget(bh);
+ if (buffer_new(bh)) {
+ struct old_bh = get_hash_table(bh->b_dev, bh->b_blocknr, bh->b_size);
+ if (old_bh) {
+ unmap_buffer(old_bh);
+ /* Here we could run brelse or bforget. We use
+ bforget because it will try to put the buffer
+ in the freelist. */
+ __bforget(old_bh);
+ }
}
#endif
}
/* The page cache is now PAGE_CACHE_SIZE aligned, period. We handle old a.out
* and others via unaligned private mappings.
*/
- block = page->pg_offset << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits);
+ block = page->index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits);
bh = head;
i = 0;
head = page->buffers;
bbits = inode->i_sb->s_blocksize_bits;
- block = page->pg_offset << (PAGE_CACHE_SHIFT - bbits);
+ block = page->index << (PAGE_CACHE_SHIFT - bbits);
blocks = PAGE_CACHE_SIZE >> bbits;
start_block = offset >> bbits;
end_block = (offset + bytes - 1) >> bbits;
unsigned long data_offset = offset;
int need_balance_dirty;
- offset = inode->i_size - (page->pg_offset << PAGE_CACHE_SHIFT);
- if (page->pg_offset > (inode->i_size >> PAGE_CACHE_SHIFT))
+ offset = inode->i_size - (page->index << PAGE_CACHE_SHIFT);
+ if (page->index > (inode->i_size >> PAGE_CACHE_SHIFT))
offset = 0;
else if (offset >= data_offset)
offset = data_offset;
head = page->buffers;
bbits = inode->i_sb->s_blocksize_bits;
- block = page->pg_offset << (PAGE_CACHE_SHIFT - bbits);
+ block = page->index << (PAGE_CACHE_SHIFT - bbits);
blocks = PAGE_CACHE_SIZE >> bbits;
start_block = offset >> bbits;
end_block = (offset + bytes - 1) >> bbits;
head = page->buffers;
blocks = PAGE_CACHE_SIZE >> inode->i_sb->s_blocksize_bits;
- iblock = page->pg_offset << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits);
+ iblock = page->index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits);
bh = head;
nr = 0;
&cont_file, &cont_dentry);
CDEBUG(D_INODE, "coda ino: %ld, cached ino %ld, page offset: %lx\n",
- coda_inode->i_ino, cii->c_ovp->i_ino, page->offset);
+ coda_inode->i_ino, cii->c_ovp->i_ino, page->index);
block_read_full_page(&cont_file, page);
EXIT;
struct page *page_cache = NULL;
long status;
- pgpos = MSDOS_I(inode)->i_realsize & PAGE_CACHE_MASK;
- while (pgpos < page->offset) {
+ pgpos = MSDOS_I(inode)->i_realsize >> PAGE_CACHE_SHIFT;
+ while (pgpos < page->index) {
hash = page_hash(&inode->i_data, pgpos);
repeat_find: new_page = __find_lock_page(&inode->i_data, pgpos, hash);
if (!new_page) {
page_cache_release(new_page);
if (status < 0)
goto out;
- pgpos = MSDOS_I(inode)->i_realsize & PAGE_CACHE_MASK;
+ pgpos = MSDOS_I(inode)->i_realsize >> PAGE_CACHE_SHIFT;
}
status = block_write_cont_page(file, page, offset, bytes, buf);
out:
spin_lock(&inode_lock);
/* We released the lock, so.. */
old = find_inode(sb, ino, head, find_actor, opaque);
- if (!old)
- {
+ if (!old) {
list_add(&inode->i_list, &inode_in_use);
list_add(&inode->i_hash, head);
inode->i_sb = sb;
return inode;
}
- __iget(inode);
+
+ /*
+ * Uhhuh, somebody else created the same inode under
+ * us. Use the old inode instead of the one we just
+ * allocated.
+ */
+ __iget(old);
spin_unlock(&inode_lock);
destroy_inode(inode);
inode = old;
#include "ncplib_kernel.h"
-static int ncp_read_volume_list(struct file *, void *, filldir_t);
-static int ncp_do_readdir(struct file *, void *, filldir_t);
+static void ncp_read_volume_list(struct file *, void *, filldir_t,
+ struct ncp_cache_control *);
+static void ncp_do_readdir(struct file *, void *, filldir_t,
+ struct ncp_cache_control *);
static ssize_t ncp_dir_read(struct file *, char *, size_t, loff_t *);
static int ncp_readdir(struct file *, void *, filldir_t);
* (Somebody might have used it again ...)
*/
if (dentry->d_count == 1 && NCP_FINFO(inode)->opened) {
-#ifdef NCPFS_PARANOIA
-printk(KERN_DEBUG "ncp_delete_dentry: closing file %s/%s\n",
-dentry->d_parent->d_name.name, dentry->d_name.name);
-#endif
+ PPRINTK("ncp_delete_dentry: closing file %s/%s\n",
+ dentry->d_parent->d_name.name, dentry->d_name.name);
ncp_make_closed(inode);
}
} else
if (!dentry->d_inode || !dir)
goto finished;
-
+
server = NCP_SERVER(dir);
if (!ncp_conn_valid(server))
val = NCP_TEST_AGE(server, dentry);
if (val)
goto finished;
-#ifdef NCPFS_PARANOIA
- printk(KERN_DEBUG "ncp_lookup_validate: %s/%s not valid, age=%ld\n",
+
+ PPRINTK("ncp_lookup_validate: %s/%s not valid, age=%ld\n",
dentry->d_parent->d_name.name, dentry->d_name.name,
NCP_GET_AGE(dentry));
-#endif
memcpy(__name, dentry->d_name.name, len);
__name[len] = '\0';
-#ifdef NCPFS_PARANOIA
-printk(KERN_DEBUG "ncp_lookup_validate: %s, len %d\n", __name, len);
-printk(KERN_DEBUG "ncp_lookup_validate: server lookup for %s/%s\n",
-dentry->d_parent->d_name.name, __name);
-#endif
+
+ PPRINTK("ncp_lookup_validate: %s, len %d\n", __name, len);
+ PPRINTK("ncp_lookup_validate: server lookup for %s/%s\n",
+ dentry->d_parent->d_name.name, __name);
+
if (ncp_is_server_root(dir)) {
io2vol(server, __name, 1);
res = ncp_lookup_volume(server, __name, &(finfo.i));
io2vol(server, __name, !ncp_preserve_case(dir));
res = ncp_obtain_info(server, dir, __name, &(finfo.i));
}
-#ifdef NCPFS_PARANOIA
-printk(KERN_DEBUG "ncp_lookup_validate: looked for %s/%s, res=%d\n",
-dentry->d_parent->d_name.name, __name, res);
-#endif
+ PPRINTK("ncp_lookup_validate: looked for %s/%s, res=%d\n",
+ dentry->d_parent->d_name.name, __name, res);
/*
* If we didn't find it, or if it has a different dirEntNum to
* what we remember, it's not valid any more.
if (!res) {
if (finfo.i.dirEntNum == NCP_FINFO(dentry->d_inode)->dirEntNum)
val=1;
-#ifdef NCPFS_PARANOIA
else
- printk(KERN_DEBUG "ncp_lookup_validate: found, but dirEntNum changed\n");
-#endif
+ PPRINTK("ncp_lookup_validate: found, but dirEntNum changed\n");
+
vol2io(server, finfo.i.entryName,
!ncp_preserve_entry_case(dir, finfo.i.NSCreator));
ncp_update_inode2(dentry->d_inode, &finfo);
- ncp_new_dentry(dentry);
+ if (val)
+ ncp_new_dentry(dentry);
}
finished:
-#ifdef NCPFS_PARANOIA
-printk(KERN_DEBUG "ncp_lookup_validate: result=%d\n", val);
-#endif
-
+ PPRINTK("ncp_lookup_validate: result=%d\n", val);
return val;
}
+static struct page *
+ncp_get_cache_page(struct inode *inode, unsigned long offset, int used)
+{
+ struct page *page, **hash;
+ struct page *page_cache;
+
+ hash = page_hash(&inode->i_data, offset);
+ page = __find_lock_page(&inode->i_data, offset, hash);
+
+ if (used || page)
+ return page;
+
+ page_cache = page_cache_alloc();
+ if (page_cache) {
+ page = page_cache;
+ if (add_to_page_cache_unique(page, &inode->i_data, offset, hash)) {
+ page_cache_release(page);
+ page = NULL;
+ page_cache_free(page_cache);
+ }
+ }
+ return page;
+}
+
+/* most parts from nfsd_d_validate() */
+static int
+ncp_d_validate(struct dentry *dentry)
+{
+ unsigned long dent_addr = (unsigned long) dentry;
+ unsigned long min_addr = PAGE_OFFSET;
+ unsigned long max_addr = min_addr + (max_mapnr << PAGE_SHIFT);
+ unsigned long align_mask = 0x0F;
+ unsigned int len;
+ int valid = 0;
+
+ if (dent_addr < min_addr)
+ goto bad_addr;
+ if (dent_addr > max_addr - sizeof(struct dentry))
+ goto bad_addr;
+ if ((dent_addr & ~align_mask) != dent_addr)
+ goto bad_align;
+ if (!kern_addr_valid(dent_addr))
+ goto bad_addr;
+ /*
+ * Looks safe enough to dereference ...
+ */
+ len = dentry->d_name.len;
+ if (len > NCP_MAXPATHLEN)
+ goto out;
+ /*
+ * Note: d_validate doesn't dereference the parent pointer ...
+ * just combines it with the name hash to find the hash chain.
+ */
+ valid = d_validate(dentry, dentry->d_parent, dentry->d_name.hash, len);
+out:
+ return valid;
+
+bad_addr:
+ PRINTK("ncp_d_validate: invalid address %lx\n", dent_addr);
+ goto out;
+bad_align:
+ PRINTK("ncp_d_validate: unaligned address %lx\n", dent_addr);
+ goto out;
+}
+
+static struct dentry *
+ncp_dget_fpos(struct dentry *dentry, struct dentry *parent, unsigned long fpos)
+{
+ struct dentry *dent = dentry;
+ struct list_head *next;
+
+ if (ncp_d_validate(dent))
+ if ((dent->d_parent == parent) &&
+ ((unsigned long)dent->d_fsdata == fpos))
+ goto out;
+
+ /* If a pointer is invalid, we search the dentry. */
+ next = parent->d_subdirs.next;
+ while (next != &parent->d_subdirs) {
+ dent = list_entry(next, struct dentry, d_child);
+ if ((unsigned long)dent->d_fsdata == fpos)
+ goto out;
+ next = next->next;
+ }
+ dent = NULL;
+out:
+ if (dent)
+ if (dent->d_inode)
+ return dget(dent);
+ return NULL;
+}
static int ncp_readdir(struct file *filp, void *dirent, filldir_t filldir)
{
struct dentry *dentry = filp->f_dentry;
struct inode *inode = dentry->d_inode;
+ struct page *page = NULL;
struct ncp_server *server = NCP_SERVER(inode);
- int entries, result;
+ union ncp_dir_cache *cache = NULL;
+ struct ncp_cache_control ctl;
+ int result;
- DDPRINTK(KERN_DEBUG "ncp_readdir: reading %s/%s, pos=%d\n",
+ ctl.page = NULL;
+ ctl.cache = NULL;
+
+ DDPRINTK("ncp_readdir: reading %s/%s, pos=%d\n",
dentry->d_parent->d_name.name, dentry->d_name.name,
(int) filp->f_pos);
result = -EIO;
if (!ncp_conn_valid(server))
- goto finished;
+ goto out;
result = 0;
if (filp->f_pos == 0) {
if (filldir(dirent, ".", 1, 0, inode->i_ino))
- goto finished;
+ goto out;
filp->f_pos = 1;
}
if (filp->f_pos == 1) {
if (filldir(dirent, "..", 2, 1,
dentry->d_parent->d_inode->i_ino))
- goto finished;
+ goto out;
filp->f_pos = 2;
}
+ page = ncp_get_cache_page(inode, 0, 0);
+ if (!page)
+ goto read_really;
+
+ ctl.cache = cache = (union ncp_dir_cache *) page_address(page);
+ ctl.head = cache->head;
+
+ if (!Page_Uptodate(page) || !ctl.head.eof)
+ goto init_cache;
+
+ if ((filp->f_pos == 2) &&
+ (jiffies - ctl.head.time >= NCP_MAX_AGE(server)))
+ /* Test, whether inode is changed. */
+/* if (...) */
+ goto init_cache;
+ /* Todo, if inode is unchanged? */
+/* else {
+ ncp_renew_dentries(dentry);
+ ctl.head.time = jiffies;
+ } */
+
+ if (filp->f_pos > ctl.head.end)
+ goto finished;
+
+ /*
+ * Should we check the complete cache before using?
+ * If we have big dirs, it can take a long time.
+ */
+
+ ctl.fpos = filp->f_pos + (NCP_DIRCACHE_START - 2);
+ ctl.ofs = ctl.fpos / NCP_DIRCACHE_SIZE;
+ ctl.idx = ctl.fpos % NCP_DIRCACHE_SIZE;
+
+ for (;;) {
+ if (ctl.ofs != 0) {
+ ctl.page = ncp_get_cache_page(inode, ctl.ofs, 1);
+ if (!ctl.page)
+ goto invalid_cache;
+ if (!Page_Uptodate(ctl.page))
+ goto invalid_cache;
+ ctl.cache = (union ncp_dir_cache *)
+ page_address(ctl.page);
+ }
+ while (ctl.idx < NCP_DIRCACHE_SIZE) {
+ struct dentry *dent;
+ int res;
+
+ dent = ncp_dget_fpos(ctl.cache->dentry[ctl.idx],
+ dentry, filp->f_pos);
+ if (!dent)
+ goto invalid_cache;
+ res = filldir(dirent, dent->d_name.name,
+ dent->d_name.len, filp->f_pos,
+ dent->d_inode->i_ino);
+ dput(dent);
+ if (res)
+ goto finished;
+ filp->f_pos += 1;
+ ctl.idx += 1;
+ if (filp->f_pos > ctl.head.end)
+ goto finished;
+ }
+ if (ctl.page) {
+ SetPageUptodate(ctl.page);
+ UnlockPage(ctl.page);
+ page_cache_release(ctl.page);
+ ctl.page = NULL;
+ }
+ ctl.idx = 0;
+ ctl.ofs += 1;
+ }
+invalid_cache:
+ if (ctl.page) {
+ UnlockPage(ctl.page);
+ page_cache_release(ctl.page);
+ ctl.page = NULL;
+ }
+ ctl.cache = cache;
+init_cache:
+ ncp_invalidate_dircache_entries(dentry);
+ ctl.head.time = jiffies;
+ ctl.head.eof = 0;
+ ctl.fpos = 2;
+ ctl.ofs = 0;
+ ctl.idx = NCP_DIRCACHE_START;
+ ctl.filled = 0;
+ ctl.valid = 1;
+read_really:
if (ncp_is_server_root(inode)) {
- entries = ncp_read_volume_list(filp, dirent, filldir);
- DPRINTK(KERN_DEBUG "ncp_read_volume_list returned %d\n", entries);
+ ncp_read_volume_list(filp, dirent, filldir, &ctl);
} else {
- entries = ncp_do_readdir(filp, dirent, filldir);
- DPRINTK(KERN_DEBUG "ncp_readdir: returned %d\n", entries);
+ ncp_do_readdir(filp, dirent, filldir, &ctl);
}
-
- if (entries < 0)
- result = entries;
-
+ ctl.head.end = ctl.fpos - 1;
+ ctl.head.eof = ctl.valid;
finished:
+ if (page) {
+ cache->head = ctl.head;
+ SetPageUptodate(page);
+ UnlockPage(page);
+ page_cache_release(page);
+ }
+ if (ctl.page) {
+ SetPageUptodate(ctl.page);
+ UnlockPage(ctl.page);
+ page_cache_release(ctl.page);
+ }
+out:
return result;
}
static int
-ncp_do_simple_filldir(struct file *filp, char* name, int len,
- void* dirent, filldir_t filldir)
+ncp_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
+ struct ncp_cache_control *ctrl, struct ncp_entry_info *entry)
{
- struct dentry *dentry = filp->f_dentry;
+ struct dentry *newdent, *dentry = filp->f_dentry;
+ struct inode *newino, *inode = dentry->d_inode;
+ struct ncp_server *server = NCP_SERVER(inode);
+ struct ncp_cache_control ctl = *ctrl;
struct qstr qname;
ino_t ino = 0;
- int result;
-
- qname.name = name;
- qname.len = len;
-
- ino = find_inode_number(dentry, &qname);
+ int valid = 0;
- if (!ino)
- ino = iunique(dentry->d_inode->i_sb, 2);
-
- result = filldir(dirent, name, len, filp->f_pos, ino);
- if (!result)
- filp->f_pos += 1;
-
- return result;
-}
-
-static int
-ncp_do_filldir(struct file *filp, struct ncp_entry_info *entry, void *dirent,
- filldir_t filldir)
-{
- struct dentry *dentry = filp->f_dentry;
- struct inode *inode = dentry->d_inode;
- struct qstr qname;
- ino_t ino = 0;
- int result;
+ vol2io(server, entry->i.entryName,
+ !ncp_preserve_entry_case(inode, entry->i.NSCreator));
- /* For getwd() we have to return the correct inode in d_ino if the
- * inode is currently in use. Otherwise the inode number does not
- * matter. (You can argue a lot about this..)
- */
qname.name = entry->i.entryName;
qname.len = entry->i.nameLen;
+ qname.hash = full_name_hash(qname.name, qname.len);
- {
- struct dentry *newdent;
- struct inode *newino;
-
- qname.hash = full_name_hash(qname.name, qname.len);
- if (dentry->d_op && dentry->d_op->d_hash)
- if (dentry->d_op->d_hash(dentry, &qname) != 0)
- goto end_advance;
-
- newdent = d_lookup(dentry, &qname);
+ if (dentry->d_op && dentry->d_op->d_hash)
+ if (dentry->d_op->d_hash(dentry, &qname) != 0)
+ goto end_advance;
- if (!newdent) {
- newdent = d_alloc(dentry, &qname);
- if (!newdent)
- goto end_advance;
- }
+ newdent = d_lookup(dentry, &qname);
- if (!newdent->d_inode) {
- entry->opened = 0;
- entry->ino = iunique(inode->i_sb, 2);
- newino = ncp_iget(inode->i_sb, entry);
- if (newino) {
- newdent->d_op = &ncp_dentry_operations;
- d_add(newdent, newino);
- ncp_new_dentry(newdent);
- }
- } else {
- ncp_update_inode2(newdent->d_inode, entry);
- ncp_new_dentry(newdent);
+ if (!newdent) {
+ newdent = d_alloc(dentry, &qname);
+ if (!newdent)
+ goto end_advance;
+ } else
+ memcpy((char *) newdent->d_name.name, qname.name,
+ newdent->d_name.len);
+
+ if (!newdent->d_inode) {
+ entry->opened = 0;
+ entry->ino = iunique(inode->i_sb, 2);
+ newino = ncp_iget(inode->i_sb, entry);
+ if (newino) {
+ newdent->d_op = &ncp_dentry_operations;
+ d_add(newdent, newino);
}
+ } else
+ ncp_update_inode2(newdent->d_inode, entry);
- if (newdent->d_inode)
- ino = newdent->d_inode->i_ino;
-
- dput(newdent);
+ if (newdent->d_inode) {
+ ino = newdent->d_inode->i_ino;
+ newdent->d_fsdata = (void *) ctl.fpos;
+ ncp_new_dentry(newdent);
+ }
+ if (ctl.idx >= NCP_DIRCACHE_SIZE) {
+ if (ctl.page) {
+ SetPageUptodate(ctl.page);
+ UnlockPage(ctl.page);
+ page_cache_release(ctl.page);
+ }
+ ctl.cache = NULL;
+ ctl.idx -= NCP_DIRCACHE_SIZE;
+ ctl.ofs += 1;
+ ctl.page = ncp_get_cache_page(inode, ctl.ofs, 0);
+ if (ctl.page)
+ ctl.cache = (union ncp_dir_cache *)
+ page_address(ctl.page);
+ }
+ if (ctl.cache) {
+ ctl.cache->dentry[ctl.idx] = newdent;
+ valid = 1;
+ }
+ dput(newdent);
end_advance:
+ if (!valid)
+ ctl.valid = 0;
+ if (!ctl.filled && (ctl.fpos == filp->f_pos)) {
+ if (!ino)
+ ino = find_inode_number(dentry, &qname);
+ if (!ino)
+ ino = iunique(inode->i_sb, 2);
+ ctl.filled = filldir(dirent, entry->i.entryName,
+ entry->i.nameLen, filp->f_pos, ino);
+ if (!ctl.filled)
+ filp->f_pos += 1;
}
- if (!ino)
- ino = find_inode_number(dentry, &qname);
-
- if (!ino)
- ino = iunique(inode->i_sb, 2);
-
- result = filldir(dirent, entry->i.entryName, entry->i.nameLen,
- filp->f_pos, ino);
- if (!result)
- filp->f_pos += 1;
-
- return result;
+ ctl.fpos += 1;
+ ctl.idx += 1;
+ *ctrl = ctl;
+ return (ctl.valid || !ctl.filled);
}
-static int
-ncp_read_volume_list(struct file *filp, void *dirent, filldir_t filldir)
+static void
+ncp_read_volume_list(struct file *filp, void *dirent, filldir_t filldir,
+ struct ncp_cache_control *ctl)
{
struct dentry *dentry = filp->f_dentry;
struct inode *inode = dentry->d_inode;
struct ncp_server *server = NCP_SERVER(inode);
struct ncp_volume_info info;
struct ncp_entry_info entry;
- unsigned long total_count = 2, fpos = filp->f_pos;
int i;
- DPRINTK(KERN_DEBUG "ncp_read_volume_list: pos=%ld\n", fpos);
+ DPRINTK("ncp_read_volume_list: pos=%ld\n",
+ (unsigned long) filp->f_pos);
for (i = 0; i < NCP_NUMBER_OF_VOLUMES; i++) {
if (ncp_get_volume_info_with_number(server, i, &info) != 0)
- break;
+ return;
if (!strlen(info.volume_name))
continue;
- if (total_count < fpos) {
- DPRINTK(KERN_DEBUG "ncp_read_volume_list: skipped vol: %s\n",
- info.volume_name);
- } else {
- DPRINTK(KERN_DEBUG "ncp_read_volume_list: found vol: %s\n",
- info.volume_name);
+ DPRINTK("ncp_read_volume_list: found vol: %s\n",
+ info.volume_name);
- if (ncp_lookup_volume(server, info.volume_name,
- &entry.i)) {
- DPRINTK(KERN_DEBUG "ncpfs: could not lookup vol %s\n",
- info.volume_name);
- continue;
- }
- vol2io(server, entry.i.entryName,
- !ncp_preserve_entry_case(inode, entry.i.NSCreator));
- if (ncp_do_filldir(filp, &entry, dirent, filldir))
- break;
+ if (ncp_lookup_volume(server, info.volume_name,
+ &entry.i)) {
+ DPRINTK("ncpfs: could not lookup vol %s\n",
+ info.volume_name);
+ continue;
}
- total_count += 1;
+ if (!ncp_fill_cache(filp, dirent, filldir, ctl, &entry))
+ return;
}
-
- return (total_count - fpos);
}
-static int ncp_do_readdir(struct file *filp, void *dirent, filldir_t filldir)
+static void ncp_do_readdir(struct file *filp, void *dirent, filldir_t filldir,
+ struct ncp_cache_control *ctl)
{
struct dentry *dentry = filp->f_dentry;
struct inode *dir = dentry->d_inode;
struct ncp_server *server = NCP_SERVER(dir);
- struct ncp_seq_cache *cache = NULL;
- struct ncp_cache_control ctl;
+ struct nw_search_sequence seq;
struct ncp_entry_info entry;
- struct page *page, **hash;
- unsigned long total_count = 0, fpos = filp->f_pos;
int err;
- DPRINTK(KERN_DEBUG "ncp_do_readdir: %s/%s, fpos=%ld\n",
- dentry->d_parent->d_name.name, dentry->d_name.name, fpos);
-
-#ifdef NCPFS_DEBUG_VERBOSE
-printk("ncp_do_readdir: finding cache for %s/%s\n",
- dentry->d_parent->d_name.name, dentry->d_name.name);
-#endif
-
- /* cache using inspired by smbfs and nfs */
- hash = page_hash(&dir->i_data, 0);
-
- page = __find_lock_page(&dir->i_data, 0, hash);
-
- if (!page) {
- unsigned long page_cache;
-
- page_cache = page_cache_alloc();
- if (page_cache) {
- page = page_cache_entry(page_cache);
- if (add_to_page_cache_unique(page, &dir->i_data, 0, hash)) {
- page_cache_release(page);
- page = NULL;
- page_cache_free(page_cache);
- }
- }
- }
-
- if (!page)
- goto start_search;
-
- cache = (struct ncp_seq_cache *) page_address(page);
- ctl = cache->ctl;
-
- if (!Page_Uptodate(page))
- ctl.currentpos = NCP_FPOS_EMPTY;
-
- if ((fpos == 2) || (fpos < ctl.firstcache))
- ctl.currentpos = NCP_FPOS_EMPTY;
-
- if (ctl.currentpos == NCP_FPOS_EMPTY)
- goto start_search;
-
- {
- int fetchpos = ctl.cachehead;
- int readpos = ctl.firstcache;
-
- while (readpos < fpos) {
- fetchpos += cache->cache[fetchpos] + 1;
- readpos++;
- }
- while (fpos < ctl.currentpos) {
- err = ncp_do_simple_filldir(filp,
- (char*)(cache->cache+fetchpos+1),
- cache->cache[fetchpos],
- dirent, filldir);
- if (err)
- goto out;
- fetchpos += cache->cache[fetchpos] + 1;
- fpos++;
- total_count++;
- }
+ DPRINTK("ncp_do_readdir: %s/%s, fpos=%ld\n",
+ dentry->d_parent->d_name.name, dentry->d_name.name,
+ (unsigned long) filp->f_pos);
+ PPRINTK("ncp_do_readdir: init %s, volnum=%d, dirent=%u\n",
+ dentry->d_name.name, NCP_FINFO(dir)->volNumber,
+ NCP_FINFO(dir)->dirEntNum);
+
+ err = ncp_initialize_search(server, dir, &seq);
+ if (err) {
+ DPRINTK("ncp_do_readdir: init failed, err=%d\n", err);
+ return;
}
-
-start_search:
-
- DDPRINTK(KERN_DEBUG "ncp_do_readdir: %s: f_pos=%ld,total_count=%ld\n",
- dentry->d_name.name, fpos, total_count);
-
- if (ctl.currentpos == NCP_FPOS_EMPTY) {
-#ifdef NCPFS_PARANOIA
-printk(KERN_DEBUG "ncp_do_readdir: init %s, volnum=%d, dirent=%u\n",
-dentry->d_name.name, NCP_FINFO(dir)->volNumber, NCP_FINFO(dir)->dirEntNum);
-#endif
- err = ncp_initialize_search(server, dir, &ctl.seq);
- if (err) {
- DPRINTK(KERN_DEBUG "ncp_do_readdir: init failed, err=%d\n", err);
- goto out;
- }
- ctl.eof = 0;
- ctl.cachehead = ctl.cachetail = 0;
- ctl.firstcache = ctl.currentpos = 2;
- } else
- DDPRINTK(KERN_DEBUG "ncp_do_readdir: reused seq for %s, fpos=%li\n",
- dentry->d_name.name, total_count);
-
for (;;) {
- err = ncp_search_for_file_or_subdir(server, &ctl.seq,
- &entry.i);
+ err = ncp_search_for_file_or_subdir(server, &seq, &entry.i);
if (err) {
- DPRINTK(KERN_DEBUG "ncp_do_readdir: search failed, err=%d\n", err);
- ctl.eof = 1;
- break;
- }
-
- ctl.currentpos++;
-
- vol2io(server, entry.i.entryName,
- !ncp_preserve_entry_case(dir, entry.i.NSCreator));
-
- if (page) {
- int tlen = ctl.cachetail + entry.i.nameLen + 1;
-
- if (tlen > NCP_DIRCACHE_SIZE) {
- int ofs = ctl.cachehead;
-
- while (tlen - ofs > NCP_DIRCACHE_SIZE) {
- ofs += cache->cache[ofs] + 1;
- ctl.firstcache++;
- }
- ctl.cachetail -= ofs;
- memmove(cache->cache+0,
- cache->cache+ofs,
- ctl.cachetail);
- }
- cache->cache[ctl.cachetail++] = entry.i.nameLen;
- memcpy(cache->cache+ctl.cachetail,
- entry.i.entryName, entry.i.nameLen);
- ctl.cachetail += entry.i.nameLen;
- }
- if (ctl.currentpos < fpos) {
- DPRINTK(KERN_DEBUG "ncp_do_readdir: skipped file: %s/%s\n",
- dentry->d_name.name, entry.i.entryName);
- } else {
- DDPRINTK(KERN_DEBUG "ncp_do_r: file: %s, f_pos=%ld,total_count=%ld",
- entry.i.entryName, fpos, total_count);
- if (ncp_do_filldir(filp, &entry, dirent, filldir))
- break;
+ DPRINTK("ncp_do_readdir: search failed, err=%d\n", err);
+ return;
}
- total_count++;
- fpos++;
+ if (!ncp_fill_cache(filp, dirent, filldir, ctl, &entry))
+ return;
}
-out:
- if (page) {
- cache->ctl = ctl;
- SetPageUptodate(page);
- UnlockPage(page);
- page_cache_release(page);
- }
-
- DDPRINTK(KERN_DEBUG "ncp_do_readdir: %s: return=%ld\n",
- dentry->d_name.name, total_count);
- return total_count;
}
int ncp_conn_logged_in(struct super_block *sb)
result = -ENOENT;
io2vol(server, server->m.mounted_vol, 1);
if (ncp_lookup_volume(server, server->m.mounted_vol, &i)) {
-#ifdef NCPFS_PARANOIA
-printk(KERN_DEBUG "ncp_conn_logged_in: %s not found\n", server->m.mounted_vol);
-#endif
+ PPRINTK("ncp_conn_logged_in: %s not found\n",
+ server->m.mounted_vol);
goto out;
}
vol2io(server, i.entryName, 1);
NCP_FINFO(ino)->dirEntNum = i.dirEntNum;
NCP_FINFO(ino)->DosDirNum = i.DosDirNum;
} else {
- DPRINTK(KERN_DEBUG "ncpfs: sb->s_root->d_inode == NULL!\n");
+ DPRINTK("ncpfs: sb->s_root->d_inode == NULL!\n");
}
} else {
- DPRINTK(KERN_DEBUG "ncpfs: sb->s_root == NULL!\n");
+ DPRINTK("ncpfs: sb->s_root == NULL!\n");
}
}
result = 0;
memcpy(__name, dentry->d_name.name, len);
__name[len] = '\0';
-#ifdef NCPFS_PARANOIA
-printk(KERN_DEBUG "ncp_lookup: %s, len %d\n", __name, len);
-printk(KERN_DEBUG "ncp_lookup: server lookup for %s/%s\n",
-dentry->d_parent->d_name.name, __name);
-#endif
+ PPRINTK("ncp_lookup: %s, len %d\n", __name, len);
+ PPRINTK("ncp_lookup: server lookup for %s/%s\n",
+ dentry->d_parent->d_name.name, __name);
if (ncp_is_server_root(dir)) {
io2vol(server, __name, 1);
res = ncp_lookup_volume(server, __name, &(finfo.i));
io2vol(server, __name, !ncp_preserve_case(dir));
res = ncp_obtain_info(server, dir, __name, &(finfo.i));
}
-#ifdef NCPFS_PARANOIA
-printk(KERN_DEBUG "ncp_lookup: looked for %s/%s, res=%d\n",
-dentry->d_parent->d_name.name, __name, res);
-#endif
+ PPRINTK("ncp_lookup: looked for %s/%s, res=%d\n",
+ dentry->d_parent->d_name.name, __name, res);
/*
* If we didn't find an entry, make a negative dentry.
*/
}
finished:
-#ifdef NCPFS_PARANOIA
-printk(KERN_DEBUG "ncp_lookup: result=%d\n", error);
-#endif
+ PPRINTK("ncp_lookup: result=%d\n", error);
return ERR_PTR(error);
}
return error;
out_close:
-#ifdef NCPFS_PARANOIA
-printk(KERN_DEBUG "ncp_instantiate: %s/%s failed, closing file\n",
-dentry->d_parent->d_name.name, dentry->d_name.name);
-#endif
+ PPRINTK("ncp_instantiate: %s/%s failed, closing file\n",
+ dentry->d_parent->d_name.name, dentry->d_name.name);
ncp_close_file(NCP_SERVER(dir), finfo->file_handle);
goto out;
}
struct ncp_server *server = NCP_SERVER(dir);
__u8 _name[dentry->d_name.len + 1];
-#ifdef NCPFS_PARANOIA
-printk(KERN_DEBUG "ncp_create_new: creating %s/%s, mode=%x\n",
-dentry->d_parent->d_name.name, dentry->d_name.name, mode);
-#endif
+ PPRINTK("ncp_create_new: creating %s/%s, mode=%x\n",
+ dentry->d_parent->d_name.name, dentry->d_name.name, mode);
error = -EIO;
if (!ncp_conn_valid(server))
goto out;
error = ncp_instantiate(dir, dentry, &finfo);
} else {
if (result == 0x87) error = -ENAMETOOLONG;
- DPRINTK(KERN_DEBUG "ncp_create: %s/%s failed\n",
+ DPRINTK("ncp_create: %s/%s failed\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
}
struct ncp_server *server = NCP_SERVER(dir);
__u8 _name[dentry->d_name.len + 1];
- DPRINTK(KERN_DEBUG "ncp_mkdir: making %s/%s\n",
+ DPRINTK("ncp_mkdir: making %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
error = -EIO;
if (!ncp_conn_valid(server))
struct ncp_server *server = NCP_SERVER(dir);
__u8 _name[dentry->d_name.len + 1];
- DPRINTK(KERN_DEBUG "ncp_rmdir: removing %s/%s\n",
+ DPRINTK("ncp_rmdir: removing %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
error = -EIO;
struct ncp_server *server = NCP_SERVER(dir);
int error;
- DPRINTK(KERN_DEBUG "ncp_unlink: unlinking %s/%s\n",
+ DPRINTK("ncp_unlink: unlinking %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
error = -EIO;
* Check whether to close the file ...
*/
if (inode && NCP_FINFO(inode)->opened) {
-#ifdef NCPFS_PARANOIA
-printk(KERN_DEBUG "ncp_unlink: closing file\n");
-#endif
+ PPRINTK("ncp_unlink: closing file\n");
ncp_make_closed(inode);
}
#endif
switch (error) {
case 0x00:
- DPRINTK(KERN_DEBUG "ncp: removed %s/%s\n",
+ DPRINTK("ncp: removed %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
d_delete(dentry);
break;
char _old_name[old_dentry->d_name.len + 1];
char _new_name[new_dentry->d_name.len + 1];
- DPRINTK(KERN_DEBUG "ncp_rename: %s/%s to %s/%s\n",
+ DPRINTK("ncp_rename: %s/%s to %s/%s\n",
old_dentry->d_parent->d_name.name, old_dentry->d_name.name,
new_dentry->d_parent->d_name.name, new_dentry->d_name.name);
#endif
switch (error) {
case 0x00:
- DPRINTK(KERN_DEBUG "ncp renamed %s -> %s.\n",
+ DPRINTK("ncp renamed %s -> %s.\n",
old_dentry->d_name.name,new_dentry->d_name.name);
/* d_move(old_dentry, new_dentry); */
break;
goto out;
}
- DPRINTK(KERN_DEBUG "ncp_make_open: opened=%d, volume # %u, dir entry # %u\n",
+ DPRINTK("ncp_make_open: opened=%d, volume # %u, dir entry # %u\n",
NCP_FINFO(inode)->opened,
NCP_FINFO(inode)->volNumber,
NCP_FINFO(inode)->dirEntNum);
NULL, NULL, OC_MODE_OPEN,
0, AR_READ, &finfo);
if (result) {
-#ifdef NCPFS_PARANOIA
-printk(KERN_DEBUG "ncp_make_open: failed, result=%d\n", result);
-#endif
+ PPRINTK("ncp_make_open: failed, result=%d\n", result);
goto out_unlock;
}
/*
}
access = NCP_FINFO(inode)->access;
-#ifdef NCPFS_PARANOIA
-printk(KERN_DEBUG "ncp_make_open: file open, access=%x\n", access);
-#endif
+ PPRINTK("ncp_make_open: file open, access=%x\n", access);
if (access == right || access == O_RDWR)
error = 0;
void* freepage;
size_t freelen;
- DPRINTK(KERN_DEBUG "ncp_file_read: enter %s/%s\n",
+ DPRINTK("ncp_file_read: enter %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
error = -EINVAL;
if (inode == NULL) {
- DPRINTK(KERN_DEBUG "ncp_file_read: inode = NULL\n");
+ DPRINTK("ncp_file_read: inode = NULL\n");
goto out;
}
error = -EIO;
goto out;
error = -EINVAL;
if (!S_ISREG(inode->i_mode)) {
- DPRINTK(KERN_DEBUG "ncp_file_read: read from non-file, mode %07o\n",
+ DPRINTK("ncp_file_read: read from non-file, mode %07o\n",
inode->i_mode);
goto out;
}
inode->i_atime = CURRENT_TIME;
}
- DPRINTK(KERN_DEBUG "ncp_file_read: exit %s/%s\n",
+ DPRINTK("ncp_file_read: exit %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
out:
return already_read ? already_read : error;
int errno;
void* bouncebuffer;
- DPRINTK(KERN_DEBUG "ncp_file_write: enter %s/%s\n",
+ DPRINTK("ncp_file_write: enter %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
if (inode == NULL) {
- DPRINTK(KERN_DEBUG "ncp_file_write: inode = NULL\n");
+ DPRINTK("ncp_file_write: inode = NULL\n");
return -EINVAL;
}
errno = -EIO;
if (!ncp_conn_valid(NCP_SERVER(inode)))
goto out;
if (!S_ISREG(inode->i_mode)) {
- DPRINTK(KERN_DEBUG "ncp_file_write: write to non-file, mode %07o\n",
+ DPRINTK("ncp_file_write: write to non-file, mode %07o\n",
inode->i_mode);
return -EINVAL;
}
if (pos > inode->i_size) {
inode->i_size = pos;
}
- DPRINTK(KERN_DEBUG "ncp_file_write: exit %s/%s\n",
+ DPRINTK("ncp_file_write: exit %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
out:
return already_written ? already_written : errno;
NCP_FINFO(inode)->server_file_handle = nwinfo->server_file_handle;
memcpy(NCP_FINFO(inode)->file_handle, nwinfo->file_handle,
sizeof(nwinfo->file_handle));
-#ifdef NCPFS_DEBUG_VERBOSE
-printk(KERN_DEBUG "ncp_update_inode: updated %s, volnum=%d, dirent=%u\n",
-nwinfo->i.entryName, NCP_FINFO(inode)->volNumber, NCP_FINFO(inode)->dirEntNum);
-#endif
+ DPRINTK("ncp_update_inode: updated %s, volnum=%d, dirent=%u\n",
+ nwinfo->i.entryName, NCP_FINFO(inode)->volNumber,
+ NCP_FINFO(inode)->dirEntNum);
}
void ncp_update_inode2(struct inode* inode, struct ncp_entry_info *nwinfo)
switch (nwi->attributes & (aHIDDEN|aSYSTEM)) {
case aHIDDEN:
if (server->m.flags & NCP_MOUNT_SYMLINKS) {
- if ((inode->i_size >= NCP_MIN_SYMLINK_SIZE)
- && (inode->i_size <= NCP_MAX_SYMLINK_SIZE)) {
+ if (/* (inode->i_size >= NCP_MIN_SYMLINK_SIZE)
+ && */ (inode->i_size <= NCP_MAX_SYMLINK_SIZE)) {
inode->i_mode = (inode->i_mode & ~S_IFMT) | S_IFLNK;
break;
}
}
if (nwi->attributes & aRONLY) inode->i_mode &= ~0222;
- DDPRINTK(KERN_DEBUG "ncp_read_inode: inode->i_mode = %u\n", inode->i_mode);
+ DDPRINTK("ncp_read_inode: inode->i_mode = %u\n", inode->i_mode);
inode->i_nlink = 1;
inode->i_uid = server->m.uid;
ncp_delete_inode(struct inode *inode)
{
if (S_ISDIR(inode->i_mode)) {
- DDPRINTK(KERN_DEBUG "ncp_delete_inode: put directory %ld\n", inode->i_ino);
+ DDPRINTK("ncp_delete_inode: put directory %ld\n", inode->i_ino);
}
if (NCP_FINFO(inode)->opened && ncp_make_closed(inode) != 0) {
server->m = *data;
/* Althought anything producing this is buggy, it happens
now because of PATH_MAX changes.. */
- if (server->m.time_out < 10) {
+ if (server->m.time_out < 1) {
server->m.time_out = 10;
printk(KERN_INFO "You need to recompile your ncpfs utils..\n");
}
+ server->m.time_out = server->m.time_out * HZ / 100;
server->m.file_mode = (server->m.file_mode &
(S_IRWXU | S_IRWXG | S_IRWXO)) | S_IFREG;
server->m.dir_mode = (server->m.dir_mode &
ncp_unlock_server(server);
if (error < 0)
goto out_no_connect;
- DPRINTK(KERN_DEBUG "ncp_read_super: NCP_SBP(sb) = %x\n", (int) NCP_SBP(sb));
+ DPRINTK("ncp_read_super: NCP_SBP(sb) = %x\n", (int) NCP_SBP(sb));
#ifdef CONFIG_NCPFS_PACKET_SIGNING
if (ncp_negotiate_size_and_options(server, NCP_DEFAULT_BUFSIZE,
if (ncp_negotiate_buffersize(server, NCP_DEFAULT_BUFSIZE,
&(server->buffer_size)) != 0)
goto out_no_bufsize;
- DPRINTK(KERN_DEBUG "ncpfs: bufsize = %d\n", server->buffer_size);
+ DPRINTK("ncpfs: bufsize = %d\n", server->buffer_size);
memset(&finfo, 0, sizeof(finfo));
finfo.i.attributes = aDIR;
root_inode = ncp_iget(sb, &finfo);
if (!root_inode)
goto out_no_root;
- DPRINTK(KERN_DEBUG "ncp_read_super: root vol=%d\n", NCP_FINFO(root_inode)->volNumber);
+ DPRINTK("ncp_read_super: root vol=%d\n", NCP_FINFO(root_inode)->volNumber);
sb->s_root = d_alloc_root(root_inode);
if (!sb->s_root)
goto out_no_root;
if ((attr->ia_valid & ATTR_SIZE) != 0) {
int written;
- DPRINTK(KERN_DEBUG "ncpfs: trying to change size to %ld\n",
+ DPRINTK("ncpfs: trying to change size to %ld\n",
attr->ia_size);
if ((result = ncp_make_open(inode, O_RDWR)) < 0) {
int init_module(void)
{
- DPRINTK(KERN_DEBUG "ncpfs: init_module called\n");
+ DPRINTK("ncpfs: init_module called\n");
#ifdef DEBUG_NCP_MALLOC
ncp_malloced = 0;
void cleanup_module(void)
{
- DPRINTK(KERN_DEBUG "ncpfs: cleanup_module called\n");
+ DPRINTK("ncpfs: cleanup_module called\n");
unregister_filesystem(&ncp_fs_type);
#ifdef DEBUG_NCP_MALLOC
- printk(KERN_DEBUG "ncp_malloced: %d\n", ncp_malloced);
- printk(KERN_DEBUG "ncp_current_malloced: %d\n", ncp_current_malloced);
+ PRINTK("ncp_malloced: %d\n", ncp_malloced);
+ PRINTK("ncp_current_malloced: %d\n", ncp_current_malloced);
#endif
}
else
result = server->reply_size;
ncp_unlock_server(server);
- DPRINTK(KERN_DEBUG "ncp_ioctl: copy %d bytes\n",
+ DPRINTK("ncp_ioctl: copy %d bytes\n",
result);
if (result >= 0)
if (copy_to_user(request.data, bouncebuffer, result))
copy_from_user(&info, (struct ncp_fs_info *) arg, sizeof(info));
if (info.version != NCP_GET_FS_INFO_VERSION) {
- DPRINTK(KERN_DEBUG "info.version invalid: %d\n", info.version);
+ DPRINTK("info.version invalid: %d\n", info.version);
return -EINVAL;
}
/* TODO: info.addr = server->m.serv_addr; */
sr.dirEntNum = NCP_FINFO(inode)->dirEntNum;
sr.namespace = server->name_space[sr.volNumber];
} else
- DPRINTK(KERN_DEBUG "ncpfs: s_root->d_inode==NULL\n");
+ DPRINTK("ncpfs: s_root->d_inode==NULL\n");
} else
- DPRINTK(KERN_DEBUG "ncpfs: s_root==NULL\n");
+ DPRINTK("ncpfs: s_root==NULL\n");
} else {
sr.volNumber = -1;
sr.namespace = 0;
NCP_FINFO(inode)->dirEntNum = i.dirEntNum;
NCP_FINFO(inode)->DosDirNum = i.DosDirNum;
} else
- DPRINTK(KERN_DEBUG "ncpfs: s_root->d_inode==NULL\n");
+ DPRINTK("ncpfs: s_root->d_inode==NULL\n");
} else
- DPRINTK(KERN_DEBUG "ncpfs: s_root==NULL\n");
+ DPRINTK("ncpfs: s_root==NULL\n");
return 0;
}
/*
* Fill in the supplied page for mmap
*/
-static unsigned long ncp_file_mmap_nopage(struct vm_area_struct *area,
- unsigned long address, int no_share)
+static struct page* ncp_file_mmap_nopage(struct vm_area_struct *area,
+ unsigned long address, int write_access)
{
struct file *file = area->vm_file;
struct dentry *dentry = file->f_dentry;
struct inode *inode = dentry->d_inode;
- unsigned long page;
+ struct page* page;
+ unsigned long pg_addr;
unsigned int already_read;
unsigned int count;
int bufsize;
int pos;
- page = __get_free_page(GFP_KERNEL);
+ page = __get_pages(GFP_KERNEL, 0);
if (!page)
return page;
+ pg_addr = page_address(page);
address &= PAGE_MASK;
- pos = address - area->vm_start + area->vm_offset;
+ pos = address - area->vm_start + (area->vm_pgoff << PAGE_SHIFT);
count = PAGE_SIZE;
if (address + PAGE_SIZE > area->vm_end) {
if (ncp_read_kernel(NCP_SERVER(inode),
NCP_FINFO(inode)->file_handle,
pos, to_read,
- (char *) (page + already_read),
+ (char *) (pg_addr + already_read),
&read_this_time) != 0) {
read_this_time = 0;
}
}
if (already_read < PAGE_SIZE)
- memset((char*)(page + already_read), 0,
+ memset((char*)(pg_addr + already_read), 0,
PAGE_SIZE - already_read);
return page;
}
{
struct inode *inode = file->f_dentry->d_inode;
- DPRINTK(KERN_DEBUG "ncp_mmap: called\n");
+ DPRINTK("ncp_mmap: called\n");
if (!ncp_conn_valid(NCP_SERVER(inode))) {
return -EIO;
return a < b ? a : b;
}
-static void assert_server_locked(struct ncp_server *server)
+static inline void assert_server_locked(struct ncp_server *server)
{
if (server->lock == 0) {
- DPRINTK(KERN_DEBUG "ncpfs: server not locked!\n");
+ DPRINTK("ncpfs: server not locked!\n");
}
}
int len = strlen(s);
assert_server_locked(server);
if (len > 255) {
- DPRINTK(KERN_DEBUG "ncpfs: string too long: %s\n", s);
+ DPRINTK("ncpfs: string too long: %s\n", s);
len = 255;
}
ncp_add_byte(server, len);
return;
}
-static void ncp_init_request(struct ncp_server *server)
+static inline void ncp_init_request(struct ncp_server *server)
{
ncp_lock_server(server);
server->has_subfunction = 1;
}
-static char *
+static inline char *
ncp_reply_data(struct ncp_server *server, int offset)
{
return &(server->packet[sizeof(struct ncp_reply_header) + offset]);
result = -EIO;
len = ncp_reply_byte(server, 29);
if (len > NCP_VOLNAME_LEN) {
- DPRINTK(KERN_DEBUG "ncpfs: volume name too long: %d\n", len);
+ DPRINTK("ncpfs: volume name too long: %d\n", len);
goto out;
}
memcpy(&(target->volume_name), ncp_reply_data(server, 30), len);
int err;
NCP_FINFO(inode)->opened = 0;
err = ncp_close_file(NCP_SERVER(inode), NCP_FINFO(inode)->file_handle);
-#ifdef NCPFS_PARANOIA
-if (!err)
-printk(KERN_DEBUG "ncp_make_closed: volnum=%d, dirent=%u, error=%d\n",
-NCP_FINFO(inode)->volNumber, NCP_FINFO(inode)->dirEntNum, err);
-#endif
+
+ if (!err)
+ PPRINTK("ncp_make_closed: volnum=%d, dirent=%u, error=%d\n",
+ NCP_FINFO(inode)->volNumber,
+ NCP_FINFO(inode)->dirEntNum, err);
return err;
}
namespace = ncp_reply_data(server, 2);
while (no_namespaces > 0) {
- DPRINTK(KERN_DEBUG "get_namespaces: found %d on %d\n", *namespace, volume);
+ DPRINTK("get_namespaces: found %d on %d\n", *namespace, volume);
#ifdef CONFIG_NCPFS_NFS_NS
if ((*namespace == NW_NS_NFS) && !(server->m.flags&NCP_MOUNT_NO_NFS))
int result;
int volnum;
- DPRINTK(KERN_DEBUG "ncp_lookup_volume: looking up vol %s\n", volname);
+ DPRINTK("ncp_lookup_volume: looking up vol %s\n", volname);
ncp_init_request(server);
ncp_add_byte(server, 22); /* Subfunction: Generate dir handle */
server->name_space[volnum] = ncp_get_known_namespace(server, volnum);
- DPRINTK(KERN_DEBUG "lookup_vol: namespace[%d] = %d\n",
+ DPRINTK("lookup_vol: namespace[%d] = %d\n",
volnum, server->name_space[volnum]);
target->nameLen = strlen(volname);
if (!inode) {
#if CONFIG_NCPFS_DEBUGDENTRY
- printk(KERN_DEBUG "ncpfs: ncpdel2: dentry->d_inode == NULL\n");
+ PRINTK("ncpfs: ncpdel2: dentry->d_inode == NULL\n");
#endif
return 0xFF; /* Any error */
}
#endif /* CONFIG_NCPFS_NLS */
#define NCP_GET_AGE(dentry) (jiffies - (dentry)->d_time)
-#define NCP_MAX_AGE (server->dentry_ttl)
-#define NCP_TEST_AGE(server,dentry) (NCP_GET_AGE(dentry) < NCP_MAX_AGE)
+#define NCP_MAX_AGE(server) ((server)->dentry_ttl)
+#define NCP_TEST_AGE(server,dentry) (NCP_GET_AGE(dentry) < NCP_MAX_AGE(server))
static inline void
ncp_age_dentry(struct ncp_server* server, struct dentry* dentry)
dentry->d_time = jiffies;
}
-#define NCP_FPOS_EMPTY 0 /* init value for fpos variables. */
+static inline void
+ncp_renew_dentries(struct dentry *parent)
+{
+ struct ncp_server *server = NCP_SERVER(parent->d_inode);
+ struct list_head *next = parent->d_subdirs.next;
+ struct dentry *dentry;
-struct ncp_cache_control {
- struct nw_search_sequence seq;
- int firstcache;
- int currentpos;
- int cachehead;
- int cachetail;
- int eof;
+ while (next != &parent->d_subdirs) {
+ dentry = list_entry(next, struct dentry, d_child);
+
+ if (dentry->d_fsdata == NULL)
+ ncp_age_dentry(server, dentry);
+ else
+ ncp_new_dentry(dentry);
+
+ next = next->next;
+ }
+}
+
+static inline void
+ncp_invalidate_dircache_entries(struct dentry *parent)
+{
+ struct ncp_server *server = NCP_SERVER(parent->d_inode);
+ struct list_head *next = parent->d_subdirs.next;
+ struct dentry *dentry;
+
+ while (next != &parent->d_subdirs) {
+ dentry = list_entry(next, struct dentry, d_child);
+ dentry->d_fsdata = NULL;
+ ncp_age_dentry(server, dentry);
+ next = next->next;
+ }
+}
+
+struct ncp_cache_head {
+ unsigned long time; /* cache age */
+ unsigned long end; /* last valid fpos in cache */
+ int eof;
};
-#define NCP_DIRCACHE_SIZE (PAGE_CACHE_SIZE-sizeof(struct ncp_cache_control))
-struct ncp_seq_cache {
- struct ncp_cache_control ctl;
- unsigned char cache[NCP_DIRCACHE_SIZE];
+#define NCP_DIRCACHE_SIZE ((int)(PAGE_CACHE_SIZE/sizeof(struct dentry *)))
+union ncp_dir_cache {
+ struct ncp_cache_head head;
+ struct dentry *dentry[NCP_DIRCACHE_SIZE];
+};
+
+#define NCP_FIRSTCACHE_SIZE ((int)((NCP_DIRCACHE_SIZE * \
+ sizeof(struct dentry *) - sizeof(struct ncp_cache_head)) / \
+ sizeof(struct dentry *)))
+
+#define NCP_DIRCACHE_START (NCP_DIRCACHE_SIZE - NCP_FIRSTCACHE_SIZE)
+
+struct ncp_cache_control {
+ struct ncp_cache_head head;
+ struct page *page;
+ union ncp_dir_cache *cache;
+ unsigned long fpos, ofs;
+ int filled, valid, idx;
};
#endif /* _NCPLIB_H */
set_fs(get_ds());
for (n = 0, timeout = init_timeout;; n++, timeout <<= 1) {
/*
- DDPRINTK(KERN_DEBUG "ncpfs: %08lX:%02X%02X%02X%02X%02X%02X:%04X\n",
+ DDPRINTK("ncpfs: %08lX:%02X%02X%02X%02X%02X%02X:%04X\n",
htonl(server->m.serv_addr.sipx_network),
server->m.serv_addr.sipx_node[0],
server->m.serv_addr.sipx_node[1],
server->m.serv_addr.sipx_node[5],
ntohs(server->m.serv_addr.sipx_port));
*/
- DDPRINTK(KERN_DEBUG "ncpfs: req.typ: %04X, con: %d, "
+ DDPRINTK("ncpfs: req.typ: %04X, con: %d, "
"seq: %d",
request.type,
(request.conn_high << 8) + request.conn_low,
request.sequence);
- DDPRINTK(KERN_DEBUG " func: %d\n",
+ DDPRINTK(" func: %d\n",
request.function);
result = _send(sock, (void *) start, size);
MSG_PEEK | MSG_DONTWAIT);
if (result < 0) {
if (result == -EAGAIN) {
- DDPRINTK(KERN_DEBUG "ncp_rpc_call: bad select ready\n");
+ DDPRINTK("ncp_rpc_call: bad select ready\n");
goto re_select;
}
if (result == -ECONNREFUSED) {
- DPRINTK(KERN_WARNING "ncp_rpc_call: server playing coy\n");
+ DPRINTK("ncp_rpc_call: server playing coy\n");
goto re_select;
}
if (result != -ERESTARTSYS) {
if ((result == sizeof(reply))
&& (reply.type == NCP_POSITIVE_ACK)) {
/* Throw away the packet */
- DPRINTK(KERN_DEBUG "ncp_rpc_call: got positive acknowledge\n");
+ DPRINTK("ncp_rpc_call: got positive acknowledge\n");
_recv(sock, (void *) &reply, sizeof(reply),
MSG_DONTWAIT);
n = 0;
acknowledge_seen = 1;
goto re_select;
}
- DDPRINTK(KERN_DEBUG "ncpfs: rep.typ: %04X, con: %d, tsk: %d,"
+ DDPRINTK("ncpfs: rep.typ: %04X, con: %d, tsk: %d,"
"seq: %d\n",
reply.type,
(reply.conn_high << 8) + reply.conn_low,
* a null buffer yet. */
_recv(sock, (void *) &reply, sizeof(reply), MSG_DONTWAIT);
- DPRINTK(KERN_WARNING "ncp_rpc_call: reply mismatch\n");
+ DPRINTK("ncp_rpc_call: reply mismatch\n");
goto re_select;
}
/*
#endif /* CONFIG_NCPFS_PACKET_SIGNING */
result = do_ncp_rpc_call(server, size, reply, max_reply_size);
- DDPRINTK(KERN_DEBUG "do_ncp_rpc_call returned %d\n", result);
+ DDPRINTK("do_ncp_rpc_call returned %d\n", result);
if (result < 0) {
/* There was a problem with I/O, so the connections is
result = ncp_do_request(server, request_size + sizeof(*h), reply, size);
if (result < 0) {
- DPRINTK(KERN_WARNING "ncp_request_error: %d\n", result);
+ DPRINTK("ncp_request_error: %d\n", result);
goto out;
}
server->completion = reply->completion_code;
result = reply->completion_code;
-#ifdef NCPFS_PARANOIA
-if (result != 0)
-printk(KERN_DEBUG "ncp_request: completion code=%x\n", result);
-#endif
+ if (result != 0)
+ PPRINTK("ncp_request: completion code=%x\n", result);
out:
return result;
}
#if 0
/* For testing, only 1 process */
if (server->lock != 0) {
- DPRINTK(KERN_WARNING "ncpfs: server locked!!!\n");
+ DPRINTK("ncpfs: server locked!!!\n");
}
#endif
down(&server->sem);
char *link;
#ifdef DEBUG
- printk("ncp_follow_link(dentry=%p,base=%p,follow=%u)\n",dentry,base,follow);
+ PRINTK("ncp_follow_link(dentry=%p,base=%p,follow=%u)\n",dentry,base,follow);
#endif
if(!S_ISLNK(inode->i_mode)) {
int length,error;
#ifdef DEBUG
- printk("ncp_readlink(dentry=%p,buffer=%p,buflen=%d)\n",dentry,buffer,buflen);
+ PRINTK("ncp_readlink(dentry=%p,buffer=%p,buflen=%d)\n",dentry,buffer,buflen);
#endif
if(!S_ISLNK(inode->i_mode))
char *link;
#ifdef DEBUG
- printk("ncp_symlink(dir=%p,dentry=%p,symname=%s)\n",dir,dentry,symname);
+ PRINTK("ncp_symlink(dir=%p,dentry=%p,symname=%s)\n",dir,dentry,symname);
#endif
if (!(NCP_SERVER(dir)->m.flags & NCP_MOUNT_SYMLINKS))
nfs_readpage_sync(struct dentry *dentry, struct inode *inode, struct page *page)
{
struct nfs_rreq rqst;
- unsigned long offset = page->pg_offset << PAGE_CACHE_SHIFT;
+ unsigned long offset = page->index << PAGE_CACHE_SHIFT;
char *buffer = (char *) page_address(page);
int rsize = NFS_SERVER(inode)->rsize;
int result, refresh = 0;
/* Initialize request */
/* N.B. Will the dentry remain valid for life of request? */
- nfs_readreq_setup(req, NFS_FH(dentry), page->pg_offset << PAGE_CACHE_SHIFT,
+ nfs_readreq_setup(req, NFS_FH(dentry), page->index << PAGE_CACHE_SHIFT,
(void *) address, PAGE_SIZE);
req->ra_inode = inode;
req->ra_page = page; /* count has been incremented by caller */
lock_kernel();
dprintk("NFS: nfs_readpage (%p %ld@%lu)\n",
- page, PAGE_SIZE, page->pg_offset);
+ page, PAGE_SIZE, page->index);
get_page(page);
/*
lock_kernel();
dprintk("NFS: nfs_writepage_sync(%s/%s %d@%lu/%ld)\n",
dentry->d_parent->d_name.name, dentry->d_name.name,
- count, page->pg_offset, offset);
+ count, page->index, offset);
buffer = (u8 *) page_address(page) + offset;
- offset += page->pg_offset << PAGE_CACHE_SHIFT;
+ offset += page->index << PAGE_CACHE_SHIFT;
do {
if (count < wsize && !IS_SWAPFILE(inode))
dprintk("NFS: create_write_request(%s/%s, %ld+%d)\n",
dentry->d_parent->d_name.name, dentry->d_name.name,
- (page->pg_offset << PAGE_CACHE_SHIFT) + offset, bytes);
+ (page->index << PAGE_CACHE_SHIFT) + offset, bytes);
/* FIXME: Enforce hard limit on number of concurrent writes? */
wreq = kmem_cache_alloc(nfs_wreq_cachep, SLAB_KERNEL);
dprintk("NFS: nfs_updatepage(%s/%s %d@%ld)\n",
dentry->d_parent->d_name.name, dentry->d_name.name,
- count, (page->pg_offset << PAGE_CACHE_SHIFT) +offset);
+ count, (page->index << PAGE_CACHE_SHIFT) +offset);
/*
* Try to find a corresponding request on the writeback queue.
/* Setup the task struct for a writeback call */
req->wb_flags |= NFS_WRITE_INPROGRESS;
req->wb_args.fh = NFS_FH(dentry);
- req->wb_args.offset = (page->pg_offset << PAGE_CACHE_SHIFT) + req->wb_offset;
+ req->wb_args.offset = (page->index << PAGE_CACHE_SHIFT) + req->wb_offset;
req->wb_args.count = req->wb_bytes;
req->wb_args.buffer = (void *) (page_address(page) + req->wb_offset);
extern int get_device_list(char *);
extern int get_partition_list(char *);
extern int get_filesystem_list(char *);
-extern int get_filesystem_info( char * );
+extern int get_filesystem_info(char *);
+extern int get_exec_domain_list(char *);
extern int get_irq_list(char *);
extern int get_dma_list(char *);
extern int get_rtc_status (char *);
return len;
}
+static int execdomains_read_proc(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ int len = get_exec_domain_list(page);
+ if (len <= off+count) *eof = 1;
+ *start = page + off;
+ len -= off;
+ if (len>count) len = count;
+ if (len<0) len = 0;
+ return len;
+}
+
static int swaps_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
{"swaps", swaps_read_proc},
{"slabinfo", slabinfo_read_proc},
{"iomem", memory_read_proc},
+ {"execdomains", execdomains_read_proc},
{NULL,NULL}
};
for(p=simple_ones;p->name;p++)
smb_readpage_sync(struct dentry *dentry, struct page *page)
{
char *buffer = (char *) page_address(page);
- unsigned long offset = page->pg_offset << PAGE_CACHE_SHIFT;
+ unsigned long offset = page->index << PAGE_CACHE_SHIFT;
int rsize = smb_get_rsize(server_from_dentry(dentry));
int count = PAGE_SIZE;
int result;
int wsize = smb_get_wsize(server_from_dentry(dentry));
int result, written = 0;
- offset += page->pg_offset << PAGE_CACHE_SHIFT;
+ offset += page->index << PAGE_CACHE_SHIFT;
#ifdef SMBFS_DEBUG_VERBOSE
printk("smb_writepage_sync: file %s/%s, count=%d@%ld, wsize=%d\n",
dentry->d_parent->d_name.name, dentry->d_name.name, count, offset, wsize);
pr_debug("SMBFS: smb_updatepage(%s/%s %d@%ld)\n",
dentry->d_parent->d_name.name, dentry->d_name.name,
- count, (page->pg_offset << PAGE_CACHE_SHIFT)+offset);
+ count, (page->index << PAGE_CACHE_SHIFT)+offset);
return smb_writepage_sync(dentry, page, offset, count);
}
*/
#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),__io_virt(b),(c),(d))
-#define isa_eth_io_copy_and_csum(a,b,c,d) eth_copy_and_sum((a),__io_virt(__ISA_IO_base + (b)),(c),(d))
+#define isa_eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),__io_virt(__ISA_IO_base + (b)),(c),(d))
static inline int check_signature(unsigned long io_addr,
const unsigned char *signature, int length)
#include <linux/types.h>
extern void *_mmx_memcpy(void *to, const void *from, size_t size);
-extern void mmx_clear_page(long page);
-extern void mmx_copy_page(long to, long from);
+extern void mmx_clear_page(void *page);
+extern void mmx_copy_page(void *to, void *from);
#endif
#define __NR_sigpending 73
#define __NR_sethostname 74
#define __NR_setrlimit 75
-#define __NR_getrlimit 76
+#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */
#define __NR_getrusage 77
#define __NR_gettimeofday 78
#define __NR_settimeofday 79
#define __NR_getpmsg 188 /* some people actually want streams */
#define __NR_putpmsg 189 /* some people actually want streams */
#define __NR_vfork 190
+#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
/* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
__u32 si_lf_sblk;
__u32 si_lf_eblk;
__u32 si_lasti;
- __u32 si_imap_len;
__u8 *si_imap;
struct buffer_head * si_sbh; /* buffer header w/superblock */
struct bfs_super_block * si_bfs_sb; /* superblock in si_sbh->b_data */
/*
* A swap entry has to fit into a "unsigned long", as
- * the entry is hidden in the "pg_offset" field of the
+ * the entry is hidden in the "index" field of the
* swapper address space.
*/
typedef struct {
/* these must be first (free area handling) */
struct list_head list;
struct address_space *mapping;
- unsigned long pg_offset;
+ unsigned long index;
struct page *next_hash;
atomic_t count;
unsigned long flags; /* atomic flags, some possibly updated asynchronously */
#include <linux/config.h>
+/* undef because public define in umsdos_fs.h (ncp_fs.h isn't public) */
+#undef PRINTK
+/* define because it is easy to change PRINTK to {*}PRINTK */
+#define PRINTK(format, args...) printk(KERN_DEBUG format , ## args)
+
#undef NCPFS_PARANOIA
+#ifdef NCPFS_PARANOIA
+#define PPRINTK(format, args...) PRINTK(format , ## args)
+#else
+#define PPRINTK(format, args...)
+#endif
+
#ifndef DEBUG_NCP
#define DEBUG_NCP 0
#endif
#if DEBUG_NCP > 0
-#define DPRINTK(format, args...) printk(format , ## args)
+#define DPRINTK(format, args...) PRINTK(format , ## args)
#else
#define DPRINTK(format, args...)
#endif
-
#if DEBUG_NCP > 1
-#define DDPRINTK(format, args...) printk(format , ## args)
+#define DDPRINTK(format, args...) PRINTK(format , ## args)
#else
#define DDPRINTK(format, args...)
#endif
extern void nvram_write_byte( unsigned char c, int i );
extern int nvram_check_checksum( void );
extern void nvram_set_checksum( void );
-extern int nvram_init( void );
#endif
#endif /* _LINUX_NVRAM_H */
/*
* We use a power-of-two hash table to avoid a modulus,
* and get a reasonable hash by knowing roughly how the
- * inode pointer and offsets are distributed (ie, we
+ * inode pointer and indexes are distributed (ie, we
* roughly know which bits are "significant")
*
* For the time being it will work for struct address_space too (most of
* them sitting inside the inodes). We might want to change it later.
*/
-extern inline unsigned long _page_hashfn(struct address_space * mapping, unsigned long offset)
+extern inline unsigned long _page_hashfn(struct address_space * mapping, unsigned long index)
{
#define i (((unsigned long) mapping)/(sizeof(struct inode) & ~ (sizeof(struct inode) - 1)))
#define s(x) ((x)+((x)>>PAGE_HASH_BITS))
- return s(i+offset) & (PAGE_HASH_SIZE-1);
+ return s(i+index) & (PAGE_HASH_SIZE-1);
#undef i
#undef o
#undef s
}
-#define page_hash(mapping,offset) (page_hash_table+_page_hashfn(mapping,offset))
+#define page_hash(mapping,index) (page_hash_table+_page_hashfn(mapping,index))
extern struct page * __find_get_page (struct address_space *mapping,
- unsigned long offset, struct page **hash);
-#define find_get_page(mapping, offset) \
- __find_get_page(mapping, offset, page_hash(mapping, offset))
+ unsigned long index, struct page **hash);
+#define find_get_page(mapping, index) \
+ __find_get_page(mapping, index, page_hash(mapping, index))
extern struct page * __find_lock_page (struct address_space * mapping,
- unsigned long offset, struct page **hash);
+ unsigned long index, struct page **hash);
extern void lock_page(struct page *page);
-#define find_lock_page(mapping, offset) \
- __find_lock_page(mapping, offset, page_hash(mapping, offset))
+#define find_lock_page(mapping, index) \
+ __find_lock_page(mapping, index, page_hash(mapping, index))
extern void __add_page_to_hash_queue(struct page * page, struct page **p);
-extern void add_to_page_cache(struct page * page, struct address_space *mapping, unsigned long offset);
-extern int add_to_page_cache_unique(struct page * page, struct address_space *mapping, unsigned long offset, struct page **hash);
+extern void add_to_page_cache(struct page * page, struct address_space *mapping, unsigned long index);
+extern int add_to_page_cache_unique(struct page * page, struct address_space *mapping, unsigned long index, struct page **hash);
-extern inline void add_page_to_hash_queue(struct page * page, struct inode * inode, unsigned long offset)
+extern inline void add_page_to_hash_queue(struct page * page, struct inode * inode, unsigned long index)
{
- __add_page_to_hash_queue(page, page_hash(&inode->i_data,offset));
+ __add_page_to_hash_queue(page, page_hash(&inode->i_data,index));
}
extern inline void add_page_to_inode_queue(struct address_space *mapping, struct page * page)
void *dev_data; /* driver-private, entry-specific data */
};
-int pci_simple_probe (struct pci_simple_probe_entry *list, size_t match_limit,
- pci_simple_probe_callback cb, void *drvr_data);
+int pci_simple_probe (const struct pci_simple_probe_entry *list,
+ size_t match_limit, pci_simple_probe_callback cb,
+ void *drvr_data);
#define PCI_DEVICE_ID_LAVA_PARALLEL 0x8000
#define PCI_DEVICE_ID_LAVA_DUAL_PAR_A 0x8002 /* The Lava Dual Parallel is */
#define PCI_DEVICE_ID_LAVA_DUAL_PAR_B 0x8003 /* two PCI devices on a card */
+#define PCI_DEVICE_ID_LAVA_BOCA_IOPPAR 0x8800
#define PCI_VENDOR_ID_PANACOM 0x14d4
#define PCI_DEVICE_ID_PANACOM_QUADMODEM 0x0400
struct shmid_ds {
struct ipc_perm shm_perm; /* operation perms */
- int shm_segsz; /* size of segment (bytes) */
+ size_t shm_segsz; /* size of segment (bytes) */
__kernel_time_t shm_atime; /* last attach time */
__kernel_time_t shm_dtime; /* last detach time */
__kernel_time_t shm_ctime; /* last change time */
#define SHM_INFO 14
struct shminfo {
- int shmmax;
+ size_t shmmax;
int shmmin;
int shmmni;
int shmseg;
#define SHM_DEST 01000 /* segment will be destroyed on last detach */
#define SHM_LOCKED 02000 /* segment will not be swapped */
-asmlinkage long sys_shmget (key_t key, int size, int flag);
+asmlinkage long sys_shmget (key_t key, size_t size, int flag);
asmlinkage long sys_shmat (int shmid, char *shmaddr, int shmflg, unsigned long *addr);
asmlinkage long sys_shmdt (char *shmaddr);
asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds *buf);
extern int ipcperms (struct ipc_perm *ipcp, short shmflg);
static int findkey (key_t key);
-static int newseg (key_t key, int shmflg, int size);
+static int newseg (key_t key, int shmflg, size_t size);
static int shm_map (struct vm_area_struct *shmd);
static void killseg (int id);
static void shm_open (struct vm_area_struct *shmd);
/*
* allocate new shmid_kernel and pgtable. protected by shm_segs[id] = NOID.
*/
-static int newseg (key_t key, int shmflg, int size)
+static int newseg (key_t key, int shmflg, size_t size)
{
struct shmid_kernel *shp;
int numpages = (size + PAGE_SIZE -1) >> PAGE_SHIFT;
return (unsigned int) shp->u.shm_perm.seq * SHMMNI + id;
}
-int shmmax = SHMMAX;
+size_t shmmax = SHMMAX;
-asmlinkage long sys_shmget (key_t key, int size, int shmflg)
+asmlinkage long sys_shmget (key_t key, size_t size, int shmflg)
{
struct shmid_kernel *shp;
int err, id = 0;
down(¤t->mm->mmap_sem);
spin_lock(&shm_lock);
- if (size < 0 || size > shmmax) {
+ if (size > shmmax) {
err = -EINVAL;
} else if (key == IPC_PRIVATE) {
err = newseg(key, shmflg, size);
err = -ENOMEM;
addr = 0;
again:
- if (!(addr = get_unmapped_area(addr, shp->u.shm_segsz)))
+ if (!(addr = get_unmapped_area(addr, (unsigned long)shp->u.shm_segsz)))
goto out;
if(addr & (SHMLBA - 1)) {
addr = (addr + (SHMLBA - 1)) & ~(SHMLBA - 1);
if (addr < current->mm->start_stack &&
addr > current->mm->start_stack - PAGE_SIZE*(shp->shm_npages + 4))
goto out;
- if (!(shmflg & SHM_REMAP) && find_vma_intersection(current->mm, addr, addr + shp->u.shm_segsz))
+ if (!(shmflg & SHM_REMAP) && find_vma_intersection(current->mm, addr, addr + (unsigned long)shp->u.shm_segsz))
goto out;
err = -EACCES;
spin_lock(&shm_lock);
for(i = 0; i < SHMMNI; i++)
if(shm_segs[i] != IPC_UNUSED) {
- len += sprintf(buffer + len, "%10d %10d %4o %10d %5u %5u %5d %5u %5u %5u %5u %10lu %10lu %10lu\n",
+#define SMALL_STRING "%10d %10d %4o %10u %5u %5u %5d %5u %5u %5u %5u %10lu %10lu %10lu\n"
+#define BIG_STRING "%10d %10d %4o %21u %5u %5u %5d %5u %5u %5u %5u %10lu %10lu %10lu\n"
+ char *format;
+
+ if (sizeof(size_t) <= sizeof(int))
+ format = SMALL_STRING;
+ else
+ format = BIG_STRING;
+ len += sprintf(buffer + len, format,
shm_segs[i]->u.shm_perm.key,
shm_segs[i]->u.shm_perm.seq * SHMMNI + i,
shm_segs[i]->u.shm_perm.mode,
return -ENOSYS;
}
-void shm_unuse(pte_t entry, struct page *page)
+void shm_unuse(swp_entry_t entry, struct page *page)
{
}
unlock_kernel();
return ret;
}
+
+int get_exec_domain_list(char * page)
+{
+ int len = 0;
+ struct exec_domain * e;
+
+ for (e=exec_domains; e && len < PAGE_SIZE - 80; e=e->next)
+ len += sprintf(page+len, "%d-%d\t%-16s\t[%s]\n",
+ e->pers_low, e->pers_high, e->name,
+ e->module ? e->module->name : "kernel");
+ return len;
+}
? -EFAULT : 0;
}
+/*
+ * Back compatibility for getrlimit. Needed for some apps.
+ */
+
+asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit *rlim)
+{
+ struct rlimit x;
+ if (resource >= RLIM_NLIMITS)
+ return -EINVAL;
+
+ memcpy(&x, current->rlim + resource, sizeof(*rlim));
+ if(x.rlim_cur > 0x7FFFFFFF)
+ x.rlim_cur = 0x7FFFFFFF;
+ if(x.rlim_max > 0x7FFFFFFF)
+ x.rlim_max = 0x7FFFFFFF;
+ return copy_to_user(rlim, &x, sizeof(x))?-EFAULT:0;
+}
+
+
asmlinkage long sys_setrlimit(unsigned int resource, struct rlimit *rlim)
{
struct rlimit new_rlim, *old_rlim;
extern int sg_big_buff;
#endif
#ifdef CONFIG_SYSVIPC
-extern int shmmax;
+extern size_t shmmax;
#endif
#ifdef __sparc__
{KERN_RTSIGMAX, "rtsig-max", &max_queued_signals, sizeof(int),
0644, NULL, &proc_dointvec},
#ifdef CONFIG_SYSVIPC
- {KERN_SHMMAX, "shmmax", &shmmax, sizeof (int),
- 0644, NULL, &proc_dointvec},
+ {KERN_SHMMAX, "shmmax", &shmmax, sizeof (size_t),
+ 0644, NULL, &proc_doulongvec_minmax},
#endif
#ifdef CONFIG_MAGIC_SYSRQ
{KERN_SYSRQ, "sysrq", &sysrq_enabled, sizeof (int),
page = list_entry(curr, struct page, list);
curr = curr->next;
- offset = page->pg_offset;
+ offset = page->index;
/* page wholly truncated - free it */
if (offset >= start) {
goto not_found;
if (page->mapping != mapping)
continue;
- if (page->pg_offset == offset)
+ if (page->index == offset)
break;
}
set_bit(PG_referenced, &page->flags);
curr = curr->next;
if (!page->buffers)
continue;
- if (page->pg_offset >= end)
+ if (page->index >= end)
continue;
- if (page->pg_offset < start)
+ if (page->index < start)
continue;
get_page(page);
flags = page->flags & ~((1 << PG_uptodate) | (1 << PG_error) | (1 << PG_referenced));
page->flags = flags | (1 << PG_locked);
get_page(page);
- page->pg_offset = offset;
+ page->index = offset;
add_page_to_inode_queue(mapping, page);
__add_page_to_hash_queue(page, hash);
lru_cache_add(page);
extern void wakeup_bdflush(int);
int filemap_swapout(struct page * page, struct file * file)
{
- int retval = filemap_write_page(file, page->pg_offset, page, 0);
+ int retval = filemap_write_page(file, page->index, page, 0);
wakeup_bdflush(0);
return retval;
}
BUG();
pgoff = (address - vma->vm_start) >> PAGE_CACHE_SHIFT;
pgoff += vma->vm_pgoff;
- if (page->pg_offset != pgoff) {
- printk("weirdness: pgoff=%lu pg_offset=%lu address=%lu vm_start=%lu vm_pgoff=%lu\n",
- pgoff, page->pg_offset, address, vma->vm_start, vma->vm_pgoff);
+ if (page->index != pgoff) {
+ printk("weirdness: pgoff=%lu index=%lu address=%lu vm_start=%lu vm_pgoff=%lu\n",
+ pgoff, page->index, address, vma->vm_start, vma->vm_pgoff);
}
error = filemap_write_page(vma->vm_file, pgoff, page, 1);
page_cache_free(page);
kunmap(vaddr, KM_WRITE);
/* Preserve the caching of the swap_entry. */
- highpage->pg_offset = page->pg_offset;
+ highpage->index = page->index;
highpage->mapping = page->mapping;
/*
flush_cache_range(current->mm, beg, end);
if (start >= end)
BUG();
+ spin_lock(¤t->mm->page_table_lock);
do {
change_pmd_range(dir, start, end - start, newprot);
start = (start + PGDIR_SIZE) & PGDIR_MASK;
dir++;
} while (start && (start < end));
+ spin_unlock(¤t->mm->page_table_lock);
flush_tlb_range(current->mm, beg, end);
return;
}
unsigned long offset = len;
flush_cache_range(mm, old_addr, old_addr + len);
- flush_tlb_range(mm, old_addr, old_addr + len);
/*
* This is not the clever way to do this, but we're taking the
if (move_one_page(mm, old_addr + offset, new_addr + offset))
goto oops_we_failed;
}
+ flush_tlb_range(mm, old_addr, old_addr + len);
return 0;
/*
{
swp_entry_t entry;
- entry.val = page->pg_offset;
+ entry.val = page->index;
if (!PageLocked(page))
PAGE_BUG(page);
swp_entry_t entry;
int retval = 0;
- entry.val = page->pg_offset;
+ entry.val = page->index;
if (!entry.val)
goto bad_entry;
type = SWP_TYPE(entry);
{
swp_entry_t entry;
- entry.val = page->pg_offset;
+ entry.val = page->index;
#ifdef SWAP_CACHE_INFO
swap_cache_del_total++;
goto new_swap_entry;
/* We have the old entry in the page offset still */
- if (!page->pg_offset)
+ if (!page->index)
goto new_swap_entry;
- entry.val = page->pg_offset;
+ entry.val = page->index;
type = SWP_TYPE(entry);
if (type & SHM_SWP_TYPE)
goto new_swap_entry;
* memory, and we should just continue our scan.
*/
if (PageSwapCache(page)) {
- entry.val = page->pg_offset;
+ entry.val = page->index;
swap_duplicate(entry);
set_pte(page_table, swp_entry_to_pte(entry));
drop_pte:
proc_net_create ("rt_cache", 0, rt_cache_get_info);
#ifdef CONFIG_NET_CLS_ROUTE
- create_proc_read_entry("net/rt_acct", 0, 0, ip_rt_acct_read);
+ create_proc_read_entry("net/rt_acct", 0, 0, ip_rt_acct_read, NULL);
#endif
}
int err = -EINVAL;
int i;
- if (vma->vm_offset)
+ if (vma->vm_pgoff)
return -EINVAL;
size = vma->vm_end - vma->vm_start;