fs/ioctl: add BLKSSZGET cmd to get block sector size
refer to: https://sites.uclouvain.be/SystInfo/usr/include/sys/mount.h.html Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
b385c48a30
commit
978530f5f6
@ -110,6 +110,20 @@ int file_vioctl(FAR struct file *filep, int req, va_list ap)
|
||||
ret = inode_getpath(inode, (FAR char *)(uintptr_t)arg);
|
||||
}
|
||||
break;
|
||||
|
||||
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
||||
case BIOC_BLKSSZGET:
|
||||
if (inode->u.i_ops != NULL && inode->u.i_ops->ioctl != NULL)
|
||||
{
|
||||
struct geometry geo;
|
||||
ret = inode->u.i_ops->ioctl(filep, BIOC_GEOMETRY,
|
||||
(unsigned long)(uintptr_t)&geo);
|
||||
if (ret >= 0)
|
||||
{
|
||||
*(FAR blksize_t *)(uintptr_t)arg = geo.geo_sectorsize;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -287,6 +287,12 @@
|
||||
* OUT: Partition information structure
|
||||
* populated with data from the block
|
||||
* device partition */
|
||||
#define BIOC_BLKSSZGET _BIOC(0x000f) /* Get block device sector size.
|
||||
* IN: Pointer to writable instance
|
||||
* of sector size in which
|
||||
* to return sector size.
|
||||
* OUT: Data return in user-provided
|
||||
* buffer. */
|
||||
|
||||
/* NuttX MTD driver ioctl definitions ***************************************/
|
||||
|
||||
|
@ -26,11 +26,14 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/compiler.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define BLKSSZGET BIOC_BLKSSZGET
|
||||
|
||||
/* Mount flags */
|
||||
|
||||
#define MS_RDONLY 1 /* Mount file system read-only */
|
||||
|
Loading…
Reference in New Issue
Block a user