Eneboo - Documentación para desarrolladores
src/libmysql_std/include/my_dir.h
Ir a la documentación de este archivo.
00001 /* Copyright (C) 2000 MySQL AB
00002 
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; version 2 of the License.
00006 
00007    This program is distributed in the hope that it will be useful,
00008    but WITHOUT ANY WARRANTY; without even the implied warranty of
00009    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010    GNU General Public License for more details.
00011 
00012    You should have received a copy of the GNU General Public License
00013    along with this program; if not, write to the Free Software
00014    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
00015 
00016 #ifndef _my_dir_h
00017 #define _my_dir_h
00018 #ifdef  __cplusplus
00019 extern "C" {
00020 #endif
00021 
00022 #ifndef MY_DIR_H
00023 #define MY_DIR_H
00024 
00025 #include <sys/stat.h>
00026 
00027         /* Defines for my_dir and my_stat */
00028 
00029 #define MY_S_IFMT       S_IFMT  /* type of file */
00030 #define MY_S_IFDIR      S_IFDIR /* directory */
00031 #define MY_S_IFCHR      S_IFCHR /* character special */
00032 #define MY_S_IFBLK      S_IFBLK /* block special */
00033 #define MY_S_IFREG      S_IFREG /* regular */
00034 #define MY_S_IFIFO      S_IFIFO /* fifo */
00035 #define MY_S_ISUID      S_ISUID /* set user id on execution */
00036 #define MY_S_ISGID      S_ISGID /* set group id on execution */
00037 #define MY_S_ISVTX      S_ISVTX /* save swapped text even after use */
00038 #define MY_S_IREAD      S_IREAD /* read permission, owner */
00039 #define MY_S_IWRITE     S_IWRITE        /* write permission, owner */
00040 #define MY_S_IEXEC      S_IEXEC /* execute/search permission, owner */
00041 
00042 #define MY_S_ISDIR(m)   (((m) & MY_S_IFMT) == MY_S_IFDIR)
00043 #define MY_S_ISCHR(m)   (((m) & MY_S_IFMT) == MY_S_IFCHR)
00044 #define MY_S_ISBLK(m)   (((m) & MY_S_IFMT) == MY_S_IFBLK)
00045 #define MY_S_ISREG(m)   (((m) & MY_S_IFMT) == MY_S_IFREG)
00046 #define MY_S_ISFIFO(m)  (((m) & MY_S_IFMT) == MY_S_IFIFO)
00047 
00048 #define MY_DONT_SORT    512     /* my_lib; Don't sort files */
00049 #define MY_WANT_STAT    1024    /* my_lib; stat files */
00050 
00051         /* typedefs for my_dir & my_stat */
00052 
00053 #ifdef USE_MY_STAT_STRUCT
00054 
00055 typedef struct my_stat
00056 {
00057   dev_t         st_dev;         /* major & minor device numbers */
00058   ino_t         st_ino;         /* inode number */
00059   ushort        st_mode;        /* file permissons (& suid sgid .. bits) */
00060   short         st_nlink;       /* number of links to file */
00061   ushort        st_uid;         /* user id */
00062   ushort        st_gid;         /* group id */
00063   dev_t         st_rdev;        /* more major & minor device numbers (???) */
00064   off_t         st_size;        /* size of file */
00065   time_t        st_atime;       /* time for last read */
00066   time_t        st_mtime;       /* time for last contens modify */
00067   time_t        st_ctime;       /* time for last inode or contents modify */
00068 } MY_STAT;
00069 
00070 #else
00071 
00072 #define MY_STAT struct stat     /* Orginal struct have what we need */
00073 
00074 #endif /* USE_MY_STAT_STRUCT */
00075 
00076 /* Struct describing one file returned from my_dir */
00077 typedef struct fileinfo
00078 {
00079   char                  *name;
00080   MY_STAT               *mystat;
00081 } FILEINFO;
00082 
00083 typedef struct st_my_dir        /* Struct returned from my_dir */
00084 {
00085   /*
00086     These members are just copies of parts of DYNAMIC_ARRAY structure, 
00087     which is allocated right after the end of MY_DIR structure (MEM_ROOT
00088     for storing names is also resides there). We've left them here because
00089     we don't want to change code that uses my_dir.
00090   */
00091   struct fileinfo       *dir_entry;
00092   uint                  number_off_files;
00093 } MY_DIR;
00094 
00095 extern MY_DIR *my_dir(const char *path,myf MyFlags);
00096 extern void my_dirend(MY_DIR *buffer);
00097 extern MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags);
00098 extern int my_fstat(int filenr, MY_STAT *stat_area, myf MyFlags);
00099 
00100 #endif /* MY_DIR_H */
00101 
00102 #ifdef  __cplusplus
00103 }
00104 #endif
00105 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'