c
static int qca_generate_hsp_nvm_name(char *buf, size_t size,
                                      struct qca_btsoc_version ver, 
                                      u8 rom_ver, u16 boardid) {

    int offset = 0;

    // Copy fixed parts of filename
    offset += snprintf(buf + offset, size - offset, "qca/hsp");

    if (offset >= size) return -ENAMETOOLONG;


    // Append rom_ver and boardid, char by char, with checks
    // ... (Implementation would involve converting the numbers to chars and appending 
    //       one at a time, checking the buffer bounds at each step.) 

    return 0;
}
