1 | ( directory-id, object-id, offset, type ) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 363 struct offset_v1 { 364 __le32 k_offset; 365 __le32 k_uniqueness; 366 } __attribute__ ((__packed__)); 367 368 struct offset_v2 { 369 __le64 v; 370 } __attribute__ ((__packed__)); 371 372 static inline __u16 offset_v2_k_type(const struct offset_v2 *v2) 373 { 374 __u8 type = le64_to_cpu(v2->v) >> 60; 375 return (type <= TYPE_MAXTYPE) ? type : TYPE_ANY; 376 } 377 378 static inline void set_offset_v2_k_type(struct offset_v2 *v2, int type) 379 { 380 v2->v = 381 (v2->v & cpu_to_le64(~0ULL >> 4)) | cpu_to_le64((__u64) type << 60); 382 } 383 384 static inline loff_t offset_v2_k_offset(const struct offset_v2 *v2) 385 { 386 return le64_to_cpu(v2->v) & (~0ULL >> 4); 387 } 388 389 static inline void set_offset_v2_k_offset(struct offset_v2 *v2, loff_t offset) 390 { 391 offset &= (~0ULL >> 4); 392 v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset); 393 } 394 395 /* Key of an item determines its location in the S+tree, and 396 is composed of 4 components */ 397 struct reiserfs_key { 398 __le32 k_dir_id; /* packing locality: by default parent 399 directory object id */ 400 __le32 k_objectid; /* object identifier */ 401 union { 402 struct offset_v1 k_offset_v1; 403 struct offset_v2 k_offset_v2; 404 } __attribute__ ((__packed__)) u; 405 } __attribute__ ((__packed__)); 406 |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |