From 7fad495e1dc5040f1cb1e3163dd172a245f84abd Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 2 Dec 2013 19:00:59 -0600 Subject: [PATCH] Cosmetic changes to debug output --- fs/nxffs/nxffs_block.c | 2 +- fs/nxffs/nxffs_initialize.c | 2 +- fs/nxffs/nxffs_inode.c | 2 +- fs/nxffs/nxffs_ioctl.c | 2 +- fs/nxffs/nxffs_open.c | 18 +++++++++--------- fs/nxffs/nxffs_pack.c | 4 ++-- fs/nxffs/nxffs_read.c | 4 ++-- fs/nxffs/nxffs_reformat.c | 6 ++++-- fs/nxffs/nxffs_stat.c | 8 +++++--- fs/nxffs/nxffs_unlink.c | 4 ++-- fs/nxffs/nxffs_write.c | 11 ++++++----- 11 files changed, 34 insertions(+), 29 deletions(-) diff --git a/fs/nxffs/nxffs_block.c b/fs/nxffs/nxffs_block.c index 1a6a13adb3..ff62811b8b 100644 --- a/fs/nxffs/nxffs_block.c +++ b/fs/nxffs/nxffs_block.c @@ -185,6 +185,6 @@ int nxffs_validblock(struct nxffs_volume_s *volume, off_t *block) * valid blocks left in the volume. */ - fdbg("No valid block found\n"); + fdbg("ERROR: No valid block found\n"); return -ENOSPC; } diff --git a/fs/nxffs/nxffs_initialize.c b/fs/nxffs/nxffs_initialize.c index 084f3254e8..09a7951fcc 100644 --- a/fs/nxffs/nxffs_initialize.c +++ b/fs/nxffs/nxffs_initialize.c @@ -291,7 +291,7 @@ int nxffs_initialize(FAR struct mtd_dev_s *mtd) /* Get statistics on the re-formatted volume */ -#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_FS) +#if defined(CONFIG_NXFFS_SCAN_VOLUME) && defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_FS) ret = nxffs_blockstats(volume, &stats); if (ret < 0) { diff --git a/fs/nxffs/nxffs_inode.c b/fs/nxffs/nxffs_inode.c index 287dcae33d..d87729dd73 100644 --- a/fs/nxffs/nxffs_inode.c +++ b/fs/nxffs/nxffs_inode.c @@ -169,7 +169,7 @@ static int nxffs_rdentry(FAR struct nxffs_volume_s *volume, off_t offset, crc = crc32part((FAR const uint8_t *)entry->name, namlen, crc); if (crc != ecrc) { - fdbg("CRC entry: %08x CRC calculated: %08x\n", ecrc, crc); + fdbg("ERROR: CRC entry: %08x CRC calculated: %08x\n", ecrc, crc); ret = -EIO; goto errout_with_name; } diff --git a/fs/nxffs/nxffs_ioctl.c b/fs/nxffs/nxffs_ioctl.c index 853c46fabf..cdb651bfd8 100644 --- a/fs/nxffs/nxffs_ioctl.c +++ b/fs/nxffs/nxffs_ioctl.c @@ -118,7 +118,7 @@ int nxffs_ioctl(FAR struct file *filep, int cmd, unsigned long arg) if (volume->ofiles) { - fdbg("Open files\n"); + fdbg("ERROR: Open files\n"); ret = -EBUSY; goto errout_with_semaphore; } diff --git a/fs/nxffs/nxffs_open.c b/fs/nxffs/nxffs_open.c index 31b5dad329..72fb6a9f9d 100644 --- a/fs/nxffs/nxffs_open.c +++ b/fs/nxffs/nxffs_open.c @@ -437,7 +437,7 @@ static inline int nxffs_wropen(FAR struct nxffs_volume_s *volume, * Limitation: Files cannot be open both for reading and writing. */ - fdbg("File is open for reading\n"); + fdbg("ERROR: File is open for reading\n"); ret = -ENOSYS; goto errout_with_exclsem; } @@ -448,7 +448,7 @@ static inline int nxffs_wropen(FAR struct nxffs_volume_s *volume, else if ((oflags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL)) { - fdbg("File exists, can't create O_EXCL\n"); + fdbg("ERROR: File exists, can't create O_EXCL\n"); ret = -EEXIST; goto errout_with_exclsem; } @@ -474,7 +474,7 @@ static inline int nxffs_wropen(FAR struct nxffs_volume_s *volume, else { - fdbg("File %s exists and we were not asked to truncate it\n"); + fdbg("ERROR: File %s exists and we were not asked to truncate it\n"); ret = -ENOSYS; goto errout_with_exclsem; } @@ -486,7 +486,7 @@ static inline int nxffs_wropen(FAR struct nxffs_volume_s *volume, if ((oflags & O_CREAT) == 0) { - fdbg("Not asked to create the file\n"); + fdbg("ERROR: Not asked to create the file\n"); ret = -ENOENT; goto errout_with_exclsem; } @@ -496,7 +496,7 @@ static inline int nxffs_wropen(FAR struct nxffs_volume_s *volume, namlen = strlen(name); if (namlen > CONFIG_NXFFS_MAXNAMLEN) { - fdbg("Name is too long: %d\n", namlen); + fdbg("ERROR: Name is too long: %d\n", namlen); ret = -EINVAL; goto errout_with_exclsem; } @@ -726,7 +726,7 @@ static inline int nxffs_rdopen(FAR struct nxffs_volume_s *volume, if ((ofile->oflags & O_WROK) != 0) { - fdbg("File is open for writing\n"); + fdbg("ERROR: File is open for writing\n"); ret = -ENOSYS; goto errout_with_exclsem; } @@ -734,7 +734,7 @@ static inline int nxffs_rdopen(FAR struct nxffs_volume_s *volume, /* Just increment the reference count on the ofile */ ofile->crefs++; - fdbg("crefs: %d\n", ofile->crefs); + fvdbg("crefs: %d\n", ofile->crefs); } /* The file has not yet been opened. @@ -1036,7 +1036,7 @@ int nxffs_open(FAR struct file *filep, FAR const char *relpath, { case 0: default: - fdbg("One of O_WRONLY/O_RDONLY must be provided\n"); + fdbg("ERROR: One of O_WRONLY/O_RDONLY must be provided\n"); return -EINVAL; case O_WROK: @@ -1048,7 +1048,7 @@ int nxffs_open(FAR struct file *filep, FAR const char *relpath, break; case O_WROK|O_RDOK: - fdbg("O_RDWR is not supported\n"); + fdbg("ERROR: O_RDWR is not supported\n"); return -ENOSYS; } diff --git a/fs/nxffs/nxffs_pack.c b/fs/nxffs/nxffs_pack.c index d6e31896ec..8663e3a7b6 100644 --- a/fs/nxffs/nxffs_pack.c +++ b/fs/nxffs/nxffs_pack.c @@ -1423,7 +1423,7 @@ start_pack: * with uncorrectable bit errors. */ - /* Pack each I/O block */ + /* Read each I/O block */ for (i = 0, block = pack.block0, pack.iobuffer = volume->pack; i < volume->blkper; @@ -1441,7 +1441,7 @@ start_pack: } } - /* Now ack each I/O block */ + /* Now pack each I/O block */ for (i = 0, block = pack.block0, pack.iobuffer = volume->pack; i < volume->blkper; diff --git a/fs/nxffs/nxffs_read.c b/fs/nxffs/nxffs_read.c index 406d27dd34..82a00d6b31 100644 --- a/fs/nxffs/nxffs_read.c +++ b/fs/nxffs/nxffs_read.c @@ -193,7 +193,7 @@ ssize_t nxffs_read(FAR struct file *filep, FAR char *buffer, size_t buflen) if ((ofile->oflags & O_RDOK) == 0) { - fdbg("File not open for read access\n"); + fdbg("ERROR: File not open for read access\n"); ret = -EACCES; goto errout_with_semaphore; } @@ -445,7 +445,7 @@ int nxffs_rdblkhdr(FAR struct nxffs_volume_s *volume, off_t offset, if ((uint32_t)doffset + (uint32_t)dlen > (uint32_t)volume->geo.blocksize) { - fdbg("Data length=%d is unreasonable at offset=%d\n", dlen, doffset); + fdbg("ERROR: Data length=%d is unreasonable at offset=%d\n", dlen, doffset); return -EIO; } diff --git a/fs/nxffs/nxffs_reformat.c b/fs/nxffs/nxffs_reformat.c index fd33dd3b23..2b6e7c267f 100644 --- a/fs/nxffs/nxffs_reformat.c +++ b/fs/nxffs/nxffs_reformat.c @@ -204,7 +204,9 @@ static int nxffs_badblocks(FAR struct nxffs_volume_s *volume) good = false; } - /* Check that block data is erased */ + /* This is a properly formatted, good NXFFS block. Check that the + * block data payload is erased. + */ else { @@ -215,7 +217,7 @@ static int nxffs_badblocks(FAR struct nxffs_volume_s *volume) /* If the block is bad, attempt to re-write the block header * indicating a bad block (of course, if the block has failed, - * this may not be possible, depending upon failure modes. + * this may not be possible, depending upon failure modes). */ if (!good) diff --git a/fs/nxffs/nxffs_stat.c b/fs/nxffs/nxffs_stat.c index 0d232226e8..ab8c51cc2f 100644 --- a/fs/nxffs/nxffs_stat.c +++ b/fs/nxffs/nxffs_stat.c @@ -101,8 +101,10 @@ int nxffs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf) goto errout; } - /* Fill in the statfs info */ -#warning "Need f_bfree, f_bavail, f_files, f_ffree calculation" + /* Fill in the statfs info + * + * REVISIT: Need f_bfree, f_bavail, f_files, f_ffree calculation + */ memset(buf, 0, sizeof(struct statfs)); buf->f_type = NXFFS_MAGIC; @@ -160,7 +162,7 @@ int nxffs_stat(FAR struct inode *mountpt, FAR const char *relpath, ret = nxffs_findinode(volume, relpath, &entry); if (ret < 0) { - fdbg("Inode '%s' not found: %d\n", -ret); + fdbg("ERROR: Inode '%s' not found: %d\n", -ret); goto errout_with_semaphore; } diff --git a/fs/nxffs/nxffs_unlink.c b/fs/nxffs/nxffs_unlink.c index 65838846d2..ec61979596 100644 --- a/fs/nxffs/nxffs_unlink.c +++ b/fs/nxffs/nxffs_unlink.c @@ -102,7 +102,7 @@ int nxffs_rminode(FAR struct nxffs_volume_s *volume, FAR const char *name) { /* We can't remove the inode if it is open */ - fdbg("Inode '%s' is open\n", name); + fdbg("ERROR: Inode '%s' is open\n", name); ret = -EBUSY; goto errout; } @@ -112,7 +112,7 @@ int nxffs_rminode(FAR struct nxffs_volume_s *volume, FAR const char *name) ret = nxffs_findinode(volume, name, &entry); if (ret < 0) { - fdbg("Inode '%s' not found\n", name); + fdbg("ERROR: Inode '%s' not found\n", name); goto errout; } diff --git a/fs/nxffs/nxffs_write.c b/fs/nxffs/nxffs_write.c index 29f9726974..19d3fea59a 100644 --- a/fs/nxffs/nxffs_write.c +++ b/fs/nxffs/nxffs_write.c @@ -483,7 +483,7 @@ ssize_t nxffs_write(FAR struct file *filep, FAR const char *buffer, size_t bufle if ((wrfile->ofile.oflags & O_WROK) == 0) { - fdbg("File not open for write access\n"); + fdbg("ERROR: File not open for write access\n"); ret = -EACCES; goto errout_with_semaphore; } @@ -623,7 +623,7 @@ int nxffs_wrreserve(FAR struct nxffs_volume_s *volume, size_t size) { /* Return -ENOSPC to indicate that the volume is full */ - fdbg("No space in last block\n"); + fdbg("ERROR: No space in last block\n"); return -ENOSPC; } @@ -635,9 +635,10 @@ int nxffs_wrreserve(FAR struct nxffs_volume_s *volume, size_t size) ret = nxffs_validblock(volume, &volume->ioblock); if (ret < 0) { - fdbg("No more valid blocks\n"); + fdbg("ERROR: No more valid blocks\n"); return ret; } + volume->iooffset = SIZEOF_NXFFS_BLOCK_HDR; } @@ -769,7 +770,7 @@ int nxffs_wrverify(FAR struct nxffs_volume_s *volume, size_t size) ret = nxffs_validblock(volume, &volume->ioblock); if (ret < 0) { - fdbg("No more valid blocks\n"); + fdbg("ERROR: No more valid blocks\n"); return ret; } @@ -781,7 +782,7 @@ int nxffs_wrverify(FAR struct nxffs_volume_s *volume, size_t size) * the object. */ - fdbg("Not enough memory left to hold the file header\n"); + fdbg("ERROR: Not enough memory left to hold the file header\n"); return -ENOSPC; }