Changeset 7ef5ea2 in mainline for uspace/srv/bd/hr/metadata/foreign/md/md_p.h
- Timestamp:
- 2025-06-29T23:21:19Z (9 months ago)
- Children:
- 640250b
- Parents:
- b81ae12
- File:
-
- 1 edited
-
uspace/srv/bd/hr/metadata/foreign/md/md_p.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/hr/metadata/foreign/md/md_p.h
rb81ae12 r7ef5ea2 33 33 34 34 #define MD_MAGIC 0xa92b4efc 35 36 #define MD_DISK_SYNC 2 35 37 36 38 /* … … 130 132 }; 131 133 132 /* from mdadm.h */ 134 /* 135 * mdadm - manage Linux "md" devices aka RAID arrays. 136 * 137 * Copyright (C) 2001-2016 Neil Brown <neilb@suse.com> 138 * 139 * 140 * This program is free software; you can redistribute it and/or modify 141 * it under the terms of the GNU General Public License as published by 142 * the Free Software Foundation; either version 2 of the License, or 143 * (at your option) any later version. 144 * 145 * This program is distributed in the hope that it will be useful, 146 * but WITHOUT ANY WARRANTY; without even the implied warranty of 147 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 148 * GNU General Public License for more details. 149 * 150 * You should have received a copy of the GNU General Public License 151 * along with this program; if not, write to the Free Software 152 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 153 * 154 * Author: Neil Brown 155 * Email: <neilb@suse.de> 156 */ 157 158 /* from mdadm - mdadm.h*/ 133 159 #define ALGORITHM_LEFT_ASYMMETRIC 0 134 160 #define ALGORITHM_RIGHT_ASYMMETRIC 1 135 161 #define ALGORITHM_LEFT_SYMMETRIC 2 162 163 /* from mdadm - super1.c */ 164 static inline unsigned int calc_sb_1_csum(struct mdp_superblock_1 * sb) 165 { 166 unsigned int disk_csum, csum; 167 unsigned long long newcsum; 168 int size = sizeof(*sb) + uint32_t_le2host(sb->max_dev)*2; 169 unsigned int *isuper = (unsigned int *)sb; 170 171 /* make sure I can count... */ 172 if (offsetof(struct mdp_superblock_1,data_offset) != 128 || 173 offsetof(struct mdp_superblock_1, utime) != 192 || 174 sizeof(struct mdp_superblock_1) != 256) { 175 fprintf(stderr, "WARNING - superblock isn't sized correctly\n"); 176 } 177 178 disk_csum = sb->sb_csum; 179 sb->sb_csum = 0; 180 newcsum = 0; 181 for (; size >= 4; size -= 4) { 182 newcsum += uint32_t_le2host(*isuper); 183 isuper++; 184 } 185 186 if (size == 2) 187 newcsum += uint32_t_le2host(*(unsigned short*) isuper); 188 189 csum = (newcsum & 0xffffffff) + (newcsum >> 32); 190 sb->sb_csum = disk_csum; 191 return host2uint32_t_le(csum); 192 } 136 193 137 194 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
