xiaoxiang781216 commented on code in PR #8000: URL: https://github.com/apache/nuttx/pull/8000#discussion_r1059959537
########## include/nuttx/mm/mm_map.h: ########## @@ -0,0 +1,83 @@ +/**************************************************************************** + * include/nuttx/mm/mm_map.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 __INCLUDE_NUTTX_MM_MM_MAP_H +#define __INCLUDE_NUTTX_MM_MM_MAP_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> +#include <nuttx/fs/fs.h> +#include <nuttx/queue.h> + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* Type of the mapping */ + +enum mm_map_type +{ + MM_MAP_ANONYMOUS, + MM_MAP_NAMED, + MM_MAP_INODE, + MM_MAP_SHM +}; + +/* Id of the mapping */ + +union mm_map_id_u +{ + FAR const char *name; /* For MM_MAP_NAMED */ + FAR struct inode *inode; /* For MM_MAP_INODE */ + int shmid; /* FOR MM_MAP_SHM */ + uintptr_t val; +}; + +/* A memory mapping list item */ + +struct mm_map_entry_s +{ + FAR struct mm_map_entry *flink; /* this is used as sq_entry_t */ + enum mm_map_type type; + union mm_map_id_u id; + FAR const void *vaddr; + size_t length; + off_t offset; + int prot; + int flags; + void *priv; +}; + +/* A structure for the task group */ + +struct mm_map_s +{ + sq_queue_t mm_map_sq; + sem_t mm_map_sem; Review Comment: How about we embed these two fields into task_group_s directly? So we can reserve mm_map_s/file_map_s for mmap/munmap argument. -- 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: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org