Pkg.F2FS — API for parsing F2FS file system images¶
Overview¶
The Pkg.F2FS module contains the API for parsing F2FS (Flash-Friendly File System) images.
F2FS is a log-structured file system designed by Samsung for NAND flash storage. It uses a Node Address Table (NAT) for efficient inode resolution, multi-level hash-based directories, and supports inline data for small files, extended attributes, and compression (LZO, LZ4, ZSTD). F2FS is commonly found in Android devices and other flash-based storage systems.
Enumerating F2FS Files¶
The following code example demonstrates how to enumerate files in an F2FS file system:
from Pro.Core import *
from Pkg.F2FS import *
def enumerateFiles(fname):
c = createContainerFromFile(fname)
if c.isNull():
return
obj = F2FSObject()
if not obj.Load(c) or not obj.Initialize():
return
nre = CFSNonRecursiveEnum(obj)
nre.AddPath(obj.FSRootDirectory())
while True:
f = nre.Next(None)
if not f:
break
entry = obj.FSGetEntry(f, None)
if not entry.IsNull():
print(entry.Name(), entry.DataSize())
Module API¶
Pkg.F2FS module API.
Classes:
This class represents an F2FS (Flash-Friendly File System) image.
- class F2FSObject¶
Bases:
Pro.Core.CFFObjectThis class represents an F2FS (Flash-Friendly File System) image.
F2FS is a log-structured file system designed for NAND flash storage. It uses a Node Address Table (NAT) for inode resolution, multi-level hash directories, and supports inline data, compression (LZO, LZ4, ZSTD), and extended attributes. The class provides file system support through the CFS interface inherited from
CFFObject.Methods:
Returns the total number of blocks.
Returns the block size in bytes.
Returns a comma-separated list of enabled feature flags.
Returns the number of valid inodes.
GetUUID()Returns the UUID of the F2FS volume.
Returns the volume name of the F2FS image.
- GetBlockCount() → int¶
Returns the total number of blocks.
- Returns
Returns the block count.
- Return type
int
- GetBlockSize() → int¶
Returns the block size in bytes.
- Returns
Returns the block size.
- Return type
int
- GetFeatures() → str¶
Returns a comma-separated list of enabled feature flags.
- Returns
Returns the features string.
- Return type
str
- GetInodeCount() → int¶
Returns the number of valid inodes.
- Returns
Returns the inode count.
- Return type
int
- GetUUID() → str¶
Returns the UUID of the F2FS volume.
- Returns
Returns the UUID string.
- Return type
str
- GetVolumeName() → str¶
Returns the volume name of the F2FS image.
- Returns
Returns the volume name.
- Return type
str