mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #16226 from jnohlgard/devfs-submodule
devfs: Split devfs-random into two files using submodules
This commit is contained in:
commit
8ebe4f608b
@ -1,2 +1,4 @@
|
|||||||
MODULE=devfs
|
MODULE=devfs
|
||||||
|
SRC = devfs.c auto_init_devfs.c
|
||||||
|
SUBMODULES = 1
|
||||||
include $(RIOTBASE)/Makefile.base
|
include $(RIOTBASE)/Makefile.base
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
|
|
||||||
#include "vfs.h"
|
#include "vfs.h"
|
||||||
|
|
||||||
#ifdef MODULE_DEVFS_HWRNG
|
|
||||||
|
|
||||||
#include "periph/hwrng.h"
|
#include "periph/hwrng.h"
|
||||||
|
|
||||||
static ssize_t hwrng_vfs_read(vfs_file_t *filp, void *dest, size_t nbytes);
|
static ssize_t hwrng_vfs_read(vfs_file_t *filp, void *dest, size_t nbytes);
|
||||||
@ -39,23 +37,3 @@ static ssize_t hwrng_vfs_read(vfs_file_t *filp, void *dest, size_t nbytes)
|
|||||||
|
|
||||||
return nbytes;
|
return nbytes;
|
||||||
}
|
}
|
||||||
#endif /* MODULE_PERIPH_HWRNG */
|
|
||||||
|
|
||||||
#ifdef MODULE_DEVFS_RANDOM
|
|
||||||
|
|
||||||
#include "random.h"
|
|
||||||
|
|
||||||
static ssize_t random_vfs_read(vfs_file_t *filp, void *dest, size_t nbytes);
|
|
||||||
|
|
||||||
const vfs_file_ops_t random_vfs_ops = {
|
|
||||||
.read = random_vfs_read,
|
|
||||||
};
|
|
||||||
|
|
||||||
static ssize_t random_vfs_read(vfs_file_t *filp, void *dest, size_t nbytes)
|
|
||||||
{
|
|
||||||
(void)filp;
|
|
||||||
random_bytes(dest, nbytes);
|
|
||||||
|
|
||||||
return nbytes;
|
|
||||||
}
|
|
||||||
#endif /* MODULE_RANDOM */
|
|
37
sys/fs/devfs/random.c
Normal file
37
sys/fs/devfs/random.c
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 OTA keys S.A.
|
||||||
|
*
|
||||||
|
* This file is subject to the terms and conditions of the GNU Lesser
|
||||||
|
* General Public License v2.1. See the file LICENSE in the top level
|
||||||
|
* directory for more details.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup sys_fs_devfs
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* @file
|
||||||
|
* @brief Random backends for devfs implementation
|
||||||
|
*
|
||||||
|
* @author Vincent Dupont <vincent@otakeys.com>
|
||||||
|
*
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "vfs.h"
|
||||||
|
#include "random.h"
|
||||||
|
|
||||||
|
static ssize_t random_vfs_read(vfs_file_t *filp, void *dest, size_t nbytes);
|
||||||
|
|
||||||
|
const vfs_file_ops_t random_vfs_ops = {
|
||||||
|
.read = random_vfs_read,
|
||||||
|
};
|
||||||
|
|
||||||
|
static ssize_t random_vfs_read(vfs_file_t *filp, void *dest, size_t nbytes)
|
||||||
|
{
|
||||||
|
(void)filp;
|
||||||
|
random_bytes(dest, nbytes);
|
||||||
|
|
||||||
|
return nbytes;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user