Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ADFS_FS_H
0003 #define _ADFS_FS_H
0004 
0005 #include <uapi/linux/adfs_fs.h>
0006 
0007 /*
0008  * Calculate the boot block checksum on an ADFS drive.  Note that this will
0009  * appear to be correct if the sector contains all zeros, so also check that
0010  * the disk size is non-zero!!!
0011  */
0012 static inline int adfs_checkbblk(unsigned char *ptr)
0013 {
0014     unsigned int result = 0;
0015     unsigned char *p = ptr + 511;
0016 
0017     do {
0018             result = (result & 0xff) + (result >> 8);
0019             result = result + *--p;
0020     } while (p != ptr);
0021 
0022     return (result & 0xff) != ptr[511];
0023 }
0024 #endif