@@ -676,16 +676,16 @@ void AfterScanDir(uv_fs_t* req) {
676676}
677677
678678
679- // This struct is only used on sync fs calls.
679+ // This class is only used on sync fs calls.
680680// For async calls FSReqWrap is used.
681- class fs_req_wrap {
681+ class FSReqWrapSync {
682682 public:
683- fs_req_wrap () {}
684- ~fs_req_wrap () { uv_fs_req_cleanup (&req); }
683+ FSReqWrapSync () {}
684+ ~FSReqWrapSync () { uv_fs_req_cleanup (&req); }
685685 uv_fs_t req;
686686
687687 private:
688- DISALLOW_COPY_AND_ASSIGN (fs_req_wrap );
688+ DISALLOW_COPY_AND_ASSIGN (FSReqWrapSync );
689689};
690690
691691// Returns nullptr if the operation fails from the start.
@@ -729,7 +729,7 @@ inline FSReqBase* AsyncCall(Environment* env,
729729// creating an error in the C++ land.
730730// ctx must be checked using value->IsObject() before being passed.
731731template <typename Func, typename ... Args>
732- inline int SyncCall (Environment* env, Local<Value> ctx, fs_req_wrap * req_wrap,
732+ inline int SyncCall (Environment* env, Local<Value> ctx, FSReqWrapSync * req_wrap,
733733 const char * syscall, Func fn, Args... args) {
734734 env->PrintSyncTrace ();
735735 int err = fn (env->event_loop (), &(req_wrap->req ), args..., nullptr );
@@ -775,7 +775,7 @@ void Access(const FunctionCallbackInfo<Value>& args) {
775775 uv_fs_access, *path, mode);
776776 } else { // access(path, mode, undefined, ctx)
777777 CHECK_EQ (argc, 4 );
778- fs_req_wrap req_wrap;
778+ FSReqWrapSync req_wrap;
779779 SyncCall (env, args[3 ], &req_wrap, " access" , uv_fs_access, *path, mode);
780780 }
781781}
@@ -796,7 +796,7 @@ void Close(const FunctionCallbackInfo<Value>& args) {
796796 uv_fs_close, fd);
797797 } else { // close(fd, undefined, ctx)
798798 CHECK_EQ (argc, 3 );
799- fs_req_wrap req_wrap;
799+ FSReqWrapSync req_wrap;
800800 SyncCall (env, args[2 ], &req_wrap, " close" , uv_fs_close, fd);
801801 }
802802}
@@ -904,7 +904,7 @@ static void Stat(const FunctionCallbackInfo<Value>& args) {
904904 uv_fs_stat, *path);
905905 } else { // stat(path, undefined, ctx)
906906 CHECK_EQ (argc, 3 );
907- fs_req_wrap req_wrap;
907+ FSReqWrapSync req_wrap;
908908 int err = SyncCall (env, args[2 ], &req_wrap, " stat" , uv_fs_stat, *path);
909909 if (err == 0 ) {
910910 FillStatsArray (env->fs_stats_field_array (),
@@ -928,7 +928,7 @@ static void LStat(const FunctionCallbackInfo<Value>& args) {
928928 uv_fs_lstat, *path);
929929 } else { // lstat(path, undefined, ctx)
930930 CHECK_EQ (argc, 3 );
931- fs_req_wrap req_wrap;
931+ FSReqWrapSync req_wrap;
932932 int err = SyncCall (env, args[2 ], &req_wrap, " lstat" , uv_fs_lstat, *path);
933933 if (err == 0 ) {
934934 FillStatsArray (env->fs_stats_field_array (),
@@ -952,7 +952,7 @@ static void FStat(const FunctionCallbackInfo<Value>& args) {
952952 uv_fs_fstat, fd);
953953 } else { // fstat(fd, undefined, ctx)
954954 CHECK_EQ (argc, 3 );
955- fs_req_wrap req_wrap;
955+ FSReqWrapSync req_wrap;
956956 int err = SyncCall (env, args[2 ], &req_wrap, " fstat" , uv_fs_fstat, fd);
957957 if (err == 0 ) {
958958 FillStatsArray (env->fs_stats_field_array (),
@@ -981,7 +981,7 @@ static void Symlink(const FunctionCallbackInfo<Value>& args) {
981981 AfterNoArgs, uv_fs_symlink, *target, *path, flags);
982982 } else { // symlink(target, path, flags, undefinec, ctx)
983983 CHECK_EQ (argc, 5 );
984- fs_req_wrap req;
984+ FSReqWrapSync req;
985985 SyncCall (env, args[4 ], &req, " symlink" ,
986986 uv_fs_symlink, *target, *path, flags);
987987 }
@@ -1005,7 +1005,7 @@ static void Link(const FunctionCallbackInfo<Value>& args) {
10051005 AfterNoArgs, uv_fs_link, *src, *dest);
10061006 } else { // link(src, dest)
10071007 CHECK_EQ (argc, 4 );
1008- fs_req_wrap req;
1008+ FSReqWrapSync req;
10091009 SyncCall (env, args[3 ], &req, " link" ,
10101010 uv_fs_link, *src, *dest);
10111011 }
@@ -1028,7 +1028,7 @@ static void ReadLink(const FunctionCallbackInfo<Value>& args) {
10281028 uv_fs_readlink, *path);
10291029 } else {
10301030 CHECK_EQ (argc, 4 );
1031- fs_req_wrap req;
1031+ FSReqWrapSync req;
10321032 int err = SyncCall (env, args[3 ], &req, " readlink" ,
10331033 uv_fs_readlink, *path);
10341034 if (err < 0 ) {
@@ -1068,7 +1068,7 @@ static void Rename(const FunctionCallbackInfo<Value>& args) {
10681068 UTF8, AfterNoArgs, uv_fs_rename, *old_path, *new_path);
10691069 } else {
10701070 CHECK_EQ (argc, 4 );
1071- fs_req_wrap req;
1071+ FSReqWrapSync req;
10721072 SyncCall (env, args[3 ], &req, " rename" , uv_fs_rename, *old_path, *new_path);
10731073 }
10741074}
@@ -1091,7 +1091,7 @@ static void FTruncate(const FunctionCallbackInfo<Value>& args) {
10911091 uv_fs_ftruncate, fd, len);
10921092 } else {
10931093 CHECK_EQ (argc, 4 );
1094- fs_req_wrap req;
1094+ FSReqWrapSync req;
10951095 SyncCall (env, args[3 ], &req, " ftruncate" , uv_fs_ftruncate, fd, len);
10961096 }
10971097}
@@ -1111,7 +1111,7 @@ static void Fdatasync(const FunctionCallbackInfo<Value>& args) {
11111111 uv_fs_fdatasync, fd);
11121112 } else {
11131113 CHECK_EQ (argc, 3 );
1114- fs_req_wrap req;
1114+ FSReqWrapSync req;
11151115 SyncCall (env, args[2 ], &req, " fdatasync" , uv_fs_fdatasync, fd);
11161116 }
11171117}
@@ -1131,7 +1131,7 @@ static void Fsync(const FunctionCallbackInfo<Value>& args) {
11311131 uv_fs_fsync, fd);
11321132 } else {
11331133 CHECK_EQ (argc, 3 );
1134- fs_req_wrap req;
1134+ FSReqWrapSync req;
11351135 SyncCall (env, args[2 ], &req, " fsync" , uv_fs_fsync, fd);
11361136 }
11371137}
@@ -1151,7 +1151,7 @@ static void Unlink(const FunctionCallbackInfo<Value>& args) {
11511151 uv_fs_unlink, *path);
11521152 } else {
11531153 CHECK_EQ (argc, 3 );
1154- fs_req_wrap req;
1154+ FSReqWrapSync req;
11551155 SyncCall (env, args[2 ], &req, " unlink" , uv_fs_unlink, *path);
11561156 }
11571157}
@@ -1171,7 +1171,7 @@ static void RMDir(const FunctionCallbackInfo<Value>& args) {
11711171 uv_fs_rmdir, *path);
11721172 } else { // rmdir(path, undefined, ctx)
11731173 CHECK_EQ (argc, 3 );
1174- fs_req_wrap req_wrap;
1174+ FSReqWrapSync req_wrap;
11751175 SyncCall (env, args[2 ], &req_wrap, " rmdir" ,
11761176 uv_fs_rmdir, *path);
11771177 }
@@ -1195,7 +1195,7 @@ static void MKDir(const FunctionCallbackInfo<Value>& args) {
11951195 uv_fs_mkdir, *path, mode);
11961196 } else { // mkdir(path, mode, undefined, ctx)
11971197 CHECK_EQ (argc, 4 );
1198- fs_req_wrap req_wrap;
1198+ FSReqWrapSync req_wrap;
11991199 SyncCall (env, args[3 ], &req_wrap, " mkdir" ,
12001200 uv_fs_mkdir, *path, mode);
12011201 }
@@ -1218,7 +1218,7 @@ static void RealPath(const FunctionCallbackInfo<Value>& args) {
12181218 uv_fs_realpath, *path);
12191219 } else { // realpath(path, encoding, undefined, ctx)
12201220 CHECK_EQ (argc, 4 );
1221- fs_req_wrap req_wrap;
1221+ FSReqWrapSync req_wrap;
12221222 int err = SyncCall (env, args[3 ], &req_wrap, " realpath" ,
12231223 uv_fs_realpath, *path);
12241224 if (err < 0 ) {
@@ -1259,7 +1259,7 @@ static void ReadDir(const FunctionCallbackInfo<Value>& args) {
12591259 uv_fs_scandir, *path, 0 /* flags*/ );
12601260 } else { // readdir(path, encoding, undefined, ctx)
12611261 CHECK_EQ (argc, 4 );
1262- fs_req_wrap req_wrap;
1262+ FSReqWrapSync req_wrap;
12631263 int err = SyncCall (env, args[3 ], &req_wrap, " scandir" ,
12641264 uv_fs_scandir, *path, 0 /* flags*/ );
12651265 if (err < 0 ) {
@@ -1343,7 +1343,7 @@ static void Open(const FunctionCallbackInfo<Value>& args) {
13431343 uv_fs_open, *path, flags, mode);
13441344 } else { // open(path, flags, mode, undefined, ctx)
13451345 CHECK_EQ (argc, 5 );
1346- fs_req_wrap req_wrap;
1346+ FSReqWrapSync req_wrap;
13471347 int result = SyncCall (env, args[4 ], &req_wrap, " open" ,
13481348 uv_fs_open, *path, flags, mode);
13491349 args.GetReturnValue ().Set (result);
@@ -1371,7 +1371,7 @@ static void OpenFileHandle(const FunctionCallbackInfo<Value>& args) {
13711371 uv_fs_open, *path, flags, mode);
13721372 } else { // openFileHandle(path, flags, mode, undefined, ctx)
13731373 CHECK_EQ (argc, 5 );
1374- fs_req_wrap req_wrap;
1374+ FSReqWrapSync req_wrap;
13751375 int result = SyncCall (env, args[4 ], &req_wrap, " open" ,
13761376 uv_fs_open, *path, flags, mode);
13771377 if (result < 0 ) {
@@ -1405,7 +1405,7 @@ static void CopyFile(const FunctionCallbackInfo<Value>& args) {
14051405 uv_fs_copyfile, *src, *dest, flags);
14061406 } else { // copyFile(src, dest, flags, undefined, ctx)
14071407 CHECK_EQ (argc, 5 );
1408- fs_req_wrap req_wrap;
1408+ FSReqWrapSync req_wrap;
14091409 SyncCall (env, args[4 ], &req_wrap, " copyfile" ,
14101410 uv_fs_copyfile, *src, *dest, flags);
14111411 }
@@ -1456,7 +1456,7 @@ static void WriteBuffer(const FunctionCallbackInfo<Value>& args) {
14561456 uv_fs_write, fd, &uvbuf, 1 , pos);
14571457 } else { // write(fd, buffer, off, len, pos, undefined, ctx)
14581458 CHECK_EQ (argc, 7 );
1459- fs_req_wrap req_wrap;
1459+ FSReqWrapSync req_wrap;
14601460 int bytesWritten = SyncCall (env, args[6 ], &req_wrap, " write" ,
14611461 uv_fs_write, fd, &uvbuf, 1 , pos);
14621462 args.GetReturnValue ().Set (bytesWritten);
@@ -1499,7 +1499,7 @@ static void WriteBuffers(const FunctionCallbackInfo<Value>& args) {
14991499 uv_fs_write, fd, *iovs, iovs.length (), pos);
15001500 } else { // writeBuffers(fd, chunks, pos, undefined, ctx)
15011501 CHECK_EQ (argc, 5 );
1502- fs_req_wrap req_wrap;
1502+ FSReqWrapSync req_wrap;
15031503 int bytesWritten = SyncCall (env, args[4 ], &req_wrap, " write" ,
15041504 uv_fs_write, fd, *iovs, iovs.length (), pos);
15051505 args.GetReturnValue ().Set (bytesWritten);
@@ -1578,7 +1578,7 @@ static void WriteString(const FunctionCallbackInfo<Value>& args) {
15781578 }
15791579 } else { // write(fd, string, pos, enc, undefined, ctx)
15801580 CHECK_EQ (argc, 6 );
1581- fs_req_wrap req_wrap;
1581+ FSReqWrapSync req_wrap;
15821582 FSReqBase::FSReqBuffer stack_buffer;
15831583 if (buf == nullptr ) {
15841584 len = StringBytes::StorageSize (env->isolate (), value, enc);
@@ -1643,7 +1643,7 @@ static void Read(const FunctionCallbackInfo<Value>& args) {
16431643 uv_fs_read, fd, &uvbuf, 1 , pos);
16441644 } else { // read(fd, buffer, offset, len, pos, undefined, ctx)
16451645 CHECK_EQ (argc, 7 );
1646- fs_req_wrap req_wrap;
1646+ FSReqWrapSync req_wrap;
16471647 const int bytesRead = SyncCall (env, args[6 ], &req_wrap, " read" ,
16481648 uv_fs_read, fd, &uvbuf, 1 , pos);
16491649 args.GetReturnValue ().Set (bytesRead);
@@ -1672,7 +1672,7 @@ static void Chmod(const FunctionCallbackInfo<Value>& args) {
16721672 uv_fs_chmod, *path, mode);
16731673 } else { // chmod(path, mode, undefined, ctx)
16741674 CHECK_EQ (argc, 4 );
1675- fs_req_wrap req_wrap;
1675+ FSReqWrapSync req_wrap;
16761676 SyncCall (env, args[3 ], &req_wrap, " chmod" ,
16771677 uv_fs_chmod, *path, mode);
16781678 }
@@ -1700,7 +1700,7 @@ static void FChmod(const FunctionCallbackInfo<Value>& args) {
17001700 uv_fs_fchmod, fd, mode);
17011701 } else { // fchmod(fd, mode, undefined, ctx)
17021702 CHECK_EQ (argc, 4 );
1703- fs_req_wrap req_wrap;
1703+ FSReqWrapSync req_wrap;
17041704 SyncCall (env, args[3 ], &req_wrap, " fchmod" ,
17051705 uv_fs_fchmod, fd, mode);
17061706 }
@@ -1731,7 +1731,7 @@ static void Chown(const FunctionCallbackInfo<Value>& args) {
17311731 uv_fs_chown, *path, uid, gid);
17321732 } else { // chown(path, uid, gid, undefined, ctx)
17331733 CHECK_EQ (argc, 5 );
1734- fs_req_wrap req_wrap;
1734+ FSReqWrapSync req_wrap;
17351735 SyncCall (env, args[4 ], &req_wrap, " chown" ,
17361736 uv_fs_chown, *path, uid, gid);
17371737 }
@@ -1762,7 +1762,7 @@ static void FChown(const FunctionCallbackInfo<Value>& args) {
17621762 uv_fs_fchown, fd, uid, gid);
17631763 } else { // fchown(fd, uid, gid, undefined, ctx)
17641764 CHECK_EQ (argc, 5 );
1765- fs_req_wrap req_wrap;
1765+ FSReqWrapSync req_wrap;
17661766 SyncCall (env, args[4 ], &req_wrap, " fchown" ,
17671767 uv_fs_fchown, fd, uid, gid);
17681768 }
@@ -1790,7 +1790,7 @@ static void UTimes(const FunctionCallbackInfo<Value>& args) {
17901790 uv_fs_utime, *path, atime, mtime);
17911791 } else { // utimes(path, atime, mtime, undefined, ctx)
17921792 CHECK_EQ (argc, 5 );
1793- fs_req_wrap req_wrap;
1793+ FSReqWrapSync req_wrap;
17941794 SyncCall (env, args[4 ], &req_wrap, " utime" ,
17951795 uv_fs_utime, *path, atime, mtime);
17961796 }
@@ -1817,7 +1817,7 @@ static void FUTimes(const FunctionCallbackInfo<Value>& args) {
18171817 uv_fs_futime, fd, atime, mtime);
18181818 } else { // futimes(fd, atime, mtime, undefined, ctx)
18191819 CHECK_EQ (argc, 5 );
1820- fs_req_wrap req_wrap;
1820+ FSReqWrapSync req_wrap;
18211821 SyncCall (env, args[4 ], &req_wrap, " futime" ,
18221822 uv_fs_futime, fd, atime, mtime);
18231823 }
@@ -1840,7 +1840,7 @@ static void Mkdtemp(const FunctionCallbackInfo<Value>& args) {
18401840 uv_fs_mkdtemp, *tmpl);
18411841 } else { // mkdtemp(tmpl, encoding, undefined, ctx)
18421842 CHECK_EQ (argc, 4 );
1843- fs_req_wrap req_wrap;
1843+ FSReqWrapSync req_wrap;
18441844 SyncCall (env, args[3 ], &req_wrap, " mkdtemp" ,
18451845 uv_fs_mkdtemp, *tmpl);
18461846 const char * path = static_cast <const char *>(req_wrap.req .path );
0 commit comments