Documentation
¶
Index ¶
Constants ¶
const MaxLabelLen = 128
MaxLabelLen is the cap we enforce on the volume label. The real NTFS limit is 32 UTF-16 code units (~64 on-disk bytes); we use a slightly generous byte cap here since this mock driver stores raw bytes — that gives users headroom while still rejecting absurdly long input.
Variables ¶
var ErrShrinkTooSmall = errors.New("ntfs: shrink target smaller than highest used offset")
ErrShrinkTooSmall is returned by Shrink and Resize when the requested new size is smaller than the highest byte currently occupied by a live file blob. Callers must Compact or delete files before retrying.
Functions ¶
func Format ¶
func Format(path string, sizeBytes int64, cfg FormatConfig) (filesystem.Filesystem, error)
Types ¶
type FS ¶
type FS interface {
filesystem.Filesystem
FragmentationStats() (files int, used uint64, freeExtents int, totalFree uint64, largestFree uint64)
Layout() []FileLayout
Compact() error
Symlink(target, linkPath string) error
Label() string
SetLabel(label string) error
Grow(newSizeBytes int64) error
Shrink(newSizeBytes int64) error
Resize(newSizeBytes int64) error
}
FS is the public interface returned by Open. It extends filesystem.Filesystem with NTFS-specific operations (fragmentation analysis, compaction and NTFSIMG1 image resize). Callers that only need the generic interface can use it directly; callers that want the extras type-assert (or accept *FS via Open's return type).
NOTE: Grow / Shrink / Resize operate on the NTFSIMG1 image format this driver implements, NOT on real NTFS. Resizing a real NTFS volume would require manipulating the MFT, $Bitmap and runlists and is a separate, much larger project.
type FileLayout ¶
FileLayout describes a stored file blob location inside the image.
type FormatConfig ¶
type FormatConfig struct{ Label string }
Format creates a fresh NTFS-like image at path with the given size.
