diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-18 13:18:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-18 13:18:39 -0400 |
commit | 5cc97bf2d8eaa6cab60727c3eba3e85e29062669 (patch) | |
tree | 975976f2cb37b932d65440e6fb9960be93fc0bd7 /mm/util.c | |
parent | 826ea8f22cf612d534f33c492c98f7895043bfd1 (diff) | |
parent | dfdcdd42fdf63452ddd1bed6f49ae2a35dfb5d6c (diff) |
Merge branch 'xen-upstream' of ssh://master.kernel.org/pub/scm/linux/kernel/git/jeremy/xen
* 'xen-upstream' of ssh://master.kernel.org/pub/scm/linux/kernel/git/jeremy/xen: (44 commits)
xen: disable all non-virtual drivers
xen: use iret directly when possible
xen: suppress abs symbol warnings for unused reloc pointers
xen: Attempt to patch inline versions of common operations
xen: Place vcpu_info structure into per-cpu memory
xen: handle external requests for shutdown, reboot and sysrq
xen: machine operations
xen: add virtual network device driver
xen: add virtual block device driver.
xen: add the Xenbus sysfs and virtual device hotplug driver
xen: Add grant table support
xen: use the hvc console infrastructure for Xen console
xen: hack to prevent bad segment register reload
xen: lazy-mmu operations
xen: Add support for preemption
xen: SMP guest support
xen: Implement sched_clock
xen: Account for stolen time
xen: ignore RW mapping of RO pages in pagetable_init
xen: Complete pagetable pinning
...
Diffstat (limited to 'mm/util.c')
-rw-r--r-- | mm/util.c | 26 |
1 files changed, 24 insertions, 2 deletions
@@ -6,7 +6,6 @@ | |||
6 | 6 | ||
7 | /** | 7 | /** |
8 | * kstrdup - allocate space for and copy an existing string | 8 | * kstrdup - allocate space for and copy an existing string |
9 | * | ||
10 | * @s: the string to duplicate | 9 | * @s: the string to duplicate |
11 | * @gfp: the GFP mask used in the kmalloc() call when allocating memory | 10 | * @gfp: the GFP mask used in the kmalloc() call when allocating memory |
12 | */ | 11 | */ |
@@ -27,6 +26,30 @@ char *kstrdup(const char *s, gfp_t gfp) | |||
27 | EXPORT_SYMBOL(kstrdup); | 26 | EXPORT_SYMBOL(kstrdup); |
28 | 27 | ||
29 | /** | 28 | /** |
29 | * kstrndup - allocate space for and copy an existing string | ||
30 | * @s: the string to duplicate | ||
31 | * @max: read at most @max chars from @s | ||
32 | * @gfp: the GFP mask used in the kmalloc() call when allocating memory | ||
33 | */ | ||
34 | char *kstrndup(const char *s, size_t max, gfp_t gfp) | ||
35 | { | ||
36 | size_t len; | ||
37 | char *buf; | ||
38 | |||
39 | if (!s) | ||
40 | return NULL; | ||
41 | |||
42 | len = strnlen(s, max); | ||
43 | buf = kmalloc_track_caller(len+1, gfp); | ||
44 | if (buf) { | ||
45 | memcpy(buf, s, len); | ||
46 | buf[len] = '\0'; | ||
47 | } | ||
48 | return buf; | ||
49 | } | ||
50 | EXPORT_SYMBOL(kstrndup); | ||
51 | |||
52 | /** | ||
30 | * kmemdup - duplicate region of memory | 53 | * kmemdup - duplicate region of memory |
31 | * | 54 | * |
32 | * @src: memory region to duplicate | 55 | * @src: memory region to duplicate |
@@ -80,7 +103,6 @@ EXPORT_SYMBOL(krealloc); | |||
80 | 103 | ||
81 | /* | 104 | /* |
82 | * strndup_user - duplicate an existing string from user space | 105 | * strndup_user - duplicate an existing string from user space |
83 | * | ||
84 | * @s: The string to duplicate | 106 | * @s: The string to duplicate |
85 | * @n: Maximum number of bytes to copy, including the trailing NUL. | 107 | * @n: Maximum number of bytes to copy, including the trailing NUL. |
86 | */ | 108 | */ |