diff options
author | Carsten Otte <cotte@de.ibm.com> | 2005-06-24 01:05:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-24 03:06:41 -0400 |
commit | ceffc078528befc008c6f2c2c4decda79eabd534 (patch) | |
tree | a289e10162bdef0c0d9f6533f1a647b0fe1ed7a9 /mm/filemap.c | |
parent | 420edbcc09008342c7b2665453f6b370739aadb0 (diff) |
[PATCH] xip: fs/mm: execute in place
- generic_file* file operations do no longer have a xip/non-xip split
- filemap_xip.c implements a new set of fops that require get_xip_page
aop to work proper. all new fops are exported GPL-only (don't like to
see whatever code use those except GPL modules)
- __xip_unmap now uses page_check_address, which is no longer static
in rmap.c, and defined in linux/rmap.h
- mm/filemap.h is now much more clean, plainly having just Linus'
inline funcs moved here from filemap.c
- fix includes in filemap_xip to make it build cleanly on i386
Signed-off-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 74 |
1 files changed, 2 insertions, 72 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index a3598b542a31..7332194d7afd 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/blkdev.h> | 28 | #include <linux/blkdev.h> |
29 | #include <linux/security.h> | 29 | #include <linux/security.h> |
30 | #include <linux/syscalls.h> | 30 | #include <linux/syscalls.h> |
31 | #include "filemap.h" | ||
31 | /* | 32 | /* |
32 | * FIXME: remove all knowledge of the buffer layer from the core VM | 33 | * FIXME: remove all knowledge of the buffer layer from the core VM |
33 | */ | 34 | */ |
@@ -1714,32 +1715,7 @@ int remove_suid(struct dentry *dentry) | |||
1714 | } | 1715 | } |
1715 | EXPORT_SYMBOL(remove_suid); | 1716 | EXPORT_SYMBOL(remove_suid); |
1716 | 1717 | ||
1717 | /* | 1718 | size_t |
1718 | * Copy as much as we can into the page and return the number of bytes which | ||
1719 | * were sucessfully copied. If a fault is encountered then clear the page | ||
1720 | * out to (offset+bytes) and return the number of bytes which were copied. | ||
1721 | */ | ||
1722 | static inline size_t | ||
1723 | filemap_copy_from_user(struct page *page, unsigned long offset, | ||
1724 | const char __user *buf, unsigned bytes) | ||
1725 | { | ||
1726 | char *kaddr; | ||
1727 | int left; | ||
1728 | |||
1729 | kaddr = kmap_atomic(page, KM_USER0); | ||
1730 | left = __copy_from_user_inatomic(kaddr + offset, buf, bytes); | ||
1731 | kunmap_atomic(kaddr, KM_USER0); | ||
1732 | |||
1733 | if (left != 0) { | ||
1734 | /* Do it the slow way */ | ||
1735 | kaddr = kmap(page); | ||
1736 | left = __copy_from_user(kaddr + offset, buf, bytes); | ||
1737 | kunmap(page); | ||
1738 | } | ||
1739 | return bytes - left; | ||
1740 | } | ||
1741 | |||
1742 | static size_t | ||
1743 | __filemap_copy_from_user_iovec(char *vaddr, | 1719 | __filemap_copy_from_user_iovec(char *vaddr, |
1744 | const struct iovec *iov, size_t base, size_t bytes) | 1720 | const struct iovec *iov, size_t base, size_t bytes) |
1745 | { | 1721 | { |
@@ -1767,52 +1743,6 @@ __filemap_copy_from_user_iovec(char *vaddr, | |||
1767 | } | 1743 | } |
1768 | 1744 | ||
1769 | /* | 1745 | /* |
1770 | * This has the same sideeffects and return value as filemap_copy_from_user(). | ||
1771 | * The difference is that on a fault we need to memset the remainder of the | ||
1772 | * page (out to offset+bytes), to emulate filemap_copy_from_user()'s | ||
1773 | * single-segment behaviour. | ||
1774 | */ | ||
1775 | static inline size_t | ||
1776 | filemap_copy_from_user_iovec(struct page *page, unsigned long offset, | ||
1777 | const struct iovec *iov, size_t base, size_t bytes) | ||
1778 | { | ||
1779 | char *kaddr; | ||
1780 | size_t copied; | ||
1781 | |||
1782 | kaddr = kmap_atomic(page, KM_USER0); | ||
1783 | copied = __filemap_copy_from_user_iovec(kaddr + offset, iov, | ||
1784 | base, bytes); | ||
1785 | kunmap_atomic(kaddr, KM_USER0); | ||
1786 | if (copied != bytes) { | ||
1787 | kaddr = kmap(page); | ||
1788 | copied = __filemap_copy_from_user_iovec(kaddr + offset, iov, | ||
1789 | base, bytes); | ||
1790 | kunmap(page); | ||
1791 | } | ||
1792 | return copied; | ||
1793 | } | ||
1794 | |||
1795 | static inline void | ||
1796 | filemap_set_next_iovec(const struct iovec **iovp, size_t *basep, size_t bytes) | ||
1797 | { | ||
1798 | const struct iovec *iov = *iovp; | ||
1799 | size_t base = *basep; | ||
1800 | |||
1801 | while (bytes) { | ||
1802 | int copy = min(bytes, iov->iov_len - base); | ||
1803 | |||
1804 | bytes -= copy; | ||
1805 | base += copy; | ||
1806 | if (iov->iov_len == base) { | ||
1807 | iov++; | ||
1808 | base = 0; | ||
1809 | } | ||
1810 | } | ||
1811 | *iovp = iov; | ||
1812 | *basep = base; | ||
1813 | } | ||
1814 | |||
1815 | /* | ||
1816 | * Performs necessary checks before doing a write | 1746 | * Performs necessary checks before doing a write |
1817 | * | 1747 | * |
1818 | * Can adjust writing position aor amount of bytes to write. | 1748 | * Can adjust writing position aor amount of bytes to write. |