MySQL  8.0.27
Source Code Documentation
my_dir.h
Go to the documentation of this file.
1 /* Copyright (c) 2000, 2021, Oracle and/or its affiliates.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License, version 2.0,
5  as published by the Free Software Foundation.
6 
7  This program is also distributed with certain software (including
8  but not limited to OpenSSL) that is licensed under separate terms,
9  as designated in a particular file or component or in included license
10  documentation. The authors of MySQL hereby grant you an additional
11  permission to link the program and your derivative works with the
12  separately licensed software that they have included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef MY_DIR_H
24 #define MY_DIR_H
25 
26 /**
27  @file include/my_dir.h
28 */
29 
30 #include <fcntl.h>
31 #include <sys/stat.h>
32 #include <sys/types.h>
33 
34 #include "my_inttypes.h"
35 
36 /* Defines for my_dir and my_stat */
37 
38 #ifdef _WIN32
39 #define S_IROTH _S_IREAD
40 #define S_IFIFO _S_IFIFO
41 #endif
42 
43 #define MY_S_IFMT S_IFMT /* type of file */
44 #define MY_S_IFDIR S_IFDIR /* directory */
45 #define MY_S_IFCHR S_IFCHR /* character special */
46 #define MY_S_IFBLK S_IFBLK /* block special */
47 #define MY_S_IFREG S_IFREG /* regular */
48 #define MY_S_IFIFO S_IFIFO /* fifo */
49 #define MY_S_ISUID S_ISUID /* set user id on execution */
50 #define MY_S_ISGID S_ISGID /* set group id on execution */
51 #define MY_S_ISVTX S_ISVTX /* save swapped text even after use */
52 #define MY_S_IREAD S_IREAD /* read permission, owner */
53 #define MY_S_IWRITE S_IWRITE /* write permission, owner */
54 #define MY_S_IEXEC S_IEXEC /* execute/search permission, owner */
55 
56 #define MY_S_ISDIR(m) (((m)&MY_S_IFMT) == MY_S_IFDIR)
57 #define MY_S_ISCHR(m) (((m)&MY_S_IFMT) == MY_S_IFCHR)
58 #define MY_S_ISBLK(m) (((m)&MY_S_IFMT) == MY_S_IFBLK)
59 #define MY_S_ISREG(m) (((m)&MY_S_IFMT) == MY_S_IFREG)
60 #define MY_S_ISFIFO(m) (((m)&MY_S_IFMT) == MY_S_IFIFO)
61 
62 #define MY_DONT_SORT 512 /* my_lib; Don't sort files */
63 #define MY_WANT_STAT 1024 /* my_lib; stat files */
64 
65 /* typedefs for my_dir & my_stat */
66 
67 #ifdef _WIN32
68 #define MY_STAT struct _stati64 /* 64 bit file size */
69 #else
70 #define MY_STAT struct stat /* Orginal struct have what we need */
71 #endif
72 
73 /* Struct describing one file returned from my_dir */
74 typedef struct fileinfo {
75  char *name;
78 
79 struct MY_DIR /* Struct returned from my_dir */
80 {
81  /*
82  These members are just copies of parts of Prealloced_array structure,
83  which is allocated right after the end of MY_DIR structure (MEM_ROOT
84  for storing names is also resides there). We've left them here because
85  we don't want to change code that uses my_dir.
86  */
89 };
90 
91 extern MY_DIR *my_dir(const char *path, myf MyFlags);
92 extern void my_dirend(MY_DIR *buffer);
93 extern MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags);
94 extern int my_fstat(int filenr, MY_STAT *stat_area);
95 
96 #endif /* MY_DIR_H */
int my_fstat(int filenr, MY_STAT *stat_area)
Definition: my_lib.cc:292
#define MY_STAT
Definition: my_dir.h:70
MY_STAT * my_stat(const char *path, MY_STAT *stat_area, myf my_flags)
Definition: my_lib.cc:302
void my_dirend(MY_DIR *buffer)
Definition: my_lib.cc:68
struct fileinfo FILEINFO
MY_DIR * my_dir(const char *path, myf MyFlags)
Definition: my_lib.cc:84
Some integer typedefs for easier portability.
int myf
Definition: my_inttypes.h:93
static char * path
Definition: mysqldump.cc:130
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:391
Definition: my_dir.h:80
uint number_off_files
Definition: my_dir.h:88
struct fileinfo * dir_entry
Definition: my_dir.h:87
Definition: my_dir.h:74
char * name
Definition: my_dir.h:75
MY_STAT * mystat
Definition: my_dir.h:76
unsigned int uint
Definition: uca-dump.cc:29