首页 > 代码库 > 解决fastboot刷机内存消耗问题

解决fastboot刷机内存消耗问题

Windows实现方案及代码:

//add by hthevoid *mmap_file(const char *fn, unsigned *_sz){    HANDLE    file;    HANDLE    mapfile;    char     *data;    DWORD     sz;    file = CreateFile( fn,                       GENERIC_READ,                       FILE_SHARE_READ,                       NULL,                       OPEN_EXISTING,                       0,                       NULL );    if (file == INVALID_HANDLE_VALUE)        return NULL;    sz = GetFileSize( file, NULL );    data      = http://www.mamicode.com/NULL;"load_file: could not allocate %ld bytes\n", sz );            sz = 0;        }     }	    CloseHandle( file );    *_sz = (unsigned) sz;    return  data;}

 Linux实现方案及代码:

//add by hthevoid *mmap_file(const char *fn, unsigned *_sz){    char *data;    int sz;    int fd;    int errno_tmp;    data = http://www.mamicode.com/0;>

 

解决fastboot刷机内存消耗问题