MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / my_sync_dir

Function my_sync_dir

mysys/my_sync.c:135–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133#ifdef NEED_EXPLICIT_SYNC_DIR
134
135int my_sync_dir(const char *dir_name, myf my_flags)
136{
137 File dir_fd;
138 int res= 0;
139 const char *correct_dir_name;
140 DBUG_ENTER("my_sync_dir");
141 DBUG_PRINT("my",("Dir: '%s' my_flags: %d", dir_name, my_flags));
142 /* Sometimes the path does not contain an explicit directory */
143 correct_dir_name= (dir_name[0] == 0) ? cur_dir_name : dir_name;
144 /*
145 Syncing a dir may give EINVAL on tmpfs on Linux, which is ok.
146 EIO on the other hand is very important. Hence MY_IGNORE_BADFD.
147 */
148 if ((dir_fd= my_open(correct_dir_name, O_RDONLY, MYF(my_flags))) >= 0)
149 {
150 if (my_sync(dir_fd, MYF(my_flags | MY_IGNORE_BADFD)))
151 res= 2;
152 if (my_close(dir_fd, MYF(my_flags)))
153 res= 3;
154 }
155 else
156 res= 1;
157 DBUG_RETURN(res);
158}
159
160#else /* NEED_EXPLICIT_SYNC_DIR */
161

Callers 2

my_rename.cFile · 0.85
my_sync_dir_by_fileFunction · 0.85

Calls 3

my_openFunction · 0.85
my_syncFunction · 0.85
my_closeFunction · 0.85

Tested by

no test coverage detected