2014-09-29 15:14:38 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* fs/driver/driver.h
|
|
|
|
*
|
2021-02-03 14:47:23 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2014-09-29 15:14:38 +02:00
|
|
|
*
|
2021-02-03 14:47:23 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2014-09-29 15:14:38 +02:00
|
|
|
*
|
2021-02-03 14:47:23 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2014-09-29 15:14:38 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __FS_DRIVER_DRIVER_H
|
|
|
|
#define __FS_DRIVER_DRIVER_H
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <nuttx/compiler.h>
|
|
|
|
#include <nuttx/fs/fs.h>
|
|
|
|
|
2015-06-11 19:24:20 +02:00
|
|
|
#include "inode/inode.h"
|
|
|
|
|
2014-09-29 15:14:38 +02:00
|
|
|
/****************************************************************************
|
2015-10-03 00:30:35 +02:00
|
|
|
* Public Data
|
2014-09-29 15:14:38 +02:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#undef EXTERN
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
#define EXTERN extern "C"
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: find_blockdriver
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Return the inode of the block driver specified by 'pathname'
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Input Parameters:
|
2018-09-22 22:20:18 +02:00
|
|
|
* pathname - The full path to the block driver to be located
|
|
|
|
* mountflags - If MS_RDONLY is not set, then driver must support write
|
|
|
|
* operations (see include/sys/mount.h)
|
|
|
|
* ppinode - Address of the location to return the inode reference
|
2014-09-29 15:14:38 +02:00
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2014-09-29 15:14:38 +02:00
|
|
|
* Returns zero on success or a negated errno on failure:
|
|
|
|
*
|
|
|
|
* ENOENT - No block driver of this name is registered
|
|
|
|
* ENOTBLK - The inode associated with the pathname is not a block driver
|
|
|
|
* EACCESS - The MS_RDONLY option was not set but this driver does not
|
2018-09-22 22:20:18 +02:00
|
|
|
* support write access
|
2014-09-29 15:14:38 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2015-11-21 18:24:55 +01:00
|
|
|
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
2014-09-29 15:14:38 +02:00
|
|
|
int find_blockdriver(FAR const char *pathname, int mountflags,
|
|
|
|
FAR struct inode **ppinode);
|
2015-11-21 18:24:55 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: block_proxy
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Create a temporary char driver using drivers/bch to mediate character
|
|
|
|
* oriented accessed to the block driver.
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Input Parameters:
|
2021-01-22 14:25:03 +01:00
|
|
|
* filep - The caller provided location in which to return the 'struct
|
|
|
|
* file' instance.
|
2015-11-21 18:24:55 +01:00
|
|
|
* blkdev - The path to the block driver
|
|
|
|
* oflags - Character driver open flags
|
|
|
|
*
|
|
|
|
* Returned Value:
|
2021-01-22 14:25:03 +01:00
|
|
|
* Zero (OK) is returned on success. On failure, a negated errno value is
|
|
|
|
* returned.
|
2015-11-21 18:24:55 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-10-22 16:25:01 +02:00
|
|
|
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
2020-10-01 13:21:36 +02:00
|
|
|
int block_proxy(FAR struct file *filep, FAR const char *blkdev, int oflags);
|
2015-11-21 18:24:55 +01:00
|
|
|
#endif
|
2014-09-29 15:14:38 +02:00
|
|
|
|
2018-11-08 16:59:18 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: mtd_proxy
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Create a temporary block driver using drivers/mtd/ftl to mediate block
|
|
|
|
* oriented accessed to the mtd driver.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* mtddev - The path to the mtd driver
|
|
|
|
* mountflags - if MS_RDONLY is not set, then driver must support write
|
|
|
|
* operations (see include/sys/mount.h)
|
|
|
|
* ppinode - address of the location to return the inode reference
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* If zero, non-zero inode pointer is returned on success. This
|
|
|
|
* is the inode pointer of the nameless block driver that mediates
|
2021-01-22 14:36:58 +01:00
|
|
|
* accesses to the mtd driver. A negated errno value is returned on
|
|
|
|
* any failure.
|
2018-11-08 16:59:18 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_MTD
|
|
|
|
int mtd_proxy(FAR const char *mtddev, int mountflags,
|
|
|
|
FAR struct inode **ppinode);
|
|
|
|
#endif
|
|
|
|
|
2014-09-29 15:14:38 +02:00
|
|
|
#undef EXTERN
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __FS_DRIVER_DRIVER_H */
|