Skip to content

Commit

Permalink
Rename "FillByFAllocate" to "FillByFallocate" (#217)
Browse files Browse the repository at this point in the history
Signed-off-by: cwen0 <cwenyin0@gmail.com>

Signed-off-by: cwen0 <cwenyin0@gmail.com>
  • Loading branch information
cwen0 committed Sep 20, 2022
1 parent 98f3ca4 commit f6d3a9f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cmd/attack/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func NewDiskFillCommand(dep fx.Option, options *core.DiskOption) *cobra.Command
Short: "fill disk",
Run: func(*cobra.Command, []string) {
options.Action = core.DiskFillAction
utils.FxNewAppWithoutLog(dep, fx.Invoke(processDiskAttack), fx.NopLogger).Run()
utils.FxNewAppWithoutLog(dep, fx.Invoke(processDiskAttack)).Run()
},
}

Expand All @@ -128,7 +128,7 @@ func NewDiskFillCommand(dep fx.Option, options *core.DiskOption) *cobra.Command
"If path not provided, a temp file will be generated and deleted immediately after data filled in or allocated")
cmd.Flags().StringVarP(&options.Percent, "percent", "c", "",
"'percent' how many percent data of disk will fill in the file path")
cmd.Flags().BoolVarP(&options.FillByFAllocate, "fallocate", "f", true, "fill disk by fallocate instead of dd")
cmd.Flags().BoolVarP(&options.FillByFallocate, "fallocate", "f", true, "fill disk by fallocate instead of dd")
return cmd
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/core/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ type DiskOption struct {
Percent string `json:"percent,omitempty"`
PayloadProcessNum uint8 `json:"payload-process-num,omitempty"`

FillByFAllocate bool `json:"fill-by-fallocate,omitempty"`
FillByFallocate bool `json:"fallocate,omitempty"`
}

func NewDiskOption() *DiskOption {
Expand All @@ -86,7 +86,7 @@ func NewDiskOption() *DiskOption {
Kind: DiskAttack,
},
PayloadProcessNum: 1,
FillByFAllocate: true,
FillByFallocate: true,
}
}

Expand All @@ -105,7 +105,7 @@ func (opt *DiskOption) PreProcess() (*DiskAttackConfig, error) {
return nil, err
}

if opt.Action == DiskFillAction && opt.FillByFAllocate && byteSize != 0 {
if opt.Action == DiskFillAction && opt.FillByFallocate && byteSize != 0 {
return &DiskAttackConfig{
CommonAttackConfig: opt.CommonAttackConfig,
DdOptions: nil,
Expand Down

0 comments on commit f6d3a9f

Please sign in to comment.