aboutsummaryrefslogtreecommitdiffstats
path: root/fs/adfs/inode.c
diff options
context:
space:
mode:
authorStuart Swales <stuart.swales.croftnuisk@gmail.com>2011-03-22 19:35:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-22 20:44:17 -0400
commitda23ef0549d4205ca9b576cf6cce9a80d0c3e43a (patch)
tree476939ca9c146ebc20ac627098690b1e2026827a /fs/adfs/inode.c
parent7a9730af9c596749425a98eba136152e5be4602a (diff)
adfs: add hexadecimal filetype suffix option
ADFS (FileCore) storage complies with the RISC OS filetype specification (12 bits of file type information is stored in the file load address, rather than using a file extension). The existing driver largely ignores this information and does not present it to the end user. It is desirable that stored filetypes be made visible to the end user to facilitate a precise copy of data and metadata from a hard disc (or image thereof) into a RISC OS emulator (such as RPCEmu) or to a network share which can be accessed by real Acorn systems. This patch implements a per-mount filetype suffix option (use -o ftsuffix=1) to present any filetype as a ,xyz hexadecimal suffix on each file. This type suffix is compatible with that used by RISC OS systems that access network servers using NFS client software and by RPCemu's host filing system. Signed-off-by: Stuart Swales <stuart.swales.croftnuisk@gmail.com> Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/adfs/inode.c')
-rw-r--r--fs/adfs/inode.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/fs/adfs/inode.c b/fs/adfs/inode.c
index 16d7ef2dffe1..92444e94f842 100644
--- a/fs/adfs/inode.c
+++ b/fs/adfs/inode.c
@@ -78,26 +78,13 @@ static const struct address_space_operations adfs_aops = {
78 .bmap = _adfs_bmap 78 .bmap = _adfs_bmap
79}; 79};
80 80
81static inline unsigned int
82adfs_filetype(struct inode *inode)
83{
84 unsigned int type;
85
86 if (ADFS_I(inode)->stamped)
87 type = (ADFS_I(inode)->loadaddr >> 8) & 0xfff;
88 else
89 type = (unsigned int) -1;
90
91 return type;
92}
93
94/* 81/*
95 * Convert ADFS attributes and filetype to Linux permission. 82 * Convert ADFS attributes and filetype to Linux permission.
96 */ 83 */
97static umode_t 84static umode_t
98adfs_atts2mode(struct super_block *sb, struct inode *inode) 85adfs_atts2mode(struct super_block *sb, struct inode *inode)
99{ 86{
100 unsigned int filetype, attr = ADFS_I(inode)->attr; 87 unsigned int attr = ADFS_I(inode)->attr;
101 umode_t mode, rmask; 88 umode_t mode, rmask;
102 struct adfs_sb_info *asb = ADFS_SB(sb); 89 struct adfs_sb_info *asb = ADFS_SB(sb);
103 90
@@ -106,9 +93,7 @@ adfs_atts2mode(struct super_block *sb, struct inode *inode)
106 return S_IFDIR | S_IXUGO | mode; 93 return S_IFDIR | S_IXUGO | mode;
107 } 94 }
108 95
109 filetype = adfs_filetype(inode); 96 switch (ADFS_I(inode)->filetype) {
110
111 switch (filetype) {
112 case 0xfc0: /* LinkFS */ 97 case 0xfc0: /* LinkFS */
113 return S_IFLNK|S_IRWXUGO; 98 return S_IFLNK|S_IRWXUGO;
114 99
@@ -277,7 +262,8 @@ adfs_iget(struct super_block *sb, struct object_info *obj)
277 ADFS_I(inode)->loadaddr = obj->loadaddr; 262 ADFS_I(inode)->loadaddr = obj->loadaddr;
278 ADFS_I(inode)->execaddr = obj->execaddr; 263 ADFS_I(inode)->execaddr = obj->execaddr;
279 ADFS_I(inode)->attr = obj->attr; 264 ADFS_I(inode)->attr = obj->attr;
280 ADFS_I(inode)->stamped = ((obj->loadaddr & 0xfff00000) == 0xfff00000); 265 ADFS_I(inode)->filetype = obj->filetype;
266 ADFS_I(inode)->stamped = ((obj->loadaddr & 0xfff00000) == 0xfff00000);
281 267
282 inode->i_mode = adfs_atts2mode(sb, inode); 268 inode->i_mode = adfs_atts2mode(sb, inode);
283 adfs_adfs2unix_time(&inode->i_mtime, inode); 269 adfs_adfs2unix_time(&inode->i_mtime, inode);