Skip to content

Commit

Permalink
Trunk Build 699
Browse files Browse the repository at this point in the history
  • Loading branch information
quizic committed Jan 13, 2017
1 parent d021c35 commit adb66e5
Show file tree
Hide file tree
Showing 35 changed files with 548 additions and 97 deletions.
14 changes: 11 additions & 3 deletions core/driver/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,21 +199,23 @@ REDSTATUS RedDirEntryDelete(
}
else if((DirEntryIndexToOffset(ulDeleteIdx) + DIRENT_SIZE) == pPInode->pInodeBuf->ullSize)
{
uint32_t ulTruncIdx = ulDeleteIdx;
/* Start searching one behind the index to be deleted.
*/
uint32_t ulTruncIdx = ulDeleteIdx - 1U;
bool fDone = false;

/* We are deleting the last dirent in the directory, so search
backwards to find the last populated dirent, allowing us to truncate
the directory to that point.
*/
while((ret == 0) && (ulTruncIdx > 0U) && !fDone)
while((ret == 0) && (ulTruncIdx != UINT32_MAX) && !fDone)
{
ret = RedInodeDataSeekAndRead(pPInode, ulTruncIdx / DIRENTS_PER_BLOCK);

if(ret == 0)
{
const DIRENT *pDirents = CAST_CONST_DIRENT_PTR(pPInode->pbData);
uint32_t ulBlockIdx = (ulTruncIdx - 1U) % DIRENTS_PER_BLOCK;
uint32_t ulBlockIdx = ulTruncIdx % DIRENTS_PER_BLOCK;

do
{
Expand Down Expand Up @@ -242,6 +244,12 @@ REDSTATUS RedDirEntryDelete(
}
}

/* Currently ulTruncIdx represents the last valid dirent index, or
UINT32_MAX if the directory is now empty. Increment it so that it
represents the first invalid entry, which will be truncated.
*/
ulTruncIdx++;

/* Truncate the directory, deleting the requested entry and any empty
dirents at the end of the directory.
*/
Expand Down
4 changes: 4 additions & 0 deletions core/driver/volume.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ REDSTATUS RedVolMount(void)

if(ret != 0)
{
/* If we fail to mount, invalidate the buffers to prevent any
confusion that could be caused by stale or corrupt metadata.
*/
(void)RedBufferDiscardRange(0U, gpRedVolume->ulBlockCount);
(void)RedOsBDevClose(gbRedVolNum);
}
}
Expand Down
18 changes: 18 additions & 0 deletions doc/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ recent releases and a list of known issues.

## Release History and Changes

### Reliance Edge v2.0, January 2017

- Added support for Linux as a host environment
- All "host" projects may now be built in either Windows or Linux using the
`make` command. The formatter and image builder are built, and the checker
and image copier are also built in the commercial kit.
- An additional host tool has been added for Linux only: `redfuse`. It is a
File System in User Space (FUSE) implementation, allowing a Reliance Edge
volume to be mounted directly on Linux for easy access. It is built from
the host project folder using the command `make redfuse`.
- The OS-specific API test (commercial kit only) is now ported to run on Linux
for the purpose of verifying the FUSE implementation.
- Fixed a bug that could leave a directory in an invalid state after removing
files. For example, an affected directory might report a non-zero length even
after all files had been deleted.
- Fixed a bug that would leave the driver in a bad state if a mount operation
failed due to missing or corrupt metaroot blocks.

### Reliance Edge v1.1 (Beta), November 2016

- Added support for a discard (trim) interface in the commercial kit. While
Expand Down
20 changes: 20 additions & 0 deletions doc/release_notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,26 @@ course of recent releases and a list of known issues.

Release History and Changes

Reliance Edge v2.0, January 2017

- Added support for Linux as a host environment
- All "host" projects may now be built in either Windows or Linux
using the make command. The formatter and image builder are built,
and the checker and image copier are also built in the
commercial kit.
- An additional host tool has been added for Linux only: redfuse. It
is a File System in User Space (FUSE) implementation, allowing a
Reliance Edge volume to be mounted directly on Linux for
easy access. It is built from the host project folder using the
command make redfuse.
- The OS-specific API test (commercial kit only) is now ported to run
on Linux for the purpose of verifying the FUSE implementation.
- Fixed a bug that could leave a directory in an invalid state after
removing files. For example, an affected directory might report a
non-zero length even after all files had been deleted.
- Fixed a bug that would leave the driver in a bad state if a mount
operation failed due to missing or corrupt metaroot blocks.

Reliance Edge v1.1 (Beta), November 2016

- Added support for a discard (trim) interface in the commercial kit.
Expand Down
12 changes: 6 additions & 6 deletions include/redver.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<!-- This macro is updated automatically: do not edit! -->
*/
#define RED_BUILD_NUMBER "696"
#define RED_BUILD_NUMBER "699"

#define RED_KIT_GPL 0U /* Open source GPL kit. */
#define RED_KIT_COMMERCIAL 1U /* Commercially-licensed kit. */
Expand All @@ -48,13 +48,13 @@

/** @brief Version number to display in output.
*/
#define RED_VERSION "v1.1"
#define RED_VERSION "v2.0"

/** @brief Version number in hex.
/** @brief Version number in hex.
The most significant byte is the major version number, etc.
*/
#define RED_VERSION_VAL 0x01010000U
#define RED_VERSION_VAL 0x02000000U

/** @brief On-disk version number.
Expand All @@ -71,7 +71,7 @@

/* Specifies whether the product is in alpha stage, beta stage, or neither.
*/
#if 1
#if 0
#if 0
#define ALPHABETA " (Alpha)"
#else
Expand All @@ -88,7 +88,7 @@

/** @brief Product copyright.
*/
#define RED_PRODUCT_LEGAL "Copyright (c) 2014-2016 Datalight, Inc. All Rights Reserved Worldwide."
#define RED_PRODUCT_LEGAL "Copyright (c) 2014-2017 Datalight, Inc. All Rights Reserved Worldwide."


/** @brief Product patents.
Expand Down
2 changes: 2 additions & 0 deletions os/linux/services/osbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,13 +704,15 @@ static REDSTATUS FileDiskClose(uint8_t bVolNum)
LINUXBDEV *pDisk = &gaDisk[bVolNum];
REDSTATUS ret = 0;

#if REDCONF_READ_ONLY == 0
/* Flush before closing. This is primarily for the tools, so that all the
data is really committed to the media when the tool exits.
*/
if(gaDisk[bVolNum].mode != BDEV_O_RDONLY)
{
ret = FileDiskFlush(bVolNum);
}
#endif

if(ret == 0)
{
Expand Down
14 changes: 10 additions & 4 deletions os/linux/tools/fuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,8 @@ static int fuse_red_open(
int32_t iFd;
int result = 0;

assert(pFileInfo != NULL);

iFd = red_local_open(pszPath, pFileInfo->flags);

if (iFd < 0)
Expand Down Expand Up @@ -592,8 +594,10 @@ static int fuse_red_read(
(void)pszPath;

assert(pFileInfo != NULL);
assert(offset >= 0);
assert(size <= INT_MAX);
if(offset < 0 || size > INT_MAX)
{
return -EINVAL;
}

iFd = (int32_t)pFileInfo->fh;

Expand Down Expand Up @@ -629,8 +633,10 @@ static int fuse_red_write(
(void)pszPath;

assert(pFileInfo != NULL);
assert(offset >= 0);
assert(size <= INT_MAX);
if(offset < 0 || size > INT_MAX)
{
return -EINVAL;
}

iFd = (int32_t)pFileInfo->fh;

Expand Down
1 change: 1 addition & 0 deletions os/win32/services/osbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include <redfs.h>
#include <redvolume.h>
#endif


typedef enum
Expand Down
2 changes: 1 addition & 1 deletion projects/freertos/atmel/sam4e-ek/src/config/redconf.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* THIS FILE WAS GENERATED BY THE DATALIGHT RELIANCE EDGE CONFIGURATION
UTILITY. DO NOT MODIFY.
Generated by configuration utility version 1.1
Generated by configuration utility version 2.0
*/
/** @file
*/
Expand Down
4 changes: 2 additions & 2 deletions projects/freertos/atmel/sam4e-ek/src/config/redconf.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* THIS FILE WAS GENERATED BY THE DATALIGHT RELIANCE EDGE CONFIGURATION
UTILITY. DO NOT MODIFY.
Generated by configuration utility version 1.1
Generated by configuration utility version 2.0
*/
/** @file
*/
Expand Down Expand Up @@ -105,7 +105,7 @@

#define REDCONF_CHECKER 0

#define RED_CONFIG_UTILITY_VERSION 0x1010000U
#define RED_CONFIG_UTILITY_VERSION 0x2000000U

#define RED_CONFIG_MINCOMPAT_VER 0x1000200U

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* THIS FILE WAS GENERATED BY THE DATALIGHT RELIANCE EDGE CONFIGURATION
UTILITY. DO NOT MODIFY.
Generated by configuration utility version 1.1
Generated by configuration utility version 2.0
*/
/** @file
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* THIS FILE WAS GENERATED BY THE DATALIGHT RELIANCE EDGE CONFIGURATION
UTILITY. DO NOT MODIFY.
Generated by configuration utility version 1.1
Generated by configuration utility version 2.0
*/
/** @file
*/
Expand Down Expand Up @@ -105,7 +105,7 @@

#define REDCONF_CHECKER 0

#define RED_CONFIG_UTILITY_VERSION 0x1010000U
#define RED_CONFIG_UTILITY_VERSION 0x2000000U

#define RED_CONFIG_MINCOMPAT_VER 0x1000200U

Expand Down
2 changes: 1 addition & 1 deletion projects/freertos/st/stm324xg-eval/src/redconf.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* THIS FILE WAS GENERATED BY THE DATALIGHT RELIANCE EDGE CONFIGURATION
UTILITY. DO NOT MODIFY.
Generated by configuration utility version 1.1
Generated by configuration utility version 2.0
*/
/** @file
*/
Expand Down
4 changes: 2 additions & 2 deletions projects/freertos/st/stm324xg-eval/src/redconf.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* THIS FILE WAS GENERATED BY THE DATALIGHT RELIANCE EDGE CONFIGURATION
UTILITY. DO NOT MODIFY.
Generated by configuration utility version 1.1
Generated by configuration utility version 2.0
*/
/** @file
*/
Expand Down Expand Up @@ -105,7 +105,7 @@

#define REDCONF_CHECKER 0

#define RED_CONFIG_UTILITY_VERSION 0x1010000U
#define RED_CONFIG_UTILITY_VERSION 0x2000000U

#define RED_CONFIG_MINCOMPAT_VER 0x1000200U

Expand Down
84 changes: 84 additions & 0 deletions projects/linux/host/fusetest/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#
# makefile for Linux project in Reliance Edge
#
P_PROJDIR ?= $(shell pwd)
P_BASEDIR ?= $(shell readlink -f $(P_PROJDIR)/../../../..)

P_OS ?= linux
B_OBJEXT ?= o
B_DEBUG ?= 0
CC ?= gcc

INCLUDES= \
-I $(P_BASEDIR)/include \
-I $(P_BASEDIR)/core/include \
-I $(P_BASEDIR)/tests/testfw \
-I $(P_BASEDIR)/os/linux/include \
-I $(P_BASEDIR)/tests/stochposix \
-I $(P_PROJDIR)

##
# All warnings are errors, Check to see if the GCC compiler
# options for stack frame and unused variables are supported.
##

EXTRA_CFLAGS +=-Wall
EXTRA_CFLAGS +=-Werror
EXTRA_CFLAGS +=$(call cc-option,-Wframe-larger-than=4096)

ifneq ($(B_DEBUG),0)
EXTRA_CFLAGS +=-g -DDEBUG
endif

all: osapitest

.c.o:
$(CC) $(EXTRA_CFLAGS) $(INCLUDES) -DD_DEBUG=$(B_DEBUG) -x c -c $< -o $@

include $(P_BASEDIR)/build/reliance.mk

REDTOSAPIHDR= \
$(P_BASEDIR)/tests/os/generic/redtosapiprotos.h \
$(P_BASEDIR)/os/linux/include/redtosapiconfig.h

REDTOSAPIOBJ= \
$(P_BASEDIR)/tests/os/generic/tosfflush.$(B_OBJEXT) \
$(P_BASEDIR)/tests/os/generic/tosfread.$(B_OBJEXT) \
$(P_BASEDIR)/tests/os/generic/tosfwrite.$(B_OBJEXT) \
$(P_BASEDIR)/tests/os/generic/tosopendir.$(B_OBJEXT) \
$(P_BASEDIR)/tests/os/generic/tosremove.$(B_OBJEXT) \
$(P_BASEDIR)/tests/os/generic/tosrewinddir.$(B_OBJEXT) \
$(P_BASEDIR)/tests/os/generic/tosseekdir.$(B_OBJEXT) \
$(P_BASEDIR)/tests/os/generic/tosapi.$(B_OBJEXT) \
$(P_BASEDIR)/tests/os/generic/tosfopen.$(B_OBJEXT) \
$(P_BASEDIR)/tests/os/generic/tosfseek.$(B_OBJEXT) \
$(P_BASEDIR)/tests/os/generic/tosmkdir.$(B_OBJEXT) \
$(P_BASEDIR)/tests/os/generic/tosreaddir.$(B_OBJEXT) \
$(P_BASEDIR)/tests/os/generic/tosrename.$(B_OBJEXT) \
$(P_BASEDIR)/tests/os/generic/tosrmdir.$(B_OBJEXT)

$(P_BASEDIR)/tests/os/generic/tosfflush.$(B_OBJEXT): $(REDTOSAPIHDR) $(REDHDR)
$(P_BASEDIR)/tests/os/generic/tosfread.$(B_OBJEXT): $(REDTOSAPIHDR) $(REDHDR)
$(P_BASEDIR)/tests/os/generic/tosfwrite.$(B_OBJEXT): $(REDTOSAPIHDR) $(REDHDR)
$(P_BASEDIR)/tests/os/generic/tosopendir.$(B_OBJEXT): $(REDTOSAPIHDR) $(REDHDR)
$(P_BASEDIR)/tests/os/generic/tosremove.$(B_OBJEXT): $(REDTOSAPIHDR) $(REDHDR)
$(P_BASEDIR)/tests/os/generic/tosrewinddir.$(B_OBJEXT): $(REDTOSAPIHDR) $(REDHDR)
$(P_BASEDIR)/tests/os/generic/tosseekdir.$(B_OBJEXT): $(REDTOSAPIHDR) $(REDHDR)
$(P_BASEDIR)/tests/os/generic/tosapi.$(B_OBJEXT): $(REDTOSAPIHDR) $(REDHDR)
$(P_BASEDIR)/tests/os/generic/tosfopen.$(B_OBJEXT): $(REDTOSAPIHDR) $(REDHDR)
$(P_BASEDIR)/tests/os/generic/tosfseek.$(B_OBJEXT): $(REDTOSAPIHDR) $(REDHDR)
$(P_BASEDIR)/tests/os/generic/tosmkdir.$(B_OBJEXT): $(REDTOSAPIHDR) $(REDHDR)
$(P_BASEDIR)/tests/os/generic/tosreaddir.$(B_OBJEXT): $(REDTOSAPIHDR) $(REDHDR)
$(P_BASEDIR)/tests/os/generic/tosrename.$(B_OBJEXT): $(REDTOSAPIHDR) $(REDHDR)
$(P_BASEDIR)/tests/os/generic/tosrmdir.$(B_OBJEXT): $(REDTOSAPIHDR) $(REDHDR)

osapitest: $(P_PROJDIR)/osapitest_main.$(B_OBJEXT) $(REDTOSAPIOBJ) $(REDDRIVOBJ) $(REDTESTOBJ)
$(CC) $(EXTRA_CFLAGS) $^ -o $@


.phony: clean
clean:
-rm -f $(REDTOSAPIOBJ)
-rm -f $(P_PROJDIR)/*.$(B_OBJEXT)
-rm -f osapitest

Loading

0 comments on commit adb66e5

Please sign in to comment.