Skip to content

Commit

Permalink
Fix #367, Deprecate OS_VolumeTable objects
Browse files Browse the repository at this point in the history
Remove the OS_VolumeTable definition from all BSPs, but provide
a default (empty) one to support linking when OMIT_DEPRECATED is
not set.
  • Loading branch information
jphickey committed May 14, 2020
1 parent c2bcebb commit 1c36569
Show file tree
Hide file tree
Showing 23 changed files with 160 additions and 346 deletions.
26 changes: 13 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@
#
# This also exports the following variables:
#
# OSAL_BSP_STAGING_INSTALL_DIR : the location of the staging directory
# for the selected OSAL BSP. This can be used in
# post-build rules or "install()" commands to stage
# binary or data files for execution.
#
# UT_COVERAGE_COMPILE_FLAGS : Compiler flags that must be used to
# instrument code for coverage testing
# UT_COVERAGE_LINK_FLAGS : Linker flags that must be used to
Expand Down Expand Up @@ -161,13 +156,22 @@ if (OSAL_BSP_INCLUDE_DIRECTORIES)
include_directories(${OSAL_BSP_INCLUDE_DIRECTORIES})
endif (OSAL_BSP_INCLUDE_DIRECTORIES)

set(BSP_SRCLIST
src/bsp/shared/src/osapi-bsp.c
src/bsp/shared/src/bsp_default_app_run.c
src/bsp/shared/src/bsp_default_app_startup.c
src/bsp/shared/src/bsp_default_symtab.c
)

if (NOT OMIT_DEPRECATED)
list(APPEND BSP_SRCLIST
src/bsp/shared/src/bsp_default_voltab.c
)
endif (NOT OMIT_DEPRECATED)

# Define the external "osal_bsp" static library target
add_library(osal_bsp STATIC
src/bsp/shared/src/osapi-bsp.c
src/bsp/shared/src/bsp_default_app_run.c
src/bsp/shared/src/bsp_default_app_startup.c
src/bsp/shared/src/bsp_default_symtab.c
${BSP_SRCLIST}
$<TARGET_OBJECTS:osal_${OSAL_SYSTEM_BSPTYPE}_impl>
)

Expand Down Expand Up @@ -337,10 +341,6 @@ endif (ENABLE_UNIT_TESTS)
# This is conditional to avoid warnings in a standalone build.
get_directory_property(HAS_PARENT PARENT_DIRECTORY)
if (HAS_PARENT)
# export the "OSAL_BSP_STAGING_INSTALL_DIR" to the parent build, so this can be
# used in "install" commands as necessary for the files needed at runtime
set(OSAL_BSP_STAGING_INSTALL_DIR "${OSAL_BSP_STAGING_INSTALL_DIR}" PARENT_SCOPE)

# Export the UT coverage compiler/linker flags to the parent build.
# These flags are based on the target system type and should be used
# when building code intended for coverage analysis.
Expand Down
1 change: 0 additions & 1 deletion src/bsp/mcp750-vxworks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

add_library(osal_mcp750-vxworks_impl OBJECT
src/bsp_start.c
src/bsp_voltab.c
src/bsp_console.c
)

Expand Down
3 changes: 0 additions & 3 deletions src/bsp/mcp750-vxworks/build_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@
#
##########################################################################

# This indicates where to stage target binaries created during the build
set(OSAL_BSP_STAGING_INSTALL_DIR "CF:0")

# The "-u" switch is required to ensure that "ldppc" pulls in the OS_BSPMain entry point
target_link_libraries(osal_bsp -uOS_BSPMain)
60 changes: 0 additions & 60 deletions src/bsp/mcp750-vxworks/src/bsp_voltab.c

This file was deleted.

1 change: 0 additions & 1 deletion src/bsp/pc-linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

add_library(osal_pc-linux_impl OBJECT
src/bsp_start.c
src/bsp_voltab.c
src/bsp_console.c
)

Expand Down
5 changes: 0 additions & 5 deletions src/bsp/pc-linux/build_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,3 @@ if (NOT CMAKE_CROSSCOMPILING)
set(UT_COVERAGE_COMPILE_FLAGS -pg --coverage)
set(UT_COVERAGE_LINK_FLAGS -pg --coverage)
endif()

# This indicates where to stage target binaries created during the build
# It should reflect the _real_ location of the persistent storage path used by
# the BSP which is intended to be used for runtime modules or files.
set(OSAL_BSP_STAGING_INSTALL_DIR "eeprom1")
32 changes: 0 additions & 32 deletions src/bsp/pc-linux/src/bsp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,41 +38,9 @@ OS_BSP_PcLinuxGlobalData_t OS_BSP_PcLinuxGlobal;
--------------------------------------------------------- */
void OS_BSP_Initialize(void)
{
mode_t mode;
uint32 i;
struct stat statbuf;
FILE *fp;
char buffer[32];

/*
** Create local directories for "disk" mount points
** See bsp_voltab for the values
**
** NOTE - the voltab table is poorly designed here; values of "0" are valid
** and will translate into an entry that is actually used. In particular the
** "free" flag has to be actually initialized to TRUE to say its NOT valid.
** So in the case of an entry that has been zeroed out (i.e. bss section) it
** will be treated as a valid entry.
**
** Checking that the DeviceName starts with a leading slash '/' is a workaround
** for this, and may be the only way to detect an entry that is uninitialized.
*/
mode = S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO;
for (i = 0; i < NUM_TABLE_ENTRIES; ++i)
{
if (OS_VolumeTable[i].VolumeType == FS_BASED &&
OS_VolumeTable[i].PhysDevName[0] != 0 &&
OS_VolumeTable[i].DeviceName[0] == '/')

{
if (stat(OS_VolumeTable[i].PhysDevName, &statbuf) < 0)
{
BSP_DEBUG("Creating mount point: %s\n", OS_VolumeTable[i].PhysDevName);
mkdir(OS_VolumeTable[i].PhysDevName, mode);
}
}
}

/*
* If not running as root, check /proc/sys/fs/mqueue/msg_max
*
Expand Down
49 changes: 0 additions & 49 deletions src/bsp/pc-linux/src/bsp_voltab.c

This file was deleted.

1 change: 0 additions & 1 deletion src/bsp/pc-rtems/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

add_library(osal_pc-rtems_impl OBJECT
src/bsp_start.c
src/bsp_voltab.c
src/bsp_console.c
)

Expand Down
5 changes: 0 additions & 5 deletions src/bsp/pc-rtems/build_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,3 @@
target_link_libraries(osal_bsp
rtemscpu
)

# This indicates where to stage target binaries created during the build
# It should reflect the _real_ location of the persistent storage path used by
# the BSP which is intended to be used for runtime modules or files.
set(OSAL_BSP_STAGING_INSTALL_DIR "eeprom")
66 changes: 25 additions & 41 deletions src/bsp/pc-rtems/src/bsp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ OS_BSP_PcRtemsGlobalData_t OS_BSP_PcRtemsGlobal;
void OS_BSP_Setup(void)
{
int status;
unsigned int i;
struct stat statbuf;
const char * cfpart;
const char * cmdlinestr;
const char * cmdp;
char * cmdi, *cmdo;
Expand Down Expand Up @@ -206,6 +204,19 @@ void OS_BSP_Setup(void)
printf("Creating Root file system failed: %s\n", rtems_status_text(status));
}

/*
* Create the mountpoint for the general purpose file system
*/
if (stat(RTEMS_USER_FS_MOUNTPOINT, &statbuf) < 0)
{
status = mkdir(RTEMS_USER_FS_MOUNTPOINT,
S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO); /* For nonvol filesystem mountpoint */
if (status < 0)
{
printf("mkdir failed: %s\n", strerror(errno));
}
}

/*
* Register the IDE partition table.
*/
Expand All @@ -217,52 +228,25 @@ void OS_BSP_Setup(void)
* is still available. */
BSP_DEBUG("warning: /dev/hda partition table not found: %s / %s\n", rtems_status_text(status), strerror(errno));
BSP_DEBUG("Persistent storage will NOT be mounted\n");
cfpart = NULL;
}
else
{
cfpart = "/dev/hda1";
status = mount("/dev/hda1", RTEMS_USER_FS_MOUNTPOINT, RTEMS_FILESYSTEM_TYPE_DOSFS,
RTEMS_FILESYSTEM_READ_WRITE, NULL);
if (status < 0)
{
BSP_DEBUG("mount failed: %s\n", strerror(errno));
}
}

/*
** Create local directories for "disk" mount points
** See bsp_voltab for the values
**
** NOTE - the voltab table is poorly designed here; values of "0" are valid
** and will translate into an entry that is actually used. In particular the
** "free" flag has to be actually initialized to TRUE to say its NOT valid.
** So in the case of an entry that has been zeroed out (i.e. bss section) it
** will be treated as a valid entry.
**
** Checking that the DeviceName starts with a leading slash '/' is a workaround
** for this, and may be the only way to detect an entry that is uninitialized.
*/
for (i = 0; i < NUM_TABLE_ENTRIES; ++i)
{
if (OS_VolumeTable[i].VolumeType == FS_BASED && OS_VolumeTable[i].PhysDevName[0] != 0 &&
OS_VolumeTable[i].DeviceName[0] == '/')
* Change to the user storage mountpoint dir, which
* will be the basis of relative directory refs.
* If mounted, it will be persistent, otherwise
* it will be an IMFS dir, but should generally work.
*/
chdir(RTEMS_USER_FS_MOUNTPOINT);

{
if (stat(OS_VolumeTable[i].PhysDevName, &statbuf) < 0)
{
status = mkdir(OS_VolumeTable[i].PhysDevName,
S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO); /* For ramdisk mountpoint */
if (status < 0)
{
printf("mkdir failed: %s\n", strerror(errno));
}
}
if (cfpart != NULL && strcmp(OS_VolumeTable[i].MountPoint, "/cf") == 0)
{
status = mount(cfpart, OS_VolumeTable[i].PhysDevName, RTEMS_FILESYSTEM_TYPE_DOSFS,
RTEMS_FILESYSTEM_READ_WRITE, NULL);
if (status < 0)
{
printf("mount failed: %s\n", strerror(errno));
}
}
}
}

/*
* Start the shell now, before any application starts.
Expand Down
Loading

0 comments on commit 1c36569

Please sign in to comment.