From f56d1427ba4390abbc7ad29d18bc32f4b76e66d9 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 23 Jun 2025 16:04:46 +1000 Subject: [PATCH] Rename mmap_span -> mmap-span Go's magic treatment of _suffix is not a good naming convention. --- mmap_span/mmap_span.go => mmap-span/mmap-span.go | 2 +- storage/mmap.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) rename mmap_span/mmap_span.go => mmap-span/mmap-span.go (99%) diff --git a/mmap_span/mmap_span.go b/mmap-span/mmap-span.go similarity index 99% rename from mmap_span/mmap_span.go rename to mmap-span/mmap-span.go index 10bbfb67..55031040 100644 --- a/mmap_span/mmap_span.go +++ b/mmap-span/mmap-span.go @@ -1,4 +1,4 @@ -package mmap_span +package mmapSpan import ( "errors" diff --git a/storage/mmap.go b/storage/mmap.go index 5c84f282..95879276 100644 --- a/storage/mmap.go +++ b/storage/mmap.go @@ -15,7 +15,7 @@ import ( "github.com/edsrzf/mmap-go" "github.com/anacrolix/torrent/metainfo" - "github.com/anacrolix/torrent/mmap_span" + mmapSpan "github.com/anacrolix/torrent/mmap-span" ) type mmapClientImpl struct { @@ -55,7 +55,7 @@ func (s *mmapClientImpl) Close() error { type mmapTorrentStorage struct { infoHash metainfo.Hash - span *mmap_span.MMapSpan + span *mmapSpan.MMapSpan pc PieceCompletionGetSetter } @@ -109,7 +109,7 @@ func (sp mmapStoragePiece) MarkNotComplete() error { return sp.pc.Set(sp.pieceKey(), false) } -func mMapTorrent(md *metainfo.Info, location string) (mms *mmap_span.MMapSpan, err error) { +func mMapTorrent(md *metainfo.Info, location string) (mms *mmapSpan.MMapSpan, err error) { var mMaps []FileMapping defer func() { if err != nil { @@ -133,7 +133,7 @@ func mMapTorrent(md *metainfo.Info, location string) (mms *mmap_span.MMapSpan, e } mMaps = append(mMaps, mm) } - return mmap_span.New(mMaps, md.FileSegmentsIndex()), nil + return mmapSpan.New(mMaps, md.FileSegmentsIndex()), nil } func mmapFile(name string, size int64) (_ FileMapping, err error) { @@ -198,7 +198,7 @@ func WrapFileMapping(region mmap.MMap, file *os.File) FileMapping { } } -type FileMapping = mmap_span.Mmap +type FileMapping = mmapSpan.Mmap // Handles closing the mmap's file handle (needed for Windows). Could be implemented differently by // OS. -- 2.51.0