Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | /* SPDX-License-Identifier: GPL-2.0 */ /* * Superblock definitions * * Minimal version for U-Boot - based on Linux */ #ifndef _LINUX_FS_SUPER_TYPES_H #define _LINUX_FS_SUPER_TYPES_H #include <linux/list.h> #include <linux/rwsem.h> #include <linux/string.h> #include <linux/time.h> #include <linux/types.h> #include <linux/uuid.h> /* Forward declarations */ struct block_device; struct dentry; struct file_system_type; struct super_operations; struct export_operations; struct xattr_handler; struct inode; struct writeback_control; struct kstatfs; struct seq_file; /* sb_writers stub */ struct sb_writers { int frozen; }; /* super_block - filesystem superblock */ struct super_block { void *s_fs_info; unsigned long s_blocksize; unsigned char s_blocksize_bits; unsigned long s_magic; loff_t s_maxbytes; unsigned long s_flags; unsigned long s_iflags; /* Internal flags */ struct rw_semaphore s_umount; struct sb_writers s_writers; struct block_device *s_bdev; char s_id[32]; struct dentry *s_root; uuid_t s_uuid; struct file_system_type *s_type; s32 s_time_gran; /* Time granularity (ns) */ time64_t s_time_min; /* Min supported time */ time64_t s_time_max; /* Max supported time */ const struct super_operations *s_op; const struct export_operations *s_export_op; const struct xattr_handler * const *s_xattr; struct dentry *d_sb; /* Parent dentry - stub */ /* U-Boot: list of all inodes, for freeing on unmount */ struct list_head s_inodes; }; /* super_operations - VFS superblock operations */ struct super_operations { struct inode *(*alloc_inode)(struct super_block *); void (*free_inode)(struct inode *); void (*destroy_inode)(struct inode *); int (*write_inode)(struct inode *, struct writeback_control *); void (*dirty_inode)(struct inode *, int); int (*drop_inode)(struct inode *); void (*evict_inode)(struct inode *); void (*put_super)(struct super_block *); int (*sync_fs)(struct super_block *, int); int (*freeze_fs)(struct super_block *); int (*unfreeze_fs)(struct super_block *); int (*statfs)(struct dentry *, struct kstatfs *); int (*show_options)(struct seq_file *, struct dentry *); void (*shutdown)(struct super_block *); ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); struct dentry *(*get_dquots)(struct inode *); }; /* Superblock flags - also defined in linux/fs.h */ #ifndef SB_RDONLY #define SB_RDONLY (1 << 0) /* Read-only mount */ #endif /* sb_rdonly - check if filesystem is mounted read-only */ static inline bool sb_rdonly(const struct super_block *sb) { return sb->s_flags & SB_RDONLY; } /* * Superblock write operations - U-Boot is single-threaded, no locking needed */ #define sb_start_write(sb) do { (void)(sb); } while (0) #define sb_end_write(sb) do { (void)(sb); } while (0) #define sb_start_write_trylock(sb) ({ (void)(sb); 1; }) /* Superblock internal write operations */ #define sb_start_intwrite(sb) do { (void)(sb); } while (0) #define sb_end_intwrite(sb) do { (void)(sb); } while (0) #define sb_start_intwrite_trylock(sb) ({ (void)(sb); 1; }) /* Superblock pagefault operations */ #define sb_start_pagefault(sb) do { (void)(sb); } while (0) #define sb_end_pagefault(sb) do { (void)(sb); } while (0) /* Superblock internal flags */ #define SB_I_CGROUPWB 0 /* Not supported in U-Boot */ #define SB_I_ALLOW_HSM 0 /* Not supported in U-Boot */ /* Superblock block size operations - sb_set_blocksize in stub.c */ int sb_set_blocksize(struct super_block *sb, int size); static inline int sb_min_blocksize(struct super_block *sb, int size) { return sb_set_blocksize(sb, size); } /* Superblock block device operations */ u64 sb_bdev_nr_blocks(struct super_block *sb); #define sb_is_blkdev_sb(sb) ({ (void)(sb); 0; }) /* Superblock discard/zeroout operations - no-op in U-Boot */ #define sb_issue_zeroout(sb, blk, num, gfp) \ ({ (void)(sb); (void)(blk); (void)(num); (void)(gfp); 0; }) #define sb_issue_discard(sb, sector, nr_sects, gfp, flags) \ ({ (void)(sb); (void)(sector); (void)(nr_sects); (void)(gfp); (void)(flags); 0; }) /* Case-folding - not supported in U-Boot */ #define sb_no_casefold_compat_fallback(sb) ({ (void)(sb); 1; }) /* Superblock identity functions */ static inline void super_set_uuid(struct super_block *sb, const u8 *uuid, unsigned len) { if (len > sizeof(sb->s_uuid.b)) len = sizeof(sb->s_uuid.b); memcpy(sb->s_uuid.b, uuid, len); } #endif /* _LINUX_FS_SUPER_TYPES_H */ |