fs: nxstyle fixes
Fix for several errors reported by the nxstyle tool Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
parent
015a205ec6
commit
7dc5db49fc
@ -127,7 +127,9 @@ int aio_cancel(int fildes, FAR struct aiocb *aiocbp)
|
|||||||
status = work_cancel(LPWORK, &aioc->aioc_work);
|
status = work_cancel(LPWORK, &aioc->aioc_work);
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
{
|
{
|
||||||
/* Remove the container from the list of pending transfers */
|
/* Remove the container from the list of pending
|
||||||
|
* transfers
|
||||||
|
*/
|
||||||
|
|
||||||
pid = aioc->aioc_pid;
|
pid = aioc->aioc_pid;
|
||||||
aioc_decant(aioc);
|
aioc_decant(aioc);
|
||||||
@ -182,7 +184,9 @@ int aio_cancel(int fildes, FAR struct aiocb *aiocbp)
|
|||||||
status = work_cancel(LPWORK, &aioc->aioc_work);
|
status = work_cancel(LPWORK, &aioc->aioc_work);
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
{
|
{
|
||||||
/* Remove the container from the list of pending transfers */
|
/* Remove the container from the list of pending
|
||||||
|
* transfers
|
||||||
|
*/
|
||||||
|
|
||||||
next =
|
next =
|
||||||
(FAR struct aio_container_s *)aioc->aioc_link.flink;
|
(FAR struct aio_container_s *)aioc->aioc_link.flink;
|
||||||
|
@ -103,7 +103,8 @@ struct nfsstats
|
|||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
#define EXTERN extern "C"
|
#define EXTERN extern "C"
|
||||||
extern "C" {
|
extern "C"
|
||||||
|
{
|
||||||
#else
|
#else
|
||||||
#define EXTERN extern
|
#define EXTERN extern
|
||||||
#endif
|
#endif
|
||||||
|
@ -80,9 +80,9 @@ struct nfsmount
|
|||||||
uint16_t nm_readdirsize; /* Size of a readdir RPC */
|
uint16_t nm_readdirsize; /* Size of a readdir RPC */
|
||||||
uint16_t nm_buflen; /* Size of I/O buffer */
|
uint16_t nm_buflen; /* Size of I/O buffer */
|
||||||
|
|
||||||
/* Set aside memory on the stack to hold the largest call message. NOTE
|
/* Set aside memory on the stack to hold the largest call message.
|
||||||
* that for the case of the write call message, it is the reply message that
|
* NOTE that for the case of the write call message, it is the reply
|
||||||
* is in this union.
|
* message that is in this union.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
union
|
union
|
||||||
@ -101,24 +101,26 @@ struct nfsmount
|
|||||||
struct rpc_reply_write write;
|
struct rpc_reply_write write;
|
||||||
} nm_msgbuffer;
|
} nm_msgbuffer;
|
||||||
|
|
||||||
/* I/O buffer (must be a aligned to 32-bit boundaries). This buffer used for all
|
/* I/O buffer (must be a aligned to 32-bit boundaries). This buffer used
|
||||||
* reply messages EXCEPT for the WRITE RPC. In that case it is used for the WRITE
|
* for all reply messages EXCEPT for the WRITE RPC. In that case it is used
|
||||||
* call message that contains the data to be written. This buffer must be
|
* for the WRITE call message that contains the data to be written. This
|
||||||
* dynamically sized based on the characteristics of the server and upon the
|
* buffer must be dynamically sized based on the characteristics of the
|
||||||
* configuration of the NuttX network. It must be sized to hold the largest
|
* server and upon the configuration of the NuttX network. It must be
|
||||||
* possible WRITE call message or READ response message.
|
* sized to hold the largest possible WRITE call message or READ response
|
||||||
|
* message.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uint32_t nm_iobuffer[1]; /* Actual size is given by nm_buflen */
|
uint32_t nm_iobuffer[1]; /* Actual size is given by nm_buflen */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The size of the nfsmount structure will depend on the size of the allocated I/O
|
/* The size of the nfsmount structure will depend on the size of the
|
||||||
* buffer.
|
* allocated I/O buffer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SIZEOF_nfsmount(n) (sizeof(struct nfsmount) + ((n + 3) & ~3) - sizeof(uint32_t))
|
#define SIZEOF_nfsmount(n) (sizeof(struct nfsmount) + ((n + 3) & ~3) - sizeof(uint32_t))
|
||||||
|
|
||||||
/* Mount parameters structure. This structure is use in nfs_decode_args function before one
|
/* Mount parameters structure.
|
||||||
|
* This structure is use in nfs_decode_args function before one
|
||||||
* mount structure is allocated in each NFS mount.
|
* mount structure is allocated in each NFS mount.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
34
fs/nfs/rpc.h
34
fs/nfs/rpc.h
@ -12,23 +12,25 @@
|
|||||||
* the regents of the university of michigan
|
* the regents of the university of michigan
|
||||||
* all rights reserved
|
* all rights reserved
|
||||||
*
|
*
|
||||||
* permission is granted to use, copy, create derivative works and redistribute
|
* permission is granted to use, copy, create derivative works and
|
||||||
* this software and such derivative works for any purpose, so long as the name
|
* redistribute this software and such derivative works for any purpose, so
|
||||||
* of the university of michigan is not used in any advertising or publicity
|
* long as the name of the university of michigan is not used in any
|
||||||
* pertaining to the use or distribution of this software without specific,
|
* advertising or publicity pertaining to the use or distribution of this
|
||||||
* written prior authorization. if the above copyright notice or any other
|
* software without specific, written prior authorization. if the above
|
||||||
* identification of the university of michigan is included in any copy of any
|
* copyright notice or any other identification of the university of michigan
|
||||||
* portion of this software, then the disclaimer below must also be included.
|
* is included in any copy of any portion of this software, then the
|
||||||
|
* disclaimer below must also be included.
|
||||||
*
|
*
|
||||||
* this software is provided as is, without representation from the university
|
* this software is provided as is, without representation from the
|
||||||
* of michigan as to its fitness for any purpose, and without warranty by the
|
* university of michigan as to its fitness for any purpose, and without
|
||||||
* university of michigan of any kind, either express or implied, including
|
* warranty by the university of michigan of any kind, either express or
|
||||||
* without limitation the implied warranties of merchantability and fitness for
|
* implied, including without limitation the implied warranties of
|
||||||
* a particular purpose. the regents of the university of michigan shall not be
|
* merchantability and fitness for a particular purpose. the regents of the
|
||||||
* liable for any damages, including special, indirect, incidental, or
|
* university of michigan shall not be liable for any damages, including
|
||||||
* consequential damages, with respect to any claim arising out of or in
|
* special, indirect, incidental, or consequential damages, with respect to
|
||||||
* connection with the use of the software, even if it has been or is hereafter
|
* any claim arising out of or in connection with the use of the software,
|
||||||
* advised of the possibility of such damages.
|
* even if it has been or is hereafter advised of the possibility of such
|
||||||
|
* damages.
|
||||||
*
|
*
|
||||||
* Copyright (c) 1989, 1993
|
* Copyright (c) 1989, 1993
|
||||||
* The Regents of the University of California. All rights reserved.
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
@ -43,8 +43,8 @@
|
|||||||
* Copyright (c) 1989, 1991, 1993, 1995 The Regents of the University of
|
* Copyright (c) 1989, 1991, 1993, 1995 The Regents of the University of
|
||||||
* California. All rights reserved.
|
* California. All rights reserved.
|
||||||
*
|
*
|
||||||
* This code is derived from software contributed to Berkeley by Rick Macklem at
|
* This code is derived from software contributed to Berkeley by Rick Macklem
|
||||||
* The University of Guelph.
|
* at The University of Guelph.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
@ -60,11 +60,11 @@
|
|||||||
* endorse or promote products derived from this software without specific
|
* endorse or promote products derived from this software without specific
|
||||||
* prior written permission.
|
* prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Macros used for conversion to/from xdr representation by nfs...
|
/* Macros used for conversion to/from xdr representation by nfs...
|
||||||
* These use the MACHINE DEPENDENT routines ntohl, htonl
|
* These use the MACHINE DEPENDENT routines ntohl, htonl
|
||||||
* As defined by "XDR: External Data Representation Standard" RFC1014
|
* As defined by "XDR: External Data Representation Standard" RFC1014
|
||||||
|
@ -212,7 +212,9 @@ int smartfs_mount(struct smartfs_mountpt_s *fs, bool writeable)
|
|||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure that that the media is write-able (if write access is needed) */
|
/* Make sure that that the media is write-able
|
||||||
|
* (if write access is needed)
|
||||||
|
*/
|
||||||
|
|
||||||
if (writeable && !geo.geo_writeenabled)
|
if (writeable && !geo.geo_writeenabled)
|
||||||
{
|
{
|
||||||
@ -724,7 +726,9 @@ int smartfs_finddirentry(struct smartfs_mountpt_s *fs,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add used bytes to the total and point to next sector */
|
/* Add used bytes to the total and point
|
||||||
|
* to next sector
|
||||||
|
*/
|
||||||
|
|
||||||
if (*((FAR uint16_t *)header->used) !=
|
if (*((FAR uint16_t *)header->used) !=
|
||||||
SMARTFS_ERASEDSTATE_16BIT)
|
SMARTFS_ERASEDSTATE_16BIT)
|
||||||
@ -847,10 +851,12 @@ errout:
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int smartfs_createentry(FAR struct smartfs_mountpt_s *fs,
|
int smartfs_createentry(FAR struct smartfs_mountpt_s *fs,
|
||||||
uint16_t parentdirsector, FAR const char *filename,
|
uint16_t parentdirsector,
|
||||||
|
FAR const char *filename,
|
||||||
uint16_t type, mode_t mode,
|
uint16_t type, mode_t mode,
|
||||||
FAR struct smartfs_entry_s *direntry,
|
FAR struct smartfs_entry_s *direntry,
|
||||||
uint16_t sectorno, FAR struct smartfs_ofile_s *sf)
|
uint16_t sectorno,
|
||||||
|
FAR struct smartfs_ofile_s *sf)
|
||||||
{
|
{
|
||||||
struct smart_read_write_s readwrite;
|
struct smart_read_write_s readwrite;
|
||||||
int ret;
|
int ret;
|
||||||
@ -1264,7 +1270,9 @@ int smartfs_deleteentry(struct smartfs_mountpt_s *fs,
|
|||||||
offset += entrysize;
|
offset += entrysize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test if the count it zero. If it is, then we will release the sector */
|
/* Test if the count it zero.
|
||||||
|
* If it is, then we will release the sector
|
||||||
|
*/
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
@ -1275,7 +1283,9 @@ int smartfs_deleteentry(struct smartfs_mountpt_s *fs,
|
|||||||
|
|
||||||
nextsector = SMARTFS_NEXTSECTOR(header);
|
nextsector = SMARTFS_NEXTSECTOR(header);
|
||||||
|
|
||||||
/* Now loop through the dir sectors to find ourselves in the chain */
|
/* Now loop through the dir sectors to find ourselves in the
|
||||||
|
* chain
|
||||||
|
*/
|
||||||
|
|
||||||
sector = entry->dfirst;
|
sector = entry->dfirst;
|
||||||
readwrite.offset = 0;
|
readwrite.offset = 0;
|
||||||
|
@ -102,7 +102,9 @@ typedef int32_t(*spiffs_read_t)(uint32_t addr, uint32_t size, uint8_t * dst);
|
|||||||
|
|
||||||
/* spi write call function type */
|
/* spi write call function type */
|
||||||
|
|
||||||
typedef int32_t(*spiffs_write_t)(uint32_t addr, uint32_t size, uint8_t * src);
|
typedef int32_t(*spiffs_write_t)(uint32_t addr,
|
||||||
|
uint32_t size,
|
||||||
|
uint8_t * src);
|
||||||
|
|
||||||
/* spi erase call function type */
|
/* spi erase call function type */
|
||||||
|
|
||||||
|
@ -193,7 +193,8 @@ static int spiffs_cache_page_remove_oldest(FAR struct spiffs_s *fs,
|
|||||||
|
|
||||||
/* Don't remove any cache pages unless there are no free cache pages */
|
/* Don't remove any cache pages unless there are no free cache pages */
|
||||||
|
|
||||||
if ((cache->cpage_use_map & cache->cpage_use_mask) != cache->cpage_use_mask)
|
if ((cache->cpage_use_map & cache->cpage_use_mask) !=
|
||||||
|
cache->cpage_use_mask)
|
||||||
{
|
{
|
||||||
/* At least one free cpage */
|
/* At least one free cpage */
|
||||||
|
|
||||||
@ -463,9 +464,9 @@ ssize_t spiffs_cache_read(FAR struct spiffs_s *fs, uint8_t op, int16_t objid,
|
|||||||
cp->cpndx, cp->pgndx);
|
cp->cpndx, cp->pgndx);
|
||||||
|
|
||||||
ret = spiffs_mtd_read(fs, addr -
|
ret = spiffs_mtd_read(fs, addr -
|
||||||
SPIFFS_PADDR_TO_PAGE_OFFSET(fs, addr),
|
SPIFFS_PADDR_TO_PAGE_OFFSET(fs, addr),
|
||||||
SPIFFS_GEO_PAGE_SIZE(fs),
|
SPIFFS_GEO_PAGE_SIZE(fs),
|
||||||
spiffs_get_cache_page(fs, cache, cp->cpndx));
|
spiffs_get_cache_page(fs, cache, cp->cpndx));
|
||||||
|
|
||||||
mem = spiffs_get_cache_page(fs, cache, cp->cpndx);
|
mem = spiffs_get_cache_page(fs, cache, cp->cpndx);
|
||||||
memcpy(dest, &mem[SPIFFS_PADDR_TO_PAGE_OFFSET(fs, addr)], len);
|
memcpy(dest, &mem[SPIFFS_PADDR_TO_PAGE_OFFSET(fs, addr)], len);
|
||||||
@ -705,7 +706,8 @@ void spiffs_cache_page_release(FAR struct spiffs_s *fs,
|
|||||||
|
|
||||||
for (fobj = (FAR struct spiffs_file_s *)dq_peek(&fs->objq);
|
for (fobj = (FAR struct spiffs_file_s *)dq_peek(&fs->objq);
|
||||||
fobj != NULL;
|
fobj != NULL;
|
||||||
fobj = (FAR struct spiffs_file_s *)dq_next((FAR dq_entry_t *)fobj))
|
fobj =
|
||||||
|
(FAR struct spiffs_file_s *)dq_next((FAR dq_entry_t *)fobj))
|
||||||
{
|
{
|
||||||
/* "Unrefer" the cache page */
|
/* "Unrefer" the cache page */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user