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