Move inode and VFS utils from fs/. to fs/inode/.

This commit is contained in:
Gregory Nutt 2014-09-28 10:53:40 -06:00
parent ebd4aa9193
commit 39ff9d626e
12 changed files with 23 additions and 31 deletions

View File

@ -67,17 +67,14 @@ CSRCS += fs_open.c fs_opendir.c fs_poll.c fs_read.c fs_readdir.c
CSRCS += fs_rename.c fs_rewinddir.c fs_rmdir.c fs_seekdir.c fs_stat.c
CSRCS += fs_statfs.c fs_select.c fs_unlink.c fs_write.c
CSRCS += fs_files.c fs_foreachinode.c fs_inode.c fs_inodeaddref.c
CSRCS += fs_inodebasename.c fs_inodefind.c fs_inoderelease.c
CSRCS += fs_inoderemove.c fs_inodereserve.c
CSRCS += fs_registerdriver.c fs_unregisterdriver.c
CSRCS += fs_registerblockdriver.c fs_unregisterblockdriver.c
CSRCS += fs_findblockdriver.c fs_openblockdriver.c fs_closeblockdriver.c
DEPPATH =
DEPPATH = --dep-path .
VPATH = .
include inode/Make.defs
include mmap/Make.defs
# Stream support
@ -142,7 +139,7 @@ $(BIN): $(OBJS)
$(call ARCHIVE, $@, $(OBJS))
.depend: Makefile $(SRCS)
$(Q) $(MKDEP) --dep-path . $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) $(MKDEP) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) touch $@
depend: .depend

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/fs/fs.h
*
* Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2011-2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -203,25 +203,28 @@ struct mountpt_operations
/* Named OS resources are also maintained by the VFS. This includes:
*
* - Named semaphores: sem_open(), sem_close(), and sem_unlink()
* - POSIX Message Queues: mq_open() and mq_close()
* - POSIX Message Queues: mq_open(), mq_close(), and mq_unlink()
* - Shared memory: shm_open() and shm_unlink();
*
* These are a special case in that they do not follow quite the same
* pattern as the other file system types in that they have no read or
* write methods.
* These are a special case in that they do not follow the same pattern
* as the other inode system types:
*
* Each inode type carries a payload specific to the OS resource;
* Only the contents of struct special_operations is visible to the VFS.
* - All of these resources have their own open() and unlink() interfaces.
* All require special, additional operations at open() and unlink()
* time
* - None of the standard VFS operations can be used with semaphores
* or named messages queues. These OS resources have their own
* own open() and close methods that do not use file descriptors.
* - Only ftruncate() and close() make sense with the file descriptor
* returned by shm_open()
*
* Inode types are not defined here, but rather in:
*
* - include/nuttx/semaphore.h
* - include/nuttx/mqueue.h, and
* - include/nuttx/shm.h
*/
struct inode;
struct special_operations
{
int (*open)(FAR struct inode *inode);
int (*close)(FAR struct inode *inode);
int (*unlink)(FAR struct inode *inode, FAR const char *relpath);
};
/* These are the various kinds of operations that can be associated with
* an inode.
*/
@ -233,7 +236,6 @@ union inode_ops_u
FAR const struct block_operations *i_bops; /* Block driver operations */
FAR const struct mountpt_operations *i_mops; /* Operations on a mountpoint */
#endif
FAR const struct special_operations *i_xops; /* Generic operations on OS resources */
FAR const struct semaphore_operations *i_sops; /* Operations for named semaphores */
};

View File

@ -56,19 +56,12 @@
/* This is the named semaphore inode */
struct inode; /* Forward reference */
struct semaphore_operations
{
/* Common inode operations */
int (*open)(FAR struct inode *inode);
int (*close)(FAR struct inode *inode);
int (*unlink)(FAR struct inode *inode, FAR const char *relpath);
/* Payload unique to named semaphores */
uint16_t ns_refs; /* Number of open references semaphore */
sem_t ns_sem; /* The semaphore itself */
uint16_t ns_refs; /* Number of open references to the semaphore */
sem_t ns_sem; /* The semaphore itself */
};
/****************************************************************************