Commit 5ade138f authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/davem/sparc-2.5

into home.osdl.org:/home/torvalds/v2.5/linux
parents bd519fce c5a46f51
......@@ -11,7 +11,6 @@
NM := $(NM) -B
LDFLAGS_vmlinux := -static -N #-relax
LDFLAGS_BLOB := --format binary --oformat elf64-alpha
cflags-y := -pipe -mno-fp-regs -ffixed-8
# Determine if we can use the BWX instructions with GAS.
......
......@@ -34,7 +34,6 @@ CFLAGS += -D__linux__
CFLAGS += -DUTS_SYSNAME=\"uClinux\" -DTARGET=$(BOARD)
AFLAGS += -DPLATFORM=$(PLATFORM) -DTARGET=$(BOARD) -DMODEL=$(MODEL) $(cflags-y)
LDFLAGS += $(ldflags-y)
LDFLAGS_BLOB := --format binary --oformat elf32-h8300
CROSS_COMPILE = h8300-elf-
#HEAD := arch/$(ARCH)/platform/$(platform-y)/$(board-y)/crt0_$(model-y).o
......
......@@ -18,7 +18,6 @@
LDFLAGS := -m elf_i386
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
LDFLAGS_vmlinux :=
LDFLAGS_BLOB := --format binary --oformat elf32-i386
CFLAGS += -pipe
......
......@@ -19,7 +19,6 @@ COMPILE_ARCH = $(shell uname -m)
# override top level makefile
AS += -m68020
LDFLAGS := -m m68kelf
LDFLAGS_BLOB := --format binary --oformat elf32-m68k
ifneq ($(COMPILE_ARCH),$(ARCH))
# prefix for cross-compiling binaries
CROSS_COMPILE = m68k-linux-
......
......@@ -85,8 +85,6 @@ CFLAGS += -O2 -g
CFLAGS += -D__linux__
CFLAGS += -DUTS_SYSNAME=\"uClinux\"
LDFLAGS_BLOB := --format binary --oformat elf32-m68k
head-y := arch/m68knommu/platform/$(platform-y)/$(board-y)/crt0_$(model-y).o
CLEAN_FILES := include/asm-$(ARCH)/asm-offsets.h \
......
......@@ -18,11 +18,9 @@
ifdef CONFIG_CPU_LITTLE_ENDIAN
tool-prefix = mipsel-linux-
JIFFIES32 = jiffies_64
LDFLAGS_BLOB := --format binary --oformat elf32-tradlittlemips
else
tool-prefix = mips-linux-
JIFFIES32 = jiffies_64 + 4
LDFLAGS_BLOB := --format binary --oformat elf32-tradbigmips
endif
ifdef CONFIG_CROSSCOMPILE
......
......@@ -20,13 +20,11 @@
ifdef CONFIG_PARISC64
CROSS_COMPILE := hppa64-linux-
UTS_MACHINE := parisc64
LDFLAGS_BLOB := --format binary --oformat elf64-hppa-linux
else
MACHINE := $(subst 64,,$(shell uname -m))
ifneq ($(MACHINE),parisc)
CROSS_COMPILE := hppa-linux-
endif
LDFLAGS_BLOB := --format binary --oformat elf32-hppa-linux
endif
FINAL_LD=$(CROSS_COMPILE)ld --warn-common --warn-section-align
......
......@@ -13,7 +13,6 @@
# This must match PAGE_OFFSET in include/asm-ppc/page.h.
KERNELLOAD := $(CONFIG_KERNEL_START)
LDFLAGS_BLOB := --format binary --oformat elf32-powerpc
LDFLAGS_vmlinux := -Ttext $(KERNELLOAD) -Bstatic
CPPFLAGS += -Iarch/$(ARCH)
AFLAGS += -Iarch/$(ARCH)
......
......@@ -17,7 +17,6 @@ KERNELLOAD := 0xc000000000000000
LDFLAGS := -m elf64ppc
LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD)
LDFLAGS_BLOB := --format binary --oformat elf64-powerpc
CFLAGS += -msoft-float -pipe -Wno-uninitialized -mminimal-toc \
-mtraceback=full -mcpu=power4
......
......@@ -17,7 +17,6 @@ check_gcc = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null > /dev
ifdef CONFIG_ARCH_S390_31
LDFLAGS := -m elf_s390
LDFLAGS_BLOB := --format binary --oformat elf32-s390
CFLAGS += -m31
AFLAGS += -m31
UTS_MACHINE := s390
......@@ -26,7 +25,6 @@ endif
ifdef CONFIG_ARCH_S390X
LDFLAGS := -m elf64_s390
MODFLAGS += -fpic -D__PIC__
LDFLAGS_BLOB := --format binary --oformat elf64-s390
CFLAGS += -m64
AFLAGS += -m64
UTS_MACHINE := s390x
......
......@@ -50,10 +50,8 @@ LDFLAGS_vmlinux += -e _stext
ifdef CONFIG_CPU_LITTLE_ENDIAN
LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64' -EL
LDFLAGS_BLOB :=--format binary --oformat elf32-sh-linux
else
LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64+4' -EB
LDFLAGS_BLOB :=--format binary --oformat elf32-shbig-linux
endif
CFLAGS += -pipe $(cpu-y)
......
......@@ -23,8 +23,6 @@ AS := $(AS) -32
LDFLAGS := -m elf32_sparc
endif
LDFLAGS_BLOB := --format binary --oformat elf32-sparc
#CFLAGS := $(CFLAGS) -g -pipe -fcall-used-g5 -fcall-used-g7
ifneq ($(IS_EGCS),y)
CFLAGS := $(CFLAGS) -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
......
......@@ -32,7 +32,6 @@ RANLIB = sparc64-linux-ranlib
else
AS := $(AS) -64
LDFLAGS := -m elf64_sparc
LDFLAGS_BLOB := --format binary --oformat elf64-sparc
endif
ifneq ($(UNDECLARED_REGS),y)
......
......@@ -27,7 +27,6 @@ CFLAGS += -D__linux__ -DUTS_SYSNAME=\"uClinux\"
# some reason)
LDFLAGS_MODULE += --unique=.gnu.linkonce.this_module
LDFLAGS_BLOB := -b binary --oformat elf32-little
OBJCOPY_FLAGS_BLOB := -I binary -O elf32-little -B v850e
......
......@@ -36,7 +36,6 @@ export IA32_CC IA32_LD IA32_AS IA32_OBJCOPY IA32_CPP
LDFLAGS := -m elf_x86_64
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
LDFLAGS_vmlinux := -e stext
LDFLAGS_BLOB := --format binary --oformat elf64-x86-64
CFLAGS += -mno-red-zone
CFLAGS += -mcmodel=kernel
......
......@@ -1522,6 +1522,7 @@ void blk_requeue_request(request_queue_t *q, struct request *rq)
* @rq: request to be inserted
* @at_head: insert request at head or tail of queue
* @data: private data
* @reinsert: true if request it a reinsertion of previously processed one
*
* Description:
* Many block devices need to execute commands asynchronously, so they don't
......@@ -1536,7 +1537,7 @@ void blk_requeue_request(request_queue_t *q, struct request *rq)
* host that is unable to accept a particular command.
*/
void blk_insert_request(request_queue_t *q, struct request *rq,
int at_head, void *data)
int at_head, void *data, int reinsert)
{
unsigned long flags;
......@@ -1554,11 +1555,15 @@ void blk_insert_request(request_queue_t *q, struct request *rq,
/*
* If command is tagged, release the tag
*/
if (blk_rq_tagged(rq))
blk_queue_end_tag(q, rq);
if(reinsert) {
blk_requeue_request(q, rq);
} else {
if (blk_rq_tagged(rq))
blk_queue_end_tag(q, rq);
drive_stat_acct(rq, rq->nr_sectors, 1);
__elv_add_request(q, rq, !at_head, 0);
drive_stat_acct(rq, rq->nr_sectors, 1);
__elv_add_request(q, rq, !at_head, 0);
}
q->request_fn(q);
spin_unlock_irqrestore(q->queue_lock, flags);
}
......
......@@ -484,7 +484,7 @@ static unsigned int __init init_chipset_via82cxxx(struct pci_dev *dev, const cha
for (i = 24; i >= 0; i -= 8)
if (((u >> i) & 0x10) ||
(((u >> i) & 0x20) &&
(((u >> i) & 7) < 8))) {
(((u >> i) & 7) < 6))) {
/* BIOS 80-wire bit or
* UDMA w/ < 60ns/cycle
*/
......
......@@ -1155,6 +1155,7 @@ int __init skmca_probe(struct SKMCA_NETDEV *dev)
priv->cmdaddr = base + 0x3ff3;
priv->medium = medium;
memset(&(priv->stat), 0, sizeof(struct net_device_stats));
spin_lock_init(&priv->lock);
/* set base + irq for this device (irq not allocated so far) */
dev->irq = 0;
......
......@@ -69,7 +69,7 @@ int scsi_insert_special_req(struct scsi_request *sreq, int at_head)
*/
sreq->sr_request->flags &= ~REQ_DONTPREP;
blk_insert_request(sreq->sr_device->request_queue, sreq->sr_request,
at_head, sreq);
at_head, sreq, 0);
return 0;
}
......@@ -147,7 +147,7 @@ int scsi_queue_insert(struct scsi_cmnd *cmd, int reason)
* function. The SCSI request function detects the blocked condition
* and plugs the queue appropriately.
*/
blk_insert_request(device->request_queue, cmd->request, 1, cmd);
blk_insert_request(device->request_queue, cmd->request, 1, cmd, 1);
return 0;
}
......@@ -445,7 +445,7 @@ static void scsi_run_queue(struct request_queue *q)
static void scsi_requeue_command(struct request_queue *q, struct scsi_cmnd *cmd)
{
cmd->request->flags &= ~REQ_DONTPREP;
blk_insert_request(q, cmd->request, 1, cmd);
blk_insert_request(q, cmd->request, 1, cmd, 1);
scsi_run_queue(q);
}
......
......@@ -4,12 +4,6 @@
obj-$(CONFIG_DEVPTS_FS) += devpts.o
devpts-objs := inode.o
ifeq ($(CONFIG_DEVPTS_FS_XATTR),y)
devpts-objs += xattr.o
endif
ifeq ($(CONFIG_DEVPTS_FS_SECURITY),y)
devpts-objs += xattr_security.o
endif
devpts-y := inode.o
devpts-$(CONFIG_DEVPTS_FS_XATTR) += xattr.o
devpts-$(CONFIG_DEVPTS_FS_SECURITY) += xattr_security.o
......@@ -4,17 +4,9 @@
obj-$(CONFIG_EXT2_FS) += ext2.o
ext2-objs := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
ioctl.o namei.o super.o symlink.o
ext2-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
ioctl.o namei.o super.o symlink.o
ifeq ($(CONFIG_EXT2_FS_XATTR),y)
ext2-objs += xattr.o xattr_user.o xattr_trusted.o
endif
ifeq ($(CONFIG_EXT2_FS_POSIX_ACL),y)
ext2-objs += acl.o
endif
ifeq ($(CONFIG_EXT2_FS_SECURITY),y)
ext2-objs += xattr_security.o
endif
ext2-$(CONFIG_EXT2_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o
ext2-$(CONFIG_EXT2_FS_POSIX_ACL) += acl.o
ext2-$(CONFIG_EXT2_FS_SECURITY) += xattr_security.o
......@@ -4,17 +4,9 @@
obj-$(CONFIG_EXT3_FS) += ext3.o
ext3-objs := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
ioctl.o namei.o super.o symlink.o hash.o
ext3-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
ioctl.o namei.o super.o symlink.o hash.o
ifeq ($(CONFIG_EXT3_FS_XATTR),y)
ext3-objs += xattr.o xattr_user.o xattr_trusted.o
endif
ifeq ($(CONFIG_EXT3_FS_POSIX_ACL),y)
ext3-objs += acl.o
endif
ifeq ($(CONFIG_EXT3_FS_SECURITY),y)
ext3-objs += xattr_security.o
endif
ext3-$(CONFIG_EXT3_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o
ext3-$(CONFIG_EXT3_FS_POSIX_ACL) += acl.o
ext3-$(CONFIG_EXT3_FS_SECURITY) += xattr_security.o
......@@ -232,6 +232,8 @@ void fat_cache_add(struct inode *inode, int f_clu, int d_clu)
struct fat_cache *walk, *last;
int first, prev_f_clu, prev_d_clu;
if (f_clu == 0)
return;
first = MSDOS_I(inode)->i_start;
if (!first)
return;
......@@ -287,31 +289,65 @@ void fat_cache_add(struct inode *inode, int f_clu, int d_clu)
spin_unlock(&sbi->cache_lock);
}
static int fat_get_cluster(struct inode *inode, int cluster)
int fat_get_cluster(struct inode *inode, int cluster, int *fclus, int *dclus)
{
struct super_block *sb = inode->i_sb;
int nr,count;
if (!(nr = MSDOS_I(inode)->i_start)) return 0;
if (!cluster) return nr;
count = 0;
for (fat_cache_lookup(inode, cluster, &count, &nr);
count < cluster;
count++) {
nr = fat_access(sb, nr, -1);
if (nr == FAT_ENT_EOF) {
fat_fs_panic(sb, "%s: request beyond EOF (ino %lu)",
__FUNCTION__, inode->i_ino);
const int limit = sb->s_maxbytes >> MSDOS_SB(sb)->cluster_bits;
int nr;
BUG_ON(MSDOS_I(inode)->i_start == 0);
*fclus = 0;
*dclus = MSDOS_I(inode)->i_start;
if (cluster == 0)
return 0;
fat_cache_lookup(inode, cluster, fclus, dclus);
while (*fclus < cluster) {
/* prevent the infinite loop of cluster chain */
if (*fclus > limit) {
fat_fs_panic(sb, "%s: detected the cluster chain loop"
" (i_pos %llu)", __FUNCTION__,
MSDOS_I(inode)->i_pos);
return -EIO;
} else if (nr == FAT_ENT_FREE) {
fat_fs_panic(sb, "%s: invalid cluster chain (ino %lu)",
__FUNCTION__, inode->i_ino);
}
nr = fat_access(sb, *dclus, -1);
if (nr < 0)
return nr;
else if (nr == FAT_ENT_FREE) {
fat_fs_panic(sb, "%s: invalid cluster chain"
" (i_pos %llu)", __FUNCTION__,
MSDOS_I(inode)->i_pos);
return -EIO;
} else if (nr < 0)
return nr;
} else if (nr == FAT_ENT_EOF) {
fat_cache_add(inode, *fclus, *dclus);
return FAT_ENT_EOF;
}
(*fclus)++;
*dclus = nr;
}
fat_cache_add(inode, cluster, nr);
return nr;
fat_cache_add(inode, *fclus, *dclus);
return 0;
}
static int fat_bmap_cluster(struct inode *inode, int cluster)
{
struct super_block *sb = inode->i_sb;
int ret, fclus, dclus;
if (MSDOS_I(inode)->i_start == 0)
return 0;
ret = fat_get_cluster(inode, cluster, &fclus, &dclus);
if (ret < 0)
return ret;
else if (ret == FAT_ENT_EOF) {
fat_fs_panic(sb, "%s: request beyond EOF (i_pos %llu)",
__FUNCTION__, MSDOS_I(inode)->i_pos);
return -EIO;
}
return dclus;
}
int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys)
......@@ -335,52 +371,58 @@ int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys)
return 0;
cluster = sector >> (sbi->cluster_bits - sb->s_blocksize_bits);
offset = sector & (sbi->cluster_size - 1);
cluster = fat_get_cluster(inode, cluster);
offset = sector & (sbi->sec_per_clus - 1);
cluster = fat_bmap_cluster(inode, cluster);
if (cluster < 0)
return cluster;
else if (cluster) {
*phys = ((sector_t)cluster - 2) * sbi->cluster_size
*phys = ((sector_t)cluster - 2) * sbi->sec_per_clus
+ sbi->data_start + offset;
}
return 0;
}
/* Free all clusters after the skip'th cluster. Doesn't use the cache,
because this way we get an additional sanity check. */
int fat_free(struct inode *inode,int skip)
/* Free all clusters after the skip'th cluster. */
int fat_free(struct inode *inode, int skip)
{
struct super_block *sb = inode->i_sb;
int nr,last;
int nr, ret, fclus, dclus;
if (MSDOS_I(inode)->i_start == 0)
return 0;
if (skip) {
ret = fat_get_cluster(inode, skip - 1, &fclus, &dclus);
if (ret < 0)
return ret;
else if (ret == FAT_ENT_EOF)
return 0;
if (!(nr = MSDOS_I(inode)->i_start)) return 0;
last = 0;
while (skip--) {
last = nr;
nr = fat_access(sb, nr, -1);
nr = fat_access(sb, dclus, -1);
if (nr == FAT_ENT_EOF)
return 0;
else if (nr == FAT_ENT_FREE) {
fat_fs_panic(sb, "%s: invalid cluster chain (ino %lu)",
__FUNCTION__, inode->i_ino);
return -EIO;
} else if (nr < 0)
else if (nr > 0) {
/*
* write a new EOF, and get the remaining cluster
* chain for freeing.
*/
nr = fat_access(sb, dclus, FAT_ENT_EOF);
}
if (nr < 0)
return nr;
}
if (last) {
fat_access(sb, last, FAT_ENT_EOF);
fat_cache_inval_inode(inode);
} else {
fat_cache_inval_inode(inode);
nr = MSDOS_I(inode)->i_start;
MSDOS_I(inode)->i_start = 0;
MSDOS_I(inode)->i_logstart = 0;
mark_inode_dirty(inode);
}
lock_fat(sb);
while (nr != FAT_ENT_EOF) {
do {
nr = fat_access(sb, nr, FAT_ENT_FREE);
if (nr < 0)
goto error;
......@@ -392,8 +434,8 @@ int fat_free(struct inode *inode,int skip)
}
if (MSDOS_SB(sb)->free_clusters != -1)
MSDOS_SB(sb)->free_clusters++;
inode->i_blocks -= (1 << MSDOS_SB(sb)->cluster_bits) >> 9;
}
inode->i_blocks -= MSDOS_SB(sb)->cluster_size >> 9;
} while (nr != FAT_ENT_EOF);
fat_clusters_flush(sb);
nr = 0;
error:
......
......@@ -152,7 +152,7 @@ fat_strnicmp(struct nls_table *t, const unsigned char *s1,
}
static inline int
fat_shortname2uni(struct nls_table *nls, char *buf, int buf_size,
fat_shortname2uni(struct nls_table *nls, unsigned char *buf, int buf_size,
wchar_t *uni_buf, unsigned short opt, int lower)
{
int len = 0;
......@@ -176,8 +176,8 @@ fat_shortname2uni(struct nls_table *nls, char *buf, int buf_size,
* Return values: negative -> error, 0 -> not found, positive -> found,
* value is the total amount of slots, including the shortname entry.
*/
int fat_search_long(struct inode *inode, const char *name, int name_len,
int anycase, loff_t *spos, loff_t *lpos)
int fat_search_long(struct inode *inode, const unsigned char *name,
int name_len, int anycase, loff_t *spos, loff_t *lpos)
{
struct super_block *sb = inode->i_sb;
struct buffer_head *bh = NULL;
......@@ -187,7 +187,7 @@ int fat_search_long(struct inode *inode, const char *name, int name_len,
wchar_t bufuname[14];
unsigned char xlate_len, long_slots;
wchar_t *unicode = NULL;
char work[8], bufname[260]; /* 256 + 4 */
unsigned char work[8], bufname[260]; /* 256 + 4 */
int uni_xlate = MSDOS_SB(sb)->options.unicode_xlate;
int utf8 = MSDOS_SB(sb)->options.utf8;
unsigned short opt_shortname = MSDOS_SB(sb)->options.shortname;
......@@ -199,7 +199,7 @@ int fat_search_long(struct inode *inode, const char *name, int name_len,
goto EODir;
parse_record:
long_slots = 0;
if (de->name[0] == (__s8) DELETED_FLAG)
if (de->name[0] == DELETED_FLAG)
continue;
if (de->attr != ATTR_EXT && (de->attr & ATTR_VOLUME))
continue;
......@@ -258,7 +258,7 @@ int fat_search_long(struct inode *inode, const char *name, int name_len,
if (ds->alias_checksum != alias_checksum)
goto parse_long;
}
if (de->name[0] == (__s8) DELETED_FLAG)
if (de->name[0] == DELETED_FLAG)
continue;
if (de->attr == ATTR_EXT)
goto parse_long;
......@@ -351,7 +351,7 @@ static int fat_readdirx(struct inode *inode, struct file *filp, void *dirent,
wchar_t bufuname[14];
unsigned char long_slots;
wchar_t *unicode = NULL;
char c, work[8], bufname[56], *ptname = bufname;
unsigned char c, work[8], bufname[56], *ptname = bufname;
unsigned long lpos, dummy, *furrfu = &lpos;
int uni_xlate = MSDOS_SB(sb)->options.unicode_xlate;
int isvfat = MSDOS_SB(sb)->options.isvfat;
......@@ -392,7 +392,7 @@ static int fat_readdirx(struct inode *inode, struct file *filp, void *dirent,
goto EODir;
/* Check for long filename entry */
if (isvfat) {
if (de->name[0] == (__s8) DELETED_FLAG)
if (de->name[0] == DELETED_FLAG)
goto RecEnd;
if (de->attr != ATTR_EXT && (de->attr & ATTR_VOLUME))
goto RecEnd;
......@@ -458,7 +458,7 @@ static int fat_readdirx(struct inode *inode, struct file *filp, void *dirent,
if (ds->alias_checksum != alias_checksum)
goto ParseLong;
}
if (de->name[0] == (__s8) DELETED_FLAG)
if (de->name[0] == DELETED_FLAG)
goto RecEnd;
if (de->attr == ATTR_EXT)
goto ParseLong;
......@@ -555,7 +555,7 @@ static int fat_readdirx(struct inode *inode, struct file *filp, void *dirent,
(de->attr & ATTR_DIR) ? DT_DIR : DT_REG) < 0)
goto FillFailed;
} else {
char longname[275];
unsigned char longname[275];
int long_len = utf8
? utf8_wcstombs(longname, unicode, sizeof(longname))
: uni16_to_x8(longname, unicode, uni_xlate,
......@@ -647,9 +647,23 @@ int fat_dir_ioctl(struct inode * inode, struct file * filp,
unsigned int cmd, unsigned long arg)
{
struct fat_ioctl_filldir_callback buf;
struct dirent __user *d1 = (struct dirent *)arg;
struct dirent __user *d1;
int ret, shortname, both;
switch (cmd) {
case VFAT_IOCTL_READDIR_SHORT:
shortname = 1;
both = 1;
break;
case VFAT_IOCTL_READDIR_BOTH:
shortname = 0;
both = 1;
break;
default:
return -EINVAL;
}
d1 = (struct dirent *)arg;
if (!access_ok(VERIFY_WRITE, d1, sizeof(struct dirent[2])))
return -EFAULT;
/*
......@@ -662,20 +676,13 @@ int fat_dir_ioctl(struct inode * inode, struct file * filp,
buf.dirent = d1;
buf.result = 0;
switch (cmd) {
case VFAT_IOCTL_READDIR_SHORT:
shortname = 1;
both = 1;
break;
case VFAT_IOCTL_READDIR_BOTH:
shortname = 0;
both = 1;
break;
default:
return -EINVAL;
down(&inode->i_sem);
ret = -ENOENT;
if (!IS_DEADDIR(inode)) {
ret = fat_readdirx(inode, filp, &buf, fat_ioctl_filldir,
shortname, both);
}
ret = fat_readdirx(inode, filp, &buf, fat_ioctl_filldir,
shortname, both);
up(&inode->i_sem);
if (ret >= 0)
ret = buf.result;
return ret;
......
......@@ -48,7 +48,7 @@ int fat_get_block(struct inode *inode, sector_t iblock,
BUG();
return -EIO;
}
if (!((unsigned long)iblock % MSDOS_SB(sb)->cluster_size)) {
if (!((unsigned long)iblock % MSDOS_SB(sb)->sec_per_clus)) {
int error;
error = fat_add_cluster(inode);
......@@ -84,14 +84,15 @@ static ssize_t fat_file_write(struct file *filp, const char *buf, size_t count,
void fat_truncate(struct inode *inode)
{
struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
int cluster;
const unsigned int cluster_size = sbi->cluster_size;
int nr_clusters;
/* Why no return value? Surely the disk could fail... */
if (IS_RDONLY (inode))
return /* -EPERM */;
if (IS_IMMUTABLE(inode))
return /* -EPERM */;
cluster = 1 << sbi->cluster_bits;
/*
* This protects against truncating a file bigger than it was then
* trying to write into the hole.
......@@ -99,8 +100,10 @@ void fat_truncate(struct inode *inode)
if (MSDOS_I(inode)->mmu_private > inode->i_size)
MSDOS_I(inode)->mmu_private = inode->i_size;
nr_clusters = (inode->i_size + (cluster_size - 1)) >> sbi->cluster_bits;
lock_kernel();
fat_free(inode, (inode->i_size + (cluster - 1)) >> sbi->cluster_bits);
fat_free(inode, nr_clusters);
MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
unlock_kernel();
inode->i_ctime = inode->i_mtime = CURRENT_TIME;
......
......@@ -159,7 +159,9 @@ void fat_put_super(struct super_block *sb)
{
struct msdos_sb_info *sbi = MSDOS_SB(sb);
fat_clusters_flush(sb);
if (!(sb->s_flags & MS_RDONLY))
fat_clusters_flush(sb);
if (sbi->nls_disk) {
unload_nls(sbi->nls_disk);
sbi->nls_disk = NULL;
......@@ -463,32 +465,17 @@ static int parse_options(char *options, int is_vfat, int *debug,
static int fat_calc_dir_size(struct inode *inode)
{
struct super_block *sb = inode->i_sb;
int nr;
struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
int ret, fclus, dclus;
inode->i_size = 0;
if (MSDOS_I(inode)->i_start == 0)
return 0;
nr = MSDOS_I(inode)->i_start;
do {
inode->i_size += 1 << MSDOS_SB(sb)->cluster_bits;
nr = fat_access(sb, nr, -1);
if (nr < 0)
return nr;
else if (nr == FAT_ENT_FREE) {
fat_fs_panic(sb, "Directory %lu: invalid cluster chain",
inode->i_ino);
return -EIO;
}
if (inode->i_size > FAT_MAX_DIR_SIZE) {
fat_fs_panic(sb, "Directory %lu: "
"exceeded the maximum size of directory",
inode->i_ino);
inode->i_size = FAT_MAX_DIR_SIZE;
break;
}
} while (nr != FAT_ENT_EOF);
ret = fat_get_cluster(inode, FAT_ENT_EOF, &fclus, &dclus);
if (ret < 0)
return ret;
inode->i_size = (fclus + 1) << sbi->cluster_bits;
return 0;
}
......@@ -499,6 +486,7 @@ static int fat_read_root(struct inode *inode)
struct msdos_sb_info *sbi = MSDOS_SB(sb);
int error;
MSDOS_I(inode)->file_cluster = MSDOS_I(inode)->disk_cluster = 0;
MSDOS_I(inode)->i_pos = 0;
inode->i_uid = sbi->options.fs_uid;
inode->i_gid = sbi->options.fs_gid;
......@@ -516,9 +504,9 @@ static int fat_read_root(struct inode *inode)
MSDOS_I(inode)->i_start = 0;
inode->i_size = sbi->dir_entries * sizeof(struct msdos_dir_entry);
}
inode->i_blksize = 1 << sbi->cluster_bits;
inode->i_blocks = ((inode->i_size + inode->i_blksize - 1)
& ~((loff_t)inode->i_blksize - 1)) >> 9;
inode->i_blksize = sbi->cluster_size;
inode->i_blocks = ((inode->i_size + (sbi->cluster_size - 1))
& ~((loff_t)sbi->cluster_size - 1)) >> 9;
MSDOS_I(inode)->i_logstart = 0;
MSDOS_I(inode)->mmu_private = inode->i_size;
......@@ -746,7 +734,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
struct msdos_sb_info *sbi;
int logical_sector_size, fat_clusters, debug, cp, first;
unsigned int total_sectors, rootdir_sectors;
unsigned char media;
unsigned int media;
long error;
char buf[50];
......@@ -822,12 +810,12 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
brelse(bh);
goto out_invalid;
}
sbi->cluster_size = b->cluster_size;
if (!sbi->cluster_size
|| (sbi->cluster_size & (sbi->cluster_size - 1))) {
sbi->sec_per_clus = b->sec_per_clus;
if (!sbi->sec_per_clus
|| (sbi->sec_per_clus & (sbi->sec_per_clus - 1))) {
if (!silent)
printk(KERN_ERR "FAT: bogus cluster size %d\n",
sbi->cluster_size);
printk(KERN_ERR "FAT: bogus sectors per cluster %d\n",
sbi->sec_per_clus);
brelse(bh);
goto out_invalid;
}
......@@ -856,7 +844,8 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
b = (struct fat_boot_sector *) bh->b_data;
}
sbi->cluster_bits = ffs(sb->s_blocksize * sbi->cluster_size) - 1;
sbi->cluster_size = sb->s_blocksize * sbi->sec_per_clus;
sbi->cluster_bits = ffs(sbi->cluster_size) - 1;
sbi->fats = b->fats;
sbi->fat_bits = 0; /* Don't know yet */
sbi->fat_start = CF_LE_W(b->reserved);
......@@ -924,7 +913,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
total_sectors = CF_LE_W(get_unaligned((unsigned short *)&b->sectors));
if (total_sectors == 0)
total_sectors = CF_LE_L(b->total_sect);
sbi->clusters = (total_sectors - sbi->data_start) / sbi->cluster_size;
sbi->clusters = (total_sectors - sbi->data_start) / sbi->sec_per_clus;
if (sbi->fat_bits != 32)
sbi->fat_bits = (sbi->clusters > MSDOS_FAT12) ? 16 : 12;
......@@ -1021,22 +1010,26 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
int fat_statfs(struct super_block *sb, struct kstatfs *buf)
{
int free,nr;
int free, nr;
lock_fat(sb);
if (MSDOS_SB(sb)->free_clusters != -1)
free = MSDOS_SB(sb)->free_clusters;
else {
free = 0;
for (nr = 2; nr < MSDOS_SB(sb)->clusters + 2; nr++)
if (fat_access(sb, nr, -1) == FAT_ENT_FREE)
free++;
MSDOS_SB(sb)->free_clusters = free;
lock_fat(sb);
if (MSDOS_SB(sb)->free_clusters != -1)
free = MSDOS_SB(sb)->free_clusters;
else {
free = 0;
for (nr = 2; nr < MSDOS_SB(sb)->clusters + 2; nr++)
if (fat_access(sb, nr, -1) == FAT_ENT_FREE)
free++;
MSDOS_SB(sb)->free_clusters = free;
}
unlock_fat(sb);
}
unlock_fat(sb);
buf->f_type = sb->s_magic;
buf->f_bsize = 1 << MSDOS_SB(sb)->cluster_bits;
buf->f_bsize = MSDOS_SB(sb)->cluster_size;
buf->f_blocks = MSDOS_SB(sb)->clusters;
buf->f_bfree = free;
buf->f_bavail = free;
......@@ -1045,9 +1038,9 @@ int fat_statfs(struct super_block *sb, struct kstatfs *buf)
return 0;
}
static int is_exec(char *extension)
static int is_exec(unsigned char *extension)
{
char *exe_extensions = "EXECOMBAT", *walk;
unsigned char *exe_extensions = "EXECOMBAT", *walk;
for (walk = exe_extensions; *walk; walk += 3)
if (!strncmp(extension, walk, 3))
......@@ -1149,9 +1142,9 @@ static int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de)
inode->i_flags |= S_IMMUTABLE;
MSDOS_I(inode)->i_attrs = de->attr & ATTR_UNUSED;
/* this is as close to the truth as we can get ... */
inode->i_blksize = 1 << sbi->cluster_bits;
inode->i_blocks = ((inode->i_size + inode->i_blksize - 1)
& ~((loff_t)inode->i_blksize - 1)) >> 9;
inode->i_blksize = sbi->cluster_size;
inode->i_blocks = ((inode->i_size + (sbi->cluster_size - 1))
& ~((loff_t)sbi->cluster_size - 1)) >> 9;
inode->i_mtime.tv_sec = inode->i_atime.tv_sec =
date_dos2unix(CF_LE_W(de->time),CF_LE_W(de->date));
inode->i_mtime.tv_nsec = inode->i_atime.tv_nsec = 0;
......
......@@ -50,15 +50,14 @@ void unlock_fat(struct super_block *sb)
/* XXX: Need to write one per FSINFO block. Currently only writes 1 */
void fat_clusters_flush(struct super_block *sb)
{
struct msdos_sb_info *sbi = MSDOS_SB(sb);
struct buffer_head *bh;
struct fat_boot_fsinfo *fsinfo;
if (MSDOS_SB(sb)->fat_bits != 32)
return;
if (MSDOS_SB(sb)->free_clusters == -1)
if (sbi->fat_bits != 32)
return;
bh = sb_bread(sb, MSDOS_SB(sb)->fsinfo_sector);
bh = sb_bread(sb, sbi->fsinfo_sector);
if (bh == NULL) {
printk(KERN_ERR "FAT bread failed in fat_clusters_flush\n");
return;
......@@ -71,10 +70,12 @@ void fat_clusters_flush(struct super_block *sb)
" Found signature1 0x%08x signature2 0x%08x"
" (sector = %lu)\n",
CF_LE_L(fsinfo->signature1), CF_LE_L(fsinfo->signature2),
MSDOS_SB(sb)->fsinfo_sector);
sbi->fsinfo_sector);
} else {
fsinfo->free_clusters = CF_LE_L(MSDOS_SB(sb)->free_clusters);
fsinfo->next_cluster = CF_LE_L(MSDOS_SB(sb)->prev_free);
if (sbi->free_clusters != -1)
fsinfo->free_clusters = CF_LE_L(sbi->free_clusters);
if (sbi->prev_free)
fsinfo->next_cluster = CF_LE_L(sbi->prev_free);
mark_buffer_dirty(bh);
}
brelse(bh);
......@@ -87,41 +88,25 @@ void fat_clusters_flush(struct super_block *sb)
int fat_add_cluster(struct inode *inode)
{
struct super_block *sb = inode->i_sb;
int count, nr, limit, last, curr, file_cluster;
int count, limit, new_dclus, new_fclus, last;
int cluster_bits = MSDOS_SB(sb)->cluster_bits;
/*
* We must locate the last cluster of the file to add this new
* one (nr) to the end of the link list (the FAT).
* one (new_dclus) to the end of the link list (the FAT).
*
* In order to confirm that the cluster chain is valid, we
* find out EOF first.
*/
nr = -EIO;
last = file_cluster = 0;
if ((curr = MSDOS_I(inode)->i_start) != 0) {
int max_cluster = MSDOS_I(inode)->mmu_private >> cluster_bits;
fat_cache_lookup(inode, INT_MAX, &last, &curr);
file_cluster = last;
while (curr && curr != FAT_ENT_EOF) {
file_cluster++;
curr = fat_access(sb, last = curr, -1);
if (curr < 0)
return curr;
else if (curr == FAT_ENT_FREE) {
fat_fs_panic(sb, "%s: invalid cluster chain"
" (ino %lu)",
__FUNCTION__, inode->i_ino);
goto out;
}
if (file_cluster > max_cluster) {
fat_fs_panic(sb, "%s: bad cluster counts"
" (ino %lu)",
__FUNCTION__, inode->i_ino);
goto out;
}
}
last = new_fclus = 0;
if (MSDOS_I(inode)->i_start) {
int ret, fclus, dclus;
ret = fat_get_cluster(inode, FAT_ENT_EOF, &fclus, &dclus);
if (ret < 0)
return ret;
new_fclus = fclus + 1;
last = dclus;
}
/* find free FAT entry */
......@@ -133,12 +118,12 @@ int fat_add_cluster(struct inode *inode)
}
limit = MSDOS_SB(sb)->clusters + 2;
nr = MSDOS_SB(sb)->prev_free + 1;
for (count = 0; count < MSDOS_SB(sb)->clusters; count++, nr++) {
nr = nr % limit;
if (nr < 2)
nr = 2;
if (fat_access(sb, nr, -1) == FAT_ENT_FREE)
new_dclus = MSDOS_SB(sb)->prev_free + 1;
for (count = 0; count < MSDOS_SB(sb)->clusters; count++, new_dclus++) {
new_dclus = new_dclus % limit;
if (new_dclus < 2)
new_dclus = 2;
if (fat_access(sb, new_dclus, -1) == FAT_ENT_FREE)
break;
}
if (count >= MSDOS_SB(sb)->clusters) {
......@@ -146,9 +131,9 @@ int fat_add_cluster(struct inode *inode)
unlock_fat(sb);
return -ENOSPC;
}
MSDOS_SB(sb)->prev_free = nr;
MSDOS_SB(sb)->prev_free = new_dclus;
fat_access(sb, nr, FAT_ENT_EOF);
fat_access(sb, new_dclus, FAT_ENT_EOF);
if (MSDOS_SB(sb)->free_clusters != -1)
MSDOS_SB(sb)->free_clusters--;
fat_clusters_flush(sb);
......@@ -157,29 +142,28 @@ int fat_add_cluster(struct inode *inode)
/* add new one to the last of the cluster chain */
if (last) {
fat_access(sb, last, nr);
fat_cache_add(inode, file_cluster, nr);
fat_access(sb, last, new_dclus);
fat_cache_add(inode, new_fclus, new_dclus);
} else {
MSDOS_I(inode)->i_start = nr;
MSDOS_I(inode)->i_logstart = nr;
MSDOS_I(inode)->i_start = new_dclus;
MSDOS_I(inode)->i_logstart = new_dclus;
mark_inode_dirty(inode);
}
if (file_cluster != (inode->i_blocks >> (cluster_bits - 9))) {
printk (KERN_ERR "file_cluster badly computed!!! %d <> %ld\n",
file_cluster, inode->i_blocks >> (cluster_bits - 9));
if (new_fclus != (inode->i_blocks >> (cluster_bits - 9))) {
fat_fs_panic(sb, "clusters badly computed (%d != %ld)",
new_fclus, inode->i_blocks >> (cluster_bits - 9));
fat_cache_inval_inode(inode);
}
inode->i_blocks += (1 << cluster_bits) >> 9;
inode->i_blocks += MSDOS_SB(sb)->cluster_size >> 9;
out:
return nr;
return new_dclus;
}
struct buffer_head *fat_extend_dir(struct inode *inode)
{
struct super_block *sb = inode->i_sb;
struct buffer_head *bh, *res = NULL;
int nr, cluster_size = MSDOS_SB(sb)->cluster_size;
int nr, sec_per_clus = MSDOS_SB(sb)->sec_per_clus;
sector_t sector, last_sector;
if (MSDOS_SB(sb)->fat_bits != 32) {
......@@ -191,8 +175,8 @@ struct buffer_head *fat_extend_dir(struct inode *inode)
if (nr < 0)
return ERR_PTR(nr);
sector = ((sector_t)nr - 2) * cluster_size + MSDOS_SB(sb)->data_start;
last_sector = sector + cluster_size;
sector = ((sector_t)nr - 2) * sec_per_clus + MSDOS_SB(sb)->data_start;
last_sector = sector + sec_per_clus;
for ( ; sector < last_sector; sector++) {
if ((bh = sb_getblk(sb, sector))) {
memset(bh->b_data, 0, sb->s_blocksize);
......@@ -211,8 +195,8 @@ struct buffer_head *fat_extend_dir(struct inode *inode)
inode->i_size = (inode->i_size + sb->s_blocksize)
& ~(sb->s_blocksize - 1);
}
inode->i_size += 1 << MSDOS_SB(sb)->cluster_bits;
MSDOS_I(inode)->mmu_private += 1 << MSDOS_SB(sb)->cluster_bits;
inode->i_size += MSDOS_SB(sb)->cluster_size;
MSDOS_I(inode)->mmu_private += MSDOS_SB(sb)->cluster_size;
return res;
}
......@@ -325,230 +309,54 @@ int fat__get_entry(struct inode *dir, loff_t *pos,struct buffer_head **bh,
return 0;
}
/*
* Now an ugly part: this set of directory scan routines works on clusters
* rather than on inodes and sectors. They are necessary to locate the '..'
* directory "inode". raw_scan_sector operates in four modes:
*
* name number ino action
* -------- -------- -------- -------------------------------------------------
* non-NULL - X Find an entry with that name
* NULL non-NULL non-NULL Find an entry whose data starts at *number
* NULL non-NULL NULL Count subdirectories in *number. (*)
* NULL NULL non-NULL Find an empty entry
*
* (*) The return code should be ignored. It DOES NOT indicate success or
* failure. *number has to be initialized to zero.
*
* - = not used, X = a value is returned unless NULL
*
* If res_bh is non-NULL, the buffer is not deallocated but returned to the
* caller on success. res_de is set accordingly.
*
* If cont is non-zero, raw_found continues with the entry after the one
* res_bh/res_de point to.
*/
#define RSS_NAME /* search for name */ \
done = !strncmp(data[entry].name,name,MSDOS_NAME) && \
!(data[entry].attr & ATTR_VOLUME);
#define RSS_START /* search for start cluster */ \
done = !IS_FREE(data[entry].name) \
&& ( \
( \
(sbi->fat_bits != 32) ? 0 : (CF_LE_W(data[entry].starthi) << 16) \
) \
| CF_LE_W(data[entry].start) \
) == *number;
#define RSS_FREE /* search for free entry */ \
{ \
done = IS_FREE(data[entry].name); \
}
#define RSS_COUNT /* count subdirectories */ \
{ \
done = 0; \
if (!IS_FREE(data[entry].name) && (data[entry].attr & ATTR_DIR)) \
(*number)++; \
}
static int raw_scan_sector(struct super_block *sb, sector_t sector,
const char *name, int *number, loff_t *i_pos,
struct buffer_head **res_bh,
struct msdos_dir_entry **res_de)
static int fat_get_short_entry(struct inode *dir, loff_t *pos,
struct buffer_head **bh,
struct msdos_dir_entry **de, loff_t *i_pos)
{
struct msdos_sb_info *sbi = MSDOS_SB(sb);
struct buffer_head *bh;
struct msdos_dir_entry *data;
int entry,start,done;
if (!(bh = sb_bread(sb, sector)))
return -EIO;
data = (struct msdos_dir_entry *) bh->b_data;
for (entry = 0; entry < sbi->dir_per_block; entry++) {
/* RSS_COUNT: if (data[entry].name == name) done=true else done=false. */
if (name) {
RSS_NAME
} else {
if (!i_pos) RSS_COUNT
else {
if (number) RSS_START
else RSS_FREE
}
}
if (done) {
if (i_pos) {
*i_pos = ((loff_t)sector << sbi->dir_per_block_bits) + entry;
}
start = CF_LE_W(data[entry].start);
if (sbi->fat_bits == 32)
start |= (CF_LE_W(data[entry].starthi) << 16);
if (!res_bh)
brelse(bh);
else {
*res_bh = bh;
*res_de = &data[entry];
}
return start;
}
while (fat_get_entry(dir, pos, bh, de, i_pos) >= 0) {
/* free entry or long name entry or volume label */
if (!IS_FREE((*de)->name) && !((*de)->attr & ATTR_VOLUME))
return 0;
}
brelse(bh);
return -ENOENT;
}
/*
* raw_scan_root performs raw_scan_sector on the root directory until the
* requested entry is found or the end of the directory is reached.
*/
static int raw_scan_root(struct super_block *sb, const char *name,
int *number, loff_t *i_pos,
struct buffer_head **res_bh,
struct msdos_dir_entry **res_de)
{
int count,cluster;
for (count = 0;
count < MSDOS_SB(sb)->dir_entries / MSDOS_SB(sb)->dir_per_block;
count++) {
cluster = raw_scan_sector(sb, MSDOS_SB(sb)->dir_start + count,
name, number, i_pos, res_bh, res_de);
if (cluster >= 0)
return cluster;
}
return -ENOENT;
}
/*
* raw_scan_nonroot performs raw_scan_sector on a non-root directory until the
* requested entry is found or the end of the directory is reached.
*/
static int raw_scan_nonroot(struct super_block *sb, int start, const char *name,
int *number, loff_t *i_pos,
struct buffer_head **res_bh,
struct msdos_dir_entry **res_de)
{
struct msdos_sb_info *sbi = MSDOS_SB(sb);
int count, cluster;
unsigned long dir_size = 0;
sector_t sector;
#ifdef DEBUG
printk("raw_scan_nonroot: start=%d\n",start);
#endif
do {
for (count = 0; count < sbi->cluster_size; count++) {
sector = ((sector_t)start - 2) * sbi->cluster_size
+ count + sbi->data_start;
cluster = raw_scan_sector(sb, sector, name, number,
i_pos, res_bh, res_de);
if (cluster >= 0)
return cluster;
}
dir_size += 1 << sbi->cluster_bits;
if (dir_size > FAT_MAX_DIR_SIZE) {
fat_fs_panic(sb, "Directory %d: "
"exceeded the maximum size of directory",
start);
break;
}
start = fat_access(sb, start, -1);
if (start < 0)
return start;
else if (start == FAT_ENT_FREE) {
fat_fs_panic(sb, "%s: invalid cluster chain",
__FUNCTION__);
break;
}
#ifdef DEBUG
printk("next start: %d\n",start);
#endif
} while (start != FAT_ENT_EOF);
return -ENOENT;
}
/*
* raw_scan performs raw_scan_sector on any sector.
*
* NOTE: raw_scan must not be used on a directory that is is the process of
* being created.
*/
static int raw_scan(struct super_block *sb, int start, const char *name,
loff_t *i_pos, struct buffer_head **res_bh,
struct msdos_dir_entry **res_de)
{
if (start)
return raw_scan_nonroot(sb,start,name,NULL,i_pos,res_bh,res_de);
else
return raw_scan_root(sb,name,NULL,i_pos,res_bh,res_de);
}
/*
* fat_subdirs counts the number of sub-directories of dir. It can be run
* on directories being created.
*/
int fat_subdirs(struct inode *dir)
{
struct msdos_sb_info *sbi = MSDOS_SB(dir->i_sb);
int number;
number = 0;
if ((dir->i_ino == MSDOS_ROOT_INO) && (sbi->fat_bits != 32))
raw_scan_root(dir->i_sb, NULL, &number, NULL, NULL, NULL);
else {
if ((dir->i_ino != MSDOS_ROOT_INO) && !MSDOS_I(dir)->i_start)
return 0; /* in mkdir */
else {
raw_scan_nonroot(dir->i_sb, MSDOS_I(dir)->i_start,
NULL, &number, NULL, NULL, NULL);
}
struct buffer_head *bh;
struct msdos_dir_entry *de;
loff_t cpos, i_pos;
int count = 0;
bh = NULL;
cpos = 0;
while (fat_get_short_entry(dir, &cpos, &bh, &de, &i_pos) >= 0) {
if (de->attr & ATTR_DIR)
count++;
}
return number;
brelse(bh);
return count;
}
/*
* Scans a directory for a given file (name points to its formatted name) or
* for an empty directory slot (name is NULL). Returns an error code or zero.
* Scans a directory for a given file (name points to its formatted name).
* Returns an error code or zero.
*/
int fat_scan(struct inode *dir, const char *name, struct buffer_head **res_bh,
struct msdos_dir_entry **res_de, loff_t *i_pos)
int fat_scan(struct inode *dir, const unsigned char *name,
struct buffer_head **bh, struct msdos_dir_entry **de,
loff_t *i_pos)
{
int res;
loff_t cpos;
res = raw_scan(dir->i_sb, MSDOS_I(dir)->i_start, name, i_pos,
res_bh, res_de);
return (res < 0) ? res : 0;
*bh = NULL;
cpos = 0;
while (fat_get_short_entry(dir, &cpos, bh, de, i_pos) >= 0) {
if (!strncmp((*de)->name, name, MSDOS_NAME))
return 0;
}
return -ENOENT;
}
......@@ -4,14 +4,12 @@
obj-$(CONFIG_JFS_FS) += jfs.o
jfs-objs := super.o file.o inode.o namei.o jfs_mount.o jfs_umount.o \
jfs-y := super.o file.o inode.o namei.o jfs_mount.o jfs_umount.o \
jfs_xtree.o jfs_imap.o jfs_debug.o jfs_dmap.o \
jfs_unicode.o jfs_dtree.o jfs_inode.o \
jfs_extent.o symlink.o jfs_metapage.o \
jfs_logmgr.o jfs_txnmgr.o jfs_uniupr.o resize.o xattr.o
ifeq ($(CONFIG_JFS_POSIX_ACL),y)
jfs-objs += acl.o
endif
jfs-$(CONFIG_JFS_POSIX_ACL) += acl.o
EXTRA_CFLAGS += -D_JFS_4K
......@@ -14,30 +14,30 @@
/* MS-DOS "device special files" */
static const char *reserved_names[] = {
"CON ","PRN ","NUL ","AUX ",
"LPT1 ","LPT2 ","LPT3 ","LPT4 ",
"COM1 ","COM2 ","COM3 ","COM4 ",
NULL
static const unsigned char *reserved_names[] = {
"CON ","PRN ","NUL ","AUX ",
"LPT1 ","LPT2 ","LPT3 ","LPT4 ",
"COM1 ","COM2 ","COM3 ","COM4 ",
NULL
};
/* Characters that are undesirable in an MS-DOS file name */
static char bad_chars[] = "*?<>|\"";
static char bad_if_strict_pc[] = "+=,; ";
static char bad_if_strict_atari[] = " "; /* GEMDOS is less restrictive */
static unsigned char bad_chars[] = "*?<>|\"";
static unsigned char bad_if_strict_pc[] = "+=,; ";
static unsigned char bad_if_strict_atari[] = " "; /* GEMDOS is less restrictive */
#define bad_if_strict(opts) ((opts)->atari ? bad_if_strict_atari : bad_if_strict_pc)
/***** Formats an MS-DOS file name. Rejects invalid names. */
static int msdos_format_name(const char *name,int len,
char *res,struct fat_mount_options *opts)
static int msdos_format_name(const unsigned char *name, int len,
unsigned char *res, struct fat_mount_options *opts)
/* name is the proposed name, len is its length, res is
* the resulting name, opts->name_check is either (r)elaxed,
* (n)ormal or (s)trict, opts->dotsOK allows dots at the
* beginning of name (for hidden files)
*/
{
char *walk;
const char **reserved;
unsigned char *walk;
const unsigned char **reserved;
unsigned char c;
int space;
......@@ -112,13 +112,13 @@ static int msdos_format_name(const char *name,int len,
}
/***** Locates a directory entry. Uses unformatted name. */
static int msdos_find(struct inode *dir, const char *name, int len,
static int msdos_find(struct inode *dir, const unsigned char *name, int len,
struct buffer_head **bh, struct msdos_dir_entry **de,
loff_t *i_pos)
{
int res;
unsigned char msdos_name[MSDOS_NAME];
char dotsOK;
char msdos_name[MSDOS_NAME];
int res;
dotsOK = MSDOS_SB(dir->i_sb)->options.dotsOK;
res = msdos_format_name(name,len, msdos_name,&MSDOS_SB(dir->i_sb)->options);
......@@ -146,8 +146,8 @@ static int msdos_find(struct inode *dir, const char *name, int len,
static int msdos_hash(struct dentry *dentry, struct qstr *qstr)
{
struct fat_mount_options *options = & (MSDOS_SB(dentry->d_sb)->options);
unsigned char msdos_name[MSDOS_NAME];
int error;
char msdos_name[MSDOS_NAME];
error = msdos_format_name(qstr->name, qstr->len, msdos_name, options);
if (!error)
......@@ -162,8 +162,8 @@ static int msdos_hash(struct dentry *dentry, struct qstr *qstr)
static int msdos_cmp(struct dentry *dentry, struct qstr *a, struct qstr *b)
{
struct fat_mount_options *options = & (MSDOS_SB(dentry->d_sb)->options);
unsigned char a_msdos_name[MSDOS_NAME], b_msdos_name[MSDOS_NAME];
int error;
char a_msdos_name[MSDOS_NAME], b_msdos_name[MSDOS_NAME];
error = msdos_format_name(a->name, a->len, a_msdos_name, options);
if (error)
......@@ -228,7 +228,7 @@ struct dentry *msdos_lookup(struct inode *dir,struct dentry *dentry, struct name
}
/***** Creates a directory entry (name is already formatted). */
static int msdos_add_entry(struct inode *dir, const char *name,
static int msdos_add_entry(struct inode *dir, const unsigned char *name,
struct buffer_head **bh,
struct msdos_dir_entry **de,
loff_t *i_pos, int is_dir, int is_hid)
......@@ -270,7 +270,7 @@ int msdos_create(struct inode *dir,struct dentry *dentry,int mode,
struct inode *inode;
loff_t i_pos;
int res, is_hid;
char msdos_name[MSDOS_NAME];
unsigned char msdos_name[MSDOS_NAME];
lock_kernel();
res = msdos_format_name(dentry->d_name.name,dentry->d_name.len,
......@@ -352,7 +352,7 @@ int msdos_mkdir(struct inode *dir,struct dentry *dentry,int mode)
struct msdos_dir_entry *de;
struct inode *inode;
int res,is_hid;
char msdos_name[MSDOS_NAME];
unsigned char msdos_name[MSDOS_NAME];
loff_t i_pos;
lock_kernel();
......@@ -442,9 +442,9 @@ int msdos_unlink( struct inode *dir, struct dentry *dentry)
return res;
}
static int do_msdos_rename(struct inode *old_dir, char *old_name,
static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
struct dentry *old_dentry,
struct inode *new_dir,char *new_name, struct dentry *new_dentry,
struct inode *new_dir, unsigned char *new_name, struct dentry *new_dentry,
struct buffer_head *old_bh,
struct msdos_dir_entry *old_de, loff_t old_i_pos, int is_hid)
{
......@@ -550,7 +550,7 @@ int msdos_rename(struct inode *old_dir,struct dentry *old_dentry,
struct msdos_dir_entry *old_de;
loff_t old_i_pos;
int error, is_hid, old_hid; /* if new file and old file are hidden */
char old_msdos_name[MSDOS_NAME], new_msdos_name[MSDOS_NAME];
unsigned char old_msdos_name[MSDOS_NAME], new_msdos_name[MSDOS_NAME];
lock_kernel();
error = msdos_format_name(old_dentry->d_name.name,
......
......@@ -4,14 +4,11 @@
obj-$(CONFIG_NCP_FS) += ncpfs.o
ncpfs-objs := dir.o file.o inode.o ioctl.o mmap.o ncplib_kernel.o sock.o \
ncpfs-y := dir.o file.o inode.o ioctl.o mmap.o ncplib_kernel.o sock.o \
ncpsign_kernel.o getopt.o
ifeq ($(CONFIG_NCPFS_EXTRAS),y)
ncpfs-objs += symlink.o
endif
ifeq ($(CONFIG_NCPFS_NFS_NS),y)
ncpfs-objs += symlink.o
endif
ncpfs-$(CONFIG_NCPFS_EXTRAS) += symlink.o
ncpfs-$(CONFIG_NCPFS_NFS_NS) += symlink.o
# If you want debugging output, please uncomment the following line
# EXTRA_CFLAGS += -DDEBUG_NCP=1
......
......@@ -4,15 +4,10 @@
obj-$(CONFIG_PROC_FS) += proc.o
proc-objs := inode.o root.o base.o generic.o array.o \
kmsg.o proc_tty.o proc_misc.o kcore.o
proc-y := task_nommu.o
proc-$(CONFIG_MMU) := task_mmu.o
ifeq ($(CONFIG_MMU),y)
proc-objs += task_mmu.o
else
proc-objs += task_nommu.o
endif
proc-y += inode.o root.o base.o generic.o array.o \
kmsg.o proc_tty.o proc_misc.o kcore.o
ifeq ($(CONFIG_PROC_DEVICETREE),y)
proc-objs += proc_devtree.o
endif
proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o
......@@ -23,6 +23,7 @@
#include <linux/slab.h>
#include <linux/smp_lock.h>
#include <linux/buffer_head.h>
#include <linux/namei.h>
#define DEBUG_LEVEL 0
#if (DEBUG_LEVEL >= 1)
......@@ -70,14 +71,20 @@ static struct dentry_operations vfat_dentry_ops[4] = {
static int vfat_revalidate(struct dentry *dentry, struct nameidata *nd)
{
int ret = 1;
PRINTK1(("vfat_revalidate: %s\n", dentry->d_name.name));
spin_lock(&dcache_lock);
if (dentry->d_time == dentry->d_parent->d_inode->i_version) {
spin_unlock(&dcache_lock);
return 1;
}
if (nd && !(nd->flags & LOOKUP_CONTINUE) && (nd->flags & LOOKUP_CREATE))
/*
* negative dentry is dropped, in order to make sure
* to use the name which a user desires if this is
* create path.
*/
ret = 0;
else if (dentry->d_time != dentry->d_parent->d_inode->i_version)
ret = 0;
spin_unlock(&dcache_lock);
return 0;
return ret;
}
static inline unsigned char
......@@ -115,7 +122,7 @@ vfat_strnicmp(struct nls_table *t, const unsigned char *s1,
*/
static int vfat_hash(struct dentry *dentry, struct qstr *qstr)
{
const char *name;
const unsigned char *name;
int len;
len = qstr->len;
......@@ -137,7 +144,7 @@ static int vfat_hash(struct dentry *dentry, struct qstr *qstr)
static int vfat_hashi(struct dentry *dentry, struct qstr *qstr)
{
struct nls_table *t = MSDOS_SB(dentry->d_inode->i_sb)->nls_io;
const char *name;
const unsigned char *name;
int len;
unsigned long hash;
......@@ -197,44 +204,13 @@ static int vfat_cmp(struct dentry *dentry, struct qstr *a, struct qstr *b)
return 1;
}
#ifdef DEBUG
static void dump_fat(struct super_block *sb,int start)
{
printk("[");
while (start) {
printk("%d ",start);
start = fat_access(sb,start,-1);
if (!start) {
printk("ERROR");
break;
}
if (start == -1) break;
}
printk("]\n");
}
static void dump_de(struct msdos_dir_entry *de)
{
int i;
unsigned char *p = (unsigned char *) de;
printk("[");
for (i = 0; i < 32; i++, p++) {
printk("%02x ", *p);
}
printk("]\n");
}
#endif
/* MS-DOS "device special files" */
static const char *reserved3_names[] = {
static const unsigned char *reserved3_names[] = {
"con ", "prn ", "nul ", "aux ", NULL
};
static const char *reserved4_names[] = {
static const unsigned char *reserved4_names[] = {
"com1 ", "com2 ", "com3 ", "com4 ", "com5 ",
"com6 ", "com7 ", "com8 ", "com9 ",
"lpt1 ", "lpt2 ", "lpt3 ", "lpt4 ", "lpt5 ",
......@@ -287,16 +263,20 @@ static inline int vfat_is_used_badchars(const wchar_t *s, int len)
/* Returns negative number on error, 0 for a normal
* return, and 1 for . or .. */
static int vfat_valid_longname(const char *name, int len, int xlate)
static int vfat_valid_longname(const unsigned char *name, int len, int xlate)
{
const char **reserved, *walk;
const unsigned char **reserved, *walk;
int baselen;
if (len && name[len-1] == ' ') return -EINVAL;
if (len >= 256) return -EINVAL;
if (len < 3) return 0;
if (len && name[len-1] == ' ')
return -EINVAL;
if (len >= 256)
return -EINVAL;
if (len < 3)
return 0;
for (walk = name; *walk != 0 && *walk != '.'; walk++);
for (walk = name; *walk != 0 && *walk != '.'; walk++)
;
baselen = walk - name;
if (baselen == 3) {
......@@ -313,7 +293,7 @@ static int vfat_valid_longname(const char *name, int len, int xlate)
return 0;
}
static int vfat_find_form(struct inode *dir,char *name)
static int vfat_find_form(struct inode *dir, unsigned char *name)
{
struct msdos_dir_entry *de;
struct buffer_head *bh = NULL;
......@@ -426,7 +406,7 @@ static inline int to_shortname_char(struct nls_table *nls,
*/
static int vfat_create_shortname(struct inode *dir, struct nls_table *nls,
wchar_t *uname, int ulen,
char *name_res, unsigned char *lcase)
unsigned char *name_res, unsigned char *lcase)
{
wchar_t *ip, *ext_start, *end, *name_start;
unsigned char base[9], ext[4], buf[8], *p;
......@@ -606,21 +586,22 @@ static int vfat_create_shortname(struct inode *dir, struct nls_table *nls,
/* Translate a string, including coded sequences into Unicode */
static int
xlate_to_uni(const char *name, int len, char *outname, int *longlen, int *outlen,
int escape, int utf8, struct nls_table *nls)
xlate_to_uni(const unsigned char *name, int len, unsigned char *outname,
int *longlen, int *outlen, int escape, int utf8,
struct nls_table *nls)
{
const unsigned char *ip;
unsigned char nc;
char *op;
unsigned char *op;
unsigned int ec;
int i, k, fill;
int charlen;
if (utf8) {
*outlen = utf8_mbstowcs((__u16 *) outname, name, PAGE_SIZE);
*outlen = utf8_mbstowcs((wchar_t *)outname, name, PAGE_SIZE);
if (name[len-1] == '.')
*outlen-=2;
op = &outname[*outlen * sizeof(__u16)];
op = &outname[*outlen * sizeof(wchar_t)];
} else {
if (name[len-1] == '.')
len--;
......@@ -691,8 +672,9 @@ xlate_to_uni(const char *name, int len, char *outname, int *longlen, int *outlen
return 0;
}
static int vfat_build_slots(struct inode *dir, const char *name, int len,
struct msdos_dir_slot *ds, int *slots, int is_dir)
static int vfat_build_slots(struct inode *dir, const unsigned char *name,
int len, struct msdos_dir_slot *ds,
int *slots, int is_dir)
{
struct msdos_sb_info *sbi = MSDOS_SB(dir->i_sb);
struct fat_mount_options *opts = &sbi->options;
......@@ -700,7 +682,7 @@ static int vfat_build_slots(struct inode *dir, const char *name, int len,
struct msdos_dir_entry *de;
unsigned long page;
unsigned char cksum, lcase;
char msdos_name[MSDOS_NAME];
unsigned char msdos_name[MSDOS_NAME];
wchar_t *uname;
int res, slot, ulen, usize, i;
loff_t offset;
......@@ -714,7 +696,7 @@ static int vfat_build_slots(struct inode *dir, const char *name, int len,
return -ENOMEM;
uname = (wchar_t *)page;
res = xlate_to_uni(name, len, (char *)uname, &ulen, &usize,
res = xlate_to_uni(name, len, (unsigned char *)uname, &ulen, &usize,
opts->unicode_xlate, opts->utf8, sbi->nls_io);
if (res < 0)
goto out_free;
......
......@@ -491,7 +491,7 @@ extern void blk_attempt_remerge(request_queue_t *, struct request *);
extern void __blk_attempt_remerge(request_queue_t *, struct request *);
extern struct request *blk_get_request(request_queue_t *, int, int);
extern void blk_put_request(struct request *);
extern void blk_insert_request(request_queue_t *, struct request *, int, void *);
extern void blk_insert_request(request_queue_t *, struct request *, int, void *, int);
extern void blk_requeue_request(request_queue_t *, struct request *);
extern void blk_plug_device(request_queue_t *);
extern int blk_remove_plug(request_queue_t *);
......
......@@ -44,7 +44,7 @@ struct statfs;
#define CASE_LOWER_EXT 16 /* extension is lower case */
#define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */
#define IS_FREE(n) (!*(n) || *(const unsigned char *) (n) == DELETED_FLAG)
#define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG)
#define MSDOS_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO)
/* valid file mode bits */
......@@ -113,11 +113,11 @@ struct statfs;
#define CT_LE_L(v) cpu_to_le32(v)
struct fat_boot_sector {
__s8 ignored[3]; /* Boot strap short or near jump */
__s8 system_id[8]; /* Name - can be used to special case
__u8 ignored[3]; /* Boot strap short or near jump */
__u8 system_id[8]; /* Name - can be used to special case
partition manager volumes */
__u8 sector_size[2]; /* bytes per logical sector */
__u8 cluster_size; /* sectors/cluster */
__u8 sec_per_clus; /* sectors/cluster */
__u16 reserved; /* reserved sectors */
__u8 fats; /* number of FATs */
__u8 dir_entries[2]; /* root directory entries */
......@@ -149,7 +149,7 @@ struct fat_boot_fsinfo {
};
struct msdos_dir_entry {
__s8 name[8],ext[3]; /* name and extension */
__u8 name[8],ext[3]; /* name and extension */
__u8 attr; /* attribute bits */
__u8 lcase; /* Case for base and extension */
__u8 ctime_ms; /* Creation time, milliseconds */
......@@ -237,12 +237,15 @@ extern void fat_cache_lookup(struct inode *inode, int cluster, int *f_clu,
int *d_clu);
extern void fat_cache_add(struct inode *inode, int f_clu, int d_clu);
extern void fat_cache_inval_inode(struct inode *inode);
extern int fat_get_cluster(struct inode *inode, int cluster,
int *fclus, int *dclus);
extern int fat_free(struct inode *inode, int skip);
/* fat/dir.c */
extern struct file_operations fat_dir_operations;
extern int fat_search_long(struct inode *inode, const char *name, int name_len,
int anycase, loff_t *spos, loff_t *lpos);
extern int fat_search_long(struct inode *inode, const unsigned char *name,
int name_len, int anycase,
loff_t *spos, loff_t *lpos);
extern int fat_readdir(struct file *filp, void *dirent, filldir_t filldir);
extern int fat_dir_ioctl(struct inode * inode, struct file * filp,
unsigned int cmd, unsigned long arg);
......@@ -302,7 +305,7 @@ static __inline__ int fat_get_entry(struct inode *dir, loff_t *pos,
return fat__get_entry(dir, pos, bh, de, i_pos);
}
extern int fat_subdirs(struct inode *dir);
extern int fat_scan(struct inode *dir, const char *name,
extern int fat_scan(struct inode *dir, const unsigned char *name,
struct buffer_head **res_bh,
struct msdos_dir_entry **res_de, loff_t *i_pos);
......
......@@ -36,8 +36,9 @@ struct fat_cache {
};
struct msdos_sb_info {
unsigned short cluster_size; /* sectors/cluster */
unsigned short cluster_bits; /* sectors/cluster */
unsigned short sec_per_clus; /* sectors/cluster */
unsigned short cluster_bits; /* log2(cluster_size) */
unsigned int cluster_size; /* cluster size */
unsigned char fats,fat_bits; /* number of FATs, FAT bits (12 or 16) */
unsigned short fat_start;
unsigned long fat_length; /* FAT start & length (sec.) */
......
......@@ -83,7 +83,6 @@ unsigned char software_suspend_enabled = 0;
#define ADDRESS2(x) __ADDRESS(__pa(x)) /* Needed for x86-64 where some pages are in memory twice */
/* References to section boundaries */
extern char _text, _etext, _edata, __bss_start, _end;
extern char __nosave_begin, __nosave_end;
extern int is_head_of_free_region(struct page *);
......
......@@ -1377,7 +1377,8 @@ svc_create_socket(struct svc_serv *serv, int protocol, struct sockaddr_in *sin)
return error;
if (sin != NULL) {
sock->sk->sk_reuse = 1; /* allow address reuse */
if (type == SOCK_STREAM)
sock->sk->sk_reuse = 1; /* allow address reuse */
error = sock->ops->bind(sock, (struct sockaddr *) sin,
sizeof(*sin));
if (error < 0)
......
......@@ -115,6 +115,7 @@ int conf_read(const char *name)
while (fgets(line, sizeof(line), in)) {
lineno++;
sym = NULL;
switch (line[0]) {
case '#':
if (memcmp(line + 2, "CONFIG_", 7))
......@@ -125,11 +126,15 @@ int conf_read(const char *name)
*p++ = 0;
if (strncmp(p, "is not set", 10))
continue;
sym = sym_lookup(line + 9, 0);
sym = sym_find(line + 9);
if (!sym) {
fprintf(stderr, "%s:%d: trying to assign nonexistent symbol %s\n", name, lineno, line + 9);
break;
}
switch (sym->type) {
case S_BOOLEAN:
case S_TRISTATE:
sym->user = symbol_no.curr;
sym->user.tri = no;
sym->flags &= ~SYMBOL_NEW;
break;
default:
......@@ -197,35 +202,36 @@ int conf_read(const char *name)
default:
;
}
if (sym_is_choice_value(sym)) {
struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
switch (sym->user.tri) {
case mod:
if (cs->user.tri == yes)
/* warn? */;
break;
case yes:
if (cs->user.tri != no)
/* warn? */;
cs->user.val = sym;
break;
case no:
break;
}
cs->user.tri = sym->user.tri;
}
break;
case '\n':
break;
default:
continue;
}
if (sym && sym_is_choice_value(sym)) {
struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
switch (sym->user.tri) {
case no:
break;
case mod:
if (cs->user.tri == yes)
/* warn? */;
break;
case yes:
if (cs->user.tri != no)
/* warn? */;
cs->user.val = sym;
break;
}
cs->user.tri = E_OR(cs->user.tri, sym->user.tri);
cs->flags &= ~SYMBOL_NEW;
}
}
fclose(in);
for_all_symbols(i, sym) {
sym_calc_value(sym);
if (sym_has_value(sym)) {
if (sym_has_value(sym) && !sym_is_choice_value(sym)) {
if (sym->visible == no)
sym->flags |= SYMBOL_NEW;
switch (sym->type) {
......@@ -241,7 +247,6 @@ int conf_read(const char *name)
if (!sym_is_choice(sym))
continue;
prop = sym_get_choice_prop(sym);
sym->flags &= ~SYMBOL_NEW;
for (e = prop->expr; e; e = e->left.expr)
if (e->right.sym->visible != no)
sym->flags |= e->right.sym->flags & SYMBOL_NEW;
......@@ -408,6 +413,7 @@ int conf_write(const char *name)
if (out_h) {
fclose(out_h);
rename(".tmpconfig.h", "include/linux/autoconf.h");
file_write_dep(NULL);
}
if (!name || basename != conf_def_filename) {
if (!name)
......
......@@ -30,7 +30,7 @@ enum {
SINGLE_VIEW, SPLIT_VIEW, FULL_VIEW
};
static gint view_mode = SPLIT_VIEW;
static gint view_mode = FULL_VIEW;
static gboolean show_name = TRUE;
static gboolean show_range = TRUE;
static gboolean show_value = TRUE;
......@@ -59,7 +59,8 @@ GtkTreeModel *model1, *model2;
static GtkTreeIter *parents[256] = { 0 };
static gint indent;
static struct menu *current;
static struct menu *current; // current node for SINGLE view
static struct menu *browsed; // browsed node for SPLIT view
enum {
COL_OPTION, COL_NAME, COL_NO, COL_MOD, COL_YES, COL_VALUE,
......@@ -317,17 +318,33 @@ void init_left_tree(void)
GtkTreeView *view = GTK_TREE_VIEW(tree1_w);
GtkCellRenderer *renderer;
GtkTreeSelection *sel;
GtkTreeViewColumn *column;
gtk_tree_view_set_model(view, model1);
gtk_tree_view_set_headers_visible(view, TRUE);
gtk_tree_view_set_rules_hint(view, FALSE);
column = gtk_tree_view_column_new();
gtk_tree_view_append_column(view, column);
gtk_tree_view_column_set_title(column, "Options");
renderer = gtk_cell_renderer_toggle_new();
gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column),
renderer, FALSE);
gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column),
renderer,
"active", COL_BTNACT,
"inconsistent", COL_BTNINC,
"visible", COL_BTNVIS,
"radio", COL_BTNRAD, NULL);
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_insert_column_with_attributes(view, -1,
"Options", renderer,
"text", COL_OPTION,
"foreground-gdk",
COL_COLOR, NULL);
gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column),
renderer, FALSE);
gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column),
renderer,
"text", COL_OPTION,
"foreground-gdk",
COL_COLOR, NULL);
sel = gtk_tree_view_get_selection(view);
gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE);
......@@ -709,7 +726,7 @@ on_show_all_options1_activate(GtkMenuItem * menuitem, gpointer user_data)
show_all = GTK_CHECK_MENU_ITEM(menuitem)->active;
gtk_tree_store_clear(tree2);
display_tree(&rootmenu); // instead of update_tree for speed reasons
display_tree(&rootmenu); // instead of update_tree to speed-up
}
......@@ -923,7 +940,7 @@ static void change_sym_value(struct menu *menu, gint col)
if (view_mode == FULL_VIEW)
update_tree(&rootmenu, NULL);
else if (view_mode == SPLIT_VIEW) {
update_tree(current, NULL);
update_tree(browsed, NULL);
display_list();
}
else if (view_mode == SINGLE_VIEW)
......@@ -952,7 +969,7 @@ static void toggle_sym_value(struct menu *menu)
if (view_mode == FULL_VIEW)
update_tree(&rootmenu, NULL);
else if (view_mode == SPLIT_VIEW) {
update_tree(current, NULL);
update_tree(browsed, NULL);
display_list();
}
else if (view_mode == SINGLE_VIEW)
......@@ -1004,8 +1021,6 @@ static gint column2index(GtkTreeViewColumn * column)
}
//#define GTK_BUG_FIXED // uncomment it for GTK+ >= 2.1.4 (2.2)
/* User click: update choice (full) or goes down (single) */
gboolean
on_treeview2_button_press_event(GtkWidget * widget,
......@@ -1018,7 +1033,7 @@ on_treeview2_button_press_event(GtkWidget * widget,
struct menu *menu;
gint col;
#ifdef GTK_BUG_FIXED
#if GTK_CHECK_VERSION(2,1,4) // bug in ctree with earlier version of GTK
gint tx = (gint) event->x;
gint ty = (gint) event->y;
gint cx, cy;
......@@ -1151,7 +1166,7 @@ on_treeview1_button_press_event(GtkWidget * widget,
current = menu;
display_tree_part();
} else {
current = menu;
browsed = menu;
display_tree_part();
}
......@@ -1196,7 +1211,7 @@ static gchar **fill_row(struct menu *menu)
switch (ptype) {
case P_MENU:
row[COL_PIXBUF] = (gchar *) xpm_menu;
if (view_mode != FULL_VIEW)
if (view_mode == SINGLE_VIEW)
row[COL_PIXVIS] = GINT_TO_POINTER(TRUE);
row[COL_BTNVIS] = GINT_TO_POINTER(FALSE);
break;
......@@ -1242,6 +1257,8 @@ static gchar **fill_row(struct menu *menu)
stype = sym_get_type(sym);
switch (stype) {
case S_BOOLEAN:
if(GPOINTER_TO_INT(row[COL_PIXVIS]) == FALSE)
row[COL_BTNVIS] = GINT_TO_POINTER(TRUE);
if (sym_is_choice(sym))
break;
case S_TRISTATE:
......@@ -1491,6 +1508,7 @@ static void display_tree(struct menu *menu)
place_node(child, fill_row(child));
#ifdef DEBUG
printf("%*c%s: ", indent, ' ', menu_get_prompt(child));
printf("%s", child->flags & MENU_ROOT ? "rootmenu | " : "");
dbg_print_ptype(ptype);
printf(" | ");
if (sym) {
......@@ -1504,10 +1522,12 @@ static void display_tree(struct menu *menu)
if ((view_mode != FULL_VIEW) && (ptype == P_MENU)
&& (tree == tree2))
continue;
/*
if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT)) ||
(view_mode == FULL_VIEW)
|| (view_mode == SPLIT_VIEW)) {
|| (view_mode == SPLIT_VIEW))*/
if ((view_mode == SINGLE_VIEW) && (menu->flags & MENU_ROOT)
|| (view_mode == FULL_VIEW) || (view_mode == SPLIT_VIEW)) {
indent++;
display_tree(child);
indent--;
......@@ -1520,7 +1540,10 @@ static void display_tree_part(void)
{
if (tree2)
gtk_tree_store_clear(tree2);
display_tree(current);
if(view_mode == SINGLE_VIEW)
display_tree(current);
else if(view_mode == SPLIT_VIEW)
display_tree(browsed);
gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w));
}
......@@ -1531,20 +1554,25 @@ static void display_list(void)
gtk_tree_store_clear(tree1);
tree = tree1;
display_tree(current = &rootmenu);
display_tree(&rootmenu);
gtk_tree_view_expand_all(GTK_TREE_VIEW(tree1_w));
tree = tree2;
}
static void fixup_rootmenu(struct menu *menu)
void fixup_rootmenu(struct menu *menu)
{
struct menu *child;
if (!menu->prompt || menu->prompt->type != P_MENU)
return;
menu->flags |= MENU_ROOT;
for (child = menu->list; child; child = child->next)
fixup_rootmenu(child);
struct menu *child;
static int menu_cnt = 0;
menu->flags |= MENU_ROOT;
for (child = menu->list; child; child = child->next) {
if (child->prompt && child->prompt->type == P_MENU) {
menu_cnt++;
fixup_rootmenu(child);
menu_cnt--;
} else if (!menu_cnt)
fixup_rootmenu(child);
}
}
......
......@@ -409,10 +409,13 @@ void ConfigList::updateList(ConfigItem* item)
item = new ConfigItem(this, 0, true);
last = item;
}
if (mode == singleMode && rootEntry->sym && rootEntry->prompt) {
if ((mode == singleMode || mode == symbolMode) &&
rootEntry->sym && rootEntry->prompt) {
item = last ? last->nextSibling() : firstChild();
if (!item)
item = new ConfigItem(this, last, rootEntry, true);
else
item->testUpdateMenu(true);
updateMenuList(item, rootEntry);
triggerUpdate();
......
......@@ -3,11 +3,12 @@ obj-y := initramfs_data.o
host-progs := gen_init_cpio
clean-files := initramfs_data.cpio.gz initramfs_data.S
clean-files := initramfs_data.cpio.gz
$(src)/initramfs_data.S: $(obj)/initramfs_data.cpio.gz
echo " .section .init.ramfs,\"a\"" > $(src)/initramfs_data.S
echo ".incbin \"usr/initramfs_data.cpio.gz\"" >> $(src)/initramfs_data.S
# initramfs_data.o contains the initramfs_data.cpio.gz image.
# The image is included using .incbin, a dependency which is not
# tracked automatically.
$(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio.gz FORCE
# initramfs-y are the programs which will be copied into the CPIO
# archive. Currently, the filenames are hardcoded in gen_init_cpio,
......
/*
initramfs_data includes the compressed binary that is the
filesystem used for early user space.
Note: Older versions of "as" (prior to binutils 2.11.90.0.23
released on 2001-07-14) dit not support .incbin.
If you are forced to use older binutils than that then the
following trick can be applied to create the resulting binary:
ld -m elf_i386 --format binary --oformat elf32-i386 -r \
-T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o
ld -m elf_i386 -r -o built-in.o initramfs_data.o
initramfs_data.scr looks like this:
SECTIONS
{
.init.ramfs : { *(.data) }
}
The above example is for i386 - the parameters vary from architectures.
Eventually look up LDFLAGS_BLOB in an older version of the
arch/$(ARCH)/Makefile to see the flags used before .incbin was introduced.
Using .incbin has the advantage over ld that the correct flags are set
in the ELF header, as required by certain architectures.
*/
.section .init.ramfs,"a"
.incbin "usr/initramfs_data.cpio.gz"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment