Revision 9a28f49adbe4955af8a1306fd36ddae15136dde7 authored by Christoph Hellwig on 13 January 2006, 17:04:41 UTC, committed by James Bottomley on 14 January 2006, 16:54:56 UTC
Adds hotplug support for SAS end devices.  Unfortunately the fusion
firmware doesn't generate similar events for expanders addition/removal
so we can't support them yet.  Eric has an idea about a clever scheme to
find out about expander changes so that'll be added later on.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1 parent 9638d89
Raw File
util.c
#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);
back to top