xiaoxiang781216 commented on code in PR #21907: URL: https://github.com/apache/nuttx/pull/21907#discussion_r4659567542
########## fs/vfs/fs_cwd.c: ########## @@ -0,0 +1,718 @@ +/**************************************************************************** + * fs/vfs/fs_cwd.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <sys/stat.h> +#include <errno.h> +#include <fcntl.h> +#include <limits.h> +#include <stdbool.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> + +#include <nuttx/fs/fs.h> +#include <nuttx/lib/lib.h> +#include <nuttx/list.h> +#include <nuttx/mutex.h> +#include <nuttx/sched.h> + +#include "inode/inode.h" +#include "fs_heap.h" + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/* The current directory of one or more task groups. The groups that a + * group creates share its object until one of them calls chdir(). All + * fields are protected by g_cwd_lock. + */ + +struct fs_cwd_s +{ + struct list_node node; /* In g_cwd_list */ + unsigned int crefs; /* Number of task groups that use it */ + bool removed; /* The directory was removed */ + FAR char *path; /* Absolute host path, no symbolic links */ +}; + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static mutex_t g_cwd_lock = NXMUTEX_INITIALIZER; +static struct list_node g_cwd_list = LIST_INITIAL_VALUE(g_cwd_list); Review Comment: does this behavior describe in POISX spec? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
