Skip to content

Commit 933a41f

Browse files
committed
PR review fixes: Convert inode's is_* functions to properties
1 parent b8d68b9 commit 933a41f

File tree

1 file changed

+15
-7
lines changed
  • volatility3/framework/symbols/linux/extensions

1 file changed

+15
-7
lines changed

volatility3/framework/symbols/linux/extensions/__init__.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,34 +1780,42 @@ def is_valid(self) -> bool:
17801780
# pointer, will easily cause an integer overflow here.
17811781
return self.i_ino > 0 and self.i_count.counter >= 0
17821782

1783+
@property
17831784
def is_dir(self) -> bool:
17841785
"""Returns True if the inode is a directory"""
17851786
return stat.S_ISDIR(self.i_mode) != 0
17861787

1788+
@property
17871789
def is_reg(self) -> bool:
17881790
"""Returns True if the inode is a regular file"""
17891791
return stat.S_ISREG(self.i_mode) != 0
17901792

1793+
@property
17911794
def is_link(self) -> bool:
17921795
"""Returns True if the inode is a symlink"""
17931796
return stat.S_ISLNK(self.i_mode) != 0
17941797

1798+
@property
17951799
def is_fifo(self) -> bool:
17961800
"""Returns True if the inode is a FIFO"""
17971801
return stat.S_ISFIFO(self.i_mode) != 0
17981802

1803+
@property
17991804
def is_sock(self) -> bool:
18001805
"""Returns True if the inode is a socket"""
18011806
return stat.S_ISSOCK(self.i_mode) != 0
18021807

1808+
@property
18031809
def is_block(self) -> bool:
18041810
"""Returns True if the inode is a block device"""
18051811
return stat.S_ISBLK(self.i_mode) != 0
18061812

1813+
@property
18071814
def is_char(self) -> bool:
18081815
"""Returns True if the inode is a char device"""
18091816
return stat.S_ISCHR(self.i_mode) != 0
18101817

1818+
@property
18111819
def is_sticky(self) -> bool:
18121820
"""Returns True if the sticky bit is set"""
18131821
return (self.i_mode & stat.S_ISVTX) != 0
@@ -1818,19 +1826,19 @@ def get_inode_type(self) -> Union[str, None]:
18181826
Returns:
18191827
The inode type name
18201828
"""
1821-
if self.is_dir():
1829+
if self.is_dir:
18221830
return "DIR"
1823-
elif self.is_reg():
1831+
elif self.is_reg:
18241832
return "REG"
1825-
elif self.is_link():
1833+
elif self.is_link:
18261834
return "LNK"
1827-
elif self.is_fifo():
1835+
elif self.is_fifo:
18281836
return "FIFO"
1829-
elif self.is_sock():
1837+
elif self.is_sock:
18301838
return "SOCK"
1831-
elif self.is_char():
1839+
elif self.is_char:
18321840
return "CHR"
1833-
elif self.is_block():
1841+
elif self.is_block:
18341842
return "BLK"
18351843
else:
18361844
return None

0 commit comments

Comments
 (0)