xref: /OK3568_Linux_fs/kernel/Documentation/filesystems/adfs.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun===============================
4*4882a593SmuzhiyunAcorn Disc Filing System - ADFS
5*4882a593Smuzhiyun===============================
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunFilesystems supported by ADFS
8*4882a593Smuzhiyun-----------------------------
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunThe ADFS module supports the following Filecore formats which have:
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun- new maps
13*4882a593Smuzhiyun- new directories or big directories
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunIn terms of the named formats, this means we support:
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun- E and E+, with or without boot block
18*4882a593Smuzhiyun- F and F+
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunWe fully support reading files from these filesystems, and writing to
21*4882a593Smuzhiyunexisting files within their existing allocation.  Essentially, we do
22*4882a593Smuzhiyunnot support changing any of the filesystem metadata.
23*4882a593Smuzhiyun
24*4882a593SmuzhiyunThis is intended to support loopback mounted Linux native filesystems
25*4882a593Smuzhiyunon a RISC OS Filecore filesystem, but will allow the data within files
26*4882a593Smuzhiyunto be changed.
27*4882a593Smuzhiyun
28*4882a593SmuzhiyunIf write support (ADFS_FS_RW) is configured, we allow rudimentary
29*4882a593Smuzhiyundirectory updates, specifically updating the access mode and timestamp.
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunMount options for ADFS
32*4882a593Smuzhiyun----------------------
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun  ============  ======================================================
35*4882a593Smuzhiyun  uid=nnn	All files in the partition will be owned by
36*4882a593Smuzhiyun		user id nnn.  Default 0 (root).
37*4882a593Smuzhiyun  gid=nnn	All files in the partition will be in group
38*4882a593Smuzhiyun		nnn.  Default 0 (root).
39*4882a593Smuzhiyun  ownmask=nnn	The permission mask for ADFS 'owner' permissions
40*4882a593Smuzhiyun		will be nnn.  Default 0700.
41*4882a593Smuzhiyun  othmask=nnn	The permission mask for ADFS 'other' permissions
42*4882a593Smuzhiyun		will be nnn.  Default 0077.
43*4882a593Smuzhiyun  ftsuffix=n	When ftsuffix=0, no file type suffix will be applied.
44*4882a593Smuzhiyun		When ftsuffix=1, a hexadecimal suffix corresponding to
45*4882a593Smuzhiyun		the RISC OS file type will be added.  Default 0.
46*4882a593Smuzhiyun  ============  ======================================================
47*4882a593Smuzhiyun
48*4882a593SmuzhiyunMapping of ADFS permissions to Linux permissions
49*4882a593Smuzhiyun------------------------------------------------
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun  ADFS permissions consist of the following:
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun	- Owner read
54*4882a593Smuzhiyun	- Owner write
55*4882a593Smuzhiyun	- Other read
56*4882a593Smuzhiyun	- Other write
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun  (In older versions, an 'execute' permission did exist, but this
59*4882a593Smuzhiyun  does not hold the same meaning as the Linux 'execute' permission
60*4882a593Smuzhiyun  and is now obsolete).
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun  The mapping is performed as follows::
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun	Owner read				-> -r--r--r--
65*4882a593Smuzhiyun	Owner write				-> --w--w---w
66*4882a593Smuzhiyun	Owner read and filetype UnixExec	-> ---x--x--x
67*4882a593Smuzhiyun    These are then masked by ownmask, eg 700	-> -rwx------
68*4882a593Smuzhiyun	Possible owner mode permissions		-> -rwx------
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun	Other read				-> -r--r--r--
71*4882a593Smuzhiyun	Other write				-> --w--w--w-
72*4882a593Smuzhiyun	Other read and filetype UnixExec	-> ---x--x--x
73*4882a593Smuzhiyun    These are then masked by othmask, eg 077	-> ----rwxrwx
74*4882a593Smuzhiyun	Possible other mode permissions		-> ----rwxrwx
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun  Hence, with the default masks, if a file is owner read/write, and
77*4882a593Smuzhiyun  not a UnixExec filetype, then the permissions will be::
78*4882a593Smuzhiyun
79*4882a593Smuzhiyun			-rw-------
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun  However, if the masks were ownmask=0770,othmask=0007, then this would
82*4882a593Smuzhiyun  be modified to::
83*4882a593Smuzhiyun
84*4882a593Smuzhiyun			-rw-rw----
85*4882a593Smuzhiyun
86*4882a593Smuzhiyun  There is no restriction on what you can do with these masks.  You may
87*4882a593Smuzhiyun  wish that either read bits give read access to the file for all, but
88*4882a593Smuzhiyun  keep the default write protection (ownmask=0755,othmask=0577)::
89*4882a593Smuzhiyun
90*4882a593Smuzhiyun			-rw-r--r--
91*4882a593Smuzhiyun
92*4882a593Smuzhiyun  You can therefore tailor the permission translation to whatever you
93*4882a593Smuzhiyun  desire the permissions should be under Linux.
94*4882a593Smuzhiyun
95*4882a593SmuzhiyunRISC OS file type suffix
96*4882a593Smuzhiyun------------------------
97*4882a593Smuzhiyun
98*4882a593Smuzhiyun  RISC OS file types are stored in bits 19..8 of the file load address.
99*4882a593Smuzhiyun
100*4882a593Smuzhiyun  To enable non-RISC OS systems to be used to store files without losing
101*4882a593Smuzhiyun  file type information, a file naming convention was devised (initially
102*4882a593Smuzhiyun  for use with NFS) such that a hexadecimal suffix of the form ,xyz
103*4882a593Smuzhiyun  denoted the file type: e.g. BasicFile,ffb is a BASIC (0xffb) file.  This
104*4882a593Smuzhiyun  naming convention is now also used by RISC OS emulators such as RPCEmu.
105*4882a593Smuzhiyun
106*4882a593Smuzhiyun  Mounting an ADFS disc with option ftsuffix=1 will cause appropriate file
107*4882a593Smuzhiyun  type suffixes to be appended to file names read from a directory.  If the
108*4882a593Smuzhiyun  ftsuffix option is zero or omitted, no file type suffixes will be added.
109