From 1528b8dccab30450bf82e1363145c6679a64fd10 Mon Sep 17 00:00:00 2001 From: Petro Karashchenko Date: Sun, 25 Aug 2024 16:37:15 -0400 Subject: [PATCH] nuttx: resolve various 'FAR' and 'CODE' issues Signed-off-by: Petro Karashchenko --- binfmt/libelf/libelf_coredump.c | 2 +- drivers/lcd/memlcd.c | 2 +- drivers/modem/alt1250/altcom_hdlr_firmware.c | 4 +- drivers/modem/alt1250/altcom_pkt.c | 20 +++++----- drivers/modem/alt1250/altmdm.c | 12 +++--- drivers/mtd/gd5f.c | 2 +- drivers/mtd/mx35.c | 2 +- drivers/mtd/smart.c | 6 +-- drivers/sensors/apds9922.c | 2 +- drivers/sensors/as726x.c | 2 +- drivers/sensors/max31865.c | 2 +- drivers/serial/serial.c | 2 +- drivers/usbdev/cdcacm.c | 4 +- fs/mnemofs/mnemofs.h | 4 +- fs/mnemofs/mnemofs_ctz.c | 4 +- fs/nxffs/nxffs.h | 2 +- fs/nxffs/nxffs_block.c | 2 +- fs/nxffs/nxffs_pack.c | 2 +- fs/procfs/fs_procfsutil.c | 2 +- fs/vfs/fs_sendfile.c | 6 +-- include/dsp.h | 2 +- include/nuttx/fs/procfs.h | 40 ++++++++++---------- include/nuttx/lib/math.h | 25 ++++++------ include/nuttx/net/net.h | 14 +++---- include/nuttx/nx/nxmu.h | 2 +- include/strings.h | 1 + include/sys/socket.h | 2 +- libs/libc/misc/lib_dumpvbuffer.c | 2 +- libs/libc/stdlib/lib_qsort.c | 14 +++---- libs/libdsp/lib_svm.c | 2 +- libs/libm/libm.csv | 12 +++--- libs/libm/libm/lib_frexpf.c | 4 +- libs/libm/libm/lib_modf.c | 5 ++- libs/libm/libm/lib_modff.c | 4 +- libs/libm/libm/lib_modfl.c | 2 +- libs/libm/libm/lib_nan.c | 2 +- libs/libm/libm/lib_nanf.c | 3 +- libs/libm/libm/lib_nanl.c | 2 +- libs/libm/libm/lib_sincos.c | 2 +- libs/libm/libm/lib_sincosf.c | 3 +- libs/libm/libm/lib_sincosl.c | 2 +- net/local/local_sendmsg.c | 6 +-- net/utils/net_lock.c | 14 +++---- 43 files changed, 128 insertions(+), 121 deletions(-) diff --git a/binfmt/libelf/libelf_coredump.c b/binfmt/libelf/libelf_coredump.c index 018884bfa1..3de936cc40 100644 --- a/binfmt/libelf/libelf_coredump.c +++ b/binfmt/libelf/libelf_coredump.c @@ -468,7 +468,7 @@ static void elf_emit_memory(FAR struct elf_dumpinfo_s *cinfo, int memsegs) static void elf_emit_tcb_phdr(FAR struct elf_dumpinfo_s *cinfo, FAR struct tcb_s *tcb, - FAR Elf_Phdr *phdr, off_t *offset) + FAR Elf_Phdr *phdr, FAR off_t *offset) { uintptr_t sp; diff --git a/drivers/lcd/memlcd.c b/drivers/lcd/memlcd.c index 45e1667938..e308632a8e 100644 --- a/drivers/lcd/memlcd.c +++ b/drivers/lcd/memlcd.c @@ -258,7 +258,7 @@ static inline void __clear_bit(int nr, uint8_t *addr) *p &= ~mask; } -static inline int __test_bit(int nr, const volatile uint8_t *addr) +static inline int __test_bit(int nr, FAR const volatile uint8_t *addr) { return 1 & (addr[BIT_BYTE(nr)] >> (nr & (BITS_PER_BYTE - 1))); } diff --git a/drivers/modem/alt1250/altcom_hdlr_firmware.c b/drivers/modem/alt1250/altcom_hdlr_firmware.c index 7a936cbcfc..78422cfc6a 100644 --- a/drivers/modem/alt1250/altcom_hdlr_firmware.c +++ b/drivers/modem/alt1250/altcom_hdlr_firmware.c @@ -83,8 +83,8 @@ int32_t altcom_injectimage_pkt_compose(FAR void **arg, size_t arglen, int32_t size = 0; FAR uint8_t *sending_data = (FAR uint8_t *)arg[0]; - int len = *(int *)arg[1]; - bool mode = *(bool *)arg[2]; + int len = *(FAR int *)arg[1]; + bool mode = *(FAR bool *)arg[2]; #ifndef CONFIG_MODEM_ALT1250_DISABLE_PV1 if (altver == ALTCOM_VER1) diff --git a/drivers/modem/alt1250/altcom_pkt.c b/drivers/modem/alt1250/altcom_pkt.c index fda716689c..e1c086c688 100644 --- a/drivers/modem/alt1250/altcom_pkt.c +++ b/drivers/modem/alt1250/altcom_pkt.c @@ -278,7 +278,7 @@ static bool is_header_ok(FAR struct altcom_cmdhdr_s *hdr) * Public Functions ****************************************************************************/ -bool altcom_is_v1pkt_ok(struct altcom_cmdhdr_s *cmdhdr) +bool altcom_is_v1pkt_ok(FAR struct altcom_cmdhdr_s *cmdhdr) { struct calculated_checksum checksum; @@ -292,7 +292,7 @@ bool altcom_is_v1pkt_ok(struct altcom_cmdhdr_s *cmdhdr) && (cmdhdr->payload[0] == LTE_RESULT_OK); } -bool altcom_is_v4pkt_ok(struct altcom_cmdhdr_s *cmdhdr) +bool altcom_is_v4pkt_ok(FAR struct altcom_cmdhdr_s *cmdhdr) { struct calculated_checksum checksum; @@ -308,9 +308,10 @@ bool altcom_is_v4pkt_ok(struct altcom_cmdhdr_s *cmdhdr) FAR void *altcom_make_poweron_cmd_v1(int *sz) { - struct altcom_cmdhdr_s *hdr = (struct altcom_cmdhdr_s *)g_poweron_cmd; - struct altcom_cmdfooter_s *footer - = (struct altcom_cmdfooter_s *)&hdr->payload[0]; + FAR struct altcom_cmdhdr_s *hdr = + (FAR struct altcom_cmdhdr_s *)g_poweron_cmd; + FAR struct altcom_cmdfooter_s *footer = + (FAR struct altcom_cmdfooter_s *)&hdr->payload[0]; set_header_top(hdr, ALTCOM_VER1, ALTCOM_CMDID_POWER_ON_V1); hdr->v1_options = htons(ALTCOM_CMDOPT_CHECKSUM_EN); @@ -334,11 +335,12 @@ FAR void *altcom_make_poweron_cmd_v1(int *sz) FAR void *altcom_make_poweron_cmd_v4(int *sz) { - struct altcom_cmdhdr_s *hdr = (struct altcom_cmdhdr_s *)g_poweron_cmd; + FAR struct altcom_cmdhdr_s *hdr = + (FAR struct altcom_cmdhdr_s *)g_poweron_cmd; set_header_top(hdr, ALTCOM_VER4, ALTCOM_CMDID_POWER_ON_V4); hdr->v4_hdr_cksum = htons(calc_checksum_v4((FAR uint8_t *)hdr, - sizeof(struct altcom_cmdhdr_s)-4)); + sizeof(struct altcom_cmdhdr_s) - 4)); hdr->v4_data_cksum = htons(calc_checksum_v4(&hdr->payload[0], 0)); /* No payload of this altcom command. So sending size is just header size */ @@ -405,8 +407,8 @@ uint16_t altcom_make_header(FAR struct altcom_cmdhdr_s *hdr, if (ver == ALTCOM_VER1) { - struct altcom_cmdfooter_s *footer - = (struct altcom_cmdfooter_s *)&hdr->payload[sz]; + FAR struct altcom_cmdfooter_s *footer = + (FAR struct altcom_cmdfooter_s *)&hdr->payload[sz]; hdr->v1_options = htons(ALTCOM_CMDOPT_CHECKSUM_EN); hdr->v1_checksum = diff --git a/drivers/modem/alt1250/altmdm.c b/drivers/modem/alt1250/altmdm.c index f45e87edd7..f1745b2dbd 100644 --- a/drivers/modem/alt1250/altmdm.c +++ b/drivers/modem/alt1250/altmdm.c @@ -917,7 +917,7 @@ static altmdm_state_t process_state_v1set(uint32_t event, altmdm_state_t state) { int len; - void *pkt; + FAR void *pkt; pkt = altcom_make_poweron_cmd_v1(&len); set_vp(VP_TRYV1); @@ -934,7 +934,7 @@ static altmdm_state_t process_state_v4set(uint32_t event, altmdm_state_t state) { int len; - void *pkt; + FAR void *pkt; pkt = altcom_make_poweron_cmd_v4(&len); set_vp(VP_TRYV4); @@ -962,7 +962,7 @@ static altmdm_state_t process_state_sleepset(uint32_t event, static altmdm_state_t process_state_txprepare(uint32_t event, altmdm_state_t state) { - void *buff; + FAR void *buff; int len; nxsem_wait_uninterruptible(&g_altmdm_dev.lock_txreq); @@ -1217,7 +1217,7 @@ static altmdm_state_t process_state_gotrx(uint32_t event, altmdm_state_t state) { enum version_phase_e vp; - void *rcv_data; + FAR void *rcv_data; state = ALTMDM_STATE_DECIDEDELAY; @@ -1232,7 +1232,7 @@ static altmdm_state_t process_state_gotrx(uint32_t event, vp = get_vp(); if (vp == VP_TRYV1) { - if (altcom_is_v1pkt_ok((struct altcom_cmdhdr_s *)rcv_data)) + if (altcom_is_v1pkt_ok((FAR struct altcom_cmdhdr_s *)rcv_data)) { set_vp(VP_V1); set_return_code(ALTMDM_RETURN_RESET_V1); @@ -1244,7 +1244,7 @@ static altmdm_state_t process_state_gotrx(uint32_t event, } } else if ((vp == VP_TRYV4) - && altcom_is_v4pkt_ok((struct altcom_cmdhdr_s *)rcv_data)) + && altcom_is_v4pkt_ok((FAR struct altcom_cmdhdr_s *)rcv_data)) { set_vp(VP_V4); set_return_code(ALTMDM_RETURN_RESET_V4); diff --git a/drivers/mtd/gd5f.c b/drivers/mtd/gd5f.c index fa8ed7ab71..9f5e252a9c 100644 --- a/drivers/mtd/gd5f.c +++ b/drivers/mtd/gd5f.c @@ -793,7 +793,7 @@ static int gd5f_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg) case MTDIOC_ECCSTATUS: { - uint8_t *result = (FAR uint8_t *)arg; + FAR uint8_t *result = (FAR uint8_t *)arg; *result = (priv->eccstatus & GD5F_FEATURE_ECC_MASK) >> GD5F_FEATURE_ECC_OFFSET; diff --git a/drivers/mtd/mx35.c b/drivers/mtd/mx35.c index 5e2c7a9658..57d30e93d2 100644 --- a/drivers/mtd/mx35.c +++ b/drivers/mtd/mx35.c @@ -839,7 +839,7 @@ static int mx35_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg) case MTDIOC_ECCSTATUS: { - uint8_t *result = (FAR uint8_t *)arg; + FAR uint8_t *result = (FAR uint8_t *)arg; *result = (priv->eccstatus & MX35_FEATURE_ECC_MASK) >> MX35_FEATURE_ECC_OFFSET; diff --git a/drivers/mtd/smart.c b/drivers/mtd/smart.c index b3747d4c59..801b80216a 100644 --- a/drivers/mtd/smart.c +++ b/drivers/mtd/smart.c @@ -3231,7 +3231,7 @@ static inline int smart_llformat(FAR struct smart_struct_s *dev, #ifdef CONFIG_SMART_CRC_8 sectorheader->crc8 = smart_calc_sector_crc(dev); #elif defined(CONFIG_SMART_CRC_16) - *((uint16_t *)sectorheader->crc16) = smart_calc_sector_crc(dev); + *((FAR uint16_t *)sectorheader->crc16) = smart_calc_sector_crc(dev); #elif defined(CONFIG_SMART_CRC_32) *((FAR uint32_t *)sectorheader->crc32) = smart_calc_sector_crc(dev); #endif @@ -3393,7 +3393,7 @@ static int smart_relocate_sector(FAR struct smart_struct_s *dev, #ifdef CONFIG_SMART_CRC_8 header->crc8 = smart_calc_sector_crc(dev); #elif defined(CONFIG_SMART_CRC_16) - *((uint16_t *)header->crc16) = smart_calc_sector_crc(dev); + *((FAR uint16_t *)header->crc16) = smart_calc_sector_crc(dev); #elif defined(CONFIG_SMART_CRC_32) *((FAR uint32_t *)header->crc32) = smart_calc_sector_crc(dev); #endif @@ -4818,7 +4818,7 @@ static int smart_writesector(FAR struct smart_struct_s *dev, #ifdef CONFIG_SMART_CRC_8 header->crc8 = smart_calc_sector_crc(dev); #elif defined(CONFIG_SMART_CRC_16) - *((uint16_t *)header->crc16) = smart_calc_sector_crc(dev); + *((FAR uint16_t *)header->crc16) = smart_calc_sector_crc(dev); #elif defined(CONFIG_SMART_CRC_32) *((FAR uint32_t *)header->crc32) = smart_calc_sector_crc(dev); #endif diff --git a/drivers/sensors/apds9922.c b/drivers/sensors/apds9922.c index e9d23805b1..150dd4c8f3 100644 --- a/drivers/sensors/apds9922.c +++ b/drivers/sensors/apds9922.c @@ -1996,7 +1996,7 @@ static ssize_t apds9922_als_read(FAR struct file *filep, FAR char *buffer, return (ssize_t)-EINVAL; } - ptr = (int *)buffer; + ptr = (FAR int *)buffer; if (priv->als < 0) { diff --git a/drivers/sensors/as726x.c b/drivers/sensors/as726x.c index e40c3d04e4..de2955ceb6 100644 --- a/drivers/sensors/as726x.c +++ b/drivers/sensors/as726x.c @@ -141,7 +141,7 @@ static float as726x_getcalibrated(FAR struct as726x_dev_s *priv, colourdata |= ((uint32_t) byte2 << (8 * 1)); colourdata |= ((uint32_t) byte3 << (8 * 0)); - return *((float *)(&colourdata)); + return *((FAR float *)(&colourdata)); } /**************************************************************************** diff --git a/drivers/sensors/max31865.c b/drivers/sensors/max31865.c index e998debe96..816e0d5fc0 100644 --- a/drivers/sensors/max31865.c +++ b/drivers/sensors/max31865.c @@ -255,7 +255,7 @@ static ssize_t max31865_read(FAR struct file *filep, FAR char *buffer, temp = (-RTD_A + sqrt(RTD_A * RTD_A - 4 * RTD_B * (1 - rt / 100.0))) \ / (2 * RTD_B); - *(float *)buffer = temp; + *(FAR float *)buffer = temp; sninfo("MAX31865 ADC: %d, RTD: %.2f, temperature: %.1f\n", \ regmsb, rt, temp); diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c index 2164a1d61c..d52c9b244a 100644 --- a/drivers/serial/serial.c +++ b/drivers/serial/serial.c @@ -1779,7 +1779,7 @@ static void uart_launch_foreach(FAR struct tcb_s *tcb, FAR void *arg) if (!strcmp(tcb->name, CONFIG_TTY_LAUNCH_FILEPATH)) #endif { - *(int *)arg = 1; + *(FAR int *)arg = 1; } } diff --git a/drivers/usbdev/cdcacm.c b/drivers/usbdev/cdcacm.c index 2804c5d747..fa22e5b249 100644 --- a/drivers/usbdev/cdcacm.c +++ b/drivers/usbdev/cdcacm.c @@ -2435,7 +2435,7 @@ static int cdcuart_ioctl(FAR struct file *filep, int cmd, unsigned long arg) leave_critical_section(flags); - *(int *)arg = count; + *(FAR int *)arg = count; ret = 0; } break; @@ -2461,7 +2461,7 @@ static int cdcuart_ioctl(FAR struct file *filep, int cmd, unsigned long arg) leave_critical_section(flags); - *(int *)arg = count; + *(FAR int *)arg = count; ret = 0; } break; diff --git a/fs/mnemofs/mnemofs.h b/fs/mnemofs/mnemofs.h index 3415c74ac1..43abb57204 100644 --- a/fs/mnemofs/mnemofs.h +++ b/fs/mnemofs/mnemofs.h @@ -270,7 +270,7 @@ struct mfs_dirent_s struct timespec st_ctim; /* Time of last status change */ struct mfs_ctz_s ctz; uint8_t namelen; - FAR char name[]; + char name[]; }; /* Parent iterator */ @@ -320,7 +320,7 @@ extern "C" ****************************************************************************/ static mfs_t inline mfs_blkremsz(FAR const struct mfs_sb_s * const sb, - mfs_t pg, mfs_t pgoff) + mfs_t pg, mfs_t pgoff) { return MFS_BLKSZ(sb) - (MFS_PG2BLKPGOFF(sb, pg) * sb->pg_sz + pgoff); } diff --git a/fs/mnemofs/mnemofs_ctz.c b/fs/mnemofs/mnemofs_ctz.c index 0d6eea664b..38ca8ba7dd 100644 --- a/fs/mnemofs/mnemofs_ctz.c +++ b/fs/mnemofs/mnemofs_ctz.c @@ -123,7 +123,7 @@ static void ctz_off2loc(FAR const struct mfs_sb_s * const sb, mfs_t off, static mfs_t ctz_blkdatasz(FAR const struct mfs_sb_s * const sb, const mfs_t idx); static void ctz_copyidxptrs(FAR const struct mfs_sb_s * const sb, - FAR struct mfs_ctz_s ctz, const mfs_t idx, + struct mfs_ctz_s ctz, const mfs_t idx, FAR char *buf); /**************************************************************************** @@ -259,7 +259,7 @@ static mfs_t ctz_blkdatasz(FAR const struct mfs_sb_s * const sb, ****************************************************************************/ static void ctz_copyidxptrs(FAR const struct mfs_sb_s * const sb, - FAR struct mfs_ctz_s ctz, const mfs_t idx, + struct mfs_ctz_s ctz, const mfs_t idx, FAR char *buf) { mfs_t i; diff --git a/fs/nxffs/nxffs.h b/fs/nxffs/nxffs.h index a2da06a36e..3be58a134d 100644 --- a/fs/nxffs/nxffs.h +++ b/fs/nxffs/nxffs.h @@ -691,7 +691,7 @@ int nxffs_verifyblock(FAR struct nxffs_volume_s *volume, off_t block); * ****************************************************************************/ -int nxffs_validblock(struct nxffs_volume_s *volume, off_t *block); +int nxffs_validblock(FAR struct nxffs_volume_s *volume, FAR off_t *block); /**************************************************************************** * Name: nxffs_blockstats diff --git a/fs/nxffs/nxffs_block.c b/fs/nxffs/nxffs_block.c index db94828e10..5205e33827 100644 --- a/fs/nxffs/nxffs_block.c +++ b/fs/nxffs/nxffs_block.c @@ -125,7 +125,7 @@ int nxffs_verifyblock(FAR struct nxffs_volume_s *volume, off_t block) * ****************************************************************************/ -int nxffs_validblock(struct nxffs_volume_s *volume, off_t *block) +int nxffs_validblock(FAR struct nxffs_volume_s *volume, FAR off_t *block) { off_t i; int ret; diff --git a/fs/nxffs/nxffs_pack.c b/fs/nxffs/nxffs_pack.c index 24c5c562bf..8a3af04779 100644 --- a/fs/nxffs/nxffs_pack.c +++ b/fs/nxffs/nxffs_pack.c @@ -251,7 +251,7 @@ static inline off_t nxffs_mediacheck(FAR struct nxffs_volume_s *volume, static inline int nxffs_startpos(FAR struct nxffs_volume_s *volume, FAR struct nxffs_pack_s *pack, - off_t *froffset) + FAR off_t *froffset) { struct nxffs_blkentry_s blkentry; off_t offset = *froffset; diff --git a/fs/procfs/fs_procfsutil.c b/fs/procfs/fs_procfsutil.c index 1b3415849a..206724ba1a 100644 --- a/fs/procfs/fs_procfsutil.c +++ b/fs/procfs/fs_procfsutil.c @@ -91,7 +91,7 @@ size_t procfs_memcpy(FAR const char *src, size_t srclen, FAR char *dest, size_t destlen, - off_t *offset) + FAR off_t *offset) { size_t copysize; size_t lnoffset; diff --git a/fs/vfs/fs_sendfile.c b/fs/vfs/fs_sendfile.c index ac460a63bf..93b7772bd8 100644 --- a/fs/vfs/fs_sendfile.c +++ b/fs/vfs/fs_sendfile.c @@ -37,7 +37,7 @@ ****************************************************************************/ static ssize_t copyfile(FAR struct file *outfile, FAR struct file *infile, - off_t *offset, size_t count) + FAR off_t *offset, size_t count) { FAR uint8_t *iobuffer; FAR uint8_t *wrbuffer; @@ -243,7 +243,7 @@ static ssize_t copyfile(FAR struct file *outfile, FAR struct file *infile, ****************************************************************************/ ssize_t file_sendfile(FAR struct file *outfile, FAR struct file *infile, - off_t *offset, size_t count) + FAR off_t *offset, size_t count) { if (count == 0) { @@ -327,7 +327,7 @@ ssize_t file_sendfile(FAR struct file *outfile, FAR struct file *infile, * ****************************************************************************/ -ssize_t sendfile(int outfd, int infd, off_t *offset, size_t count) +ssize_t sendfile(int outfd, int infd, FAR off_t *offset, size_t count) { FAR struct file *outfile; FAR struct file *infile; diff --git a/include/dsp.h b/include/dsp.h index b4a7f1462e..b387c27248 100644 --- a/include/dsp.h +++ b/include/dsp.h @@ -522,7 +522,7 @@ void phase_angle_update(FAR struct phase_angle_f32_s *angle, float val); void svm3_init(FAR struct svm3_state_f32_s *s); void svm3(FAR struct svm3_state_f32_s *s, FAR ab_frame_f32_t *ab); void svm3_current_correct(FAR struct svm3_state_f32_s *s, - float *c0, float *c1, float *c2); + FAR float *c0, FAR float *c1, FAR float *c2); /* Field Oriented Control */ diff --git a/include/nuttx/fs/procfs.h b/include/nuttx/fs/procfs.h index 902d612587..6d161b51a7 100644 --- a/include/nuttx/fs/procfs.h +++ b/include/nuttx/fs/procfs.h @@ -44,23 +44,21 @@ struct procfs_operations * information to manage privileges. */ - int (*open)(FAR struct file *filep, FAR const char *relpath, - int oflags, mode_t mode); + CODE int (*open)(FAR struct file *filep, FAR const char *relpath, + int oflags, mode_t mode); /* The following methods must be identical in signature and position * because the struct file_operations and struct mountpt_operations are * treated like unions. */ - int (*close)(FAR struct file *filep); - ssize_t (*read)(FAR struct file *filep, - FAR char *buffer, - size_t buflen); - ssize_t (*write)(FAR struct file *filep, - FAR const char *buffer, - size_t buflen); - int (*poll)(FAR struct file *filep, FAR struct pollfd *fds, - bool setup); + CODE int (*close)(FAR struct file *filep); + CODE ssize_t (*read)(FAR struct file *filep, FAR char *buffer, + size_t buflen); + CODE ssize_t (*write)(FAR struct file *filep, FAR const char *buffer, + size_t buflen); + CODE int (*poll)(FAR struct file *filep, FAR struct pollfd *fds, + bool setup); /* The two structures need not be common after this point. The following * are extended methods needed to deal with the unique needs of mounted @@ -69,20 +67,20 @@ struct procfs_operations * Additional open-file-specific procfs operations: */ - int (*dup)(FAR const struct file *oldp, - FAR struct file *newp); + CODE int (*dup)(FAR const struct file *oldp, FAR struct file *newp); /* Directory operations */ - int (*opendir)(FAR const char *relpath, - FAR struct fs_dirent_s **dir); - int (*closedir)(FAR struct fs_dirent_s *dir); - int (*readdir)(FAR struct fs_dirent_s *dir, FAR struct dirent *entry); - int (*rewinddir)(FAR struct fs_dirent_s *dir); + CODE int (*opendir)(FAR const char *relpath, + FAR struct fs_dirent_s **dir); + CODE int (*closedir)(FAR struct fs_dirent_s *dir); + CODE int (*readdir)(FAR struct fs_dirent_s *dir, + FAR struct dirent *entry); + CODE int (*rewinddir)(FAR struct fs_dirent_s *dir); /* Operations on paths */ - int (*stat)(FAR const char *relpath, FAR struct stat *buf); + CODE int (*stat)(FAR const char *relpath, FAR struct stat *buf); }; /* Procfs handler prototypes ************************************************/ @@ -135,7 +133,7 @@ struct procfs_meminfo_entry_s { FAR const char *name; FAR struct mm_heap_s *heap; - struct procfs_meminfo_entry_s *next; + FAR struct procfs_meminfo_entry_s *next; #if CONFIG_MM_BACKTRACE >= 0 /* This is dynamic control flag whether to turn on backtrace in the heap, @@ -202,7 +200,7 @@ extern "C" size_t procfs_memcpy(FAR const char *src, size_t srclen, FAR char *dest, size_t destlen, - off_t *offset); + FAR off_t *offset); /**************************************************************************** * Name: procfs_snprintf diff --git a/include/nuttx/lib/math.h b/include/nuttx/lib/math.h index a5469c2e3f..8915a197ff 100644 --- a/include/nuttx/lib/math.h +++ b/include/nuttx/lib/math.h @@ -26,6 +26,7 @@ ****************************************************************************/ #include +#include /* If CONFIG_ARCH_MATH_H is defined, then the top-level Makefile will copy * this header file to include/math.h where it will become the system math.h @@ -225,12 +226,12 @@ double fabs (double x); long double fabsl (long double x); #endif -float modff (float x, float *iptr); +float modff (float x, FAR float *iptr); #ifdef CONFIG_HAVE_DOUBLE -double modf (double x, double *iptr); +double modf (double x, FAR double *iptr); #endif #ifdef CONFIG_HAVE_LONG_DOUBLE -long double modfl (long double x, long double *iptr); +long double modfl (long double x, FAR long double *iptr); #endif float fmodf (float x, float div); @@ -388,22 +389,22 @@ double ldexp (double x, int n); long double ldexpl(long double x, int n); #endif -float frexpf(float x, int *exp); +float frexpf(float x, FAR int *exp); #ifdef CONFIG_HAVE_DOUBLE -double frexp (double x, int *exp); +double frexp (double x, FAR int *exp); #endif #ifdef CONFIG_HAVE_LONG_DOUBLE -long double frexpl(long double x, int *exp); +long double frexpl(long double x, FAR int *exp); #endif /* Trigonometric Functions **************************************************/ -void sincosf(float, float *, float *); +void sincosf(float, FAR float *, FAR float *); #ifdef CONFIG_HAVE_DOUBLE -void sincos(double, double *, double *); +void sincos(double, FAR double *, FAR double *); #endif #ifdef CONFIG_HAVE_LONG_DOUBLE -void sincosl(long double, long double *, long double *); +void sincosl(long double, FAR long double *, FAR long double *); #endif float sinf (float x); @@ -545,12 +546,12 @@ double trunc (double x); long double truncl (long double x); #endif -float nanf(const char *tagp); +float nanf(FAR const char *tagp); #ifdef CONFIG_HAVE_DOUBLE -double nan(const char *tagp); +double nan(FAR const char *tagp); #endif #ifdef CONFIG_HAVE_LONG_DOUBLE -long double nanl(const char *tagp); +long double nanl(FAR const char *tagp); #endif float nearbyintf(float x); diff --git a/include/nuttx/net/net.h b/include/nuttx/net/net.h index 739285102c..14012630a2 100644 --- a/include/nuttx/net/net.h +++ b/include/nuttx/net/net.h @@ -400,7 +400,7 @@ void net_unlock(void); * ****************************************************************************/ -int net_sem_timedwait(sem_t *sem, unsigned int timeout); +int net_sem_timedwait(FAR sem_t *sem, unsigned int timeout); /**************************************************************************** * Name: net_mutex_timedlock @@ -424,7 +424,7 @@ int net_sem_timedwait(sem_t *sem, unsigned int timeout); * ****************************************************************************/ -int net_mutex_timedlock(mutex_t *mutex, unsigned int timeout); +int net_mutex_timedlock(FAR mutex_t *mutex, unsigned int timeout); /**************************************************************************** * Name: net_sem_wait @@ -446,7 +446,7 @@ int net_mutex_timedlock(mutex_t *mutex, unsigned int timeout); * ****************************************************************************/ -int net_sem_wait(sem_t *sem); +int net_sem_wait(FAR sem_t *sem); /**************************************************************************** * Name: net_mutex_lock @@ -468,7 +468,7 @@ int net_sem_wait(sem_t *sem); * ****************************************************************************/ -int net_mutex_lock(mutex_t *mutex); +int net_mutex_lock(FAR mutex_t *mutex); /**************************************************************************** * Name: net_sem_timedwait_uninterruptible @@ -487,7 +487,7 @@ int net_mutex_lock(mutex_t *mutex); * ****************************************************************************/ -int net_sem_timedwait_uninterruptible(sem_t *sem, unsigned int timeout); +int net_sem_timedwait_uninterruptible(FAR sem_t *sem, unsigned int timeout); /**************************************************************************** * Name: net_sem_wait_uninterruptible @@ -505,7 +505,7 @@ int net_sem_timedwait_uninterruptible(sem_t *sem, unsigned int timeout); * ****************************************************************************/ -int net_sem_wait_uninterruptible(sem_t *sem); +int net_sem_wait_uninterruptible(FAR sem_t *sem); #ifdef CONFIG_MM_IOB @@ -955,7 +955,7 @@ ssize_t psock_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg, * ****************************************************************************/ -ssize_t psock_send(FAR struct socket *psock, const void *buf, size_t len, +ssize_t psock_send(FAR struct socket *psock, FAR const void *buf, size_t len, int flags); /**************************************************************************** diff --git a/include/nuttx/nx/nxmu.h b/include/nuttx/nx/nxmu.h index 292d172df9..5b861db1cd 100644 --- a/include/nuttx/nx/nxmu.h +++ b/include/nuttx/nx/nxmu.h @@ -435,7 +435,7 @@ struct nxsvrmsg_getrectangle_s unsigned int plane; /* The plane number to read */ FAR uint8_t *dest; /* Memory location in which to store the graphics data */ unsigned int deststride; /* Width of the destination memory in bytes */ - sem_t *sem_done; /* Semaphore to report when command is done. */ + FAR sem_t *sem_done; /* Semaphore to report when command is done. */ }; /* Fill a trapezoidal region in the window with a color */ diff --git a/include/strings.h b/include/strings.h index cde41afa84..b80c03248e 100644 --- a/include/strings.h +++ b/include/strings.h @@ -26,6 +26,7 @@ ****************************************************************************/ #include +#include #include diff --git a/include/sys/socket.h b/include/sys/socket.h index 0e9bb8c1c5..2ef50f90d0 100644 --- a/include/sys/socket.h +++ b/include/sys/socket.h @@ -262,7 +262,7 @@ #define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr((mhdr), (cmsg)) #define CMSG_ALIGN(len) \ - (((len)+sizeof(long)-1) & ~(sizeof(long)-1)) + (((len) + sizeof(long) - 1) & ~(sizeof(long) - 1)) #define CMSG_DATA(cmsg) \ ((FAR void *)((FAR char *)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr)))) #define CMSG_SPACE(len) \ diff --git a/libs/libc/misc/lib_dumpvbuffer.c b/libs/libc/misc/lib_dumpvbuffer.c index b52d2c2866..7d08687d3b 100644 --- a/libs/libc/misc/lib_dumpvbuffer.c +++ b/libs/libc/misc/lib_dumpvbuffer.c @@ -97,7 +97,7 @@ static void lib_dumpvfile_handler(FAR void *arg, FAR const char *fmt, ...) { va_list ap; - int *fd = (int *)arg; + FAR int *fd = (FAR int *)arg; va_start(ap, fmt); vdprintf(*fd, fmt, ap); diff --git a/libs/libc/stdlib/lib_qsort.c b/libs/libc/stdlib/lib_qsort.c index ea9e3151d0..4e61168d8f 100644 --- a/libs/libc/stdlib/lib_qsort.c +++ b/libs/libc/stdlib/lib_qsort.c @@ -56,11 +56,11 @@ #define swapcode(TYPE, parmi, parmj, n) \ { \ - long i = (n) / sizeof (TYPE); \ - register TYPE *pi = (TYPE *)(parmi); \ - register TYPE *pj = (TYPE *)(parmj); \ + long i = (n) / sizeof(TYPE); \ + register FAR TYPE *pi = (FAR TYPE *)(parmi); \ + register FAR TYPE *pj = (FAR TYPE *)(parmj); \ do { \ - register TYPE t = *pi; \ + register TYPE t = *pi; \ *pi++ = *pj; \ *pj++ = t; \ } while (--i > 0); \ @@ -73,9 +73,9 @@ #define swap(a, b) \ if (swaptype == 0) \ { \ - long t = *(long *)(a); \ - *(long *)(a) = *(long *)(b); \ - *(long *)(b) = t; \ + long t = *(FAR long *)(a); \ + *(FAR long *)(a) = *(FAR long *)(b); \ + *(FAR long *)(b) = t; \ } \ else \ { \ diff --git a/libs/libdsp/lib_svm.c b/libs/libdsp/lib_svm.c index c4119dadd5..9879af4923 100644 --- a/libs/libdsp/lib_svm.c +++ b/libs/libdsp/lib_svm.c @@ -356,7 +356,7 @@ void svm3(FAR struct svm3_state_f32_s *s, FAR ab_frame_f32_t *v_ab) ****************************************************************************/ void svm3_current_correct(FAR struct svm3_state_f32_s *s, - float *c0, float *c1, float *c2) + FAR float *c0, FAR float *c1, FAR float *c2) { /* Get best ADC samples according to SVM sector. * diff --git a/libs/libm/libm.csv b/libs/libm/libm.csv index 9b0cbb4559..8d93bba54f 100644 --- a/libs/libm/libm.csv +++ b/libs/libm/libm.csv @@ -31,9 +31,9 @@ "fmod","math.h","defined(CONFIG_HAVE_DOUBLE) && !defined(CONFIG_LIBM_NONE)","double","double","double" "fmodf","math.h","!defined(CONFIG_LIBM_NONE)","float","float","float" "fmodl","math.h","defined(CONFIG_HAVE_LONG_DOUBLE) && !defined(CONFIG_LIBM_NONE)","long double","long double","long double" -"frexp","math.h","defined(CONFIG_HAVE_DOUBLE) && !defined(CONFIG_LIBM_NONE)","double","double","int *" -"frexpf","math.h","!defined(CONFIG_LIBM_NONE)","float","float","int *" -"frexpl","math.h","defined(CONFIG_HAVE_LONG_DOUBLE) && !defined(CONFIG_LIBM_NONE)","long double","long double","int *" +"frexp","math.h","defined(CONFIG_HAVE_DOUBLE) && !defined(CONFIG_LIBM_NONE)","double","double","FAR int *" +"frexpf","math.h","!defined(CONFIG_LIBM_NONE)","float","float","FAR int *" +"frexpl","math.h","defined(CONFIG_HAVE_LONG_DOUBLE) && !defined(CONFIG_LIBM_NONE)","long double","long double","FAR int *" "gamma","math.h","defined(CONFIG_HAVE_DOUBLE) && !defined(CONFIG_LIBM_NONE)","double","double" "ldexp","math.h","defined(CONFIG_HAVE_DOUBLE) && !defined(CONFIG_LIBM_NONE)","double","double","int" "ldexpf","math.h","!defined(CONFIG_LIBM_NONE)","float","float","int" @@ -48,9 +48,9 @@ "log2l","math.h","defined(CONFIG_HAVE_LONG_DOUBLE) && !defined(CONFIG_LIBM_NONE)","long double","long double" "logf","math.h","!defined(CONFIG_LIBM_NONE)","float","float" "logl","math.h","defined(CONFIG_HAVE_LONG_DOUBLE) && !defined(CONFIG_LIBM_NONE)","long double","long double" -"modf","math.h","defined(CONFIG_HAVE_DOUBLE) && !defined(CONFIG_LIBM_NONE)","double","double","double *" -"modff","math.h","!defined(CONFIG_LIBM_NONE)","float","float","float *" -"modfl","math.h","defined(CONFIG_HAVE_LONG_DOUBLE) && !defined(CONFIG_LIBM_NONE)","long double","long double","long double *" +"modf","math.h","defined(CONFIG_HAVE_DOUBLE) && !defined(CONFIG_LIBM_NONE)","double","double","FAR double *" +"modff","math.h","!defined(CONFIG_LIBM_NONE)","float","float","FAR float *" +"modfl","math.h","defined(CONFIG_HAVE_LONG_DOUBLE) && !defined(CONFIG_LIBM_NONE)","long double","long double","FAR long double *" "pow","math.h","defined(CONFIG_HAVE_DOUBLE) && !defined(CONFIG_LIBM_NONE)","double","double","double" "powf","math.h","!defined(CONFIG_LIBM_NONE)","float","float","float" "powl","math.h","defined(CONFIG_HAVE_LONG_DOUBLE) && !defined(CONFIG_LIBM_NONE)","long double","long double","long double" diff --git a/libs/libm/libm/lib_frexpf.c b/libs/libm/libm/lib_frexpf.c index 36a4eb0231..fbd8f9bf19 100644 --- a/libs/libm/libm/lib_frexpf.c +++ b/libs/libm/libm/lib_frexpf.c @@ -29,13 +29,15 @@ * Included Files ****************************************************************************/ +#include + #include /**************************************************************************** * Public Functions ****************************************************************************/ -float frexpf(float x, int *exponent) +float frexpf(float x, FAR int *exponent) { float res; diff --git a/libs/libm/libm/lib_modf.c b/libs/libm/libm/lib_modf.c index d48c92f2c5..f482559b4c 100644 --- a/libs/libm/libm/lib_modf.c +++ b/libs/libm/libm/lib_modf.c @@ -29,6 +29,9 @@ * Included Files ****************************************************************************/ +#include +#include + #include #include @@ -37,7 +40,7 @@ ****************************************************************************/ #ifdef CONFIG_HAVE_DOUBLE -double modf(double x, double *iptr) +double modf(double x, FAR double *iptr) { if (fabs(x) >= 4503599627370496.0) { diff --git a/libs/libm/libm/lib_modff.c b/libs/libm/libm/lib_modff.c index 2267a53a53..650a9405a4 100644 --- a/libs/libm/libm/lib_modff.c +++ b/libs/libm/libm/lib_modff.c @@ -29,13 +29,15 @@ * Included Files ****************************************************************************/ +#include + #include /**************************************************************************** * Public Functions ****************************************************************************/ -float modff(float x, float *iptr) +float modff(float x, FAR float *iptr) { if (fabsf(x) >= 8388608.0F) { diff --git a/libs/libm/libm/lib_modfl.c b/libs/libm/libm/lib_modfl.c index 5a857dcd69..003cdadcfe 100644 --- a/libs/libm/libm/lib_modfl.c +++ b/libs/libm/libm/lib_modfl.c @@ -40,7 +40,7 @@ ****************************************************************************/ #ifdef CONFIG_HAVE_LONG_DOUBLE -long double modfl(long double x, long double *iptr) +long double modfl(long double x, FAR long double *iptr) { if (fabsl(x) >= 4503599627370496.0) { diff --git a/libs/libm/libm/lib_nan.c b/libs/libm/libm/lib_nan.c index 1be0b43ae3..6d08537e23 100644 --- a/libs/libm/libm/lib_nan.c +++ b/libs/libm/libm/lib_nan.c @@ -32,7 +32,7 @@ ****************************************************************************/ #ifdef CONFIG_HAVE_DOUBLE -double nan(const char *tagp) +double nan(FAR const char *tagp) { return (double)NAN; } diff --git a/libs/libm/libm/lib_nanf.c b/libs/libm/libm/lib_nanf.c index 2b648c127d..6f2494bb93 100644 --- a/libs/libm/libm/lib_nanf.c +++ b/libs/libm/libm/lib_nanf.c @@ -22,7 +22,6 @@ * Included Files ****************************************************************************/ -#include #include #include @@ -31,7 +30,7 @@ * Public Functions ****************************************************************************/ -float nanf(const char *tagp) +float nanf(FAR const char *tagp) { return (float)NAN; } diff --git a/libs/libm/libm/lib_nanl.c b/libs/libm/libm/lib_nanl.c index ac86785865..6070c5eb99 100644 --- a/libs/libm/libm/lib_nanl.c +++ b/libs/libm/libm/lib_nanl.c @@ -32,7 +32,7 @@ ****************************************************************************/ #ifdef CONFIG_HAVE_LONG_DOUBLE -long double nanl(const char *tagp) +long double nanl(FAR const char *tagp) { return (long double)NAN; } diff --git a/libs/libm/libm/lib_sincos.c b/libs/libm/libm/lib_sincos.c index a3c3fc82ae..b9335b261b 100644 --- a/libs/libm/libm/lib_sincos.c +++ b/libs/libm/libm/lib_sincos.c @@ -42,7 +42,7 @@ #ifdef CONFIG_HAVE_DOUBLE nooptimiziation_function -void sincos(double x, double *s, double *c) +void sincos(double x, FAR double *s, FAR double *c) { *s = sin(x); *c = cos(x); diff --git a/libs/libm/libm/lib_sincosf.c b/libs/libm/libm/lib_sincosf.c index 064cb0e757..6396905afe 100644 --- a/libs/libm/libm/lib_sincosf.c +++ b/libs/libm/libm/lib_sincosf.c @@ -22,7 +22,6 @@ * Included Files ****************************************************************************/ -#include #include #include @@ -40,7 +39,7 @@ ****************************************************************************/ nooptimiziation_function -void sincosf(float x, float *s, float *c) +void sincosf(float x, FAR float *s, FAR float *c) { *s = sinf(x); *c = cosf(x); diff --git a/libs/libm/libm/lib_sincosl.c b/libs/libm/libm/lib_sincosl.c index 1512765c70..ced5053a32 100644 --- a/libs/libm/libm/lib_sincosl.c +++ b/libs/libm/libm/lib_sincosl.c @@ -42,7 +42,7 @@ #ifdef CONFIG_HAVE_LONG_DOUBLE nooptimiziation_function -void sincosl(long double x, long double *s, long double *c) +void sincosl(long double x, FAR long double *s, FAR long double *c) { *s = sinl(x); *c = cosl(x); diff --git a/net/local/local_sendmsg.c b/net/local/local_sendmsg.c index 64f14457bb..75adc8aaba 100644 --- a/net/local/local_sendmsg.c +++ b/net/local/local_sendmsg.c @@ -75,9 +75,9 @@ static int local_sendctl(FAR struct local_conn_s *conn, FAR struct local_conn_s *peer; FAR struct file *filep2; FAR struct file *filep; - struct cmsghdr *cmsg; + FAR struct cmsghdr *cmsg; int count = 0; - int *fds; + FAR int *fds; int ret; int i = 0; @@ -98,7 +98,7 @@ static int local_sendctl(FAR struct local_conn_s *conn, goto fail; } - fds = (int *)CMSG_DATA(cmsg); + fds = (FAR int *)CMSG_DATA(cmsg); count = (cmsg->cmsg_len - sizeof(struct cmsghdr)) / sizeof(int); if (count + peer->lc_cfpcount >= LOCAL_NCONTROLFDS) diff --git a/net/utils/net_lock.c b/net/utils/net_lock.c index 0196dd9b15..05721477ae 100644 --- a/net/utils/net_lock.c +++ b/net/utils/net_lock.c @@ -61,7 +61,7 @@ static rmutex_t g_netlock = NXRMUTEX_INITIALIZER; ****************************************************************************/ static int -_net_timedwait(sem_t *sem, bool interruptible, unsigned int timeout) +_net_timedwait(FAR sem_t *sem, bool interruptible, unsigned int timeout) { unsigned int count; int blresult; @@ -231,7 +231,7 @@ int net_restorelock(unsigned int count) * ****************************************************************************/ -int net_sem_timedwait(sem_t *sem, unsigned int timeout) +int net_sem_timedwait(FAR sem_t *sem, unsigned int timeout) { return _net_timedwait(sem, true, timeout); } @@ -258,7 +258,7 @@ int net_sem_timedwait(sem_t *sem, unsigned int timeout) * ****************************************************************************/ -int net_mutex_timedlock(mutex_t *mutex, unsigned int timeout) +int net_mutex_timedlock(FAR mutex_t *mutex, unsigned int timeout) { unsigned int count; int blresult; @@ -313,7 +313,7 @@ int net_mutex_timedlock(mutex_t *mutex, unsigned int timeout) * ****************************************************************************/ -int net_sem_wait(sem_t *sem) +int net_sem_wait(FAR sem_t *sem) { return net_sem_timedwait(sem, UINT_MAX); } @@ -338,7 +338,7 @@ int net_sem_wait(sem_t *sem) * ****************************************************************************/ -int net_mutex_lock(mutex_t *mutex) +int net_mutex_lock(FAR mutex_t *mutex) { return net_mutex_timedlock(mutex, UINT_MAX); } @@ -360,7 +360,7 @@ int net_mutex_lock(mutex_t *mutex) * ****************************************************************************/ -int net_sem_timedwait_uninterruptible(sem_t *sem, unsigned int timeout) +int net_sem_timedwait_uninterruptible(FAR sem_t *sem, unsigned int timeout) { return _net_timedwait(sem, false, timeout); } @@ -381,7 +381,7 @@ int net_sem_timedwait_uninterruptible(sem_t *sem, unsigned int timeout) * ****************************************************************************/ -int net_sem_wait_uninterruptible(sem_t *sem) +int net_sem_wait_uninterruptible(FAR sem_t *sem) { return net_sem_timedwait_uninterruptible(sem, UINT_MAX); }