1 /* SPDX-License-Identifier: GPL-2.0 */ << 2 #ifndef _ADFS_FS_H 1 #ifndef _ADFS_FS_H 3 #define _ADFS_FS_H 2 #define _ADFS_FS_H 4 3 5 #include <uapi/linux/adfs_fs.h> 4 #include <uapi/linux/adfs_fs.h> 6 5 7 /* 6 /* 8 * Calculate the boot block checksum on an ADF 7 * Calculate the boot block checksum on an ADFS drive. Note that this will 9 * appear to be correct if the sector contains 8 * appear to be correct if the sector contains all zeros, so also check that 10 * the disk size is non-zero!!! 9 * the disk size is non-zero!!! 11 */ 10 */ 12 static inline int adfs_checkbblk(unsigned char 11 static inline int adfs_checkbblk(unsigned char *ptr) 13 { 12 { 14 unsigned int result = 0; 13 unsigned int result = 0; 15 unsigned char *p = ptr + 511; 14 unsigned char *p = ptr + 511; 16 15 17 do { 16 do { 18 result = (result & 0xff) + (re 17 result = (result & 0xff) + (result >> 8); 19 result = result + *--p; 18 result = result + *--p; 20 } while (p != ptr); 19 } while (p != ptr); 21 20 22 return (result & 0xff) != ptr[511]; 21 return (result & 0xff) != ptr[511]; 23 } 22 } 24 #endif 23 #endif 25 24
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.