Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 1 | /* |
| 2 | * native.c --- returns the ext2_flag for a native byte order |
| 3 | * |
| 4 | * Copyright (C) 1996 Theodore Ts'o. |
| 5 | * |
Theodore Ts'o | 19c78dc | 1997-04-29 16:17:09 +0000 | [diff] [blame] | 6 | * %Begin-Header% |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 7 | * This file may be redistributed under the terms of the GNU Public |
| 8 | * License. |
Theodore Ts'o | 19c78dc | 1997-04-29 16:17:09 +0000 | [diff] [blame] | 9 | * %End-Header% |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #include <stdio.h> |
Theodore Ts'o | b5abe6f | 1998-01-19 14:47:53 +0000 | [diff] [blame] | 13 | |
| 14 | #if EXT2_FLAT_INCLUDES |
| 15 | #include "ext2_fs.h" |
| 16 | #else |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 17 | #include <linux/ext2_fs.h> |
Theodore Ts'o | b5abe6f | 1998-01-19 14:47:53 +0000 | [diff] [blame] | 18 | #endif |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 19 | |
| 20 | #include "ext2fs.h" |
| 21 | |
| 22 | static int i386_byteorder(void) |
| 23 | { |
| 24 | int one = 1; |
| 25 | char *cp = (char *) &one; |
| 26 | |
| 27 | return (*cp == 1); |
| 28 | } |
| 29 | |
| 30 | int ext2fs_native_flag(void) |
| 31 | { |
| 32 | if (i386_byteorder()) |
| 33 | return 0; |
Theodore Ts'o | 5c57647 | 1997-04-29 15:29:49 +0000 | [diff] [blame] | 34 | return EXT2_FLAG_SWAP_BYTES; |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | |
| 38 | |