nuttx/fs/hostfs/hostfs.h
chenrun1 6e9a43c504 hostfs:add get_path
To perform kvdb related type testing in the simulator, ioctl support is required to obtain relpath

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-18 10:17:48 +08:00

83 lines
2.8 KiB
C

/****************************************************************************
* fs/hostfs/hostfs.h
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*
****************************************************************************/
#ifndef __FS_HOSTFS_HOSTFS_H
#define __FS_HOSTFS_HOSTFS_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define HOSTFS_MAX_PATH 256
/****************************************************************************
* Public Types
****************************************************************************/
/* This structure describes the state of one open file. This structure
* is protected by the volume semaphore.
*/
struct hostfs_ofile_s
{
struct hostfs_ofile_s *fnext; /* Supports a singly linked list */
int16_t crefs; /* Reference count */
mode_t oflags; /* Open mode */
int fd;
char relpath[1];
};
/* This structure represents the overall mountpoint state. An instance of
* this structure is retained as inode private data on each mountpoint that
* is mounted with a hostfs filesystem.
*/
struct hostfs_mountpt_s
{
FAR struct hostfs_ofile_s *fs_head; /* A singly-linked list of open files */
char fs_root[HOSTFS_MAX_PATH];
};
/****************************************************************************
* Internal function prototypes
****************************************************************************/
/* Forward references for utility functions */
struct hostfs_mountpt_s;
struct file; /* Forward references */
struct inode;
struct fs_dirent_s;
struct statfs;
struct stat;
#endif /* __FS_HOSTFS_HOSTFS_H */