int mtdpart_main(int argc, char *argv[]) { FAR struct mtd_dev_s *master; FAR struct mtd_dev_s *part[CONFIG_EXAMPLES_MTDPART_NPARTITIONS]; FAR struct mtd_geometry_s geo; FAR uint32_t *buffer; char blockname[32]; char charname[32]; size_t partsize; ssize_t nbytes; off_t nblocks; off_t offset; off_t check; off_t sectoff; off_t seekpos; unsigned int blkpererase; int fd; int i; int j; int k; int ret; /* Create and initialize a RAM MTD FLASH driver instance */ #ifdef CONFIG_EXAMPLES_MTDPART_ARCHINIT master = mtdpart_archinitialize(); #else master = rammtd_initialize(g_simflash, MTDPART_BUFSIZE); #endif if (!master) { message("ERROR: Failed to create RAM MTD instance\n"); msgflush(); exit(1); } /* Perform the IOCTL to erase the entire FLASH part */ ret = master->ioctl(master, MTDIOC_BULKERASE, 0); if (ret < 0) { message("ERROR: MTDIOC_BULKERASE ioctl failed: %d\n", ret); } /* Initialize to provide an FTL block driver on the MTD FLASH interface. * * NOTE: We could just skip all of this FTL and BCH stuff. We could * instead just use the MTD drivers bwrite and bread to perform this * test. Creating the character drivers, however, makes this test more * interesting. */ ret = ftl_initialize(0, master); if (ret < 0) { message("ERROR: ftl_initialize /dev/mtdblock0 failed: %d\n", ret); msgflush(); exit(2); } /* Now create a character device on the block device */ ret = bchdev_register("/dev/mtdblock0", "/dev/mtd0", false); if (ret < 0) { message("ERROR: bchdev_register /dev/mtd0 failed: %d\n", ret); msgflush(); exit(3); } /* Get the geometry of the FLASH device */ ret = master->ioctl(master, MTDIOC_GEOMETRY, (unsigned long)((uintptr_t)&geo)); if (ret < 0) { fdbg("ERROR: mtd->ioctl failed: %d\n", ret); exit(3); } message("Flash Geometry:\n"); message(" blocksize: %lu\n", (unsigned long)geo.blocksize); message(" erasesize: %lu\n", (unsigned long)geo.erasesize); message(" neraseblocks: %lu\n", (unsigned long)geo.neraseblocks); /* Determine the size of each partition. Make each partition an even * multiple of the erase block size (perhaps not using some space at the * end of the FLASH). */ blkpererase = geo.erasesize / geo.blocksize; nblocks = (geo.neraseblocks / CONFIG_EXAMPLES_MTDPART_NPARTITIONS) * blkpererase; partsize = nblocks * geo.blocksize; message(" No. partitions: %u\n", CONFIG_EXAMPLES_MTDPART_NPARTITIONS); message(" Partition size: %lu Blocks (%lu bytes)\n", nblocks, partsize); /* Now create MTD FLASH partitions */ message("Creating partitions\n"); for (offset = 0, i = 1; i <= CONFIG_EXAMPLES_MTDPART_NPARTITIONS; offset += nblocks, i++) { message(" Partition %d. Block offset=%lu, size=%lu\n", i, (unsigned long)offset, (unsigned long)nblocks); /* Create the partition */ part[i] = mtd_partition(master, offset, nblocks); if (!part[i]) { message("ERROR: mtd_partition failed. offset=%lu nblocks=%lu\n", (unsigned long)offset, (unsigned long)nblocks); msgflush(); exit(4); } /* Initialize to provide an FTL block driver on the MTD FLASH interface */ snprintf(blockname, 32, "/dev/mtdblock%d", i); snprintf(charname, 32, "/dev/mtd%d", i); ret = ftl_initialize(i, part[i]); if (ret < 0) { message("ERROR: ftl_initialize %s failed: %d\n", blockname, ret); msgflush(); exit(5); } /* Now create a character device on the block device */ ret = bchdev_register(blockname, charname, false); if (ret < 0) { message("ERROR: bchdev_register %s failed: %d\n", charname, ret); msgflush(); exit(6); } } /* Allocate a buffer */ buffer = (FAR uint32_t *)malloc(geo.blocksize); if (!buffer) { message("ERROR: failed to allocate a sector buffer\n"); msgflush(); exit(7); } /* Open the master MTD FLASH character driver for writing */ fd = open("/dev/mtd0", O_WRONLY); if (fd < 0) { message("ERROR: open /dev/mtd0 failed: %d\n", errno); msgflush(); exit(8); } /* Now write the offset into every block */ message("Initializing media:\n"); offset = 0; for (i = 0; i < geo.neraseblocks; i++) { for (j = 0; j < blkpererase; j++) { /* Fill the block with the offset */ for (k = 0; k < geo.blocksize / sizeof(uint32_t); k++) { buffer[k] = offset; offset += 4; } /* And write it using the character driver */ nbytes = write(fd, buffer, geo.blocksize); if (nbytes < 0) { message("ERROR: write to /dev/mtd0 failed: %d\n", errno); msgflush(); exit(9); } } } close(fd); /* Now read each partition */ message("Checking partitions:\n"); for (offset = 0, i = 1; i <= CONFIG_EXAMPLES_MTDPART_NPARTITIONS; offset += partsize, i++) { message(" Partition %d. Byte offset=%lu, size=%lu\n", i, (unsigned long)offset, (unsigned long)partsize); /* Open the master MTD partition character driver for writing */ snprintf(charname, 32, "/dev/mtd%d", i); fd = open(charname, O_RDWR); if (fd < 0) { message("ERROR: open %s failed: %d\n", charname, errno); msgflush(); exit(10); } /* Now verify the offset in every block */ check = offset; sectoff = 0; for (j = 0; j < nblocks; j++) { #if 0 /* Too much */ message(" block=%u offset=%lu\n", j, (unsigned long) check); #endif /* Seek to the next read position */ seekpos = lseek(fd, sectoff, SEEK_SET); if (seekpos != sectoff) { message("ERROR: lseek to offset %ld failed: %d\n", (unsigned long)sectoff, errno); msgflush(); exit(11); } /* Read the next block into memory */ nbytes = read(fd, buffer, geo.blocksize); if (nbytes < 0) { message("ERROR: read from %s failed: %d\n", charname, errno); msgflush(); exit(12); } else if (nbytes == 0) { message("ERROR: Unexpected end-of file in %s\n", charname); msgflush(); exit(13); } else if (nbytes != geo.blocksize) { message("ERROR: Unexpected read size from %s: %ld\n", charname, (unsigned long)nbytes); msgflush(); exit(14); } /* Since we forced the size of the partition to be an even number * of erase blocks, we do not expect to encounter the end of file * indication. */ else if (nbytes == 0) { message("ERROR: Unexpected end of file on %s\n", charname); msgflush(); exit(15); } /* This is not expected at all */ else if (nbytes != geo.blocksize) { message("ERROR: Short read from %s failed: %lu\n", charname, (unsigned long)nbytes); msgflush(); exit(16); } /* Verfy the offsets in the block */ for (k = 0; k < geo.blocksize / sizeof(uint32_t); k++) { if (buffer[k] != check) { message("ERROR: Bad offset %lu, expected %lu\n", (long)buffer[k], (long)check); msgflush(); exit(17); } /* Invert the value to indicate that we have verified * this value. */ buffer[k] = ~check; check += sizeof(uint32_t); } /* Seek to the next write position */ seekpos = lseek(fd, sectoff, SEEK_SET); if (seekpos != sectoff) { message("ERROR: lseek to offset %ld failed: %d\n", (unsigned long)sectoff, errno); msgflush(); exit(18); } /* Now write the block back to FLASH with the modified value */ nbytes = write(fd, buffer, geo.blocksize); if (nbytes < 0) { message("ERROR: write to %s failed: %d\n", charname, errno); msgflush(); exit(19); } else if (nbytes != geo.blocksize) { message("ERROR: Unexpected write size to %s: %ld\n", charname, (unsigned long)nbytes); msgflush(); exit(20); } /* Get the offset to the next block */ sectoff += geo.blocksize; } /* Try reading one more time. We should get the end of file */ nbytes = read(fd, buffer, geo.blocksize); if (nbytes != 0) { message("ERROR: Expected end-of-file from %s failed: %d %d\n", charname, nbytes, errno); msgflush(); exit(22); } close(fd); } /* Now verify that all of the verifed blocks appear where we thing they * should on the device. */ message("Verfying media:\n"); fd = open("/dev/mtd0", O_RDONLY); if (fd < 0) { message("ERROR: open /dev/mtd0 failed: %d\n", errno); msgflush(); exit(23); } offset = 0; check = 0; for (i = 0; i < nblocks * CONFIG_EXAMPLES_MTDPART_NPARTITIONS; i++) { /* Read the next block into memory */ nbytes = read(fd, buffer, geo.blocksize); if (nbytes < 0) { message("ERROR: read from %s failed: %d\n", charname, errno); msgflush(); exit(24); } else if (nbytes == 0) { message("ERROR: Unexpected end-of file in %s\n", charname); msgflush(); exit(25); } else if (nbytes != geo.blocksize) { message("ERROR: Unexpected read size from %s: %ld\n", charname, (unsigned long)nbytes); msgflush(); exit(26); } /* Verfy the values in the block */ for (k = 0; k < geo.blocksize / sizeof(uint32_t); k++) { if (buffer[k] != ~check) { message("ERROR: Bad value %lu, expected %lu\n", (long)buffer[k], (long)(~check)); msgflush(); exit(27); } check += sizeof(uint32_t); } } close(fd); /* And exit without bothering to clean up */ message("PASS: Everything looks good\n"); msgflush(); return 0; }
static void mtd_start(char *partition_names[], unsigned n_partitions) { int ret; if (started) errx(1, "mtd already mounted"); if (!attached) { #ifdef CONFIG_ARCH_BOARD_PX4FMU_V1 at24xxx_attach(); #else #if defined(CONFIG_ARCH_BOARD_AERODROID) #ifdef CONFIG_RAMTRON_FUJITSU ramtron_attach(); #else spansion_attach(); #endif #else ramtron_attach(); #endif #endif } if (!mtd_dev) { warnx("ERROR: Failed to create RAMTRON FRAM MTD instance"); exit(1); } unsigned long blocksize, erasesize, neraseblocks; unsigned blkpererase, nblocks, partsize; ret = mtd_get_geometry(&blocksize, &erasesize, &neraseblocks, &blkpererase, &nblocks, &partsize, n_partitions); if (ret) exit(3); /* Now create MTD FLASH partitions */ FAR struct mtd_dev_s *part[n_partitions]; char blockname[32]; unsigned offset; unsigned i; for (offset = 0, i = 0; i < n_partitions; offset += nblocks, i++) { /* Create the partition */ part[i] = mtd_partition(mtd_dev, offset, nblocks); if (!part[i]) { warnx("ERROR: mtd_partition failed. offset=%lu nblocks=%lu", (unsigned long)offset, (unsigned long)nblocks); exit(4); } /* Initialize to provide an FTL block driver on the MTD FLASH interface */ snprintf(blockname, sizeof(blockname), "/dev/mtdblock%d", i); ret = ftl_initialize(i, part[i]); if (ret < 0) { warnx("ERROR: ftl_initialize %s failed: %d", blockname, ret); exit(5); } /* Now create a character device on the block device */ ret = bchdev_register(blockname, partition_names[i], false); if (ret < 0) { warnx("ERROR: bchdev_register %s failed: %d", partition_names[i], ret); exit(6); } } n_partitions_current = n_partitions; started = true; exit(0); }
int board_app_initialize(uintptr_t arg) { #ifdef HAVE_RTC_DRIVER FAR struct rtc_lowerhalf_s *rtclower; #endif #if defined(HAVE_N25QXXX) FAR struct mtd_dev_s *mtd_temp; #endif #if defined(HAVE_N25QXXX_CHARDEV) char blockdev[18]; char chardev[12]; #endif int ret; (void)ret; #ifdef HAVE_PROC /* mount the proc filesystem */ syslog(LOG_INFO, "Mounting procfs to /proc\n"); ret = mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", ret, errno); return ret; } #endif #ifdef HAVE_RTC_DRIVER /* Instantiate the STM32 lower-half RTC driver */ rtclower = stm32l4_rtc_lowerhalf(); if (!rtclower) { serr("ERROR: Failed to instantiate the RTC lower-half driver\n"); return -ENOMEM; } else { /* Bind the lower half driver and register the combined RTC driver * as /dev/rtc0 */ ret = rtc_initialize(0, rtclower); if (ret < 0) { serr("ERROR: Failed to bind/register the RTC driver: %d\n", ret); return ret; } } #endif #ifdef HAVE_N25QXXX /* Create an instance of the STM32L4 QSPI device driver */ g_qspi = stm32l4_qspi_initialize(0); if (!g_qspi) { _err("ERROR: stm32l4_qspi_initialize failed\n"); return ret; } else { /* Use the QSPI device instance to initialize the * N25QXXX device. */ mtd_temp = n25qxxx_initialize(g_qspi, true); if (!mtd_temp) { _err("ERROR: n25qxxx_initialize failed\n"); return ret; } g_mtd_fs = mtd_temp; #ifdef CONFIG_MTD_PARTITION { FAR struct mtd_geometry_s geo; off_t nblocks; /* Setup a partition of 256KiB for our file system. */ ret = MTD_IOCTL(g_mtd_fs, MTDIOC_GEOMETRY, (unsigned long)(uintptr_t)&geo); if (ret < 0) { _err("ERROR: MTDIOC_GEOMETRY failed\n"); return ret; } nblocks = (256*1024) / geo.blocksize; mtd_temp = mtd_partition(g_mtd_fs, 0, nblocks); if (!mtd_temp) { _err("ERROR: mtd_partition failed\n"); return ret; } g_mtd_fs = mtd_temp; } #endif #ifdef HAVE_N25QXXX_SMARTFS /* Configure the device with no partition support */ ret = smart_initialize(N25QXXX_SMART_MINOR, g_mtd_fs, NULL); if (ret != OK) { _err("ERROR: Failed to initialize SmartFS: %d\n", ret); } #elif defined(HAVE_N25QXXX_NXFFS) /* Initialize to provide NXFFS on the N25QXXX MTD interface */ ret = nxffs_initialize(g_mtd_fs); if (ret < 0) { _err("ERROR: NXFFS initialization failed: %d\n", ret); } /* Mount the file system at /mnt/nxffs */ ret = mount(NULL, "/mnt/nxffs", "nxffs", 0, NULL); if (ret < 0) { _err("ERROR: Failed to mount the NXFFS volume: %d\n", errno); return ret; } #else /* if defined(HAVE_N25QXXX_CHARDEV) */ /* Use the FTL layer to wrap the MTD driver as a block driver */ ret = ftl_initialize(N25QXXX_MTD_MINOR, g_mtd_fs); if (ret < 0) { _err("ERROR: Failed to initialize the FTL layer: %d\n", ret); return ret; } /* Use the minor number to create device paths */ snprintf(blockdev, 18, "/dev/mtdblock%d", N25QXXX_MTD_MINOR); snprintf(chardev, 12, "/dev/mtd%d", N25QXXX_MTD_MINOR); /* Now create a character device on the block device */ /* NOTE: for this to work, you will need to make sure that * CONFIG_FS_WRITABLE is set in the config. It's not a user- * visible setting, but you can make it set by selecting an * arbitrary writable file system (you don't have to actually * use it, just select it so that the block device created via * ftl_initialize() will be writable). */ ret = bchdev_register(blockdev, chardev, false); if (ret < 0) { _err("ERROR: bchdev_register %s failed: %d\n", chardev, ret); return ret; } #endif } #endif #ifdef HAVE_USBHOST /* Initialize USB host operation. stm32l4_usbhost_initialize() starts a thread * will monitor for USB connection and disconnection events. */ ret = stm32l4_usbhost_initialize(); if (ret != OK) { udbg("ERROR: Failed to initialize USB host: %d\n", ret); return ret; } #endif #ifdef HAVE_USBMONITOR /* Start the USB Monitor */ ret = usbmonitor_start(0, NULL); if (ret != OK) { udbg("ERROR: Failed to start USB monitor: %d\n", ret); return ret; } #endif return OK; }
int board_app_initialize(void) { #if defined(CONFIG_STM32_SPI4) FAR struct spi_dev_s *spi; FAR struct mtd_dev_s *mtd; FAR struct mtd_geometry_s geo; #endif #if defined(CONFIG_MTD_PARTITION_NAMES) FAR const char *partname = CONFIG_STM32F429I_DISCO_FLASH_PART_NAMES; #endif #if defined(CONFIG_MTD) && defined(CONFIG_MTD_SST25XX) int ret; #elif defined(HAVE_USBHOST) || defined(HAVE_USBMONITOR) int ret; #endif /* Configure SPI-based devices */ #ifdef CONFIG_STM32_SPI4 /* Get the SPI port */ syslog(LOG_INFO, "Initializing SPI port 4\n"); spi = stm32_spibus_initialize(4); if (!spi) { syslog(LOG_ERR, "ERROR: Failed to initialize SPI port 4\n"); return -ENODEV; } syslog(LOG_INFO, "Successfully initialized SPI port 4\n"); /* Now bind the SPI interface to the SST25F064 SPI FLASH driver. This * is a FLASH device that has been added external to the board (i.e. * the board does not ship from STM with any on-board FLASH. */ #if defined(CONFIG_MTD) && defined(CONFIG_MTD_SST25XX) syslog(LOG_INFO, "Bind SPI to the SPI flash driver\n"); mtd = sst25xx_initialize(spi); if (!mtd) { syslog(LOG_ERR, "ERROR: Failed to bind SPI port 4 to the SPI FLASH driver\n"); } else { syslog(LOG_INFO, "Successfully bound SPI port 4 to the SPI FLASH driver\n"); /* Get the geometry of the FLASH device */ ret = mtd->ioctl(mtd, MTDIOC_GEOMETRY, (unsigned long)((uintptr_t)&geo)); if (ret < 0) { fdbg("ERROR: mtd->ioctl failed: %d\n", ret); return ret; } #ifdef CONFIG_STM32F429I_DISCO_FLASH_PART { int partno; int partsize; int partoffset; int partszbytes; int erasesize; const char *partstring = CONFIG_STM32F429I_DISCO_FLASH_PART_LIST; const char *ptr; FAR struct mtd_dev_s *mtd_part; char partref[4]; /* Now create a partition on the FLASH device */ partno = 0; ptr = partstring; partoffset = 0; /* Get the Flash erase size */ erasesize = geo.erasesize; while (*ptr != '\0') { /* Get the partition size */ partsize = atoi(ptr); partszbytes = (partsize << 10); /* partsize is defined in KB */ /* Check if partition size is bigger then erase block */ if (partszbytes < erasesize) { fdbg("ERROR: Partition size is lesser than erasesize!\n"); return -1; } /* Check if partition size is multiple of erase block */ if ((partszbytes % erasesize) != 0) { fdbg("ERROR: Partition size is not multiple of erasesize!\n"); return -1; } mtd_part = mtd_partition(mtd, partoffset, partszbytes / erasesize); partoffset += partszbytes / erasesize; #ifdef CONFIG_STM32F429I_DISCO_FLASH_CONFIG_PART /* Test if this is the config partition */ if (CONFIG_STM32F429I_DISCO_FLASH_CONFIG_PART_NUMBER == partno) { /* Register the partition as the config device */ mtdconfig_register(mtd_part); } else #endif { /* Now initialize a SMART Flash block device and bind it * to the MTD device. */ #if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS) sprintf(partref, "p%d", partno); smart_initialize(CONFIG_STM32F429I_DISCO_FLASH_MINOR, mtd_part, partref); #endif } #if defined(CONFIG_MTD_PARTITION_NAMES) /* Set the partition name */ if (mtd_part == NULL) { dbg("Error: failed to create partition %s\n", partname); return -1; } mtd_setpartitionname(mtd_part, partname); /* Now skip to next name. We don't need to split the string here * because the MTD partition logic will only display names up to * the comma, thus allowing us to use a single static name * in the code. */ while (*partname != ',' && *partname != '\0') { /* Skip to next ',' */ partname++; } if (*partname == ',') { partname++; } #endif /* Update the pointer to point to the next size in the list */ while ((*ptr >= '0') && (*ptr <= '9')) { ptr++; } if (*ptr == ',') { ptr++; } /* Increment the part number */ partno++; } } #else /* CONFIG_STM32F429I_DISCO_FLASH_PART */ /* Configure the device with no partition support */ smart_initialize(CONFIG_STM32F429I_DISCO_FLASH_MINOR, mtd, NULL); #endif /* CONFIG_STM32F429I_DISCO_FLASH_PART */ } #endif /* CONFIG_MTD */ #endif /* CONFIG_STM32_SPI4 */ /* Create a RAM MTD device if configured */ #if defined(CONFIG_RAMMTD) && defined(CONFIG_STM32F429I_DISCO_RAMMTD) { uint8_t *start = (uint8_t *) kmm_malloc(CONFIG_STM32F429I_DISCO_RAMMTD_SIZE * 1024); mtd = rammtd_initialize(start, CONFIG_STM32F429I_DISCO_RAMMTD_SIZE * 1024); mtd->ioctl(mtd, MTDIOC_BULKERASE, 0); /* Now initialize a SMART Flash block device and bind it to the MTD device */ #if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS) smart_initialize(CONFIG_STM32F429I_DISCO_RAMMTD_MINOR, mtd, NULL); #endif } #endif /* CONFIG_RAMMTD && CONFIG_STM32F429I_DISCO_RAMMTD */ #ifdef HAVE_USBHOST /* Initialize USB host operation. stm32_usbhost_initialize() starts a thread * will monitor for USB connection and disconnection events. */ ret = stm32_usbhost_initialize(); if (ret != OK) { syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); return ret; } #endif #ifdef HAVE_USBMONITOR /* Start the USB Monitor */ ret = usbmonitor_start(0, NULL); if (ret != OK) { syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); } #endif return OK; }
int board_initialize(void) { int ret; char partref[4]; char devname[16]; #ifdef CONFIG_MTD FAR struct mtd_dev_s *mtd; FAR struct mtd_geometry_s geo; FAR struct mtd_dev_s *mtd_part; #endif int partno = QEMU_SMARTFS_PARTITION_PARTNO; int minorno = QEMU_SMARTFS_PARTITION_MINORNO; int partoffset = QEMU_SMARTFS_PARTITION_START; int partsize = QEMU_SMARTFS_PARTITION_SIZE; #ifdef CONFIG_MTD mtd = up_flashinitialize(); if (!mtd) { lldbg("ERROR : up_flashinitializ failed\n"); return ERROR; } if (mtd->ioctl(mtd, MTDIOC_GEOMETRY, (unsigned long)&geo) < 0) { lldbg("ERROR: mtd->ioctl failed\n"); return ERROR; } #ifdef CONFIG_MTD_PARTITION mtd_part = mtd_partition(mtd, partoffset, partsize / geo.blocksize, partno); if (!mtd_part) { lldbg("ERROR: failed to create partition.\n"); return ERROR; } #endif /* CONFIG_MTD_PARTITION */ ret = snprintf(partref, sizeof(partref), "p%d", partno); if (ret < 0) { lldbg("ERROR: snprintf failed while constructing partref, ret = %d\n", ret); return ERROR; } if (ret >= sizeof(partref)) { lldbg("WARNING: snprintf output might have truncated, ret = %d\n", ret); } ret = snprintf(devname, sizeof(devname), "/dev/smart%d%s", minorno, partref); if (ret < 0) { lldbg("ERROR: snprintf failed while constructing devname, ret = %d\n", ret); return ERROR; } if (ret >= sizeof(devname)) { lldbg("WARNING: snprintf output might have truncated, ret = %d\n", ret); } #if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS) smart_initialize(minorno, mtd_part, partref); #endif /* defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS) */ #endif /* CONFIG_MTD */ ret = mksmartfs(devname, false); if (ret != OK) { lldbg("ERROR: mksmartfs on %s failed, ret = %d\n", devname, ret); } else { ret = mount(devname, QEMU_SMARTFS_MOUNT_POINT, "smartfs", 0, NULL); if (ret != OK) { lldbg("ERROR: mounting '%s' failed, ret = %d\n", devname, ret); } else { lldbg("%s is mounted successfully at %s \n", devname, QEMU_SMARTFS_MOUNT_POINT); } } return OK; }