Remove vcfiled and vcfilesys. 70/295270/1
authorDave Stevenson <dave.stevenson@raspberrypi.com>
Mon, 27 Jul 2020 16:57:22 +0000 (17:57 +0100)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 4 Jul 2023 08:52:09 +0000 (17:52 +0900)
Both these libraries/apps were related to the VPU accessing the
host file system over VCHI. This has never been used on the Pi,
and is creating build warnings with the latest versions of gcc.
Remove them from the source tree.

cherry-pick upstream commit fdc2102ccf94a397661d495c6942eb834c66ee28
from https://github.com/raspberrypi/userland

Change-Id: Ie26d8771ad5533be9aaafa6e528c1fb31768460b
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
host_applications/linux/libs/bcm_host/CMakeLists.txt
interface/vmcs_host/CMakeLists.txt
interface/vmcs_host/linux/vcfiled/vcfiled_check.c [deleted file]
interface/vmcs_host/linux/vcfiled/vcfiled_check.h [deleted file]
interface/vmcs_host/linux/vcfilesys.c [deleted file]
interface/vmcs_host/vc_fileservice_defs.h [deleted file]
interface/vmcs_host/vc_vchi_filesys.h [deleted file]
interface/vmcs_host/vcfilesys.h [deleted file]
interface/vmcs_host/vchost.h

index a863cb6..2f4beb9 100755 (executable)
@@ -15,9 +15,7 @@ include_directories( ../../../..
                     ../../../../host_applications/vmcs/test_apps/iltest
                      ../../../../host_applications/framework/common )
 
-add_library(bcm_host ${SHARED} bcm_host.c 
-       ../../../../interface/vmcs_host/linux/vcfilesys.c 
-       ../../../../interface/vmcs_host/linux/vcfiled/vcfiled_check.c)
+add_library(bcm_host ${SHARED} bcm_host.c)
 
 target_link_libraries(bcm_host vcos vchostif)
 
index a157db1..c30cb69 100755 (executable)
@@ -8,8 +8,8 @@
 add_definitions(-fno-strict-aliasing)
 
 add_library(vchostif
-            ${VMCS_TARGET}/vcfilesys.c ${VMCS_TARGET}/vcmisc.c
-            vc_vchi_gencmd.c vc_vchi_filesys.c vc_vchi_gpuserv.c
+            ${VMCS_TARGET}/vcmisc.c
+            vc_vchi_gencmd.c vc_vchi_gpuserv.c
             vc_vchi_tvservice.c vc_vchi_cecservice.c
             vc_vchi_dispmanx.c vc_service_common.c)
 #            ${VMCS_TARGET}/vmcs_main.c
diff --git a/interface/vmcs_host/linux/vcfiled/vcfiled_check.c b/interface/vmcs_host/linux/vcfiled/vcfiled_check.c
deleted file mode 100755 (executable)
index 35e0899..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
-Copyright (c) 2012, Broadcom Europe Ltd
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * 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.
-    * Neither the name of the copyright holder 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 HOLDER 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.
-*/
-
-#include "vcfiled_check.h"
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <syslog.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-int vcfiled_lock(const char *lockfile, VCFILED_LOGMSG_T logmsg)
-{
-   int rc, fd;
-   char pidbuf[32];
-   char *lockdir = strdup(lockfile);
-   char *sep = strrchr(lockdir, '/');
-   int ret = -1;
-   if (!sep)
-   {
-      free(lockdir);
-      return -1;
-   }
-   *sep = '\0';
-
-   if (mkdir(lockdir, S_IRWXU | S_IRGRP|S_IXGRP) < 0)
-   {
-      if (errno != EEXIST)
-      {
-         logmsg(LOG_CRIT, "could not create %s:%s\n", lockdir,strerror(errno));
-         goto finish;
-      }
-   }
-   fd = open(lockfile, O_RDWR | O_CREAT | O_EXCL, 0640);
-   if (fd<0)
-   {
-      if (errno != EEXIST)
-      {
-         logmsg(LOG_CRIT, "could not create lockfile %s:%s\n", lockfile, strerror(errno));
-         goto finish;
-      }
-      else
-      {
-         // it already exists - reopen it and try to lock it
-         fd = open(lockfile, O_RDWR);
-         if (fd<0)
-         {
-            logmsg(LOG_CRIT, "could not re-open lockfile %s:%s\n", lockfile, strerror(errno));
-            goto finish;
-         }
-      }
-   }
-   // at this point, we have opened the file, and can use discretionary locking, 
-   // which should work even over NFS
-
-   struct flock flock;
-   memset(&flock, 0, sizeof(flock));
-   flock.l_type   = F_WRLCK;
-   flock.l_whence = SEEK_SET;
-   flock.l_start  = 0;
-   flock.l_len    = 1;
-   if (fcntl(fd, F_SETLK, &flock) < 0)
-   {
-      // if we failed to lock, then it might mean we're already running, or
-      // something else bad.
-      if (errno == EACCES || errno == EAGAIN)
-      {
-         // already running
-         int pid = 0, rc = read(fd, pidbuf, sizeof(pidbuf));
-         if (rc)
-            pid = atoi(pidbuf);
-         logmsg(LOG_CRIT, "already running at pid %d\n", pid);
-         close(fd);
-         goto finish;
-      }
-      else
-      {
-         logmsg(LOG_CRIT, "could not lock %s:%s\n", lockfile, strerror(errno));
-         close(fd);
-         goto finish;
-      }
-   }
-   snprintf(pidbuf,sizeof(pidbuf),"%d", getpid());
-   rc = write(fd, pidbuf, strlen(pidbuf)+1);
-   if (rc<0)
-   {
-      logmsg(LOG_CRIT, "could not write pid:%s\n", strerror(errno));
-      goto finish;
-   }
-   /* do not close the file, as that will release the lock - it will
-    * will close automatically when the program exits.
-    */
-   ret = 0;
-finish:
-   free(lockdir);
-   /* coverity[leaked_handle] - fd left open on purpose */
-   return ret;
-}
-
-int vcfiled_is_running(const char *filename)
-{
-   int ret;
-   
-   int fd = open(filename, O_RDONLY);
-   if (fd < 0)
-   {
-      // file not there, so filed not running
-      ret = 0;
-   }
-
-   else
-   {
-      struct flock flock;
-      memset(&flock, 0, sizeof(flock));
-      flock.l_type   = F_WRLCK;
-      flock.l_whence = SEEK_SET;
-      flock.l_start  = 0;
-      flock.l_len    = 1;
-      int rc = fcntl(fd, F_GETLK, &flock);
-      if (rc != 0)
-      {
-         /* could not access lock info */
-         printf("%s: Could not access lockfile %s: %s\n",
-            "vmcs_main", filename, strerror(errno));
-         ret = 0;
-      }
-      else if (flock.l_pid == 0)
-      {
-         /* file is unlocked, so filed not running */
-         ret = 0;
-      }
-      else 
-      {
-         /* file is locked, so filed is running */
-         ret = 1;
-      }
-   }
-   /* coverity[leaked_handle] - fd left open on purpose */
-   return ret;
-}
-
-
-
diff --git a/interface/vmcs_host/linux/vcfiled/vcfiled_check.h b/interface/vmcs_host/linux/vcfiled/vcfiled_check.h
deleted file mode 100755 (executable)
index 360f50a..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-Copyright (c) 2012, Broadcom Europe Ltd
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * 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.
-    * Neither the name of the copyright holder 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 HOLDER 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.
-*/
-
-#ifndef VCFILED_CHECK_H
-#define VCFILED_CHECK_H
-
-#ifdef ANDROID
-#define VCFILED_LOCKDIR "/tmp/vcfiled/vcfiled.pid"
-#define VCFILED_LOCKFILE "/tmp/vcfiled"
-#endif
-
-#ifndef VCFILED_LOCKFILE
-#define VCFILED_LOCKDIR "/var/run/vcfiled"
-#define VCFILED_LOCKFILE VCFILED_LOCKDIR "/vcfiled"
-#endif
-
-typedef void (*VCFILED_LOGMSG_T)(int level, const char *fmt, ...);
-int vcfiled_lock(const char *filename, VCFILED_LOGMSG_T logmsg);
-extern int vcfiled_is_running(const char *lockfile);
-
-
-#endif
-
-
diff --git a/interface/vmcs_host/linux/vcfilesys.c b/interface/vmcs_host/linux/vcfilesys.c
deleted file mode 100755 (executable)
index 9f3ebf1..0000000
+++ /dev/null
@@ -1,1131 +0,0 @@
-/*
-Copyright (c) 2012, Broadcom Europe Ltd
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * 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.
-    * Neither the name of the copyright holder 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 HOLDER 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.
-*/
-
-#define VCOS_LOG_CATEGORY (&hostfs_log_cat)
-
-#ifndef  _LARGEFILE_SOURCE
-#define  _LARGEFILE_SOURCE
-#endif
-#ifndef  _LARGEFILE64_SOURCE
-#define  _LARGEFILE64_SOURCE
-#endif
-#define  _FILE_OFFSET_BITS 64    /* So we get lseek and lseek64 */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/statfs.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <assert.h>
-#include <ctype.h>
-#include <limits.h>
-
-#if defined(__GLIBC__) && !defined( __USE_FILE_OFFSET64 )
-#error   "__USE_FILE_OFFSET64 isn't defined"
-#endif
-
-#include "interface/vcos/vcos.h"
-
-/* Some hackery to prevent a clash with the Linux type of the same name */
-#define dirent fs_dirent
-#include "vcfilesys_defs.h"
-#include "vchost.h"
-#undef dirent
-
-#include <dirent.h>
-
-#include "vc_fileservice_defs.h"
-
-VCOS_LOG_CAT_T hostfs_log_cat;
-
-/******************************************************************************
-Global data.
-******************************************************************************/
-
-/******************************************************************************
-Local types and defines.
-******************************************************************************/
-
-//#define DEBUG_LEVEL 1
-#define DEBUG_MINOR(...) vcos_log_info(__VA_ARGS__)
-#define DEBUG_MAJOR(...) vcos_log_warn(__VA_ARGS__)
-
-/* Define a wrapper for the native directory handle which includes the path
- * to that directory (needed to retrieve size and attributes via stat()).
- */
-
-struct fs_dir
-{
-   DIR *dhandle;
-   int pathlen;
-   char pathbuf[PATH_MAX];
-};
-
-/*
- *  The media player on the Videocore may be asked to open a file on the Host that
- *  is in fact a FIFO.  We need to note when a FIFO has been opened so that we
- *  can fake out some FIFO seeks that the Videocore may perform, hence the following
- *  types and variables.
- */
-
-typedef struct
-{
-   int is_fifo;            // non-zero if file is a FIFO
-   uint64_t read_offset;   // read offset into file
-} file_info_t;
-
-#define FILE_INFO_TABLE_CHUNK_LEN   20
-
-/******************************************************************************
-Static data.
-******************************************************************************/
-
-static file_info_t *p_file_info_table = NULL;
-static int file_info_table_len = 0;
-
-/******************************************************************************
-Static functions.
-******************************************************************************/
-
-static void backslash_to_slash( char *s );
-
-/******************************************************************************
-Global functions.
-******************************************************************************/
-
-/******************************************************************************
-NAME
-   vc_hostfs_init
-
-SYNOPSIS
-   void vc_hostfs_init(void)
-
-FUNCTION
-   Initialises the host to accept requests from Videocore
-
-RETURNS
-   void
-******************************************************************************/
-
-void vc_hostfs_init(void)
-{
-   // This hostfs module is not thread safe - it allocaes a block
-   // of memory and uses it without any kind of locking. 
-   //
-   // It offers no advantage of stdio, and so most clients should
-   // not use it. Arguably FILESYS should use it in order to get
-   // the FIFO support.
-
-   const char *thread_name = vcos_thread_get_name(vcos_thread_current());
-   if (strcmp(thread_name, "FILESYS") != 0 && strcmp(thread_name, "HFilesys") != 0)
-   {
-      fprintf(stderr,"%s: vc_hostfs is deprecated. Please use stdio\n",
-              vcos_thread_get_name(vcos_thread_current()));
-   }
-
-   vcos_log_register("hostfs", &hostfs_log_cat);
-   DEBUG_MINOR("init");
-   // Allocate memory for the file info table
-   p_file_info_table = (file_info_t *)calloc( FILE_INFO_TABLE_CHUNK_LEN, sizeof( file_info_t ) );
-   assert( p_file_info_table != NULL );
-   if (p_file_info_table)
-   {
-      file_info_table_len = FILE_INFO_TABLE_CHUNK_LEN;
-   }
-}
-
-/** Terminate this library. Clean up resources.
-  */
-
-void vc_hostfs_exit(void)
-{
-   vcos_log_unregister(&hostfs_log_cat);
-   if (p_file_info_table)
-   {
-      free(p_file_info_table);
-      p_file_info_table = NULL;
-   }
-}
-
-/******************************************************************************
-NAME
-   vc_hostfs_close
-
-SYNOPSIS
-   int vc_hostfs_close(int fildes)
-
-FUNCTION
-   Deallocates the file descriptor to a file.
-
-RETURNS
-   Successful completion: 0
-   Otherwise: -1
-******************************************************************************/
-
-int vc_hostfs_close(int fildes)
-{
-   DEBUG_MINOR("vc_hostfs_close(%d)", fildes);
-   return close(fildes);
-}
-
-/******************************************************************************
-NAME
-   vc_hostfs_lseek
-
-SYNOPSIS
-   long vc_hostfs_lseek(int fildes, long offset, int whence)
-
-FUNCTION
-   Sets the file pointer associated with the open file specified by fildes.  If
-   the file is a FIFO (Linux does not support seeking on a FIFO) then, for the
-   benefit of the Videocore streaming file handlers which do a number of null seeks,
-   that is, seeks to the current position, the return value is faked without an
-   actual seek being done.
-
-RETURNS
-   Successful completion: offset
-   Otherwise: -1
-******************************************************************************/
-
-long vc_hostfs_lseek(int fildes, long offset, int whence)
-{
-   return (long) vc_hostfs_lseek64( fildes, (int64_t) offset, whence);
-}
-
-
-/******************************************************************************
-NAME
-   vc_hostfs_lseek64
-
-SYNOPSIS
-   int64_t vc_hostfs_lseek64(int fildes, int64_t offset, int whence)
-
-FUNCTION
-   Sets the file pointer associated with the open file specified by fildes.  If
-   the file is a FIFO (Linux does not support seeking on a FIFO) then, for the
-   benefit of the Videocore streaming file handlers which do a number of null seeks,
-   that is, seeks to the current position, the return value is faked without an
-   actual seek being done.
-
-RETURNS
-   Successful completion: offset
-   Otherwise: -1
-******************************************************************************/
-
-int64_t vc_hostfs_lseek64(int fildes, int64_t offset, int whence)
-{
-   DEBUG_MINOR("vc_hostfs_lseek(%d,%" PRId64 ",%d)", fildes, offset, whence);
-   if (fildes >= file_info_table_len)
-   {
-      // File descriptor not in table, so this is an error
-      DEBUG_MAJOR("vc_hostfs_lseek: invalid fildes %d", fildes);
-      return -1;
-   }
-   else
-   {
-      // There is entry in the file info table for this file descriptor, so go
-      // ahead and handle the seek
-      int64_t read_offset = p_file_info_table[fildes].read_offset;
-
-      if (p_file_info_table[fildes].is_fifo)
-      {
-         // The Videocore is attempting to seek on a FIFO.  FIFOs don't support seeking
-         // but, for the benefit of certain Videocore "streaming" file handlers, we
-         // will fake limited FIFO seek functionality by computing where a seek
-         // would take us to
-         if (whence == SEEK_SET)
-         {
-            read_offset = offset;
-         }
-         else if (whence == SEEK_CUR)
-         {
-            read_offset += offset;
-         }
-         else
-         {
-            // seeking to the end of FIFO makes no sense, so this is an error
-            DEBUG_MAJOR("vc_hostfs_lseek(%d,%lld,%d): SEEK_END not supported on FIFO", fildes, (long long)offset, whence);
-            return -1;
-         }
-      }
-      else
-      {
-         // File is not a FIFO, so do the seek
-         read_offset = lseek64(fildes, offset, whence);
-      }
-      p_file_info_table[fildes].read_offset = read_offset;
-      DEBUG_MINOR("vc_hostfs_lseek returning %" PRId64 ")", read_offset);
-      return read_offset;
-   }
-}
-
-
-
-
-/******************************************************************************
-NAME
-   vc_hostfs_open
-
-SYNOPSIS
-   int vc_hostfs_open(const char *path, int vc_oflag)
-
-FUNCTION
-   Establishes a connection between a file and a file descriptor.  For the benefit
-   of faking out seeks on a FIFO, we will need to keep track of the read offset for
-   all reads, and to facilitate this each opened file is given an entry in a local
-   file info table.
-
-RETURNS
-   Successful completion: file descriptor
-   Otherwise: -1
-******************************************************************************/
-
-int vc_hostfs_open(const char *inPath, int vc_oflag)
-{
-   char *path = strdup( inPath );
-   //char *s;
-   int flags = 0, ret=errno;
-   struct stat fileStat;
-
-   // Replace all '\' with '/'
-   backslash_to_slash( path );
-
-#if 0
-   s = path + strlen( path );
-   if (( s - path ) >= 4 )
-   {
-      if ( strcasecmp( &s[ -4 ], ".vll" ) == 0 )
-      {
-         // The Videocore is asking for a .vll file. Since it isn't consistent with
-         // the case, we convert .vll files to all lowercase.
-          "vc_hostfs_open: '%s'", path ;
-
-         s--;   // backup to the last character (*s is on the '\0')
-         while (( s >= path ) && ( *s != '/' ))
-         {
-            *s = tolower( *s );
-            s--;
-         }
-      }
-   }
-#endif
-   DEBUG_MINOR("vc_hostfs_open: '%s'", path);
-
-   flags = O_RDONLY;
-   if (vc_oflag & VC_O_WRONLY)  flags =  O_WRONLY;
-   if (vc_oflag & VC_O_RDWR)    flags =  O_RDWR;
-   if (vc_oflag & VC_O_APPEND)  flags |= O_APPEND;
-   if (vc_oflag & VC_O_CREAT)   flags |= O_CREAT;
-   if (vc_oflag & VC_O_TRUNC)   flags |= O_TRUNC;
-   if (vc_oflag & VC_O_EXCL)    flags |= O_EXCL;
-
-   //while (*path == '\\') path++; // do not want initial '\'
-   if (flags & O_CREAT)
-      ret = open(path, flags, S_IRUSR | S_IWUSR );
-   else
-      ret = open(path, flags );
-
-   if (ret < 0 )
-   {
-      DEBUG_MINOR("vc_hostfs_open(%s,%d) = %d", path, vc_oflag, ret);
-   }
-   else
-   {
-      DEBUG_MINOR("vc_hostfs_open(%s,%d) = %d", path, vc_oflag, ret);
-   }
-
-   // If the file was successfully open then initialize its entry in
-   // the file info table.  If necessary, we expand the size of the table
-   if (ret >= 0)
-   {
-      // File was successfully opened
-      if (ret >= file_info_table_len)
-      {
-         file_info_t *p_new_file_info_table = p_file_info_table;
-         int new_file_info_table_len = file_info_table_len;
-
-         // try and allocate a bigger buffer for the file info table
-         new_file_info_table_len += FILE_INFO_TABLE_CHUNK_LEN;
-         p_new_file_info_table = calloc( (size_t)new_file_info_table_len, sizeof( file_info_t ) );
-         if (p_new_file_info_table == NULL)
-         {
-            // calloc failed
-            DEBUG_MAJOR("vc_hostfs_open: file_info_table calloc failed");
-            assert( 0 );
-         }
-         else
-         {
-            // calloc successful, so copy data from previous buffer to new buffer,
-            // free previous buffer and update ptr and len info
-            memcpy( p_new_file_info_table, p_file_info_table, sizeof( file_info_t ) * file_info_table_len );
-            free( p_file_info_table );
-            p_file_info_table = p_new_file_info_table;
-            file_info_table_len = new_file_info_table_len;
-         }
-      }
-      assert( ret < file_info_table_len );
-      {
-         // initialize this file's entry in the file info table
-         p_file_info_table[ret].is_fifo = 0;
-         p_file_info_table[ret].read_offset = 0;
-      }
-
-      // Check whether the file is a FIFO.  A FIFO does not support seeking
-      // but we will fake, to the extent supported by the buffered file system
-      // on the Videocore, limited FIFO seek functionality.  This is for the benefit
-      // of certain Videocore "streaming" file handlers.
-      if (fstat( ret, &fileStat ) != 0)
-      {
-         DEBUG_MINOR("vc_hostfs_open: fstat failed: %s", strerror(errno));
-      }
-      else if (S_ISFIFO( fileStat.st_mode ))
-      {
-         // file is a FIFO, so note its fildes for future reference
-         p_file_info_table[ret].is_fifo = 1;
-         DEBUG_MINOR("vc_hostfs_open: file with fildes %d is a FIFO", ret);
-      }
-   }
-
-   free( path );
-
-   return ret;
-}
-
-/******************************************************************************
-NAME
-   vc_hostfs_read
-
-SYNOPSIS
-   int vc_hostfs_read(int fildes, void *buf, unsigned int nbyte)
-
-FUNCTION
-   Attempts to read nbyte bytes from the file associated with the file
-   descriptor, fildes, into the buffer pointed to by buf.  For the benefit
-   of faking out seeks on a FIFO, we keep track of the read offset for all
-   reads.
-
-RETURNS
-   Successful completion: number of bytes read
-   Otherwise: -1
-******************************************************************************/
-
-int vc_hostfs_read(int fildes, void *buf, unsigned int nbyte)
-{
-   if (fildes >= file_info_table_len)
-   {
-      // File descriptor not in table, so this is an error
-      DEBUG_MAJOR("vc_hostfs_read(%d,%p,%u): invalid fildes", fildes, buf, nbyte);
-      return -1;
-   }
-   else
-   {
-      // There is entry in the file info table for this file descriptor, so go
-      // ahead and handle the read
-      int ret = (int) read(fildes, buf, nbyte);
-      DEBUG_MINOR("vc_hostfs_read(%d,%p,%u) = %d", fildes, buf, nbyte, ret);
-      if (ret > 0)
-      {
-         p_file_info_table[fildes].read_offset += (long) ret;
-      }
-      return ret;
-   }
-}
-
-/******************************************************************************
-NAME
-   vc_hostfs_write
-
-SYNOPSIS
-   int vc_hostfs_write(int fildes, const void *buf, unsigned int nbyte)
-
-FUNCTION
-   Attempts to write nbyte bytes from the buffer pointed to by buf to file
-   associated with the file descriptor, fildes.
-
-RETURNS
-   Successful completion: number of bytes written
-   Otherwise: -1
-******************************************************************************/
-
-int vc_hostfs_write(int fildes, const void *buf, unsigned int nbyte)
-{
-   int ret = (int) write(fildes, buf, nbyte);
-   DEBUG_MINOR("vc_hostfs_write(%d,%p,%u) = %d", fildes, buf, nbyte, ret);
-   return ret;
-}
-
-/******************************************************************************
-NAME
-   vc_hostfs_closedir
-
-SYNOPSIS
-   int vc_hostfs_closedir(void *dhandle)
-
-FUNCTION
-   Ends a directory list iteration.
-
-RETURNS
-   Successful completion: 0
-   Otherwise: -1
-******************************************************************************/
-
-int vc_hostfs_closedir(void *dhandle)
-{
-   struct fs_dir *fsdir = (struct fs_dir *)dhandle;
-   int ret = -1;
-
-   DEBUG_MINOR( "vc_hostfs_closedir(%p)", dhandle );
-
-   if (dhandle && fsdir->dhandle)
-   {
-      (void)closedir(fsdir->dhandle);
-      fsdir->dhandle = NULL;
-      free(fsdir);
-      ret = 0;
-   }
-
-   return ret;
-}
-
-/******************************************************************************
-NAME
-   vc_hostfs_format
-
-SYNOPSIS
-   int vc_hostfs_format(const char *path)
-
-FUNCTION
-   Formats the physical file system that contains path.
-
-RETURNS
-   Successful completion: 0
-   Otherwise: -1
-******************************************************************************/
-
-int vc_hostfs_format(const char *path)
-{
-   DEBUG_MINOR("vc_hostfs_format: '%s' not implemented", path);
-   return -1;
-}
-
-/******************************************************************************
-NAME
-   vc_hostfs_freespace
-
-SYNOPSIS
-   int vc_hostfs_freespace(const char *path)
-
-FUNCTION
-   Returns the amount of free space on the physical file system that contains
-   path.
-
-RETURNS
-   Successful completion: free space
-   Otherwise: -1
-******************************************************************************/
-
-int vc_hostfs_freespace(const char *inPath)
-{
-   int ret;
-
-   int64_t freeSpace =  vc_hostfs_freespace64( inPath );
-
-   // Saturate return value (need this in case we have a large file system)
-   if (freeSpace > (int64_t) INT_MAX)
-   {
-      ret = INT_MAX;
-   }
-   else
-   {
-      ret = (int) freeSpace;
-   }
-
-   return ret;
-}
-
-
-
-
-
-/******************************************************************************
-NAME
-   vc_hostfs_freespace
-
-SYNOPSIS
-   int vc_hostfs_freespace(const char *path)
-
-FUNCTION
-   Returns the amount of free space on the physical file system that contains
-   path.
-
-RETURNS
-   Successful completion: free space
-   Otherwise: -1
-******************************************************************************/
-int64_t vc_hostfs_freespace64(const char *inPath)
-{
-   char *path = strdup( inPath );
-   int64_t ret;
-   struct statfs fsStat;
-
-   // Replace all '\' with '/'
-   backslash_to_slash( path );
-
-   ret = (int64_t) statfs( path, &fsStat );
-
-   if (ret == 0)
-   {
-      ret = fsStat.f_bsize * fsStat.f_bavail;
-   }
-   else
-   {
-      ret = -1;
-   }
-
-   DEBUG_MINOR( "vc_hostfs_freespace64 for '%s' returning %" PRId64 "", path, ret );
-
-   free( path );
-   return ret;
-}
-
-
-/******************************************************************************
-NAME
-   vc_hostfs_get_attr
-
-SYNOPSIS
-   int vc_hostfs_get_attr(const char *path, fattributes_t *attr)
-
-FUNCTION
-   Gets the file/directory attributes.
-
-RETURNS
-   Successful completion: 0
-   Otherwise: -1
-******************************************************************************/
-
-int vc_hostfs_get_attr(const char *path, fattributes_t *attr)
-{
-    struct stat sb;
-
-    DEBUG_MINOR("vc_hostfs_get_attr: '%s'", path );
-
-
-    *attr = 0;
-
-    if ( stat( path, &sb ) == 0 )
-    {
-        if ( S_ISDIR( sb.st_mode ))
-        {
-            *attr |= ATTR_DIRENT;
-        }
-
-        if (( sb.st_mode & S_IWUSR  ) == 0 )
-        {
-            *attr |= ATTR_RDONLY;
-        }
-
-        return 0;
-    }
-    return -1;
-}
-
-/******************************************************************************
-NAME
-   vc_hostfs_mkdir
-
-SYNOPSIS
-   int vc_hostfs_mkdir(const char *path)
-
-FUNCTION
-   Creates a new directory named by the pathname pointed to by path.
-
-RETURNS
-   Successful completion: 0
-   Otherwise: -1
-******************************************************************************/
-
-int vc_hostfs_mkdir(const char *path)
-{
-    DEBUG_MINOR( "vc_hostfs_mkdir: '%s'",  path );
-    if ( mkdir( path, 0777 ) == 0 )
-    {
-        return 0;
-    }
-    return -1;
-}
-
-/******************************************************************************
-NAME
-   vc_hostfs_opendir
-
-SYNOPSIS
-   void *vc_hostfs_opendir(const char *dirname)
-
-FUNCTION
-   Starts a directory list iteration of sub-directories.
-
-RETURNS
-   Successful completion: dhandle (pointer)
-   Otherwise: NULL
-******************************************************************************/
-
-void *vc_hostfs_opendir(const char *dirname)
-{
-   struct fs_dir *fsdir = NULL;
-
-   DEBUG_MINOR( "vc_hostfs_opendir: '%s'", dirname );
-
-   if (dirname && dirname[0])
-   {
-      fsdir = (struct fs_dir *)malloc(sizeof(struct fs_dir));
-
-      if (fsdir)
-      {
-         DIR *dhandle;
-         int len = strlen(dirname);
-
-         memcpy(fsdir->pathbuf, dirname, len);
-
-         backslash_to_slash(fsdir->pathbuf);
-
-         /* Remove any trailing slashes */
-         while (fsdir->pathbuf[len - 1] == '/')
-            len--;
-
-         fsdir->pathbuf[len] = '\0';
-
-         dhandle = opendir(fsdir->pathbuf);
-         DEBUG_MINOR( "opendir: '%s' = %p", fsdir->pathbuf, dhandle );
-
-         if (dhandle)
-         {
-            fsdir->pathlen = len;
-            fsdir->dhandle = dhandle;
-         }
-         else
-         {
-            free(fsdir);
-            fsdir = NULL;
-         }
-      }
-   }
-
-   return fsdir;
-}
-
-/******************************************************************************
-NAME
-   vc_hostfs_readdir_r
-
-SYNOPSIS
-   struct dirent *vc_hostfs_readdir_r(void *dhandle, struct dirent *result)
-
-FUNCTION
-   Fills in the passed result structure with details of the directory entry
-   at the current psition in the directory stream specified by the argument
-   dhandle, and positions the directory stream at the next entry. If the last
-   sub-directory has been reached it ends the iteration and begins a new one
-   for files in the directory.
-
-RETURNS
-   Successful completion: result
-   End of directory stream: NULL
-******************************************************************************/
-
-struct fs_dirent *vc_hostfs_readdir_r(void *dhandle, struct fs_dirent *result)
-{
-   struct fs_dir *fsdir = (struct fs_dir *)dhandle;
-
-   DEBUG_MINOR( "vc_hostfs_readdir_r(%p)", fsdir );
-
-   if (fsdir && result)
-   {
-      struct dirent *dent;
-
-      while ((dent = readdir(fsdir->dhandle)) != NULL)
-      {
-         struct stat statbuf;
-         int ret;
-
-         /* Append the filename, and stat the resulting path */
-         fsdir->pathbuf[fsdir->pathlen] = '/';
-         vcos_safe_strcpy(fsdir->pathbuf, dent->d_name, sizeof(fsdir->pathbuf), fsdir->pathlen + 1);
-         ret = stat(fsdir->pathbuf, &statbuf);
-         fsdir->pathbuf[fsdir->pathlen] = '\0';
-
-         if (ret == 0)
-         {
-            vcos_safe_strcpy(result->d_name, dent->d_name, sizeof(result->d_name), 0);
-            result->d_size = (statbuf.st_size <= 0xffffffff) ? (unsigned int)statbuf.st_size : 0xffffffff;
-            result->d_attrib = ATTR_NORMAL;
-            if ((statbuf.st_mode & S_IWUSR) == 0)
-               result->d_attrib |= ATTR_RDONLY;
-            if (statbuf.st_mode & S_IFDIR)
-               result->d_attrib |= ATTR_DIRENT;
-            result->d_creatime = statbuf.st_ctime;
-            result->d_modtime = statbuf.st_mtime;
-            DEBUG_MINOR( "vc_hostfs_readdir_r() = '%s', %x, %x", result->d_name, result->d_size, result->d_attrib );
-            break;
-         }
-      }
-
-      if (!dent)
-      {
-         DEBUG_MINOR( "vc_hostfs_readdir_r() = NULL" );
-         rewinddir(fsdir->dhandle);
-         result = NULL;
-      }
-   }
-   else
-   {
-      result = NULL;
-   }
-
-   return result;
-}
-
-/******************************************************************************
-NAME
-   vc_hostfs_remove
-
-SYNOPSIS
-   int vc_hostfs_remove(const char *path)
-
-FUNCTION
-   Removes a file or a directory. A directory must be empty before it can be
-   deleted.
-
-RETURNS
-   Successful completion: 0
-   Otherwise: -1
-******************************************************************************/
-
-int vc_hostfs_remove(const char *path)
-{
-    char *pathbuf = strdup(path);
-    int ret = -1;
-
-    DEBUG_MINOR( "vc_hostfs_remove: '%s'", path );
-
-    if (pathbuf)
-    {
-       backslash_to_slash(pathbuf);
-
-       if ( unlink( pathbuf ) == 0 )
-          ret = 0;
-    }
-
-    free(pathbuf);
-
-    return ret;
-}
-
-/******************************************************************************
-NAME
-   vc_hostfs_rename
-
-SYNOPSIS
-   int vc_hostfs_rename(const char *old, const char *new)
-
-FUNCTION
-   Changes the name of a file. The old and new pathnames must be on the same
-   physical file system.
-
-RETURNS
-   Successful completion: 0
-   Otherwise: -1
-******************************************************************************/
-
-int vc_hostfs_rename(const char *old, const char *new)
-{
-    char *oldbuf = strdup(old);
-    char *newbuf = strdup(new);
-    int ret = -1;
-
-    DEBUG_MINOR( "vc_hostfs_rename: '%s' to '%s'", old, new );
-
-    if (oldbuf && newbuf)
-    {
-       backslash_to_slash(oldbuf);
-       backslash_to_slash(newbuf);
-
-       if ( rename( oldbuf, newbuf ) == 0 )
-          ret = 0;
-    }
-
-    if (oldbuf)
-       free(oldbuf);
-
-    if (newbuf)
-       free(newbuf);
-
-    return ret;
-}
-
-/******************************************************************************
-NAME
-   vc_hostfs_set_attr
-
-SYNOPSIS
-   int vc_hostfs_set_attr(const char *path, fattributes_t attr)
-
-FUNCTION
-   Sets file/directory attributes.
-
-RETURNS
-   Successful completion: 0
-   Otherwise: -1
-******************************************************************************/
-
-int vc_hostfs_set_attr(const char *path, fattributes_t attr)
-{
-   char *pathbuf = strdup(path);
-   int ret = -1;
-
-   DEBUG_MINOR( "vc_hostfs_set_attr: '%s', %x", path, attr );
-
-   if (pathbuf)
-   {
-      mode_t mode = 0;
-      struct stat sb;
-
-      backslash_to_slash(pathbuf);
-
-      if ( stat( path, &sb ) == 0 )
-      {
-         mode = sb.st_mode;
-
-         if ( attr & ATTR_RDONLY )
-         {
-            mode &= ~S_IWUSR;
-         }
-         else
-         {
-            mode |= S_IWUSR;
-         }
-
-         /* coverity[toctou] Not doing anything security-relevant here,
-          * so the race condition is harmless */
-         if ( chmod( path, mode ) == 0 )
-            ret = 0;
-      }
-   }
-
-   if (pathbuf)
-      free(pathbuf);
-
-   return ret;
-}
-
-/******************************************************************************
-NAME
-   vc_hostfs_setend
-
-SYNOPSIS
-   int vc_hostfs_setend(int fildes)
-
-FUNCTION
-   Truncates file at current position.
-
-RETURNS
-   Successful completion: 0
-   Otherwise: -1
-******************************************************************************/
-
-int vc_hostfs_setend(int filedes)
-{
-    off_t   currPosn;
-
-    if (( currPosn = lseek( filedes, 0, SEEK_CUR )) != (off_t)-1 )
-    {
-        if ( ftruncate( filedes, currPosn ) == 0 )
-        {
-            return 0;
-        }
-    }
-   return -1;
-}
-
-
-/******************************************************************************
-NAME
-   vc_hostfs_totalspace64
-
-SYNOPSIS
-   int64_t vc_hostfs_totalspace64(const char *path)
-
-FUNCTION
-   Returns the total amount of space on the physical file system that contains
-   path.
-
-RETURNS
-   Successful completion: total space
-   Otherwise: -1
-******************************************************************************/
-
-int64_t vc_hostfs_totalspace64(const char *inPath)
-{
-   char *path = strdup( inPath );
-   int64_t ret = -1;
-   struct statfs fsStat;
-
-   // Replace all '\' with '/'
-   if (path)
-   {
-      backslash_to_slash( path );
-
-      ret = statfs( path, &fsStat );
-
-      if (ret == 0)
-      {
-         ret = fsStat.f_bsize * fsStat.f_blocks;
-      }
-      else
-      {
-         ret = -1;
-      }
-   }
-
-   DEBUG_MINOR( "vc_hostfs_totalspace for '%s' returning %" PRId64 "", path, ret );
-
-   if (path)
-      free( path );
-   return ret;
-}
-
-
-/******************************************************************************
-NAME
-   vc_hostfs_totalspace
-
-SYNOPSIS
-   int vc_hostfs_totalspace(const char *path)
-
-FUNCTION
-   Returns the total amount of space on the physical file system that contains
-   path.
-
-RETURNS
-   Successful completion: total space
-   Otherwise: -1
-******************************************************************************/
-
-int vc_hostfs_totalspace(const char *inPath)
-{
-   int ret;
-   int64_t totalSpace = vc_hostfs_totalspace64(inPath);
-
-   // Saturate return value (need this in case we have a large file system)
-   if (totalSpace > (int64_t) INT_MAX)
-   {
-      ret = INT_MAX;
-   }
-   else
-   {
-      ret = (int) totalSpace;
-   }
-   return ret;
-}
-
-/******************************************************************************
-NAME
-   backslash_to_slash
-
-SYNOPSIS
-   void backslash_to_slash( char *s )
-
-FUNCTION
-   Convert all '\' in a string to '/'.
-
-RETURNS
-   None.
-******************************************************************************/
-
-static void backslash_to_slash( char *s )
-{
-   while ( *s != '\0' )
-   {
-       if ( *s == '\\' )
-       {
-           *s = '/';
-       }
-       s++;
-   }
-}
-
-/******************************************************************************
-NAME
-   vc_hostfs_scandisk
-
-SYNOPSIS
-   void vc_hostfs_scandisk(const char *path)
-
-FUNCTION
-   Invalidates any cluster chains in the FAT that are not referenced
-   in any directory structures
-
-RETURNS
-   Void
-******************************************************************************/
-
-void vc_hostfs_scandisk(const char *path)
-{
-   (void)path;
-
-   // not yet implemented
-}
-
-
-/******************************************************************************
-NAME
-   vc_hostfs_chkdsk
-
-SYNOPSIS
-   int vc_hostfs_chkdsk(const char *path, int fix_errors)
-
-FUNCTION
-   Checks whether or not a FAT filesystem is corrupt or not. If fix_errors
-   is TRUE behaves exactly as vc_filesys_scandisk.
-
-RETURNS
-   Successful completion: 0
-   Otherwise: indicates failure
-******************************************************************************/
-
-int vc_hostfs_chkdsk(const char *path, int fix_errors)
-{
-   (void)path;
-   (void)fix_errors;
-   return 0;
-}
-
diff --git a/interface/vmcs_host/vc_fileservice_defs.h b/interface/vmcs_host/vc_fileservice_defs.h
deleted file mode 100755 (executable)
index cfcb738..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-Copyright (c) 2012, Broadcom Europe Ltd
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * 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.
-    * Neither the name of the copyright holder 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 HOLDER 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.
-*/
-
-// File service command enumeration.
-
-#ifndef VC_FILESERVICE_DEFS_H
-#define VC_FILESERVICE_DEFS_H
-
-#define VC_FILESERV_VER   1
-/* Definitions (not used by API) */
-#define FS_MAX_DATA 8192 //4096
-
-/* Protocol (not used by API) version 1.2 */
-
-enum {
-   /* Over-the-wire file open flags */
-   VC_O_RDONLY     = 0x01,
-   VC_O_WRONLY     = 0x02,
-   VC_O_RDWR            = 0x04,
-   VC_O_APPEND     = 0x08,
-   VC_O_CREAT           = 0x10,
-   VC_O_TRUNC           = 0x20,
-   VC_O_EXCL            = 0x40,
-
-   /* Request Commands (VC->Host->VC) */
-
-   /* These commands don't require a pathname */
-   VC_FILESYS_RESET      = 64,
-   VC_FILESYS_CLOSE      = 65,
-   VC_FILESYS_CLOSEDIR   = 66,
-   VC_FILESYS_LSEEK      = 67,
-   VC_FILESYS_READ       = 68,
-   VC_FILESYS_READDIR    = 69,
-   VC_FILESYS_SETEND     = 70,
-   VC_FILESYS_WRITE      = 71,
-
-   /* These commands require a pathname */
-   VC_FILESYS_FORMAT     = 72,
-   VC_FILESYS_FREESPACE  = 73,
-   VC_FILESYS_GET_ATTR   = 74,
-   VC_FILESYS_MKDIR      = 75,
-   VC_FILESYS_OPEN       = 76,
-   VC_FILESYS_OPENDIR    = 77,
-   VC_FILESYS_REMOVE     = 78,
-   VC_FILESYS_RENAME     = 79,
-   VC_FILESYS_SET_ATTR   = 80,
-   VC_FILESYS_SCANDISK   = 81,
-   VC_FILESYS_TOTALSPACE = 82,
-   VC_FILESYS_DISKWRITABLE=83,
-   VC_FILESYS_OPEN_DISK_RAW  = 84,
-   VC_FILESYS_CLOSE_DISK_RAW = 85,
-   VC_FILESYS_NUMSECTORS     = 86,
-   VC_FILESYS_READ_SECTORS   = 87,
-   VC_FILESYS_WRITE_SECTORS  = 88,
-
-   VC_FILESYS_MOUNT      = 89,
-   VC_FILESYS_UMOUNT     = 90,
-   VC_FILESYS_FSTYPE     = 91,
-
-   VC_FILESYS_READ_DIRECT = 92,
-
-   VC_FILESYS_LSEEK64     = 93,
-   VC_FILESYS_FREESPACE64 = 94,
-   VC_FILESYS_TOTALSPACE64= 95,
-   VC_FILESYS_OPEN_DISK   = 96,
-   VC_FILESYS_CLOSE_DISK  = 97,
-   
-   /* extra simple functions for mass storage testing */
-   VC_FILESYS_READ_SECTOR = 98, //1sect
-   VC_FILESYS_STREAM_SECTOR_BEGIN = 99,
-   VC_FILESYS_STREAM_SECTOR_END = 100,
-   VC_FILESYS_WRITE_SECTOR = 101,
-   VC_FILESYS_FSTAT      = 102,
-   VC_FILESYS_DIRSIZE     = 103,
-   VC_FILESYS_LIST_DIRS   = 104,
-   VC_FILESYS_LIST_FILES  = 105,
-   VC_FILESYS_NUM_DIRS    = 106,
-   VC_FILESYS_NUM_FILES   = 107,
-   VC_FILESYS_MAX_FILESIZE = 108,
-   VC_FILESYS_CHKDSK       = 109,
-};
-
-/* Parameters for lseek */
-
-#define  VC_FILESYS_SEEK_SET  0    /* Set file pointer to "offset" */
-#define  VC_FILESYS_SEEK_CUR  1    /* Set file pointer to current plus "offset" */
-#define  VC_FILESYS_SEEK_END  2    /* Set file pointer to EOF plus "offset" */
-
-/* Return values of vc_filesys_type */
-#define VC_FILESYS_FS_UNKNOWN 0
-#define VC_FILESYS_FS_FAT12 1
-#define VC_FILESYS_FS_FAT16 2
-#define VC_FILESYS_FS_FAT32 3
-
-#endif
diff --git a/interface/vmcs_host/vc_vchi_filesys.h b/interface/vmcs_host/vc_vchi_filesys.h
deleted file mode 100755 (executable)
index 393a3eb..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
-Copyright (c) 2012, Broadcom Europe Ltd
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * 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.
-    * Neither the name of the copyright holder 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 HOLDER 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.
-*/
-
-#ifndef VC_VCHI_VCFILESYS_H_
-#define VC_VCHI_VCFILESYS_H_
-
-#include "vchost_platform_config.h"
-#include "vcfilesys_defs.h"
-#include "vc_fileservice_defs.h"
-#include "interface/vchi/vchi.h"
-
-#ifndef _DIRENT_H  // This should really be in a dirent.h header to avoid conflicts
-typedef struct DIR_tag DIR;
-#endif // ifndef _DIRENT_H
-
-typedef struct {   
-   int64_t  st_size;    /* total size, in bytes  (off_t)*/      
-   uint32_t st_modtime;   /* time of last modification (time_t)*/   
-} FSTAT_T;
-
-
-VCHPRE_ int VCHPOST_  vc_vchi_filesys_init (VCHI_INSTANCE_T initialise_instance, VCHI_CONNECTION_T **connections, uint32_t num_connections );
-
-// Stop it to prevent the functions from trying to use it.
-VCHPRE_ void VCHPOST_ vc_filesys_stop(void);
-
-// Return the service number (-1 if not running).
-VCHPRE_ int VCHPOST_ vc_filesys_inum(void);
-
-// Low level file system functions equivalent to close(), lseek(), open(), read() and write()
-VCHPRE_ int VCHPOST_ vc_filesys_close(int fildes);
-
-VCHPRE_ long VCHPOST_ vc_filesys_lseek(int fildes, long offset, int whence);
-
-VCHPRE_ int64_t VCHPOST_ vc_filesys_lseek64(int fildes, int64_t offset, int whence);
-
-VCHPRE_ int VCHPOST_ vc_filesys_open(const char *path, int vc_oflag);
-
-VCHPRE_ int VCHPOST_ vc_filesys_read(int fildes, void *buf, unsigned int nbyte);
-
-VCHPRE_ int VCHPOST_ vc_filesys_write(int fildes, const void *buf, unsigned int nbyte);
-
-VCHPRE_ int VCHPOST_ vc_filesys_mount(const char *device, const char *mountpoint, const char *options);
-VCHPRE_ int VCHPOST_ vc_filesys_umount(const char *mountpoint);
-
-
-// Ends a directory listing iteration
-VCHPRE_ int VCHPOST_ vc_filesys_closedir(void *dhandle);
-
-// Formats the drive that contains the given path
-VCHPRE_ int VCHPOST_ vc_filesys_format(const char *path);
-
-// Returns the amount of free space on the drive that contains the given path
-VCHPRE_ int VCHPOST_ vc_filesys_freespace(const char *path);
-VCHPRE_ int64_t VCHPOST_ vc_filesys_freespace64(const char *path);
-
-// Gets the attributes of the named file
-VCHPRE_ int VCHPOST_ vc_filesys_get_attr(const char *path, fattributes_t *attr);
-
-// Get the file stat info struct for the specified file.
-VCHPRE_ int VCHPOST_ vc_filesys_fstat(int filedes, FSTAT_T *buf);
-
-// Creates a new directory
-VCHPRE_ int VCHPOST_ vc_filesys_mkdir(const char *path);
-
-// Starts a directory listing iteration
-VCHPRE_ void * VCHPOST_ vc_filesys_opendir(const char *dirname);
-
-// Directory listing iterator
-VCHPRE_ struct dirent * VCHPOST_ vc_filesys_readdir_r(void *dhandle, struct dirent *result);
-
-// Get the sum of the filesizes, and the number of files under the specified directory path.
-VCHPRE_ int64_t VCHPOST_ vc_filesys_dirsize(const char *path, uint32_t *num_files, uint32_t *num_dirs);
-
-// Deletes a file or (empty) directory
-VCHPRE_ int VCHPOST_ vc_filesys_remove(const char *path);
-
-// Renames a file, provided the new name is on the same file system as the old
-VCHPRE_ int VCHPOST_ vc_filesys_rename(const char *oldfile, const char *newfile);
-
-// Resets the co-processor side file system
-VCHPRE_ int VCHPOST_ vc_filesys_reset(void);
-
-// Sets the attributes of the named file
-VCHPRE_ int VCHPOST_ vc_filesys_set_attr(const char *path, fattributes_t attr);
-
-// Truncates a file at its current position
-VCHPRE_ int VCHPOST_ vc_filesys_setend(int fildes);
-
-// Returns the size of a file in bytes.
-VCHPRE_ int VCHPOST_ vc_filesys_size(const char *path);
-
-// Checks whether there are any messages in the incoming message fifo and responds to any such messages
-VCHPRE_ int VCHPOST_ vc_filesys_poll_message_fifo(void);
-
-// Return the event used to wait for reads.
-VCHPRE_ void * VCHPOST_ vc_filesys_read_event(void);
-
-// Sends a command for VC01 to reset the file system
-VCHPRE_ void VCHPOST_ vc_filesys_sendreset(void);
-
-// Return the error code of the last file system error
-VCHPRE_ int VCHPOST_ vc_filesys_errno(void);
-
-// Invalidates any cluster chains in the FAT that are not referenced in any directory structures
-VCHPRE_ void VCHPOST_ vc_filesys_scandisk(const char *path);
-
-// Checks whether or not a FAT filesystem is corrupt or not. If fix_errors is TRUE behaves exactly as vc_filesys_scandisk.
-VCHPRE_ int VCHPOST_ vc_filesys_chkdsk(const char *path, int fix_errors);
-
-// Return whether a disk is writeable or not.
-VCHPRE_ int VCHPOST_ vc_filesys_diskwritable(const char *path);
-
-// Return file system type of a disk.
-VCHPRE_ int VCHPOST_ vc_filesys_fstype(const char *path);
-
-// Returns the toatl amount of space on the drive that contains the given path
-VCHPRE_ int VCHPOST_ vc_filesys_totalspace(const char *path);
-VCHPRE_ int64_t VCHPOST_ vc_filesys_totalspace64(const char *path);
-
-// Open disk for block level access
-VCHPRE_ int VCHPOST_ vc_filesys_open_disk_raw(const char *path);
-
-// Close disk from block level access mode
-VCHPRE_ int VCHPOST_ vc_filesys_close_disk_raw(const char *path);
-
-// Open disk for normal access
-VCHPRE_ int VCHPOST_ vc_filesys_open_disk(const char *path);
-
-// Close disk for normal access
-VCHPRE_ int VCHPOST_ vc_filesys_close_disk(const char *path);
-
-// Return number of sectors.
-VCHPRE_ int VCHPOST_ vc_filesys_numsectors(const char *path);
-VCHPRE_ int64_t VCHPOST_ vc_filesys_numsectors64(const char *path);
-
-// Read/Write sectors
-VCHPRE_ int VCHPOST_ vc_filesys_read_sectors(const char *path, uint32_t sector_num, char *sectors, uint32_t num_sectors, uint32_t *sectors_read);
-VCHPRE_ int VCHPOST_ vc_filesys_write_sectors(const char *path, uint32_t sector_num, char *sectors, uint32_t num_sectors, uint32_t *sectors_written);
-
-// Begin reading sectors from VideoCore.
-VCHPRE_ int VCHPOST_ vc_filesys_read_sectors_begin(const char *path, uint32_t sector, uint32_t count);
-
-// Read the next sector.
-VCHPRE_ int VCHPOST_ vc_filesys_read_sector(char *buf);
-
-// End streaming sectors.
-VCHPRE_ int VCHPOST_ vc_filesys_read_sectors_end(uint32_t *sectors_read);
-
-// Begin writing sectors from VideoCore.
-VCHPRE_ int VCHPOST_ vc_filesys_write_sectors_begin(const char *path, uint32_t sector, uint32_t count);
-
-// Write the next sector.
-VCHPRE_ int VCHPOST_ vc_filesys_write_sector(const char *buf);
-
-// End streaming sectors.
-VCHPRE_ int VCHPOST_ vc_filesys_write_sectors_end(uint32_t *sectors_written);
-
-#endif //VCFILESYS_H_
-
diff --git a/interface/vmcs_host/vcfilesys.h b/interface/vmcs_host/vcfilesys.h
deleted file mode 100755 (executable)
index c8617cf..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
-Copyright (c) 2012, Broadcom Europe Ltd
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * 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.
-    * Neither the name of the copyright holder 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 HOLDER 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.
-*/
-
-#include "vchost_platform_config.h"
-#include "vcfilesys_defs.h"
-#include "vc_fileservice_defs.h"
-
-#ifndef VCFILESYS_H_
-#define VCFILESYS_H_
-
-#ifndef FILESYS_DIR_DEFINED
-#define  FILESYS_DIR_DEFINED
-typedef struct DIR_tag DIR;
-#endif
-
-// Initialises the file system for use
-VCHPRE_ int VCHPOST_ vc_filesys_init (void);
-
-// Stop it to prevent the functions from trying to use it.
-VCHPRE_ void VCHPOST_ vc_filesys_stop(void);
-
-// Return the service number (-1 if not running).
-VCHPRE_ int VCHPOST_ vc_filesys_inum(void);
-
-// Low level file system functions equivalent to close(), lseek(), open(), read() and write()
-VCHPRE_ int VCHPOST_ vc_filesys_close(int fildes);
-
-VCHPRE_ long VCHPOST_ vc_filesys_lseek(int fildes, long offset, int whence);
-
-VCHPRE_ int64_t VCHPOST_ vc_filesys_lseek64(int fildes, int64_t offset, int whence);
-
-VCHPRE_ int VCHPOST_ vc_filesys_open(const char *path, int vc_oflag);
-
-VCHPRE_ int VCHPOST_ vc_filesys_read(int fildes, void *buf, unsigned int nbyte);
-
-VCHPRE_ int VCHPOST_ vc_filesys_write(int fildes, const void *buf, unsigned int nbyte);
-
-VCHPRE_ int VCHPOST_ vc_filesys_mount(const char *device, const char *mountpoint, const char *options);
-VCHPRE_ int VCHPOST_ vc_filesys_umount(const char *mountpoint);
-
-
-// Ends a directory listing iteration
-VCHPRE_ int VCHPOST_ vc_filesys_closedir(void *dhandle);
-
-// Formats the drive that contains the given path
-VCHPRE_ int VCHPOST_ vc_filesys_format(const char *path);
-
-// Returns the amount of free space on the drive that contains the given path
-VCHPRE_ int VCHPOST_ vc_filesys_freespace(const char *path);
-VCHPRE_ int64_t VCHPOST_ vc_filesys_freespace64(const char *path);
-
-// Gets the attributes of the named file
-VCHPRE_ int VCHPOST_ vc_filesys_get_attr(const char *path, fattributes_t *attr);
-
-// Creates a new directory
-VCHPRE_ int VCHPOST_ vc_filesys_mkdir(const char *path);
-
-// Starts a directory listing iteration
-VCHPRE_ void * VCHPOST_ vc_filesys_opendir(const char *dirname);
-
-// Directory listing iterator
-VCHPRE_ struct dirent * VCHPOST_ vc_filesys_readdir_r(void *dhandle, struct dirent *result);
-
-// Deletes a file or (empty) directory
-VCHPRE_ int VCHPOST_ vc_filesys_remove(const char *path);
-
-// Renames a file, provided the new name is on the same file system as the old
-VCHPRE_ int VCHPOST_ vc_filesys_rename(const char *oldfile, const char *newfile);
-
-// Resets the co-processor side file system
-VCHPRE_ int VCHPOST_ vc_filesys_reset(void);
-
-// Sets the attributes of the named file
-VCHPRE_ int VCHPOST_ vc_filesys_set_attr(const char *path, fattributes_t attr);
-
-// Truncates a file at its current position
-VCHPRE_ int VCHPOST_ vc_filesys_setend(int fildes);
-
-// Checks whether there are any messages in the incoming message fifo and responds to any such messages
-VCHPRE_ int VCHPOST_ vc_filesys_poll_message_fifo(void);
-
-// Return the event used to wait for reads.
-VCHPRE_ void * VCHPOST_ vc_filesys_read_event(void);
-
-// Sends a command for VC01 to reset the file system
-VCHPRE_ void VCHPOST_ vc_filesys_sendreset(void);
-
-// Return the error code of the last file system error
-VCHPRE_ int VCHPOST_ vc_filesys_errno(void);
-
-// Invalidates any cluster chains in the FAT that are not referenced in any directory structures
-VCHPRE_ void VCHPOST_ vc_filesys_scandisk(const char *path);
-
-// Checks whether or not a FAT filesystem is corrupt or not. If fix_errors is TRUE behaves exactly as vc_filesys_scandisk.
-VCHPRE_ int VCHPOST_ vc_filesys_chkdsk(const char *path, int fix_errors);
-
-// Return whether a disk is writeable or not.
-VCHPRE_ int VCHPOST_ vc_filesys_diskwritable(const char *path);
-
-// Return file system type of a disk.
-VCHPRE_ int VCHPOST_ vc_filesys_fstype(const char *path);
-
-// Returns the toatl amount of space on the drive that contains the given path
-VCHPRE_ int VCHPOST_ vc_filesys_totalspace(const char *path);
-VCHPRE_ int64_t VCHPOST_ vc_filesys_totalspace64(const char *path);
-
-// Open disk for block level access
-VCHPRE_ int VCHPOST_ vc_filesys_open_disk_raw(const char *path);
-
-// Close disk from block level access mode
-VCHPRE_ int VCHPOST_ vc_filesys_close_disk_raw(const char *path);
-
-// Open disk for normal access
-VCHPRE_ int VCHPOST_ vc_filesys_open_disk(const char *path);
-
-// Close disk for normal access
-VCHPRE_ int VCHPOST_ vc_filesys_close_disk(const char *path);
-
-// Return number of sectors.
-VCHPRE_ int VCHPOST_ vc_filesys_numsectors(const char *path);
-VCHPRE_ int64_t VCHPOST_ vc_filesys_numsectors64(const char *path);
-
-// Begin reading sectors from VideoCore.
-VCHPRE_ int VCHPOST_ vc_filesys_read_sectors_begin(const char *path, uint32_t sector, uint32_t count);
-
-// Read the next sector.
-VCHPRE_ int VCHPOST_ vc_filesys_read_sector(char *buf);
-
-// End streaming sectors.
-VCHPRE_ int VCHPOST_ vc_filesys_read_sectors_end(uint32_t *sectors_read);
-
-// Begin writing sectors from VideoCore.
-VCHPRE_ int VCHPOST_ vc_filesys_write_sectors_begin(const char *path, uint32_t sector, uint32_t count);
-
-// Write the next sector.
-VCHPRE_ int VCHPOST_ vc_filesys_write_sector(const char *buf);
-
-// End streaming sectors.
-VCHPRE_ int VCHPOST_ vc_filesys_write_sectors_end(uint32_t *sectors_written);
-
-#endif //VCFILESYS_H_
-
index 23ffa63..e4a3798 100755 (executable)
@@ -29,9 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #define VCHOST_H
 
 #include "vchost_platform_config.h"
-#include "vcfilesys_defs.h"
 #include "interface/vcos/vcos.h" //for VCHPRE_ abd VCHPOST_ macro's for func declaration
-#include "interface/vmcs_host/vc_fileservice_defs.h" // for VC_O_XXX file definitions
 #include "interface/vchi/vchi.h"
 
 #define UNUSED_PARAMETER(x) ((void)(x))/* macro to suppress not use warning */
@@ -160,74 +158,6 @@ VCHPRE_ void VCHPOST_ vc_lock_obtain(void *lock);
 VCHPRE_ void VCHPOST_ vc_lock_release(void *lock);
 
 /*---------------------------------------------------------------------------*/
-/* File system related functions */
-/*---------------------------------------------------------------------------*/
-
-// Initialises the host dependent file system functions for use
-VCHPRE_ void VCHPOST_ vc_hostfs_init(void);
-VCHPRE_ void VCHPOST_ vc_hostfs_exit(void);
-
-// Low level file system functions equivalent to close(), lseek(), open(), read() and write()
-VCHPRE_ int VCHPOST_ vc_hostfs_close(int fildes);
-
-VCHPRE_ long VCHPOST_ vc_hostfs_lseek(int fildes, long offset, int whence);
-
-VCHPRE_ int64_t VCHPOST_ vc_hostfs_lseek64(int fildes, int64_t offset, int whence);
-
-VCHPRE_ int VCHPOST_ vc_hostfs_open(const char *path, int vc_oflag);
-
-VCHPRE_ int VCHPOST_ vc_hostfs_read(int fildes, void *buf, unsigned int nbyte);
-
-VCHPRE_ int VCHPOST_ vc_hostfs_write(int fildes, const void *buf, unsigned int nbyte);
-
-// Ends a directory listing iteration
-VCHPRE_ int VCHPOST_ vc_hostfs_closedir(void *dhandle);
-
-// Formats the drive that contains the given path
-VCHPRE_ int VCHPOST_ vc_hostfs_format(const char *path);
-
-// Returns the amount of free space on the drive that contains the given path
-VCHPRE_ int VCHPOST_ vc_hostfs_freespace(const char *path);
-VCHPRE_ int64_t VCHPOST_ vc_hostfs_freespace64(const char *path);
-
-// Gets the attributes of the named file
-VCHPRE_ int VCHPOST_ vc_hostfs_get_attr(const char *path, fattributes_t *attr);
-
-// Creates a new directory
-VCHPRE_ int VCHPOST_ vc_hostfs_mkdir(const char *path);
-
-// Starts a directory listing iteration
-VCHPRE_ void * VCHPOST_ vc_hostfs_opendir(const char *dirname);
-
-// Directory listing iterator
-VCHPRE_ struct dirent * VCHPOST_ vc_hostfs_readdir_r(void *dhandle, struct dirent *result);
-
-// Deletes a file or (empty) directory
-VCHPRE_ int VCHPOST_ vc_hostfs_remove(const char *path);
-
-// Renames a file, provided the new name is on the same file system as the old
-VCHPRE_ int VCHPOST_ vc_hostfs_rename(const char *oldfile, const char *newfile);
-
-// Sets the attributes of the named file
-VCHPRE_ int VCHPOST_ vc_hostfs_set_attr(const char *path, fattributes_t attr);
-
-// Truncates a file at its current position
-VCHPRE_ int VCHPOST_ vc_hostfs_setend(int fildes);
-
-// Returns the total amount of space on the drive that contains the given path
-VCHPRE_ int VCHPOST_ vc_hostfs_totalspace(const char *path);
-VCHPRE_ int64_t VCHPOST_ vc_hostfs_totalspace64(const char *path);
-
-// Return millisecond resolution system time, only used for differences
-VCHPRE_ int VCHPOST_ vc_millitime(void);
-
-// Invalidates any cluster chains in the FAT that are not referenced in any directory structures
-VCHPRE_ void VCHPOST_ vc_hostfs_scandisk(const char *path);
-
-// Checks whether or not a FAT filesystem is corrupt or not. If fix_errors is TRUE behaves exactly as vc_filesys_scandisk.
-VCHPRE_ int VCHPOST_ vc_hostfs_chkdsk(const char *path, int fix_errors);
-
-/*---------------------------------------------------------------------------*/
 /* These functions only need to be implemented for the test system. */
 /*---------------------------------------------------------------------------*/