changeset 1167:9a5dfd13727c

common: add block size and number of blocks to struct nattr Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Sun, 05 Apr 2020 13:51:28 -0400
parents cf539681812d
children 543b2cf8aaf8
files src/common/attr.c src/common/include/nomad/attr.h
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/common/attr.c	Sun Apr 05 13:08:51 2020 -0400
+++ b/src/common/attr.c	Sun Apr 05 13:51:28 2020 -0400
@@ -138,6 +138,11 @@
 	nattr->ino = stat->st_ino;
 	nattr->owner = stat->st_uid;
 	nattr->group = stat->st_gid;
+	nattr->blksize = stat->st_blksize;
+	nattr->blocks = stat->st_blocks;
+
+	STATIC_ASSERT(sizeof(stat->st_blksize) == sizeof(nattr->blksize));
+	STATIC_ASSERT(sizeof(stat->st_blocks) == sizeof(nattr->blocks));
 }
 
 bool_t xdr_nattr(XDR *xdrs, struct nattr *attr)
@@ -162,5 +167,9 @@
 		return FALSE;
 	if (!xdr_uint32_t(xdrs, &attr->group))
 		return FALSE;
+	if (!xdr_uint32_t(xdrs, &attr->blksize))
+		return FALSE;
+	if (!xdr_uint64_t(xdrs, &attr->blocks))
+		return FALSE;
 	return TRUE;
 }
--- a/src/common/include/nomad/attr.h	Sun Apr 05 13:08:51 2020 -0400
+++ b/src/common/include/nomad/attr.h	Sun Apr 05 13:51:28 2020 -0400
@@ -89,6 +89,8 @@
 	uint64_t ino;
 	uint32_t owner;
 	uint32_t group;
+	uint32_t blksize;
+	uint64_t blocks;
 };
 
 extern mode_t nmode_to_mode(const uint16_t nmode);