Add more mount options to common-documentation

Related to #1

Add documentation for adfs, affs, and debugfs filesystem mount options.

* **common-documentation/filesystems/mountoptions/adfs.go**
  - Add documentation for adfs filesystem options including uid, gid, ownmask, and othmask.

* **common-documentation/filesystems/mountoptions/affs.go**
  - Add documentation for affs filesystem options including uid, gid, setuid, setgid, mode, and other options.

* **common-documentation/filesystems/mountoptions/debugfs.go**
  - Add documentation for debugfs filesystem options including uid, gid, and mode.

* **handlers/fstab/documentation/documentation-mountoptions.go**
  - Update to include the new mount options for adfs, affs, and debugfs filesystems.
  - Add entries for adfs, affs, and debugfs in the `MountOptionsMapField`.

* **common.go**
  - Add common constants like "zero" to common-documentation/filesystems/mountoptions/common.go.
This commit is contained in:
Myzel394 2024-08-05 23:01:28 +02:00
parent 68691c3016
commit 73de4ca319
5 changed files with 137 additions and 19 deletions

View File

@ -0,0 +1,22 @@
package commondocumentation
import docvalues "config-lsp/doc-values"
var AdfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
docvalues.CreateEnumStringWithDoc(
"uid",
"Set the owner of the files in the filesystem (default: uid=0).",
): docvalues.PositiveNumbeValue(),
docvalues.CreateEnumStringWithDoc(
"gid",
"Set the group of the files in the filesystem (default: gid=0).",
): docvalues.PositiveNumbeValue(),
docvalues.CreateEnumStringWithDoc(
"ownmask",
"Set the permission mask for ADFS 'owner' permissions (default: 0700).",
): docvalues.StringValue{},
docvalues.CreateEnumStringWithDoc(
"othmask",
"Set the permission mask for ADFS 'other' permissions (default: 0077).",
): docvalues.StringValue{},
}

View File

@ -0,0 +1,82 @@
package commondocumentation
import docvalues "config-lsp/doc-values"
var AffsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
docvalues.CreateEnumStringWithDoc(
"uid",
"Set the owner and group of the root of the filesystem (default: uid=gid=0, but with option uid or gid without specified value, the UID and GID of the current process are taken).",
): docvalues.NumberValue{Min: &zero},
docvalues.CreateEnumStringWithDoc(
"gid",
"Set the owner and group of the root of the filesystem (default: uid=gid=0, but with option uid or gid without specified value, the UID and GID of the current process are taken).",
): docvalues.NumberValue{Min: &zero},
docvalues.CreateEnumStringWithDoc(
"setuid",
"Set the owner of all files.",
): docvalues.NumberValue{Min: &zero},
docvalues.CreateEnumStringWithDoc(
"setgid",
"Set the group of all files.",
): docvalues.NumberValue{Min: &zero},
docvalues.CreateEnumStringWithDoc(
"mode",
"Set the mode of all files to value & 0777 disregarding the original permissions. Add search permission to directories that have read permission. The value is given in octal.",
): docvalues.StringValue{},
docvalues.CreateEnumStringWithDoc(
"protect",
"Do not allow any changes to the protection bits on the filesystem.",
): docvalues.StringValue{},
docvalues.CreateEnumStringWithDoc(
"usemp",
"Set UID and GID of the root of the filesystem to the UID and GID of the mount point upon the first sync or umount, and then clear this option. Strange...",
): docvalues.StringValue{},
docvalues.CreateEnumStringWithDoc(
"verbose",
"Print an informational message for each successful mount.",
): docvalues.StringValue{},
docvalues.CreateEnumStringWithDoc(
"prefix",
"Prefix used before volume name, when following a link.",
): docvalues.StringValue{},
docvalues.CreateEnumStringWithDoc(
"volume",
"Prefix (of length at most 30) used before '/' when following a symbolic link.",
): docvalues.StringValue{},
docvalues.CreateEnumStringWithDoc(
"reserved",
"(Default: 2.) Number of unused blocks at the start of the device.",
): docvalues.NumberValue{Min: &zero},
docvalues.CreateEnumStringWithDoc(
"root",
"Give explicitly the location of the root block.",
): docvalues.NumberValue{Min: &zero},
docvalues.CreateEnumStringWithDoc(
"bs",
"Give blocksize. Allowed values are 512, 1024, 2048, 4096.",
): docvalues.EnumValue{
EnforceValues: true,
Values: []docvalues.EnumString{
docvalues.CreateEnumString("512"),
docvalues.CreateEnumString("1024"),
docvalues.CreateEnumString("2048"),
docvalues.CreateEnumString("4096"),
},
},
docvalues.CreateEnumStringWithDoc(
"grpquota",
"These options are accepted but ignored. (However, quota utilities may react to such strings in /etc/fstab.)",
): docvalues.StringValue{},
docvalues.CreateEnumStringWithDoc(
"noquota",
"These options are accepted but ignored. (However, quota utilities may react to such strings in /etc/fstab.)",
): docvalues.StringValue{},
docvalues.CreateEnumStringWithDoc(
"quota",
"These options are accepted but ignored. (However, quota utilities may react to such strings in /etc/fstab.)",
): docvalues.StringValue{},
docvalues.CreateEnumStringWithDoc(
"usrquota",
"These options are accepted but ignored. (However, quota utilities may react to such strings in /etc/fstab.)",
): docvalues.StringValue{},
}

View File

@ -0,0 +1,18 @@
package commondocumentation
import docvalues "config-lsp/doc-values"
var DebugfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
docvalues.CreateEnumStringWithDoc(
"uid",
"Set the owner of the mountpoint.",
): docvalues.NumberValue{Min: &zero},
docvalues.CreateEnumStringWithDoc(
"gid",
"Set the group of the mountpoint.",
): docvalues.NumberValue{Min: &zero},
docvalues.CreateEnumStringWithDoc(
"mode",
"Sets the mode of the mountpoint.",
): docvalues.StringValue{},
}

3
common.go Normal file
View File

@ -0,0 +1,3 @@
package commondocumentation
var zero = 0

View File

@ -245,25 +245,18 @@ func createMountOptionField(
var DefaultMountOptionsField = createMountOptionField([]docvalues.EnumString{}, map[docvalues.EnumString]docvalues.Value{}) var DefaultMountOptionsField = createMountOptionField([]docvalues.EnumString{}, map[docvalues.EnumString]docvalues.Value{})
var MountOptionsMapField = map[string]docvalues.Value{ var MountOptionsMapField = map[string]docvalues.Value{
// "adfs": createMountOptionField( "adfs": createMountOptionField(
// []docvalues.EnumString{}, []docvalues.EnumString{},
// map[string]commondocumentation.AssignableOption{ commondocumentation.AdfsDocumentationAssignable,
// "uid": { ),
// Documentation: "Set the owner of the files in the filesystem", "affs": createMountOptionField(
// Handler: func(context docvalues.KeyValueAssignmentContext) docvalues.Value { []docvalues.EnumString{},
// min := 0 commondocumentation.AffsDocumentationAssignable,
// return docvalues.NumberValue{Min: &min} ),
// }, "debugfs": createMountOptionField(
// }, []docvalues.EnumString{},
// "gid": { commondocumentation.DebugfsDocumentationAssignable,
// Documentation: "Set the group of the files in the filesystem", ),
// Handler: func(context docvalues.KeyValueAssignmentContext) docvalues.Value {
// min := 0
// return docvalues.NumberValue{Min: &min}
// },
// },
// },
// ),
"ext2": createMountOptionField( "ext2": createMountOptionField(
commondocumentation.Ext2DocumentationEnums, commondocumentation.Ext2DocumentationEnums,
commondocumentation.Ext2DocumentationAssignable, commondocumentation.Ext2DocumentationAssignable,