Skip to content

Commit 3e0b53d

Browse files
milantracygvisor-bot
authored andcommitted
Clean up p9 package.
The p9 has been been deprecated, no reference to those types and methods. PiperOrigin-RevId: 789012763
1 parent 14c22da commit 3e0b53d

File tree

1 file changed

+0
-134
lines changed

1 file changed

+0
-134
lines changed

pkg/p9/p9.go

Lines changed: 0 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,6 @@ func (o OpenFlags) String() string {
130130
return buf.String()
131131
}
132132

133-
// Tag is a message tag.
134-
type Tag uint16
135-
136133
// FileMode are flags corresponding to file modes.
137134
//
138135
// These correspond to bits sent over the wire.
@@ -569,137 +566,6 @@ func StatToAttr(s *syscall.Stat_t, req AttrMask) (Attr, AttrMask) {
569566
return attr, req
570567
}
571568

572-
// SetAttrMask specifies a valid mask for setattr.
573-
type SetAttrMask struct {
574-
Permissions bool
575-
UID bool
576-
GID bool
577-
Size bool
578-
ATime bool
579-
MTime bool
580-
CTime bool
581-
ATimeNotSystemTime bool
582-
MTimeNotSystemTime bool
583-
}
584-
585-
// IsSubsetOf returns whether s is a subset of m.
586-
func (s SetAttrMask) IsSubsetOf(m SetAttrMask) bool {
587-
sb := s.bitmask()
588-
sm := m.bitmask()
589-
return sm|sb == sm
590-
}
591-
592-
// String implements fmt.Stringer.
593-
func (s SetAttrMask) String() string {
594-
var masks []string
595-
if s.Permissions {
596-
masks = append(masks, "Permissions")
597-
}
598-
if s.UID {
599-
masks = append(masks, "UID")
600-
}
601-
if s.GID {
602-
masks = append(masks, "GID")
603-
}
604-
if s.Size {
605-
masks = append(masks, "Size")
606-
}
607-
if s.ATime {
608-
masks = append(masks, "ATime")
609-
}
610-
if s.MTime {
611-
masks = append(masks, "MTime")
612-
}
613-
if s.CTime {
614-
masks = append(masks, "CTime")
615-
}
616-
if s.ATimeNotSystemTime {
617-
masks = append(masks, "ATimeNotSystemTime")
618-
}
619-
if s.MTimeNotSystemTime {
620-
masks = append(masks, "MTimeNotSystemTime")
621-
}
622-
return fmt.Sprintf("SetAttrMask{with: %s}", strings.Join(masks, " "))
623-
}
624-
625-
// Empty returns true if no fields are masked.
626-
func (s SetAttrMask) Empty() bool {
627-
return !s.Permissions && !s.UID && !s.GID && !s.Size && !s.ATime && !s.MTime && !s.CTime && !s.ATimeNotSystemTime && !s.MTimeNotSystemTime
628-
}
629-
630-
func (s SetAttrMask) bitmask() uint32 {
631-
var mask uint32
632-
if s.Permissions {
633-
mask |= 0x00000001
634-
}
635-
if s.UID {
636-
mask |= 0x00000002
637-
}
638-
if s.GID {
639-
mask |= 0x00000004
640-
}
641-
if s.Size {
642-
mask |= 0x00000008
643-
}
644-
if s.ATime {
645-
mask |= 0x00000010
646-
}
647-
if s.MTime {
648-
mask |= 0x00000020
649-
}
650-
if s.CTime {
651-
mask |= 0x00000040
652-
}
653-
if s.ATimeNotSystemTime {
654-
mask |= 0x00000080
655-
}
656-
if s.MTimeNotSystemTime {
657-
mask |= 0x00000100
658-
}
659-
return mask
660-
}
661-
662-
// SetAttr specifies a set of attributes for a setattr.
663-
type SetAttr struct {
664-
Permissions FileMode
665-
UID UID
666-
GID GID
667-
Size uint64
668-
ATimeSeconds uint64
669-
ATimeNanoSeconds uint64
670-
MTimeSeconds uint64
671-
MTimeNanoSeconds uint64
672-
}
673-
674-
// String implements fmt.Stringer.
675-
func (s SetAttr) String() string {
676-
return fmt.Sprintf("SetAttr{Permissions: 0o%o, UID: %d, GID: %d, Size: %d, ATime: {Sec: %d, NanoSec: %d}, MTime: {Sec: %d, NanoSec: %d}}", s.Permissions, s.UID, s.GID, s.Size, s.ATimeSeconds, s.ATimeNanoSeconds, s.MTimeSeconds, s.MTimeNanoSeconds)
677-
}
678-
679-
// Apply applies this to the given Attr.
680-
func (a *Attr) Apply(mask SetAttrMask, attr SetAttr) {
681-
if mask.Permissions {
682-
a.Mode = a.Mode&^permissionsMask | (attr.Permissions & permissionsMask)
683-
}
684-
if mask.UID {
685-
a.UID = attr.UID
686-
}
687-
if mask.GID {
688-
a.GID = attr.GID
689-
}
690-
if mask.Size {
691-
a.Size = attr.Size
692-
}
693-
if mask.ATime {
694-
a.ATimeSeconds = attr.ATimeSeconds
695-
a.ATimeNanoSeconds = attr.ATimeNanoSeconds
696-
}
697-
if mask.MTime {
698-
a.MTimeSeconds = attr.MTimeSeconds
699-
a.MTimeNanoSeconds = attr.MTimeNanoSeconds
700-
}
701-
}
702-
703569
// AllocateMode are possible modes to p9.File.Allocate().
704570
type AllocateMode struct {
705571
KeepSize bool

0 commit comments

Comments
 (0)