Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174871
b: refs/heads/master
c: a5d09d6
h: refs/heads/master
i:
  174869: d4fda1a
  174867: 0f94781
  174863: 1d36aad
v: v3
  • Loading branch information
Roel Kluin authored and Jason Wessel committed Dec 11, 2009
1 parent 5607633 commit fbf86b9
Show file tree
Hide file tree
Showing 265 changed files with 3,692 additions and 39,420 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9764757932ce26f139332f89d1d3b815e4cc56ab
refs/heads/master: a5d09d68335bb8422d5e7050c9f03f99ba6cfebd
7 changes: 2 additions & 5 deletions trunk/Documentation/filesystems/nilfs2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ Mount options
NILFS2 supports the following mount options:
(*) == default

nobarrier Disables barriers.
barrier=on(*) This enables/disables barriers. barrier=off disables
it, barrier=on enables it.
errors=continue(*) Keep going on a filesystem error.
errors=remount-ro Remount the filesystem read-only on an error.
errors=panic Panic and halt the machine if an error occurs.
Expand All @@ -70,10 +71,6 @@ order=strict Apply strict in-order semantics that preserves sequence
blocks. That means, it is guaranteed that no
overtaking of events occurs in the recovered file
system after a crash.
norecovery Disable recovery of the filesystem on mount.
This disables every write access on the device for
read-only mounts or snapshots. This option will fail
for r/w mounts on an unclean volume.

NILFS2 usage
============
Expand Down
19 changes: 13 additions & 6 deletions trunk/arch/alpha/kernel/osf_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,25 @@ SYSCALL_DEFINE6(osf_mmap, unsigned long, addr, unsigned long, len,
unsigned long, prot, unsigned long, flags, unsigned long, fd,
unsigned long, off)
{
unsigned long ret = -EINVAL;
struct file *file = NULL;
unsigned long ret = -EBADF;

#if 0
if (flags & (_MAP_HASSEMAPHORE | _MAP_INHERIT | _MAP_UNALIGNED))
printk("%s: unimplemented OSF mmap flags %04lx\n",
current->comm, flags);
#endif
if ((off + PAGE_ALIGN(len)) < off)
goto out;
if (off & ~PAGE_MASK)
goto out;
ret = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
if (!(flags & MAP_ANONYMOUS)) {
file = fget(fd);
if (!file)
goto out;
}
flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
down_write(&current->mm->mmap_sem);
ret = do_mmap(file, addr, len, prot, flags, off);
up_write(&current->mm->mmap_sem);
if (file)
fput(file);
out:
return ret;
}
Expand Down
3 changes: 0 additions & 3 deletions trunk/arch/arm/include/asm/mman.h
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#include <asm-generic/mman.h>

#define arch_mmap_check(addr, len, flags) \
(((flags) & MAP_FIXED && (addr) < FIRST_USER_ADDRESS) ? -EINVAL : 0)
2 changes: 1 addition & 1 deletion trunk/arch/arm/kernel/calls.S
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
/* 160 */ CALL(sys_sched_get_priority_min)
CALL(sys_sched_rr_get_interval)
CALL(sys_nanosleep)
CALL(sys_mremap)
CALL(sys_arm_mremap)
CALL(sys_setresuid16)
/* 165 */ CALL(sys_getresuid16)
CALL(sys_ni_syscall) /* vm86 */
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/arm/kernel/entry-common.S
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,12 @@ sys_mmap2:
tst r5, #PGOFF_MASK
moveq r5, r5, lsr #PAGE_SHIFT - 12
streq r5, [sp, #4]
beq sys_mmap_pgoff
beq do_mmap2
mov r0, #-EINVAL
mov pc, lr
#else
str r5, [sp, #4]
b sys_mmap_pgoff
b do_mmap2
#endif
ENDPROC(sys_mmap2)

Expand Down
55 changes: 54 additions & 1 deletion trunk/arch/arm/kernel/sys_arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,41 @@
#include <linux/ipc.h>
#include <linux/uaccess.h>

extern unsigned long do_mremap(unsigned long addr, unsigned long old_len,
unsigned long new_len, unsigned long flags,
unsigned long new_addr);

/* common code for old and new mmaps */
inline long do_mmap2(
unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags,
unsigned long fd, unsigned long pgoff)
{
int error = -EINVAL;
struct file * file = NULL;

flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);

if (flags & MAP_FIXED && addr < FIRST_USER_ADDRESS)
goto out;

error = -EBADF;
if (!(flags & MAP_ANONYMOUS)) {
file = fget(fd);
if (!file)
goto out;
}

down_write(&current->mm->mmap_sem);
error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
up_write(&current->mm->mmap_sem);

if (file)
fput(file);
out:
return error;
}

struct mmap_arg_struct {
unsigned long addr;
unsigned long len;
Expand All @@ -49,11 +84,29 @@ asmlinkage int old_mmap(struct mmap_arg_struct __user *arg)
if (a.offset & ~PAGE_MASK)
goto out;

error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
out:
return error;
}

asmlinkage unsigned long
sys_arm_mremap(unsigned long addr, unsigned long old_len,
unsigned long new_len, unsigned long flags,
unsigned long new_addr)
{
unsigned long ret = -EINVAL;

if (flags & MREMAP_FIXED && new_addr < FIRST_USER_ADDRESS)
goto out;

down_write(&current->mm->mmap_sem);
ret = do_mremap(addr, old_len, new_len, flags, new_addr);
up_write(&current->mm->mmap_sem);

out:
return ret;
}

/*
* Perform the select(nd, in, out, ex, tv) and mmap() system
* calls.
Expand Down
3 changes: 1 addition & 2 deletions trunk/arch/arm/mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
* We enforce the MAP_FIXED case.
*/
if (flags & MAP_FIXED) {
if (aliasing && flags & MAP_SHARED &&
(addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1))
if (aliasing && flags & MAP_SHARED && addr & (SHMLBA - 1))
return -EINVAL;
return addr;
}
Expand Down
4 changes: 4 additions & 0 deletions trunk/arch/avr32/include/asm/syscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ asmlinkage int sys_sigaltstack(const stack_t __user *, stack_t __user *,
struct pt_regs *);
asmlinkage int sys_rt_sigreturn(struct pt_regs *);

/* kernel/sys_avr32.c */
asmlinkage long sys_mmap2(unsigned long, unsigned long, unsigned long,
unsigned long, unsigned long, off_t);

/* mm/cache.c */
asmlinkage int sys_cacheflush(int, void __user *, size_t);

Expand Down
31 changes: 31 additions & 0 deletions trunk/arch/avr32/kernel/sys_avr32.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,39 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/file.h>
#include <linux/mm.h>
#include <linux/unistd.h>

#include <asm/mman.h>
#include <asm/uaccess.h>
#include <asm/syscalls.h>

asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags,
unsigned long fd, off_t offset)
{
int error = -EBADF;
struct file *file = NULL;

flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
if (!(flags & MAP_ANONYMOUS)) {
file = fget(fd);
if (!file)
return error;
}

down_write(&current->mm->mmap_sem);
error = do_mmap_pgoff(file, addr, len, prot, flags, offset);
up_write(&current->mm->mmap_sem);

if (file)
fput(file);
return error;
}

int kernel_execve(const char *file, char **argv, char **envp)
{
register long scno asm("r8") = __NR_execve;
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/avr32/kernel/syscall-stubs.S
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ __sys_execve:
__sys_mmap2:
pushm lr
st.w --sp, ARG6
call sys_mmap_pgoff
call sys_mmap2
sub sp, -4
popm pc

Expand Down
33 changes: 33 additions & 0 deletions trunk/arch/blackfin/kernel/sys_bfin.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,39 @@
#include <asm/cacheflush.h>
#include <asm/dma.h>

/* common code for old and new mmaps */
static inline long
do_mmap2(unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags,
unsigned long fd, unsigned long pgoff)
{
int error = -EBADF;
struct file *file = NULL;

flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
if (!(flags & MAP_ANONYMOUS)) {
file = fget(fd);
if (!file)
goto out;
}

down_write(&current->mm->mmap_sem);
error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
up_write(&current->mm->mmap_sem);

if (file)
fput(file);
out:
return error;
}

asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags,
unsigned long fd, unsigned long pgoff)
{
return do_mmap2(addr, len, prot, flags, fd, pgoff);
}

asmlinkage void *sys_sram_alloc(size_t size, unsigned long flags)
{
return sram_alloc_with_lsl(size, flags);
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/blackfin/mach-common/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,7 @@ ENTRY(_sys_call_table)
.long _sys_ni_syscall /* streams2 */
.long _sys_vfork /* 190 */
.long _sys_getrlimit
.long _sys_mmap_pgoff
.long _sys_mmap2
.long _sys_truncate64
.long _sys_ftruncate64
.long _sys_stat64 /* 195 */
Expand Down
30 changes: 27 additions & 3 deletions trunk/arch/cris/kernel/sys_cris.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,31 @@
#include <asm/uaccess.h>
#include <asm/segment.h>

/* common code for old and new mmaps */
static inline long
do_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
unsigned long flags, unsigned long fd, unsigned long pgoff)
{
int error = -EBADF;
struct file * file = NULL;

flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
if (!(flags & MAP_ANONYMOUS)) {
file = fget(fd);
if (!file)
goto out;
}

down_write(&current->mm->mmap_sem);
error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
up_write(&current->mm->mmap_sem);

if (file)
fput(file);
out:
return error;
}

asmlinkage unsigned long old_mmap(unsigned long __user *args)
{
unsigned long buffer[6];
Expand All @@ -38,7 +63,7 @@ asmlinkage unsigned long old_mmap(unsigned long __user *args)
if (buffer[5] & ~PAGE_MASK) /* verify that offset is on page boundary */
goto out;

err = sys_mmap_pgoff(buffer[0], buffer[1], buffer[2], buffer[3],
err = do_mmap2(buffer[0], buffer[1], buffer[2], buffer[3],
buffer[4], buffer[5] >> PAGE_SHIFT);
out:
return err;
Expand All @@ -48,8 +73,7 @@ asmlinkage long
sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
unsigned long flags, unsigned long fd, unsigned long pgoff)
{
/* bug(?): 8Kb pages here */
return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
return do_mmap2(addr, len, prot, flags, fd, pgoff);
}

/*
Expand Down
Loading

0 comments on commit fbf86b9

Please sign in to comment.