fs/: Fix various coding standard issues found while testing tools/nxstyle.c

This commit is contained in:
Gregory Nutt
2019-03-01 15:00:00 -06:00
parent 4ae7373427
commit be3dd0bac6
44 changed files with 206 additions and 144 deletions
+1 -1
View File
@@ -329,7 +329,7 @@ static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir)
finfo("Entry %d: \"%s\"\n", index, name);
dir->fd_dir.d_type = DTYPE_FILE;
strncpy(dir->fd_dir.d_name, name, NAME_MAX+1);
strncpy(dir->fd_dir.d_name, name, NAME_MAX + 1);
/* The application list is terminated by an entry with a NULL name.
* Therefore, there is at least one more entry in the list.
+4 -2
View File
@@ -1059,7 +1059,9 @@ static int cromfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir)
case S_IFIFO: /* FIFO */
case S_IFCHR: /* Character driver */
case S_IFBLK: /* Block driver */
/* case S_IFSOCK: Socket */
#if 0
case S_IFSOCK: /* Socket */
#endif
case S_IFMQ: /* Message queue */
case S_IFSEM: /* Semaphore */
case S_IFSHM: /* Shared memory */
@@ -1183,7 +1185,7 @@ static int cromfs_stat(FAR struct inode *mountpt, FAR const char *relpath,
/* Sanity checks */
DEBUGASSERT(mountpt != NULL && mountpt->i_private != NULL && buf != NULL );
DEBUGASSERT(mountpt != NULL && mountpt->i_private != NULL && buf != NULL);
memset(buf, 0, sizeof(struct stat));
/* Recover our private data from the inode instance */
+17 -11
View File
@@ -1765,8 +1765,10 @@ static int fat_truncate(FAR struct file *filep, off_t length)
FAR uint8_t *direntry;
int ndx;
/* We are shrinking the file. */
/* Read the directory entry into the fs_buffer. */
/* We are shrinking the file.
*
* Read the directory entry into the fs_buffer.
*/
ret = fat_fscacheread(fs, ff->ff_dirsector);
if (ret < 0)
@@ -2255,7 +2257,7 @@ static int fat_statfs(FAR struct inode *mountpt, FAR struct statfs *buf)
#ifdef CONFIG_FAT_LFN
buf->f_namelen = LDIR_MAXFNAME; /* Maximum length of filenames */
#else
buf->f_namelen = (8+1+3); /* Maximum length of filenames */
buf->f_namelen = (8 + 1 + 3); /* Maximum length of filenames */
#endif
}
@@ -2295,8 +2297,10 @@ static int fat_unlink(FAR struct inode *mountpt, FAR const char *relpath)
* open reference to the file is closed.
*/
/* Remove the file */
/* TODO: Need to defer deleting cluster chain if the file is open. */
/* Remove the file
*
* TODO: Need to defer deleting cluster chain if the file is open.
*/
ret = fat_remove(fs, relpath, false);
}
@@ -2463,7 +2467,7 @@ static int fat_mkdir(FAR struct inode *mountpt, FAR const char *relpath,
/* So far, the two entries are nearly the same */
memcpy(direntry2, direntry, DIR_SIZE);
direntry2[DIR_NAME+1] = '.';
direntry2[DIR_NAME + 1] = '.';
/* Now add the cluster information to both directory entries */
@@ -2554,8 +2558,10 @@ int fat_rmdir(FAR struct inode *mountpt, FAR const char *relpath)
* open reference to the directory is closed.
*/
/* Remove the directory */
/* TODO: Need to defer deleting cluster chain if the file is open. */
/* Remove the directory.
*
* TODO: Need to defer deleting cluster chain if the file is open.
*/
ret = fat_remove(fs, relpath, true);
}
@@ -2578,7 +2584,7 @@ int fat_rename(FAR struct inode *mountpt, FAR const char *oldrelpath,
FAR struct fat_dirinfo_s dirinfo;
FAR struct fat_dirseq_s dirseq;
uint8_t *direntry;
uint8_t dirstate[DIR_SIZE-DIR_ATTRIBUTES];
uint8_t dirstate[DIR_SIZE - DIR_ATTRIBUTES];
int ret;
/* Sanity checks */
@@ -2631,7 +2637,7 @@ int fat_rename(FAR struct inode *mountpt, FAR const char *oldrelpath,
/* Save the non-name-related portion of the directory entry intact */
direntry = &fs->fs_buffer[dirinfo.fd_seq.ds_offset];
memcpy(dirstate, &direntry[DIR_ATTRIBUTES], DIR_SIZE-DIR_ATTRIBUTES);
memcpy(dirstate, &direntry[DIR_ATTRIBUTES], DIR_SIZE - DIR_ATTRIBUTES);
/* Now find the directory where we should create the newpath object */
@@ -2683,7 +2689,7 @@ int fat_rename(FAR struct inode *mountpt, FAR const char *oldrelpath,
/* Copy the unchanged information into the new short file name entry. */
direntry = &fs->fs_buffer[dirinfo.fd_seq.ds_offset];
memcpy(&direntry[DIR_ATTRIBUTES], dirstate, DIR_SIZE-DIR_ATTRIBUTES);
memcpy(&direntry[DIR_ATTRIBUTES], dirstate, DIR_SIZE - DIR_ATTRIBUTES);
fs->fs_dirty = true;
/* Remove the old entry, flushing the new directory entry to disk. If
+14 -14
View File
@@ -909,8 +909,8 @@ static inline int fat_uniquealias(struct fat_mountpt_s *fs,
/* Back up the tilde and break out of the inner loop */
tilde--;
dirinfo->fd_name[tilde] = '~';
dirinfo->fd_name[tilde+1] = '1';
dirinfo->fd_name[tilde] = '~';
dirinfo->fd_name[tilde + 1] = '1';
break;
}
@@ -1219,7 +1219,7 @@ static inline int fat_findlfnentry(struct fat_mountpt_s *fs,
*/
namelen = strlen((FAR char *)dirinfo->fd_lfname);
DEBUGASSERT(namelen <= LDIR_MAXFNAME+1);
DEBUGASSERT(namelen <= LDIR_MAXFNAME + 1);
/* How many LFN directory entries are we expecting? */
@@ -1520,7 +1520,7 @@ static inline int fat_allocatelfnentry(struct fat_mountpt_s *fs,
*/
namelen = strlen((char *)dirinfo->fd_lfname);
DEBUGASSERT(namelen <= LDIR_MAXFNAME+1);
DEBUGASSERT(namelen <= LDIR_MAXFNAME + 1);
/* How many LFN directory entries are we expecting? */
@@ -1859,7 +1859,7 @@ static inline int fat_getlfname(struct fat_mountpt_s *fs, struct fs_dirent_s *di
* spaces.
*/
for (; nsrc > 0 && lfname[nsrc-1] == ' '; nsrc--);
for (; nsrc > 0 && lfname[nsrc - 1] == ' '; nsrc--);
/* Further reduce the length so that it fits in the destination
* buffer.
@@ -1875,14 +1875,14 @@ static inline int fat_getlfname(struct fat_mountpt_s *fs, struct fs_dirent_s *di
* terminator will fit).
*/
dir->fd_dir.d_name[offset+nsrc] = '\0';
dir->fd_dir.d_name[offset + nsrc] = '\0';
}
/* Then transfer the characters */
for (i = 0; i < nsrc && offset+i < NAME_MAX; i++)
for (i = 0; i < nsrc && offset + i < NAME_MAX; i++)
{
dir->fd_dir.d_name[offset+i] = lfname[i];
dir->fd_dir.d_name[offset + i] = lfname[i];
}
}
@@ -2061,7 +2061,7 @@ static int fat_putlfname(struct fat_mountpt_s *fs,
*/
namelen = strlen((FAR char *)dirinfo->fd_lfname);
DEBUGASSERT(namelen <= LDIR_MAXFNAME+1);
DEBUGASSERT(namelen <= LDIR_MAXFNAME + 1);
/* How many LFN directory entries do we need to write? */
@@ -2159,7 +2159,7 @@ static int fat_putlfname(struct fat_mountpt_s *fs,
{
nbytes = MIN(6, remainder);
fat_putlfnchunk(LDIR_PTRWCHAR6_11(direntry),
&dirinfo->fd_lfname[offset+5], nbytes);
&dirinfo->fd_lfname[offset + 5], nbytes);
remainder -= nbytes;
}
@@ -2167,7 +2167,7 @@ static int fat_putlfname(struct fat_mountpt_s *fs,
{
nbytes = MIN(2, remainder);
fat_putlfnchunk(LDIR_PTRWCHAR12_13(direntry),
&dirinfo->fd_lfname[offset+11], nbytes);
&dirinfo->fd_lfname[offset + 11], nbytes);
remainder -= nbytes;
}
@@ -2182,9 +2182,9 @@ static int fat_putlfname(struct fat_mountpt_s *fs,
fat_putlfnchunk(LDIR_PTRWCHAR1_5(direntry),
&dirinfo->fd_lfname[offset], 5);
fat_putlfnchunk(LDIR_PTRWCHAR6_11(direntry),
&dirinfo->fd_lfname[offset+5], 6);
&dirinfo->fd_lfname[offset + 5], 6);
fat_putlfnchunk(LDIR_PTRWCHAR12_13(direntry),
&dirinfo->fd_lfname[offset+11], 2);
&dirinfo->fd_lfname[offset + 11], 2);
}
/* Write the remaining directory entries */
@@ -2727,7 +2727,7 @@ int fat_dirname2path(struct fat_mountpt_s *fs, struct fs_dirent_s *dir)
{
/* No.. Get the name from a short file name directory entries */
return fat_getsfname(direntry, dir->fd_dir.d_name, NAME_MAX+1);
return fat_getsfname(direntry, dir->fd_dir.d_name, NAME_MAX + 1);
}
}
+9 -9
View File
@@ -438,13 +438,13 @@ uint32_t fat_systime2fattime(void)
uint16_t fattime;
uint16_t fatdate;
fattime = (tm.tm_sec >> 1) & 0x001f; /* Bits 0-4: 2 second count (0-29) */
fattime |= (tm.tm_min << 5) & 0x07e0; /* Bits 5-10: minutes (0-59) */
fattime |= (tm.tm_hour << 11) & 0xf800; /* Bits 11-15: hours (0-23) */
fattime = (tm.tm_sec >> 1) & 0x001f; /* Bits 0-4: 2 second count (0-29) */
fattime |= (tm.tm_min << 5) & 0x07e0; /* Bits 5-10: minutes (0-59) */
fattime |= (tm.tm_hour << 11) & 0xf800; /* Bits 11-15: hours (0-23) */
fatdate = tm.tm_mday & 0x001f; /* Bits 0-4: Day of month (1-31) */
fatdate |= ((tm.tm_mon+1) << 5) & 0x01e0; /* Bits 5-8: Month of year (1-12) */
fatdate |= ((tm.tm_year-80) << 9) & 0xfe00; /* Bits 9-15: Year from 1980 */
fatdate = tm.tm_mday & 0x001f; /* Bits 0-4: Day of month (1-31) */
fatdate |= ((tm.tm_mon + 1) << 5) & 0x01e0; /* Bits 5-8: Month of year (1-12) */
fatdate |= ((tm.tm_year - 80) << 9) & 0xfe00; /* Bits 9-15: Year from 1980 */
return (uint32_t)fatdate << 16 | (uint32_t)fattime;
}
@@ -490,7 +490,7 @@ time_t fat_fattime2systime(uint16_t fattime, uint16_t fatdate)
tm.tm_mday = (fatdate & 0x001f); /* Bits 0-4: Day of month (1-31) */
tmp = ((fatdate & 0x01e0) >> 5); /* Bits 5-8: Month of year (1-12) */
tm.tm_mon = tmp > 0 ? tmp-1 : 0;
tm.tm_mon = tmp > 0 ? tmp - 1 : 0;
tm.tm_year = ((fatdate & 0xfe00) >> 9) + 80; /* Bits 9-15: Year from 1980 */
/* Then convert the broken out time into seconds since the epoch */
@@ -1395,7 +1395,7 @@ int fat_nextdirentry(struct fat_mountpt_s *fs, struct fs_fatdir_s *dir)
* has been examined.
*/
if ((sector & (fs->fs_fatsecperclus-1)) == 0)
if ((sector & (fs->fs_fatsecperclus - 1)) == 0)
{
/* Get next cluster */
@@ -1542,7 +1542,7 @@ int fat_dirshrink(struct fat_mountpt_s *fs, FAR uint8_t *direntry,
return cluster;
}
clustersize = fs->fs_fatsecperclus * fs->fs_hwsectorsize;;
clustersize = fs->fs_fatsecperclus * fs->fs_hwsectorsize;
remaining = length;
while (cluster >= 2 && cluster < fs->fs_nclusters)
+3 -3
View File
@@ -258,7 +258,7 @@ static void hostfs_mkpath(FAR struct hostfs_mountpt_s *fs,
if (depth >= 0)
{
strncat(path, &relpath[first], pathlen-strlen(path)-1);
strncat(path, &relpath[first], pathlen - strlen(path) - 1);
}
}
@@ -1000,12 +1000,12 @@ static int hostfs_bind(FAR struct inode *blkdriver, FAR const void *data,
{
/* Remove trailing '/' */
fs->fs_root[len-1] = '\0';
fs->fs_root[len - 1] = '\0';
}
/* Append a '/' to the name now */
if (fs->fs_root[len-1] != '/')
if (fs->fs_root[len - 1] != '/')
{
strcat(fs->fs_root, "/");
}
+4 -4
View File
@@ -814,17 +814,17 @@ static int lfs_dir_commit(FAR lfs_t *lfs, FAR lfs_dir_t *dir,
break;
relocate:
/* commit was corrupted */
relocate:
/* Commit was corrupted */
LFS_DEBUG("Bad block at %" PRIu32, dir->pair[0]);
/* drop caches and prepare to relocate block */
/* Drop caches and prepare to relocate block */
relocated = true;
lfs_cache_drop(lfs, &lfs->pcache);
/* can't relocate superblock, filesystem is now frozen */
/* Can't relocate superblock, filesystem is now frozen */
if (lfs_paircmp(oldpair, (const lfs_block_t[2]){ 0, 1 }) == 0)
{
+1
View File
@@ -79,6 +79,7 @@
/****************************************************************************
* Private Types
****************************************************************************/
/* This structure describes the state of the automounter */
struct automounter_state_s
+2
View File
@@ -63,7 +63,9 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* In the canonical case, a file system is bound to a block driver. However,
* some less typical cases a block driver is not required. Examples are
* pseudo file systems (like BINFS or PROCFS) and MTD file systems (like NXFFS).
+4 -1
View File
@@ -307,7 +307,10 @@ static int usage_entry(FAR const char *mountpoint, FAR struct statfs *statbuf,
char sizelabel;
char freelabel;
char usedlabel;
static const char labels[5] = { 'B', 'K', 'M', 'G', 'T' };
static const char labels[5] =
{
'B', 'K', 'M', 'G', 'T'
};
DEBUGASSERT(mountpoint != NULL && statbuf != NULL && info != NULL);
-1
View File
@@ -147,7 +147,6 @@ int umount2(FAR const char *target, unsigned int flags)
* pseudo-file inode.
*/
mountpt_inode->i_flags &= ~FSNODEFLAG_TYPE_MASK;
mountpt_inode->i_private = NULL;
mountpt_inode->u.i_mops = NULL;
-1
View File
@@ -166,7 +166,6 @@ int mq_close(mqd_t mqdes)
return ret;
}
/****************************************************************************
* Name: mq_inode_release
*
+2 -2
View File
@@ -86,7 +86,7 @@ static inline int nfs_pathsegment(FAR const char **path, FAR char *buffer,
if (ch == '\0' || ch == '/')
{
/* This logic just suppors "//" sequences in the path name */
/* This logic just supports "//" sequences in the path name */
if (ch == '\0' || nbytes > 0)
{
@@ -390,7 +390,7 @@ int nfs_findnode(struct nfsmount *nmp, FAR const char *relpath,
FAR struct nfs_fattr *dir_attributes)
{
FAR const char *path = relpath;
char buffer[NAME_MAX+1];
char buffer[NAME_MAX + 1];
char terminator;
uint32_t tmp;
int error;
+9 -5
View File
@@ -535,8 +535,10 @@ static int nfs_fileopen(FAR struct nfsmount *nmp, FAR struct nfsnode *np,
return EEXIST;
}
/* Initialize the file private data */
/* Copy the file handle */
/* Initialize the file private data.
*
* Copy the file handle.
*/
np->n_fhsize = (uint8_t)fhandle.length;
memcpy(&np->n_fhandle, &fhandle.handle, fhandle.length);
@@ -2119,7 +2121,9 @@ int nfs_fsinfo(FAR struct nfsmount *nmp)
/* Save the root file system attributes */
//memcpy(&nmp->nm_fattr. &fsp.obj_attributes, sizeof(struct nfs_fattr));
#if 0
memcpy(&nmp->nm_fattr. &fsp.obj_attributes, sizeof(struct nfs_fattr));
#endif
pref = fxdr_unsigned(uint32_t, fsp.fsinfo.fs_wtpref);
if (pref < nmp->nm_wsize)
@@ -2560,8 +2564,8 @@ static int nfs_rename(struct inode *mountpt, const char *oldrelpath,
struct nfsmount *nmp;
struct file_handle from_handle;
struct file_handle to_handle;
char from_name[NAME_MAX+1];
char to_name[NAME_MAX+1];
char from_name[NAME_MAX + 1];
char to_name[NAME_MAX + 1];
struct nfs_fattr fattr;
FAR uint32_t *ptr;
int namelen;
+8 -4
View File
@@ -115,8 +115,10 @@ int nxffs_blockstats(FAR struct nxffs_volume_s *volume,
stats->nblocks++;
/* Collect statistics */
/* Check if this is a block that should be recognized by NXFFS */
/* Collect statistics.
*
* Check if this is a block that should be recognized by NXFFS.
*/
if (memcmp(blkhdr->magic, g_blockmagic, NXFFS_MAGICSIZE) != 0)
{
@@ -189,8 +191,10 @@ int nxffs_blockstats(FAR struct nxffs_volume_s *volume,
FAR struct nxffs_block_s *blkhdr = (FAR struct nxffs_block_s *)volume->pack;
/* Collect statistics */
/* Check if this is a block that should be recognized by NXFFS */
/* Collect statistics.
*
* Check if this is a block that should be recognized by NXFFS.
*/
if (memcmp(blkhdr->magic, g_blockmagic, NXFFS_MAGICSIZE) != 0)
{
+1 -1
View File
@@ -150,7 +150,7 @@ int nxffs_readdir(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir)
finfo("Offset %d: \"%s\"\n", entry.hoffset, entry.name);
dir->fd_dir.d_type = DTYPE_FILE;
strncpy(dir->fd_dir.d_name, entry.name, NAME_MAX+1);
strncpy(dir->fd_dir.d_name, entry.name, NAME_MAX + 1);
/* Discard this entry and set the next offset. */
+6 -3
View File
@@ -100,7 +100,9 @@ static inline ssize_t nxffs_analyzeinode(FAR struct nxffs_blkinfo_s *blkinfo,
uint8_t state;
uint32_t noffs;
uint32_t doffs;
//uint32_t utc;
#if 0
uint32_t utc;
#endif
uint32_t ecrc;
uint32_t datlen;
uint32_t crc;
@@ -120,7 +122,9 @@ static inline ssize_t nxffs_analyzeinode(FAR struct nxffs_blkinfo_s *blkinfo,
memcpy(&inode, &blkinfo->buffer[offset], SIZEOF_NXFFS_INODE_HDR);
noffs = nxffs_rdle32(inode.noffs);
doffs = nxffs_rdle32(inode.doffs);
//utc = nxffs_rdle32(inode.utc);
#if 0
utc = nxffs_rdle32(inode.utc);
#endif
ecrc = nxffs_rdle32(inode.crc);
datlen = nxffs_rdle32(inode.datlen);
@@ -135,7 +139,6 @@ static inline ssize_t nxffs_analyzeinode(FAR struct nxffs_blkinfo_s *blkinfo,
return ERROR;
}
/* Can we verify the inode? We need to have the inode name in the same
* block to do that (or get access to the next block)
*/
-1
View File
@@ -1180,7 +1180,6 @@ int nxffs_close(FAR struct file *filep)
ofile->crefs--;
}
filep->f_priv = NULL;
nxsem_post(&volume->exclsem);
+1
View File
@@ -58,6 +58,7 @@
/****************************************************************************
* Public Types
****************************************************************************/
/* This structure supports access to one inode data stream */
struct nxffs_packstream_s
+4 -2
View File
@@ -117,8 +117,10 @@ int nxffs_truncate(FAR struct file *filep, off_t length)
}
else if (oldsize > length)
{
/* We are shrinking the file */
/* REVISIT: Logic to shrink the file has not yet been implemented */
/* We are shrinking the file.
*
* REVISIT: Logic to shrink the file has not yet been implemented.
*/
ret = -ENOSYS;
}
+1 -1
View File
@@ -130,7 +130,7 @@ void nxffs_wrle32(uint8_t *dest, uint32_t val)
/* Little endian means LS halfword first in byte stream */
nxffs_wrle16(dest, (uint16_t)(val & 0xffff));
nxffs_wrle16(dest+2, (uint16_t)(val >> 16));
nxffs_wrle16(dest + 2, (uint16_t)(val >> 16));
}
/****************************************************************************
+2 -1
View File
@@ -104,7 +104,8 @@ static int parse_partition(FAR struct partition_state_s *state,
partition_handler_t handler,
FAR void *arg)
{
int i, ret = 0;
int i;
int ret = 0;
for (i = 0; g_parser[i] != NULL; i++)
{
+8 -4
View File
@@ -109,6 +109,7 @@ extern const struct procfs_operations ccm_procfsoperations;
/****************************************************************************
* Private Types
****************************************************************************/
/* Table of all known / pre-registered procfs handlers / participants. */
#ifdef CONFIG_FS_PROCFS_REGISTER
@@ -199,6 +200,7 @@ static const uint8_t g_procfs_entrycount = sizeof(g_procfs_entries) /
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/* Helpers */
static void procfs_enum(FAR struct tcb_s *tcb, FAR void *arg);
@@ -358,7 +360,8 @@ static void procfs_enum(FAR struct tcb_s *tcb, FAR void *arg)
static int procfs_open(FAR struct file *filep, FAR const char *relpath,
int oflags, mode_t mode)
{
int x, ret = -ENOENT;
int x;
int ret = -ENOENT;
finfo("Open '%s'\n", relpath);
@@ -845,7 +848,7 @@ static int procfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir)
/* Save the filename=pid and file type=directory */
dir->fd_dir.d_type = DTYPE_DIRECTORY;
snprintf(dir->fd_dir.d_name, NAME_MAX+1, "%d", (int)pid);
snprintf(dir->fd_dir.d_name, NAME_MAX + 1, "%d", (int)pid);
/* Set up the next directory entry offset. NOTE that we could use the
* standard f_pos instead of our own private index.
@@ -1030,8 +1033,9 @@ static int procfs_stat(struct inode *mountpt, const char *relpath,
memset(buf, 0, sizeof(struct stat));
if (!relpath || relpath[0] == '\0')
{
/* The path refers to the top level directory */
/* It's a read-only directory */
/* The path refers to the top level directory.
* It's a read-only directory.
*/
buf->st_mode = S_IFDIR | S_IROTH | S_IRGRP | S_IRUSR;
ret = OK;
+1 -1
View File
@@ -90,7 +90,7 @@ struct progmem_info_s
int ordblks; /* This is the number of free chunks */
int mxordblk; /* Size of the largest free chunk */
int uordblks; /* Total size of memory for allocated chunks */
int fordblks; /* Total size of memory for free chunks.*/
int fordblks; /* Total size of memory for free chunks. */
};
#endif
+7 -3
View File
@@ -76,6 +76,7 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* See include/nuttx/sched.h: */
#undef HAVE_GROUPID
@@ -1696,8 +1697,11 @@ static int proc_readdir(struct fs_dirent_s *dir)
return -ENOENT;
}
/* The TCB is still valid (or at least was when we entered this function) */
/* Handle the directory listing by the node type */
/* The TCB is still valid (or at least was when we entered this
* function)
*
* Handle the directory listing by the node type.
*/
switch (procdir->node->node)
{
@@ -1718,7 +1722,7 @@ static int proc_readdir(struct fs_dirent_s *dir)
/* Save the filename and file type */
dir->fd_dir.d_type = node->dtype;
strncpy(dir->fd_dir.d_name, node->name, NAME_MAX+1);
strncpy(dir->fd_dir.d_name, node->name, NAME_MAX + 1);
/* Set up the next directory entry offset. NOTE that we could use the
* standard f_pos instead of our own private index.
+9 -2
View File
@@ -101,6 +101,7 @@ struct skel_level1_s
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/* File system methods */
static int skel_open(FAR struct file *filep, FAR const char *relpath,
@@ -108,7 +109,9 @@ static int skel_open(FAR struct file *filep, FAR const char *relpath,
static int skel_close(FAR struct file *filep);
static ssize_t skel_read(FAR struct file *filep, FAR char *buffer,
size_t buflen);
/* TODO: Should not support skel_write if read-only */
static ssize_t skel_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen);
static int skel_dup(FAR const struct file *oldp,
@@ -140,7 +143,9 @@ const struct procfs_operations skel_procfsoperations =
skel_open, /* open */
skel_close, /* close */
skel_read, /* read */
/* TODO: Decide if this procfs entry supports write access */
#if 0 /* NULL if the procfs entry does not support write access. */
NULL, /* write */
#else
@@ -270,6 +275,7 @@ static ssize_t skel_read(FAR struct file *filep, FAR char *buffer,
****************************************************************************/
/* TODO: Should not support skel_write if read-only */
static ssize_t skel_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen)
{
@@ -502,10 +508,11 @@ static int skel_stat(FAR const char *relpath, FAR struct stat *buf)
buf->st_mode = S_IFDIR | S_IROTH | S_IRGRP | S_IRUSR;
/* TODO: Set S_IFREG if the relpath refers to a file.
/* TODO: If the skel_write() method is supported, then stat must also
* TODO: If the skel_write() method is supported, then stat must also
* report S_IWOTH | S_IWGRP | S_IWUSR for files (but not for
* directories) as well.
/* TODO: Other 'struct buf' settings may be appropriate (optional) */
* TODO: Other 'struct buf' settings may be appropriate (optional)
*/
ret = OK;
+1 -1
View File
@@ -94,7 +94,7 @@ static inline int romfs_checkentry(struct romfs_mountpt_s *rm,
int entrylen,
struct romfs_dirinfo_s *dirinfo)
{
char name[NAME_MAX+1];
char name[NAME_MAX + 1];
uint32_t linkoffset;
uint32_t next;
uint32_t info;
+11 -8
View File
@@ -115,6 +115,7 @@ struct smartfs_procfs_entry_s
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/* File system methods */
static int smartfs_open(FAR struct file *filep, FAR const char *relpath,
@@ -187,6 +188,7 @@ const struct procfs_operations smartfs_procfsoperations =
smartfs_read, /* read */
/* No write supported */
smartfs_write, /* write */
smartfs_dup, /* dup */
@@ -646,7 +648,8 @@ static int smartfs_readdir(struct fs_dirent_s *dir)
}
dir->fd_dir.d_type = DTYPE_DIRECTORY;
strncpy(dir->fd_dir.d_name, level1->mount->fs_blkdriver->i_name, NAME_MAX+1);
strncpy(dir->fd_dir.d_name, level1->mount->fs_blkdriver->i_name,
NAME_MAX + 1);
/* Advance to next entry */
@@ -658,14 +661,16 @@ static int smartfs_readdir(struct fs_dirent_s *dir)
/* Listing the contents of a specific mount */
dir->fd_dir.d_type = g_direntry[level1->base.index].type;
strncpy(dir->fd_dir.d_name, g_direntry[level1->base.index++].name, NAME_MAX+1);
strncpy(dir->fd_dir.d_name, g_direntry[level1->base.index++].name,
NAME_MAX + 1);
}
else if (level1->base.level == 3)
{
/* Listing the contents of a specific entry */
dir->fd_dir.d_type = g_direntry[level1->base.index].type;
strncpy(dir->fd_dir.d_name, g_direntry[level1->direntry].name, NAME_MAX+1);
strncpy(dir->fd_dir.d_name, g_direntry[level1->direntry].name,
NAME_MAX + 1);
level1->base.index++;
}
@@ -798,7 +803,6 @@ static size_t smartfs_status_read(FAR struct file *filep, FAR char *buffer,
priv = (FAR struct smartfs_file_s *) filep->f_priv;
/* Initialize the read length to zero and test if we are at the
* end of the file (i.e. already read the data.
*/
@@ -878,7 +882,6 @@ static size_t smartfs_mem_read(FAR struct file *filep, FAR char *buffer,
priv = (FAR struct smartfs_file_s *) filep->f_priv;
/* Initialize the read length to zero and test if we are at the
* end of the file (i.e. already read the data.
*/
@@ -905,7 +908,7 @@ static size_t smartfs_mem_read(FAR struct file *filep, FAR char *buffer,
if (procfs_data.allocs[x].ptr != NULL)
{
len += snprintf(&buffer[len], buflen-len, " %s: %d\n",
len += snprintf(&buffer[len], buflen - len, " %s: %d\n",
procfs_data.allocs[x].name, procfs_data.allocs[x].size);
total += procfs_data.allocs[x].size;
}
@@ -913,7 +916,7 @@ static size_t smartfs_mem_read(FAR struct file *filep, FAR char *buffer,
/* Add the total allocation amount to the buffer */
len += snprintf(&buffer[len], buflen-len, "\nTotal: %d\n", total);
len += snprintf(&buffer[len], buflen - len, "\nTotal: %d\n", total);
}
/* Indicate we have done the read */
@@ -988,7 +991,7 @@ static size_t smartfs_erasemap_read(FAR struct file *filep, FAR char *buffer,
if (copylen >= priv->offset)
{
buffer[len++] = procfs_data.erasecounts[y*cols+x] + 'A';
buffer[len++] = procfs_data.erasecounts[y * cols + x] + 'A';
priv->offset++;
if (len >= buflen)
+13 -7
View File
@@ -238,7 +238,7 @@ static int smartfs_open(FAR struct file *filep, const char *relpath,
if (ret == OK)
{
/* The name exists -- but is is a file or a directory ? */
/* The name exists -- but is is a file or a directory? */
if (sf->entry.flags & SMARTFS_DIRENT_TYPE_DIR)
{
@@ -261,7 +261,8 @@ static int smartfs_open(FAR struct file *filep, const char *relpath,
/* TODO: Test open mode based on the file mode */
/* The file exists. Check if we are opening it for O_CREAT or
* O_TRUNC mode and delete the sector chain if we are. */
* O_TRUNC mode and delete the sector chain if we are.
*/
if ((oflags & (O_CREAT | O_TRUNC)) != 0)
{
@@ -429,12 +430,14 @@ static int smartfs_close(FAR struct file *filep)
smartfs_semtake(fs);
/* Check if we are the last one with a reference to the file and
* only close if we are. */
* only close if we are.
*/
if (sf->crefs > 1)
{
/* The file is opened more than once. Just decrement the
* reference count and return. */
* reference count and return.
*/
sf->crefs--;
goto okout;
@@ -675,7 +678,8 @@ static ssize_t smartfs_write(FAR struct file *filep, const char *buffer,
}
/* First test if we are overwriting an existing location or writing to
* a new one. */
* a new one.
*/
header = (struct smartfs_chain_header_s *) fs->fs_rwbuffer;
byteswritten = 0;
@@ -1402,7 +1406,8 @@ static int smartfs_bind(FAR struct inode *blkdriver, const void *data,
}
/* If the global semaphore hasn't been initialized, then
* initialized it now. */
* initialized it now.
*/
fs->fs_sem = &g_sem;
if (!g_seminitialized)
@@ -1648,7 +1653,8 @@ static int smartfs_mkdir(struct inode *mountpt, const char *relpath, mode_t mode
else if (ret == -ENOENT)
{
/* It doesn't exist ... we can create it, but only if we have
* the right permissions and if the parentdirsector is valid. */
* the right permissions and if the parentdirsector is valid.
*/
if (parentdirsector == 0xFFFF)
{
+13 -8
View File
@@ -184,7 +184,7 @@ void smartfs_wrle32(uint8_t *dest, uint32_t val)
/* Little endian means LS halfword first in byte stream */
smartfs_wrle16(dest, (uint16_t)(val & 0xffff));
smartfs_wrle16(dest+2, (uint16_t)(val >> 16));
smartfs_wrle16(dest + 2, (uint16_t)(val >> 16));
}
/****************************************************************************
@@ -669,7 +669,8 @@ int smartfs_finddirentry(struct smartfs_mountpt_s *fs,
direntry->dfirst = dirstack[depth];
if (direntry->name == NULL)
{
direntry->name = (char *) kmm_malloc(fs->fs_llformat.namesize+1);
direntry->name = (FAR char *)
kmm_malloc(fs->fs_llformat.namesize + 1);
}
memset(direntry->name, 0, fs->fs_llformat.namesize + 1);
@@ -1073,10 +1074,10 @@ int smartfs_createentry(FAR struct smartfs_mountpt_s *fs,
direntry->datlen = 0;
if (direntry->name == NULL)
{
direntry->name = (FAR char *) kmm_malloc(fs->fs_llformat.namesize+1);
direntry->name = (FAR char *)kmm_malloc(fs->fs_llformat.namesize + 1);
}
memset(direntry->name, 0, fs->fs_llformat.namesize+1);
memset(direntry->name, 0, fs->fs_llformat.namesize + 1);
strncpy(direntry->name, filename, fs->fs_llformat.namesize);
ret = OK;
@@ -1218,6 +1219,7 @@ int smartfs_deleteentry(struct smartfs_mountpt_s *fs,
#endif
{
/* Count this entry */
count++;
}
@@ -1370,6 +1372,7 @@ int smartfs_countdirentries(struct smartfs_mountpt_s *fs,
#endif
{
/* Count this entry */
count++;
}
@@ -1439,7 +1442,8 @@ int smartfs_sync_internal(FAR struct smartfs_mountpt_s *fs,
#else /* CONFIG_SMARTFS_USE_SECTOR_BUFFER */
/* Test if we have written bytes to the current sector that
* need to be recorded in the chain header's used bytes field. */
* need to be recorded in the chain header's used bytes field.
*/
if (sf->byteswritten > 0)
{
@@ -1571,8 +1575,9 @@ off_t smartfs_seek_internal(FAR struct smartfs_mountpt_s *fs,
{
/* Seeking within the current sector. Just update the offset */
sf->curroffset = sizeof(struct smartfs_chain_header_s) + newpos-sectorstartpos;
sf->filepos = newpos;
sf->curroffset = sizeof(struct smartfs_chain_header_s) +
newpos - sectorstartpos;
sf->filepos = newpos;
return newpos;
}
@@ -1931,7 +1936,7 @@ int smartfs_extendfile(FAR struct smartfs_mountpt_s *fs,
readwrite.count = fs->fs_llformat.availbytes - sf->curroffset;
if (readwrite.count > remaining)
{
/* Limit the write to the size for our smaller working buffer*/
/* Limit the write to the size for our smaller working buffer */
readwrite.count = SMARTFS_TRUNCBUFFER_SIZE;
}
+6 -5
View File
@@ -270,6 +270,7 @@ static FAR struct spiffs_cache_page_s *
FAR struct spiffs_cache_page_s *cp;
/* We found one */
cp = spiffs_get_cache_page_hdr(fs, cache, i);
cache->cpage_use_map |= (1 << i);
cp->last_access = cache->last_access;
@@ -311,7 +312,7 @@ void spiffs_cache_initialize(FAR struct spiffs_s *fs)
int cache_entries;
sz = fs->cache_size;
cache_entries = (sz - sizeof(struct spiffs_cache_s )) /
cache_entries = (sz - sizeof(struct spiffs_cache_s)) /
(SPIFFS_CACHE_PAGE_SIZE(fs));
if (fs->cache == 0)
@@ -330,14 +331,14 @@ void spiffs_cache_initialize(FAR struct spiffs_s *fs)
cache_mask |= 1;
}
memset(&cache, 0, sizeof(struct spiffs_cache_s ));
memset(&cache, 0, sizeof(struct spiffs_cache_s));
cache.cpage_count = cache_entries;
cache.cpages = (FAR uint8_t*)
((FAR uint8_t *)fs->cache + sizeof(struct spiffs_cache_s ));
cache.cpages = (FAR uint8_t *)
((FAR uint8_t *)fs->cache + sizeof(struct spiffs_cache_s));
cache.cpage_use_map = 0xffffffff;
cache.cpage_use_mask = cache_mask;
memcpy(fs->cache, &cache, sizeof(struct spiffs_cache_s ));
memcpy(fs->cache, &cache, sizeof(struct spiffs_cache_s));
cp = spiffs_get_cache(fs);
memset(cp->cpages, 0, cp->cpage_count * SPIFFS_CACHE_PAGE_SIZE(fs));
+5 -5
View File
@@ -320,7 +320,7 @@ static int spiffs_check_rewrite_index(FAR struct spiffs_s *fs,
}
ret = spiffs_cache_write(fs, SPIFFS_OP_T_OBJ_LU | SPIFFS_OP_C_UPDT, 0,
SPIFFS_BLOCK_TO_PADDR(fs, SPIFFS_BLOCK_FOR_PAGE(fs,free_pgndx)) +
SPIFFS_BLOCK_TO_PADDR(fs, SPIFFS_BLOCK_FOR_PAGE(fs, free_pgndx)) +
SPIFFS_OBJ_LOOKUP_ENTRY_FOR_PAGE(fs, free_pgndx) *
sizeof(int16_t), sizeof(int16_t),
(FAR uint8_t *)&objid);
@@ -2029,7 +2029,6 @@ int spiffs_check_objidconsistency(FAR struct spiffs_s *fs)
return ret;
}
/****************************************************************************
* Name: spiffs_dump
*
@@ -2086,7 +2085,7 @@ int spiffs_dump(FAR struct spiffs_s *fs)
cur_entry < (int)(SPIFFS_GEO_PAGES_PER_BLOCK(fs) -
SPIFFS_OBJ_LOOKUP_PAGES(fs)))
{
int16_t objid = objlu_buf[cur_entry-entry_offset];
int16_t objid = objlu_buf[cur_entry - entry_offset];
if (cur_entry == 0)
{
@@ -2157,8 +2156,9 @@ int spiffs_dump(FAR struct spiffs_s *fs)
spiffs_checkinfo("page_alloc: %d\n", fs->alloc_pages);
spiffs_checkinfo("page_delet: %d\n", fs->deleted_pages);
/* The following duplicates some logic from spiffs_statfs() */
/* -2 for spare blocks, +1 for emergency page */
/* The following duplicates some logic from spiffs_statfs().
* -2 for spare blocks, +1 for emergency page.
*/
pages_per_block = SPIFFS_GEO_PAGES_PER_BLOCK(fs);
blocks = SPIFFS_GEO_BLOCK_COUNT(fs);
+1 -1
View File
@@ -1901,7 +1901,7 @@ ssize_t spiffs_fobj_append(FAR struct spiffs_s *fs,
/* On subsequent passes, create a new object index page */
len_objndx_spndx =
SPIFFS_OBJNDX_ENTRY_SPNDX(fs,(fobj->size - 1) /
SPIFFS_OBJNDX_ENTRY_SPNDX(fs, (fobj->size - 1) /
SPIFFS_DATA_PAGE_SIZE(fs));
if (nwritten > 0 || cur_objndx_spndx > len_objndx_spndx)
+3 -4
View File
@@ -100,7 +100,6 @@ struct spiffs_gc_s
*
****************************************************************************/
static int spiffs_gc_erase_block(FAR struct spiffs_s *fs, int16_t blkndx)
{
int ret;
@@ -109,6 +108,7 @@ static int spiffs_gc_erase_block(FAR struct spiffs_s *fs, int16_t blkndx)
spiffs_gcinfo("Erase block=%04x\n", blkndx);
/* Erase the block */
ret = spiffs_erase_block(fs, blkndx);
if (ret < 0)
{
@@ -332,7 +332,7 @@ static int spiffs_gc_find_candidate(FAR struct spiffs_s *fs,
* probably not so many blocks
*/
if (ret >= 0 /* && deleted_pages_in_block > 0 */ )
if (ret >= 0 /* && deleted_pages_in_block > 0 */)
{
int32_t score;
int16_t erase_count;
@@ -754,7 +754,6 @@ static int spiffs_gc_clean(FAR struct spiffs_s *fs, int16_t blkndx)
*/
}
if (ret < 0)
{
break;
@@ -1134,7 +1133,7 @@ int spiffs_gc_check(FAR struct spiffs_s *fs, off_t len)
#if 0
if (fs->free_blocks <= 2 && (int32_t)needed_pages > free_pages)
{
spiffs_gcinfo("Full freeblk=%d" needed=%d" free=%d dele=%d\n",
spiffs_gcinfo("Full freeblk=%d needed=%d free=%d dele=%d\n",
fs->free_blocks, needed_pages, free_pages,
fs->deleted_pages);
return -ENOSPC;
+4 -4
View File
@@ -919,7 +919,6 @@ static off_t spiffs_seek(FAR struct file *filep, off_t offset, int whence)
/* Set up for the new file position */
data_spndx = (pos > 0 ? (pos - 1) : 0) / SPIFFS_DATA_PAGE_SIZE(fs);
objndx_spndx = SPIFFS_OBJNDX_ENTRY_SPNDX(fs, data_spndx);
@@ -1127,7 +1126,7 @@ static int spiffs_dup(FAR const struct file *oldp, FAR struct file *newp)
fobj = oldp->f_priv;
/* Increment the reference count (atomically)*/
/* Increment the reference count (atomically) */
spiffs_lock_volume(fs);
fobj->crefs++;
@@ -1676,8 +1675,9 @@ static int spiffs_unlink(FAR struct inode *mountpt, FAR const char *relpath)
}
else
{
/* Otherwise, we will need to re-open the file */
/* Allocate new file object */
/* Otherwise, we will need to re-open the file.
* First, allocate new file object.
*/
fobj = (FAR struct spiffs_file_s *)kmm_zalloc(sizeof(struct spiffs_file_s));
if (fobj == NULL)
+6 -4
View File
@@ -83,6 +83,7 @@
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/* TMPFS helpers */
static void tmpfs_lock_reentrant(FAR struct tmpfs_sem_s *sem);
@@ -1411,8 +1412,9 @@ static int tmpfs_open(FAR struct file *filep, FAR const char *relpath,
goto errout_with_filelock;
}
/* Check if the caller has sufficient privileges to open the file */
/* REVISIT: No file protection implemented */
/* Check if the caller has sufficient privileges to open the file.
* REVISIT: No file protection implemented
*/
/* If O_TRUNC is specified and the file is opened for writing,
* then truncate the file. This operation requires that the file is
@@ -1770,7 +1772,7 @@ static int tmpfs_dup(FAR const struct file *oldp, FAR struct file *newp)
tfo = oldp->f_priv;
DEBUGASSERT(tfo != NULL);
/* Increment the reference count (atomically)*/
/* Increment the reference count (atomically) */
tmpfs_lock_file(tfo);
tfo->tfo_refs++;
@@ -1810,7 +1812,7 @@ static int tmpfs_fstat(FAR const struct file *filep, FAR struct stat *buf)
tmpfs_lock_file(tfo);
/* Return information about the file in the stat buffer.*/
/* Return information about the file in the stat buffer. */
tmpfs_stat_common((FAR struct tmpfs_object_s *)tfo, buf);
+5 -4
View File
@@ -78,6 +78,7 @@
/****************************************************************************
* Private Types
****************************************************************************/
/* This structure describes one contained file system mountpoint */
struct unionfs_mountpt_s
@@ -107,6 +108,7 @@ struct unionfs_file_s
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/* Helper functions */
static int unionfs_semtake(FAR struct unionfs_inode_s *ui, bool noint);
@@ -358,7 +360,6 @@ static bool unionfs_ispartprefix(FAR const char *partprefix,
/* Check for NUL or empty full prefix */
if (prefix == NULL || *prefix == '\0')
{
/* A non-NUL partial path cannot be a contained in a NUL prefix */
@@ -703,7 +704,7 @@ static FAR char *unionfs_relpath(FAR const char *path, FAR const char *name)
{
/* Yes.. extend the file name by prepending the path */
if (path[pathlen-1] == '/')
if (path[pathlen - 1] == '/')
{
ret = asprintf(&relpath, "%s%s", path, name);
}
@@ -1715,7 +1716,7 @@ static int unionfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir)
* directories.
*/
strncpy(dir->fd_dir.d_name, um->um_prefix, NAME_MAX+1);
strncpy(dir->fd_dir.d_name, um->um_prefix, NAME_MAX + 1);
/* Describe this as a read only directory */
@@ -1789,7 +1790,7 @@ static int unionfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir)
* be multiple directories.
*/
strncpy(dir->fd_dir.d_name, um->um_prefix, NAME_MAX+1);
strncpy(dir->fd_dir.d_name, um->um_prefix, NAME_MAX + 1);
/* Describe this as a read only directory */
+1 -1
View File
@@ -1377,7 +1377,7 @@ static int userfs_bind(FAR struct inode *blkdriver, FAR const void *data,
client.sin_port = 0;
client.sin_addr.s_addr = HTONL(INADDR_LOOPBACK);
ret = psock_bind(&priv->psock, (struct sockaddr*)&client,
ret = psock_bind(&priv->psock, (FAR struct sockaddr *)&client,
sizeof(struct sockaddr_in));
if (ret < 0)
{
+2 -1
View File
@@ -63,7 +63,8 @@ int dup(int fd)
int ret = OK;
/* Check the range of the descriptor to see if we got a file or a socket
* descriptor. */
* descriptor.
*/
if ((unsigned int)fd < CONFIG_NFILE_DESCRIPTORS)
{
-1
View File
@@ -130,4 +130,3 @@ errout:
set_errno(-ret);
return ERROR;
}
+1 -1
View File
@@ -142,7 +142,7 @@ int epoll_ctl(int epfd, int op, int fd, struct epoll_event *ev)
{
if (eph->evs[i].data.fd == fd)
{
if (i != eph->occupied-1)
if (i != eph->occupied - 1)
{
memmove(&eph->evs[i], &eph->evs[i + 1],
eph->occupied - i);
+11 -8
View File
@@ -107,7 +107,8 @@ static int poll_fdsetup(int fd, FAR struct pollfd *fds, bool setup)
/* Perform the socket ioctl */
#ifdef CONFIG_NET
if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS))
if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS +
CONFIG_NSOCKET_DESCRIPTORS))
{
return net_poll(fd, fds, setup);
}
@@ -478,18 +479,20 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
#if (MSEC_PER_TICK * USEC_PER_MSEC) != USEC_PER_TICK && \
defined(CONFIG_HAVE_LONG_LONG)
ticks = (((unsigned long long)timeout * USEC_PER_MSEC) + (USEC_PER_TICK - 1)) /
ticks = (((unsigned long long)timeout * USEC_PER_MSEC) +
(USEC_PER_TICK - 1)) /
USEC_PER_TICK;
#else
ticks = ((unsigned int)timeout + (MSEC_PER_TICK - 1)) / MSEC_PER_TICK;
ticks = ((unsigned int)timeout + (MSEC_PER_TICK - 1)) /
MSEC_PER_TICK;
#endif
/* Either wait for either a poll event(s), for a signal to occur,
* or for the specified timeout to elapse with no event.
*
* NOTE: If a poll event is pending (i.e., the semaphore has already
* been incremented), nxsem_tickwait() will not wait, but will return
* immediately.
* NOTE: If a poll event is pending (i.e., the semaphore has
* already been incremented), nxsem_tickwait() will not wait, but
* will return immediately.
*/
ret = nxsem_tickwait(&sem, clock_systimer(), ticks);
@@ -512,8 +515,8 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
ret = poll_semtake(&sem);
}
/* Teardown the poll operation and get the count of events. Zero will be
* returned in the case of a timeout.
/* Teardown the poll operation and get the count of events. Zero will
* be returned in the case of a timeout.
*
* Preserve ret, if negative, since it holds the result of the wait.
*/
+3 -2
View File
@@ -390,7 +390,7 @@ next_subdir:
{
FAR char *subdirname;
/* Yes.. In this case, the target of the rename must be a
/* Yes.. In this case, the target of the rename must be a
* subdirectory of newinode, not the newinode itself. For
* example: mv b a/ must move b to a/b.
*/
@@ -414,7 +414,8 @@ next_subdir:
FAR char *tmp = subdir;
subdir = NULL;
(void)asprintf(&subdir, "%s/%s", newrelpath, subdirname);
(void)asprintf(&subdir, "%s/%s", newrelpath,
subdirname);
if (tmp != NULL)
{
+2 -2
View File
@@ -137,8 +137,8 @@ int rmdir(FAR const char *pathname)
#endif
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
/* If this is a "dangling" pseudo-directory node (i.e., it has no operations)
* then rmdir should remove the node.
/* If this is a "dangling" pseudo-directory node (i.e., it has no
* operations) then rmdir should remove the node.
*/
if (!inode->u.i_ops)