do_otp_lock(9)
π
do_otp_lock β a Kernel API Manual moment (that's the manual name btw, Kernel API Manual, and we're in section 9, kernel API, iykyk)
okay so bestie, picture this: it's a kernel function, it's section 9, and it's got [DEFAULT] energy in the name line because it's literally tagged that way. Let's get into it π«Ά
β¨ NAME β¨
do_otp_lock β [DEFAULT] Lock OTP block area. that's it, that's the whole vibe. it locks the OTP block area. iconic, honestly π₯
πΈ SYNOPSIS πΈ
int do_otp_lock (struct mtd_info *mtd , loff_t from , size_t len ,
size_t *retlen , u_char *buf );
five arguments, one int coming back at you. she's got a signature and she's not afraid to use it π
π ARGUMENTS π
mtdβ the MTD device structure. your actual flash device bestie, the whole point of the operation.fromβ the offset to lock. where the lock starts π¦lenβ number of bytes to lock. how much of it we're locking down, fr fr.retlenβ pointer to variable to store the number of lock bytes. so like, she writes back how many bytes actually got locked, through this pointer β¨bufβ the databuffer to put/get data. yes it says put/get, both, that's literally what the original says, don't come for me π
π DESCRIPTION π
Lock OTP block area.
no cap, that's the entire description β short, sweet, and absolutely serving main character energy. she locks the OTP block area, she does it well, and she doesn't over-explain herself π
π SEE ALSO π
the kernel file ./drivers/mtd/nand/onenand/onenand_base.c is where this lives, and here's the full squad she runs with β every single one, no skipping:
onenand_readw(9)onenand_writew(9)onenand_block_address(9)onenand_bufferram_address(9)onenand_page_address(9)onenand_buffer_address(9)flexonenand_block(9)flexonenand_addr(9)onenand_get_density(9)flexonenand_region(9)onenand_command(9)onenand_read_ecc(9)onenand_wait(9)onenand_bufferram_offset(9)onenand_read_bufferram(9)onenand_sync_read_bufferram(9)onenand_write_bufferram(9)onenand_get_2x_blockpage(9)onenand_check_bufferram(9)onenand_update_bufferram(9)onenand_invalidate_bufferram(9)onenand_get_device(9)onenand_release_device(9)onenand_transfer_auto_oob(9)onenand_recover_lsb(9)onenand_mlc_read_ops_nolock(9)onenand_read_ops_nolock(9)onenand_read_oob_nolock(9)onenand_read_oob(9)onenand_bbt_wait(9)onenand_bbt_read_oob(9)onenand_verify_oob(9)onenand_verify(9)onenand_panic_write(9)onenand_fill_auto_oob(9)onenand_write_ops_nolock(9)onenand_write_oob_nolock(9)onenand_write_oob(9)onenand_block_isbad_nolock(9)onenand_multiblock_erase(9)onenand_block_by_block_erase(9)onenand_erase(9)onenand_sync(9)onenand_block_isbad(9)onenand_default_block_markbad(9)onenand_block_markbad(9)onenand_do_lock_cmd(9)onenand_lock(9)onenand_unlock(9)onenand_check_lock_status(9)onenand_unlock_all(9)onenand_otp_command(9)onenand_otp_write_oob_nolock(9)do_otp_read(9)do_otp_write(9)onenand_otp_walk(9)onenand_get_fact_prot_info(9)onenand_read_fact_prot_reg(9)onenand_get_user_prot_info(9)onenand_read_user_prot_reg(9)onenand_write_user_prot_reg(9)onenand_lock_user_prot_reg(9)onenand_check_features(9)onenand_print_device_info(9)onenand_check_maf(9)flexonenand_get_boundary(9)flexonenand_get_size(9)flexonenand_check_blocks_erased(9)onenand_chip_probe(9)onenand_probe(9)onenand_suspend(9)onenand_resume(9)onenand_scan(9)onenand_release(9)
that's a whole friend group and they all ate ππ
ok but fr fr, peek at yourretlenandbufbefore you call this β those are pointers, and pointers without somewhere real to point are giving undefined behaviour energy π treat them right!
mwah, that's the page! π§ this one ships out of ./drivers/mtd/nand/onenand and it's dated October 2026, so mark your calendars bestie β she's from the future and she's still locking OTP block areas πβ¨
π¦ 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