parseMountEntry parses a mount string and classifies the validation result. It returns the parsed parts together with a mountValidationKind so callers can map the shared result to their own error constructors. On format errors the returned parts are empty; on mode and empty-path errors any successfu
(mount string)
| 129 | // returned parts are empty; on mode and empty-path errors any successfully parsed |
| 130 | // fields are preserved in mountParts. |
| 131 | func parseMountEntry(mount string) (mountParts, mountValidationKind) { |
| 132 | source, dest, mode, err := validateMountStringFormat(mount) |
| 133 | if err != nil { |
| 134 | if source == "" && dest == "" && mode == "" { |
| 135 | return mountParts{}, mountValidationFormatError |
| 136 | } |
| 137 | return mountParts{source: source, dest: dest, mode: mode}, mountValidationModeError |
| 138 | } |
| 139 | if source == "" { |
| 140 | return mountParts{source: source, dest: dest, mode: mode}, mountValidationEmptySource |
| 141 | } |
| 142 | if dest == "" { |
| 143 | return mountParts{source: source, dest: dest, mode: mode}, mountValidationEmptyDestination |
| 144 | } |
| 145 | return mountParts{source: source, dest: dest, mode: mode}, mountValidationOK |
| 146 | } |
| 147 | |
| 148 | // validateMountEntries applies shared mount parsing and classification across |
| 149 | // callers while allowing each caller to preserve its own logging and error |