Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 16895
b: refs/heads/master
c: 30992c9
h: refs/heads/master
i:
  16893: 45028a4
  16891: f7244aa
  16887: b6e7b66
  16879: ee325b6
  16863: 9ab9b60
  16831: 4704438
  16767: cbc6674
  16639: 2936ac8
  16383: 44c5429
v: v3
  • Loading branch information
Matt Mackall authored and Linus Torvalds committed Jan 9, 2006
1 parent 7213e39 commit a85d3e6
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 39 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: 50dd26ba0947aa653f0e42897aad7a4adce4e620
refs/heads/master: 30992c97ae9d01b17374fbfab76a869fb4bba500
2 changes: 1 addition & 1 deletion trunk/mm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mmu-$(CONFIG_MMU) := fremap.o highmem.o madvise.o memory.o mincore.o \
obj-y := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \
page_alloc.o page-writeback.o pdflush.o \
readahead.o slab.o swap.o truncate.o vmscan.o \
prio_tree.o $(mmu-y)
prio_tree.o util.o $(mmu-y)

obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o thrash.o
obj-$(CONFIG_HUGETLBFS) += hugetlb.o
Expand Down
37 changes: 0 additions & 37 deletions trunk/mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -3052,20 +3052,6 @@ void kmem_cache_free(kmem_cache_t *cachep, void *objp)
}
EXPORT_SYMBOL(kmem_cache_free);

/**
* kzalloc - allocate memory. The memory is set to zero.
* @size: how many bytes of memory are required.
* @flags: the type of memory to allocate.
*/
void *kzalloc(size_t size, gfp_t flags)
{
void *ret = kmalloc(size, flags);
if (ret)
memset(ret, 0, size);
return ret;
}
EXPORT_SYMBOL(kzalloc);

/**
* kfree - free previously allocated memory
* @objp: pointer returned by kmalloc.
Expand Down Expand Up @@ -3659,26 +3645,3 @@ unsigned int ksize(const void *objp)

return obj_reallen(page_get_cache(virt_to_page(objp)));
}


/*
* kstrdup - allocate space for and copy an existing string
*
* @s: the string to duplicate
* @gfp: the GFP mask used in the kmalloc() call when allocating memory
*/
char *kstrdup(const char *s, gfp_t gfp)
{
size_t len;
char *buf;

if (!s)
return NULL;

len = strlen(s) + 1;
buf = kmalloc(len, gfp);
if (buf)
memcpy(buf, s, len);
return buf;
}
EXPORT_SYMBOL(kstrdup);
39 changes: 39 additions & 0 deletions trunk/mm/util.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/module.h>

/**
* kzalloc - allocate memory. The memory is set to zero.
* @size: how many bytes of memory are required.
* @flags: the type of memory to allocate.
*/
void *kzalloc(size_t size, gfp_t flags)
{
void *ret = kmalloc(size, flags);
if (ret)
memset(ret, 0, size);
return ret;
}
EXPORT_SYMBOL(kzalloc);

/*
* kstrdup - allocate space for and copy an existing string
*
* @s: the string to duplicate
* @gfp: the GFP mask used in the kmalloc() call when allocating memory
*/
char *kstrdup(const char *s, gfp_t gfp)
{
size_t len;
char *buf;

if (!s)
return NULL;

len = strlen(s) + 1;
buf = kmalloc(len, gfp);
if (buf)
memcpy(buf, s, len);
return buf;
}
EXPORT_SYMBOL(kstrdup);

0 comments on commit a85d3e6

Please sign in to comment.