as usual: @since (even typedef) ChangeLog NEWS
Vincent On Thu, Feb 23, 2012 at 12:45 PM, Enlightenment SVN <no-re...@enlightenment.org> wrote: > Log: > eina: introduce Eina_Stat to prevent issue when building with different > config option. > > > Author: cedric > Date: 2012-02-23 03:45:25 -0800 (Thu, 23 Feb 2012) > New Revision: 68315 > Trac: http://trac.enlightenment.org/e/changeset/68315 > > Modified: > trunk/eina/src/include/eina_file.h trunk/eina/src/lib/eina_file.c > > Modified: trunk/eina/src/include/eina_file.h > =================================================================== > --- trunk/eina/src/include/eina_file.h 2012-02-23 11:27:45 UTC (rev 68314) > +++ trunk/eina/src/include/eina_file.h 2012-02-23 11:45:25 UTC (rev 68315) > @@ -92,6 +92,12 @@ > typedef struct _Eina_File_Direct_Info Eina_File_Direct_Info; > > /** > + * @typedef Eina_Stat > + * A typedef to #_Eina_Stat. > + */ > +typedef struct _Eina_Stat Eina_Stat; > + > +/** > * @typedef Eina_File_Dir_List_Cb > * Type for a callback to be called when iterating over the files of a > * directory. > @@ -150,6 +156,30 @@ > }; > > /** > + * @struct _Eina_Stat > + * A structure to store informations of a path. > + */ > +struct _Eina_Stat > +{ > + unsigned long int dev; > + unsigned long int ino; > + unsigned int mode; > + unsigned int nlink; > + unsigned int uid; > + unsigned int gid; > + unsigned long int rdev; > + unsigned long int size; > + unsigned long int blksize; > + unsigned long int blocks; > + unsigned long int atime; > + unsigned long int atimensec; > + unsigned long int mtime; > + unsigned long int mtimensec; > + unsigned long int ctime; > + unsigned long int ctimensec; > +}; > + > +/** > * @def EINA_FILE_DIR_LIST_CB > * @brief cast to an #Eina_File_Dir_List_Cb. > * > @@ -262,7 +292,7 @@ > * @see eina_file_direct_ls() > * @see eina_file_stat_ls() > */ > -EAPI int eina_file_stat(void *container, Eina_File_Direct_Info *info, struct > stat *buf) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2, 3); > +EAPI int eina_file_statat(void *container, Eina_File_Direct_Info *info, > Eina_Stat *buf) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2, 3); > > /** > * @brief Get an iterator to list the content of a directory, with direct > > Modified: trunk/eina/src/lib/eina_file.c > =================================================================== > --- trunk/eina/src/lib/eina_file.c 2012-02-23 11:27:45 UTC (rev 68314) > +++ trunk/eina/src/lib/eina_file.c 2012-02-23 11:45:25 UTC (rev 68315) > @@ -362,14 +362,14 @@ > static Eina_Bool > _eina_file_stat_ls_iterator_next(Eina_File_Direct_Iterator *it, void **data) > { > - struct stat st; > + Eina_Stat st; > > if (!_eina_file_direct_ls_iterator_next(it, data)) > return EINA_FALSE; > > if (it->info.type == EINA_FILE_UNKNOWN) > { > - if (eina_file_stat(it->dirp, &it->info, &st) != 0) > + if (eina_file_statat(it->dirp, &it->info, &st) != 0) > it->info.type = EINA_FILE_UNKNOWN; > } > > @@ -1276,20 +1276,21 @@ > } > > EAPI int > -eina_file_stat(void *container, Eina_File_Direct_Info *info, struct stat > *buf) > +eina_file_statat(void *container, Eina_File_Direct_Info *info, Eina_Stat *st) > { > + struct stat buf; > #ifdef HAVE_FSTATAT > int fd; > #endif > > EINA_SAFETY_ON_NULL_RETURN_VAL(info, -1); > - EINA_SAFETY_ON_NULL_RETURN_VAL(buf, -1); > + EINA_SAFETY_ON_NULL_RETURN_VAL(st, -1); > > #ifdef HAVE_FSTATAT > fd = dirfd(container); > - if (fstatat(fd, info->path + info->name_start, buf, 0)) > + if (fstatat(fd, info->path + info->name_start, &buf, 0)) > #else > - if (stat(info->path, buf)) > + if (stat(info->path, &buf)) > #endif > { > if (info->type != EINA_FILE_LNK) > @@ -1299,23 +1300,51 @@ > > if (info->type == EINA_FILE_UNKNOWN) > { > - if (S_ISREG(buf->st_mode)) > + if (S_ISREG(buf.st_mode)) > info->type = EINA_FILE_REG; > - else if (S_ISDIR(buf->st_mode)) > + else if (S_ISDIR(buf.st_mode)) > info->type = EINA_FILE_DIR; > - else if (S_ISCHR(buf->st_mode)) > + else if (S_ISCHR(buf.st_mode)) > info->type = EINA_FILE_CHR; > - else if (S_ISBLK(buf->st_mode)) > + else if (S_ISBLK(buf.st_mode)) > info->type = EINA_FILE_BLK; > - else if (S_ISFIFO(buf->st_mode)) > + else if (S_ISFIFO(buf.st_mode)) > info->type = EINA_FILE_FIFO; > - else if (S_ISLNK(buf->st_mode)) > + else if (S_ISLNK(buf.st_mode)) > info->type = EINA_FILE_LNK; > - else if (S_ISSOCK(buf->st_mode)) > + else if (S_ISSOCK(buf.st_mode)) > info->type = EINA_FILE_SOCK; > else > info->type = EINA_FILE_UNKNOWN; > } > > + st->dev = buf.st_dev; > + st->ino = buf.st_ino; > + st->mode = buf.st_mode; > + st->nlink = buf.st_nlink; > + st->uid = buf.st_uid; > + st->gid = buf.st_gid; > + st->rdev = buf.st_rdev; > + st->size = buf.st_size; > + st->blksize = buf.st_blksize; > + st->blocks = buf.st_blocks; > + st->atime = buf.st_atime; > + st->mtime = buf.st_mtime; > + st->ctime = buf.st_ctime; > +#ifdef _STAT_VER_LINUX > +# if (defined __USE_MISC && defined st_mtime) > + st->atimensec = buf.st_atim.tv_nsec; > + st->mtimensec = buf.st_mtim.tv_nsec; > + st->ctimensec = buf.st_ctim.tv_nsec; > +# else > + st->atimensec = buf.st_atimensec; > + st->mtimensec = buf.st_mtimensec; > + st->ctimensec = buf.st_ctimensec; > +# endif > +#else > + st->atimensec = 0; > + st->mtimensec = 0; > + st->ctimensec = 0; > +#endif > return 0; > } > > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > enlightenment-svn mailing list > enlightenment-...@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel