OSDN Git Service

Remove unused "file system" concept & friends
authorZach Johnson <zachoverflow@google.com>
Fri, 5 Sep 2014 06:05:55 +0000 (23:05 -0700)
committerAndre Eisenbach <eisenbach@google.com>
Mon, 16 Mar 2015 23:51:32 +0000 (16:51 -0700)
Not actually ever used in the code, beyond importing some
header files and not calling any of their functions.

bta/Android.mk
bta/fs/bta_fs_cfg.c [deleted file]
bta/fs/bta_fs_ci.c [deleted file]
bta/hl/bta_hl_utils.c
bta/include/bta_fs_api.h [deleted file]
bta/include/bta_fs_ci.h [deleted file]
bta/include/bta_fs_co.h [deleted file]
btif/co/bta_fs_co.c [deleted file]
include/bt_target.h
main/Android.mk

index b9232e1..54ad12d 100644 (file)
@@ -52,8 +52,6 @@ LOCAL_SRC_FILES:= \
     ./hh/bta_hh_utils.c \
     ./hh/bta_hh_main.c \
     ./pb/bta_pbs_cfg.c \
-    ./fs/bta_fs_ci.c \
-    ./fs/bta_fs_cfg.c \
     ./pan/bta_pan_main.c \
     ./pan/bta_pan_ci.c \
     ./pan/bta_pan_act.c \
diff --git a/bta/fs/bta_fs_cfg.c b/bta/fs/bta_fs_cfg.c
deleted file mode 100644 (file)
index 0bfffcd..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/******************************************************************************
- *
- *  Copyright (C) 2003-2012 Broadcom Corporation
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at:
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- *  This file contains compile-time configurable constants for the BTA File
- *  System.
- *
- ******************************************************************************/
-
-#include "bt_target.h"
-#include "bta_fs_api.h"
-
-/* Character used as path separator */
-#ifndef BTA_FS_PATH_SEPARATOR
-#define BTA_FS_PATH_SEPARATOR   ((char) 0x2f)   /* 0x2f ('/'), or 0x5c ('\') */
-#endif
-
-/* Maximum path length supported by MMI */
-#ifndef BTA_FS_PATH_LEN
-#define BTA_FS_PATH_LEN         294
-#endif
-
-#ifndef BTA_FS_FILE_LEN
-#define BTA_FS_FILE_LEN         256
-#endif
-
-const tBTA_FS_CFG bta_fs_cfg =
-{
-    BTA_FS_FILE_LEN,
-    BTA_FS_PATH_LEN,
-    BTA_FS_PATH_SEPARATOR
-};
-
-tBTA_FS_CFG *p_bta_fs_cfg = (tBTA_FS_CFG *)&bta_fs_cfg;
-
diff --git a/bta/fs/bta_fs_ci.c b/bta/fs/bta_fs_ci.c
deleted file mode 100644 (file)
index 589a591..0000000
+++ /dev/null
@@ -1,280 +0,0 @@
-/******************************************************************************
- *
- *  Copyright (C) 2003-2012 Broadcom Corporation
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at:
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- *  This is the implementation file for the file system call-in functions.
- *
- ******************************************************************************/
-#include <string.h>
-
-#include "bta_api.h"
-#include "bta_sys.h"
-#include "bta_fs_ci.h"
-#include "gki.h"
-#include "bd.h"
-
-/*******************************************************************************
-**
-** Function         bta_fs_ci_write
-**
-** Description      This function sends an event to IO indicating the phone
-**                  has written the number of bytes specified in the call-out
-**                  function, bta_fs_co_write(), and is ready for more data.
-**                  This function is used to control the TX data flow.
-**                  Note: The data buffer is released by the stack after
-**                        calling this function.
-**
-** Parameters       fd - file descriptor passed to the stack in the
-**                       bta_fs_ci_open call-in function.
-**                  status - BTA_FS_CO_OK or BTA_FS_CO_FAIL
-**
-** Returns          void
-**
-*******************************************************************************/
-void bta_fs_ci_write(int fd, tBTA_FS_CO_STATUS status, UINT16 evt)
-{
-    tBTA_FS_CI_WRITE_EVT  *p_evt;
-
-    if ((p_evt = (tBTA_FS_CI_WRITE_EVT *) GKI_getbuf(sizeof(tBTA_FS_CI_WRITE_EVT))) != NULL)
-    {
-        p_evt->hdr.event = evt;
-        p_evt->fd = fd;
-        p_evt->status = status;
-
-        bta_sys_sendmsg(p_evt);
-    }
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_ci_read
-**
-** Description      This function sends an event to BTA indicating the phone has
-**                  read in the requested amount of data specified in the
-**                  bta_fs_co_read() call-out function.  It should only be called
-**                  when the requested number of bytes has been read in, or after
-**                  the end of the file has been detected.
-**
-** Parameters       fd - file descriptor passed to the stack in the
-**                       bta_fs_ci_open call-in function.
-**                  num_bytes_read - number of bytes read into the buffer
-**                      specified in the read callout-function.
-**                  status - BTA_FS_CO_OK if full buffer of data,
-**                           BTA_FS_CO_EOF if the end of file has been reached,
-**                           BTA_FS_CO_FAIL if an error has occurred.
-**
-** Returns          void
-**
-*******************************************************************************/
-void bta_fs_ci_read(int fd, UINT16 num_bytes_read, tBTA_FS_CO_STATUS status, UINT16 evt)
-{
-    tBTA_FS_CI_READ_EVT  *p_evt;
-
-    if ((p_evt = (tBTA_FS_CI_READ_EVT *) GKI_getbuf(sizeof(tBTA_FS_CI_READ_EVT))) != NULL)
-    {
-        p_evt->hdr.event = evt;
-        p_evt->fd        = fd;
-        p_evt->status    = status;
-        p_evt->num_read  = num_bytes_read;
-
-        bta_sys_sendmsg(p_evt);
-    }
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_ci_open
-**
-** Description      This function sends an event to BTA indicating the phone has
-**                  finished opening a file for reading or writing.
-**
-** Parameters       fd - file descriptor passed to the stack in the
-**                       bta_fs_ci_open call-in function.
-**                  status - BTA_FS_CO_OK if file was opened in mode specified
-**                                          in the call-out function.
-**                           BTA_FS_CO_EACCES if the file exists, but contains
-**                                          the wrong access permissions.
-**                           BTA_FS_CO_FAIL if any other error has occurred.
-**                  file_size - The total size of the file
-**                  evt - Used Internally by BTA -> MUST be same value passed
-**                       in call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-void bta_fs_ci_open(int fd, tBTA_FS_CO_STATUS status, UINT32 file_size, UINT16 evt)
-{
-    tBTA_FS_CI_OPEN_EVT  *p_evt;
-
-    if ((p_evt = (tBTA_FS_CI_OPEN_EVT *) GKI_getbuf(sizeof(tBTA_FS_CI_OPEN_EVT))) != NULL)
-    {
-        p_evt->hdr.event = evt;
-        p_evt->fd        = fd;
-        p_evt->status    = status;
-        p_evt->file_size = file_size;
-        p_evt->p_file    = NULL;
-
-        bta_sys_sendmsg(p_evt);
-    }
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_ci_direntry
-**
-** Description      This function is called in response to the
-**                  bta_fs_co_getdirentry call-out function.
-**
-** Parameters       status - BTA_FS_CO_OK if p_entry points to a valid entry.
-**                           BTA_FS_CO_EODIR if no more entries (p_entry is ignored).
-**                           BTA_FS_CO_FAIL if any errors have occurred.
-**
-** Returns          void
-**
-*******************************************************************************/
-void bta_fs_ci_direntry(tBTA_FS_CO_STATUS status, UINT16 evt)
-{
-    tBTA_FS_CI_GETDIR_EVT  *p_evt;
-
-    if ((p_evt = (tBTA_FS_CI_GETDIR_EVT *)GKI_getbuf(sizeof(tBTA_FS_CI_GETDIR_EVT))) != NULL)
-    {
-        p_evt->hdr.event = evt;
-        p_evt->status = status;
-        bta_sys_sendmsg(p_evt);
-    }
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_ci_resume
-**
-** Description      This function is called in response to the
-**                  bta_fs_co_resume call-out function.
-**
-** Parameters       p_sess_info - the stored session ID and related information.
-**                  timeout - the timeout for this suspended session.
-**                  ssn     - the stored session sequence number.
-**                  info    - the stored BTA specific information (like last active operation).
-**                  status  - BTA_FS_CO_OK if p_entry points to a valid entry.
-**                            BTA_FS_CO_FAIL if any errors have occurred.
-**                  evt - Used Internally by BTA -> MUST be same value passed
-**                       in call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-void bta_fs_ci_resume (BD_ADDR_PTR p_addr, UINT8 *p_sess_info,
-                       UINT32 timeout, UINT32 offset, UINT8 ssn, UINT8 info,
-                       tBTA_FS_CO_STATUS status, UINT16 evt)
-{
-    tBTA_FS_CI_RESUME_EVT  *p_evt;
-    UINT16  size = sizeof(tBTA_FS_CI_RESUME_EVT) + sizeof(BD_ADDR);
-
-    if ((p_evt = (tBTA_FS_CI_RESUME_EVT *)GKI_getbuf(size)) != NULL)
-    {
-        p_evt->p_addr       = NULL;
-        if (p_addr != NULL)
-        {
-            p_evt->p_addr   = (BD_ADDR_PTR)(p_evt + 1);
-            bdcpy(p_evt->p_addr, p_addr);
-        }
-        p_evt->hdr.event    = evt;
-        p_evt->p_sess_info  = p_sess_info;
-        p_evt->timeout      = timeout;
-        p_evt->offset       = offset;
-        p_evt->ssn          = ssn;
-        p_evt->info         = info;
-        p_evt->status       = status;
-        bta_sys_sendmsg(p_evt);
-    }
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_ci_action
-**
-** Description      This function is called in response to one of the action
-**                  call-out functions: bta_fs_co_copy, bta_fs_co_rename or
-**                  bta_fs_co_set_perms.
-**
-** Parameters       status  - BTA_FS_CO_OK if the action is succession.
-**                            BTA_FS_CO_FAIL if any errors have occurred.
-**                  evt - Used Internally by BTA -> MUST be same value passed
-**                       in call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-void bta_fs_ci_action(tBTA_FS_CO_STATUS status, UINT16 evt)
-{
-    tBTA_FS_CI_ACTION_EVT  *p_evt;
-
-    if ((p_evt = (tBTA_FS_CI_ACTION_EVT *) GKI_getbuf(sizeof(tBTA_FS_CI_ACTION_EVT))) != NULL)
-    {
-        p_evt->hdr.event = evt;
-        p_evt->status    = status;
-
-        bta_sys_sendmsg(p_evt);
-    }
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_ci_resume_op
-**
-** Description      This function sends an event to BTA indicating the phone has
-**                  finished opening a file for reading or writing on resume.
-**
-** Parameters       fd - file descriptor passed to the stack in the
-**                       bta_fs_ci_open call-in function.
-**                  status - BTA_FS_CO_OK if file was opened in mode specified
-**                                          in the call-out function.
-**                           BTA_FS_CO_EACCES if the file exists, but contains
-**                                          the wrong access permissions.
-**                           BTA_FS_CO_FAIL if any other error has occurred.
-**                  p_file - The file name associated with fd
-**                  file_size - The total size of the file
-**                  evt - Used Internally by BTA -> MUST be same value passed
-**                       in call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-void bta_fs_ci_resume_op(int fd, tBTA_FS_CO_STATUS status, const char *p_file,
-                         UINT32 file_size, UINT16 evt)
-{
-    tBTA_FS_CI_OPEN_EVT  *p_evt;
-    UINT16  file_len = strlen(p_file) + 1;
-    UINT16  size = sizeof(tBTA_FS_CI_OPEN_EVT) + file_len;
-    char *p;
-
-    if ((p_evt = (tBTA_FS_CI_OPEN_EVT *) GKI_getbuf(size)) != NULL)
-    {
-        p_evt->hdr.event = evt;
-        p_evt->fd        = fd;
-        p_evt->status    = status;
-        p_evt->file_size = file_size;
-        p   = (char *)(p_evt + 1);
-        BCM_STRNCPY_S (p, file_len, p_file, file_len-1);
-        p[file_len] = '\0';
-        p_evt->p_file    = (const char *)p;
-
-        bta_sys_sendmsg(p_evt);
-    }
-}
index 3a5df45..ea49fa5 100644 (file)
@@ -33,7 +33,6 @@
 #include "gki.h"
 #include "utl.h"
 #include "bd.h"
-#include "bta_fs_api.h"
 #include "bta_hl_int.h"
 #include "bta_hl_co.h"
 #include "mca_defs.h"
diff --git a/bta/include/bta_fs_api.h b/bta/include/bta_fs_api.h
deleted file mode 100644 (file)
index a3c34e0..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/******************************************************************************
- *
- *  Copyright (C) 2003-2012 Broadcom Corporation
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at:
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- *  This is the public interface file for the file system of BTA, Broadcom's
- *  Bluetooth application layer for mobile phones.
- *
- ******************************************************************************/
-#ifndef BTA_FS_API_H
-#define BTA_FS_API_H
-
-#include "bta_api.h"
-
-/*****************************************************************************
-**  Constants and data types
-*****************************************************************************/
-
-/* Configuration structure */
-typedef struct
-{
-    UINT16  max_file_len;           /* Maximum size file name */
-    UINT16  max_path_len;           /* Maximum path length (includes appended file name) */
-    char    path_separator;         /* 0x2f ('/'), or 0x5c ('\') */
-} tBTA_FS_CFG;
-
-extern tBTA_FS_CFG * p_bta_fs_cfg;
-
-#endif /* BTA_FS_API_H */
diff --git a/bta/include/bta_fs_ci.h b/bta/include/bta_fs_ci.h
deleted file mode 100644 (file)
index e2b5093..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-/******************************************************************************
- *
- *  Copyright (C) 2003-2012 Broadcom Corporation
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at:
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- *  This is the interface file for file system call-in functions.
- *
- ******************************************************************************/
-#ifndef BTA_FS_CI_H
-#define BTA_FS_CI_H
-
-#include "bta_fs_co.h"
-
-/*****************************************************************************
-**  Constants and data types
-*****************************************************************************/
-
-/* Open Complete Event */
-typedef struct
-{
-    BT_HDR            hdr;
-    tBTA_FS_CO_STATUS status;
-    UINT32            file_size;
-    int               fd;
-    const char        *p_file;
-} tBTA_FS_CI_OPEN_EVT;
-
-/* Read Ready Event */
-typedef struct
-{
-    BT_HDR            hdr;
-    tBTA_FS_CO_STATUS status;
-    int               fd;
-    UINT16            num_read;
-} tBTA_FS_CI_READ_EVT;
-
-/* Write Ready Event */
-typedef struct
-{
-    BT_HDR            hdr;
-    tBTA_FS_CO_STATUS status;
-    int               fd;
-} tBTA_FS_CI_WRITE_EVT;
-
-/* Get Directory Entry Event */
-typedef struct
-{
-    BT_HDR            hdr;
-    tBTA_FS_CO_STATUS status;
-} tBTA_FS_CI_GETDIR_EVT;
-
-/* Resume Information Event */
-typedef struct
-{
-    BT_HDR            hdr;
-    tBTA_FS_CO_STATUS status;
-    BD_ADDR_PTR       p_addr;
-    UINT8             *p_sess_info;
-    UINT32            timeout;
-    UINT32            offset;
-    UINT8             ssn;
-    UINT8             info;
-} tBTA_FS_CI_RESUME_EVT;
-
-/* Action Complete Event */
-typedef struct
-{
-    BT_HDR            hdr;
-    tBTA_FS_CO_STATUS status;
-} tBTA_FS_CI_ACTION_EVT;
-
-
-/*****************************************************************************
-**  Function Declarations
-*****************************************************************************/
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/*******************************************************************************
-**
-** Function         bta_fs_ci_write
-**
-** Description      This function sends an event to BTA indicating the phone
-**                  has written the number of bytes specified in the call-out
-**                  function, bta_fs_co_write(), and is ready for more data.
-**                  This function is used to control the TX data flow.
-**                  Note: The data buffer is released by the stack aioer
-**                        calling this function.
-**
-** Parameters       fd - file descriptor passed to the stack in the
-**                       bta_fs_ci_open call-in function.
-**                  status - BTA_FS_CO_OK, BTA_FS_CO_NOSPACE, or BTA_FS_CO_FAIL
-**                  evt - Used Internally by BTA -> MUST be same value passed
-**                       in call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_ci_write(int fd, tBTA_FS_CO_STATUS status, UINT16 evt);
-
-/*******************************************************************************
-**
-** Function         bta_fs_ci_read
-**
-** Description      This function sends an event to BTA indicating the phone has
-**                  read in the requested amount of data specified in the
-**                  bta_fs_co_read() call-out function.  It should only be called
-**                  when the requested number of bytes has been read in, or aioer
-**                  the end of the file has been detected.
-**
-** Parameters       fd - file descriptor passed to the stack in the
-**                       bta_fs_ci_open call-in function.
-**                  num_bytes_read - number of bytes read into the buffer
-**                      specified in the read callout-function.
-**                  status - BTA_FS_CO_OK if full buffer of data,
-**                           BTA_FS_CO_EOF if the end of file has been reached,
-**                           BTA_FS_CO_FAIL if an error has occurred.
-**                  evt - Used Internally by BTA -> MUST be same value passed
-**                       in call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_ci_read(int fd, UINT16 num_bytes_read,
-                                   tBTA_FS_CO_STATUS status, UINT16 evt);
-
-/*******************************************************************************
-**
-** Function         bta_fs_ci_open
-**
-** Description      This function sends an event to BTA indicating the phone has
-**                  finished opening a file for reading or writing.
-**
-** Parameters       fd - file descriptor passed to the stack in the
-**                       bta_fs_ci_open call-in function.
-**                  status - BTA_FS_CO_OK if file was opened in mode specified
-**                                          in the call-out function.
-**                           BTA_FS_CO_EACCES if the file exists, but contains
-**                                          the wrong access permissions.
-**                           BTA_FS_CO_FAIL if any other error has occurred.
-**                  file_size - The total size of the file
-**                  evt - Used Internally by BTA -> MUST be same value passed
-**                       in call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_ci_open(int fd, tBTA_FS_CO_STATUS status,
-                                   UINT32 file_size, UINT16 evt);
-
-/*******************************************************************************
-**
-** Function         bta_fs_ci_direntry
-**
-** Description      This function is called in response to the
-**                  bta_fs_co_getdirentry call-out function.
-**
-** Parameters       status - BTA_FS_CO_OK if p_entry points to a valid entry.
-**                           BTA_FS_CO_EODIR if no more entries (p_entry is ignored).
-**                           BTA_FS_CO_FAIL if any errors have occurred.
-**                  evt - Used Internally by BTA -> MUST be same value passed
-**                       in call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_ci_direntry(tBTA_FS_CO_STATUS status, UINT16 evt);
-
-/*******************************************************************************
-**
-** Function         bta_fs_ci_resume
-**
-** Description      This function is called in response to the
-**                  bta_fs_co_resume call-out function.
-**
-** Parameters       p_sess_info - the stored session ID and related information.
-**                  ssn     - the stored session sequence number.
-**                  info    - the stored BTA specific information (like last active operation).
-**                  status  - BTA_FS_CO_OK if p_entry points to a valid entry.
-**                            BTA_FS_CO_FAIL if any errors have occurred.
-**                  evt - Used Internally by BTA -> MUST be same value passed
-**                       in call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_ci_resume (BD_ADDR_PTR p_addr, UINT8 *p_sess_info,
-                                      UINT32 timeout, UINT32 offset, UINT8 ssn, UINT8 info,
-                                      tBTA_FS_CO_STATUS status, UINT16 evt);
-
-/*******************************************************************************
-**
-** Function         bta_fs_ci_action
-**
-** Description      This function is called in response to one of the action
-**                  call-out functions: bta_fs_co_copy, bta_fs_co_rename or
-**                  bta_fs_co_set_perms.
-**
-** Parameters       status  - BTA_FS_CO_OK if the action is succession.
-**                            BTA_FS_CO_FAIL if any errors have occurred.
-**                  evt - Used Internally by BTA -> MUST be same value passed
-**                       in call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_ci_action(tBTA_FS_CO_STATUS status, UINT16 evt);
-
-/*******************************************************************************
-**
-** Function         bta_fs_ci_resume_op
-**
-** Description      This function sends an event to BTA indicating the phone has
-**                  finished opening a file for reading or writing on resume.
-**
-** Parameters       fd - file descriptor passed to the stack in the
-**                       bta_fs_ci_open call-in function.
-**                  status - BTA_FS_CO_OK if file was opened in mode specified
-**                                          in the call-out function.
-**                           BTA_FS_CO_EACCES if the file exists, but contains
-**                                          the wrong access permissions.
-**                           BTA_FS_CO_FAIL if any other error has occurred.
-**                  p_file - The file name associated with fd
-**                  file_size - The total size of the file
-**                  evt - Used Internally by BTA -> MUST be same value passed
-**                       in call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_ci_resume_op(int fd, tBTA_FS_CO_STATUS status, const char *p_file,
-                                        UINT32 file_size, UINT16 evt);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BTA_FS_CI_H */
-
diff --git a/bta/include/bta_fs_co.h b/bta/include/bta_fs_co.h
deleted file mode 100644 (file)
index 7ab16fa..0000000
+++ /dev/null
@@ -1,703 +0,0 @@
-/******************************************************************************
- *
- *  Copyright (C) 2003-2012 Broadcom Corporation
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at:
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- *  This is the interface file for the synchronization server call-out
- *  functions.
- *
- ******************************************************************************/
-#ifndef BTA_FS_CO_H
-#define BTA_FS_CO_H
-
-#include <time.h>
-
-#include "bta_api.h"
-#include "goep_fs.h"
-#include "obx_api.h"
-
-/*****************************************************************************
-**  Constants and Data Types
-*****************************************************************************/
-
-#ifndef BTA_FS_CO_MAX_SSN_ENTRIES
-#define BTA_FS_CO_MAX_SSN_ENTRIES   10
-#endif
-
-/* Maximum path length supported by FS_CO */
-#ifndef BTA_FS_CO_PATH_LEN
-#define BTA_FS_CO_PATH_LEN          294
-#endif
-
-#ifndef BTA_FS_CO_TEST_ROOT
-#define BTA_FS_CO_TEST_ROOT         "test_files"
-#endif
-
-#define BTA_FS_CO_TEST_TYPE_NONE    0
-#define BTA_FS_CO_TEST_TYPE_REJECT  1
-#define BTA_FS_CO_TEST_TYPE_SUSPEND 2
-
-#ifndef BTA_FS_CO_TEST_AB_END
-#define BTA_FS_CO_TEST_AB_END   BTA_FS_CO_TEST_TYPE_NONE
-#endif
-
-/**************************
-**  Common Definitions
-***************************/
-
-/* Status codes returned by call-out functions, or in call-in functions as status */
-#define BTA_FS_CO_OK            GOEP_OK
-#define BTA_FS_CO_FAIL          GOEP_FAIL   /* Used to pass all other errors */
-#define BTA_FS_CO_EACCES        GOEP_EACCES
-#define BTA_FS_CO_ENOTEMPTY     GOEP_ENOTEMPTY
-#define BTA_FS_CO_EOF           GOEP_EOF
-#define BTA_FS_CO_EODIR         GOEP_EODIR
-#define BTA_FS_CO_ENOSPACE      GOEP_ENOSPACE/* Returned in bta_fs_ci_open if no room */
-#define BTA_FS_CO_EIS_DIR       GOEP_EIS_DIR
-#define BTA_FS_CO_RESUME        GOEP_RESUME /* used in ci_open, on resume */
-#define BTA_FS_CO_NONE          GOEP_NONE /* used in ci_open, on resume (no file to resume) */
-
-typedef UINT16 tBTA_FS_CO_STATUS;
-
-/* the index to the permission flags */
-#define BTA_FS_PERM_USER    0
-#define BTA_FS_PERM_GROUP   1
-#define BTA_FS_PERM_OTHER   2
-/* max number of the permission flags */
-#define BTA_FS_PERM_SIZE    3
-
-/* Flags passed to the open function (bta_fs_co_open)
-**      Values are OR'd together. (First 3 are
-**      mutually exclusive.
-*/
-#define BTA_FS_O_RDONLY         GOEP_O_RDONLY
-#define BTA_FS_O_WRONLY         GOEP_O_WRONLY
-#define BTA_FS_O_RDWR           GOEP_O_RDWR
-
-#define BTA_FS_O_CREAT          GOEP_O_CREAT
-#define BTA_FS_O_EXCL           GOEP_O_EXCL
-#define BTA_FS_O_TRUNC          GOEP_O_TRUNC
-
-#define BTA_FS_O_MODE_MASK(x)      (((UINT16)(x)) & 0x0003)
-
-/* Origin for the bta_fs_co_seek function  */
-#define BTA_FS_SEEK_SET         GOEP_SEEK_SET
-#define BTA_FS_SEEK_CUR         GOEP_SEEK_CUR
-#define BTA_FS_SEEK_END         GOEP_SEEK_END
-
-/* mode field in bta_fs_co_access callout */
-#define BTA_FS_ACC_EXIST        GOEP_ACC_EXIST
-#define BTA_FS_ACC_READ         GOEP_ACC_READ
-#define BTA_FS_ACC_RDWR         GOEP_ACC_RDWR
-
-#define BTA_FS_LEN_UNKNOWN      GOEP_LEN_UNKNOWN
-#define BTA_FS_INVALID_FD       GOEP_INVALID_FD
-#define BTA_FS_INVALID_APP_ID   (0xFF)  /* this app_id is reserved */
-
-/* mode field in tBTA_FS_DIRENTRY (OR'd together) */
-#define BTA_FS_A_RDONLY         GOEP_A_RDONLY
-#define BTA_FS_A_DIR            GOEP_A_DIR      /* Entry is a sub directory */
-
-#define BTA_FS_CTIME_LEN        GOEP_CTIME_LEN  /* Creation time "yyyymmddTHHMMSSZ" */
-
-/* Return structure type for a directory entry */
-typedef struct
-{
-    UINT32  refdata;            /* holder for OS specific data used to get next entry */
-    UINT32  filesize;
-    char    crtime[BTA_FS_CTIME_LEN]; /* "yyyymmddTHHMMSSZ", or "" if none */
-    char    *p_name;            /* Contains the addr of memory to copy name into */
-    UINT8   mode;               /* BTA_FS_A_RDONLY and/or BTA_FS_A_DIR */
-} tBTA_FS_DIRENTRY;
-
-/* session state */
-enum
-{
-    BTA_FS_CO_SESS_ST_NONE,
-    BTA_FS_CO_SESS_ST_ACTIVE,
-    BTA_FS_CO_SESS_ST_SUSPEND,
-    BTA_FS_CO_SESS_ST_RESUMING
-};
-typedef UINT8   tBTA_FS_CO_SESS_ST;
-
-
-
-/* a data type to keep an array of ssn/file offset - the info can be saved to NV */
-typedef struct
-{
-    char        path[BTA_FS_CO_PATH_LEN + 1];   /* the "current path". path[0]==0-> root */
-    char        file[BTA_FS_CO_PATH_LEN + 1];   /* file[0] !=0 on resume -> the previous suspended session had opened files */
-    int         oflags;  /* the flag to open the file */
-    BD_ADDR     bd_addr;
-    UINT8       sess_info[OBX_SESSION_INFO_SIZE];
-    UINT32      offset;         /* last file offset */
-    UINT32      timeout;        /* the timeout value on suspend */
-    time_t      suspend_time;   /* the time of suspend */
-    UINT16      nbytes;         /* number of bytes for last read/write */
-    UINT8       ssn;
-    UINT8       info;           /* info for BTA on the client side */
-    UINT8       app_id;
-    tBTA_FS_CO_SESS_ST  sess_st;
-} tBTA_FS_CO_SESSION;
-
-/*****************************************************************************
-**  Function Declarations
-*****************************************************************************/
-/**************************
-**  Common Functions
-***************************/
-/*******************************************************************************
-**
-** Function         bta_fs_co_init
-**
-** Description      This function is executed as a part of the start up sequence
-**                  to make sure the control block is initialized.
-**
-** Parameters       void.
-**
-** Returns          void
-**
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_co_init(void);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_open
-**
-** Description      This function is executed by BTA when a file is opened.
-**                  The phone uses this function to open
-**                  a file for reading or writing.
-**
-** Parameters       p_path  - Fully qualified path and file name.
-**                  oflags  - permissions and mode (see constants above)
-**                  size    - size of file to put (0 if unavailable or not applicable)
-**                  evt     - event that must be passed into the call-in function.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-**                  Note: Upon completion of the request, a file descriptor (int),
-**                        if successful, and an error code (tBTA_FS_CO_STATUS)
-**                        are returned in the call-in function, bta_fs_ci_open().
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_co_open(const char *p_path, int oflags, UINT32 size,
-                           UINT16 evt, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_session_info
-**
-** Description      This function is executed by BTA when a reliable session is
-**                  established (p_sess_info != NULL) or ended (p_sess_info == NULL).
-**
-** Parameters       bd_addr     - the peer address
-**                  p_sess_info - the session ID and related information.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_co_session_info(BD_ADDR bd_addr, UINT8 *p_sess_info, UINT8 ssn,
-                                           tBTA_FS_CO_SESS_ST new_st, char *p_path, UINT8 *p_info, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_resume_op
-**
-** Description      This function is executed by BTA when a reliable session is
-**                  resumed and there was an interrupted operation.
-**
-** Parameters       offset  - the session ID and related information.
-**                  evt     - event that must be passed into the call-in function.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_co_resume_op(UINT32 offset, UINT16 evt, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_suspend
-**
-** Description      This function is executed by BTA when a reliable session is
-**                  suspended.
-**
-** Parameters       bd_addr - the peer address
-**                  ssn     - the session sequence number.
-**                  info    - the BTA specific information (like last active operation).
-**                  p_offset- the location to receive object offset of the suspended session
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_co_suspend(BD_ADDR bd_addr, UINT8 *p_sess_info, UINT8 ssn,
-                                      UINT32 *p_timeout, UINT32 *p_offset, UINT8 info, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_resume
-**
-** Description      This function is executed by BTA when resuming a session.
-**                  This is used to retrieve the session ID and related information
-**
-** Parameters       evt     - event that must be passed into the call-in function.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-**                  Note: Upon completion of the request, the related session information,
-**                        if successful, and an error code (tBTA_FS_CO_STATUS)
-**                        are returned in the call-in function, bta_fs_ci_resume().
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_co_resume(UINT16 evt, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_sess_ssn
-**
-** Description      This function is executed by BTA when resuming a session.
-**                  This is used to inform call-out module if the ssn/file offset
-**                  needs to be adjusted.
-**
-** Parameters       ssn     - the session sequence number of the first request
-**                            after resume.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_co_sess_ssn(int fd, UINT8 ssn, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_setdir
-**
-** Description      This function is executed by BTA when the server changes the
-**                  local path
-**
-** Parameters       p_path  - the new path.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_co_setdir(const char *p_path, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_close
-**
-** Description      This function is called by BTA when a connection to a
-**                  client is closed.
-**
-** Parameters       fd      - file descriptor of file to close.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          (tBTA_FS_CO_STATUS) status of the call.
-**                      [BTA_FS_CO_OK if successful],
-**                      [BTA_FS_CO_FAIL if failed  ]
-**
-*******************************************************************************/
-BTA_API extern tBTA_FS_CO_STATUS bta_fs_co_close(int fd, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_read
-**
-** Description      This function is called by BTA to read in data from the
-**                  previously opened file on the phone.
-**
-** Parameters       fd      - file descriptor of file to read from.
-**                  p_buf   - buffer to read the data into.
-**                  nbytes  - number of bytes to read into the buffer.
-**                  evt     - event that must be passed into the call-in function.
-**                  ssn     - session sequence number. Ignored, if bta_fs_co_open
-**                                                       was not called with BTA_FS_CO_RELIABLE.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-**                  Note: Upon completion of the request, bta_fs_ci_read() is
-**                        called with the buffer of data, along with the number
-**                        of bytes read into the buffer, and a status.  The
-**                        call-in function should only be called when ALL requested
-**                        bytes have been read, the end of file has been detected,
-**                        or an error has occurred.
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_co_read(int fd, UINT8 *p_buf, UINT16 nbytes, UINT16 evt,
-                           UINT8 ssn, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_write
-**
-** Description      This function is called by io to send file data to the
-**                  phone.
-**
-** Parameters       fd      - file descriptor of file to write to.
-**                  p_buf   - buffer to read the data from.
-**                  nbytes  - number of bytes to write out to the file.
-**                  evt     - event that must be passed into the call-in function.
-**                  ssn     - session sequence number. Ignored, if bta_fs_co_open
-**                                                       was not called with BTA_FS_CO_RELIABLE.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-**                  Note: Upon completion of the request, bta_fs_ci_write() is
-**                        called with the file descriptor and the status.  The
-**                        call-in function should only be called when ALL requested
-**                        bytes have been written, or an error has been detected,
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_co_write(int fd, const UINT8 *p_buf, UINT16 nbytes, UINT16 evt,
-                            UINT8 ssn, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_seek
-**
-** Description      This function is called by io to move the file pointer
-**                  of a previously opened file to the specified location for
-**                  the next read or write operation.
-**
-** Parameters       fd      - file descriptor of file.
-**                  offset  - Number of bytes from origin.
-**                  origin  - Initial position: BTA_FS_SEEK_SET, BTA_FS_SEEK_CUR,
-**                            or BTA_FS_SEEK_END.
-**
-** Returns          void
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_co_seek (int fd, INT32 offset, INT16 origin, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_access
-**
-** Description      This function is called to check the existence of a file or
-**                  directory.
-**
-** Parameters       p_path   - (input) file or directory to access (fully qualified path).
-**                  mode     - (input) [BTA_FS_ACC_EXIST, BTA_FS_ACC_READ, or BTA_FS_ACC_RDWR]
-**                  p_is_dir - (output) returns TRUE if p_path specifies a directory.
-**                  app_id   - (input) application ID specified in the enable functions.
-**                                     It can be used to identify which profile is the caller
-**                                     of the call-out function.
-**
-** Returns          (tBTA_FS_CO_STATUS) status of the call.
-**                   [BTA_FS_CO_OK if it exists]
-**                   [BTA_FS_CO_EACCES if permissions are wrong]
-**                   [BTA_FS_CO_FAIL if it does not exist]
-**
-*******************************************************************************/
-BTA_API extern tBTA_FS_CO_STATUS bta_fs_co_access(const char *p_path, int mode,
-                                          BOOLEAN *p_is_dir, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_mkdir
-**
-** Description      This function is called to create a directory with
-**                  the pathname given by path. The pathname is a null terminated
-**                  string. All components of the path must already exist.
-**
-** Parameters       p_path   - (input) name of directory to create (fully qualified path).
-**                  app_id   - (input) application ID specified in the enable functions.
-**                                     It can be used to identify which profile is the caller
-**                                     of the call-out function.
-**
-** Returns          (tBTA_FS_CO_STATUS) status of the call.
-**                  [BTA_FS_CO_OK if successful]
-**                  [BTA_FS_CO_FAIL if unsuccessful]
-**
-*******************************************************************************/
-BTA_API extern tBTA_FS_CO_STATUS bta_fs_co_mkdir(const char *p_path, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_rmdir
-**
-** Description      This function is called to remove a directory whose
-**                  name is given by path. The directory must be empty.
-**
-** Parameters       p_path   - (input) name of directory to remove (fully qualified path).
-**                  app_id   - (input) application ID specified in the enable functions.
-**                                     It can be used to identify which profile is the caller
-**                                     of the call-out function.
-**
-** Returns          (tBTA_FS_CO_STATUS) status of the call.
-**                      [BTA_FS_CO_OK if successful]
-**                      [BTA_FS_CO_EACCES if read-only]
-**                      [BTA_FS_CO_ENOTEMPTY if directory is not empty]
-**                      [BTA_FS_CO_FAIL otherwise]
-**
-*******************************************************************************/
-BTA_API extern tBTA_FS_CO_STATUS bta_fs_co_rmdir(const char *p_path, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_unlink
-**
-** Description      This function is called by to remove a file whose name
-**                  is given by p_path.
-**
-** Parameters       p_path   - (input) name of file to remove (fully qualified path).
-**                  app_id   - (input) application ID specified in the enable functions.
-**                                     It can be used to identify which profile is the caller
-**                                     of the call-out function.
-**
-** Returns          (tBTA_FS_CO_STATUS) status of the call.
-**                      [BTA_FS_CO_OK if successful]
-**                      [BTA_FS_CO_EACCES if read-only]
-**                      [BTA_FS_CO_FAIL otherwise]
-**
-*******************************************************************************/
-BTA_API extern tBTA_FS_CO_STATUS bta_fs_co_unlink(const char *p_path, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_getdirentry
-**
-** Description      This function is called to retrieve a directory entry for the
-**                  specified path.  The first/next directory should be filled
-**                  into the location specified by p_entry.
-**
-** Parameters       p_path      - directory to search (Fully qualified path)
-**                  first_item  - TRUE if first search, FALSE if next search
-**                                      (p_cur contains previous)
-**                  p_entry (input/output) - Points to last entry data (valid when
-**                                           first_item is FALSE)
-**                  evt     - event that must be passed into the call-in function.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-**                  Note: Upon completion of the request, the status is passed
-**                        in the bta_fs_ci_direntry() call-in function.
-**                        BTA_FS_CO_OK is returned when p_entry is valid,
-**                        BTA_FS_CO_EODIR is returned when no more entries [finished]
-**                        BTA_FS_CO_FAIL is returned if an error occurred
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_co_getdirentry(const char *p_path, BOOLEAN first_item,
-                                   tBTA_FS_DIRENTRY *p_entry, UINT16 evt,
-                                   UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_copy
-**
-** Description      This function is called to copy a file/directory whose
-**                  name is given by p_src_path to p_dest_path.
-**
-** Parameters       p_src_path  - (input) name of file/directory to be copied (fully qualified path).
-**                  p_dest_path - (input) new name of file/directory(fully qualified path).
-**                  p_perms     - the permission of the new object.
-**                  evt     - event that must be passed into the call-in function.
-**                  app_id   - (input) application ID specified in the enable functions.
-**                                     It can be used to identify which profile is the caller
-**                                     of the call-out function.
-**
-** Returns          (tBTA_FS_CO_STATUS) status of the call.
-**                      [BTA_FS_CO_OK if successful]
-**                      [BTA_FS_CO_EIS_DIR if p_src_path is a folder]
-**                      [BTA_FS_CO_EACCES if p_dest_path already exists or could not be created (invalid path);
-**                                        or p_src_path is a directory and p_dest_path specifies a different path. ]
-**                      [BTA_FS_CO_FAIL otherwise]
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_co_copy(const char *p_src_path, const char *p_dest_path, UINT8 *p_perms, UINT16 evt, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_rename
-**
-** Description      This function is called to move a file/directory whose
-**                  name is given by p_src_path to p_dest_path.
-**
-** Parameters       p_src_path  - (input) name of file/directory to be moved (fully qualified path).
-**                  p_dest_path - (input) new name of file/directory(fully qualified path).
-**                  p_perms     - the permission of the new object.
-**                  app_id   - (input) application ID specified in the enable functions.
-**                                     It can be used to identify which profile is the caller
-**                                     of the call-out function.
-**
-** Returns          (tBTA_FS_CO_STATUS) status of the call.
-**                      [BTA_FS_CO_OK if successful]
-**                      [BTA_FS_CO_EACCES if p_dest_path already exists or could not be created (invalid path);
-**                                        or p_src_path is a directory and p_dest_path specifies a different path. ]
-**                      [BTA_FS_CO_FAIL otherwise]
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_co_rename(const char *p_src_path, const char *p_dest_path, UINT8 *p_perms, UINT16 evt, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_set_perms
-**
-** Description      This function is called to set the permission a file/directory
-**                  with name as p_src_path.
-**
-** Parameters       p_src_path  - (input) name of file/directory to set permission (fully qualified path).
-**                  p_perms     - the permission .
-**                  app_id   - (input) application ID specified in the enable functions.
-**                                     It can be used to identify which profile is the caller
-**                                     of the call-out function.
-**
-** Returns          (tBTA_FS_CO_STATUS) status of the call.
-**                      [BTA_FS_CO_OK if successful]
-**                      [BTA_FS_CO_EACCES if p_dest_path already exists or could not be created (invalid path);
-**                                        or p_src_path is a directory and p_dest_path specifies a different path. ]
-**                      [BTA_FS_CO_FAIL otherwise]
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_co_set_perms(const char *p_src_path,  UINT8 *p_perms, UINT16 evt, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_sess_fopen
-**
-** Description      This function is called by bta_fs_co_open to keep track of
-**                  the opened file (for reliable session suspend/resume.)
-**
-** Parameters       p_path  - Fully qualified path and file name.
-**                  oflags  - permissions and mode (see constants above)
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_co_sess_fopen(const char *p_path, int oflags, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_sess_fclose
-**
-** Description      This function is called by bta_fs_co_close
-**
-** Parameters       app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_co_sess_fclose(UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_sess_offset
-**
-** Description      This function is called by bta_fs_co_write to keep track of
-**                  the last file offset (Only the receiving side needs to keep
-**                  track of the file offset)
-**
-** Returns          void
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_co_sess_offset(UINT8 ssn, INT32 pos, UINT16 nbytes, UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_suspended_addr
-**
-** Description      find the peer address of the suspended session control block
-**                  for the given an app_id.
-**
-** Returns          the control block found.
-**
-*******************************************************************************/
-BTA_API extern UINT8 *bta_fs_co_suspended_addr(UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_num_suspended_session
-**
-** Description      find the number of suspended session control blocks for the
-**                  given an app_id.
-**
-** Returns          the number of control blocks found.
-**
-*******************************************************************************/
-BTA_API extern UINT8 bta_fs_co_num_suspended_session(UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_get_active_session
-**
-** Description      find the active session control block for the given an app_id.
-**
-** Returns          the control block found.
-**
-*******************************************************************************/
-BTA_API extern tBTA_FS_CO_SESSION *bta_fs_co_get_active_session(UINT8 app_id);
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_init_db
-**
-** Description      Initialize the session control blocks for platform.
-**
-** Returns          void
-**
-*******************************************************************************/
-BTA_API extern void bta_fs_co_init_db (tBTA_FS_CO_SESSION *p_first);
-
-/*******************************************************************************
-**
-** Function         bta_fs_convert_oflags
-**
-** Description      This function converts the open flags from BTA into MFS.
-**
-** Returns          BTA FS status value.
-**
-*******************************************************************************/
-BTA_API extern int bta_fs_convert_bta_oflags(int bta_oflags);
-
-#endif /* BTA_FS_CO_H */
diff --git a/btif/co/bta_fs_co.c b/btif/co/bta_fs_co.c
deleted file mode 100644 (file)
index 54bb87e..0000000
+++ /dev/null
@@ -1,1236 +0,0 @@
-/******************************************************************************
- *
- *  Copyright (C) 2009-2012 Broadcom Corporation
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at:
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- ******************************************************************************/
-#include <stdio.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/statfs.h>
-#include <sys/vfs.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <time.h>
-#include <limits.h>
-#include "gki.h"
-#include "bta_fs_co.h"
-#include "bta_fs_ci.h"
-#include <inttypes.h>
-#include "bt_utils.h"
-
-#ifndef AID_SYSTEM
-#define AID_SYSTEM        1000
-#define AID_BLUETOOTH     1002
-#define AID_SDCARD_RW     1015
-#define AID_MISC          9998
-#endif
-
-#define FAT_FS 0x4d44
-const unsigned short BT_UID= AID_BLUETOOTH;
-const unsigned short BT_GID= AID_BLUETOOTH;
-
-/* enable additional debugging traces that should be compiled out by default! */
-#ifndef BTA_FS_DEBUG
-#define BTA_FS_DEBUG TRUE
-#define LOG_TAG  "BTA_FS_CO"
-#define LOGI(format, ...)  fprintf (stdout, LOG_TAG format"\n", ## __VA_ARGS__)
-#endif
-
-#if (defined BTA_PBS_INCLUDED) && (BTA_PBS_INCLUDED == TRUE)
-extern const tBTA_PBS_CFG bta_pbs_cfg;
-#endif
-
-
-
-static int del_path (const char *path)
-{
-    DIR *dir;
-    struct dirent *de;
-    int ret = 0;
-    char nameBuffer[PATH_MAX] = {0};
-    struct stat statBuffer;
-    BTIF_TRACE_DEBUG("in del_path for path:%s", path);
-    dir = opendir(path);
-
-    if (dir == NULL) {
-        BTIF_TRACE_DEBUG("opendir failed on path:%s", path);
-        return -1;
-    }
-
-    char *filenameOffset;
-
-    strncpy(nameBuffer, path, PATH_MAX - 1);
-    strcat(nameBuffer, "/");
-    int nameLen = strlen(nameBuffer);
-    filenameOffset = nameBuffer + nameLen;
-
-    for (;;) {
-        de = readdir(dir);
-
-        if (de == NULL) {
-            BTIF_TRACE_DEBUG("readdir failed for path:%s", path);
-            //ret = -1;
-            break;
-        }
-
-        if (0 == strcmp(de->d_name, ".") || 0 == strcmp(de->d_name, ".."))
-           continue;
-
-        if((int)strlen(de->d_name) > PATH_MAX - nameLen) {
-            BTIF_TRACE_DEBUG("d_name len:%d is too big", strlen(de->d_name));
-            ret = -1;
-            break;
-        }
-
-        strcpy(filenameOffset, de->d_name);
-
-        ret = lstat (nameBuffer, &statBuffer);
-
-        if (ret != 0) {
-            BTIF_TRACE_DEBUG("lstat failed for path:%s", nameBuffer);
-            break;
-        }
-
-        if(S_ISDIR(statBuffer.st_mode)) {
-
-            ret = del_path(nameBuffer);
-            if(ret != 0)
-                break;
-        } else {
-            ret = unlink(nameBuffer);
-            if (ret != 0) {
-                BTIF_TRACE_DEBUG("unlink failed for path:%s", nameBuffer);
-                break;
-            }
-        }
-    }
-
-    closedir(dir);
-    if(ret == 0) {
-        ret = rmdir(path);
-        BTIF_TRACE_DEBUG("rmdir return:%d for path:%s", ret, path);
-    }
-
-    return ret;
-
-}
-
-inline int getAccess(int accType, struct stat *buffer, char *p_path)
-{
-
-    struct statfs fsbuffer;
-    int idType;
-
-    if(! buffer)
-       return BTA_FS_CO_FAIL;
-
-    //idType= (buffer->st_uid== BT_UID) ? 1 : (buffer->st_uid== BT_GID) ? 2 : 3;
-    if(buffer->st_uid == BT_UID)
-        idType = 1;
-    else if(buffer->st_gid == BT_GID ||
-            buffer->st_gid == AID_SYSTEM ||
-            buffer->st_gid == AID_MISC ||
-            buffer->st_gid == AID_SDCARD_RW)
-        idType = 2;
-    else idType = 3;
-
-    if(statfs(p_path, &fsbuffer)==0)
-    {
-        if(fsbuffer.f_type == FAT_FS)
-           return BTA_FS_CO_OK;
-    }
-    else {
-        return BTA_FS_CO_FAIL;
-    }
-
-    switch(accType) {
-        case 4:
-       if(idType== 1) {        //Id is User Id
-          if(buffer-> st_mode & S_IRUSR)
-              return BTA_FS_CO_OK;
-       }
-       else if(idType==2) {   //Id is Group Id
-           if(buffer-> st_mode & S_IRGRP)
-              return BTA_FS_CO_OK;
-       }
-       else {                  //Id is Others
-           if(buffer-> st_mode & S_IROTH)
-              return BTA_FS_CO_OK;
-       }
-       break;
-
-       case 6:
-       if(idType== 1) {        //Id is User Id
-          if((buffer-> st_mode & S_IRUSR) && (buffer-> st_mode & S_IWUSR))
-              return BTA_FS_CO_OK;
-       }
-       else if(idType==2) {   //Id is Group Id
-           if((buffer-> st_mode & S_IRGRP) && (buffer-> st_mode & S_IWGRP))
-              return BTA_FS_CO_OK;
-       }
-       else {                  //Id is Others
-           if((buffer-> st_mode & S_IROTH) && (buffer-> st_mode & S_IWOTH))
-              return BTA_FS_CO_OK;
-       }
-       break;
-
-       default:
-       return BTA_FS_CO_OK;
-    }
-    BTIF_TRACE_DEBUG("*************FTP- Access Failed **********");
-    return BTA_FS_CO_EACCES;
-}
-
-
-/*****************************************************************************
-**  Function Declarations
-*****************************************************************************/
-
-/*******************************************************************************
-**
-** Function         bta_fs_convert_oflags
-**
-** Description      This function converts the open flags from BTA into MFS.
-**
-** Returns          BTA FS status value.
-**
-*******************************************************************************/
-int bta_fs_convert_bta_oflags(int bta_oflags)
-{
-    int oflags = 0; /* Initially read only */
-
-    /* Only one of these can be set: Read Only, Read/Write, or Write Only */
-    if (bta_oflags & BTA_FS_O_RDWR)
-        oflags |= O_RDWR;
-    else if (bta_oflags & BTA_FS_O_WRONLY)
-        oflags |= O_WRONLY;
-
-    /* OR in any other flags that are set by BTA */
-    if (bta_oflags & BTA_FS_O_CREAT)
-        oflags |= O_CREAT;
-
-    if (bta_oflags & BTA_FS_O_EXCL)
-        oflags |= O_EXCL;
-
-    if (bta_oflags & BTA_FS_O_TRUNC)
-        oflags |= O_TRUNC;
-
-    return (oflags);
-}
-
-
-
-/*******************************************************************************
- **
- ** Function        btapp_fs_check_space
- **
- ** Description     determines access and if there is enough space for given files size on given path
- **
- ** Parameters      p_path  - Fully qualified path and file name.
- **                           WARNING: file name is stripped off! so it must be present!
- **                 size    - size of file to put (0 if unavailable or not applicable)
- **                 app_id  - in case application specific treatement is required (e.g opp versus ftp)
- ** Returns         0 if enough space, otherwise errno failure codes
- **
- *******************************************************************************/
-static int btapp_fs_check_space( const char *p_path, const UINT32 size, const UINT8 app_id )
-{
-    unsigned long long max_space;
-    struct statfs fs_buffer;
-    int err = 0;
-    char *p_dir;
-    char *p_end;
-    UNUSED(app_id);
-
-    if(size==BTA_FS_LEN_UNKNOWN)
-        return 0;
-    /* fail silently in case of no memory. write will catch if not enough space */
-
-    if (NULL != (p_dir = (char *) GKI_getbuf(strlen(p_path) + 1)))
-    {
-        strcpy(p_dir, p_path);
-        if (NULL != (p_end = strrchr(p_dir, '/')))
-        {
-
-            *p_end = '\0';
-            /* get fs info and calculate available space. if not enough, the fs error EFBIG is returned */
-
-            if (0 == statfs(p_dir, &fs_buffer))
-            {
-
-                max_space = fs_buffer.f_bavail * fs_buffer.f_bsize;
-#if (BTA_FS_DEBUG==TRUE)
-                BTIF_TRACE_DEBUG("btapp_fs_enough_space(file size: %d): (uint)max_size: %u", size, (UINT32)max_space);
-#endif
-                if (max_space < size)
-                    err = EFBIG;
-            }
-            else
-            {
-                err = errno;
-                BTIF_TRACE_WARNING("btapp_fs_enough_space(): statfs() failed with err: %d", err);
-            }
-        }
-        else
-        {
-            err = ENOENT;
-        }
-        GKI_freebuf(p_dir);
-    }
-    else
-    {
-        err = ENOMEM;
-    }
-    return err;
-
-} /* btapp_fs_check_access_space() */
-
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_open
-**
-** Description      This function is executed by BTA when a file is opened.
-**                  The phone uses this function to open
-**                  a file for reading or writing.
-**
-** Parameters       p_path  - Fully qualified path and file name.
-**                  oflags  - permissions and mode (see constants above)
-**                  size    - size of file to put (0 if unavailable or not applicable)
-**                  evt     - event that must be passed into the call-in function.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-**                  Note: Upon completion of the request, a file descriptor (int),
-**                        if successful, and an error code (tBTA_FS_CO_STATUS)
-**                        are returned in the call-in function, bta_fs_ci_open().
-**
-*******************************************************************************/
-
-void bta_fs_co_open(const char *p_path, int oflags, UINT32 size, UINT16 evt,
-                    UINT8 app_id)
-{
-
-    tBTA_FS_CO_STATUS  status;
-    UINT32  file_size = 0;
-    struct  stat file_stat;
-    int fd = -1;
-    int err = 0;
-
-    /* Convert BTA oflags into os specific flags */
-    oflags = bta_fs_convert_bta_oflags(oflags);
-
-    /* check available space in case of write access. oflags are in OS format! */
-    if (oflags & (O_RDWR|O_WRONLY))
-    {
-        err = btapp_fs_check_space(p_path, size, app_id);
-    }
-
-    if ( 0==err )
-    {
-        if ((fd = open(p_path, oflags | O_NONBLOCK, 0666)) >= 0)
-        {
-            if (fstat(fd, &file_stat) == 0)
-            {
-                file_size = file_stat.st_size;
-                if (oflags & O_CREAT)
-                {
-                    fchown(fd, BT_UID, BT_GID);
-                    BTIF_TRACE_DEBUG("\n ******CHANGED OWNERSHIP SUCCESSFULLY**********");
-                }
-            }
-        }
-
-        else
-        {
-            err = errno;
-        }
-    }
-
-    BTIF_TRACE_DEBUG("[CO] bta_fs_co_open: handle:%d err:%d, flags:%x, app id:%d",
-            fd, err, oflags, app_id);
-    BTIF_TRACE_DEBUG("file=%s", p_path);
-
-    /* convert fs error into bta_fs err. erro is set by first call to enough space to a valid value
-     * and needs only updating in case of error. This reports correct failure to remote obex! */
-
-    switch (err)
-    {
-
-    case 0:
-        status = BTA_FS_CO_OK;
-        break;
-    case EACCES:
-        status = BTA_FS_CO_EACCES;
-        break;
-    case EFBIG: /* file to big for available fs space */
-        status = BTA_FS_CO_ENOSPACE;
-        break;
-    default:
-        status = BTA_FS_CO_FAIL;
-        break;
-    }
-    bta_fs_ci_open(fd, status, file_size, evt);
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_close
-**
-** Description      This function is called by BTA when a connection to a
-**                  client is closed.
-**
-** Parameters       fd      - file descriptor of file to close.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          (tBTA_FS_CO_STATUS) status of the call.
-**                      [BTA_FS_CO_OK if successful],
-**                      [BTA_FS_CO_FAIL if failed  ]
-**
-*******************************************************************************/
-tBTA_FS_CO_STATUS bta_fs_co_close(int fd, UINT8 app_id)
-{
-    tBTA_FS_CO_STATUS status = BTA_FS_CO_OK;
-    int err;
-
-    BTIF_TRACE_DEBUG("[CO] bta_fs_co_close: handle:%d, app id:%d",
-        fd, app_id);
-    if (close (fd) < 0)
-    {
-        err = errno;
-        status = BTA_FS_CO_FAIL;
-        BTIF_TRACE_WARNING("[CO] bta_fs_co_close: handle:%d error=%d app_id:%d", fd, err, app_id);
-    }
-
-    return (status);
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_read
-**
-** Description      This function is called by BTA to read in data from the
-**                  previously opened file on the phone.
-**
-** Parameters       fd      - file descriptor of file to read from.
-**                  p_buf   - buffer to read the data into.
-**                  nbytes  - number of bytes to read into the buffer.
-**                  evt     - event that must be passed into the call-in function.
-**                  ssn     - session sequence number. Ignored, if bta_fs_co_open
-**                                                       was not called with BTA_FS_CO_RELIABLE.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-**                  Note: Upon completion of the request, bta_fs_ci_read() is
-**                        called with the buffer of data, along with the number
-**                        of bytes read into the buffer, and a status.  The
-**                        call-in function should only be called when ALL requested
-**                        bytes have been read, the end of file has been detected,
-**                        or an error has occurred.
-**
-*******************************************************************************/
-void bta_fs_co_read(int fd, UINT8 *p_buf, UINT16 nbytes, UINT16 evt, UINT8 ssn, UINT8 app_id)
-{
-    tBTA_FS_CO_STATUS  status = BTA_FS_CO_OK;
-    INT32   num_read;
-    int     err;
-    UNUSED(ssn);
-
-    if ((num_read = read (fd, p_buf, nbytes)) < 0)
-    {
-        err = errno;
-        status = BTA_FS_CO_FAIL;
-        BTIF_TRACE_WARNING("[CO] bta_fs_co_read: handle:%d error=%d app_id:%d",
-                            fd, err, app_id);
-    }
-    else if (num_read < nbytes)
-        status = BTA_FS_CO_EOF;
-
-    bta_fs_ci_read(fd, (UINT16)num_read, status, evt);
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_write
-**
-** Description      This function is called by io to send file data to the
-**                  phone.
-**
-** Parameters       fd      - file descriptor of file to write to.
-**                  p_buf   - buffer to read the data from.
-**                  nbytes  - number of bytes to write out to the file.
-**                  evt     - event that must be passed into the call-in function.
-**                  ssn     - session sequence number. Ignored, if bta_fs_co_open
-**                                                       was not called with BTA_FS_CO_RELIABLE.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-**                  Note: Upon completion of the request, bta_fs_ci_write() is
-**                        called with the file descriptor and the status.  The
-**                        call-in function should only be called when ALL requested
-**                        bytes have been written, or an error has been detected,
-**
-*******************************************************************************/
-void bta_fs_co_write(int fd, const UINT8 *p_buf, UINT16 nbytes, UINT16 evt,
-                     UINT8 ssn, UINT8 app_id)
-{
-    tBTA_FS_CO_STATUS  status = BTA_FS_CO_OK;
-    INT32   num_written;
-    int     err=0;
-    UNUSED(ssn);
-    UNUSED(app_id);
-
-    if ((num_written = write (fd, p_buf, nbytes)) < 0)
-    {
-        err = errno;
-        status = BTA_FS_CO_FAIL;
-    }
-/*    BTIF_TRACE_DEBUG("[CO] bta_fs_co_write: handle:%d error=%d, num_written:%d", fd, err, num_written);*/
-
-    bta_fs_ci_write(fd, status, evt);
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_seek
-**
-** Description      This function is called by io to move the file pointer
-**                  of a previously opened file to the specified location for
-**                  the next read or write operation.
-**
-** Parameters       fd      - file descriptor of file.
-**                  offset  - Number of bytes from origin.
-**                  origin  - Initial position.
-**
-** Returns          void
-**
-*******************************************************************************/
-void bta_fs_co_seek (int fd, INT32 offset, INT16 origin, UINT8 app_id)
-{
-    UNUSED(app_id);
-    lseek(fd, offset, origin);
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_access
-**
-** Description      This function is called to check the existence of
-**                  a file or directory, and return whether or not it is a
-**                  directory or length of the file.
-**
-** Parameters       p_path   - (input) file or directory to access (fully qualified path).
-**                  mode     - (input) [BTA_FS_ACC_EXIST, BTA_FS_ACC_READ, or BTA_FS_ACC_RDWR]
-**                  p_is_dir - (output) returns TRUE if p_path specifies a directory.
-**                  app_id   - (input) application ID specified in the enable functions.
-**                                     It can be used to identify which profile is the caller
-**                                     of the call-out function.
-**
-** Returns          (tBTA_FS_CO_STATUS) status of the call.
-**                   [BTA_FS_CO_OK if it exists]
-**                   [BTA_FS_CO_EACCES if permissions are wrong]
-**                   [BTA_FS_CO_FAIL if it does not exist]
-**
-*******************************************************************************/
-tBTA_FS_CO_STATUS bta_fs_co_access(const char *p_path, int mode, BOOLEAN *p_is_dir,
-                                   UINT8 app_id)
-{
-    int err;
-    int os_mode = 0;
-    tBTA_FS_CO_STATUS status = BTA_FS_CO_OK;
-    struct stat buffer;
-    UNUSED(app_id);
-
-    #if (TRUE==BTA_FS_DEBUG)
-    LOGI("***********CHECKING ACCESS TO = %s", p_path);
-    #endif
-
-    #if (defined BTA_PBS_INCLUDED) && (BTA_PBS_INCLUDED == TRUE)
-
-    if (app_id == UI_PBS_ID)
-    {
-
-        *p_is_dir = TRUE;
-
-        #if (TRUE==BTA_FS_DEBUG)
-        LOGI("***********SUPPORTED REPO = %d", bta_pbs_cfg.supported_repositories);
-        #endif
-        //Check if SIM contact requested,  and if so if it's supported.
-        //If not, return error!
-        if (strstr(p_path,"SIM1") && !(bta_pbs_cfg.supported_repositories & 0x2)) {
-            LOGI("***********RETURNING FAIL!");
-            return BTA_FS_CO_FAIL;
-        }
-
-        #if (TRUE==BTA_FS_DEBUG)
-        LOGI("***********RETURNING success!");
-        #endif
-        return (status);
-    }
-    #endif
-
-
-    *p_is_dir = FALSE;
-
-    if (mode == BTA_FS_ACC_RDWR)
-        os_mode = 6;
-    else if (mode == BTA_FS_ACC_READ)
-        os_mode = 4;
-
-    if (stat(p_path, &buffer) == 0)
-    {
-       /* Determine if the object is a file or directory */
-        if (S_ISDIR(buffer.st_mode))
-            *p_is_dir = TRUE;
-    }
-    else
-    {
-       BTIF_TRACE_DEBUG("stat() failed! ");
-        return BTA_FS_CO_FAIL;
-    }
-
-    status=getAccess (os_mode, &buffer, (char*)p_path);
-    return (status);
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_mkdir
-**
-** Description      This function is called to create a directory with
-**                  the pathname given by path. The pathname is a null terminated
-**                  string. All components of the path must already exist.
-**
-** Parameters       p_path   - (input) name of directory to create (fully qualified path).
-**                  app_id   - (input) application ID specified in the enable functions.
-**                                     It can be used to identify which profile is the caller
-**                                     of the call-out function.
-**
-** Returns          (tBTA_FS_CO_STATUS) status of the call.
-**                  [BTA_FS_CO_OK if successful]
-**                  [BTA_FS_CO_FAIL if unsuccessful]
-**
-*******************************************************************************/
-tBTA_FS_CO_STATUS bta_fs_co_mkdir(const char *p_path, UINT8 app_id)
-{
-    int err;
-    tBTA_FS_CO_STATUS status = BTA_FS_CO_OK;
-
-    if ((mkdir (p_path, 0666)) != 0)
-    {
-        err = errno;
-        status = BTA_FS_CO_FAIL;
-        BTIF_TRACE_WARNING("[CO] bta_fs_co_mkdir: error=%d, path [%s] app_id:%d",
-                            err, p_path, app_id);
-    }
-    return (status);
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_rmdir
-**
-** Description      This function is called to remove a directory whose
-**                  name is given by path. The directory must be empty.
-**
-** Parameters       p_path   - (input) name of directory to remove (fully qualified path).
-**                  app_id   - (input) application ID specified in the enable functions.
-**                                     It can be used to identify which profile is the caller
-**                                     of the call-out function.
-**
-** Returns          (tBTA_FS_CO_STATUS) status of the call.
-**                      [BTA_FS_CO_OK if successful]
-**                      [BTA_FS_CO_EACCES if read-only]
-**                      [BTA_FS_CO_ENOTEMPTY if directory is not empty]
-**                      [BTA_FS_CO_FAIL otherwise]
-**
-*******************************************************************************/
-tBTA_FS_CO_STATUS bta_fs_co_rmdir(const char *p_path, UINT8 app_id)
-{
-    int err, path_len;
-    tBTA_FS_CO_STATUS status = BTA_FS_CO_OK;
-    struct stat buffer;
-    char *dirName, *tmp = NULL;
-
-    path_len = strlen( p_path )+1;
-    BTIF_TRACE_DEBUG( "bta_fs_co_rmdir( app_id: %d ): path_len: %d", app_id, path_len );
-#if (TRUE==BTA_FS_DEBUG)
-    BTIF_TRACE_DEBUG( "bta_fs_co_rmdir():path_len: %d, p_path", app_id );
-    BTIF_TRACE_DEBUG( p_path );
-#endif
-
-    /* allocate a temp buffer for path with 0 char. make sure not to crash if path is too big! */
-    dirName = (char*) calloc(1, path_len+1);
-    if ( NULL != dirName )
-    {
-        strcpy( dirName, p_path );
-    }
-    else
-    {
-        BTIF_TRACE_WARNING( "bta_fs_co_rmdir( app_id: %d ) for path_len: %d::out of memory",
-                             app_id, path_len );
-        return BTA_FS_CO_FAIL;
-    }
-
-    if (NULL!= (tmp = strrchr(dirName, '/')))
-    {
-        *tmp = '\0';
-    }
-    if (stat(dirName, &buffer) == 0)
-    {
-        status = getAccess(6, &buffer, dirName);
-    }
-    else
-    {
-        free(dirName);
-#if (TRUE==BTA_FS_DEBUG)
-        BTIF_TRACE_WARNING( "bta_fs_co_rmdir()::stat(dirName) failed" );
-#endif
-        return BTA_FS_CO_FAIL;
-    }
-
-    free(dirName);
-    if (status != BTA_FS_CO_OK)
-    {
-#if (TRUE==BTA_FS_DEBUG)
-        BTIF_TRACE_WARNING( "bta_fs_co_rmdir()::getAccess(dirName) FAILED");
-#endif
-        return status;
-    }
-
-    if (stat(p_path, &buffer) == 0)
-    {
-        status = getAccess(6, &buffer, (char*)p_path);
-    }
-    else
-    {
-#if (TRUE==BTA_FS_DEBUG)
-        BTIF_TRACE_WARNING( "bta_fs_co_rmdir()::stat(p_path) FAILED");
-#endif
-        return BTA_FS_CO_FAIL;
-    }
-
-    if (status != BTA_FS_CO_OK)
-    {
-#if (TRUE==BTA_FS_DEBUG)
-        BTIF_TRACE_DEBUG( "bta_fs_co_rmdir()::getAccess(p_path) FAILED");
-#endif
-        return status;
-    }
-    //if ((rmdir (p_path)) != 0)
-    if (del_path(p_path) != 0)
-    {
-        err = errno;
-        BTIF_TRACE_WARNING( "bta_fs_co_rmdir():rmdir/del_path FAILED with err: %d", err );
-        if (err == EACCES)
-            status = BTA_FS_CO_EACCES;
-        else if (err == ENOTEMPTY)
-            status = BTA_FS_CO_ENOTEMPTY;
-        else
-            status = BTA_FS_CO_FAIL;
-    }
-    return (status);
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_unlink
-**
-** Description      This function is called to remove a file whose name
-**                  is given by p_path.
-**
-** Parameters       p_path   - (input) name of file to remove (fully qualified path).
-**                  app_id   - (input) application ID specified in the enable functions.
-**                                     It can be used to identify which profile is the caller
-**                                     of the call-out function.
-**
-** Returns          (tBTA_FS_CO_STATUS) status of the call.
-**                      [BTA_FS_CO_OK if successful]
-**                      [BTA_FS_CO_EACCES if read-only]
-**                      [BTA_FS_CO_FAIL otherwise]
-**
-*******************************************************************************/
-tBTA_FS_CO_STATUS bta_fs_co_unlink(const char *p_path, UINT8 app_id)
-{
-    BTIF_TRACE_DEBUG("bta_fs_co_unlink");
-    int err;
-    tBTA_FS_CO_STATUS status = BTA_FS_CO_OK;
-    char *dirName, *tmp=NULL;
-    struct stat buffer;
-    UNUSED(app_id);
-
-    if(! p_path)
-        return BTA_FS_CO_FAIL;
-
-    /* buffer needs to be NULL terminated - so add one more byte to be zero'd out */
-#if 0
-    dirName= (char*) calloc(1, strlen(p_path));  /* <--- this can cause problems  */
-#else
-    dirName= (char*) calloc(1, strlen(p_path) + 1);
-#endif
-
-    strncpy(dirName, p_path, strlen(p_path));
-    if((tmp=strrchr(dirName, '/')))
-    {
-           *tmp='\0';
-    }
-    if (stat(dirName, &buffer) == 0)
-    {
-        status=getAccess (6, &buffer, dirName);
-        free(dirName);
-    }
-    else
-    {
-        BTIF_TRACE_DEBUG("stat() failed! ");
-        free(dirName);
-        return BTA_FS_CO_FAIL;
-    }
-
-    if(status!= BTA_FS_CO_OK)
-       return status;
-
-    if ((unlink (p_path)) != 0)
-    {
-        err = errno;
-        if (err == EACCES)
-            status = BTA_FS_CO_EACCES;
-        else
-            status = BTA_FS_CO_FAIL;
-    }
-    return (status);
-
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_getdirentry
-**
-** Description      This function is called to get a directory entry for the
-**                  specified p_path.  The first/next directory should be filled
-**                  into the location specified by p_entry.
-**
-** Parameters       p_path      - directory to search (Fully qualified path)
-**                  first_item  - TRUE if first search, FALSE if next search
-**                                      (p_cur contains previous)
-**                  p_entry (input/output) - Points to last entry data (valid when
-**                                           first_item is FALSE)
-**                  evt     - event that must be passed into the call-in function.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-**                  Note: Upon completion of the request, the status is passed
-**                        in the bta_fs_ci_direntry() call-in function.
-**                        BTA_FS_CO_OK is returned when p_entry is valid,
-**                        BTA_FS_CO_EODIR is returned when no more entries [finished]
-**                        BTA_FS_CO_FAIL is returned if an error occurred
-**
-*******************************************************************************/
-void bta_fs_co_getdirentry(const char *p_path, BOOLEAN first_item,
-                           tBTA_FS_DIRENTRY *p_entry, UINT16 evt, UINT8 app_id)
-{
-    tBTA_FS_CO_STATUS    co_status = BTA_FS_CO_FAIL;
-    int                  status = -1;    /* '0' - success, '-1' - fail */
-    struct tm           *p_tm;
-    DIR *dir;
-    struct dirent *dirent;
-    struct stat buf;
-    char fullname[500];
-    UNUSED(app_id);
-
-    BTIF_TRACE_DEBUG("Entered bta_fs_co_getdirentry");
-
-    /* First item is to be retrieved */
-    if (first_item)
-    {
-        BTIF_TRACE_DEBUG("bta_fs_co_getdirentry: path = %s", p_path);
-
-        dir = opendir(p_path);
-        if(dir == NULL)
-        {
-           BTIF_TRACE_DEBUG("bta_fs_co_getdirentry: dir is NULL so error out with errno=%d", errno);
-            co_status = BTA_FS_CO_EODIR;
-            bta_fs_ci_direntry(co_status, evt);
-            return;
-        }
-
-        BTIF_TRACE_DEBUG("bta_fs_co_getdirentry: dir = %p", dir);
-        if((dirent = readdir(dir)) != NULL)
-        {
-            p_entry->refdata = (UINT32) dir;     /* Save this for future searches */
-            status = 0;
-            BTIF_TRACE_DEBUG("bta_fs_co_getdirentry: dirent = %p", dirent);
-        }
-        else
-        {
-            BTIF_TRACE_DEBUG("bta_fs_co_getdirentry: dirent = %p", dirent);
-            /* Close the search if there are no more items */
-            closedir( (DIR*) p_entry->refdata);
-            co_status = BTA_FS_CO_EODIR;
-        }
-    }
-    else    /* Get the next entry based on the p_ref data from previous search */
-    {
-        if ((dirent = readdir((DIR*)p_entry->refdata))  == NULL)
-        {
-            /* Close the search if there are no more items */
-            closedir( (DIR*) p_entry->refdata);
-            co_status = BTA_FS_CO_EODIR;
-            BTIF_TRACE_DEBUG("bta_fs_co_getdirentry: dirent = %p", dirent);
-        }
-        else
-        {
-            BTIF_TRACE_DEBUG("bta_fs_co_getdirentry: dirent = %p", dirent);
-            status = 0;
-        }
-    }
-
-    if (status == 0)
-    {
-        BTIF_TRACE_DEBUG("bta_fs_co_getdirentry: status = 0");
-
-        sprintf(fullname, "%s/%s", p_path,  dirent->d_name);
-
-        /* Load new values into the return structure (refdata is left untouched) */
-        if (stat(fullname, &buf) == 0) {
-            p_entry->filesize = buf.st_size;
-            p_entry->mode = 0; /* Default is normal read/write file access */
-
-            if (S_ISDIR(buf.st_mode))
-                p_entry->mode |= BTA_FS_A_DIR;
-            else
-                p_entry->mode |= BTA_FS_A_RDONLY;
-
-            strcpy(p_entry->p_name, dirent->d_name);
-#if 0
-            fprintf(stderr, "bta_fs_co_getdirentry(): %s %9d %d\n",
-                            dirent->d_name,
-                            buf.st_size,
-                            p_entry->mode);
-#endif
-            p_tm = localtime((const time_t*)&buf.st_mtime);
-            if (p_tm != NULL)
-            {
-                sprintf(p_entry->crtime, "%04d%02d%02dT%02d%02d%02dZ",
-                        p_tm->tm_year + 1900,   /* Base Year ISO 6201 */
-                        p_tm->tm_mon + 1,       /* month starts at 0 */
-                        p_tm->tm_mday,
-                        p_tm->tm_hour,
-                        p_tm->tm_min,
-                        p_tm->tm_sec);
-            }
-            else
-                p_entry->crtime[0] = '\0';  /* No valid time */
-#if 0
-            fprintf(stderr, "bta_fs_co_getdirentry(): %s %9d %d %s\n",
-                            dirent->d_name,
-                            p_entry->filesize,
-                            p_entry->mode,
-                            p_entry->crtime);
-#endif
-            co_status = BTA_FS_CO_OK;
-        } else {
-            BTIF_TRACE_WARNING("stat() failed! ");
-            co_status = BTA_FS_CO_EACCES;
-        }
-    }
-    BTIF_TRACE_DEBUG("bta_fs_co_getdirentry: calling bta_fs_ci_getdirentry");
-
-    bta_fs_ci_direntry(co_status, evt);
-}
-
-
-
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_setdir
-**
-** Description      This function is executed by BTA when the server changes the
-**                  local path
-**
-** Parameters       p_path  - the new path.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-void bta_fs_co_setdir(const char *p_path, UINT8 app_id)
-{
-    UNUSED(p_path);
-    UNUSED(app_id);
-
-    BTIF_TRACE_DEBUG("Entered %s. New path: %s", __FUNCTION__, p_path);
-}
-
-/*******************************************************************************
-** OBEX14 Reliable Session not supported. Stub associated callouts.
-******************************************************************************/
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_resume
-**
-** Description      This function is executed by BTA when resuming a session.
-**                  This is used to retrieve the session ID and related information
-**
-** Parameters       evt     - event that must be passed into the call-in function.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-**                  Note: Upon completion of the request, the related session information,
-**                        if successful, and an error code (tBTA_FS_CO_STATUS)
-**                        are returned in the call-in function, bta_fs_ci_resume().
-**
-*******************************************************************************/
-void bta_fs_co_resume(UINT16 evt, UINT8 app_id)
-{
-    UNUSED(evt);
-    UNUSED(app_id);
-
-    BTIF_TRACE_WARNING("[CO] bta_fs_co_resume - NOT implemented");
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_set_perms
-**
-** Description      This function is called to set the permission a file/directory
-**                  with name as p_src_path.
-**
-** Parameters       p_src_path  - (input) name of file/directory to set permission (fully qualified path).
-**                  p_perms     - the permission .
-**                  app_id   - (input) application ID specified in the enable functions.
-**                                     It can be used to identify which profile is the caller
-**                                     of the call-out function.
-**
-** Returns          (tBTA_FS_CO_STATUS) status of the call.
-**                      [BTA_FS_CO_OK if successful]
-**                      [BTA_FS_CO_EACCES if p_dest_path already exists or could not be created (invalid path);
-**                                        or p_src_path is a directory and p_dest_path specifies a different path. ]
-**                      [BTA_FS_CO_FAIL otherwise]
-**
-*******************************************************************************/
-void bta_fs_co_set_perms(const char *p_src_path,  UINT8 *p_perms, UINT16 evt, UINT8 app_id)
-{
-    UNUSED(p_src_path);
-    UNUSED(p_perms);
-    UNUSED(evt);
-    UNUSED(app_id);
-
-    BTIF_TRACE_WARNING("[CO] bta_fs_co_set_perms - NOT implemented");
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_rename
-**
-** Description      This function is called to move a file/directory whose
-**                  name is given by p_src_path to p_dest_path.
-**
-** Parameters       p_src_path  - (input) name of file/directory to be moved (fully qualified path).
-**                  p_dest_path - (input) new name of file/directory(fully qualified path).
-**                  p_perms     - the permission of the new object.
-**                  app_id   - (input) application ID specified in the enable functions.
-**                                     It can be used to identify which profile is the caller
-**                                     of the call-out function.
-**
-** Returns          (tBTA_FS_CO_STATUS) status of the call.
-**                      [BTA_FS_CO_OK if successful]
-**                      [BTA_FS_CO_EACCES if p_dest_path already exists or could not be created (invalid path);
-**                                        or p_src_path is a directory and p_dest_path specifies a different path. ]
-**                      [BTA_FS_CO_FAIL otherwise]
-**
-*******************************************************************************/
-void bta_fs_co_rename(const char *p_src_path, const char *p_dest_path, UINT8 *p_perms, UINT16 evt, UINT8 app_id)
-{
-    UNUSED(p_src_path);
-    UNUSED(p_dest_path);
-    UNUSED(p_perms);
-    UNUSED(evt);
-    UNUSED(app_id);
-
-    BTIF_TRACE_WARNING("[CO] bta_fs_co_rename - NOT implemented");
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_copy
-**
-** Description      This function is called to copy a file/directory whose
-**                  name is given by p_src_path to p_dest_path.
-**
-** Parameters       p_src_path  - (input) name of file/directory to be copied (fully qualified path).
-**                  p_dest_path - (input) new name of file/directory(fully qualified path).
-**                  p_perms     - the permission of the new object.
-**                  evt     - event that must be passed into the call-in function.
-**                  app_id   - (input) application ID specified in the enable functions.
-**                                     It can be used to identify which profile is the caller
-**                                     of the call-out function.
-**
-** Returns          (tBTA_FS_CO_STATUS) status of the call.
-**                      [BTA_FS_CO_OK if successful]
-**                      [BTA_FS_CO_EIS_DIR if p_src_path is a folder]
-**                      [BTA_FS_CO_EACCES if p_dest_path already exists or could not be created (invalid path);
-**                                        or p_src_path is a directory and p_dest_path specifies a different path. ]
-**                      [BTA_FS_CO_FAIL otherwise]
-**
-*******************************************************************************/
-void bta_fs_co_copy(const char *p_src_path, const char *p_dest_path, UINT8 *p_perms, UINT16 evt, UINT8 app_id)
-{
-    UNUSED(p_src_path);
-    UNUSED(p_dest_path);
-    UNUSED(p_perms);
-    UNUSED(evt);
-    UNUSED(app_id);
-
-    BTIF_TRACE_WARNING("[CO] bta_fs_co_copy - NOT implemented");
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_resume_op
-**
-** Description      This function is executed by BTA when a reliable session is
-**                  resumed and there was an interrupted operation.
-**
-** Parameters       offset  - the session ID and related information.
-**                  evt     - event that must be passed into the call-in function.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-void bta_fs_co_resume_op(UINT32 offset, UINT16 evt, UINT8 app_id)
-{
-    UNUSED(offset);
-    UNUSED(evt);
-    UNUSED(app_id);
-
-    BTIF_TRACE_WARNING("[CO] bta_fs_co_resume_op - NOT implemented");
-}
-
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_session_info
-**
-** Description      This function is executed by BTA when a reliable session is
-**                  established (p_sess_info != NULL) or ended (p_sess_info == NULL).
-**
-** Parameters       bd_addr     - the peer address
-**                  p_sess_info - the session ID and related information.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-void bta_fs_co_session_info(BD_ADDR bd_addr, UINT8 *p_sess_info, UINT8 ssn,
-                                           tBTA_FS_CO_SESS_ST new_st, char *p_path, UINT8 *p_info, UINT8 app_id)
-{
-    UNUSED(bd_addr);
-    UNUSED(p_sess_info);
-    UNUSED(ssn);
-    UNUSED(new_st);
-    UNUSED(p_path);
-    UNUSED(p_info);
-    UNUSED(app_id);
-
-    BTIF_TRACE_WARNING("[CO] bta_fs_co_session_info - NOT implemented");
-}
-
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_suspend
-**
-** Description      This function is executed by BTA when a reliable session is
-**                  suspended.
-**
-** Parameters       bd_addr - the peer address
-**                  ssn     - the session sequence number.
-**                  info    - the BTA specific information (like last active operation).
-**                  p_offset- the location to receive object offset of the suspended session
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-void bta_fs_co_suspend(BD_ADDR bd_addr, UINT8 *p_sess_info, UINT8 ssn,
-                                      UINT32 *p_timeout, UINT32 *p_offset, UINT8 info, UINT8 app_id)
-{
-    UNUSED(bd_addr);
-    UNUSED(p_sess_info);
-    UNUSED(ssn);
-    UNUSED(p_timeout);
-    UNUSED(p_offset);
-    UNUSED(info);
-    UNUSED(app_id);
-
-    BTIF_TRACE_WARNING("[CO] bta_fs_co_suspend - NOT implemented");
-}
-
-/*******************************************************************************
-**
-** Function         bta_fs_co_sess_ssn
-**
-** Description      This function is executed by BTA when resuming a session.
-**                  This is used to inform call-out module if the ssn/file offset
-**                  needs to be adjusted.
-**
-** Parameters       ssn     - the session sequence number of the first request
-**                            after resume.
-**                  app_id  - application ID specified in the enable functions.
-**                            It can be used to identify which profile is the caller
-**                            of the call-out function.
-**
-** Returns          void
-**
-*******************************************************************************/
-void bta_fs_co_sess_ssn(int fd, UINT8 ssn, UINT8 app_id)
-{
-    UNUSED(fd);
-    UNUSED(ssn);
-    UNUSED(app_id);
-
-    BTIF_TRACE_WARNING("[CO] bta_fs_co_suspend - NOT implemented");
-}
-
index 436fa58..1dcef30 100644 (file)
 #define BTA_PAN_INCLUDED TRUE
 #endif
 
-#ifndef BTA_FS_INCLUDED
-#define BTA_FS_INCLUDED TRUE
-#endif
-
 #ifndef BTA_HH_INCLUDED
 #define BTA_HH_INCLUDED TRUE
 #endif
index 29ea11d..cad90f6 100644 (file)
@@ -51,7 +51,6 @@ LOCAL_SRC_FILES += \
 
 # callouts
 LOCAL_SRC_FILES+= \
-    ../btif/co/bta_fs_co.c \
     ../btif/co/bta_ag_co.c \
     ../btif/co/bta_dm_co.c \
     ../btif/co/bta_av_co.c \