hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/fs/ocfs2/ocfs2_fs.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /* -*- mode: c; c-basic-offset: 8; -*-
23 * vim: noexpandtab sw=8 ts=8 sts=0:
34 *
....@@ -6,20 +7,6 @@
67 * On-disk structures for OCFS2.
78 *
89 * 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.
2310 */
2411
2512 #ifndef _OCFS2_FS_H
....@@ -392,21 +379,6 @@
392379 #define OCFS2_HB_GLOBAL "heartbeat=global"
393380
394381 /*
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
-/*
410382 * OCFS2_DIR_PAD defines the directory entries boundaries
411383 *
412384 * NOTE: It must be a multiple of 4
....@@ -423,17 +395,6 @@
423395 #define OCFS2_DX_LINK_MAX ((1U << 31) - 1U)
424396 #define OCFS2_LINKS_HI_SHIFT 16
425397 #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
-};
437398
438399
439400 /*
....@@ -509,7 +470,7 @@
509470 __le16 l_reserved1;
510471 __le64 l_reserved2; /* Pad to
511472 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 */
513474 };
514475
515476 /*
....@@ -523,7 +484,7 @@
523484 __le16 cl_count; /* Total chains in this list */
524485 __le16 cl_next_free_rec; /* Next unused chain slot */
525486 __le64 cl_reserved1;
526
-/*10*/ struct ocfs2_chain_rec cl_recs[0]; /* Chain records */
487
+/*10*/ struct ocfs2_chain_rec cl_recs[]; /* Chain records */
527488 };
528489
529490 /*
....@@ -535,7 +496,7 @@
535496 /*00*/ __le16 tl_count; /* Total records in this log */
536497 __le16 tl_used; /* Number of records in use */
537498 __le32 tl_reserved1;
538
-/*08*/ struct ocfs2_truncate_rec tl_recs[0]; /* Truncate records */
499
+/*08*/ struct ocfs2_truncate_rec tl_recs[]; /* Truncate records */
539500 };
540501
541502 /*
....@@ -679,7 +640,7 @@
679640 __le16 la_size; /* Size of included bitmap, in bytes */
680641 __le16 la_reserved1;
681642 __le64 la_reserved2;
682
-/*10*/ __u8 la_bitmap[0];
643
+/*10*/ __u8 la_bitmap[];
683644 };
684645
685646 /*
....@@ -692,7 +653,7 @@
692653 * for data, starting at id_data */
693654 __le16 id_reserved0;
694655 __le32 id_reserved1;
695
- __u8 id_data[0]; /* Start of user data */
656
+ __u8 id_data[]; /* Start of user data */
696657 };
697658
698659 /*
....@@ -837,7 +798,7 @@
837798 * possible in de_entries */
838799 __le16 de_num_used; /* Current number of
839800 * de_entries entries */
840
- struct ocfs2_dx_entry de_entries[0]; /* Indexed dir entries
801
+ struct ocfs2_dx_entry de_entries[]; /* Indexed dir entries
841802 * in a packed array of
842803 * length de_num_used */
843804 };
....@@ -974,7 +935,7 @@
974935 __le16 rl_used; /* Current number of used records */
975936 __le32 rl_reserved2;
976937 __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 */
978939 };
979940
980941
....@@ -1060,7 +1021,7 @@
10601021 buckets. A block uses
10611022 xb_check and sets
10621023 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. */
10641025 };
10651026
10661027 /*
....@@ -1246,7 +1207,7 @@
12461207 /* Header of one chunk of a quota file */
12471208 struct ocfs2_local_disk_chunk {
12481209 __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
12501211 * chunk of quota file */
12511212 };
12521213
....@@ -1629,7 +1590,7 @@
16291590 static inline void ocfs2_set_de_type(struct ocfs2_dir_entry *de,
16301591 umode_t mode)
16311592 {
1632
- de->file_type = ocfs2_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
1593
+ de->file_type = fs_umode_to_ftype(mode);
16331594 }
16341595
16351596 static inline int ocfs2_gd_is_discontig(struct ocfs2_group_desc *gd)