Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * attrib.h - Defines for attribute handling in NTFS Linux kernel driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *	      Part of the Linux-NTFS project.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Copyright (c) 2001-2005 Anton Altaparmakov
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * Copyright (c) 2002 Richard Russon
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #ifndef _LINUX_NTFS_ATTRIB_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #define _LINUX_NTFS_ATTRIB_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include "endian.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include "types.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include "layout.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include "inode.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include "runlist.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include "volume.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * ntfs_attr_search_ctx - used in attribute search functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * @mrec:	buffer containing mft record to search
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * @attr:	attribute record in @mrec where to begin/continue search
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * @is_first:	if true ntfs_attr_lookup() begins search with @attr, else after
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * Structure must be initialized to zero before the first call to one of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * attribute search functions. Initialize @mrec to point to the mft record to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * search, and @attr to point to the first attribute within @mrec (not necessary
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * if calling the _first() functions), and set @is_first to 'true' (not necessary
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  * if calling the _first() functions).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  * If @is_first is 'true', the search begins with @attr. If @is_first is 'false',
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  * the search begins after @attr. This is so that, after the first call to one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  * of the search attribute functions, we can call the function again, without
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  * any modification of the search context, to automagically get the next
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  * matching attribute.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) typedef struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	MFT_RECORD *mrec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	ATTR_RECORD *attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	bool is_first;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	ntfs_inode *ntfs_ino;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	ATTR_LIST_ENTRY *al_entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	ntfs_inode *base_ntfs_ino;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	MFT_RECORD *base_mrec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	ATTR_RECORD *base_attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) } ntfs_attr_search_ctx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) extern int ntfs_map_runlist_nolock(ntfs_inode *ni, VCN vcn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 		ntfs_attr_search_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) extern int ntfs_map_runlist(ntfs_inode *ni, VCN vcn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) extern LCN ntfs_attr_vcn_to_lcn_nolock(ntfs_inode *ni, const VCN vcn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 		const bool write_locked);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) extern runlist_element *ntfs_attr_find_vcn_nolock(ntfs_inode *ni,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 		const VCN vcn, ntfs_attr_search_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) int ntfs_attr_lookup(const ATTR_TYPE type, const ntfschar *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 		const u32 name_len, const IGNORE_CASE_BOOL ic,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 		const VCN lowest_vcn, const u8 *val, const u32 val_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 		ntfs_attr_search_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) extern int load_attribute_list(ntfs_volume *vol, runlist *rl, u8 *al_start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 		const s64 size, const s64 initialized_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) static inline s64 ntfs_attr_size(const ATTR_RECORD *a)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	if (!a->non_resident)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		return (s64)le32_to_cpu(a->data.resident.value_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	return sle64_to_cpu(a->data.non_resident.data_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) extern void ntfs_attr_reinit_search_ctx(ntfs_attr_search_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) extern ntfs_attr_search_ctx *ntfs_attr_get_search_ctx(ntfs_inode *ni,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		MFT_RECORD *mrec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) extern void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) #ifdef NTFS_RW
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) extern int ntfs_attr_size_bounds_check(const ntfs_volume *vol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 		const ATTR_TYPE type, const s64 size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) extern int ntfs_attr_can_be_non_resident(const ntfs_volume *vol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 		const ATTR_TYPE type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) extern int ntfs_attr_can_be_resident(const ntfs_volume *vol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 		const ATTR_TYPE type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) extern int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 		const u32 new_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) extern int ntfs_attr_make_non_resident(ntfs_inode *ni, const u32 data_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) extern s64 ntfs_attr_extend_allocation(ntfs_inode *ni, s64 new_alloc_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		const s64 new_data_size, const s64 data_start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) extern int ntfs_attr_set(ntfs_inode *ni, const s64 ofs, const s64 cnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		const u8 val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #endif /* NTFS_RW */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #endif /* _LINUX_NTFS_ATTRIB_H */