Compare commits

...

24 Commits

Author SHA1 Message Date
patacongo
1479e0d35d Prepare for release 0.2.7
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@279 42af7a65-404d-4744-a932-0658087f49c3
2007-06-09 21:01:26 +00:00
patacongo
7ac971d7ee Don't call usleep if signals are disabled
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@278 42af7a65-404d-4744-a932-0658087f49c3
2007-06-09 20:39:21 +00:00
patacongo
bece513004 SDCC specific changes. Z80 support; re-enable __FILE__ and __LINE__ in assert -- might have broken the 8051/2
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@277 42af7a65-404d-4744-a932-0658087f49c3
2007-06-09 20:31:09 +00:00
patacongo
40513d77ab No longer uses _GNU_SOURCE-specific asprintf()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@276 42af7a65-404d-4744-a932-0658087f49c3
2007-06-09 19:45:33 +00:00
patacongo
9ab11697a8 Simply conditional build; fix conditional compilation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@275 42af7a65-404d-4744-a932-0658087f49c3
2007-06-09 19:11:00 +00:00
patacongo
aca030153f Add support for custom system timer frequency
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@274 42af7a65-404d-4744-a932-0658087f49c3
2007-06-09 15:49:44 +00:00
patacongo
da19e798e6 updates
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@273 42af7a65-404d-4744-a932-0658087f49c3
2007-06-07 00:53:33 +00:00
patacongo
79457a04ab Don't call fflush if streams are disabled
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@272 42af7a65-404d-4744-a932-0658087f49c3
2007-06-07 00:29:46 +00:00
patacongo
cfdfa7b3c9 Error in memcpy arguments for SDCC platforms
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@271 42af7a65-404d-4744-a932-0658087f49c3
2007-06-07 00:24:57 +00:00
patacongo
a48fe435f8 Function incorrectly named
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@270 42af7a65-404d-4744-a932-0658087f49c3
2007-06-07 00:20:35 +00:00
patacongo
c574123ca4 Fixed nsec calculation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@269 42af7a65-404d-4744-a932-0658087f49c3
2007-06-07 00:14:35 +00:00
patacongo
637618e8bb Removed redundant interrupt disable
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@268 42af7a65-404d-4744-a932-0658087f49c3
2007-06-07 00:08:40 +00:00
patacongo
a54e55c432 Don't build sleep() or usleep() if signals are disabled
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@267 42af7a65-404d-4744-a932-0658087f49c3
2007-06-07 00:03:36 +00:00
patacongo
5abe9f896c bash if should end with 'fi' not 'if'
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@266 42af7a65-404d-4744-a932-0658087f49c3
2007-06-06 23:56:56 +00:00
patacongo
826ae7f951 file extension should be .gz not .bz2
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@265 42af7a65-404d-4744-a932-0658087f49c3
2007-06-06 23:51:21 +00:00
patacongo
c3ed839a4e updated
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@264 42af7a65-404d-4744-a932-0658087f49c3
2007-06-06 10:25:20 +00:00
patacongo
4a18d1f253 Add a test of statfs
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@263 42af7a65-404d-4744-a932-0658087f49c3
2007-05-30 00:00:04 +00:00
patacongo
f1170204c5 allocation unit is cluster, not sector
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@262 42af7a65-404d-4744-a932-0658087f49c3
2007-05-29 01:00:48 +00:00
patacongo
cf935803a0 Added statfs()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@261 42af7a65-404d-4744-a932-0658087f49c3
2007-05-29 00:31:17 +00:00
patacongo
9dd25d7965 Remove duplicate definition of struct statfs
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@260 42af7a65-404d-4744-a932-0658087f49c3
2007-05-27 23:09:23 +00:00
patacongo
5bdefbb8a0 Added fat_getattrib.c and fat_setattrib.c
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@259 42af7a65-404d-4744-a932-0658087f49c3
2007-05-27 20:40:01 +00:00
patacongo
3f5d4be4a9 Fix reference count problem
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@258 42af7a65-404d-4744-a932-0658087f49c3
2007-05-27 19:10:40 +00:00
patacongo
a0153a1ed2 Add stat()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@257 42af7a65-404d-4744-a932-0658087f49c3
2007-05-27 18:08:18 +00:00
patacongo
0c8bb6aac5 Missing closing quote
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@256 42af7a65-404d-4744-a932-0658087f49c3
2007-05-26 23:56:25 +00:00
92 changed files with 1852 additions and 409 deletions

View File

@@ -150,5 +150,31 @@
0.2.7 2007-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
* Added stat() to fs layer and to FAT
* Fixed reference counting errors associated with mounted filesystems
* Added fat_getattrib() and fat_setattrib()
* Added statfs() to fs layer and to FAT
* Correct file name extension in tools/zipme.sh
* Fix error in dependencies in 8051/2 Makefile
* sched/Makefile: Don't build sleep() or usleep() if signals are disabled
* sched/sched_setparam.c: Remove redundant disabling of interrupts
* sched/usleep.c: Fixed nsec calculation
* lib/lib_strcspn.c: Function incorrectly named strspn().
* examples/ostest/main.c: Errors in SDCC version of a memcpy() call
* examples/ostest/sighand.c: Don't call fflush() if streams are disabled
* include/limits.h, include/time.h, sched/clock_internal.h: A support for
using selectable system timer frequency.
* Fixed error in mountpoint related conditional compilation introduced
in 0.2.5
* Restructured some Makefiles to better handle enabling and disabling
NuttX features without having so much conditional compilation in the
source files.
* tools/mkconfig.c: No long depends on asprintf() and _GNU_SOURCE and
so should now build in non-GNU, non-GLIBC environments.
* include/nuttx/compiler.h: Fix for using SDCC with the Z80.
* include/assert.h & arch/pjrc-8051/src/up_assert.c: SDCC does support
__FILE__and __LINE__ (not tested)
* examples/ostest/barrier.c: Don't call usleep() when signals are
disabled.
* Started m68322

View File

@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
<p>Last Updated: May 26, 2007</p>
<p>Last Updated: June 9, 2007</p>
</td>
</tr>
</table>
@@ -183,7 +183,7 @@
</table>
<p>
The 9th release of NuttX (nuttx-0.2.6) is available for download
The 10th release of NuttX (nuttx-0.2.7) is available for download
from the <a href="http://sourceforge.net/project/showfiles.php?group_id=189573">SourceForge</a>
website.
The change log associated with the release is available <a href="#currentrelease">here</a>.
@@ -296,6 +296,8 @@
This port is complete but not stable with timer interrupts enabled.
There seems to be some issue when the stack pointer enters into the indirect IRAM
address space during interrupt handling.
This architecture has not been built in some time will likely have some compilation
problems because of SDCC compiler differences.
</p>
</td>
</tr>
@@ -403,7 +405,7 @@ Other memory:
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="olderreleases>Change Logs for Older Releases</a>
<a name="olderreleases">Change Logs for Older Releases</a>
</td>
</tr>
</table>
@@ -548,17 +550,7 @@ Other memory:
* close() was not closing the underlying device.
* Added fsync()
* Added strspn() and strcspn()
</pre></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="currentrelease">ChangeLog for Current Release</a>
</td>
</tr>
</table>
<pre><ul>
0.2.6 2007-05-26 Gregory Nutt <spudmonkey@racsa.co.cr>
* Added unlink(), mkdir(), rmdir(), and rename()
@@ -570,6 +562,45 @@ Other memory:
for only testing on the simulation).
</pre></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="currentrelease">ChangeLog for Current Release</a>
</td>
</tr>
</table>
<pre><ul>
0.2.7 2007-06-09 Gregory Nutt <spudmonkey@racsa.co.cr>
* Added stat() to fs layer and to FAT
* Fixed reference counting errors associated with mounted filesystems
* Added fat_getattrib() and fat_setattrib()
* Added statfs() to fs layer and to FAT
* Correct file name extension in tools/zipme.sh
* Fix error in dependencies in 8051/2 Makefile
* sched/Makefile: Don't build sleep() or usleep() if signals are disabled
* sched/sched_setparam.c: Remove redundant disabling of interrupts
* sched/usleep.c: Fixed nsec calculation
* lib/lib_strcspn.c: Function incorrectly named strspn().
* examples/ostest/main.c: Errors in SDCC version of a memcpy() call
* examples/ostest/sighand.c: Don't call fflush() if streams are disabled
* include/limits.h, include/time.h, sched/clock_internal.h: A support for
using selectable system timer frequency.
* Fixed error in mountpoint related conditional compilation introduced
in 0.2.5
* Restructured some Makefiles to better handle enabling and disabling
NuttX features without having so much conditional compilation in the
source files.
* tools/mkconfig.c: No long depends on asprintf() and _GNU_SOURCE and
so should now build in non-GNU, non-GLIBC environments.
* include/nuttx/compiler.h: Fix for using SDCC with the Z80.
* include/assert.h & arch/pjrc-8051/src/up_assert.c: SDCC does support
__FILE__and __LINE__ (not tested)
* examples/ostest/barrier.c: Don't call usleep() when signals are
disabled.
</pre></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
@@ -580,7 +611,7 @@ Other memory:
<pre><ul>
0.2.7 2007-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
0.2.8 2007-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
* Started m68322
</pre></ul>

View File

@@ -1163,6 +1163,12 @@ The system can be re-made subsequently by just typing <code>make</code>.
number of memory regions that the memory manager must
handle and enables the API mm_addregion(start, end);
</li>
<li>
<code>CONFIG_TICKS_PER_MSEC</code>: The default system timer is 100Hz
or <code>TICKS_PER_MSEC</code>=10. This setting may be defined to inform NuttX
that the processor hardware is providing system timer interrupts at some interrupt
interval other than 10 msec.
</li>
<li>
<code>CONFIG_RR_INTERVAL</code>: The round robin timeslice will be set
this number of milliseconds; Round robin scheduling can

View File

@@ -21,7 +21,7 @@ User's Manual
<p>
Gregory Nutt
<p>
<small>Last Update: March 28, 2007</small>
<small>Last Update: May 27, 2007</small>
</center>
<h1>1.0 <A NAME="Introduction">Introduction</a></h1>
@@ -5725,7 +5725,7 @@ notify a task when a message is available on a queue.
int close(int fd);
int dup(int fildes);
int dup2(int fildes1, int fildes2);
off_t lseek(int fd, off_t offset, int whence); /* Prototyped but not implemented */
off_t lseek(int fd, off_t offset, int whence);
int read(int fd, void *buf, unsigned int nbytes);
int unlink(const char *path);
int write(int fd, const void *buf, unsigned int nbytes);
@@ -5768,7 +5768,7 @@ notify a task when a message is available on a queue.
int printf(const char *format, ...);
int puts(const char *s);
int rename(const char *source, const char *target); /* Prototyped but not implemented */
int rename(const char *source, const char *target);
int sprintf(char *dest, const char *format, ...);
int ungetc(int c, FILE *stream);
int vprintf(const char *s, va_list ap);
@@ -5779,9 +5779,9 @@ notify a task when a message is available on a queue.
FILE *fdopen(int fd, const char *type);
int fstat(int fd, FAR struct stat *buf); /* Prototyped but not implemented */
char *getcwd(FAR char *buf, size_t size); /* Prototyped but not implemented */
int mkdir(const char *path, mode_t mode); /* Prototyped but not implemented */
int rmdir(const char *path); /* Prototyped but not implemented */
int stat(const char *path, FAR struct stat *buf); /* Prototyped but not implemented */
int mkdir(const char *path, mode_t mode);
int rmdir(const char *path);
int stat(const char *path, FAR struct stat *buf);
int statfs(const char *path, FAR struct statfs *buf); /* Prototyped but not implemented */
</pre></ul>

View File

@@ -37,17 +37,45 @@ TOPDIR = ${shell pwd}
-include ${TOPDIR}/.config
-include ${TOPDIR}/Make.defs
# Process architecture and board-specific directories
ARCH_DIR = arch/$(CONFIG_ARCH)
ARCH_SRC = $(ARCH_DIR)/src
ARCH_INC = $(ARCH_DIR)/include
BOARD_DIR = configs/$(CONFIG_ARCH_BOARD)
SUBDIRS = sched lib $(ARCH_SRC) mm fs drivers examples/$(CONFIG_EXAMPLE)
# FSDIRS depend on file descriptor support; NONFSDIRS do not
# (except for parts of FSDIRS). We will exclude FSDIRS
# from the build if file descriptor support is disabled
NONFSDIRS = sched lib $(ARCH_SRC) mm examples/$(CONFIG_EXAMPLE)
FSDIRS = fs drivers
# CLEANDIRS are the directories that will clean in. These are
# all directories that we know about.
# MAKEDIRS are the directories in which we will build targets
CLEANDIRS = $(NONFSDIRS) $(FSDIRS)
ifeq ($(CONFIG_NFILE_DESCRIPTORS),0)
MAKEDIRS = $(NONFSDIRS)
else
MAKEDIRS = $(NONFSDIRS) $(FSDIRS)
endif
# LINKLIBS is the list of NuttX libraries that is passed to the
# processor-specific Makefile to build the final target.
# Libraries in FSDIRS are excluded if file descriptor support
# is disabled.
LINKLIBS = sched/libsched$(LIBEXT) $(ARCH_SRC)/libarch$(LIBEXT) mm/libmm$(LIBEXT) \
fs/libfs$(LIBEXT) drivers/libdrivers$(LIBEXT) lib/liblib$(LIBEXT) \
examples/$(CONFIG_EXAMPLE)/lib$(CONFIG_EXAMPLE)$(LIBEXT)
lib/liblib$(LIBEXT) examples/$(CONFIG_EXAMPLE)/lib$(CONFIG_EXAMPLE)$(LIBEXT)
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
LINKLIBS += fs/libfs$(LIBEXT) drivers/libdrivers$(LIBEXT)
endif
# This is the name of the final target
BIN = nuttx$(EXEEXT)
all: $(BIN)
@@ -169,12 +197,12 @@ $(BIN): context depend $(LINKLIBS)
$(MAKE) -C $(ARCH_SRC) TOPDIR=$(TOPDIR) LINKLIBS="$(LINKLIBS)" $(BIN)
depend:
@for dir in $(SUBDIRS) ; do \
@for dir in $(MAKEDIRS) ; do \
$(MAKE) -C $$dir TOPDIR=$(TOPDIR) depend ; \
done
subdir_clean:
@for dir in $(SUBDIRS) ; do \
@for dir in $(CLEANDIRS) ; do \
if [ -e $$dir/Makefile ]; then \
$(MAKE) -C $$dir TOPDIR=$(TOPDIR) clean ; \
fi \
@@ -186,7 +214,7 @@ clean: subdir_clean
rm -f $(BIN) $(BIN).* mm_test *.map *~
subdir_distclean:
@for dir in $(SUBDIRS) ; do \
@for dir in $(CLEANDIRS) ; do \
if [ -e $$dir/Makefile ]; then \
$(MAKE) -C $$dir TOPDIR=$(TOPDIR) distclean ; \
fi \

View File

@@ -1,15 +1,14 @@
nuttx-0.2.6
nuttx-0.2.7
^^^^^^^^^^^
This is the 9th release of NuttX. This is primarily a bugfix release
to correct a number of problems introduced with the 0.2.5 release. This release
does include some FAT filesystem extensions including unlink(), mkdir(),
rmdir(), rename(), opendir(), closedir(), readdir(), seekdir(), telldir(),
rewindir(). There are some pending FAT changes that did not make it into
this release including stat(), truncate(), and long file names.
This is the 10th release of NuttX. This is primarily a bugfix release
to correct a number of problems reported to me (thanks Didier!). This release
does include the final changes complete the FAT filesystem logic including
stat(), tatfs(), and non-standard APIs to manage FAT attributes. At present,
FAT long file names and file trunction() are still not supported.
See the ChangeLog for a complete list of changes.
This release has been verified only on the Linux user-mode platform.
This tarball contains a complete CVS snapshot from May 26, 2007.
This tarball contains a complete CVS snapshot from June 9, 2007.

15
TODO
View File

@@ -7,10 +7,6 @@ o Task/Scheduler
- Implement sys/mman.h and functions
- Implement sys/wait.h and functions
- Implement priority inheritance
- Make the system timer frequency configurable via defconfig. See:
_POSIX_CLOCKRES_MIN in limits.h
CLK_TCK in time.h
MSEC_PER_TICK in sched/clock_internal.h
- Consider implementing wait, waitpid, waitid. At present, a parent has
no information about child tasks.
- Several APIs do not set errno. Need to review all APIs.
@@ -29,16 +25,20 @@ o Signals
o pthreads
- pthread_cancel(): Should implemenent cancellation points and pthread_testcancel()
o C++ Support
- Need to call static constructors
o Network
- Port FreeBSD TCP/IP stack
o USB
- Implement USB device support
o Libraries
- sscanf() and lib_vsprintf() do not support floating point values.
o File system
- Add disk usage stats, stat(), chmod(), truncate().
- Add statfs(), chmod(), truncate().
- FAT32: long file names
o Console Output
@@ -51,7 +51,7 @@ o Build system
- Some names under arch are still incorrect. These should be processor architecture
names: pjrc-8051 should be 805x
- configs/pjrc-8051 should be configs/pjrc-87c52
- Last change to create the arch/arm directory breaks dependencies in arch/arm/src.
- 0.2.4 changes to create the arch/arm directory breaks dependency target in arch/arm/src.
Probably need to add the path to the chip or common subdirectorys when
running tools/mkdeps.sh
@@ -62,7 +62,8 @@ o C5471
o DM320
o LPC214x
- Finish
- Finish bringup
- Add MMC and USB support
o pjrc-8052 / MCS51
- Current status:

View File

@@ -201,7 +201,7 @@ irqtest:
.depend: Makefile up_mem.h $(DEPSRCS)
@if [ -e board/Makefile ]; then \
$(MAKE) -C board TOPDIR=$(TOPDIR) depend ; \
if
fi
$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
touch $@

View File

@@ -95,7 +95,7 @@ static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */
* Name: up_assert
************************************************************/
void up_assert(void)
void up_assert(const ubyte *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0
_TCB *rtcb = (_TCB*)g_readytorun.head;
@@ -104,9 +104,11 @@ void up_assert(void)
up_ledon(LED_ASSERTION);
#if CONFIG_TASK_NAME_SIZE > 0
lldbg("%s: Assertion failed\n", rtcb->name);
lldbg("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
#else
lldbg("Assertion failed\n");
lldbg("Assertion failed at file:%s line: %d\n",
filename, lineno);
#endif
up_dumpstack();
@@ -117,7 +119,7 @@ void up_assert(void)
* Name: up_assert_code
************************************************************/
void up_assert_code(int errorcode)
void up_assert_code(const ubyte *filename, int lineno, int errorcode)
{
#if CONFIG_TASK_NAME_SIZE > 0
_TCB *rtcb = (_TCB*)g_readytorun.head;
@@ -126,9 +128,11 @@ void up_assert_code(int errorcode)
up_ledon(LED_ASSERTION);
#if CONFIG_TASK_NAME_SIZE > 0
lldbg("%s: Assertion failed, error=%d\n", rtcb->name, errorcode);
lldbg("Assertion failed at file:%s line: %d task: %s error code: %d\n",
filename, lineno, rtcb->name, errorcode);
#else
lldbg("Assertion failed , error=%d\n", errorcode);
lldbg("Assertion failed at file:%s line: %d error code: %d\n",
filename, lineno, errorcode);
#endif
up_dumpstack();

View File

@@ -73,7 +73,6 @@
void _exit(int status)
{
_TCB* tcb = (_TCB*)g_readytorun.head;
irqstate_t flags;
dbg("TCB=%p exitting\n", tcb);

View File

@@ -132,6 +132,11 @@ defconfig -- This is a configuration file similar to the Linux
regions of memory to allocate from, this specifies the
number of memory regions that the memory manager must
handle and enables the API mm_addregion(start, end);
CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz
or TICKS_PER_MSEC=10. This setting may be defined to
inform NuttX that the processor hardware is providing
system timer interrupts at some interrupt interval other
than 10 msec.
CONFIG_RR_INTERVAL - The round robin timeslice will be set
this number of milliseconds; Round robin scheduling can
be disabled by setting this value to zero.

View File

@@ -109,6 +109,11 @@ CONFIG_UART_MODEM_2STOP=0
# handle and enables the API mm_addregion(start, end);
# CONFIG_HAVE_LOWPUTC - architecture supports low-level, boot
# time console output
# CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz
# or TICKS_PER_MSEC=10. This setting may be defined to
# inform NuttX that the processor hardware is providing
# system timer interrupts at some interrupt interval other
# than 10 msec.
# CONFIG_RR_INTERVAL - The round robin timeslice will be set
# this number of milliseconds; Round robin scheduling can
# be disabled by setting this value to zero.

View File

@@ -98,6 +98,11 @@ CONFIG_UART1_2STOP=0
# handle and enables the API mm_addregion(start, end);
# CONFIG_HAVE_LOWPUTC - architecture supports low-level, boot
# time console output
# CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz
# or TICKS_PER_MSEC=10. This setting may be defined to
# inform NuttX that the processor hardware is providing
# system timer interrupts at some interrupt interval other
# than 10 msec.
# CONFIG_RR_INTERVAL - The round robin timeslice will be set
# this number of milliseconds; Round robin scheduling can
# be disabled by setting this value to zero.

View File

@@ -122,6 +122,11 @@ CONFIG_UART1_2STOP=0
# handle and enables the API mm_addregion(start, end);
# CONFIG_HAVE_LOWPUTC - architecture supports low-level, boot
# time console output
# CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz
# or TICKS_PER_MSEC=10. This setting may be defined to
# inform NuttX that the processor hardware is providing
# system timer interrupts at some interrupt interval other
# than 10 msec.
# CONFIG_RR_INTERVAL - The round robin timeslice will be set
# this number of milliseconds; Round robin scheduling can
# be disabled by setting this value to zero.

View File

@@ -107,6 +107,11 @@ CONFIG_UART1_2STOP=0
# handle and enables the API mm_addregion(start, end);
# CONFIG_HAVE_LOWPUTC - architecture supports low-level, boot
# time console output
# CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz
# or TICKS_PER_MSEC=10. This setting may be defined to
# inform NuttX that the processor hardware is providing
# system timer interrupts at some interrupt interval other
# than 10 msec.
# CONFIG_RR_INTERVAL - The round robin timeslice will be set
# this number of milliseconds; Round robin scheduling can
# be disabled by setting this value to zero.

View File

@@ -95,6 +95,11 @@ CONFIG_LED_DEBUG=n
# handle and enables the API mm_addregion(start, end);
# CONFIG_HAVE_LOWPUTC - architecture supports low-level, boot
# time console output
# CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz
# or TICKS_PER_MSEC=10. This setting may be defined to
# inform NuttX that the processor hardware is providing
# system timer interrupts at some interrupt interval other
# than 10 msec.
# CONFIG_RR_INTERVAL - The round robin timeslice will be set
# this number of milliseconds; Round robin scheduling can
# be disabled by setting this value to zero.

View File

@@ -63,6 +63,11 @@ CONFIG_ARCH_BOARD_SIM=y
# handle and enables the API mm_addregion(start, end);
# CONFIG_HAVE_LOWPUTC - architecture supports low-level, boot
# time console output
# CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz
# or TICKS_PER_MSEC=10. This setting may be defined to
# inform NuttX that the processor hardware is providing
# system timer interrupts at some interrupt interval other
# than 10 msec.
# CONFIG_RR_INTERVAL - The round robin timeslice will be set
# this number of milliseconds; Round robin scheduling can
# be disabled by setting this value to zero.

View File

@@ -40,6 +40,7 @@
#include <sys/mount.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/statfs.h>
#include <stdio.h>
#include <stdlib.h>
@@ -53,6 +54,10 @@
* Definitions
****************************************************************************/
#define TEST_USE_STAT 1
#define TEST_SHOW_DIRECTORIES 1
#define TEST_USE_STATFS 1
/****************************************************************************
* Private Types
****************************************************************************/
@@ -62,6 +67,7 @@
****************************************************************************/
static const char g_source[] = "/dev/blkdev";
static const char g_mntdir[] = "/mnt";
static const char g_target[] = "/mnt/fs";
static const char g_filesystemtype[] = "vfat";
@@ -83,11 +89,84 @@ static char g_namebuffer[256];
* Private Functions
****************************************************************************/
#ifdef TEST_USE_STAT
static void show_stat(const char *path, struct stat *ps)
{
printf("%s stat:\n", path);
printf("\tmode : %08x\n", ps->st_mode);
if (S_ISREG(ps->st_mode))
{
printf("\ttype : File\n");
}
else if (S_ISDIR(ps->st_mode))
{
printf("\ttype : Directory\n");
}
else if (S_ISCHR(ps->st_mode))
{
printf("\ttype : Character driver\n");
}
else if (S_ISBLK(ps->st_mode))
{
printf("\ttype : Block driver\n");
}
else
{
printf("\ttype : Unknown\n");
}
printf("\tsize : %d (bytes)\n", ps->st_size);
printf("\tblock size : %d (bytes)\n", ps->st_blksize);
printf("\tsize : %d (blocks)\n", ps->st_blocks);
printf("\taccess time : %d\n", ps->st_atime);
printf("\tmodify time : %d\n", ps->st_mtime);
printf("\tchange time : %d\n", ps->st_ctime);
}
#endif
/****************************************************************************
* Name: fail_read_open
* Name: show_statfs
****************************************************************************/
static void show_directories( const char *path, int indent )
#ifdef TEST_USE_STATFS
static void show_statfs(const char *path)
{
struct statfs buf;
int ret;
/* Try stat() against a file or directory. It should fail with expectederror */
printf("show_statfs: Try statfs(%s)\n", path);
ret = statfs(path, &buf);
if (ret == 0)
{
printf("show_statfs: statfs(%s) succeeded\n", path);
printf("\tFS Type : %0x\n", buf.f_type);
printf("\tBlock size : %d\n", buf.f_bsize);
printf("\tNumber of blocks : %d\n", buf.f_blocks);
printf("\tFree blocks : %d\n", buf.f_bfree);
printf("\tFree user blocks : %d\n", buf.f_bavail);
printf("\tNumber file nodes : %d\n", buf.f_files);
printf("\tFree file nodes : %d\n", buf.f_ffree);
printf("\tFile name length : %d\n", buf.f_namelen);
}
else
{
printf("show_statfs: ERROR statfs(%s) failed with errno=%d\n",
path, *get_errno_ptr());
g_nerrors++;
}
}
#else
# define show_statfs(p)
#endif
/****************************************************************************
* Name: show_directories
****************************************************************************/
#ifdef TEST_SHOW_DIRECTORIES
static void show_directories(const char *path, int indent)
{
DIR *dirp;
struct dirent *direntry;
@@ -124,6 +203,9 @@ static void show_directories( const char *path, int indent )
closedir(dirp);
}
#else
# define show_directories(p,i)
#endif
/****************************************************************************
* Name: fail_read_open
@@ -409,6 +491,67 @@ static void succeed_rename(const char *oldpath, const char *newpath)
}
}
/****************************************************************************
* Name: fail_stat
****************************************************************************/
#ifdef TEST_USE_STAT
static void fail_stat(const char *path, int expectederror)
{
struct stat buf;
int ret;
/* Try stat() against a file or directory. It should fail with expectederror */
printf("fail_stat: Try stat(%s)\n", path);
ret = stat(path, &buf);
if (ret == 0)
{
printf("fail_stat: ERROR stat(%s) succeeded\n", path);
show_stat(path, &buf);
g_nerrors++;
}
else if (*get_errno_ptr() != expectederror)
{
printf("fail_stat: ERROR stat(%s) failed with errno=%d (expected %d)\n",
path, *get_errno_ptr(), expectederror);
g_nerrors++;
}
}
#else
# define fail_stat(p,e);
#endif
/****************************************************************************
* Name: succeed_stat
****************************************************************************/
#ifdef TEST_USE_STAT
static void succeed_stat(const char *path)
{
struct stat buf;
int ret;
printf("succeed_stat: Try stat(%s)\n", path);
ret = stat(path, &buf);
if (ret != 0)
{
printf("succeed_stat: ERROR stat(%s) failed with errno=%d\n",
path, *get_errno_ptr());
g_nerrors++;
}
else
{
printf("succeed_stat: stat(%s) succeeded\n", path);
show_stat(path, &buf);
}
}
#else
#define succeed_stat(p)
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -439,15 +582,23 @@ int user_start(int argc, char *argv[])
if (ret == 0)
{
show_statfs(g_mntdir);
show_statfs(g_target);
/* Read a test file that is already on the test file system image */
show_directories("", 0);
succeed_stat(g_testfile1);
show_statfs(g_testfile1);
read_test_file(g_testfile1);
/* Write a test file into a pre-existing directory on the test file system */
fail_stat(g_testfile2, ENOENT);
write_test_file(g_testfile2);
show_directories("", 0);
succeed_stat(g_testfile2);
show_statfs(g_testfile2);
/* Read the file that we just wrote */
@@ -468,6 +619,7 @@ int user_start(int argc, char *argv[])
/* Try unlink() against the test file1. It should succeed. */
succeed_unlink(g_testfile1);
fail_stat(g_testfile1, ENOENT);
show_directories("", 0);
/* Attempt to open testfile1 should fail with ENOENT */
@@ -486,20 +638,24 @@ int user_start(int argc, char *argv[])
succeed_unlink(g_testfile2);
show_directories("", 0);
fail_stat(g_testfile2, ENOENT);
/* Try mkdir() against the test dir1. It should fail with EEXIST. */
fail_mkdir(g_testdir1, EEXIST);
/* Try rmdir() against the test directory. It should now succeed. */
/* Try rmdir() against the test directory. mkdir should now succeed. */
succeed_rmdir(g_testdir1);
show_directories("", 0);
fail_stat(g_testdir1, ENOENT);
/* Try mkdir() against the test dir2. It should succeed */
succeed_mkdir(g_testdir2);
show_directories("", 0);
succeed_stat(g_testdir2);
show_statfs(g_testdir2);
/* Try mkdir() against the test dir2. It should fail with EXIST */
@@ -507,8 +663,11 @@ int user_start(int argc, char *argv[])
/* Write a test file into a new directory on the test file system */
fail_stat(g_testfile3, ENOENT);
write_test_file(g_testfile3);
show_directories("", 0);
succeed_stat(g_testfile3);
show_statfs(g_testfile3);
/* Read the file that we just wrote */
@@ -516,8 +675,11 @@ int user_start(int argc, char *argv[])
/* Use mkdir() to create test dir3. It should succeed */
fail_stat(g_testdir3, ENOENT);
succeed_mkdir(g_testdir3);
show_directories("", 0);
succeed_stat(g_testdir3);
show_statfs(g_testdir3);
/* Try rename() on the root directory. Should fail with EXDEV*/
@@ -529,13 +691,21 @@ int user_start(int argc, char *argv[])
/* Try rename() to a non-existing directory. Should succeed */
fail_stat(g_testdir4, ENOENT);
succeed_rename(g_testdir3, g_testdir4);
show_directories("", 0);
fail_stat(g_testdir3, ENOENT);
succeed_stat(g_testdir4);
show_statfs(g_testdir4);
/* Try rename() of file. Should work. */
fail_stat(g_testfile4, ENOENT);
succeed_rename(g_testfile3, g_testfile4);
show_directories("", 0);
fail_stat(g_testfile3, ENOENT);
succeed_stat(g_testfile4);
show_statfs(g_testfile4);
/* Make sure that we can still read the renamed file */
@@ -554,7 +724,7 @@ int user_start(int argc, char *argv[])
printf("user_start: %d errors reported\n", g_nerrors);
}
fflush(stdout);
return 0;
}

View File

@@ -49,7 +49,9 @@ static void *barrier_func(void *parameter)
int status;
printf("barrier_func: Thread %d started\n", id);
#ifndef CONFIG_DISABLE_SIGNALS
usleep(500*1000);
#endif
/* Take the semaphore */
@@ -68,7 +70,9 @@ static void *barrier_func(void *parameter)
printf("barrier_func: ERROR thread %d could not get semaphore value\n", id);
}
#ifndef CONFIG_DISABLE_SIGNALS
usleep(500*1000);
#endif
printf("barrier_func: Thread %d done\n", id);
return NULL;
}

View File

@@ -167,7 +167,7 @@ static int user_main(int argc, char *argv[])
g_mmprevious = g_mmbefore;
#else
(void)mallinfo(&g_mmbefore);
memcpy(g_mmprevious, g_mmbefore, sizeof(struct mallinfo));
memcpy(&g_mmprevious, &g_mmbefore, sizeof(struct mallinfo));
#endif
#endif

View File

@@ -151,7 +151,11 @@ static int waiter_main(int argc, char *argv[])
/* Take the semaphore */
printf("waiter_main: Waiting on semaphore\n" );
#if CONFIG_NFILE_STREAMS > 0
fflush(stdout);
#endif
status = sem_wait(&sem);
if (status != 0)
{
@@ -176,7 +180,11 @@ static int waiter_main(int argc, char *argv[])
status = sigaction(WAKEUP_SIGNAL, &act, &oact);
printf("waiter_main: done\n" );
#if CONFIG_NFILE_STREAMS > 0
fflush(stdout);
#endif
threadexited = TRUE;
return 0;
}
@@ -222,7 +230,9 @@ void sighand_test(void)
/* Wait a bit */
#if CONFIG_NFILE_STREAMS > 0
fflush(stdout);
#endif
sleep(2);
/* Then signal the waiter thread. */
@@ -244,7 +254,9 @@ void sighand_test(void)
/* Wait a bit */
#if CONFIG_NFILE_STREAMS > 0
fflush(stdout);
#endif
sleep(2);
/* Then check the result */
@@ -260,5 +272,7 @@ void sighand_test(void)
}
printf("sighand_test: done\n" );
#if CONFIG_NFILE_STREAMS > 0
fflush(stdout);
#endif
}

View File

@@ -41,19 +41,22 @@ ASRCS =
AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS = fs_open.c fs_close.c fs_read.c fs_write.c fs_ioctl.c fs_dup.c \
fs_opendir.c fs_closedir.c fs_readdir.c fs_readdirr.c \
fs_seekdir.c fs_telldir.c fs_rewinddir.c fs_fsync.c fs_files.c \
fs_inode.c fs_inodefind.c fs_inodereserve.c \
fs_opendir.c fs_closedir.c fs_stat.c fs_readdir.c fs_readdirr.c \
fs_seekdir.c fs_telldir.c fs_rewinddir.c fs_files.c \
fs_inode.c fs_inodefind.c fs_inodereserve.c fs_statfs.c \
fs_inoderemove.c fs_registerdriver.c fs_unregisterdriver.c \
fs_inodeaddref.c fs_inoderelease.c
ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y)
CSRCS += fs_registerblockdriver.c fs_unregisterblockdriver.c \
fs_mount.c fs_umount.c fs_unlink.c fs_mkdir.c fs_rmdir.c \
fs_rename.c
fs_mount.c fs_umount.c \
fs_fsync.c fs_unlink.c fs_rename.c \
fs_mkdir.c fs_rmdir.c
ifeq ($(CONFIG_FS_FAT),y)
CSRCS += fs_fat32.c fs_fat32util.c
CSRCS += fs_fat32.c fs_fat32util.c fs_fat32attrib.c
endif
endif
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)

View File

@@ -49,8 +49,6 @@
* Global Functions
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
int close(int fd)
{
FAR struct filelist *list;
@@ -112,4 +110,3 @@ int close(int fd)
return ERROR;
}
#endif /* CONFIG_NFILE_DESCRIPTORS */

View File

@@ -71,29 +71,30 @@
*
************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
int closedir(FAR DIR *dirp)
{
struct internal_dir_s *idir = (struct internal_dir_s *)dirp;
#ifndef CONFIG_DISABLE_MOUNTPOUNT
struct inode *inode;
#endif
int ret;
if (!idir || !idir->fd_root)
{
*get_errno_ptr() = EBADF;
return ERROR;
ret = EBADF;
goto errout;
}
/* This is the 'root' inode of the directory. This means different
* things wih different filesystems.
*/
inode = idir->fd_root;
/* The way that we handle the close operation depends on what kind of root
* inode we have open.
*/
#ifndef CONFIG_DISABLE_MOUNTPOUNT
inode = idir->fd_root;
if (INODE_IS_MOUNTPT(inode))
#ifndef CONFIG_DISABLE_MOUNTPOINT
if (INODE_IS_MOUNTPT(inode) && !DIRENT_ISPSUEDONODE(idir->fd_flags))
{
/* The node is a file system mointpoint. Verify that the mountpoint
* supports the closedir() method (not an error if it does not)
@@ -106,8 +107,8 @@ int closedir(FAR DIR *dirp)
ret = inode->u.i_mops->closedir(inode, idir);
if (ret < 0)
{
*get_errno_ptr() = -ret;
return ERROR;
ret = -ret;
goto errout_with_inode;
}
}
}
@@ -126,15 +127,19 @@ int closedir(FAR DIR *dirp)
/* Release our references on the contained 'root' inode */
if (idir->fd_root)
{
inode_release(idir->fd_root);
}
inode_release(idir->fd_root);
/* Then release the container */
free(idir);
return OK;
errout_with_inode:
inode_release(inode);
free(idir);
errout:
*get_errno_ptr() = ret;
return ERROR;
}
#endif /* CONFIG_NFILE_DESCRIPTORS */

View File

@@ -65,8 +65,6 @@
* Global Functions
************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
int dup(int fildes)
{
FAR struct filelist *list;
@@ -146,4 +144,3 @@ int dup2(int fildes1, int fildes2)
return files_dup(&list->fl_files[fildes1], &list->fl_files[fildes2]);
}
#endif /* CONFIG_NFILE_DESCRIPTORS */

View File

@@ -45,6 +45,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/statfs.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
@@ -55,13 +56,11 @@
#include <debug.h>
#include <nuttx/fs.h>
#include <nuttx/fat.h>
#include "fs_internal.h"
#include "fs_fat32.h"
#ifdef CONFIG_FS_FAT
#ifndef CONFIG_DISABLE_MOUNTPOUNT
/****************************************************************************
* Definitions
****************************************************************************/
@@ -91,13 +90,16 @@ static int fat_rewinddir(struct inode *mountpt, struct internal_dir_s *dir);
static int fat_bind(FAR struct inode *blkdriver, const void *data,
void **handle);
static int fat_unbind(void *handle);
static int fat_unbind(void *handle, FAR struct inode **blkdriver);
static int fat_statfs(struct inode *mountpt, struct statfs *buf);
static int fat_unlink(struct inode *mountpt, const char *relpath);
static int fat_mkdir(struct inode *mountpt, const char *relpath,
mode_t mode);
static int fat_rmdir(struct inode *mountpt, const char *relpath);
static int fat_rename(struct inode *mountpt, const char *oldrelpath,
const char *newrelpath);
static int fat_stat(struct inode *mountpt, const char *relpath, struct stat *buf);
/****************************************************************************
* Private Variables
@@ -129,10 +131,13 @@ const struct mountpt_operations fat_operations =
fat_bind,
fat_unbind,
fat_statfs,
fat_unlink,
fat_mkdir,
fat_rmdir,
fat_rename
fat_rename,
fat_stat
};
/****************************************************************************
@@ -1189,7 +1194,7 @@ static int fat_sync(FAR struct file *filp)
DIR_PUTFSTCLUSTLO(direntry, ff->ff_startcluster);
DIR_PUTFSTCLUSTHI(direntry, ff->ff_startcluster >> 16);
wrttime = fat_gettime();
wrttime = fat_systime2fattime();
DIR_PUTWRTTIME(direntry, wrttime & 0xffff);
DIR_PUTWRTDATE(direntry, wrttime >> 16);
@@ -1482,10 +1487,13 @@ static int fat_bind(FAR struct inode *blkdriver, const void *data,
return -ENOMEM;
}
/* Initialize the allocated mountpt state structure */
/* Initialize the allocated mountpt state structure. The filesystem is
* responsible for one reference ont the blkdriver inode and does not
* have to addref() here (but does have to release in ubind().
*/
fs->fs_blkdriver = blkdriver;
sem_init(&fs->fs_sem, 0, 0);
fs->fs_blkdriver = blkdriver; /* Save the block driver reference */
sem_init(&fs->fs_sem, 0, 0); /* Initialize the semaphore that controls access */
/* Then get information about the FAT32 filesystem on the devices managed
* by this block driver.
@@ -1512,7 +1520,7 @@ static int fat_bind(FAR struct inode *blkdriver, const void *data,
*
****************************************************************************/
static int fat_unbind(void *handle)
static int fat_unbind(void *handle, FAR struct inode **blkdriver)
{
struct fat_mountpt_s *fs = (struct fat_mountpt_s*)handle;
int ret;
@@ -1539,9 +1547,23 @@ static int fat_unbind(void *handle)
if (fs->fs_blkdriver)
{
struct inode *inode = fs->fs_blkdriver;
if (inode && inode->u.i_bops && inode->u.i_bops->close)
if (inode)
{
(void)inode->u.i_bops->close(inode);
if (inode->u.i_bops && inode->u.i_bops->close)
{
(void)inode->u.i_bops->close(inode);
}
/* We hold a reference to the block driver but should
* not but mucking with inodes in this context. So, we will just return
* our contained reference to the block driver inode and let the umount
* logic dispose of it.
*/
if (blkdriver)
{
*blkdriver = inode;
}
}
}
@@ -1558,6 +1580,59 @@ static int fat_unbind(void *handle)
return ret;
}
/****************************************************************************
* Name: fat_statfs
*
* Description: Return filesystem statistics
*
****************************************************************************/
static int fat_statfs(struct inode *mountpt, struct statfs *buf)
{
struct fat_mountpt_s *fs;
int ret;
/* Sanity checks */
DEBUGASSERT(mountpt && mountpt->i_private);
/* Get the mountpoint private data from the inode structure */
fs = mountpt->i_private;
/* Check if the mount is still healthy */
fat_semtake(fs);
ret = fat_checkmount(fs);
if (ret < 0)
{
goto errout_with_semaphore;
}
/* Fill in the statfs info */
memset(buf, 0, sizeof(struct statfs));
buf->f_type = MSDOS_SUPER_MAGIC;
/* We will claim that the optimal transfer size is the size of a cluster in bytes */
buf->f_bsize = fs->fs_fatsecperclus * fs->fs_hwsectorsize;
/* Everything else follows in units of clusters */
buf->f_blocks = fs->fs_nclusters; /* Total data blocks in the file system */
ret = fat_nfreeclusters(fs, &buf->f_bfree); /* Free blocks in the file system */
buf->f_bavail = buf->f_bfree; /* Free blocks avail to non-superuser */
buf->f_namelen = (8+1+3); /* Maximum length of filenames */
fat_semgive(fs);
return OK;
errout_with_semaphore:
fat_semgive(fs);
return ret;
}
/****************************************************************************
* Name: fat_unlink
*
@@ -1731,7 +1806,7 @@ static int fat_mkdir(struct inode *mountpt, const char *relpath, mode_t mode)
direntry[DIR_NAME] = '.';
DIR_PUTATTRIBUTES(direntry, FATATTR_DIRECTORY);
crtime = fat_gettime();
crtime = fat_systime2fattime();
DIR_PUTCRTIME(direntry, crtime & 0xffff);
DIR_PUTWRTTIME(direntry, crtime & 0xffff);
DIR_PUTCRDATE(direntry, crtime >> 16);
@@ -1991,9 +2066,122 @@ int fat_rename(struct inode *mountpt, const char *oldrelpath,
return ret;
}
/****************************************************************************
* Name: fat_stat
*
* Description: Return information about a file or directory
*
****************************************************************************/
static int fat_stat(struct inode *mountpt, const char *relpath, struct stat *buf)
{
struct fat_mountpt_s *fs;
struct fat_dirinfo_s dirinfo;
uint16 date;
uint16 date2;
uint16 time;
ubyte attribute;
int ret;
/* Sanity checks */
DEBUGASSERT(mountpt && mountpt->i_private);
/* Get the mountpoint private data from the inode structure */
fs = mountpt->i_private;
/* Check if the mount is still healthy */
fat_semtake(fs);
ret = fat_checkmount(fs);
if (ret != OK)
{
goto errout_with_semaphore;
}
/* Find the directory entry corresponding to relpath. */
ret = fat_finddirentry(fs, &dirinfo, relpath);
/* If nothing was found, then we fail with EEXIST */
if (ret < 0)
{
goto errout_with_semaphore;
}
if (! dirinfo.fd_entry)
{
ret = -ENOENT;
goto errout_with_semaphore;
}
/* Get the FAT attribute and map it so some meaningful mode_t values */
attribute = DIR_GETATTRIBUTES(dirinfo.fd_entry);
if ((attribute & FATATTR_VOLUMEID) != 0)
{
ret = -ENOENT;
goto errout_with_semaphore;
}
/* Set the access permissions. The file/directory is always readable
* by everyone but may be writeable by no-one.
*/
memset(buf, 0, sizeof(struct stat));
buf->st_mode = S_IROTH|S_IRGRP|S_IRUSR;
if ((attribute & FATATTR_READONLY) == 0)
{
buf->st_mode |= S_IWOTH|S_IWGRP|S_IWUSR;
}
/* We will report only types file or directory */
if ((attribute & FATATTR_DIRECTORY) != 0)
{
buf->st_mode |= S_IFDIR;
}
else
{
buf->st_mode |= S_IFREG;
}
/* File/directory size, access block size */
buf->st_size = DIR_GETFILESIZE(dirinfo.fd_entry);
buf->st_blksize = fs->fs_fatsecperclus * fs->fs_hwsectorsize;
buf->st_blocks = (buf->st_size + buf->st_blksize - 1) / buf->st_blksize;
/* Times */
date = DIR_GETWRTDATE(dirinfo.fd_entry);
time = DIR_GETWRTTIME(dirinfo.fd_entry);
buf->st_mtime = fat_fattime2systime(time, date);
date2 = DIR_GETLASTACCDATE(dirinfo.fd_entry);
if (date == date2)
{
buf->st_atime = buf->st_mtime;
}
else
{
buf->st_atime = fat_fattime2systime(0, date2);
}
date = DIR_GETCRDATE(dirinfo.fd_entry);
time = DIR_GETCRTIME(dirinfo.fd_entry);
buf->st_ctime = fat_fattime2systime(time, date);
ret = OK;
errout_with_semaphore:
fat_semgive(fs);
return ret;
}
/****************************************************************************
* Public Functions
****************************************************************************/
#endif /* CONFIG_DISABLE_MOUNTPOUNT */
#endif /* CONFIG_FS_FAT */

View File

@@ -43,6 +43,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <semaphore.h>
#include <time.h>
/****************************************************************************
* Definitions
@@ -134,18 +135,6 @@
#define FATNTRES_LCNAME 0x08 /* Lower case in name */
#define FATNTRES_LCEXT 0x10 /* Lower case in extension */
/* File attribute bits in FAT directory entry */
#define FATATTR_READONLY 0x01
#define FATATTR_HIDDEN 0x02
#define FATATTR_SYSTEM 0x04
#define FATATTR_VOLUMEID 0x08
#define FATATTR_DIRECTORY 0x10
#define FATATTR_ARCHIVE 0x20
#define FATATTR_LONGNAME \
(FATATTR_READONLY|FATATTR_HIDDEN|FATATTR_SYSTEM|FATATTR_VOLUMEID)
/* Directory indexing helper. Each directory entry is 32-bytes in length.
* The number of directory entries in a sector then varies with the size
* of the sector supported in hardware.
@@ -282,7 +271,7 @@
# define DIR_GETCRTIME(p) fat_getuint16(UBYTE_PTR(p,DIR_CRTIME))
# define DIR_GETCRDATE(p) fat_getuint16(UBYTE_PTR(p,DIR_CRDATE))
# define DIR_GETLASTACCDATE(p) fat_getuint16(UBYTE_PTR(p,DIR_LASTACCDTE))
# define DIR_GETLASTACCDATE(p) fat_getuint16(UBYTE_PTR(p,DIR_LASTACCDATE))
# define DIR_GETFSTCLUSTHI(p) fat_getuint16(UBYTE_PTR(p,DIR_FSTCLUSTHI))
# define DIR_GETWRTTIME(p) fat_getuint16(UBYTE_PTR(p,DIR_WRTTIME))
# define DIR_GETWRTDATE(p) fat_getuint16(UBYTE_PTR(p,DIR_WRTDATE))
@@ -320,7 +309,7 @@
# define DIR_PUTCRTIME(p,v) fat_putuint16(UBYTE_PTR(p,DIR_CRTIME),v)
# define DIR_PUTCRDATE(p,v) fat_putuint16(UBYTE_PTR(p,DIR_CRDATE),v)
# define DIR_PUTLASTACCDATE(p,v) fat_putuint16(UBYTE_PTR(p,DIR_LASTACCDTE),v)
# define DIR_PUTLASTACCDATE(p,v) fat_putuint16(UBYTE_PTR(p,DIR_LASTACCDATE),v)
# define DIR_PUTFSTCLUSTHI(p,v) fat_putuint16(UBYTE_PTR(p,DIR_FSTCLUSTHI),v)
# define DIR_PUTWRTTIME(p,v) fat_putuint16(UBYTE_PTR(p,DIR_WRTTIME),v)
# define DIR_PUTWRTDATE(p,v) fat_putuint16(UBYTE_PTR(p,DIR_WRTDATE),v)
@@ -366,7 +355,7 @@
# define DIR_GETCRTIME(p) UINT16_VAL(p,DIR_CRTIME)
# define DIR_GETCRDATE(p) UINT16_VAL(p,DIR_CRDATE)
# define DIR_GETLASTACCDATE(p) UINT16_VAL(p,DIR_LASTACCDTE)
# define DIR_GETLASTACCDATE(p) UINT16_VAL(p,DIR_LASTACCDATE)
# define DIR_GETFSTCLUSTHI(p) UINT16_VAL(p,DIR_FSTCLUSTHI)
# define DIR_GETWRTTIME(p) UINT16_VAL(p,DIR_WRTTIME)
# define DIR_GETWRTDATE(p) UINT16_VAL(p,DIR_WRTDATE)
@@ -404,7 +393,7 @@
# define DIR_PUTCRTIME(p,v) UINT16_PUT(p,DIR_CRTIME,v)
# define DIR_PUTCRDATE(p,v) UINT16_PUT(p,DIR_CRDATE,v)
# define DIR_PUTLASTACCDATE(p,v) UINT16_PUT(p,DIR_LASTACCDTE,v)
# define DIR_PUTLASTACCDATE(p,v) UINT16_PUT(p,DIR_LASTACCDATE,v)
# define DIR_PUTFSTCLUSTHI(p,v) UINT16_PUT(p,DIR_FSTCLUSTHI,v)
# define DIR_PUTWRTTIME(p,v) UINT16_PUT(p,DIR_WRTTIME,v)
# define DIR_PUTWRTDATE(p,v) UINT16_PUT(p,DIR_WRTDATE,v)
@@ -526,7 +515,8 @@ EXTERN void fat_semgive(struct fat_mountpt_s *fs);
/* Get the current time for FAT creation and write times */
EXTERN uint32 fat_gettime(void);
EXTERN uint32 fat_systime2fattime(void);
EXTERN time_t fat_fattime2systime(uint16 time, uint16 date);
/* Handle hardware interactions for mounting */
@@ -551,7 +541,7 @@ EXTERN sint32 fat_extendchain(struct fat_mountpt_s *fs, uint32 cluster);
#define fat_createchain(fs) fat_extendchain(fs, 0)
/* Help for traverseing directory trees */
/* Help for traversing directory trees */
EXTERN int fat_nextdirentry(struct fat_mountpt_s *fs, struct fs_fatdir_s *dir);
EXTERN int fat_finddirentry(struct fat_mountpt_s *fs, struct fat_dirinfo_s *dirinfo,
@@ -577,6 +567,7 @@ EXTERN int fat_ffcacheinvalidate(struct fat_mountpt_s *fs, struct fat_file_s
/* FSINFO sector support */
EXTERN int fat_updatefsinfo(struct fat_mountpt_s *fs);
EXTERN int fat_nfreeclusters(struct fat_mountpt_s *fs, size_t *pfreeclusters);
#undef EXTERN
#if defined(__cplusplus)

190
fs/fs_fat32attrib.c Normal file
View File

@@ -0,0 +1,190 @@
/************************************************************
* fs_fat32attrib.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************/
/************************************************************
* Compilation Switches
************************************************************/
/************************************************************
* Included Files
************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <errno.h>
#include <nuttx/fs.h>
#include <nuttx/fat.h>
#include "fs_internal.h"
#include "fs_fat32.h"
/************************************************************
* Private Functions
************************************************************/
/************************************************************
* Name: fat_attrib
************************************************************/
static int fat_attrib(const char *path, fat_attrib_t *retattrib,
fat_attrib_t setbits, fat_attrib_t clearbits)
{
struct fat_mountpt_s *fs;
struct fat_dirinfo_s dirinfo;
FAR struct inode *inode;
const char *relpath = NULL;
ubyte oldattributes;
ubyte newattributes;
int ret;
/* Get an inode for this file */
inode = inode_find(path, &relpath);
if (!inode)
{
/* There is no mountpoint that includes in this path */
ret = ENOENT;
goto errout;
}
/* Verify that the inode is a valid mountpoint. */
if (!INODE_IS_MOUNTPT(inode) || !inode->u.i_mops || !inode->i_private)
{
ret = ENXIO;
goto errout_with_inode;
}
/* Get the mountpoint private data from the inode structure */
fs = inode->i_private;
/* Check if the mount is still healthy */
fat_semtake(fs);
ret = fat_checkmount(fs);
if (ret != OK)
{
goto errout_with_semaphore;
}
/* Find the file/directory entry for the oldrelpath */
ret = fat_finddirentry(fs, &dirinfo, relpath);
if (ret != OK)
{
/* Some error occurred -- probably -ENOENT */
goto errout_with_semaphore;
}
/* Make sure that we found some valid file or directory */
if (!dirinfo.fd_entry)
{
/* Ooops.. we found the root directory */
ret = EACCES;
goto errout_with_semaphore;
}
/* Get the current attributes */
oldattributes = DIR_GETATTRIBUTES(dirinfo.fd_entry);
newattributes = oldattributes;
/* Set or clear any bits as requested */
newattributes &= ~(clearbits & (FATATTR_READONLY|FATATTR_HIDDEN|FATATTR_SYSTEM|FATATTR_ARCHIVE));
newattributes |= (setbits & (FATATTR_READONLY|FATATTR_HIDDEN|FATATTR_SYSTEM|FATATTR_ARCHIVE));
/* Did any thingchange? */
if (newattributes != oldattributes)
{
DIR_PUTATTRIBUTES(dirinfo.fd_entry, newattributes);
fs->fs_dirty = TRUE;
ret = fat_updatefsinfo(fs);
if (ret != OK)
{
ret = -ret;
goto errout_with_semaphore;
}
}
/* Success */
if (retattrib)
{
*retattrib = newattributes;
}
fat_semgive(fs);
inode_release(inode);
return OK;
errout_with_semaphore:
fat_semgive(fs);
errout_with_inode:
inode_release(inode);
errout:
*get_errno_ptr() = ret;
return ERROR;
}
/************************************************************
* Global Functions
************************************************************/
/************************************************************
* Name: fat_getattrib
************************************************************/
int fat_getattrib(const char *path, fat_attrib_t *attrib)
{
return fat_attrib(path, attrib, 0, 0);
}
/************************************************************
* Name: fat_setattrib
************************************************************/
int fat_setattrib(const char *path, fat_attrib_t setbits, fat_attrib_t clearbits)
{
return fat_attrib(path, NULL, setbits, clearbits);
}

View File

@@ -53,13 +53,11 @@
#include <debug.h>
#include <nuttx/fs.h>
#include <nuttx/fat.h>
#include "fs_internal.h"
#include "fs_fat32.h"
#ifdef CONFIG_FS_FAT
#ifndef CONFIG_DISABLE_MOUNTPOUNT
/****************************************************************************
* Definitions
****************************************************************************/
@@ -530,9 +528,11 @@ void fat_semgive(struct fat_mountpt_s *fs)
}
/****************************************************************************
* Name: fat_gettime
* Name: fat_systime2fattime
*
* Desciption: Get the system time convertto a time and and date suitble
* for writing into the FAT FS.
*
* Desciption: Get the time and date suitble for writing into the FAT FS.
* TIME in LS 16-bits:
* Bits 0:4 = 2 second count (0-29 representing 0-58 seconds)
* Bits 5-10 = minutes (0-59)
@@ -542,10 +542,31 @@ void fat_semgive(struct fat_mountpt_s *fs)
* Bits 5:8 = Month of year (1-12)
* Bits 9:15 = Year from 1980 (0-127 representing 1980-2107)
*
****************************************************************************/
uint32 fat_systime2fattime(void)
{
#warning "Time not implemented"
return 0;
}
/****************************************************************************
* Name: fat_fattime2systime
*
* Desciption: Convert FAT data and time to a system time_t
*
* 16-bit FAT time:
* Bits 0:4 = 2 second count (0-29 representing 0-58 seconds)
* Bits 5-10 = minutes (0-59)
* Bits 11-15 = hours (0-23)
* 16-bit FAT date:
* Bits 0:4 = Day of month (0-31)
* Bits 5:8 = Month of year (1-12)
* Bits 9:15 = Year from 1980 (0-127 representing 1980-2107)
*
****************************************************************************/
uint32 fat_gettime(void)
time_t fat_fattime2systime(uint16 fattime, uint16 fatdate)
{
#warning "Time not implemented"
return 0;
@@ -837,7 +858,7 @@ ssize_t fat_cluster2sector(struct fat_mountpt_s *fs, uint32 cluster )
*
* Desciption: Get the cluster start sector into the FAT.
*
* Return: <0: error, >=0: sector number
* Return: <0: error, 0:cluster unassigned, >=0: start sector of cluster
*
****************************************************************************/
@@ -1812,7 +1833,7 @@ int fat_dirtruncate(struct fat_mountpt_s *fs, struct fat_dirinfo_s *dirinfo)
DIR_PUTATTRIBUTES(dirinfo->fd_entry, FATATTR_ARCHIVE);
writetime = fat_gettime();
writetime = fat_systime2fattime();
DIR_PUTWRTTIME(dirinfo->fd_entry, writetime & 0xffff);
DIR_PUTWRTDATE(dirinfo->fd_entry, writetime > 16);
@@ -1877,7 +1898,7 @@ int fat_dircreate(struct fat_mountpt_s *fs, struct fat_dirinfo_s *dirinfo)
/* ARCHIVE attribute, write time, creation time */
DIR_PUTATTRIBUTES(dirinfo->fd_entry, FATATTR_ARCHIVE);
time = fat_gettime();
time = fat_systime2fattime();
DIR_PUTWRTTIME(dirinfo->fd_entry, time & 0xffff);
DIR_PUTCRTIME(dirinfo->fd_entry, time & 0xffff);
DIR_PUTWRTDATE(dirinfo->fd_entry, time >> 16);
@@ -2316,5 +2337,108 @@ int fat_updatefsinfo(struct fat_mountpt_s *fs)
return ret;
}
#endif /* CONFIG_DISABLE_MOUNTPOUNT */
#endif /* CONFIG_FS_FAT */
/****************************************************************************
* Name: fat_nfreeclusters
*
* Desciption: Get the number of free clusters
*
****************************************************************************/
int fat_nfreeclusters(struct fat_mountpt_s *fs, size_t *pfreeclusters)
{
uint32 nfreeclusters;
/* If number of the first free cluster is valid, then just return that value. */
if (fs->fs_fsifreecount <= fs->fs_nclusters - 2)
{
*pfreeclusters = fs->fs_fsifreecount;
return OK;
}
/* Otherwise, we will have to count the number of free clusters */
nfreeclusters = 0;
if (fs->fs_type == FSTYPE_FAT12)
{
size_t sector;
/* Examine every cluster in the fat */
for (sector = 2; sector < fs->fs_nclusters; sector++)
{
/* If the cluster is unassigned, then increment the count of free clusters */
if ((uint16)fat_getcluster(fs, sector) == 0)
{
nfreeclusters++;
}
}
}
else
{
unsigned int cluster;
size_t fatsector;
unsigned int offset;
int ret;
fatsector = fs->fs_fatbase;
offset = fs->fs_hwsectorsize;
/* Examine each cluster in the fat */
for (cluster = fs->fs_nclusters; cluster > 0; cluster--)
{
/* If we are starting a new sector, then read the new sector in fs_buffer */
if (offset >= fs->fs_hwsectorsize)
{
ret = fat_fscacheread(fs, fatsector++);
if (ret < 0)
{
return ret;
}
/* Reset the offset to the next FAT entry.
* Increment the sector number to read next time around.
*/
offset = 0;
fatsector++;
}
/* FAT16 and FAT32 differ only on the size of each cluster start
* sector number in the FAT.
*/
if (fs->fs_type == FSTYPE_FAT16)
{
if (FAT_GETFAT16(fs->fs_buffer, offset) == 0)
{
nfreeclusters++;
}
offset += 2;
}
else
{
if (FAT_GETFAT32(fs->fs_buffer, offset) == 0)
{
nfreeclusters++;
}
offset += 4;
}
}
}
fs->fs_fsifreecount = nfreeclusters;
if (fs->fs_type == FSTYPE_FAT32)
{
fs->fs_fsidirty = TRUE;
}
*pfreeclusters = nfreeclusters;
return OK;
}

View File

@@ -67,8 +67,6 @@
* Private Functions
************************************************************/
#if CONFIG_NFILE_DESCRIPTORS >0
static void _files_semtake(FAR struct filelist *list)
{
/* Take the semaphore (perhaps waiting) */
@@ -279,4 +277,3 @@ void files_release(int filedes)
}
}
#endif /* CONFIG_NFILE_DESCRIPTORS */

View File

@@ -47,9 +47,6 @@
#include "fs_internal.h"
#if CONFIG_NFILE_DESCRIPTORS > 0
#ifndef CONFIG_DISABLE_MOUNTPOUNT
/****************************************************************************
* Definitions
****************************************************************************/
@@ -138,5 +135,3 @@ int fsync(int fd)
return ERROR;
}
#endif /* CONFIG_DISABLE_MOUNTPOINT */
#endif /* CONFIG_NFILE_DESCRIPTORS */

View File

@@ -48,8 +48,6 @@
#include <nuttx/fs.h>
#include "fs_internal.h"
#if CONFIG_NFILE_DESCRIPTORS >0
/************************************************************
* Definitions
************************************************************/
@@ -330,5 +328,4 @@ const char *inode_nextname(const char *name)
if (*name) name++;
return name;
}
#endif /* CONFIG_NFILE_DESCRIPTORS */

View File

@@ -43,8 +43,6 @@
#include <nuttx/fs.h>
#include "fs_internal.h"
#if CONFIG_NFILE_DESCRIPTORS >0
/************************************************************
* Definitions
************************************************************/
@@ -97,6 +95,3 @@ FAR struct inode *inode_find(const char *path, const char **relpath)
return node;
}
#endif /* CONFIG_NFILE_DESCRIPTORS */

View File

@@ -44,8 +44,6 @@
#include <nuttx/fs.h>
#include "fs_internal.h"
#if CONFIG_NFILE_DESCRIPTORS >0
/************************************************************
* Definitions
************************************************************/
@@ -105,4 +103,3 @@ void inode_release(FAR struct inode *node)
}
}
#endif /* CONFIG_NFILE_DESCRIPTORS */

View File

@@ -119,7 +119,7 @@ STATUS inode_remove(const char *path)
/* Find the node to delete */
node = inode_search(&name, &left, &parent, NULL);
node = inode_search(&name, &left, &parent, (const char **)NULL);
if (node)
{
/* Found it, now remove it from the tree */
@@ -136,6 +136,7 @@ STATUS inode_remove(const char *path)
*/
node->i_flags |= FSNODEFLAG_DELETED;
return -EBUSY;
}
else
{
@@ -149,5 +150,5 @@ STATUS inode_remove(const char *path)
/* The node does not exist or it has references */
return ERROR;
return -ENOENT;
}

View File

@@ -156,7 +156,7 @@ FAR struct inode *inode_reserve(const char *path)
/* Find the location to insert the new subtree */
if (inode_search(&name, &left, &parent, NULL) != NULL)
if (inode_search(&name, &left, &parent, (const char **)NULL) != NULL)
{
/* Is is an error if the node already exists in the tree */

View File

@@ -207,11 +207,9 @@ EXTERN void inode_release(FAR struct inode *inode);
/* fs_files.c ***************************************************************/
#if CONFIG_NFILE_DESCRIPTORS >0
EXTERN void weak_function files_initialize(void);
EXTERN int files_allocate(FAR struct inode *inode, int oflags, off_t pos);
EXTERN void files_release(int filedes);
#endif
#undef EXTERN
#if defined(__cplusplus)

View File

@@ -52,8 +52,6 @@
* Global Functions
************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
int ioctl(int fd, int req, unsigned long arg)
{
FAR struct filelist *list;
@@ -87,4 +85,3 @@ int ioctl(int fd, int req, unsigned long arg)
return ret;
}
#endif /* CONFIG_NFILE_DESCRIPTORS */

View File

@@ -45,9 +45,6 @@
#include "fs_internal.h"
#if CONFIG_NFILE_DESCRIPTORS > 0
#ifndef CONFIG_DISABLE_MOUNTPOUNT
/****************************************************************************
* Definitions
****************************************************************************/
@@ -131,5 +128,3 @@ int mkdir(const char *pathname, mode_t mode)
return ERROR;
}
#endif /* CONFIG_DISABLE_MOUNTPOUNT */
#endif /* CONFIG_NFILE_DESCRIPTORS */

View File

@@ -45,9 +45,6 @@
#include <nuttx/fs.h>
#include "fs_internal.h"
#if CONFIG_NFILE_DESCRIPTORS > 0
#ifndef CONFIG_DISABLE_MOUNTPOUNT
/* At least one filesystem must be defined, or this file will not compile.
* It may be desire-able to make filesystems dynamically registered at
* some time in the future, but at present, this file needs to know about
@@ -225,6 +222,10 @@ int mount(const char *source, const char *target,
goto errout_with_mountpt;
}
/* Increment reference count for the reference we pass to the file system */
blkdrvr_inode->i_crefs++;
/* On failure, the bind method returns -errorcode */
status = mops->bind(blkdrvr_inode, data, &fshandle);
@@ -233,7 +234,7 @@ int mount(const char *source, const char *target,
/* The inode is unhappy with the blkdrvr for some reason */
errcode = -status;
goto errout_with_mountpt;
goto errout_with_blkdrvr2;
}
/* We have it, now populate it with driver specific information. */
@@ -258,6 +259,9 @@ int mount(const char *source, const char *target,
/* A lot of goto's! But they make the error handling much simpler */
errout_with_blkdrvr2:
inode_release(blkdrvr_inode);
errout_with_mountpt:
inode_release(mountpt_inode);
@@ -272,6 +276,5 @@ int mount(const char *source, const char *target,
return ERROR;
}
#endif /* Need at least filesystem */
#endif /* CONFIG_DISABLE_MOUNTPOUNT */
#endif /* Need file descriptor support */
#endif /* Need at least one filesystem */

View File

@@ -56,8 +56,6 @@
* Public Functions
************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
int inode_checkflags(FAR struct inode *inode, int oflags)
{
if (((oflags & O_RDOK) != 0 && !inode->u.i_ops->read) ||
@@ -153,7 +151,7 @@ int open(const char *path, int oflags, ...)
ret = OK;
if (inode->u.i_ops->open)
{
#ifndef CONFIG_DISABLE_MOUNTPOUNT
#ifndef CONFIG_DISABLE_MOUNTPOINT
if (INODE_IS_MOUNTPT(inode))
{
ret = inode->u.i_mops->open((FAR struct file*)&list->fl_files[fd],
@@ -183,4 +181,3 @@ int open(const char *path, int oflags, ...)
return ERROR;
}
#endif /* CONFIG_NFILE_DESCRIPTORS */

View File

@@ -82,8 +82,6 @@
*
************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
FAR DIR *opendir(const char *path)
{
FAR struct inode *inode = NULL;
@@ -228,4 +226,3 @@ errout_with_semaphore:
return NULL;
}
#endif /* CONFIG_NFILE_DESCRIPTORS */

View File

@@ -53,8 +53,6 @@
* Global Functions
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
int read(int fd, void *buf, unsigned int nbytes)
{
FAR struct filelist *list;
@@ -99,4 +97,3 @@ int read(int fd, void *buf, unsigned int nbytes)
return ret;
}
#endif /* CONFIG_NFILE_DESCRIPTORS */

View File

@@ -53,8 +53,6 @@
* Name: readpsuedodir
************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
static inline int readpsuedodir(struct internal_dir_s *idir)
{
FAR struct inode *prev;
@@ -228,4 +226,3 @@ errout:
return NULL;
}
#endif /* CONFIG_NFILE_DESCRIPTORS */

View File

@@ -82,8 +82,6 @@
*
************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
int readdir_r(FAR DIR *dirp, FAR struct dirent *entry,
FAR struct dirent **result)
{
@@ -120,4 +118,3 @@ int readdir_r(FAR DIR *dirp, FAR struct dirent *entry,
return 0;
}
#endif /* CONFIG_NFILE_DESCRIPTORS */

View File

@@ -43,8 +43,6 @@
#include <nuttx/fs.h>
#include "fs_internal.h"
#ifndef CONFIG_DISABLE_MOUNTPOUNT
/************************************************************
* Definitions
************************************************************/
@@ -101,4 +99,3 @@ STATUS register_blockdriver(const char *path,
return ret;
}
#endif /* CONFIG_DISABLE_MOUNTPOUNT */

View File

@@ -45,9 +45,6 @@
#include "fs_internal.h"
#if CONFIG_NFILE_DESCRIPTORS > 0
#ifndef CONFIG_DISABLE_MOUNTPOUNT
/****************************************************************************
* Definitions
****************************************************************************/
@@ -155,5 +152,3 @@ int rename(const char *oldpath, const char *newpath)
return ERROR;
}
#endif /* CONFIG_DISABLE_MOUNTPOUNT */
#endif /* CONFIG_NFILE_DESCRIPTORS */

View File

@@ -52,8 +52,6 @@
* Name: rewindpsuedodir
************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
static inline void rewindpsuedodir(struct internal_dir_s *idir)
{
struct inode *prev;
@@ -104,7 +102,7 @@ static inline void rewindpsuedodir(struct internal_dir_s *idir)
void rewinddir(FAR DIR *dirp)
{
struct internal_dir_s *idir = (struct internal_dir_s *)dirp;
#ifndef CONFIG_DISABLE_MOUNTPOUNT
#ifndef CONFIG_DISABLE_MOUNTPOINT
struct inode *inode;
#endif
@@ -119,7 +117,7 @@ void rewinddir(FAR DIR *dirp)
* that we are dealing with.
*/
#ifndef CONFIG_DISABLE_MOUNTPOUNT
#ifndef CONFIG_DISABLE_MOUNTPOINT
inode = idir->fd_root;
if (INODE_IS_MOUNTPT(inode))
{
@@ -143,4 +141,3 @@ void rewinddir(FAR DIR *dirp)
}
}
#endif /* CONFIG_NFILE_DESCRIPTORS */

View File

@@ -45,9 +45,6 @@
#include "fs_internal.h"
#if CONFIG_NFILE_DESCRIPTORS > 0
#ifndef CONFIG_DISABLE_MOUNTPOUNT
/****************************************************************************
* Definitions
****************************************************************************/
@@ -131,5 +128,3 @@ int rmdir(const char *pathname)
return ERROR;
}
#endif /* CONFIG_DISABLE_MOUNTPOUNT */
#endif /* CONFIG_NFILE_DESCRIPTORS */

View File

@@ -48,8 +48,6 @@
* Private Functions
************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
/************************************************************
* Name: seekpsuedodir
************************************************************/
@@ -111,7 +109,7 @@ static inline void seekpsuedodir(struct internal_dir_s *idir, off_t offset)
* Name: seekmountptdir
************************************************************/
#ifndef CONFIG_DISABLE_MOUNTPOUNT
#ifndef CONFIG_DISABLE_MOUNTPOINT
static inline void seekmountptdir(struct internal_dir_s *idir, off_t offset)
{
struct inode *inode;
@@ -212,7 +210,7 @@ void seekdir(FAR DIR *dirp, off_t offset)
* that we are dealing with.
*/
#ifndef CONFIG_DISABLE_MOUNTPOUNT
#ifndef CONFIG_DISABLE_MOUNTPOINT
if (INODE_IS_MOUNTPT(idir->fd_root))
{
/* The node is a file system mointpoint */
@@ -228,4 +226,3 @@ void seekdir(FAR DIR *dirp, off_t offset)
}
}
#endif /* CONFIG_NFILE_DESCRIPTORS */

Some files were not shown because too many files have changed in this diff Show More