2015-11-25 15:26:26 +01:00
|
|
|
/****************************************************************************
|
2021-03-08 22:39:04 +01:00
|
|
|
* fs/hostfs/hostfs.h
|
2015-11-25 15:26:26 +01:00
|
|
|
*
|
2021-04-10 08:50:57 +02: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
|
2015-11-25 15:26:26 +01:00
|
|
|
*
|
2021-04-10 08:50:57 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2015-11-25 15:26:26 +01:00
|
|
|
*
|
2021-04-10 08:50:57 +02: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.
|
2015-11-25 15:26:26 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#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>
|
2020-02-01 08:17:32 +01:00
|
|
|
|
|
|
|
#include <nuttx/semaphore.h>
|
2015-11-25 15:26:26 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2015-11-25 16:11:03 +01:00
|
|
|
#define HOSTFS_MAX_PATH 256
|
2015-11-25 15:26:26 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* 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;
|
|
|
|
};
|
|
|
|
|
2020-03-30 12:22:26 +02:00
|
|
|
/* 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.
|
2015-11-25 15:26:26 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
struct hostfs_mountpt_s
|
|
|
|
{
|
|
|
|
sem_t *fs_sem; /* Used to assure thread-safe access */
|
|
|
|
FAR struct hostfs_ofile_s *fs_head; /* A singly-linked list of open files */
|
|
|
|
char fs_root[HOSTFS_MAX_PATH];
|
|
|
|
};
|
|
|
|
|
|
|
|
/****************************************************************************
|
2015-11-25 16:11:03 +01:00
|
|
|
* Internal function prototypes
|
2015-11-25 15:26:26 +01:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* Semaphore access for internal use */
|
|
|
|
|
2020-03-30 12:22:26 +02:00
|
|
|
int hostfs_semtake(struct hostfs_mountpt_s *fs);
|
2015-11-25 15:26:26 +01:00
|
|
|
void hostfs_semgive(struct hostfs_mountpt_s *fs);
|
|
|
|
|
|
|
|
/* 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 */
|