mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 11:26:12 +08:00
Changing NuttX fixed size type names to C99 standard names -- things will be broken for awhile
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2343 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
+16
-13
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* drivers/bch/bch_internal.h
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@@ -41,16 +41,19 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <semaphore.h>
|
||||
#include <nuttx/fs.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define bchlib_semgive(d) sem_post(&(d)->sem) /* To match bchlib_semtake */
|
||||
#define MAX_OPENCNT (255) /* Limit of ubyte */
|
||||
#define MAX_OPENCNT (255) /* Limit of uint8_t */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
@@ -58,15 +61,15 @@
|
||||
|
||||
struct bchlib_s
|
||||
{
|
||||
struct inode *inode; /* I-node of the block driver */
|
||||
sem_t sem; /* For atomic accesses to this structure */
|
||||
size_t nsectors; /* Number of sectors supported by the device */
|
||||
size_t sector; /* The current sector in the buffer */
|
||||
uint16 sectsize; /* The size of one sector on the device */
|
||||
ubyte refs; /* Number of references */
|
||||
boolean dirty; /* Data has been written to the buffer */
|
||||
boolean readonly; /* TRUE: Only read operations are supported */
|
||||
FAR ubyte *buffer; /* One sector buffer */
|
||||
struct inode *inode; /* I-node of the block driver */
|
||||
sem_t sem; /* For atomic accesses to this structure */
|
||||
size_t nsectors; /* Number of sectors supported by the device */
|
||||
size_t sector; /* The current sector in the buffer */
|
||||
uint16_t sectsize; /* The size of one sector on the device */
|
||||
uint8_t refs; /* Number of references */
|
||||
bool dirty; /* Data has been written to the buffer */
|
||||
bool readonly; /* true: Only read operations are supported */
|
||||
FAR uint8_t *buffer; /* One sector buffer */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* drivers/bch/bchdev_register.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -33,18 +33,13 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Compilation Switches
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
@@ -52,7 +47,7 @@
|
||||
#include "bch_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@@ -80,7 +75,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int bchdev_register(const char *blkdev, const char *chardev, boolean readonly)
|
||||
int bchdev_register(const char *blkdev, const char *chardev, bool readonly)
|
||||
{
|
||||
FAR void *handle;
|
||||
int ret;
|
||||
|
||||
@@ -33,17 +33,12 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Compilation Switches
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
@@ -60,7 +55,7 @@
|
||||
#include "bch_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* drivers/bch/bchlib_cache.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -33,10 +33,6 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Compilation Switches
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
@@ -44,7 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
@@ -97,7 +93,7 @@ int bchlib_flushsector(FAR struct bchlib_s *bch)
|
||||
{
|
||||
fdbg("Write failed: %d\n");
|
||||
}
|
||||
bch->dirty = FALSE;
|
||||
bch->dirty = false;
|
||||
}
|
||||
return (int)ret;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* drivers/bch/bchlib_read.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -33,10 +33,6 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Compilation Switches
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
@@ -44,7 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
@@ -86,12 +82,12 @@
|
||||
ssize_t bchlib_read(FAR void *handle, FAR char *buffer, size_t offset, size_t len)
|
||||
{
|
||||
FAR struct bchlib_s *bch = (FAR struct bchlib_s *)handle;
|
||||
size_t nsectors;
|
||||
size_t sector;
|
||||
uint16 sectoffset;
|
||||
size_t nbytes;
|
||||
size_t bytesread;
|
||||
int ret;
|
||||
size_t nsectors;
|
||||
size_t sector;
|
||||
uint16_t sectoffset;
|
||||
size_t nbytes;
|
||||
size_t bytesread;
|
||||
int ret;
|
||||
|
||||
/* Get rid of this special case right away */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* drivers/bch/bchlib_sem.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -33,18 +33,12 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Compilation Switches
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
@@ -52,7 +46,7 @@
|
||||
#include "bch_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* drivers/bch/bchlib_setup.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -33,10 +33,6 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Compilation Switches
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
@@ -46,6 +42,8 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
@@ -84,7 +82,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int bchlib_setup(const char *blkdev, boolean readonly, FAR void **handle)
|
||||
int bchlib_setup(const char *blkdev, bool readonly, FAR void **handle)
|
||||
{
|
||||
FAR struct bchlib_s *bch;
|
||||
struct geometry geo;
|
||||
@@ -143,7 +141,7 @@ int bchlib_setup(const char *blkdev, boolean readonly, FAR void **handle)
|
||||
|
||||
/* Allocate the sector I/O buffer */
|
||||
|
||||
bch->buffer = (FAR ubyte *)malloc(bch->sectsize);
|
||||
bch->buffer = (FAR uint8_t *)malloc(bch->sectsize);
|
||||
if (!bch->buffer)
|
||||
{
|
||||
fdbg("Failed to allocate sector buffer\n");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* drivers/bch/bchlib_teardown.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -33,18 +33,12 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Compilation Switches
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
+11
-14
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* drivers/bch/bchlib_write.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -33,10 +33,6 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Compilation Switches
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
@@ -44,7 +40,8 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
@@ -86,12 +83,12 @@
|
||||
ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, size_t offset, size_t len)
|
||||
{
|
||||
FAR struct bchlib_s *bch = (FAR struct bchlib_s *)handle;
|
||||
size_t nsectors;
|
||||
size_t sector;
|
||||
uint16 sectoffset;
|
||||
size_t nbytes;
|
||||
size_t byteswritten;
|
||||
int ret;
|
||||
size_t nsectors;
|
||||
size_t sector;
|
||||
uint16_t sectoffset;
|
||||
size_t nbytes;
|
||||
size_t byteswritten;
|
||||
int ret;
|
||||
|
||||
/* Get rid of this special case right away */
|
||||
|
||||
@@ -131,7 +128,7 @@ ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, size_t offset, si
|
||||
}
|
||||
|
||||
memcpy(&bch->buffer[sectoffset], buffer, nbytes);
|
||||
bch->dirty = TRUE;
|
||||
bch->dirty = true;
|
||||
|
||||
/* Adjust pointers and counts */
|
||||
|
||||
@@ -195,7 +192,7 @@ ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, size_t offset, si
|
||||
/* Copy the head end of the sector from the user buffer */
|
||||
|
||||
memcpy(bch->buffer, buffer, len);
|
||||
bch->dirty = TRUE;
|
||||
bch->dirty = true;
|
||||
|
||||
/* Adjust counts */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user