You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/08/26 15:46:03 UTC
[1/3] incubator-mynewt-core git commit: Use OS stats facilities for
nffs counters
Repository: incubator-mynewt-core
Updated Branches:
refs/heads/develop 1c939914c -> f83ed14c3
Use OS stats facilities for nffs counters
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/6a71b5e4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/6a71b5e4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/6a71b5e4
Branch: refs/heads/develop
Commit: 6a71b5e4546b53a6e85483af625bb265525e7c7c
Parents: 1e6c958
Author: Peter Snyder <gi...@peterfs.com>
Authored: Thu Aug 25 13:19:00 2016 -0700
Committer: Peter Snyder <gi...@peterfs.com>
Committed: Thu Aug 25 13:23:14 2016 -0700
----------------------------------------------------------------------
fs/nffs/pkg.yml | 1 +
fs/nffs/src/nffs.c | 53 ++++++++++++++++++++++++++++++++++-------
fs/nffs/src/nffs_block.c | 2 ++
fs/nffs/src/nffs_crc.c | 1 +
fs/nffs/src/nffs_flash.c | 3 +++
fs/nffs/src/nffs_format.c | 1 +
fs/nffs/src/nffs_gc.c | 2 ++
fs/nffs/src/nffs_hash.c | 4 ++--
fs/nffs/src/nffs_inode.c | 12 ++++++++--
fs/nffs/src/nffs_misc.c | 1 +
fs/nffs/src/nffs_priv.h | 30 +++++++++++++++++++----
fs/nffs/src/nffs_restore.c | 8 +++++--
12 files changed, 99 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a71b5e4/fs/nffs/pkg.yml
----------------------------------------------------------------------
diff --git a/fs/nffs/pkg.yml b/fs/nffs/pkg.yml
index 61e07e0..e01062e 100644
--- a/fs/nffs/pkg.yml
+++ b/fs/nffs/pkg.yml
@@ -33,3 +33,4 @@ pkg.deps:
- libs/os
- libs/testutil
- sys/log
+ - sys/stats
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a71b5e4/fs/nffs/src/nffs.c
----------------------------------------------------------------------
diff --git a/fs/nffs/src/nffs.c b/fs/nffs/src/nffs.c
index 26c24f2..a503df3 100644
--- a/fs/nffs/src/nffs.c
+++ b/fs/nffs/src/nffs.c
@@ -25,6 +25,7 @@
#include "os/os_mempool.h"
#include "os/os_mutex.h"
#include "os/os_malloc.h"
+#include "stats/stats.h"
#include "nffs_priv.h"
#include "nffs/nffs.h"
#include "fs/fs_if.h"
@@ -35,10 +36,6 @@ uint8_t nffs_scratch_area_idx;
uint16_t nffs_block_max_data_sz;
struct nffs_area_desc *nffs_current_area_descs;
-uint32_t nffs_hashcnt_ins;
-uint32_t nffs_hashcnt_rm;
-uint32_t nffs_object_count;
-
struct os_mempool nffs_file_pool;
struct os_mempool nffs_dir_pool;
struct os_mempool nffs_inode_entry_pool;
@@ -104,6 +101,29 @@ static const struct fs_ops nffs_ops = {
.f_name = "nffs"
};
+STATS_SECT_DECL(nffs_stats) nffs_stats;
+STATS_NAME_START(nffs_stats)
+ STATS_NAME(nffs_stats, nffs_hashcnt_ins)
+ STATS_NAME(nffs_stats, nffs_hashcnt_rm)
+ STATS_NAME(nffs_stats, nffs_object_count)
+ STATS_NAME(nffs_stats, nffs_iocnt_read)
+ STATS_NAME(nffs_stats, nffs_iocnt_write)
+ STATS_NAME(nffs_stats, nffs_gccnt)
+ STATS_NAME(nffs_stats, nffs_readcnt_data)
+ STATS_NAME(nffs_stats, nffs_readcnt_block)
+ STATS_NAME(nffs_stats, nffs_readcnt_crc)
+ STATS_NAME(nffs_stats, nffs_readcnt_copy)
+ STATS_NAME(nffs_stats, nffs_readcnt_format)
+ STATS_NAME(nffs_stats, nffs_readcnt_gccollate)
+ STATS_NAME(nffs_stats, nffs_readcnt_inode)
+ STATS_NAME(nffs_stats, nffs_readcnt_inodeent)
+ STATS_NAME(nffs_stats, nffs_readcnt_rename)
+ STATS_NAME(nffs_stats, nffs_readcnt_update)
+ STATS_NAME(nffs_stats, nffs_readcnt_filename)
+ STATS_NAME(nffs_stats, nffs_readcnt_object)
+ STATS_NAME(nffs_stats, nffs_readcnt_detect)
+STATS_NAME_END(nffs_stats)
+
static void
nffs_lock(void)
{
@@ -122,12 +142,24 @@ nffs_unlock(void)
assert(rc == 0 || rc == OS_NOT_STARTED);
}
-static void
+static int
nffs_stats_init(void)
{
- nffs_hashcnt_ins = 0;
- nffs_hashcnt_rm = 0;
- nffs_object_count = 0;
+ int rc = 0;
+ rc = stats_init_and_reg(
+ STATS_HDR(nffs_stats),
+ STATS_SIZE_INIT_PARMS(nffs_stats, STATS_SIZE_32),
+ STATS_NAME_INIT_PARMS(nffs_stats),
+ "nffs_stats");
+ if (rc) {
+ if (rc < 0) {
+ /* multiple initializations are okay */
+ rc = 0;
+ } else {
+ rc = FS_EOS;
+ }
+ }
+ return rc;
}
/**
@@ -636,7 +668,10 @@ nffs_init(void)
nffs_cache_clear();
- nffs_stats_init();
+ rc = nffs_stats_init();
+ if (rc != 0) {
+ return FS_EOS;
+ }
rc = os_mutex_init(&nffs_mutex);
if (rc != 0) {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a71b5e4/fs/nffs/src/nffs_block.c
----------------------------------------------------------------------
diff --git a/fs/nffs/src/nffs_block.c b/fs/nffs/src/nffs_block.c
index d1d291a..22e2230 100644
--- a/fs/nffs/src/nffs_block.c
+++ b/fs/nffs/src/nffs_block.c
@@ -89,6 +89,7 @@ nffs_block_read_disk(uint8_t area_idx, uint32_t area_offset,
{
int rc;
+ STATS_INC(nffs_stats, nffs_readcnt_block);
rc = nffs_flash_read(area_idx, area_offset, out_disk_block,
sizeof *out_disk_block);
if (rc != 0) {
@@ -436,6 +437,7 @@ nffs_block_read_data(const struct nffs_block *block, uint16_t offset,
area_offset += sizeof (struct nffs_disk_block);
area_offset += offset;
+ STATS_INC(nffs_stats, nffs_readcnt_data);
rc = nffs_flash_read(area_idx, area_offset, dst, length);
if (rc != 0) {
return rc;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a71b5e4/fs/nffs/src/nffs_crc.c
----------------------------------------------------------------------
diff --git a/fs/nffs/src/nffs_crc.c b/fs/nffs/src/nffs_crc.c
index e6523f9..d8c2439 100644
--- a/fs/nffs/src/nffs_crc.c
+++ b/fs/nffs/src/nffs_crc.c
@@ -37,6 +37,7 @@ nffs_crc_flash(uint16_t initial_crc, uint8_t area_idx, uint32_t area_offset,
chunk_len = len;
}
+ STATS_INC(nffs_stats, nffs_readcnt_crc);
rc = nffs_flash_read(area_idx, area_offset, nffs_flash_buf, chunk_len);
if (rc != 0) {
return rc;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a71b5e4/fs/nffs/src/nffs_flash.c
----------------------------------------------------------------------
diff --git a/fs/nffs/src/nffs_flash.c b/fs/nffs/src/nffs_flash.c
index 2588cf2..2086575 100644
--- a/fs/nffs/src/nffs_flash.c
+++ b/fs/nffs/src/nffs_flash.c
@@ -54,6 +54,7 @@ nffs_flash_read(uint8_t area_idx, uint32_t area_offset, void *data,
return FS_EOFFSET;
}
+ STATS_INC(nffs_stats, nffs_iocnt_read);
rc = hal_flash_read(area->na_flash_id, area->na_offset + area_offset, data,
len);
if (rc != 0) {
@@ -95,6 +96,7 @@ nffs_flash_write(uint8_t area_idx, uint32_t area_offset, const void *data,
return FS_EOFFSET;
}
+ STATS_INC(nffs_stats, nffs_iocnt_write);
rc = hal_flash_write(area->na_flash_id, area->na_offset + area_offset,
data, len);
if (rc != 0) {
@@ -133,6 +135,7 @@ nffs_flash_copy(uint8_t area_idx_from, uint32_t area_offset_from,
chunk_len = len;
}
+ STATS_INC(nffs_stats, nffs_readcnt_copy);
rc = nffs_flash_read(area_idx_from, area_offset_from, nffs_flash_buf,
chunk_len);
if (rc != 0) {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a71b5e4/fs/nffs/src/nffs_format.c
----------------------------------------------------------------------
diff --git a/fs/nffs/src/nffs_format.c b/fs/nffs/src/nffs_format.c
index 13d97cc..5ea4c03 100644
--- a/fs/nffs/src/nffs_format.c
+++ b/fs/nffs/src/nffs_format.c
@@ -35,6 +35,7 @@ nffs_format_from_scratch_area(uint8_t area_idx, uint8_t area_id)
int rc;
assert(area_idx < nffs_num_areas);
+ STATS_INC(nffs_stats, nffs_readcnt_format);
rc = nffs_flash_read(area_idx, 0, &disk_area, sizeof disk_area);
if (rc != 0) {
return rc;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a71b5e4/fs/nffs/src/nffs_gc.c
----------------------------------------------------------------------
diff --git a/fs/nffs/src/nffs_gc.c b/fs/nffs/src/nffs_gc.c
index ae92953..b0e055c 100644
--- a/fs/nffs/src/nffs_gc.c
+++ b/fs/nffs/src/nffs_gc.c
@@ -210,6 +210,7 @@ nffs_gc_block_chain_collate(struct nffs_hash_entry *last_entry,
nffs_flash_loc_expand(block.nb_hash_entry->nhe_flash_loc,
&from_area_idx, &from_area_offset);
from_area_offset += sizeof disk_block;
+ STATS_INC(nffs_stats, nffs_readcnt_gccollate);
rc = nffs_flash_read(from_area_idx, from_area_offset,
data + data_offset, block.nb_data_len);
if (rc != 0) {
@@ -534,6 +535,7 @@ nffs_gc(uint8_t *out_area_idx)
* reset its pointers to cached objects.
*/
nffs_gc_count++;
+ STATS_INC(nffs_stats, nffs_gccnt);
return 0;
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a71b5e4/fs/nffs/src/nffs_hash.c
----------------------------------------------------------------------
diff --git a/fs/nffs/src/nffs_hash.c b/fs/nffs/src/nffs_hash.c
index 299210b..ec7c213 100644
--- a/fs/nffs/src/nffs_hash.c
+++ b/fs/nffs/src/nffs_hash.c
@@ -156,7 +156,7 @@ nffs_hash_insert(struct nffs_hash_entry *entry)
list = nffs_hash + idx;
SLIST_INSERT_HEAD(list, entry, nhe_next);
- nffs_hashcnt_ins++;
+ STATS_INC(nffs_stats, nffs_hashcnt_ins);
if (nffs_hash_id_is_inode(entry->nhe_id)) {
nie = nffs_hash_find_inode(entry->nhe_id);
@@ -186,7 +186,7 @@ nffs_hash_remove(struct nffs_hash_entry *entry)
list = nffs_hash + idx;
SLIST_REMOVE(list, entry, nffs_hash_entry, nhe_next);
- nffs_hashcnt_rm++;
+ STATS_INC(nffs_stats, nffs_hashcnt_rm);
if (nffs_hash_id_is_inode(entry->nhe_id) && nie) {
nffs_inode_unsetflags(nie, NFFS_INODE_FLAG_INHASH);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a71b5e4/fs/nffs/src/nffs_inode.c
----------------------------------------------------------------------
diff --git a/fs/nffs/src/nffs_inode.c b/fs/nffs/src/nffs_inode.c
index a72bc82..3ddf28c 100644
--- a/fs/nffs/src/nffs_inode.c
+++ b/fs/nffs/src/nffs_inode.c
@@ -53,6 +53,7 @@ void
nffs_inode_entry_free(struct nffs_inode_entry *inode_entry)
{
if (inode_entry != NULL) {
+ assert(!nffs_inode_getflags(inode_entry, NFFS_INODE_FLAG_INHASH));
assert(nffs_hash_id_is_inode(inode_entry->nie_hash_entry.nhe_id));
os_memblock_put(&nffs_inode_entry_pool, inode_entry);
}
@@ -95,6 +96,7 @@ nffs_inode_read_disk(uint8_t area_idx, uint32_t offset,
{
int rc;
+ STATS_INC(nffs_stats, nffs_readcnt_inode);
rc = nffs_flash_read(area_idx, offset, out_disk_inode,
sizeof *out_disk_inode);
if (rc != 0) {
@@ -149,6 +151,7 @@ nffs_inode_calc_data_length(struct nffs_inode_entry *inode_entry,
*out_len = 0;
+ inode_entry->nie_blkcnt = 0;
cur = inode_entry->nie_last_block_entry;
while (cur != NULL) {
rc = nffs_block_from_hash_entry(&block, cur);
@@ -157,6 +160,7 @@ nffs_inode_calc_data_length(struct nffs_inode_entry *inode_entry,
}
*out_len += block.nb_data_len;
+ inode_entry->nie_blkcnt++;
cur = block.nb_prev;
}
@@ -231,8 +235,8 @@ nffs_inode_from_entry(struct nffs_inode *out_inode,
cached_name_len = out_inode->ni_filename_len;
}
if (cached_name_len != 0) {
- rc = nffs_flash_read(area_idx, area_offset + sizeof disk_inode,
- out_inode->ni_filename, cached_name_len);
+ STATS_INC(nffs_stats, nffs_readcnt_inodeent);
+ rc = nffs_flash_read(area_idx, area_offset + sizeof disk_inode, out_inode->ni_filename, cached_name_len);
if (rc != 0) {
return rc;
}
@@ -595,6 +599,8 @@ nffs_inode_rename(struct nffs_inode_entry *inode_entry,
filename_len = inode.ni_filename_len;
nffs_flash_loc_expand(inode_entry->nie_hash_entry.nhe_flash_loc,
&area_idx, &area_offset);
+
+ STATS_INC(nffs_stats, nffs_readcnt_rename);
rc = nffs_flash_read(area_idx,
area_offset + sizeof (struct nffs_disk_inode),
nffs_flash_buf, filename_len);
@@ -662,6 +668,7 @@ nffs_inode_update(struct nffs_inode_entry *inode_entry)
filename_len = inode.ni_filename_len;
nffs_flash_loc_expand(inode_entry->nie_hash_entry.nhe_flash_loc,
&area_idx, &area_offset);
+ STATS_INC(nffs_stats, nffs_readcnt_update);
rc = nffs_flash_read(area_idx,
area_offset + sizeof (struct nffs_disk_inode),
nffs_flash_buf, filename_len);
@@ -717,6 +724,7 @@ nffs_inode_read_filename_chunk(const struct nffs_inode *inode,
&area_idx, &area_offset);
area_offset += sizeof (struct nffs_disk_inode) + filename_offset;
+ STATS_INC(nffs_stats, nffs_readcnt_filename);
rc = nffs_flash_read(area_idx, area_offset, buf, len);
if (rc != 0) {
return rc;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a71b5e4/fs/nffs/src/nffs_misc.c
----------------------------------------------------------------------
diff --git a/fs/nffs/src/nffs_misc.c b/fs/nffs/src/nffs_misc.c
index cbf0e45..8aedd8a 100644
--- a/fs/nffs/src/nffs_misc.c
+++ b/fs/nffs/src/nffs_misc.c
@@ -153,6 +153,7 @@ nffs_misc_gc_if_oom(void *resource, int *out_rc)
/* Attempt a garbage collection on the next area. */
*out_rc = nffs_gc(NULL);
total_gc_cycles++;
+ STATS_INC(nffs_stats, nffs_gccnt);
if (*out_rc != 0) {
return 0;
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a71b5e4/fs/nffs/src/nffs_priv.h
----------------------------------------------------------------------
diff --git a/fs/nffs/src/nffs_priv.h b/fs/nffs/src/nffs_priv.h
index 4893045..1985da5 100644
--- a/fs/nffs/src/nffs_priv.h
+++ b/fs/nffs/src/nffs_priv.h
@@ -27,6 +27,7 @@
#include "nffs/nffs.h"
#include "fs/fs.h"
#include "util/crc16.h"
+#include "stats/stats.h"
#define NFFS_HASH_SIZE 256
@@ -124,7 +125,8 @@ struct nffs_inode_entry {
};
uint8_t nie_refcnt;
uint8_t nie_flags;
- uint16_t reserved16;
+ uint8_t nie_blkcnt;
+ uint8_t reserved8;
};
#define NFFS_INODE_FLAG_FREE 0x00
@@ -174,6 +176,7 @@ struct nffs_area {
uint16_t na_id;
uint8_t na_gc_seq;
uint8_t na_flash_id;
+ uint32_t na_obsolete; /* deleted bytecount */
};
struct nffs_disk_object {
@@ -236,9 +239,28 @@ struct nffs_dir {
struct nffs_dirent nd_dirent;
};
-extern uint32_t nffs_hashcnt_ins;
-extern uint32_t nffs_hashcnt_rm;
-extern uint32_t nffs_object_count;
+STATS_SECT_START(nffs_stats)
+ STATS_SECT_ENTRY(nffs_hashcnt_ins)
+ STATS_SECT_ENTRY(nffs_hashcnt_rm)
+ STATS_SECT_ENTRY(nffs_object_count)
+ STATS_SECT_ENTRY(nffs_iocnt_read)
+ STATS_SECT_ENTRY(nffs_iocnt_write)
+ STATS_SECT_ENTRY(nffs_gccnt)
+ STATS_SECT_ENTRY(nffs_readcnt_data)
+ STATS_SECT_ENTRY(nffs_readcnt_block)
+ STATS_SECT_ENTRY(nffs_readcnt_crc)
+ STATS_SECT_ENTRY(nffs_readcnt_copy)
+ STATS_SECT_ENTRY(nffs_readcnt_format)
+ STATS_SECT_ENTRY(nffs_readcnt_gccollate)
+ STATS_SECT_ENTRY(nffs_readcnt_inode)
+ STATS_SECT_ENTRY(nffs_readcnt_inodeent)
+ STATS_SECT_ENTRY(nffs_readcnt_rename)
+ STATS_SECT_ENTRY(nffs_readcnt_update)
+ STATS_SECT_ENTRY(nffs_readcnt_filename)
+ STATS_SECT_ENTRY(nffs_readcnt_object)
+ STATS_SECT_ENTRY(nffs_readcnt_detect)
+STATS_SECT_END
+extern STATS_SECT_DECL(nffs_stats) nffs_stats;
extern void *nffs_file_mem;
extern void *nffs_block_entry_mem;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a71b5e4/fs/nffs/src/nffs_restore.c
----------------------------------------------------------------------
diff --git a/fs/nffs/src/nffs_restore.c b/fs/nffs/src/nffs_restore.c
index fd425fc..2f7f2df 100644
--- a/fs/nffs/src/nffs_restore.c
+++ b/fs/nffs/src/nffs_restore.c
@@ -185,7 +185,6 @@ nffs_restore_should_sweep_inode_entry(struct nffs_inode_entry *inode_entry,
*/
if (nffs_inode_getflags(inode_entry, NFFS_INODE_FLAG_DUMMYINOBLK)) {
*out_should_sweep = 2;
- /*nffs_inode_inc_refcnt(inode_entry);*/
inode_entry->nie_refcnt = 1;
assert(inode_entry->nie_refcnt >= 1);
return 0;
@@ -724,6 +723,8 @@ nffs_restore_inode(const struct nffs_disk_inode *disk_inode, uint8_t area_idx,
err:
if (new_inode) {
+ assert(nffs_inode_getflags(inode_entry, NFFS_INODE_FLAG_INHASH));
+ nffs_hash_remove(&inode_entry->nie_hash_entry);
nffs_inode_entry_free(inode_entry);
}
return rc;
@@ -920,6 +921,7 @@ nffs_restore_block(const struct nffs_disk_block *disk_block, uint8_t area_idx,
err:
if (new_block) {
+ nffs_hash_remove(entry);
nffs_block_entry_free(entry);
}
return rc;
@@ -981,6 +983,7 @@ nffs_restore_disk_object(int area_idx, uint32_t area_offset,
if (rc != 0) {
return rc;
}
+ STATS_INC(nffs_stats, nffs_readcnt_object);
if (nffs_hash_id_is_inode(out_disk_object->ndo_disk_inode.ndi_id)) {
out_disk_object->ndo_type = NFFS_OBJECT_TYPE_INODE;
@@ -1059,7 +1062,7 @@ nffs_restore_area_contents(int area_idx)
if (rc == FS_ECORRUPT) {
area->na_cur++;
} else {
- nffs_object_count++; /* total count of restored objects */
+ STATS_INC(nffs_stats, nffs_object_count); /* restored objects */
area->na_cur += nffs_restore_disk_object_size(&disk_object);
}
break;
@@ -1101,6 +1104,7 @@ nffs_restore_detect_one_area(uint8_t flash_id, uint32_t area_offset,
{
int rc;
+ STATS_INC(nffs_stats, nffs_readcnt_detect);
rc = hal_flash_read(flash_id, area_offset, out_disk_area,
sizeof *out_disk_area);
if (rc != 0) {
[2/3] incubator-mynewt-core git commit: Don't zero stats_hdr in
stats_init() so s_name is preserved
Posted by cc...@apache.org.
Don't zero stats_hdr in stats_init() so s_name is preserved
Address jira ticket MYNEWT-369
https://issues.apache.org/jira/browse/MYNEWT-369
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/1e6c958b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/1e6c958b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/1e6c958b
Branch: refs/heads/develop
Commit: 1e6c958bbd568e1267001731a9cbf41348700fad
Parents: eff853a
Author: Peter Snyder <gi...@peterfs.com>
Authored: Thu Aug 25 11:34:07 2016 -0700
Committer: Peter Snyder <gi...@peterfs.com>
Committed: Thu Aug 25 13:23:14 2016 -0700
----------------------------------------------------------------------
sys/stats/src/stats.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/1e6c958b/sys/stats/src/stats.c
----------------------------------------------------------------------
diff --git a/sys/stats/src/stats.c b/sys/stats/src/stats.c
index a1f785c..5a181fd 100644
--- a/sys/stats/src/stats.c
+++ b/sys/stats/src/stats.c
@@ -149,7 +149,7 @@ int
stats_init(struct stats_hdr *shdr, uint8_t size, uint8_t cnt,
struct stats_name_map *map, uint8_t map_cnt)
{
- memset((uint8_t *) shdr, 0, sizeof(*shdr) + (size * cnt));
+ memset((uint8_t *) shdr+sizeof(*shdr), 0, size * cnt);
shdr->s_size = size;
shdr->s_cnt = cnt;
[3/3] incubator-mynewt-core git commit: This closes #98.
Posted by cc...@apache.org.
This closes #98.
Merge remote-tracking branch 'peterfs/nffs-update' into develop
* peterfs/nffs-update:
Use OS stats facilities for nffs counters
Don't zero stats_hdr in stats_init() so s_name is preserved
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/f83ed14c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f83ed14c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f83ed14c
Branch: refs/heads/develop
Commit: f83ed14c3d1ec8a12c124b18fb37cd62003543b2
Parents: 1c93991 6a71b5e
Author: Christopher Collins <cc...@apache.org>
Authored: Fri Aug 26 08:06:14 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Fri Aug 26 08:06:14 2016 -0700
----------------------------------------------------------------------
fs/nffs/pkg.yml | 1 +
fs/nffs/src/nffs.c | 53 ++++++++++++++++++++++++++++++++++-------
fs/nffs/src/nffs_block.c | 2 ++
fs/nffs/src/nffs_crc.c | 1 +
fs/nffs/src/nffs_flash.c | 3 +++
fs/nffs/src/nffs_format.c | 1 +
fs/nffs/src/nffs_gc.c | 2 ++
fs/nffs/src/nffs_hash.c | 4 ++--
fs/nffs/src/nffs_inode.c | 12 ++++++++--
fs/nffs/src/nffs_misc.c | 1 +
fs/nffs/src/nffs_priv.h | 30 +++++++++++++++++++----
fs/nffs/src/nffs_restore.c | 8 +++++--
sys/stats/src/stats.c | 2 +-
13 files changed, 100 insertions(+), 20 deletions(-)
----------------------------------------------------------------------