Linux: ubi rootfs 故障案例 (2)

文章目录

  • 1. 前言
  • 2. ubi rootfs 故障现场
  • 3. 问题解决
  • 4. 问题分析
  • 5. 参考资料

1. 前言

限于作者能力水平,本文可能存在谬误,因此而给读者带来的损失,作者不做任何承诺。

2. ubi rootfs 故障现场

内核故障日志如下:

......
[    0.000000] Linux version 4.19.94-g1194fe2-dirty (bill@bill-virtual-machine) (gcc version 5.3.1 20160113 (Linaro GCC 5.3-2016.02)) #21 PREEMPT Tue Jun 4 10:18:44 CST 2024
......
[    0.000000] Kernel command line: console=ttyO0,115200n8 root=ubi0:rootfs rw ubi.mtd=NAND.rootfs,2048 rootfstype=ubifs rootwait=1
......
[    1.700380] omap-gpmc 50000000.gpmc: GPMC revision 6.0
[    1.705736] gpmc_mem_init: disabling cs 0 mapped at 0x0-0x1000000
[    1.713618] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xda
[    1.720006] nand: Micron MT29F2G08AAD
[    1.723731] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    1.731376] nand: using OMAP_ECC_BCH8_CODE_HW ECC scheme
[    1.736826] 11 fixed-partitions partitions found on MTD device omap2-nand.0
[    1.743835] Creating 11 MTD partitions on "omap2-nand.0":
[    1.749263] 0x000000000000-0x000000020000 : "NAND.SPL"
[    1.755554] 0x000000020000-0x000000040000 : "NAND.SPL.backup1"
[    1.762305] 0x000000040000-0x000000060000 : "NAND.SPL.backup2"
[    1.769093] 0x000000060000-0x000000080000 : "NAND.SPL.backup3"
[    1.775856] 0x000000080000-0x0000000c0000 : "NAND.u-boot-spl-os"
[    1.782897] 0x0000000c0000-0x0000001c0000 : "NAND.u-boot"
[    1.789984] 0x0000001c0000-0x0000001e0000 : "NAND.u-boot-env"
[    1.796661] 0x0000001e0000-0x000000200000 : "NAND.u-boot-env.backup1"
[    1.804042] 0x000000200000-0x000000a00000 : "NAND.kernel"
[    1.817708] 0x000000a00000-0x00000e000000 : "NAND.rootfs"
[    2.023685] 0x00000e000000-0x000010000000 : "NAND.userdata"
......
[    2.162228] ubi0: attaching mtd9
[    2.817396] ubi0: scanning is finished
[    2.841103] ubi0: volume 0 ("rootfs") re-sized from 83 to 1668 LEBs
[    2.848156] ubi0: attached mtd9 (name "NAND.rootfs", size 214 MiB)
[    2.854435] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    2.861339] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
[    2.868081] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[    2.875082] ubi0: good PEBs: 1711, bad PEBs: 1, corrupted PEBs: 0
[    2.881199] ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
[    2.888463] ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 1890895802
[    2.897644] ubi0: available PEBs: 0, total reserved PEBs: 1711, PEBs reserved for bad PEB handling: 39
[    2.907010] ubi0: background thread "ubi_bgt0d" started, PID 65
......
[    2.972922] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 66
[    3.083296] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "rootfs"
[    3.090747] UBIFS (ubi0:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[    3.122798] UBIFS (ubi0:0): FS size: 210399232 bytes (200 MiB, 1657 LEBs), journal size 9023488 bytes (8 MiB, 72 LEBs)
[    3.142800] UBIFS (ubi0:0): reserved for root: 0 bytes (0 KiB)
[    3.148663] UBIFS (ubi0:0): media format: w4/r0 (latest is w5/r0), UUID 7A19D54A-3848-4AFB-8DDF-4E4A6B04D4FC, small LPT model
[    3.184943] VFS: Mounted root (ubifs filesystem) on device 0:14.
[    3.192113] devtmpfs: mounted
......
[    3.555581] omap2-nand 8000000.nand: uncorrectable bit-flips found
[    3.572853] ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 61 bytes from PEB 82:6144, read only 61 bytes, retry
[    3.593521] omap2-nand 8000000.nand: uncorrectable bit-flips found
[    3.602829] ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 61 bytes from PEB 82:6144, read only 61 bytes, retry
[    3.633378] omap2-nand 8000000.nand: uncorrectable bit-flips found
[    3.642841] ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 61 bytes from PEB 82:6144, read only 61 bytes, retry
[    3.673533] omap2-nand 8000000.nand: uncorrectable bit-flips found
[    3.682801] ubi0 error: ubi_io_read: error -74 (ECC error) while reading 61 bytes from PEB 82:6144, read 61 bytes
[    3.712799] CPU: 0 PID: 1 Comm: init Not tainted 4.19.94-g1194fe2-dirty #21
[    3.719788] Hardware name: Generic AM33XX (Flattened Device Tree)
[    3.732788] Backtrace: 
[    3.735259] [<c010bfe4>] (dump_backtrace) from [<c010c2b4>] (show_stack+0x18/0x1c)
[    3.752799]  r7:00001800 r6:0000003d r5:cf04c000 r4:ffffffb6
[    3.758490] [<c010c29c>] (show_stack) from [<c09531b4>] (dump_stack+0x24/0x28)
[    3.782799] [<c0953190>] (dump_stack) from [<c064e07c>] (ubi_io_read+0x15c/0x350)
[    3.790320] [<c064df20>] (ubi_io_read) from [<c064bdd8>] (ubi_eba_read_leb+0xcc/0x41c)
[    3.812796]  r10:00608040 r9:cf7e7400 r8:00000052 r7:cf723400 r6:00000000 r5:cf04c000
[    3.820659]  r4:0000003d
[    3.832800] [<c064bd0c>] (ubi_eba_read_leb) from [<c064a8ac>] (ubi_leb_read+0x78/0xc8)
[    3.840754]  r10:0000003d r9:cf7e7400 r8:00000000 r7:cf04c000 r6:cf723400 r5:00000800
[    3.862790]  r4:0000003d
[    3.865344] [<c064a834>] (ubi_leb_read) from [<c038d560>] (ubifs_leb_read+0x34/0x80)
[    3.882796]  r8:00000800 r7:00000050 r6:0000003d r5:cf04d000 r4:cf04d000
[    3.889531] [<c038d52c>] (ubifs_leb_read) from [<c038edf8>] (ubifs_read_node+0x9c/0x254)
[    3.912796]  r8:00000002 r7:0000003d r6:00000050 r5:00000800 r4:cf04d000
[    3.919531] [<c038ed5c>] (ubifs_read_node) from [<c038f084>] (ubifs_read_node_wbuf+0xd4/0x2b4)
[    3.942825]  r10:0000003d r9:00000002 r8:cf7e7400 r7:cf04d000 r6:cf76fc80 r5:00000050
[    3.950686]  r4:00000800
[    3.962803] [<c038efb0>] (ubifs_read_node_wbuf) from [<c03ab4a4>] (ubifs_tnc_read_node+0x50/0xbc)
[    3.971716]  r10:cf7e7400 r9:00000000 r8:cf04d0a8 r7:cf04d000 r6:cf7e7400 r5:00000002
[    4.002793]  r4:ca83c868
[    4.005345] [<c03ab454>] (ubifs_tnc_read_node) from [<c03909c0>] (tnc_read_hashed_node+0xd8/0x1cc)
[    4.022794]  r7:00000000 r6:cf04d000 r5:cf7e7400 r4:ca83c868
[    4.028482] [<c03908e8>] (tnc_read_hashed_node) from [<c039221c>] (ubifs_tnc_locate+0x1b4/0x1e8)
[    4.052795]  r7:00000000 r6:cf051d28 r5:c0e03048 r4:cf04d000
[    4.058485] [<c0392068>] (ubifs_tnc_locate) from [<c03929cc>] (ubifs_tnc_lookup_nm+0x40/0x144)
[    4.082796]  r10:0000007f r9:cf051d28 r8:cf7e7400 r7:cf051d0c r6:cf04d000 r5:c0e03048
[    4.090658]  r4:c0e03048
[    4.102800] [<c039298c>] (ubifs_tnc_lookup_nm) from [<c0386a2c>] (ubifs_lookup+0x244/0x314)
[    4.111190]  r10:0000007f r9:41cd253f r8:cf04d000 r7:cb155dc0 r6:cb154a18 r5:c0e03048
[    4.132790]  r4:cf7e7400
[    4.135343] [<c03867e8>] (ubifs_lookup) from [<c02428bc>] (__lookup_slow+0x90/0x194)
[    4.152798]  r10:cf051e68 r9:00000001 r8:cb154aa0 r7:cb155dc0 r6:cf051d74 r5:c0e03048
[    4.160659]  r4:cb154a18
[    4.172798] [<c024282c>] (__lookup_slow) from [<c02429f8>] (lookup_slow+0x38/0x4c)
[    4.180403]  r10:000b1c79 r9:cf051f5c r8:00000041 r7:00000001 r6:cf051e68 r5:cb154aa0
[    4.202792]  r4:cb155e3c
[    4.205341] [<c02429c0>] (lookup_slow) from [<c0243220>] (walk_component+0x21c/0x31c)
[    4.232793]  r7:00000000 r6:00000000 r5:c0e03048 r4:cf051e60
[    4.238483] [<c0243004>] (walk_component) from [<c024507c>] (path_lookupat+0x70/0x208)
[    4.252796]  r10:000b1c79 r9:cf051f5c r8:00000041 r7:cf051f5c r6:c0e03048 r5:00000000
[    4.260658]  r4:cf051e60
[    4.272800] [<c024500c>] (path_lookupat) from [<c0247680>] (filename_lookup+0xa8/0x118)
[    4.280840]  r8:00000001 r7:cf051e60 r6:cf080000 r5:c0e03048 r4:00000001
[    4.302802] [<c02475d8>] (filename_lookup) from [<c02477ec>] (user_path_at_empty+0x4c/0x54)
[    4.311192]  r9:cf050000 r8:ffffff9c r7:ffffff9c r6:cf051f5c r5:ffffff9c r4:00000001
[    4.342826] [<c02477a0>] (user_path_at_empty) from [<c0233af4>] (do_faccessat+0xb8/0x22c)
[    4.351039]  r6:cf286d80 r5:00000001 r4:00000006
[    4.362795] [<c0233a3c>] (do_faccessat) from [<c0233c98>] (sys_access+0x1c/0x20)
[    4.370226]  r10:00000021 r9:cf050000 r8:c0101204 r7:00000021 r6:00000000 r5:00000008
[    4.392818]  r4:00000044
[    4.395367] [<c0233c7c>] (sys_access) from [<c0101000>] (ret_fast_syscall+0x0/0x54)
[    4.412793] Exception stack(0xcf051fa8 to 0xcf051ff0)
[    4.417869] 1fa0:                   00000044 00000008 000b1c79 00000006 00000000 00000000
[    4.442827] 1fc0: 00000044 00000008 00000000 00000021 00000000 00000044 b6f28000 00000000
[    4.451041] 1fe0: 000c24a8 bed92b0c 0008e4f8 b6e9c5c6

从上面的内核日志

[    3.555581] omap2-nand 8000000.nand: uncorrectable bit-flips found
[    3.572853] ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 61 bytes from PEB 82:6144, read only 61 bytes, retry

观察到,出现了 ECC 错误,原因是 bit-flips (ECC 错误不一定仅限于 bit-flips) 。

3. 问题解决

这里先不分析问题的原因,先说如何解决的,然后从解决方案倒推问题的原因。解决方法很简单,就是通过 mkfs.ubifs 工具生成 rootfs.ubifs 时,添加了一个 -F 选项。构建 rootfs.ubifs 的完整 mkfs.ubifs 命令如下:

mkfs.ubifs -d <ROOTFS_TARGET_DIR> -F -e 0x1f000 -c 2048 -m 2048

那么 -F 选项是何方神圣?它到底施展了什么魔法,能够修正问题?先看一下 mkfs.ubifs 工具的帮助是怎么描述 -F 选项的:

$ mkfs.ubifs --help
Usage: mkfs.ubifs [OPTIONS] target
Make a UBIFS file system image from an existing directory tree......Options:
......
-F, --space-fixup        file-system free space has to be fixed up on first mount(requires kernel version 3.0 or greater)
......

看了之后是不是还是一头雾水?倒是知道了 -F 选项对内核版本提出了 3.0+ 的要求。再来看文档
UBIFS FAQ and HOWTO 里面对 -F 选项的说明:

What is the the purpose of the -F (--space-fixup) mkfs.ubifs option? Because of subtle ECC errors that can arise when programming NAND flash (see here), ubiformat is the recommended 
way of flashing a UBI image which contains a UBIFS file system. However, this is not always possible - for example, 
some embedded devices are manufactured using an industrial NAND flash programmer which has no knowledge of UBI or 
UBIFS.The -F option causes mkfs.ubifs to set a special flag in the superblock, which triggers a "free space fixup" 
procedure in the kernel the very first time the filesystem is mounted. This fixup procedure involves finding 
all empty pages in the UBIFS file system and re-erasing them. This ensures that NAND pages which contain all 
0xFF data get fully erased, which removes any problematic non-0xFF data from their OOB areas.Of course it is not possible to re-erase individual NAND pages, and entire PEBs are erased. UBIFS performs this 
procedure by reading the useful (non 0xFF'ed) contents of LEBs and then invoking the atomic LEB change UBI 
operation. Obviously, this means that UBIFS has to read and write a lot of LEBs which takes time. But this happens 
only once, and the "free space fixup" procedure then unsets the "fixup" UBIFS superblock flag.This option is supported if you are running a kernel version 3.0 or higher, or if you have pulled the changes from 
a UBIFS back-port tree. Note that ubiformat is still the preferred flashing method if the image is not being flashed 
for the first time, since it preserves existing erase counters (while using nandwrite or its equivalent does not).

简单翻一下其核心含义:

mkfs.ubifs 的 -F 选项,在 superblock 里插入一个特殊标记,指示内核在第一次挂载 ubi rootfs 时,
重新擦除所有空白页面。这样可确保完全擦除全是 0xFF 数据的 NAND 页面,以避免一些问题页面。
由于擦除动作是按块进行的,如果只需要擦除块内的某个空白页面,这样就需要先读取其它页面到内存,在内
存中做擦除操作后,再回写,这样整个过程会很好使,所以这个过程只在烧录根文件系统后的第一次,在下一
次重新烧录根文件系统之前,都不会再做空白页的擦除操作。

mkfs.ubifs-F 选项在 superblock 里插入一个特殊标记 UBIFS_FLG_SPACE_FIXUP

4. 问题分析

mkfs.ubifs-F 处理源码见补丁 [1/1] mkfs.ubifs: add “-F” option for “free-space fixup” ,从补丁代码可以看到,-F 选项导致 mkfs.ubifssuperblock 设置了 UBIFS_FLG_SPACE_FIXUP 标记。内核对 UBIFS_FLG_SPACE_FIXUP 的处理见如下代码分析:

/* fs/ubifs/super.c */ubifs_mount()ubifs_fill_super()mount_ubifs()static int mount_ubifs(struct ubifs_info *c)
{...err = ubifs_read_superblock(c); /* (1) 设置 @c->space_fixup */.../* 非只读挂载 && rootfs 镜像的 superblock 设置了 UBIFS_FLG_SPACE_FIXUP 标志 */if (!c->ro_mount && c->space_fixup) { /* (2) 【第 1 次】 烧录 ubi rootfs 镜像启动后,做 LEB 修正动作 */err = ubifs_fixup_free_space(c);}...
}
/* (1) 设置 @c->space_fixup */
int ubifs_read_superblock(struct ubifs_info *c)
{.../* 按 UBIFS_FLG_SPACE_FIXUP 设置 @c->space_fixup */c->space_fixup = !!(sup_flags & UBIFS_FLG_SPACE_FIXUP);...
}/* (2) 【第 1 次】 烧录 ubi rootfs 镜像启动后,做 LEB 修正动作 */
int ubifs_fixup_free_space(struct ubifs_info *c)
{int err;struct ubifs_sb_node *sup;ubifs_assert(c, c->space_fixup);ubifs_assert(c, !c->ro_mount);ubifs_msg(c, "start fixing up free space");err = fixup_free_space(c); /* 【第 1 次】 做 LEB(Logic Erase Block) 修正 */if (err)return err;/* 读取当前的 rootfs superblock */sup = ubifs_read_sb_node(c);if (IS_ERR(sup))return PTR_ERR(sup);/* Free-space fixup is no longer required *//* 清除 rootfs superblock 的 UBIFS_FLG_SPACE_FIXUP 标志 */c->space_fixup = 0;sup->flags &= cpu_to_le32(~UBIFS_FLG_SPACE_FIXUP);/** 将清除了 UBIFS_FLG_SPACE_FIXUP 标志 superblock 信息写回:* 这样下次启动就不会再做 fixup 动作了 。*/err = ubifs_write_sb_node(c, sup);kfree(sup);if (err)return err;...ubifs_msg(c, "free space fixup complete");return err;
}

上面的重点是 fixup_free_space() 调用,做了一些修正动作,对这一部分感兴趣的读者可自行阅读相关源码。另外,修正动作只发生在烧录 ubi rootfs第一次启动期间,第一次修正执行后就会清除 ubi rootfsUBIFS_FLG_SPACE_FIXUP,也即下次重新烧录 ubi rootfs 之前,都不会再做这个修正动作。
修正后重新烧录 rootfs 后的内核日志如下(只截取相关部分),不再有 bit-flipsECC 错误信息:

[    1.705300] omap-gpmc 50000000.gpmc: GPMC revision 6.0
[    1.710488] gpmc_mem_init: disabling cs 0 mapped at 0x0-0x1000000
[    1.718410] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xda
[    1.724923] nand: Micron MT29F2G08AAD
[    1.728603] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    1.736266] nand: using OMAP_ECC_BCH8_CODE_HW ECC scheme
[    1.741704] 11 fixed-partitions partitions found on MTD device omap2-nand.0
[    1.748720] Creating 11 MTD partitions on "omap2-nand.0":
[    1.754160] 0x000000000000-0x000000020000 : "NAND.SPL"
[    1.760419] 0x000000020000-0x000000040000 : "NAND.SPL.backup1"
[    1.767263] 0x000000040000-0x000000060000 : "NAND.SPL.backup2"
[    1.774018] 0x000000060000-0x000000080000 : "NAND.SPL.backup3"
[    1.780714] 0x000000080000-0x0000000c0000 : "NAND.u-boot-spl-os"
[    1.787773] 0x0000000c0000-0x0000001c0000 : "NAND.u-boot"
[    1.794897] 0x0000001c0000-0x0000001e0000 : "NAND.u-boot-env"
[    1.801508] 0x0000001e0000-0x000000200000 : "NAND.u-boot-env.backup1"
[    1.808887] 0x000000200000-0x000000a00000 : "NAND.kernel"
[    1.822567] 0x000000a00000-0x00000e000000 : "NAND.rootfs"
[    2.028535] 0x00000e000000-0x000010000000 : "NAND.userdata"
......
[    2.162337] ubi0: attaching mtd9
[    2.817470] ubi0: scanning is finished
[    2.841173] ubi0: volume 0 ("rootfs") re-sized from 83 to 1668 LEBs
[    2.848229] ubi0: attached mtd9 (name "NAND.rootfs", size 214 MiB)
[    2.854507] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    2.861411] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
[    2.868154] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[    2.875156] ubi0: good PEBs: 1711, bad PEBs: 1, corrupted PEBs: 0
[    2.881273] ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
[    2.888538] ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 1188901366
[    2.897719] ubi0: available PEBs: 0, total reserved PEBs: 1711, PEBs reserved for bad PEB handling: 39
[    2.907084] ubi0: background thread "ubi_bgt0d" started, PID 65
......
[    2.973019] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 66
[    3.033637] UBIFS (ubi0:0): start fixing up free space
[    5.726825] UBIFS (ubi0:0): free space fixup complete
[    5.753860] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "rootfs"
[    5.761304] UBIFS (ubi0:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[    5.792971] UBIFS (ubi0:0): FS size: 210399232 bytes (200 MiB, 1657 LEBs), journal size 9023488 bytes (8 MiB, 72 LEBs)
[    5.812884] UBIFS (ubi0:0): reserved for root: 0 bytes (0 KiB)
[    5.818746] UBIFS (ubi0:0): media format: w4/r0 (latest is w5/r0), UUID 150447CF-F29A-405C-8394-C7D00D7C2315, small LPT model
[    5.855066] VFS: Mounted root (ubifs filesystem) on device 0:14.
[    5.862233] devtmpfs: mounted

其中:

[    3.033637] UBIFS (ubi0:0): start fixing up free space
[    5.726825] UBIFS (ubi0:0): free space fixup complete

正是内核修正过程相关的日志。
本文承接前一个故事 Linux: ubi rootfs 故障案例 (1) ,感兴趣的读者可前往阅读。

5. 参考资料

[1] What is the the purpose of the -F (–space-fixup) mkfs.ubifs option?
[2] http://www.linux-mtd.infradead.org/doc/ubifs.html#L_source
[3] https://patchwork.ozlabs.org/project/linux-mtd/patch/1305147748-13632-1-git-send-email-mlcreech@gmail.com/

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/25733.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

《python程序语言设计》2018版第5章第35题求完全数,解题经历,我认为的正确代码放在最后

5.35从4月开始一直到成功&#xff0c;此文章将所有的记录和不同阶段代码展现给大家。但是没有配图&#xff0c;我最后成功的代码放在了最后。 2024.04.15 05.35.01version 求完整数&#xff0c;这个让我突然有点蒙。我什么时候能求完整数呢&#xff1f;&#xff1f; 正因子之和…

c++手写的bitset

支持stl bitset 类似的api #include <iostream> #include <vector> #include <climits> #include <utility> #include <stdexcept> #include <iterator>using namespace std;const int W 64;class Bitset { private:vector<unsigned …

vue+jave实现文件报表增加文件下载功能

需求背景:系统有文件交互功能。但没有做页面展示。为了测试方便&#xff0c;写了报表展示并可下载文件做检查。(所以下载是依赖表数据的) 使用语言和框架: 前端:vue-cli 后端:springBoot 前端实现 1、在报表vue文件&#xff0c;显示下载按钮并实现下载接口请求和处理。 //报…

网络分析(ArcPy)

一.前言 GIS中的网络分析最重要的便是纠正拓扑关系&#xff0c;建立矫正好的网络数据集&#xff0c;再进行网络分析&#xff0c;一般大家都是鼠标在arcgis上点点点&#xff0c;今天说一下Arcpy来解决的方案&#xff0c;对python的要求并不高,具体api参数查询arcgis帮助文档即可…

JavaScript 使用优先级队列的霍夫曼编码(Huffman Coding using Priority Queue)

先决条件&#xff1a; 贪婪算法 | (霍夫曼编码)、priority_queue::push() 和 C STL 中的 priority_queue::pop() 。 贪婪算法 | (霍夫曼编码)&#xff1a; C#&#xff1a;C# 霍夫曼编码 | 贪婪算法&#xff08;Huffman Coding | Greedy Algo&#xff09;-CSDN博客 JavaScr…

Java数组的定义 ,基本概念与使用

数组的定义 1.问题:想将一个数据保存起来,我们可以使用变量,但是变量一次只能存储一个数据,所以我们想能不能一次存多个数据2.数组概述:是一个容器,数组本身属于引用数据类型3.作用:一次存储多个数据4.特点:a.既可以存储基本类型的数据,还能存储引用类型的数据b.定长(定义数组…

【设计模式】结构型设计模式之 桥接模式

一、 介绍 桥接模式在《设计模式 可复用面向对象软件的基础》中定义为&#xff1a;将抽象和现实解耦&#xff0c;让他们可以独立变化。上面的定义比较难以理解&#xff0c;换个通俗的说法&#xff1a;一个类存在两个或多个独立变化的维度&#xff0c;通过组合的方式让这个类在…

C++设计模式---观察者模式

1、介绍 观察者模式&#xff08;Observer Pattern&#xff09;是一种行为设计模式&#xff0c;它定义了一种一对多的依赖关系&#xff0c;让多个观察者对象同时监听某一个主题对象。当主题对象状态发生变化时&#xff0c;它的所有依赖者&#xff08;观察者&#xff09;都会自动…

【Android面试八股文】一图展示 Android生命周期:从Activity到Fragment,以及完整的Android Fragment生命周期

图片来源于&#xff1a;https://github.com/xxv/android-lifecycle Android生命周期&#xff1a;从Activity到Fragment 图&#xff1a;android-lifecycle-activity-to-fragments.png 完整的Android Fragment生命周期 图&#xff1a;complete_android_fragment_lifecycle.png…

人脸考勤项目实训

第一章 Python-----Anaconda安装 文章目录 第一章 Python-----Anaconda安装前言一、Anaconda是什么&#xff1f;二、Anaconda的前世今生二、Windows安装步骤1.官网下载2.安装步骤安装虚拟环境 总结 前言 工欲善其事必先利其器&#xff0c;项目第一步&#xff0c;安装我们的环境…

如何使用Python pottery库

要使用Python的Pottery库,你需要按照以下步骤进行: 你可以通过pip工具来安装Pottery库。打开终端或命令提示符,输入以下命令: pip install pottery 安装完成后,你就可以开始使用Pottery库了。 在你的Python脚本中,首先需要导入Pottery库。通常,你会从pottery模块中导…

Django ListView 列表视图类

ListView是Django的通用视图之一&#xff0c;它用于显示一个对象列表。这个视图将所有的对象作为一个上下文变量传递给模板。 1&#xff0c;创建应用 python manage.py startapp app3 2&#xff0c;注册应用 Test/Test/settings.py Test/Test/urls.py 3&#xff0c;添加模型 …

【EDA】SSTA中最慢路径与最快路径统计计算

假设(X1,X2)为二元高斯随机向量,均值(μ1,μ2),标准差(σ1,σ2),相关系数ρ 定义:X=max(X1,X2),Y=min(X1,X2) SSTA中计算setup/hold的worst delay时即求X、Y,路径N对应维度为N维。 X的概率密度函数PDF为f(x)=f1(-x)+f2(-x),f1和f2为: 其中小Φ和大Φ…

牛客题目数据结构

做过线段树2模板大概可以写出一部分代码&#xff0c;这题主要关键点是怎么维护平方和 借图了 这样处理完maketag的代码就出来了 void maketag(int id,int l,int r,ll v,int opt){if(opt1){seg[id].val*v;seg[id].pfval*(v*v);seg[id].mul*v;seg[id].add*v;}else{seg[id].pfva…

仓库管理业务在WMS与ERP中如何抉择

当然&#xff0c;以下是WMS&#xff08;仓库管理系统&#xff09;与ERP&#xff08;企业资源计划&#xff09;系统在仓库管理中的主要区别和各自的优势的整理&#xff1a; 一、主要区别&#xff1a; 1. 功能范围&#xff1a; - WMS&#xff1a;专注于仓库内部运作&#xff0c;…

【机器学习】决策树模型(个人笔记)

文章目录 多样性指标基尼杂质指数&#xff08;Gini Impurity Index&#xff09;熵&#xff08;Entropy&#xff09; 决策树的应用 源代码文件请点击此处&#xff01; 多样性指标 基尼杂质指数&#xff08;Gini Impurity Index&#xff09; 若集合中包含 m m m 个元素和 n …

LeetCode1318或运算的最小翻转次数

题目描述 给你三个正整数 a、b 和 c。你可以对 a 和 b 的二进制表示进行位翻转操作&#xff0c;返回能够使按位或运算 a OR b c 成立的最小翻转次数。「位翻转操作」是指将一个数的二进制表示任何单个位上的 1 变成 0 或者 0 变成 1 。 解析 这一题就按位依次比较就行了。取这…

[C++数据结构之看懂就这一篇]图(上)

&#x1f4da;博客主页&#xff1a;Zhui_Yi_&#x1f50d;&#xff1a;上期回顾&#xff1a;JAVA面向对象&#xff08;上&#xff09;❤️感谢大家点赞&#x1f44d;&#x1f3fb;收藏⭐评论✍&#x1f3fb;&#xff0c;您的三连就是我持续更新的动力❤️&#x1f387;追当今朝…

Android 可拖拽的View,限制在父布局中随意拖拽;拖拽结束后可左右吸边;

实现方法一&#xff1a;自定义View 可随意拖动拖拽的View&#xff0c;限制拖动范围是父布局中&#xff1b; import android.content.Context; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.ViewGroup; …

Simscape Multibody与RigidBodyTree:机器人建模

RigidBodyTree&#xff1a;主要用于表示机器人刚体结构的动力学模型&#xff0c;重点关注机器人的几何结构、质量和力矩&#xff0c;以及它们如何随时间变化。它通常用于计算机器人的运动和受力情况。Simscape Multibody&#xff1a;作为Simscape的一个子模块&#xff0c;专门用…