134873900SMauro Carvalho Chehab.. SPDX-License-Identifier: GPL-2.0
234873900SMauro Carvalho Chehab
334873900SMauro Carvalho Chehab===============================
434873900SMauro Carvalho ChehabAcorn Disc Filing System - ADFS
534873900SMauro Carvalho Chehab===============================
634873900SMauro Carvalho Chehab
734873900SMauro Carvalho ChehabFilesystems supported by ADFS
834873900SMauro Carvalho Chehab-----------------------------
934873900SMauro Carvalho Chehab
1034873900SMauro Carvalho ChehabThe ADFS module supports the following Filecore formats which have:
1134873900SMauro Carvalho Chehab
1234873900SMauro Carvalho Chehab- new maps
1334873900SMauro Carvalho Chehab- new directories or big directories
1434873900SMauro Carvalho Chehab
1534873900SMauro Carvalho ChehabIn terms of the named formats, this means we support:
1634873900SMauro Carvalho Chehab
1734873900SMauro Carvalho Chehab- E and E+, with or without boot block
1834873900SMauro Carvalho Chehab- F and F+
1934873900SMauro Carvalho Chehab
2034873900SMauro Carvalho ChehabWe fully support reading files from these filesystems, and writing to
2134873900SMauro Carvalho Chehabexisting files within their existing allocation.  Essentially, we do
2234873900SMauro Carvalho Chehabnot support changing any of the filesystem metadata.
2334873900SMauro Carvalho Chehab
2434873900SMauro Carvalho ChehabThis is intended to support loopback mounted Linux native filesystems
2534873900SMauro Carvalho Chehabon a RISC OS Filecore filesystem, but will allow the data within files
2634873900SMauro Carvalho Chehabto be changed.
2734873900SMauro Carvalho Chehab
2834873900SMauro Carvalho ChehabIf write support (ADFS_FS_RW) is configured, we allow rudimentary
2934873900SMauro Carvalho Chehabdirectory updates, specifically updating the access mode and timestamp.
3034873900SMauro Carvalho Chehab
3134873900SMauro Carvalho ChehabMount options for ADFS
3234873900SMauro Carvalho Chehab----------------------
3334873900SMauro Carvalho Chehab
3434873900SMauro Carvalho Chehab  ============  ======================================================
3534873900SMauro Carvalho Chehab  uid=nnn	All files in the partition will be owned by
3634873900SMauro Carvalho Chehab		user id nnn.  Default 0 (root).
3734873900SMauro Carvalho Chehab  gid=nnn	All files in the partition will be in group
3834873900SMauro Carvalho Chehab		nnn.  Default 0 (root).
3934873900SMauro Carvalho Chehab  ownmask=nnn	The permission mask for ADFS 'owner' permissions
4034873900SMauro Carvalho Chehab		will be nnn.  Default 0700.
4134873900SMauro Carvalho Chehab  othmask=nnn	The permission mask for ADFS 'other' permissions
4234873900SMauro Carvalho Chehab		will be nnn.  Default 0077.
4334873900SMauro Carvalho Chehab  ftsuffix=n	When ftsuffix=0, no file type suffix will be applied.
4434873900SMauro Carvalho Chehab		When ftsuffix=1, a hexadecimal suffix corresponding to
4534873900SMauro Carvalho Chehab		the RISC OS file type will be added.  Default 0.
4634873900SMauro Carvalho Chehab  ============  ======================================================
4734873900SMauro Carvalho Chehab
4834873900SMauro Carvalho ChehabMapping of ADFS permissions to Linux permissions
4934873900SMauro Carvalho Chehab------------------------------------------------
5034873900SMauro Carvalho Chehab
5134873900SMauro Carvalho Chehab  ADFS permissions consist of the following:
5234873900SMauro Carvalho Chehab
5334873900SMauro Carvalho Chehab	- Owner read
5434873900SMauro Carvalho Chehab	- Owner write
5534873900SMauro Carvalho Chehab	- Other read
5634873900SMauro Carvalho Chehab	- Other write
5734873900SMauro Carvalho Chehab
5834873900SMauro Carvalho Chehab  (In older versions, an 'execute' permission did exist, but this
5934873900SMauro Carvalho Chehab  does not hold the same meaning as the Linux 'execute' permission
6034873900SMauro Carvalho Chehab  and is now obsolete).
6134873900SMauro Carvalho Chehab
6234873900SMauro Carvalho Chehab  The mapping is performed as follows::
6334873900SMauro Carvalho Chehab
6434873900SMauro Carvalho Chehab	Owner read				-> -r--r--r--
6534873900SMauro Carvalho Chehab	Owner write				-> --w--w---w
6634873900SMauro Carvalho Chehab	Owner read and filetype UnixExec	-> ---x--x--x
6734873900SMauro Carvalho Chehab    These are then masked by ownmask, eg 700	-> -rwx------
6834873900SMauro Carvalho Chehab	Possible owner mode permissions		-> -rwx------
6934873900SMauro Carvalho Chehab
7034873900SMauro Carvalho Chehab	Other read				-> -r--r--r--
7134873900SMauro Carvalho Chehab	Other write				-> --w--w--w-
7234873900SMauro Carvalho Chehab	Other read and filetype UnixExec	-> ---x--x--x
7334873900SMauro Carvalho Chehab    These are then masked by othmask, eg 077	-> ----rwxrwx
7434873900SMauro Carvalho Chehab	Possible other mode permissions		-> ----rwxrwx
7534873900SMauro Carvalho Chehab
7634873900SMauro Carvalho Chehab  Hence, with the default masks, if a file is owner read/write, and
7734873900SMauro Carvalho Chehab  not a UnixExec filetype, then the permissions will be::
7834873900SMauro Carvalho Chehab
7934873900SMauro Carvalho Chehab			-rw-------
8034873900SMauro Carvalho Chehab
8134873900SMauro Carvalho Chehab  However, if the masks were ownmask=0770,othmask=0007, then this would
8234873900SMauro Carvalho Chehab  be modified to::
8334873900SMauro Carvalho Chehab
8434873900SMauro Carvalho Chehab			-rw-rw----
8534873900SMauro Carvalho Chehab
8634873900SMauro Carvalho Chehab  There is no restriction on what you can do with these masks.  You may
8734873900SMauro Carvalho Chehab  wish that either read bits give read access to the file for all, but
8834873900SMauro Carvalho Chehab  keep the default write protection (ownmask=0755,othmask=0577)::
8934873900SMauro Carvalho Chehab
9034873900SMauro Carvalho Chehab			-rw-r--r--
9134873900SMauro Carvalho Chehab
9234873900SMauro Carvalho Chehab  You can therefore tailor the permission translation to whatever you
9334873900SMauro Carvalho Chehab  desire the permissions should be under Linux.
9434873900SMauro Carvalho Chehab
9534873900SMauro Carvalho ChehabRISC OS file type suffix
9634873900SMauro Carvalho Chehab------------------------
9734873900SMauro Carvalho Chehab
9834873900SMauro Carvalho Chehab  RISC OS file types are stored in bits 19..8 of the file load address.
9934873900SMauro Carvalho Chehab
10034873900SMauro Carvalho Chehab  To enable non-RISC OS systems to be used to store files without losing
10134873900SMauro Carvalho Chehab  file type information, a file naming convention was devised (initially
10234873900SMauro Carvalho Chehab  for use with NFS) such that a hexadecimal suffix of the form ,xyz
10334873900SMauro Carvalho Chehab  denoted the file type: e.g. BasicFile,ffb is a BASIC (0xffb) file.  This
10434873900SMauro Carvalho Chehab  naming convention is now also used by RISC OS emulators such as RPCEmu.
10534873900SMauro Carvalho Chehab
10634873900SMauro Carvalho Chehab  Mounting an ADFS disc with option ftsuffix=1 will cause appropriate file
10734873900SMauro Carvalho Chehab  type suffixes to be appended to file names read from a directory.  If the
10834873900SMauro Carvalho Chehab  ftsuffix option is zero or omitted, no file type suffixes will be added.
109