From 818fe47243e4d2343423e468cfd66bd910079664 Mon Sep 17 00:00:00 2001 From: Jiang Liu Date: Tue, 21 Mar 2023 15:40:24 +0800 Subject: [PATCH] rafs: get rid of several unimplemented() The nydus-image check for v5 uses some unimplemented methods of InodeWrapper, which causes panicking at runtime. Fixes: https://github.com/dragonflyoss/image-service/issues/1160 Signed-off-by: Jiang Liu --- rafs/src/metadata/inode.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rafs/src/metadata/inode.rs b/rafs/src/metadata/inode.rs index bd6cbc9df32..32217aba902 100644 --- a/rafs/src/metadata/inode.rs +++ b/rafs/src/metadata/inode.rs @@ -338,7 +338,7 @@ impl InodeWrapper { match self { InodeWrapper::V5(i) => i.i_mtime, InodeWrapper::V6(i) => i.i_mtime, - InodeWrapper::Ref(_i) => unimplemented!(), + InodeWrapper::Ref(i) => i.get_attr().mtime, } } @@ -357,7 +357,7 @@ impl InodeWrapper { match self { InodeWrapper::V5(i) => i.i_mtime_nsec, InodeWrapper::V6(i) => i.i_mtime_nsec, - InodeWrapper::Ref(_i) => unimplemented!(), + InodeWrapper::Ref(i) => i.get_attr().mtimensec, } } @@ -376,7 +376,7 @@ impl InodeWrapper { match self { InodeWrapper::V5(i) => i.i_blocks, InodeWrapper::V6(i) => i.i_blocks, - InodeWrapper::Ref(_i) => unimplemented!(), + InodeWrapper::Ref(i) => i.get_attr().blocks, } } @@ -424,7 +424,7 @@ impl InodeWrapper { match self { InodeWrapper::V5(i) => i.i_nlink, InodeWrapper::V6(i) => i.i_nlink, - InodeWrapper::Ref(_i) => unimplemented!(), + InodeWrapper::Ref(i) => i.get_attr().nlink, } } @@ -506,7 +506,7 @@ impl InodeWrapper { match self { InodeWrapper::V5(i) => i.i_child_index, InodeWrapper::V6(_i) => u32::MAX, - InodeWrapper::Ref(_i) => unimplemented!(), + InodeWrapper::Ref(i) => i.get_child_index().unwrap_or(u32::MAX), } }