drivers/ramdisk.c and include/nuttx/fs/ramdisk.h: Add logic to dispose of the drvier and RAM buffer when the RAM disk has been unlinked and all open references to the RAM disk have been closed. Add new parameters to romdisk() to specify what should be done with the RAM/ROM buffer -- Should it be freed or not? Changed all calls to ramdisk() to use these new parameters.
This commit is contained in:
parent
f5558cd10e
commit
0724e7ccf3
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* examples/mount/ramdisk.c
|
||||
*
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009, 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -116,7 +116,7 @@ int create_ramdisk(void)
|
||||
(FAR uint8_t *)pbuffer,
|
||||
CONFIG_EXAMPLES_MOUNT_NSECTORS,
|
||||
CONFIG_EXAMPLES_MOUNT_SECTORSIZE,
|
||||
true);
|
||||
RDFLAG_WRENABLED | RDFLAG_FUNLINK);
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("create_ramdisk: Failed to register ramdisk at %s: %d\n",
|
||||
|
@ -1250,7 +1250,8 @@ int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
|
||||
/* Then register the ramdisk */
|
||||
|
||||
ret = ramdisk_register(minor, buffer, nsectors, sectsize, true);
|
||||
ret = ramdisk_register(minor, buffer, nsectors, sectsize,
|
||||
RDFLAG_WRENABLED | RDFLAG_FUNLINK);
|
||||
if (ret < 0)
|
||||
{
|
||||
nsh_output(vtbl, g_fmtcmdfailed, argv[0], "ramdisk_register", NSH_ERRNO_OF(-ret));
|
||||
|
Loading…
x
Reference in New Issue
Block a user