// SPDX-License-Identifier: GPL-2.0-only /* * linux/fs/adfs/inode.c * * Copyright (C) 1997-1999 Russell King */ #include <linux/buffer_head.h> #include <linux/mpage.h> #include <linux/writeback.h> #include "adfs.h" /* * Lookup/Create a block at offset 'block' into 'inode'. We currently do * not support creation of new blocks, so we return -EIO for this case. */ static int adfs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh, int create) { … } static int adfs_writepages(struct address_space *mapping, struct writeback_control *wbc) { … } static int adfs_read_folio(struct file *file, struct folio *folio) { … } static void adfs_write_failed(struct address_space *mapping, loff_t to) { … } static int adfs_write_begin(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, struct page **pagep, void **fsdata) { … } static sector_t _adfs_bmap(struct address_space *mapping, sector_t block) { … } static const struct address_space_operations adfs_aops = …; /* * Convert ADFS attributes and filetype to Linux permission. */ static umode_t adfs_atts2mode(struct super_block *sb, struct inode *inode) { … } /* * Convert Linux permission to ADFS attribute. We try to do the reverse * of atts2mode, but there is not a 1:1 translation. */ static int adfs_mode2atts(struct super_block *sb, struct inode *inode, umode_t ia_mode) { … } static const s64 nsec_unix_epoch_diff_risc_os_epoch = …; /* * Convert an ADFS time to Unix time. ADFS has a 40-bit centi-second time * referenced to 1 Jan 1900 (til 2248) so we need to discard 2208988800 seconds * of time to convert from RISC OS epoch to Unix epoch. */ static void adfs_adfs2unix_time(struct timespec64 *tv, struct inode *inode) { … } /* Convert an Unix time to ADFS time for an entry that is already stamped. */ static void adfs_unix2adfs_time(struct inode *inode, const struct timespec64 *ts) { … } /* * Fill in the inode information from the object information. * * Note that this is an inode-less filesystem, so we can't use the inode * number to reference the metadata on the media. Instead, we use the * inode number to hold the object ID, which in turn will tell us where * the data is held. We also save the parent object ID, and with these * two, we can locate the metadata. * * This does mean that we rely on an objects parent remaining the same at * all times - we cannot cope with a cross-directory rename (yet). */ struct inode * adfs_iget(struct super_block *sb, struct object_info *obj) { … } /* * Validate and convert a changed access mode/time to their ADFS equivalents. * adfs_write_inode will actually write the information back to the directory * later. */ int adfs_notify_change(struct mnt_idmap *idmap, struct dentry *dentry, struct iattr *attr) { … } /* * write an existing inode back to the directory, and therefore the disk. * The adfs-specific inode data has already been updated by * adfs_notify_change() */ int adfs_write_inode(struct inode *inode, struct writeback_control *wbc) { … }