fs: Move inotify.c from fs/notify/ to fs/vfs/

and merge fs/notify/notify.h into fs/vfs/vfs.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2025-06-22 15:19:47 +08:00
committed by Alan C. Assis
parent 1ea0ae8073
commit c9dc89142c
44 changed files with 79 additions and 200 deletions

View File

@@ -135,7 +135,6 @@ source "fs/mqueue/Kconfig"
source "fs/shm/Kconfig"
source "fs/mmap/Kconfig"
source "fs/partition/Kconfig"
source "fs/notify/Kconfig"
source "fs/fat/Kconfig"
source "fs/nfs/Kconfig"
source "fs/nxffs/Kconfig"

View File

@@ -1,21 +0,0 @@
# ##############################################################################
# fs/Make.defs
#
# SPDX-License-Identifier: Apache-2.0
#
# 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.
#
# ##############################################################################

View File

@@ -66,7 +66,6 @@ include rpmsgfs/Make.defs
include zipfs/Make.defs
include mnemofs/Make.defs
include v9fs/Make.defs
include notify/Make.defs
endif
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)fs

View File

@@ -32,7 +32,7 @@
#include <nuttx/fs/fs.h>
#include "inode/inode.h"
#include "notify/notify.h"
#include "vfs/vfs.h"
#ifndef CONFIG_DISABLE_MOUNTPOINT

View File

@@ -33,7 +33,7 @@
#include <nuttx/sched_note.h>
#include "inode/inode.h"
#include "notify/notify.h"
#include "vfs/vfs.h"
/****************************************************************************
* Public Functions

View File

@@ -33,7 +33,7 @@
#include <nuttx/mtd/mtd.h>
#include "inode/inode.h"
#include "notify/notify.h"
#include "vfs/vfs.h"
#if defined(CONFIG_MTD) && !defined(CONFIG_DISABLE_MOUNTPOINT)

View File

@@ -32,7 +32,7 @@
#include <nuttx/fs/fs.h>
#include "inode/inode.h"
#include "notify/notify.h"
#include "vfs/vfs.h"
#ifdef CONFIG_PIPES

View File

@@ -29,7 +29,7 @@
#include <nuttx/fs/fs.h>
#include "inode/inode.h"
#include "notify/notify.h"
#include "vfs/vfs.h"
/****************************************************************************
* Public Functions

View File

@@ -29,7 +29,7 @@
#include <nuttx/fs/fs.h>
#include "inode/inode.h"
#include "notify/notify.h"
#include "vfs/vfs.h"
/****************************************************************************
* Public Functions

View File

@@ -30,7 +30,7 @@
#include <nuttx/mtd/mtd.h>
#include "inode/inode.h"
#include "notify/notify.h"
#include "vfs/vfs.h"
/****************************************************************************
* Public Functions

View File

@@ -29,7 +29,7 @@
#include <nuttx/fs/fs.h>
#include "inode/inode.h"
#include "notify/notify.h"
#include "vfs/vfs.h"
#ifdef CONFIG_PIPES

View File

@@ -34,7 +34,7 @@
#include <nuttx/fs/fs.h>
#include "inode/inode.h"
#include "notify/notify.h"
#include "vfs/vfs.h"
/****************************************************************************
* Public Functions

View File

@@ -36,7 +36,7 @@
#include <nuttx/fs/fs.h>
#include "inode/inode.h"
#include "notify/notify.h"
#include "vfs/vfs.h"
#include "event/event.h"
/****************************************************************************

View File

@@ -28,7 +28,6 @@
#include <nuttx/reboot_notifier.h>
#include <nuttx/trace.h>
#include "notify/notify.h"
#include "rpmsgfs/rpmsgfs.h"
#include "inode/inode.h"
#include "aio/aio.h"

View File

@@ -37,7 +37,7 @@
#include "driver/driver.h"
#include "inode/inode.h"
#include "notify/notify.h"
#include "vfs/vfs.h"
/****************************************************************************
* Pre-processor Definitions

View File

@@ -34,7 +34,7 @@
#include <nuttx/fs/fs.h>
#include "inode/inode.h"
#include "notify/notify.h"
#include "vfs/vfs.h"
/****************************************************************************
* Public Functions

View File

@@ -41,7 +41,7 @@
#include "inode/inode.h"
#include "mqueue/mqueue.h"
#include "notify/notify.h"
#include "vfs/vfs.h"
/****************************************************************************
* Private Functions Prototypes

View File

@@ -36,7 +36,7 @@
#include "inode/inode.h"
#include "mqueue/mqueue.h"
#include "notify/notify.h"
#include "vfs/vfs.h"
/****************************************************************************
* Private Functions

View File

@@ -1,25 +0,0 @@
# ##############################################################################
# fs/notify/CMakeLists.txt
#
# SPDX-License-Identifier: Apache-2.0
#
# 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.
#
# ##############################################################################
if(CONFIG_FS_NOTIFY)
target_sources(fs PRIVATE inotify.c)
endif()

View File

@@ -1,25 +0,0 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
config FS_NOTIFY
bool "FS Notify System"
default n
---help---
The Fsnotify System
if FS_NOTIFY
config FS_NOTIFY_BUCKET_SIZE
int "Dir hash bucket size"
default 64
config FS_NOTIFY_MAX_EVENTS
int "Max events in one notify device"
default 1024
config FS_NOTIFY_FD_POLLWAITERS
int "Max pollwaiters in one notify device"
default 2
endif # FS_NOTIFY

View File

@@ -1,31 +0,0 @@
############################################################################
# fs/notify/Make.defs
#
# SPDX-License-Identifier: Apache-2.0
#
# 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.
#
############################################################################
# Include FSNOTIFY build support
ifeq ($(CONFIG_FS_NOTIFY),y)
CSRCS += inotify.c
endif
DEPPATH += --dep-path notify
VPATH += :notify

View File

@@ -1,60 +0,0 @@
/****************************************************************************
* fs/notify/notify.h
*
* SPDX-License-Identifier: Apache-2.0
*
* 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_NOTIFY_NOTIFY_H
#define __FS_NOTIFY_NOTIFY_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/fs/fs.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Type Definitions
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/* These are internal OS interface and are not available to applications */
void notify_open(FAR const char *path, int oflags);
void notify_close(FAR const char *path, int oflags);
void notify_close2(FAR struct inode *inode);
void notify_read(FAR struct file *filep);
void notify_write(FAR struct file *filep);
void notify_chstat(FAR struct file *filep);
void notify_unlink(FAR const char *path);
void notify_unmount(FAR const char *path);
void notify_mkdir(FAR const char *path);
void notify_create(FAR const char *path);
void notify_rename(FAR const char *oldpath, bool oldisdir,
FAR const char *newpath, bool newisdir);
void notify_initialize(void);
#endif

View File

@@ -35,7 +35,7 @@
#include <nuttx/fs/fs.h>
#include "inode/inode.h"
#include "notify/notify.h"
#include "vfs/vfs.h"
#ifdef CONFIG_FS_NAMED_SEMAPHORES

View File

@@ -42,7 +42,7 @@
#include <nuttx/fs/fs.h>
#include "inode/inode.h"
#include "notify/notify.h"
#include "vfs/vfs.h"
#include "semaphore/semaphore.h"
#ifdef CONFIG_FS_NAMED_SEMAPHORES

View File

@@ -36,7 +36,7 @@
#include <nuttx/semaphore.h>
#include "inode/inode.h"
#include "notify/notify.h"
#include "vfs/vfs.h"
#include "semaphore/semaphore.h"
/****************************************************************************

View File

@@ -31,7 +31,7 @@
#include <errno.h>
#include "inode/inode.h"
#include "notify/notify.h"
#include "vfs/vfs.h"
#include "shm/shmfs.h"
/****************************************************************************

View File

@@ -29,7 +29,7 @@
#include <errno.h>
#include "inode/inode.h"
#include "notify/notify.h"
#include "vfs/vfs.h"
/****************************************************************************
* Private Functions

View File

@@ -53,14 +53,18 @@ set(SRCS
fs_syncfs.c
fs_truncate.c)
# File notify support
if(CONFIG_FS_NOTIFY)
list(APPEND SRCS fs_inotify.c)
endif()
# File lock support
if(NOT "${CONFIG_FS_LOCK_BUCKET_SIZE}" STREQUAL "0")
list(APPEND SRCS fs_lock.c)
endif()
# Certain interfaces are not available if there is no mountpoint support
if(NOT "${CONFIG_PSEUDOFS_SOFTLINKS}" STREQUAL "0")
list(APPEND SRCS fs_link.c fs_symlink.c fs_readlink.c)
endif()

View File

@@ -65,6 +65,27 @@ config SIGNAL_FD_NPOLLWAITERS
endif # SIGNAL_FD
config FS_NOTIFY
bool "FS Notify System"
default n
---help---
The Fsnotify System
if FS_NOTIFY
config FS_NOTIFY_BUCKET_SIZE
int "Dir hash bucket size"
default 64
config FS_NOTIFY_MAX_EVENTS
int "Max events in one notify device"
default 1024
config FS_NOTIFY_FD_POLLWAITERS
int "Max pollwaiters in one notify device"
default 2
endif # FS_NOTIFY
config FS_BACKTRACE
int "VFS backtrace"
default 0

View File

@@ -29,7 +29,9 @@ CSRCS += fs_rename.c fs_rmdir.c fs_select.c fs_sendfile.c fs_stat.c
CSRCS += fs_statfs.c fs_uio.c fs_unlink.c fs_write.c fs_dir.c fs_fsync.c
CSRCS += fs_syncfs.c fs_truncate.c
# Certain interfaces are not available if there is no mountpoint support
ifeq ($(CONFIG_FS_NOTIFY),y)
CSRCS += fs_inotify.c
endif
ifneq ($(CONFIG_FS_LOCK_BUCKET_SIZE),0)
CSRCS += fs_lock.c

View File

@@ -39,7 +39,6 @@
# include <android/fdsan.h>
#endif
#include "notify/notify.h"
#include "inode/inode.h"
#include "sched/sched.h"
#include "vfs.h"

View File

@@ -33,8 +33,8 @@
#include <nuttx/fs/fs.h>
#include "notify/notify.h"
#include "inode/inode.h"
#include "vfs.h"
/****************************************************************************
* Private Functions

View File

@@ -1,5 +1,5 @@
/****************************************************************************
* fs/notify/inotify.c
* fs/vfs/fs_inotify.c
*
* SPDX-License-Identifier: Apache-2.0
*

View File

@@ -34,8 +34,8 @@
#include <nuttx/fs/fs.h>
#include "notify/notify.h"
#include "inode/inode.h"
#include "vfs.h"
/****************************************************************************
* Pre-processor Definitions

View File

@@ -42,7 +42,7 @@
#include "sched/sched.h"
#include "inode/inode.h"
#include "driver/driver.h"
#include "notify/notify.h"
#include "vfs.h"
/****************************************************************************
* Private Functions

View File

@@ -40,8 +40,8 @@
#include <nuttx/lib/math32.h>
#include "inode/inode.h"
#include "notify/notify.h"
#include "fs_heap.h"
#include "vfs.h"
/****************************************************************************
* Private Types

View File

@@ -35,8 +35,8 @@
#include <nuttx/cancelpt.h>
#include "notify/notify.h"
#include "inode/inode.h"
#include "vfs.h"
/****************************************************************************
* Private Functions

View File

@@ -37,9 +37,9 @@
#include <nuttx/fs/fs.h>
#include <nuttx/lib/lib.h>
#include "notify/notify.h"
#include "inode/inode.h"
#include "fs_heap.h"
#include "vfs.h"
/****************************************************************************
* Pre-processor Definitions

View File

@@ -33,8 +33,8 @@
#include <nuttx/fs/fs.h>
#include "notify/notify.h"
#include "inode/inode.h"
#include "vfs.h"
/****************************************************************************
* Pre-processor Definitions

View File

@@ -37,9 +37,9 @@
#include <nuttx/lib/lib.h>
#include <nuttx/fs/fs.h>
#include "notify/notify.h"
#include "inode/inode.h"
#include "fs_heap.h"
#include "vfs.h"
/****************************************************************************
* Pre-processor Definitions

View File

@@ -34,8 +34,8 @@
#include <nuttx/fs/fs.h>
#include "notify/notify.h"
#include "inode/inode.h"
#include "vfs.h"
/****************************************************************************
* Public Functions

View File

@@ -33,8 +33,8 @@
#include <nuttx/fs/fs.h>
#include "notify/notify.h"
#include "inode/inode.h"
#include "vfs.h"
/****************************************************************************
* Pre-processor Definitions

View File

@@ -35,8 +35,8 @@
#include <nuttx/cancelpt.h>
#include "notify/notify.h"
#include "inode/inode.h"
#include "vfs.h"
/****************************************************************************
* Private Functions

View File

@@ -27,6 +27,7 @@
* Included Files
****************************************************************************/
#include <nuttx/fs/fs.h>
#include <fcntl.h>
/****************************************************************************
@@ -105,4 +106,21 @@ int file_setlk(FAR struct file *filep, FAR struct flock *flock,
bool nonblock);
#endif /* CONFIG_FS_LOCK_BUCKET_SIZE */
#ifdef CONFIG_FS_NOTIFY
void notify_open(FAR const char *path, int oflags);
void notify_close(FAR const char *path, int oflags);
void notify_close2(FAR struct inode *inode);
void notify_read(FAR struct file *filep);
void notify_write(FAR struct file *filep);
void notify_chstat(FAR struct file *filep);
void notify_unlink(FAR const char *path);
void notify_unmount(FAR const char *path);
void notify_mkdir(FAR const char *path);
void notify_create(FAR const char *path);
void notify_rename(FAR const char *oldpath, bool oldisdir,
FAR const char *newpath, bool newisdir);
void notify_initialize(void);
#endif /* CONFIG_FS_NOTIFY */
#endif /* __FS_VFS_VFS_H */