summaryrefslogtreecommitdiff
path: root/sys/include
diff options
context:
space:
mode:
Diffstat (limited to 'sys/include')
-rw-r--r--sys/include/sys/device.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/include/sys/device.h b/sys/include/sys/device.h
index 8695ab6..a3ce983 100644
--- a/sys/include/sys/device.h
+++ b/sys/include/sys/device.h
@@ -33,10 +33,9 @@
#include <sys/sio.h>
#include <sys/queue.h>
#include <sys/types.h>
+#include <string.h>
#include <vm/dynalloc.h>
-#define DEVICE_ALLOC() dynalloc(sizeof(struct device))
-
struct device {
dev_t major, minor;
size_t blocksize;
@@ -46,6 +45,19 @@ struct device {
TAILQ_ENTRY(device) link;
};
+static inline struct device *
+device_alloc(void)
+{
+ struct device *dev;
+
+ dev = dynalloc(sizeof(struct device));
+ if (dev == NULL)
+ return dev;
+
+ memset(dev, 0, sizeof(struct device));
+ return dev;
+}
+
struct device *device_fetch(dev_t major, dev_t minor);
dev_t device_alloc_major(void);
dev_t device_create(struct device *dev, dev_t major, dev_t minor);