nand_lock(9)
π nand_lock(9) β the Kernel API Manual page, but make it make sense π
okay so bestie, welcome to nand_lock(9) from the Kernel API Manual (section 9, the big-kid kernel-functions section, iykyk). this is like one specific little function in the MTD/NAND universe and she's actually so simple it's almost suspicious. let's get into it π
β¨ NAME β¨
nand_lock β the [MTD Interface] function that locks the NAND flash π
that's it. that's her whole job description. lock the NAND flash. main character energy, zero notes.
πΈ SYNOPSIS πΈ
int nand_lock (struct mtd_info *mtd , loff_t ofs , uint64_t len );
look at that signature, she's giving "three params and a dream" β¨ returns an int, so yeah, check your return value, bestie, that's just good manners π«Ά
π¦ ARGUMENTS π¦
three of them, and each one has a vibe:
mtdβ the MTD device structure πΎ this is your actual flash device, the thing you're locking. she's the whole reason we're here.ofsβ the offset byte address π like, where in the flash you're starting from. literal byte address, no games.lenβ the number of bytes to lock π and this one's got a rule, so listen up: it must be a multiple of block/page size. that's not a suggestion, that's the contract. if you hand it a weird number that doesn't line up, that's on you, bestie π
lowkey the len multiple-of-block/page-size thing is the one detail people forget, so likeβ¦ don't be that person π
π₯ SEE ALSO π₯
okay this section is long β she's the friend who knows literally everyone. the kernel file behind all this is ./drivers/mtd/nand/raw/nand_base.c, and here's the entire squad, no cap, not skipping a single one because every single reference matters:
nand_extract_bits(9)nand_select_target(9)nand_deselect_target(9)nand_release_device(9)nand_bbm_get_next_page(9)nand_block_bad(9)nand_region_is_secured(9)nand_get_device(9)nand_check_wp(9)nand_fill_oob(9)nand_do_write_oob(9)nand_default_block_markbad(9)nand_markbad_bbm(9)nand_block_markbad_lowlevel(9)nand_block_isreserved(9)nand_block_checkbad(9)nand_soft_waitrdy(9)nand_gpio_waitrdy(9)panic_nand_wait(9)nand_reset_interface(9)nand_setup_interface(9)nand_choose_best_sdr_timings(9)nand_choose_best_nvddr_timings(9)nand_choose_best_timings(9)nand_choose_interface_config(9)nand_fill_column_cycles(9)nand_read_page_op(9)nand_read_param_page_op(9)nand_change_read_column_op(9)nand_read_oob_op(9)nand_prog_page_begin_op(9)nand_prog_page_end_op(9)nand_prog_page_op(9)nand_change_write_column_op(9)nand_readid_op(9)nand_status_op(9)nand_exit_status_op(9)nand_erase_op(9)nand_set_features_op(9)nand_get_features_op(9)nand_reset_op(9)nand_read_data_op(9)nand_write_data_op(9)struct nand_op_parser_ctx(9)π (yes, a struct, she's fancy)nand_op_parser_must_split_instr(9)nand_op_parser_match_pat(9)nand_op_parser_exec_op(9)nand_subop_get_addr_start_off(9)nand_subop_get_num_addr_cyc(9)nand_subop_get_data_start_off(9)nand_subop_get_data_len(9)nand_reset(9)nand_get_features(9)nand_set_features(9)nand_read_page_raw_notsupp(9)nand_read_page_raw(9)nand_monolithic_read_page_raw(9)nand_read_page_raw_syndrome(9)nand_read_page_swecc(9)nand_read_subpage(9)nand_read_page_hwecc(9)nand_read_page_hwecc_oob_first(9)nand_read_page_syndrome(9)nand_transfer_oob(9)nand_setup_read_retry(9)nand_do_read_ops(9)nand_read_oob_std(9)nand_read_oob_syndrome(9)nand_write_oob_std(9)nand_write_oob_syndrome(9)nand_do_read_oob(9)nand_read_oob(9)nand_write_page_raw_notsupp(9)nand_write_page_raw(9)nand_monolithic_write_page_raw(9)nand_write_page_raw_syndrome(9)nand_write_page_swecc(9)nand_write_page_hwecc(9)nand_write_subpage_hwecc(9)nand_write_page_syndrome(9)nand_write_page(9)nand_do_write_ops(9)panic_nand_write(9)nand_write_oob(9)nand_erase(9)nand_erase_nand(9)nand_sync(9)nand_block_isbad(9)nand_block_markbad(9)nand_suspend(9)nand_resume(9)nand_shutdown(9)nand_unlock(9)rawnand_dt_parse_gpio_cs(9)nand_scan_ident(9)nand_check_ecc_caps(9)nand_match_ecc_req(9)nand_maximize_ecc(9)nand_ecc_choose_conf(9)nand_scan_tail(9)nand_scan_with_ids(9)nand_cleanup(9)
and that's the whole group chat π every one of them, exactly as written, no edits, no merges, periodt.
and that's the page!! honestly? iconic. nand_lock locks the NAND flash, takes an mtd, an offset ofs, and a len that's gotta be a multiple of block/page size, and returns an int. slay. π
β¨
mwah π this little love letter lives in ./drivers/mtd/nand/raw and she's dated October 2026 β stay charming, stay locked, and go read your return values bestie ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms