Skip to content

Commit 933c4d3

Browse files
committed
libcontainer/intelrdt: privatize IntelRdtManager and its fields
No functional change. Signed-off-by: Xiaochen Shen <[email protected]>
1 parent 2c004a1 commit 933c4d3

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

libcontainer/intelrdt/intelrdt.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -165,18 +165,18 @@ type Manager interface {
165165
}
166166

167167
// This implements interface Manager
168-
type IntelRdtManager struct {
168+
type intelRdtManager struct {
169169
mu sync.Mutex
170-
Config *configs.Config
171-
Id string
172-
Path string
170+
config *configs.Config
171+
id string
172+
path string
173173
}
174174

175175
func NewManager(config *configs.Config, id string, path string) Manager {
176-
return &IntelRdtManager{
177-
Config: config,
178-
Id: id,
179-
Path: path,
176+
return &intelRdtManager{
177+
config: config,
178+
id: id,
179+
path: path,
180180
}
181181
}
182182

@@ -542,51 +542,51 @@ func GetIntelRdtPath(id string) (string, error) {
542542
}
543543

544544
// Applies Intel RDT configuration to the process with the specified pid
545-
func (m *IntelRdtManager) Apply(pid int) (err error) {
545+
func (m *intelRdtManager) Apply(pid int) (err error) {
546546
// If intelRdt is not specified in config, we do nothing
547-
if m.Config.IntelRdt == nil {
547+
if m.config.IntelRdt == nil {
548548
return nil
549549
}
550-
d, err := getIntelRdtData(m.Config, pid)
550+
d, err := getIntelRdtData(m.config, pid)
551551
if err != nil && !IsNotFound(err) {
552552
return err
553553
}
554554

555555
m.mu.Lock()
556556
defer m.mu.Unlock()
557-
path, err := d.join(m.Id)
557+
path, err := d.join(m.id)
558558
if err != nil {
559559
return err
560560
}
561561

562-
m.Path = path
562+
m.path = path
563563
return nil
564564
}
565565

566566
// Destroys the Intel RDT 'container_id' group
567-
func (m *IntelRdtManager) Destroy() error {
567+
func (m *intelRdtManager) Destroy() error {
568568
m.mu.Lock()
569569
defer m.mu.Unlock()
570570
if err := os.RemoveAll(m.GetPath()); err != nil {
571571
return err
572572
}
573-
m.Path = ""
573+
m.path = ""
574574
return nil
575575
}
576576

577577
// Returns Intel RDT path to save in a state file and to be able to
578578
// restore the object later
579-
func (m *IntelRdtManager) GetPath() string {
580-
if m.Path == "" {
581-
m.Path, _ = GetIntelRdtPath(m.Id)
579+
func (m *intelRdtManager) GetPath() string {
580+
if m.path == "" {
581+
m.path, _ = GetIntelRdtPath(m.id)
582582
}
583-
return m.Path
583+
return m.path
584584
}
585585

586586
// Returns statistics for Intel RDT
587-
func (m *IntelRdtManager) GetStats() (*Stats, error) {
587+
func (m *intelRdtManager) GetStats() (*Stats, error) {
588588
// If intelRdt is not specified in config
589-
if m.Config.IntelRdt == nil {
589+
if m.config.IntelRdt == nil {
590590
return nil, nil
591591
}
592592

@@ -668,7 +668,7 @@ func (m *IntelRdtManager) GetStats() (*Stats, error) {
668668
}
669669

670670
// Set Intel RDT "resource control" filesystem as configured.
671-
func (m *IntelRdtManager) Set(container *configs.Config) error {
671+
func (m *intelRdtManager) Set(container *configs.Config) error {
672672
// About L3 cache schema:
673673
// It has allocation bitmasks/values for L3 cache on each socket,
674674
// which contains L3 cache id and capacity bitmask (CBM).

0 commit comments

Comments
 (0)