Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / include / linux / adfs_fs.h
blob4836e382ad52f40cefb4c343420fcccd8085816f
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ADFS_FS_H
3 #define _ADFS_FS_H
5 #include <uapi/linux/adfs_fs.h>
7 /*
8 * Calculate the boot block checksum on an ADFS drive. Note that this will
9 * appear to be correct if the sector contains all zeros, so also check that
10 * the disk size is non-zero!!!
12 static inline int adfs_checkbblk(unsigned char *ptr)
14 unsigned int result = 0;
15 unsigned char *p = ptr + 511;
17 do {
18 result = (result & 0xff) + (result >> 8);
19 result = result + *--p;
20 } while (p != ptr);
22 return (result & 0xff) != ptr[511];
24 #endif