PIPE(2): Port to RTEMS

This commit is contained in:
Kevin Kirspel
2016-12-21 11:01:28 -08:00
committed by Sebastian Huber
parent 6959face72
commit b1580fb039
6 changed files with 486 additions and 2 deletions

29
rtemsbsd/sys/fs/devfs/devfs_devs.c Normal file → Executable file
View File

@@ -33,6 +33,7 @@
#include <sys/types.h>
#include <sys/conf.h>
#include <sys/kernel.h>
#include <sys/file.h>
#include <sys/malloc.h>
#include <stdlib.h>
@@ -45,8 +46,12 @@
#include <rtems/imfs.h>
#define DEVFS_ROOTINO 2
const char rtems_cdev_directory[] = RTEMS_CDEV_DIRECTORY;
struct unrhdr *devfs_inos;
static struct cdev *
devfs_imfs_get_context_by_iop(rtems_libio_t *iop)
{
@@ -325,3 +330,27 @@ devfs_dev_exists(const char *name)
else
return 0;
}
ino_t
devfs_alloc_cdp_inode(void)
{
return (alloc_unr(devfs_inos));
}
void
devfs_free_cdp_inode(ino_t ino)
{
if (ino > 0)
free_unr(devfs_inos, ino);
}
static void
devfs_devs_init(void *junk __unused)
{
devfs_inos = new_unrhdr(DEVFS_ROOTINO + 1, INT_MAX, &devmtx);
}
SYSINIT(devfs_devs, SI_SUB_DEVFS, SI_ORDER_FIRST, devfs_devs_init, NULL);