win: remove unnecessary inlining from fs.c
Refs: https://github.com/libuv/libuv/issues/4819
This commit is contained in:
parent
55f5fce1cc
commit
30f872c6c2
72
src/win/fs.c
72
src/win/fs.c
@ -167,9 +167,10 @@ typedef enum {
|
|||||||
FS__STAT_PATH_TRY_SLOW
|
FS__STAT_PATH_TRY_SLOW
|
||||||
} fs__stat_path_return_t;
|
} fs__stat_path_return_t;
|
||||||
|
|
||||||
INLINE static void fs__stat_assign_statbuf_null(uv_stat_t* statbuf);
|
static void fs__stat_assign_statbuf_null(uv_stat_t* statbuf);
|
||||||
INLINE static void fs__stat_assign_statbuf(uv_stat_t* statbuf,
|
static void fs__stat_assign_statbuf(uv_stat_t* statbuf,
|
||||||
FILE_STAT_BASIC_INFORMATION stat_info, int do_lstat);
|
FILE_STAT_BASIC_INFORMATION stat_info,
|
||||||
|
int do_lstat);
|
||||||
|
|
||||||
|
|
||||||
void uv__fs_init(void) {
|
void uv__fs_init(void) {
|
||||||
@ -182,9 +183,9 @@ void uv__fs_init(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
INLINE static int fs__readlink_handle(HANDLE handle,
|
static int fs__readlink_handle(HANDLE handle,
|
||||||
char** target_ptr,
|
char** target_ptr,
|
||||||
size_t* target_len_ptr) {
|
size_t* target_len_ptr) {
|
||||||
char buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
|
char buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
|
||||||
REPARSE_DATA_BUFFER* reparse_data = (REPARSE_DATA_BUFFER*) buffer;
|
REPARSE_DATA_BUFFER* reparse_data = (REPARSE_DATA_BUFFER*) buffer;
|
||||||
WCHAR* w_target;
|
WCHAR* w_target;
|
||||||
@ -319,8 +320,10 @@ INLINE static int fs__readlink_handle(HANDLE handle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
INLINE static int fs__capture_path(uv_fs_t* req, const char* path,
|
static int fs__capture_path(uv_fs_t* req,
|
||||||
const char* new_path, const int copy_path) {
|
const char* path,
|
||||||
|
const char* new_path,
|
||||||
|
const int copy_path) {
|
||||||
WCHAR* buf;
|
WCHAR* buf;
|
||||||
WCHAR* pos;
|
WCHAR* pos;
|
||||||
size_t buf_sz = 0;
|
size_t buf_sz = 0;
|
||||||
@ -394,8 +397,10 @@ INLINE static int fs__capture_path(uv_fs_t* req, const char* path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
INLINE static void uv__fs_req_init(uv_loop_t* loop, uv_fs_t* req,
|
static void uv__fs_req_init(uv_loop_t* loop,
|
||||||
uv_fs_type fs_type, const uv_fs_cb cb) {
|
uv_fs_t* req,
|
||||||
|
uv_fs_type fs_type,
|
||||||
|
const uv_fs_cb cb) {
|
||||||
uv__once_init();
|
uv__once_init();
|
||||||
UV_REQ_INIT(req, UV_FS);
|
UV_REQ_INIT(req, UV_FS);
|
||||||
req->loop = loop;
|
req->loop = loop;
|
||||||
@ -1698,8 +1703,9 @@ void fs__closedir(uv_fs_t* req) {
|
|||||||
SET_REQ_RESULT(req, 0);
|
SET_REQ_RESULT(req, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE static fs__stat_path_return_t fs__stat_path(WCHAR* path,
|
static fs__stat_path_return_t fs__stat_path(WCHAR* path,
|
||||||
uv_stat_t* statbuf, int do_lstat) {
|
uv_stat_t* statbuf,
|
||||||
|
int do_lstat) {
|
||||||
FILE_STAT_BASIC_INFORMATION stat_info;
|
FILE_STAT_BASIC_INFORMATION stat_info;
|
||||||
|
|
||||||
/* Check if the new fast API is available. */
|
/* Check if the new fast API is available. */
|
||||||
@ -1735,8 +1741,7 @@ INLINE static fs__stat_path_return_t fs__stat_path(WCHAR* path,
|
|||||||
return FS__STAT_PATH_SUCCESS;
|
return FS__STAT_PATH_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf,
|
static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf, int do_lstat) {
|
||||||
int do_lstat) {
|
|
||||||
size_t target_length = 0;
|
size_t target_length = 0;
|
||||||
FILE_FS_DEVICE_INFORMATION device_info;
|
FILE_FS_DEVICE_INFORMATION device_info;
|
||||||
FILE_ALL_INFORMATION file_info;
|
FILE_ALL_INFORMATION file_info;
|
||||||
@ -1827,7 +1832,7 @@ INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE static void fs__stat_assign_statbuf_null(uv_stat_t* statbuf) {
|
static void fs__stat_assign_statbuf_null(uv_stat_t* statbuf) {
|
||||||
memset(statbuf, 0, sizeof(uv_stat_t));
|
memset(statbuf, 0, sizeof(uv_stat_t));
|
||||||
statbuf->st_mode = _S_IFCHR;
|
statbuf->st_mode = _S_IFCHR;
|
||||||
statbuf->st_mode |= (_S_IREAD | _S_IWRITE) | ((_S_IREAD | _S_IWRITE) >> 3) |
|
statbuf->st_mode |= (_S_IREAD | _S_IWRITE) | ((_S_IREAD | _S_IWRITE) >> 3) |
|
||||||
@ -1837,8 +1842,9 @@ INLINE static void fs__stat_assign_statbuf_null(uv_stat_t* statbuf) {
|
|||||||
statbuf->st_rdev = FILE_DEVICE_NULL << 16;
|
statbuf->st_rdev = FILE_DEVICE_NULL << 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE static void fs__stat_assign_statbuf(uv_stat_t* statbuf,
|
static void fs__stat_assign_statbuf(uv_stat_t* statbuf,
|
||||||
FILE_STAT_BASIC_INFORMATION stat_info, int do_lstat) {
|
FILE_STAT_BASIC_INFORMATION stat_info,
|
||||||
|
int do_lstat) {
|
||||||
statbuf->st_dev = stat_info.VolumeSerialNumber.LowPart;
|
statbuf->st_dev = stat_info.VolumeSerialNumber.LowPart;
|
||||||
|
|
||||||
/* Todo: st_mode should probably always be 0666 for everyone. We might also
|
/* Todo: st_mode should probably always be 0666 for everyone. We might also
|
||||||
@ -1943,7 +1949,7 @@ INLINE static void fs__stat_assign_statbuf(uv_stat_t* statbuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
INLINE static void fs__stat_prepare_path(WCHAR* pathw) {
|
static void fs__stat_prepare_path(WCHAR* pathw) {
|
||||||
size_t len = wcslen(pathw);
|
size_t len = wcslen(pathw);
|
||||||
|
|
||||||
if (len > 1 && pathw[len - 2] != L':' &&
|
if (len > 1 && pathw[len - 2] != L':' &&
|
||||||
@ -1952,8 +1958,10 @@ INLINE static void fs__stat_prepare_path(WCHAR* pathw) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE static DWORD fs__stat_directory(WCHAR* path, uv_stat_t* statbuf,
|
static DWORD fs__stat_directory(WCHAR* path,
|
||||||
int do_lstat, DWORD ret_error) {
|
uv_stat_t* statbuf,
|
||||||
|
int do_lstat,
|
||||||
|
DWORD ret_error) {
|
||||||
HANDLE handle = INVALID_HANDLE_VALUE;
|
HANDLE handle = INVALID_HANDLE_VALUE;
|
||||||
FILE_STAT_BASIC_INFORMATION stat_info;
|
FILE_STAT_BASIC_INFORMATION stat_info;
|
||||||
FILE_ID_FULL_DIR_INFORMATION dir_info;
|
FILE_ID_FULL_DIR_INFORMATION dir_info;
|
||||||
@ -2126,9 +2134,9 @@ cleanup:
|
|||||||
return ret_error;
|
return ret_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE static DWORD fs__stat_impl_from_path(WCHAR* path,
|
static DWORD fs__stat_impl_from_path(WCHAR* path,
|
||||||
int do_lstat,
|
int do_lstat,
|
||||||
uv_stat_t* statbuf) {
|
uv_stat_t* statbuf) {
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
DWORD flags;
|
DWORD flags;
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
@ -2173,7 +2181,7 @@ INLINE static DWORD fs__stat_impl_from_path(WCHAR* path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
INLINE static void fs__stat_impl(uv_fs_t* req, int do_lstat) {
|
static void fs__stat_impl(uv_fs_t* req, int do_lstat) {
|
||||||
DWORD error;
|
DWORD error;
|
||||||
|
|
||||||
error = fs__stat_impl_from_path(req->file.pathw, do_lstat, &req->statbuf);
|
error = fs__stat_impl_from_path(req->file.pathw, do_lstat, &req->statbuf);
|
||||||
@ -2196,7 +2204,7 @@ INLINE static void fs__stat_impl(uv_fs_t* req, int do_lstat) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
INLINE static int fs__fstat_handle(int fd, HANDLE handle, uv_stat_t* statbuf) {
|
static int fs__fstat_handle(int fd, HANDLE handle, uv_stat_t* statbuf) {
|
||||||
DWORD file_type;
|
DWORD file_type;
|
||||||
|
|
||||||
/* Each file type is processed differently. */
|
/* Each file type is processed differently. */
|
||||||
@ -2272,7 +2280,7 @@ static void fs__rename(uv_fs_t* req) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
INLINE static void fs__sync_impl(uv_fs_t* req) {
|
static void fs__sync_impl(uv_fs_t* req) {
|
||||||
int fd = req->file.fd;
|
int fd = req->file.fd;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
@ -2578,7 +2586,7 @@ fchmod_cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
INLINE static int fs__utime_handle(HANDLE handle, double atime, double mtime) {
|
static int fs__utime_handle(HANDLE handle, double atime, double mtime) {
|
||||||
FILETIME filetime_as, *filetime_a = &filetime_as;
|
FILETIME filetime_as, *filetime_a = &filetime_as;
|
||||||
FILETIME filetime_ms, *filetime_m = &filetime_ms;
|
FILETIME filetime_ms, *filetime_m = &filetime_ms;
|
||||||
FILETIME now;
|
FILETIME now;
|
||||||
@ -2606,10 +2614,10 @@ INLINE static int fs__utime_handle(HANDLE handle, double atime, double mtime) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE static DWORD fs__utime_impl_from_path(WCHAR* path,
|
static DWORD fs__utime_impl_from_path(WCHAR* path,
|
||||||
double atime,
|
double atime,
|
||||||
double mtime,
|
double mtime,
|
||||||
int do_lutime) {
|
int do_lutime) {
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
DWORD flags;
|
DWORD flags;
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
@ -2639,7 +2647,7 @@ INLINE static DWORD fs__utime_impl_from_path(WCHAR* path,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE static void fs__utime_impl(uv_fs_t* req, int do_lutime) {
|
static void fs__utime_impl(uv_fs_t* req, int do_lutime) {
|
||||||
DWORD error;
|
DWORD error;
|
||||||
|
|
||||||
error = fs__utime_impl_from_path(req->file.pathw,
|
error = fs__utime_impl_from_path(req->file.pathw,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user