2009-06-18 00:28:50 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* binfmt/libnxflat/libnxflat_uninit.c
|
|
|
|
*
|
2024-09-09 15:12:59 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
2021-02-03 21:47:23 +08:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you 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
|
2009-06-18 00:28:50 +08:00
|
|
|
*
|
2021-02-03 21:47:23 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2009-06-18 00:28:50 +08:00
|
|
|
*
|
2021-02-03 21:47:23 +08:00
|
|
|
* 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.
|
2009-06-18 00:28:50 +08:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
2009-12-16 01:06:59 +08:00
|
|
|
|
2009-06-18 00:28:50 +08:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <debug.h>
|
|
|
|
#include <errno.h>
|
2012-10-25 04:19:44 +08:00
|
|
|
|
|
|
|
#include <nuttx/binfmt/nxflat.h>
|
2009-06-18 00:28:50 +08:00
|
|
|
|
|
|
|
/****************************************************************************
|
2015-04-08 22:29:03 +08:00
|
|
|
* Pre-processor Definitions
|
2009-06-18 00:28:50 +08:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Private Constant Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Private Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxflat_uninit
|
2009-06-23 06:12:19 +08:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Releases any resources committed by nxflat_init(). This essentially
|
|
|
|
* undoes the actions of nxflat_init.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* 0 (OK) is returned on success and a negated errno is returned on
|
|
|
|
* failure.
|
|
|
|
*
|
2009-06-18 00:28:50 +08:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int nxflat_uninit(struct nxflat_loadinfo_s *loadinfo)
|
|
|
|
{
|
2021-02-16 01:15:08 +08:00
|
|
|
if (loadinfo->file.f_inode)
|
2009-06-18 00:28:50 +08:00
|
|
|
{
|
2021-02-16 01:15:08 +08:00
|
|
|
file_close(&loadinfo->file);
|
2009-06-18 00:28:50 +08:00
|
|
|
}
|
2020-01-12 00:10:49 +08:00
|
|
|
|
2009-06-18 00:28:50 +08:00
|
|
|
return OK;
|
|
|
|
}
|