diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-03-21 19:20:44 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-03-21 19:20:44 +0100 |
commit | 09a2107b1b2f5567b8a50afec9e54a33284c6233 (patch) | |
tree | a9f544eb24b6b5ec510fa580cd997356671996d3 /include | |
parent | bbf0c9d4c35034c8634cd9607712d94fac089127 (diff) | |
parent | 0d622bed4f1a1484af747840c39325c67d7767d4 (diff) | |
download | mariadb-git-09a2107b1b2f5567b8a50afec9e54a33284c6233.tar.gz |
Merge branch '10.0' into 10.1
Diffstat (limited to 'include')
-rw-r--r-- | include/my_sys.h | 3 | ||||
-rw-r--r-- | include/mysql/psi/mysql_file.h | 44 |
2 files changed, 45 insertions, 2 deletions
diff --git a/include/my_sys.h b/include/my_sys.h index 6d4faeb5c6a..7480514dc08 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -646,8 +646,7 @@ extern File my_create_with_symlink(const char *linkname, const char *filename, myf MyFlags); extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags); extern int my_symlink(const char *content, const char *linkname, myf MyFlags); -extern int my_handler_delete_with_symlink(PSI_file_key key, const char *name, - const char *ext, myf sync_dir); +extern int my_handler_delete_with_symlink(const char *filename, myf sync_dir); extern size_t my_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags); extern size_t my_pread(File Filedes,uchar *Buffer,size_t Count,my_off_t offset, diff --git a/include/mysql/psi/mysql_file.h b/include/mysql/psi/mysql_file.h index aca66bd4974..2f388c285bf 100644 --- a/include/mysql/psi/mysql_file.h +++ b/include/mysql/psi/mysql_file.h @@ -442,6 +442,20 @@ #endif /** + @def mysql_file_delete_with_symlink(K, P1, P2, P3) + Instrumented delete with symbolic link. + @c mysql_file_delete_with_symlink is a replacement + for @c my_handler_delete_with_symlink. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_delete_with_symlink(K, P1, P2, P3) \ + inline_mysql_file_delete_with_symlink(K, __FILE__, __LINE__, P1, P2, P3) +#else + #define mysql_file_delete_with_symlink(K, P1, P2, P3) \ + inline_mysql_file_delete_with_symlink(P1, P2, P3) +#endif + +/** @def mysql_file_rename_with_symlink(K, P1, P2, P3) Instrumented rename with symbolic link. @c mysql_file_rename_with_symlink is a replacement @@ -1294,6 +1308,7 @@ inline_mysql_file_rename( return result; } + static inline File inline_mysql_file_create_with_symlink( #ifdef HAVE_PSI_FILE_INTERFACE @@ -1325,6 +1340,35 @@ inline_mysql_file_create_with_symlink( static inline int +inline_mysql_file_delete_with_symlink( +#ifdef HAVE_PSI_FILE_INTERFACE + PSI_file_key key, const char *src_file, uint src_line, +#endif + const char *name, const char *ext, myf flags) +{ + int result; + char buf[FN_REFLEN]; + char *fullname= fn_format(buf, name, "", ext, MY_UNPACK_FILENAME | MY_APPEND_EXT); +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_name_locker) + (&state, key, PSI_FILE_DELETE, fullname, &locker); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line); + result= my_handler_delete_with_symlink(fullname, flags); + PSI_FILE_CALL(end_file_close_wait)(locker, result); + return result; + } +#endif + + result= my_handler_delete_with_symlink(fullname, flags); + return result; +} + + +static inline int inline_mysql_file_rename_with_symlink( #ifdef HAVE_PSI_FILE_INTERFACE PSI_file_key key, const char *src_file, uint src_line, |