1
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
3
This library is free software; you can redistribute it and/or
4
modify it under the terms of the GNU Library General Public
5
License as published by the Free Software Foundation; either
6
version 2 of the License, or (at your option) any later version.
8
This library is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
Library General Public License for more details.
13
You should have received a copy of the GNU Library General Public
14
License along with this library; if not, write to the Free
15
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
29
/* Defines for my_dir and my_stat */
31
#define MY_S_IFMT S_IFMT /* type of file */
32
#define MY_S_IFDIR S_IFDIR /* directory */
33
#define MY_S_IFCHR S_IFCHR /* character special */
34
#define MY_S_IFBLK S_IFBLK /* block special */
35
#define MY_S_IFREG S_IFREG /* regular */
36
#define MY_S_IFIFO S_IFIFO /* fifo */
37
#define MY_S_ISUID S_ISUID /* set user id on execution */
38
#define MY_S_ISGID S_ISGID /* set group id on execution */
39
#define MY_S_ISVTX S_ISVTX /* save swapped text even after use */
40
#define MY_S_IREAD S_IREAD /* read permission, owner */
41
#define MY_S_IWRITE S_IWRITE /* write permission, owner */
42
#define MY_S_IEXEC S_IEXEC /* execute/search permission, owner */
44
#define MY_S_ISDIR(m) (((m) & MY_S_IFMT) == MY_S_IFDIR)
45
#define MY_S_ISCHR(m) (((m) & MY_S_IFMT) == MY_S_IFCHR)
46
#define MY_S_ISBLK(m) (((m) & MY_S_IFMT) == MY_S_IFBLK)
47
#define MY_S_ISREG(m) (((m) & MY_S_IFMT) == MY_S_IFREG)
48
#define MY_S_ISFIFO(m) (((m) & MY_S_IFMT) == MY_S_IFIFO)
50
#define MY_DONT_SORT 512 /* my_lib; Don't sort files */
51
#define MY_WANT_STAT 1024 /* my_lib; stat files */
53
/* typedefs for my_dir & my_stat */
55
#ifdef USE_MY_STAT_STRUCT
57
typedef struct my_stat
59
dev_t st_dev; /* major & minor device numbers */
60
ino_t st_ino; /* inode number */
61
ushort st_mode; /* file permissons (& suid sgid .. bits) */
62
short st_nlink; /* number of links to file */
63
ushort st_uid; /* user id */
64
ushort st_gid; /* group id */
65
dev_t st_rdev; /* more major & minor device numbers (???) */
66
off_t st_size; /* size of file */
67
time_t st_atime; /* time for last read */
68
time_t st_mtime; /* time for last contens modify */
69
time_t st_ctime; /* time for last inode or contents modify */
74
#define MY_STAT struct stat /* Orginal struct have what we need */
76
#endif /* USE_MY_STAT_STRUCT */
78
typedef struct fileinfo /* Struct returned from my_dir & my_stat */
84
typedef struct st_my_dir /* Struct returned from my_dir */
86
struct fileinfo *dir_entry;
87
uint number_off_files;
90
extern MY_DIR *my_dir(const char *path,myf MyFlags);
91
extern void my_dirend(MY_DIR *buffer);
92
extern MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags);
93
extern int my_fstat(int filenr, MY_STAT *stat_area, myf MyFlags);