Changeset aa9bad8 in mainline for uspace/srv/bd/hr/metadata/foreign
- Timestamp:
- 2025-06-27T22:21:05Z (4 months ago)
- Children:
- 2de7c1f
- Parents:
- 78433bb
- git-author:
- Miroslav Cimerman <mc@…> (2025-06-27 22:14:37)
- git-committer:
- Miroslav Cimerman <mc@…> (2025-06-27 22:21:05)
- Location:
- uspace/srv/bd/hr/metadata/foreign
- Files:
- 
      - 3 edited
 
 - 
          
  geom/hr_g_mirror.c (modified) (8 diffs)
- 
          
  geom/hr_g_stripe.c (modified) (8 diffs)
- 
          
  softraid/hr_softraid.c (modified) (8 diffs)
 
Legend:
- Unmodified
- Added
- Removed
- 
      uspace/srv/bd/hr/metadata/foreign/geom/hr_g_mirror.cr78433bb raa9bad8 54 54 #include "g_mirror.h" 55 55 56 /* not exposed */ 56 57 static void *meta_gmirror_alloc_struct(void); 58 /* static void meta_gmirror_encode(void *, void *); */ 59 static errno_t meta_gmirror_decode(const void *, void *); 60 static errno_t meta_gmirror_get_block(service_id_t, void **); 61 /* static errno_t meta_gmirror_write_block(service_id_t, const void *); */ 62 static bool meta_gmirror_has_valid_magic(const void *); 63 64 static errno_t meta_gmirror_probe(service_id_t, void **); 57 65 static errno_t meta_gmirror_init_vol2meta(hr_volume_t *); 58 66 static errno_t meta_gmirror_init_meta2vol(const list_t *, hr_volume_t *); 59 static void meta_gmirror_encode(void *, void *);60 static errno_t meta_gmirror_decode(const void *, void *);61 static errno_t meta_gmirror_get_block(service_id_t, void **);62 static errno_t meta_gmirror_write_block(service_id_t, const void *);63 static bool meta_gmirror_has_valid_magic(const void *);64 67 static bool meta_gmirror_compare_uuids(const void *, const void *); 65 68 static void meta_gmirror_inc_counter(hr_volume_t *); … … 75 78 76 79 hr_superblock_ops_t metadata_gmirror_ops = { 77 . alloc_struct = meta_gmirror_alloc_struct,80 .probe = meta_gmirror_probe, 78 81 .init_vol2meta = meta_gmirror_init_vol2meta, 79 82 .init_meta2vol = meta_gmirror_init_meta2vol, 80 .encode = meta_gmirror_encode,81 .decode = meta_gmirror_decode,82 .get_block = meta_gmirror_get_block,83 .write_block = meta_gmirror_write_block,84 .has_valid_magic = meta_gmirror_has_valid_magic,85 83 .compare_uuids = meta_gmirror_compare_uuids, 86 84 .inc_counter = meta_gmirror_inc_counter, … … 96 94 }; 97 95 98 static void *meta_gmirror_alloc_struct(void) 99 { 100 return calloc(1, sizeof(struct g_mirror_metadata)); 96 static errno_t meta_gmirror_probe(service_id_t svc_id, void **rmd) 97 { 98 errno_t rc; 99 void *meta_block; 100 101 void *metadata_struct = meta_gmirror_alloc_struct(); 102 if (metadata_struct == NULL) 103 return ENOMEM; 104 105 rc = meta_gmirror_get_block(svc_id, &meta_block); 106 if (rc != EOK) 107 goto error; 108 109 rc = meta_gmirror_decode(meta_block, metadata_struct); 110 111 free(meta_block); 112 113 if (rc != EOK) 114 goto error; 115 116 if (!meta_gmirror_has_valid_magic(metadata_struct)) { 117 rc = ENOFS; 118 goto error; 119 } 120 121 *rmd = metadata_struct; 122 return EOK; 123 124 error: 125 free(metadata_struct); 126 return ENOFS; 101 127 } 102 128 … … 177 203 } 178 204 205 static bool meta_gmirror_compare_uuids(const void *m1_v, const void *m2_v) 206 { 207 const struct g_mirror_metadata *m1 = m1_v; 208 const struct g_mirror_metadata *m2 = m2_v; 209 if (m1->md_mid == m2->md_mid) 210 return true; 211 212 return false; 213 } 214 215 static void meta_gmirror_inc_counter(hr_volume_t *vol) 216 { 217 fibril_mutex_lock(&vol->md_lock); 218 219 struct g_mirror_metadata *md = vol->in_mem_md; 220 221 /* XXX: probably md_genid and not md_syncid is incremented */ 222 md->md_genid++; 223 224 fibril_mutex_unlock(&vol->md_lock); 225 } 226 227 static errno_t meta_gmirror_save(hr_volume_t *vol, bool with_state_callback) 228 { 229 HR_DEBUG("%s()", __func__); 230 231 (void)vol; 232 (void)with_state_callback; 233 234 /* 235 * cannot support right now, because would need to store the 236 * metadata for all disks, because of hardcoded provider names and 237 * more importantly, disk unique ids 238 */ 239 240 return ENOTSUP; 241 } 242 243 static errno_t meta_gmirror_save_ext(hr_volume_t *vol, size_t ext_idx, 244 bool with_state_callback) 245 { 246 HR_DEBUG("%s()", __func__); 247 248 return ENOTSUP; 249 } 250 251 static const char *meta_gmirror_get_devname(const void *md_v) 252 { 253 const struct g_mirror_metadata *md = md_v; 254 255 return md->md_name; 256 } 257 258 static hr_level_t meta_gmirror_get_level(const void *md_v) 259 { 260 (void)md_v; 261 262 return HR_LVL_1; 263 } 264 265 static uint64_t meta_gmirror_get_data_offset(void) 266 { 267 return 0; 268 } 269 270 static size_t meta_gmirror_get_size(void) 271 { 272 return 1; 273 } 274 275 static uint8_t meta_gmirror_get_flags(void) 276 { 277 uint8_t flags = 0; 278 279 return flags; 280 } 281 282 static hr_metadata_type_t meta_gmirror_get_type(void) 283 { 284 return HR_METADATA_GEOM_MIRROR; 285 } 286 287 static void meta_gmirror_dump(const void *md_v) 288 { 289 HR_DEBUG("%s()", __func__); 290 291 mirror_metadata_dump(md_v); 292 } 293 294 static void *meta_gmirror_alloc_struct(void) 295 { 296 return calloc(1, sizeof(struct g_mirror_metadata)); 297 } 298 299 #if 0 179 300 static void meta_gmirror_encode(void *md_v, void *block) 180 301 { … … 183 304 mirror_metadata_encode(md_v, block); 184 305 } 306 #endif 185 307 186 308 static errno_t meta_gmirror_decode(const void *block, void *md_v) … … 237 359 } 238 360 361 #if 0 239 362 static errno_t meta_gmirror_write_block(service_id_t dev, const void *block) 240 363 { … … 263 386 return rc; 264 387 } 388 #endif 265 389 266 390 static bool meta_gmirror_has_valid_magic(const void *md_v) … … 276 400 } 277 401 278 static bool meta_gmirror_compare_uuids(const void *m1_v, const void *m2_v)279 {280 const struct g_mirror_metadata *m1 = m1_v;281 const struct g_mirror_metadata *m2 = m2_v;282 if (m1->md_mid == m2->md_mid)283 return true;284 285 return false;286 }287 288 static void meta_gmirror_inc_counter(hr_volume_t *vol)289 {290 fibril_mutex_lock(&vol->md_lock);291 292 struct g_mirror_metadata *md = vol->in_mem_md;293 294 /* XXX: probably md_genid and not md_syncid is incremented */295 md->md_genid++;296 297 fibril_mutex_unlock(&vol->md_lock);298 }299 300 static errno_t meta_gmirror_save(hr_volume_t *vol, bool with_state_callback)301 {302 HR_DEBUG("%s()", __func__);303 304 (void)vol;305 (void)with_state_callback;306 307 /*308 * cannot support right now, because would need to store the309 * metadata for all disks, because of hardcoded provider names and310 * more importantly, disk unique ids311 */312 313 return ENOTSUP;314 }315 316 static errno_t meta_gmirror_save_ext(hr_volume_t *vol, size_t ext_idx,317 bool with_state_callback)318 {319 HR_DEBUG("%s()", __func__);320 321 return ENOTSUP;322 }323 324 static const char *meta_gmirror_get_devname(const void *md_v)325 {326 const struct g_mirror_metadata *md = md_v;327 328 return md->md_name;329 }330 331 static hr_level_t meta_gmirror_get_level(const void *md_v)332 {333 (void)md_v;334 335 return HR_LVL_1;336 }337 338 static uint64_t meta_gmirror_get_data_offset(void)339 {340 return 0;341 }342 343 static size_t meta_gmirror_get_size(void)344 {345 return 1;346 }347 348 static uint8_t meta_gmirror_get_flags(void)349 {350 uint8_t flags = 0;351 352 return flags;353 }354 355 static hr_metadata_type_t meta_gmirror_get_type(void)356 {357 return HR_METADATA_GEOM_MIRROR;358 }359 360 static void meta_gmirror_dump(const void *md_v)361 {362 HR_DEBUG("%s()", __func__);363 364 mirror_metadata_dump(md_v);365 }366 367 402 /** @} 368 403 */ 
- 
      uspace/srv/bd/hr/metadata/foreign/geom/hr_g_stripe.cr78433bb raa9bad8 54 54 #include "g_stripe.h" 55 55 56 /* not exposed */ 56 57 static void *meta_gstripe_alloc_struct(void); 58 /* static void meta_gstripe_encode(void *, void *); */ 59 static errno_t meta_gstripe_decode(const void *, void *); 60 static errno_t meta_gstripe_get_block(service_id_t, void **); 61 /* static errno_t meta_gstripe_write_block(service_id_t, const void *); */ 62 static bool meta_gstripe_has_valid_magic(const void *); 63 64 static errno_t meta_gstripe_probe(service_id_t, void **); 57 65 static errno_t meta_gstripe_init_vol2meta(hr_volume_t *); 58 66 static errno_t meta_gstripe_init_meta2vol(const list_t *, hr_volume_t *); 59 static void meta_gstripe_encode(void *, void *);60 static errno_t meta_gstripe_decode(const void *, void *);61 static errno_t meta_gstripe_get_block(service_id_t, void **);62 static errno_t meta_gstripe_write_block(service_id_t, const void *);63 static bool meta_gstripe_has_valid_magic(const void *);64 67 static bool meta_gstripe_compare_uuids(const void *, const void *); 65 68 static void meta_gstripe_inc_counter(hr_volume_t *); … … 75 78 76 79 hr_superblock_ops_t metadata_gstripe_ops = { 77 . alloc_struct = meta_gstripe_alloc_struct,80 .probe = meta_gstripe_probe, 78 81 .init_vol2meta = meta_gstripe_init_vol2meta, 79 82 .init_meta2vol = meta_gstripe_init_meta2vol, 80 .encode = meta_gstripe_encode,81 .decode = meta_gstripe_decode,82 .get_block = meta_gstripe_get_block,83 .write_block = meta_gstripe_write_block,84 .has_valid_magic = meta_gstripe_has_valid_magic,85 83 .compare_uuids = meta_gstripe_compare_uuids, 86 84 .inc_counter = meta_gstripe_inc_counter, … … 96 94 }; 97 95 98 static void *meta_gstripe_alloc_struct(void) 99 { 100 return calloc(1, sizeof(struct g_stripe_metadata)); 96 static errno_t meta_gstripe_probe(service_id_t svc_id, void **rmd) 97 { 98 errno_t rc; 99 void *meta_block; 100 101 void *metadata_struct = meta_gstripe_alloc_struct(); 102 if (metadata_struct == NULL) 103 return ENOMEM; 104 105 rc = meta_gstripe_get_block(svc_id, &meta_block); 106 if (rc != EOK) 107 goto error; 108 109 rc = meta_gstripe_decode(meta_block, metadata_struct); 110 111 free(meta_block); 112 113 if (rc != EOK) 114 goto error; 115 116 if (!meta_gstripe_has_valid_magic(metadata_struct)) { 117 rc = ENOFS; 118 goto error; 119 } 120 121 *rmd = metadata_struct; 122 return EOK; 123 124 error: 125 free(metadata_struct); 126 return ENOFS; 101 127 } 102 128 … … 178 204 } 179 205 206 static bool meta_gstripe_compare_uuids(const void *md1_v, const void *md2_v) 207 { 208 const struct g_stripe_metadata *md1 = md1_v; 209 const struct g_stripe_metadata *md2 = md2_v; 210 if (md1->md_id == md2->md_id) 211 return true; 212 213 return false; 214 } 215 216 static void meta_gstripe_inc_counter(hr_volume_t *vol) 217 { 218 (void)vol; 219 } 220 221 static errno_t meta_gstripe_save(hr_volume_t *vol, bool with_state_callback) 222 { 223 HR_DEBUG("%s()", __func__); 224 225 return ENOTSUP; 226 } 227 228 static errno_t meta_gstripe_save_ext(hr_volume_t *vol, size_t ext_idx, 229 bool with_state_callback) 230 { 231 HR_DEBUG("%s()", __func__); 232 233 return ENOTSUP; 234 } 235 236 static const char *meta_gstripe_get_devname(const void *md_v) 237 { 238 const struct g_stripe_metadata *md = md_v; 239 240 return md->md_name; 241 } 242 243 static hr_level_t meta_gstripe_get_level(const void *md_v) 244 { 245 (void)md_v; 246 247 return HR_LVL_0; 248 } 249 250 static uint64_t meta_gstripe_get_data_offset(void) 251 { 252 return 0; 253 } 254 255 static size_t meta_gstripe_get_size(void) 256 { 257 return 1; 258 } 259 260 static uint8_t meta_gstripe_get_flags(void) 261 { 262 uint8_t flags = 0; 263 264 return flags; 265 } 266 267 static hr_metadata_type_t meta_gstripe_get_type(void) 268 { 269 return HR_METADATA_GEOM_STRIPE; 270 } 271 272 static void meta_gstripe_dump(const void *md_v) 273 { 274 HR_DEBUG("%s()", __func__); 275 276 const struct g_stripe_metadata *md = md_v; 277 278 printf(" magic: %s\n", md->md_magic); 279 printf(" version: %u\n", (u_int)md->md_version); 280 printf(" name: %s\n", md->md_name); 281 printf(" id: %u\n", (u_int)md->md_id); 282 printf(" no: %u\n", (u_int)md->md_no); 283 printf(" all: %u\n", (u_int)md->md_all); 284 printf("stripesize: %u\n", (u_int)md->md_stripesize); 285 printf(" mediasize: %jd\n", (intmax_t)md->md_provsize); 286 } 287 288 static void *meta_gstripe_alloc_struct(void) 289 { 290 return calloc(1, sizeof(struct g_stripe_metadata)); 291 } 292 293 #if 0 180 294 static void meta_gstripe_encode(void *md_v, void *block) 181 295 { … … 184 298 stripe_metadata_encode(md_v, block); 185 299 } 300 #endif 186 301 187 302 static errno_t meta_gstripe_decode(const void *block, void *md_v) … … 239 354 } 240 355 356 #if 0 241 357 static errno_t meta_gstripe_write_block(service_id_t dev, const void *block) 242 358 { … … 265 381 return rc; 266 382 } 383 #endif 267 384 268 385 static bool meta_gstripe_has_valid_magic(const void *md_v) … … 278 395 } 279 396 280 static bool meta_gstripe_compare_uuids(const void *md1_v, const void *md2_v)281 {282 const struct g_stripe_metadata *md1 = md1_v;283 const struct g_stripe_metadata *md2 = md2_v;284 if (md1->md_id == md2->md_id)285 return true;286 287 return false;288 }289 290 static void meta_gstripe_inc_counter(hr_volume_t *vol)291 {292 (void)vol;293 }294 295 static errno_t meta_gstripe_save(hr_volume_t *vol, bool with_state_callback)296 {297 HR_DEBUG("%s()", __func__);298 299 return ENOTSUP;300 }301 302 static errno_t meta_gstripe_save_ext(hr_volume_t *vol, size_t ext_idx,303 bool with_state_callback)304 {305 HR_DEBUG("%s()", __func__);306 307 return ENOTSUP;308 }309 310 static const char *meta_gstripe_get_devname(const void *md_v)311 {312 const struct g_stripe_metadata *md = md_v;313 314 return md->md_name;315 }316 317 static hr_level_t meta_gstripe_get_level(const void *md_v)318 {319 (void)md_v;320 321 return HR_LVL_0;322 }323 324 static uint64_t meta_gstripe_get_data_offset(void)325 {326 return 0;327 }328 329 static size_t meta_gstripe_get_size(void)330 {331 return 1;332 }333 334 static uint8_t meta_gstripe_get_flags(void)335 {336 uint8_t flags = 0;337 338 return flags;339 }340 341 static hr_metadata_type_t meta_gstripe_get_type(void)342 {343 return HR_METADATA_GEOM_STRIPE;344 }345 346 static void meta_gstripe_dump(const void *md_v)347 {348 HR_DEBUG("%s()", __func__);349 350 const struct g_stripe_metadata *md = md_v;351 352 printf(" magic: %s\n", md->md_magic);353 printf(" version: %u\n", (u_int)md->md_version);354 printf(" name: %s\n", md->md_name);355 printf(" id: %u\n", (u_int)md->md_id);356 printf(" no: %u\n", (u_int)md->md_no);357 printf(" all: %u\n", (u_int)md->md_all);358 printf("stripesize: %u\n", (u_int)md->md_stripesize);359 printf(" mediasize: %jd\n", (intmax_t)md->md_provsize);360 }361 362 397 /** @} 363 398 */ 
- 
      uspace/srv/bd/hr/metadata/foreign/softraid/hr_softraid.cr78433bb raa9bad8 54 54 #include "softraidvar.h" 55 55 56 /* not exposed */ 56 57 static void *meta_softraid_alloc_struct(void); 58 /* static void meta_softraid_encode(void *, void *); */ 59 static errno_t meta_softraid_decode(const void *, void *); 60 static errno_t meta_softraid_get_block(service_id_t, void **); 61 /* static errno_t meta_softraid_write_block(service_id_t, const void *); */ 62 static bool meta_softraid_has_valid_magic(const void *); 63 64 static errno_t meta_softraid_probe(service_id_t, void **); 57 65 static errno_t meta_softraid_init_vol2meta(hr_volume_t *); 58 66 static errno_t meta_softraid_init_meta2vol(const list_t *, hr_volume_t *); 59 static void meta_softraid_encode(void *, void *);60 static errno_t meta_softraid_decode(const void *, void *);61 static errno_t meta_softraid_get_block(service_id_t, void **);62 static errno_t meta_softraid_write_block(service_id_t, const void *);63 static bool meta_softraid_has_valid_magic(const void *);64 67 static bool meta_softraid_compare_uuids(const void *, const void *); 65 68 static void meta_softraid_inc_counter(hr_volume_t *); … … 75 78 76 79 hr_superblock_ops_t metadata_softraid_ops = { 77 . alloc_struct = meta_softraid_alloc_struct,80 .probe = meta_softraid_probe, 78 81 .init_vol2meta = meta_softraid_init_vol2meta, 79 82 .init_meta2vol = meta_softraid_init_meta2vol, 80 .encode = meta_softraid_encode,81 .decode = meta_softraid_decode,82 .get_block = meta_softraid_get_block,83 .write_block = meta_softraid_write_block,84 .has_valid_magic = meta_softraid_has_valid_magic,85 83 .compare_uuids = meta_softraid_compare_uuids, 86 84 .inc_counter = meta_softraid_inc_counter, … … 96 94 }; 97 95 98 static void *meta_softraid_alloc_struct(void) 99 { 100 return calloc(1, SR_META_SIZE * DEV_BSIZE); 96 static errno_t meta_softraid_probe(service_id_t svc_id, void **rmd) 97 { 98 errno_t rc; 99 void *meta_block; 100 101 void *metadata_struct = meta_softraid_alloc_struct(); 102 if (metadata_struct == NULL) 103 return ENOMEM; 104 105 rc = meta_softraid_get_block(svc_id, &meta_block); 106 if (rc != EOK) 107 goto error; 108 109 rc = meta_softraid_decode(meta_block, metadata_struct); 110 111 free(meta_block); 112 113 if (rc != EOK) 114 goto error; 115 116 if (!meta_softraid_has_valid_magic(metadata_struct)) { 117 rc = ENOFS; 118 goto error; 119 } 120 121 *rmd = metadata_struct; 122 return EOK; 123 124 error: 125 free(metadata_struct); 126 return ENOFS; 101 127 } 102 128 … … 181 207 } 182 208 209 static bool meta_softraid_compare_uuids(const void *m1_v, const void *m2_v) 210 { 211 const struct sr_metadata *m1 = m1_v; 212 const struct sr_metadata *m2 = m2_v; 213 if (memcmp(&m1->ssdi.ssd_uuid, &m2->ssdi.ssd_uuid, 214 SR_UUID_MAX) == 0) 215 return true; 216 217 return false; 218 } 219 220 static void meta_softraid_inc_counter(hr_volume_t *vol) 221 { 222 fibril_mutex_lock(&vol->md_lock); 223 224 struct sr_metadata *md = vol->in_mem_md; 225 226 md->ssd_ondisk++; 227 228 fibril_mutex_unlock(&vol->md_lock); 229 } 230 231 static errno_t meta_softraid_save(hr_volume_t *vol, bool with_state_callback) 232 { 233 HR_DEBUG("%s()", __func__); 234 235 return ENOTSUP; 236 } 237 238 static errno_t meta_softraid_save_ext(hr_volume_t *vol, size_t ext_idx, 239 bool with_state_callback) 240 { 241 HR_DEBUG("%s()", __func__); 242 243 return ENOTSUP; 244 } 245 246 static const char *meta_softraid_get_devname(const void *md_v) 247 { 248 const struct sr_metadata *md = md_v; 249 250 return md->ssd_devname; 251 } 252 253 static hr_level_t meta_softraid_get_level(const void *md_v) 254 { 255 const struct sr_metadata *md = md_v; 256 257 switch (md->ssdi.ssd_level) { 258 case 0: 259 return HR_LVL_0; 260 case 1: 261 return HR_LVL_1; 262 case 5: 263 return HR_LVL_5; 264 default: 265 return HR_LVL_UNKNOWN; 266 } 267 } 268 269 static uint64_t meta_softraid_get_data_offset(void) 270 { 271 return SR_DATA_OFFSET; 272 } 273 274 static size_t meta_softraid_get_size(void) 275 { 276 return SR_META_SIZE; 277 } 278 279 static uint8_t meta_softraid_get_flags(void) 280 { 281 uint8_t flags = 0; 282 283 return flags; 284 } 285 286 static hr_metadata_type_t meta_softraid_get_type(void) 287 { 288 return HR_METADATA_SOFTRAID; 289 } 290 291 static void meta_softraid_dump(const void *md_v) 292 { 293 HR_DEBUG("%s()", __func__); 294 295 const struct sr_metadata *md = md_v; 296 297 sr_meta_print(md); 298 } 299 300 static void *meta_softraid_alloc_struct(void) 301 { 302 return calloc(1, SR_META_SIZE * DEV_BSIZE); 303 } 304 305 #if 0 183 306 static void meta_softraid_encode(void *md_v, void *block) 184 307 { … … 188 311 (void)block; 189 312 } 313 #endif 190 314 191 315 static errno_t meta_softraid_decode(const void *block, void *md_v) … … 372 496 } 373 497 498 #if 0 374 499 static errno_t meta_softraid_write_block(service_id_t dev, const void *block) 375 500 { … … 398 523 return rc; 399 524 } 525 #endif 400 526 401 527 static bool meta_softraid_has_valid_magic(const void *md_v) … … 411 537 } 412 538 413 static bool meta_softraid_compare_uuids(const void *m1_v, const void *m2_v)414 {415 const struct sr_metadata *m1 = m1_v;416 const struct sr_metadata *m2 = m2_v;417 if (memcmp(&m1->ssdi.ssd_uuid, &m2->ssdi.ssd_uuid,418 SR_UUID_MAX) == 0)419 return true;420 421 return false;422 }423 424 static void meta_softraid_inc_counter(hr_volume_t *vol)425 {426 fibril_mutex_lock(&vol->md_lock);427 428 struct sr_metadata *md = vol->in_mem_md;429 430 md->ssd_ondisk++;431 432 fibril_mutex_unlock(&vol->md_lock);433 }434 435 static errno_t meta_softraid_save(hr_volume_t *vol, bool with_state_callback)436 {437 HR_DEBUG("%s()", __func__);438 439 return ENOTSUP;440 }441 442 static errno_t meta_softraid_save_ext(hr_volume_t *vol, size_t ext_idx,443 bool with_state_callback)444 {445 HR_DEBUG("%s()", __func__);446 447 return ENOTSUP;448 }449 450 static const char *meta_softraid_get_devname(const void *md_v)451 {452 const struct sr_metadata *md = md_v;453 454 return md->ssd_devname;455 }456 457 static hr_level_t meta_softraid_get_level(const void *md_v)458 {459 const struct sr_metadata *md = md_v;460 461 switch (md->ssdi.ssd_level) {462 case 0:463 return HR_LVL_0;464 case 1:465 return HR_LVL_1;466 case 5:467 return HR_LVL_5;468 default:469 return HR_LVL_UNKNOWN;470 }471 }472 473 static uint64_t meta_softraid_get_data_offset(void)474 {475 return SR_DATA_OFFSET;476 }477 478 static size_t meta_softraid_get_size(void)479 {480 return SR_META_SIZE;481 }482 483 static uint8_t meta_softraid_get_flags(void)484 {485 uint8_t flags = 0;486 487 return flags;488 }489 490 static hr_metadata_type_t meta_softraid_get_type(void)491 {492 return HR_METADATA_SOFTRAID;493 }494 495 static void meta_softraid_dump(const void *md_v)496 {497 HR_DEBUG("%s()", __func__);498 499 const struct sr_metadata *md = md_v;500 501 sr_meta_print(md);502 }503 504 539 /** @} 505 540 */ 
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  
