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