Skip to content

Commit 2d0b79e

Browse files
committed
using mountpoint instead of mdtname for fid2path
1 parent 3f07a04 commit 2d0b79e

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

cmd/changelog-reader/main.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func create_symlink(ctx context.Context, name string) {
152152
}
153153
}
154154

155-
func slink(ctx context.Context, mdtname string, rec *llapi.ChangelogRecord) {
155+
func slink(ctx context.Context, rec *llapi.ChangelogRecord) {
156156
tname, err := getPath(rec.Name(), rec.ParentFid().String())
157157
if err != nil {
158158
fmt.Printf("error in getPath: %s\n", err)
@@ -170,7 +170,7 @@ func slink(ctx context.Context, mdtname string, rec *llapi.ChangelogRecord) {
170170
}
171171

172172
// only handle symlinks here
173-
func unlnk(ctx context.Context, mdtname string, rec *llapi.ChangelogRecord) {
173+
func unlnk(ctx context.Context, rec *llapi.ChangelogRecord) {
174174
// if the target is in symlinkLookup we need to delete it
175175
if _, ok := symlinkLookup[rec.TargetFid().String()]; ok {
176176
tname, err := getPath(rec.Name(), rec.ParentFid().String())
@@ -216,7 +216,7 @@ func create_dir(ctx context.Context, name string) {
216216
}
217217
}
218218

219-
func mkdir(ctx context.Context, mdtname string, rec *llapi.ChangelogRecord) {
219+
func mkdir(ctx context.Context, rec *llapi.ChangelogRecord) {
220220
//var recno int64 = 0
221221
//var linkno int = 0
222222
//tname, _ := llapi.Fid2Path(mdtname, rec.TargetFid(), &recno, &linkno)
@@ -242,7 +242,7 @@ func mkdir(ctx context.Context, mdtname string, rec *llapi.ChangelogRecord) {
242242
create_dir(ctx, tname)
243243
}
244244

245-
func rmdir(ctx context.Context, mdtname string, rec *llapi.ChangelogRecord) {
245+
func rmdir(ctx context.Context, rec *llapi.ChangelogRecord) {
246246
tname, err := getPath(rec.Name(), rec.ParentFid().String())
247247
if err != nil {
248248
fmt.Printf("error in getPath: %s\n", err)
@@ -293,7 +293,7 @@ func rmdir(ctx context.Context, mdtname string, rec *llapi.ChangelogRecord) {
293293
// - If the file size is larger than 256MB then it must be restored if in archive
294294
// and then marked as dirty.
295295

296-
func renme(ctx context.Context, mdtname string, rec *llapi.ChangelogRecord) {
296+
func renme(ctx context.Context, rec *llapi.ChangelogRecord) {
297297
tname, err := getPath(rec.Name(), rec.ParentFid().String())
298298
if err != nil {
299299
fmt.Printf("error in getPath: %s\n", err)
@@ -432,12 +432,12 @@ func renme(ctx context.Context, mdtname string, rec *llapi.ChangelogRecord) {
432432
}
433433

434434
// we only need to update the layout for a directory
435-
func update_layout(ctx context.Context, mdtname string, rec *llapi.ChangelogRecord) {
435+
func update_layout(ctx context.Context, rec *llapi.ChangelogRecord) {
436436
tfid := rec.TargetFid()
437437

438438
recno := int64(0)
439439
linkno := 0
440-
target_name, err := llapi.Fid2Path(mdtname, tfid, &recno, &linkno)
440+
target_name, err := llapi.Fid2Path(mountRoot, tfid, &recno, &linkno)
441441
if err != nil {
442442
fmt.Printf("Error getting the path from a fid [%s]\n", err)
443443
return
@@ -470,12 +470,12 @@ func update_layout(ctx context.Context, mdtname string, rec *llapi.ChangelogReco
470470
}
471471
}
472472

473-
func update_metadata(ctx context.Context, mdtname string, rec *llapi.ChangelogRecord) {
473+
func update_metadata(ctx context.Context, rec *llapi.ChangelogRecord) {
474474
tfid := rec.TargetFid()
475475

476476
recno := int64(0)
477477
linkno := 0
478-
target_name, err := llapi.Fid2Path(mdtname, tfid, &recno, &linkno)
478+
target_name, err := llapi.Fid2Path(mountRoot, tfid, &recno, &linkno)
479479
if err != nil {
480480
fmt.Printf("Error getting the path from a fid [%s]\n", err)
481481
return
@@ -650,27 +650,27 @@ func process_changelog(mdtname string, userid string) {
650650
switch {
651651
case rectype == "MKDIR":
652652
display_changelog(rec)
653-
mkdir(ctx, mdtname, rec)
653+
mkdir(ctx, rec)
654654
case rectype == "RMDIR":
655655
display_changelog(rec)
656-
rmdir(ctx, mdtname, rec)
656+
rmdir(ctx, rec)
657657
case rectype == "RENME":
658658
display_changelog(rec)
659-
renme(ctx, mdtname, rec)
659+
renme(ctx, rec)
660660
//case rectype == "XATTR":
661-
// update_metadata(ctx, mdtname, rec)
661+
// update_metadata(ctx, rec)
662662
case rectype == "SATTR":
663663
display_changelog(rec)
664-
update_metadata(ctx, mdtname, rec)
664+
update_metadata(ctx, rec)
665665
case rectype == "LYOUT":
666666
display_changelog(rec)
667-
update_layout(ctx, mdtname, rec)
667+
update_layout(ctx, rec)
668668
case rectype == "SLINK":
669669
display_changelog(rec)
670-
slink(ctx, mdtname, rec)
670+
slink(ctx, rec)
671671
case rectype == "UNLNK":
672672
display_changelog(rec)
673-
unlnk(ctx, mdtname, rec)
673+
unlnk(ctx, rec)
674674
default:
675675
if debug == true {
676676
display_changelog(rec)

0 commit comments

Comments
 (0)