| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* -*- mode: c; c-basic-offset: 8; -*- |
|---|
| 2 | 3 | * vim: noexpandtab sw=8 ts=8 sts=0: |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * On-disk structures for OCFS2. |
|---|
| 7 | 8 | * |
|---|
| 8 | 9 | * Copyright (C) 2002, 2004 Oracle. All rights reserved. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or |
|---|
| 11 | | - * modify it under the terms of the GNU General Public |
|---|
| 12 | | - * License, version 2, as published by the Free Software Foundation. |
|---|
| 13 | | - * |
|---|
| 14 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 17 | | - * General Public License for more details. |
|---|
| 18 | | - * |
|---|
| 19 | | - * You should have received a copy of the GNU General Public |
|---|
| 20 | | - * License along with this program; if not, write to the |
|---|
| 21 | | - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|---|
| 22 | | - * Boston, MA 021110-1307, USA. |
|---|
| 23 | 10 | */ |
|---|
| 24 | 11 | |
|---|
| 25 | 12 | #ifndef _OCFS2_FS_H |
|---|
| .. | .. |
|---|
| 392 | 379 | #define OCFS2_HB_GLOBAL "heartbeat=global" |
|---|
| 393 | 380 | |
|---|
| 394 | 381 | /* |
|---|
| 395 | | - * OCFS2 directory file types. Only the low 3 bits are used. The |
|---|
| 396 | | - * other bits are reserved for now. |
|---|
| 397 | | - */ |
|---|
| 398 | | -#define OCFS2_FT_UNKNOWN 0 |
|---|
| 399 | | -#define OCFS2_FT_REG_FILE 1 |
|---|
| 400 | | -#define OCFS2_FT_DIR 2 |
|---|
| 401 | | -#define OCFS2_FT_CHRDEV 3 |
|---|
| 402 | | -#define OCFS2_FT_BLKDEV 4 |
|---|
| 403 | | -#define OCFS2_FT_FIFO 5 |
|---|
| 404 | | -#define OCFS2_FT_SOCK 6 |
|---|
| 405 | | -#define OCFS2_FT_SYMLINK 7 |
|---|
| 406 | | - |
|---|
| 407 | | -#define OCFS2_FT_MAX 8 |
|---|
| 408 | | - |
|---|
| 409 | | -/* |
|---|
| 410 | 382 | * OCFS2_DIR_PAD defines the directory entries boundaries |
|---|
| 411 | 383 | * |
|---|
| 412 | 384 | * NOTE: It must be a multiple of 4 |
|---|
| .. | .. |
|---|
| 423 | 395 | #define OCFS2_DX_LINK_MAX ((1U << 31) - 1U) |
|---|
| 424 | 396 | #define OCFS2_LINKS_HI_SHIFT 16 |
|---|
| 425 | 397 | #define OCFS2_DX_ENTRIES_MAX (0xffffffffU) |
|---|
| 426 | | - |
|---|
| 427 | | -#define S_SHIFT 12 |
|---|
| 428 | | -static unsigned char ocfs2_type_by_mode[S_IFMT >> S_SHIFT] = { |
|---|
| 429 | | - [S_IFREG >> S_SHIFT] = OCFS2_FT_REG_FILE, |
|---|
| 430 | | - [S_IFDIR >> S_SHIFT] = OCFS2_FT_DIR, |
|---|
| 431 | | - [S_IFCHR >> S_SHIFT] = OCFS2_FT_CHRDEV, |
|---|
| 432 | | - [S_IFBLK >> S_SHIFT] = OCFS2_FT_BLKDEV, |
|---|
| 433 | | - [S_IFIFO >> S_SHIFT] = OCFS2_FT_FIFO, |
|---|
| 434 | | - [S_IFSOCK >> S_SHIFT] = OCFS2_FT_SOCK, |
|---|
| 435 | | - [S_IFLNK >> S_SHIFT] = OCFS2_FT_SYMLINK, |
|---|
| 436 | | -}; |
|---|
| 437 | 398 | |
|---|
| 438 | 399 | |
|---|
| 439 | 400 | /* |
|---|
| .. | .. |
|---|
| 509 | 470 | __le16 l_reserved1; |
|---|
| 510 | 471 | __le64 l_reserved2; /* Pad to |
|---|
| 511 | 472 | sizeof(ocfs2_extent_rec) */ |
|---|
| 512 | | -/*10*/ struct ocfs2_extent_rec l_recs[0]; /* Extent records */ |
|---|
| 473 | +/*10*/ struct ocfs2_extent_rec l_recs[]; /* Extent records */ |
|---|
| 513 | 474 | }; |
|---|
| 514 | 475 | |
|---|
| 515 | 476 | /* |
|---|
| .. | .. |
|---|
| 523 | 484 | __le16 cl_count; /* Total chains in this list */ |
|---|
| 524 | 485 | __le16 cl_next_free_rec; /* Next unused chain slot */ |
|---|
| 525 | 486 | __le64 cl_reserved1; |
|---|
| 526 | | -/*10*/ struct ocfs2_chain_rec cl_recs[0]; /* Chain records */ |
|---|
| 487 | +/*10*/ struct ocfs2_chain_rec cl_recs[]; /* Chain records */ |
|---|
| 527 | 488 | }; |
|---|
| 528 | 489 | |
|---|
| 529 | 490 | /* |
|---|
| .. | .. |
|---|
| 535 | 496 | /*00*/ __le16 tl_count; /* Total records in this log */ |
|---|
| 536 | 497 | __le16 tl_used; /* Number of records in use */ |
|---|
| 537 | 498 | __le32 tl_reserved1; |
|---|
| 538 | | -/*08*/ struct ocfs2_truncate_rec tl_recs[0]; /* Truncate records */ |
|---|
| 499 | +/*08*/ struct ocfs2_truncate_rec tl_recs[]; /* Truncate records */ |
|---|
| 539 | 500 | }; |
|---|
| 540 | 501 | |
|---|
| 541 | 502 | /* |
|---|
| .. | .. |
|---|
| 679 | 640 | __le16 la_size; /* Size of included bitmap, in bytes */ |
|---|
| 680 | 641 | __le16 la_reserved1; |
|---|
| 681 | 642 | __le64 la_reserved2; |
|---|
| 682 | | -/*10*/ __u8 la_bitmap[0]; |
|---|
| 643 | +/*10*/ __u8 la_bitmap[]; |
|---|
| 683 | 644 | }; |
|---|
| 684 | 645 | |
|---|
| 685 | 646 | /* |
|---|
| .. | .. |
|---|
| 692 | 653 | * for data, starting at id_data */ |
|---|
| 693 | 654 | __le16 id_reserved0; |
|---|
| 694 | 655 | __le32 id_reserved1; |
|---|
| 695 | | - __u8 id_data[0]; /* Start of user data */ |
|---|
| 656 | + __u8 id_data[]; /* Start of user data */ |
|---|
| 696 | 657 | }; |
|---|
| 697 | 658 | |
|---|
| 698 | 659 | /* |
|---|
| .. | .. |
|---|
| 837 | 798 | * possible in de_entries */ |
|---|
| 838 | 799 | __le16 de_num_used; /* Current number of |
|---|
| 839 | 800 | * de_entries entries */ |
|---|
| 840 | | - struct ocfs2_dx_entry de_entries[0]; /* Indexed dir entries |
|---|
| 801 | + struct ocfs2_dx_entry de_entries[]; /* Indexed dir entries |
|---|
| 841 | 802 | * in a packed array of |
|---|
| 842 | 803 | * length de_num_used */ |
|---|
| 843 | 804 | }; |
|---|
| .. | .. |
|---|
| 974 | 935 | __le16 rl_used; /* Current number of used records */ |
|---|
| 975 | 936 | __le32 rl_reserved2; |
|---|
| 976 | 937 | __le64 rl_reserved1; /* Pad to sizeof(ocfs2_refcount_record) */ |
|---|
| 977 | | -/*10*/ struct ocfs2_refcount_rec rl_recs[0]; /* Refcount records */ |
|---|
| 938 | +/*10*/ struct ocfs2_refcount_rec rl_recs[]; /* Refcount records */ |
|---|
| 978 | 939 | }; |
|---|
| 979 | 940 | |
|---|
| 980 | 941 | |
|---|
| .. | .. |
|---|
| 1060 | 1021 | buckets. A block uses |
|---|
| 1061 | 1022 | xb_check and sets |
|---|
| 1062 | 1023 | this field to zero.) */ |
|---|
| 1063 | | - struct ocfs2_xattr_entry xh_entries[0]; /* xattr entry list. */ |
|---|
| 1024 | + struct ocfs2_xattr_entry xh_entries[]; /* xattr entry list. */ |
|---|
| 1064 | 1025 | }; |
|---|
| 1065 | 1026 | |
|---|
| 1066 | 1027 | /* |
|---|
| .. | .. |
|---|
| 1246 | 1207 | /* Header of one chunk of a quota file */ |
|---|
| 1247 | 1208 | struct ocfs2_local_disk_chunk { |
|---|
| 1248 | 1209 | __le32 dqc_free; /* Number of free entries in the bitmap */ |
|---|
| 1249 | | - __u8 dqc_bitmap[0]; /* Bitmap of entries in the corresponding |
|---|
| 1210 | + __u8 dqc_bitmap[]; /* Bitmap of entries in the corresponding |
|---|
| 1250 | 1211 | * chunk of quota file */ |
|---|
| 1251 | 1212 | }; |
|---|
| 1252 | 1213 | |
|---|
| .. | .. |
|---|
| 1629 | 1590 | static inline void ocfs2_set_de_type(struct ocfs2_dir_entry *de, |
|---|
| 1630 | 1591 | umode_t mode) |
|---|
| 1631 | 1592 | { |
|---|
| 1632 | | - de->file_type = ocfs2_type_by_mode[(mode & S_IFMT)>>S_SHIFT]; |
|---|
| 1593 | + de->file_type = fs_umode_to_ftype(mode); |
|---|
| 1633 | 1594 | } |
|---|
| 1634 | 1595 | |
|---|
| 1635 | 1596 | static inline int ocfs2_gd_is_discontig(struct ocfs2_group_desc *gd) |
|---|