summaryrefslogtreecommitdiff
path: root/innobase/include
diff options
context:
space:
mode:
authorunknown <heikki@hundin.mysql.fi>2004-03-16 20:55:49 +0200
committerunknown <heikki@hundin.mysql.fi>2004-03-16 20:55:49 +0200
commit217a102fa82d9f0831b16655ce28fe1cc5df41f6 (patch)
treef1556d71c0e45f7e6d5093e9acbc4c8aac4ea930 /innobase/include
parentd626b52f7fb603e27c10fa976e9998b868f1543e (diff)
downloadmariadb-git-217a102fa82d9f0831b16655ce28fe1cc5df41f6.tar.gz
ut0mem.h, ut0mem.c:
Add ut_strdup os0file.h, os0file.c: Add creation of directories innobase/os/os0file.c: Add creation of directories innobase/ut/ut0mem.c: Add ut_strdup innobase/include/os0file.h: Add creation of directories innobase/include/ut0mem.h: Add ut_strdup
Diffstat (limited to 'innobase/include')
-rw-r--r--innobase/include/os0file.h58
-rw-r--r--innobase/include/ut0mem.h9
2 files changed, 66 insertions, 1 deletions
diff --git a/innobase/include/os0file.h b/innobase/include/os0file.h
index 5f2d6e3ed21..b9bb8aafe2e 100644
--- a/innobase/include/os0file.h
+++ b/innobase/include/os0file.h
@@ -60,6 +60,7 @@ log. */
#define OS_FILE_CREATE 52
#define OS_FILE_OVERWRITE 53
#define OS_FILE_OPEN_RAW 54
+#define OS_FILE_CREATE_PATH 55
#define OS_FILE_READ_ONLY 333
#define OS_FILE_READ_WRITE 444
@@ -228,7 +229,9 @@ os_file_create_simple(
string */
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
(if does not exist, error), or OS_FILE_CREATE if a new
- file is created (if exists, error) */
+ file is created (if exists, error), or
+ OS_FILE_CREATE_PATH if new file (if exists, error) and
+ subdirectories along its path are created (if needed)*/
ulint access_type,/* in: OS_FILE_READ_ONLY or OS_FILE_READ_WRITE */
ibool* success);/* out: TRUE if succeed, FALSE if error */
/********************************************************************
@@ -421,6 +424,59 @@ os_file_write(
ulint offset_high,/* in: most significant 32 bits of
offset */
ulint n); /* in: number of bytes to write */
+/***********************************************************************
+Check the existence and type of the given file. */
+
+ibool
+os_file_status(
+/*===========*/
+ /* out: TRUE if call succeeded */
+ char * path, /* in: pathname of the file */
+ ibool * exists, /* out: TRUE if file exists */
+ os_file_type_t* type); /* out: type of the file (if it exists) */
+/********************************************************************
+The function os_file_dirname returns a directory component of a
+null-terminated pathname string. In the usual case, dirname returns
+the string up to, but not including, the final '/', and basename
+is the component following the final '/'. Trailing '/' charac­
+ters are not counted as part of the pathname.
+
+If path does not contain a slash, dirname returns the string ".".
+
+Concatenating the string returned by dirname, a "/", and the basename
+yields a complete pathname.
+
+The return value is a copy of the directory component of the pathname.
+The copy is allocated from heap. It is the caller responsibility
+to free it after it is no longer needed.
+
+The following list of examples (taken from SUSv2) shows the strings
+returned by dirname and basename for different paths:
+
+ path dirname basename
+ "/usr/lib" "/usr" "lib"
+ "/usr/" "/" "usr"
+ "usr" "." "usr"
+ "/" "/" "/"
+ "." "." "."
+ ".." "." ".."
+*/
+
+char*
+os_file_dirname(
+/*============*/
+ /* out, own: directory component of the
+ pathname */
+ char* path); /* in: pathname */
+/********************************************************************
+Creates all missing subdirectories along the given path. */
+
+ibool
+os_file_create_subdirs_if_needed(
+/*=============================*/
+ /* out: TRUE if call succeeded
+ FALSE otherwise */
+ char* path); /* in: path name */
/****************************************************************************
Initializes the asynchronous io system. Creates separate aio array for
non-ibuf read and write, a third aio array for the ibuf i/o, with just one
diff --git a/innobase/include/ut0mem.h b/innobase/include/ut0mem.h
index ce8aabeca41..b7dfe77a08e 100644
--- a/innobase/include/ut0mem.h
+++ b/innobase/include/ut0mem.h
@@ -96,6 +96,15 @@ ut_str_catenate(
char* str1, /* in: null-terminated string */
char* str2); /* in: null-terminated string */
/**************************************************************************
+Return a copy of the given string. The returned string must be freed
+using mem_free. */
+
+char*
+ut_strdup(
+/*======*/
+ /* out, own: cnull-terminated string */
+ char* str); /* in: null-terminated string */
+/**************************************************************************
Checks if a null-terminated string contains a certain character. */
ibool