<p dir="ltr">I basically do that too. But can you do it again to create another RAM disk?</p>
<br><div class="gmail_quote"><div dir="ltr">On Thu, Apr 6, 2017, 5:46 PM Chris Johns <<a href="mailto:chrisj@rtems.org">chrisj@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 07/04/2017 00:08, Mathew Benson wrote:<br class="gmail_msg">
> Can I create a ramdisk, append to the rtems_ramdisk_configuration object<br class="gmail_msg">
> and register a new set of drivers to mount another ramdisk? Or are the<br class="gmail_msg">
> drivers registered oncecand only once at initialization? Basically, do<br class="gmail_msg">
> I have to predefine all the ramdisks? I have an application that<br class="gmail_msg">
> calculates the number of blocks at initialization and creates them one<br class="gmail_msg">
> at a time. But it appears that only the first call to register the<br class="gmail_msg">
> driver actually results in the creation of a new ramdisk device.<br class="gmail_msg">
><br class="gmail_msg">
<br class="gmail_msg">
I create a RAM disk by calling `ramdisk_register`. For example:<br class="gmail_msg">
<br class="gmail_msg">
#define RAMDISK_BLOCK_SIZE 512<br class="gmail_msg">
#define RAMDISK_BLOCK_COUNT ((32 * (1024 * 1024UL))/RAMDISK_BLOCK_SIZE)<br class="gmail_msg">
#define RAMDISK_PATH "/dev/rda"<br class="gmail_msg">
<br class="gmail_msg">
void setup_ramdisk (void)<br class="gmail_msg">
{<br class="gmail_msg">
#if HAS_RAMDISK<br class="gmail_msg">
dev_t dev = 0;<br class="gmail_msg">
rtems_status_code sc;<br class="gmail_msg">
<br class="gmail_msg">
printf("RAM disk: ");<br class="gmail_msg">
<br class="gmail_msg">
sc = rtems_disk_io_initialize ();<br class="gmail_msg">
if (sc != RTEMS_SUCCESSFUL)<br class="gmail_msg">
{<br class="gmail_msg">
printf ("error: disk io not initialised: %s\n",<br class="gmail_msg">
rtems_status_text (sc));<br class="gmail_msg">
return;<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
sc = ramdisk_register (RAMDISK_BLOCK_SIZE, RAMDISK_BLOCK_COUNT,<br class="gmail_msg">
false, RAMDISK_PATH, &dev);<br class="gmail_msg">
if (sc != RTEMS_SUCCESSFUL)<br class="gmail_msg">
{<br class="gmail_msg">
printf ("error: ramdisk driver not initialised: %s\n",<br class="gmail_msg">
rtems_status_text (sc));<br class="gmail_msg">
return;<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
printf ("successful\n");<br class="gmail_msg">
#endif<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
I then RFS format and mount the disk using a `#! joel` script:<br class="gmail_msg">
<br class="gmail_msg">
#! joel<br class="gmail_msg">
# Format and mount the RAM disk<br class="gmail_msg">
mkrfs /dev/rda<br class="gmail_msg">
mkdir /ram<br class="gmail_msg">
mount -t rfs /dev/rda /ram<br class="gmail_msg">
<br class="gmail_msg">
Chris<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
users mailing list<br class="gmail_msg">
<a href="mailto:users@rtems.org" class="gmail_msg" target="_blank">users@rtems.org</a><br class="gmail_msg">
<a href="http://lists.rtems.org/mailman/listinfo/users" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a><br class="gmail_msg">
</blockquote></div>