diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2012-05-28 02:48:55 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2012-05-28 02:48:55 +0200 |
| commit | aa4e5092f58f5a11018e569aee9cf037daf8c5d6 (patch) | |
| tree | f8c01df8f7eb3dda4c0292df3548d9fced5e3297 /util-linux | |
| parent | f5234398ef3010b68468cafe3e2ea89b2bb08a17 (diff) | |
| download | busybox-w32-1_20_1.tar.gz busybox-w32-1_20_1.tar.bz2 busybox-w32-1_20_1.zip | |
Apply post-1.20.0 patches, bump version to 1.20.11_20_1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
| -rw-r--r-- | util-linux/mdev.c | 41 | ||||
| -rw-r--r-- | util-linux/volume_id/ext.c | 52 |
2 files changed, 72 insertions, 21 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c index 0a34122b4..c4829a596 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c | |||
| @@ -661,37 +661,45 @@ static int FAST_FUNC dirAction(const char *fileName UNUSED_PARAM, | |||
| 661 | static void load_firmware(const char *firmware, const char *sysfs_path) | 661 | static void load_firmware(const char *firmware, const char *sysfs_path) |
| 662 | { | 662 | { |
| 663 | int cnt; | 663 | int cnt; |
| 664 | int firmware_fd, loading_fd, data_fd; | 664 | int firmware_fd, loading_fd; |
| 665 | 665 | ||
| 666 | /* check for /lib/firmware/$FIRMWARE */ | 666 | /* check for /lib/firmware/$FIRMWARE */ |
| 667 | xchdir("/lib/firmware"); | 667 | xchdir("/lib/firmware"); |
| 668 | firmware_fd = xopen(firmware, O_RDONLY); | 668 | firmware_fd = open(firmware, O_RDONLY); /* can fail */ |
| 669 | |||
| 670 | /* in case we goto out ... */ | ||
| 671 | data_fd = -1; | ||
| 672 | 669 | ||
| 673 | /* check for /sys/$DEVPATH/loading ... give 30 seconds to appear */ | 670 | /* check for /sys/$DEVPATH/loading ... give 30 seconds to appear */ |
| 674 | xchdir(sysfs_path); | 671 | xchdir(sysfs_path); |
| 675 | for (cnt = 0; cnt < 30; ++cnt) { | 672 | for (cnt = 0; cnt < 30; ++cnt) { |
| 676 | loading_fd = open("loading", O_WRONLY); | 673 | loading_fd = open("loading", O_WRONLY); |
| 677 | if (loading_fd != -1) | 674 | if (loading_fd >= 0) |
| 678 | goto loading; | 675 | goto loading; |
| 679 | sleep(1); | 676 | sleep(1); |
| 680 | } | 677 | } |
| 681 | goto out; | 678 | goto out; |
| 682 | 679 | ||
| 683 | loading: | 680 | loading: |
| 684 | /* tell kernel we're loading by "echo 1 > /sys/$DEVPATH/loading" */ | 681 | cnt = 0; |
| 685 | if (full_write(loading_fd, "1", 1) != 1) | 682 | if (firmware_fd >= 0) { |
| 686 | goto out; | 683 | int data_fd; |
| 687 | 684 | ||
| 688 | /* load firmware into /sys/$DEVPATH/data */ | 685 | /* tell kernel we're loading by "echo 1 > /sys/$DEVPATH/loading" */ |
| 689 | data_fd = open("data", O_WRONLY); | 686 | if (full_write(loading_fd, "1", 1) != 1) |
| 690 | if (data_fd == -1) | 687 | goto out; |
| 691 | goto out; | 688 | |
| 692 | cnt = bb_copyfd_eof(firmware_fd, data_fd); | 689 | /* load firmware into /sys/$DEVPATH/data */ |
| 690 | data_fd = open("data", O_WRONLY); | ||
| 691 | if (data_fd < 0) | ||
| 692 | goto out; | ||
| 693 | cnt = bb_copyfd_eof(firmware_fd, data_fd); | ||
| 694 | if (ENABLE_FEATURE_CLEAN_UP) | ||
| 695 | close(data_fd); | ||
| 696 | } | ||
| 693 | 697 | ||
| 694 | /* tell kernel result by "echo [0|-1] > /sys/$DEVPATH/loading" */ | 698 | /* Tell kernel result by "echo [0|-1] > /sys/$DEVPATH/loading" |
| 699 | * Note: we emit -1 if firmware file wasn't found. | ||
| 700 | * There are cases when otherwise kernel would wait for minutes | ||
| 701 | * before timing out. | ||
| 702 | */ | ||
| 695 | if (cnt > 0) | 703 | if (cnt > 0) |
| 696 | full_write(loading_fd, "0", 1); | 704 | full_write(loading_fd, "0", 1); |
| 697 | else | 705 | else |
| @@ -701,7 +709,6 @@ static void load_firmware(const char *firmware, const char *sysfs_path) | |||
| 701 | if (ENABLE_FEATURE_CLEAN_UP) { | 709 | if (ENABLE_FEATURE_CLEAN_UP) { |
| 702 | close(firmware_fd); | 710 | close(firmware_fd); |
| 703 | close(loading_fd); | 711 | close(loading_fd); |
| 704 | close(data_fd); | ||
| 705 | } | 712 | } |
| 706 | } | 713 | } |
| 707 | 714 | ||
diff --git a/util-linux/volume_id/ext.c b/util-linux/volume_id/ext.c index b5194a7b5..aa23d1ebf 100644 --- a/util-linux/volume_id/ext.c +++ b/util-linux/volume_id/ext.c | |||
| @@ -39,10 +39,50 @@ struct ext2_super_block { | |||
| 39 | uint8_t volume_name[16]; | 39 | uint8_t volume_name[16]; |
| 40 | } PACKED; | 40 | } PACKED; |
| 41 | 41 | ||
| 42 | #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x00000004 | ||
| 43 | #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x00000008 | ||
| 44 | #define EXT_SUPERBLOCK_OFFSET 0x400 | 42 | #define EXT_SUPERBLOCK_OFFSET 0x400 |
| 45 | 43 | ||
| 44 | /* for s_flags */ | ||
| 45 | #define EXT2_FLAGS_TEST_FILESYS 0x0004 | ||
| 46 | |||
| 47 | /* for s_feature_compat */ | ||
| 48 | #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 | ||
| 49 | |||
| 50 | /* for s_feature_ro_compat */ | ||
| 51 | #define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 | ||
| 52 | #define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 | ||
| 53 | #define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 | ||
| 54 | #define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008 | ||
| 55 | #define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010 | ||
| 56 | #define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020 | ||
| 57 | #define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040 | ||
| 58 | |||
| 59 | /* for s_feature_incompat */ | ||
| 60 | #define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002 | ||
| 61 | #define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 | ||
| 62 | #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 | ||
| 63 | #define EXT2_FEATURE_INCOMPAT_META_BG 0x0010 | ||
| 64 | #define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */ | ||
| 65 | #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 | ||
| 66 | #define EXT4_FEATURE_INCOMPAT_MMP 0x0100 | ||
| 67 | #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 | ||
| 68 | |||
| 69 | #define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \ | ||
| 70 | EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \ | ||
| 71 | EXT2_FEATURE_RO_COMPAT_BTREE_DIR) | ||
| 72 | #define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \ | ||
| 73 | EXT2_FEATURE_INCOMPAT_META_BG) | ||
| 74 | #define EXT2_FEATURE_INCOMPAT_UNSUPPORTED ~EXT2_FEATURE_INCOMPAT_SUPP | ||
| 75 | #define EXT2_FEATURE_RO_COMPAT_UNSUPPORTED ~EXT2_FEATURE_RO_COMPAT_SUPP | ||
| 76 | |||
| 77 | #define EXT3_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \ | ||
| 78 | EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \ | ||
| 79 | EXT2_FEATURE_RO_COMPAT_BTREE_DIR) | ||
| 80 | #define EXT3_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \ | ||
| 81 | EXT3_FEATURE_INCOMPAT_RECOVER| \ | ||
| 82 | EXT2_FEATURE_INCOMPAT_META_BG) | ||
| 83 | #define EXT3_FEATURE_INCOMPAT_UNSUPPORTED ~EXT3_FEATURE_INCOMPAT_SUPP | ||
| 84 | #define EXT3_FEATURE_RO_COMPAT_UNSUPPORTED ~EXT3_FEATURE_RO_COMPAT_SUPP | ||
| 85 | |||
| 46 | int FAST_FUNC volume_id_probe_ext(struct volume_id *id /*,uint64_t off*/) | 86 | int FAST_FUNC volume_id_probe_ext(struct volume_id *id /*,uint64_t off*/) |
| 47 | { | 87 | { |
| 48 | #define off ((uint64_t)0) | 88 | #define off ((uint64_t)0) |
| @@ -66,11 +106,15 @@ int FAST_FUNC volume_id_probe_ext(struct volume_id *id /*,uint64_t off*/) | |||
| 66 | dbg("ext: label '%s' uuid '%s'", id->label, id->uuid); | 106 | dbg("ext: label '%s' uuid '%s'", id->label, id->uuid); |
| 67 | 107 | ||
| 68 | #if ENABLE_FEATURE_BLKID_TYPE | 108 | #if ENABLE_FEATURE_BLKID_TYPE |
| 69 | if ((le32_to_cpu(es->feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) | 109 | if ((es->feature_ro_compat & cpu_to_le32(EXT4_FEATURE_RO_COMPAT_HUGE_FILE | EXT4_FEATURE_RO_COMPAT_DIR_NLINK)) |
| 110 | || (es->feature_incompat & cpu_to_le32(EXT4_FEATURE_INCOMPAT_EXTENTS | EXT4_FEATURE_INCOMPAT_64BIT)) | ||
| 111 | ) { | ||
| 112 | id->type = "ext4"; | ||
| 113 | } | ||
| 114 | else if (es->feature_compat & cpu_to_le32(EXT3_FEATURE_COMPAT_HAS_JOURNAL)) | ||
| 70 | id->type = "ext3"; | 115 | id->type = "ext3"; |
| 71 | else | 116 | else |
| 72 | id->type = "ext2"; | 117 | id->type = "ext2"; |
| 73 | #endif | 118 | #endif |
| 74 | |||
| 75 | return 0; | 119 | return 0; |
| 76 | } | 120 | } |
