use time32_t consistently in xfsdump tree
PATCH 1/1 use time32_t consistently in xfsdump tree
xfsdump stores time_t as 32-bits in its dump and inventory structures for portability/historical reasons. xfsinvutil uses time_t directly, leading to some strange results on systems which have a 64-bit time_t.
The 32-bit time-related functions were factored out into their own file since they are now used by xfsinvutil, and their original file (util.c) could not easily be linked with xfsinvutil due to dependencies on many other dump/restore modules.
--- .gitignore | 3 +++ common/Makefile | 2 +- common/util.c | 20 -------------------- common/util.h | 11 ----------- dump/Makefile | 2 ++ dump/content.c | 1 + inventory/inv_stobj.c | 2 +- invutil/Makefile | 5 ++++- invutil/cmenu.c | 4 ++-- invutil/cmenu.h | 2 +- invutil/fstab.c | 2 +- invutil/fstab.h | 2 +- invutil/invidx.c | 32 ++++++-------------------------- invutil/invidx.h | 3 +-- invutil/invutil.c | 45 +++++++++++++++++++++++++++------------------ invutil/invutil.h | 10 +++++----- invutil/stobj.c | 5 +++-- invutil/stobj.h | 2 +- restore/Makefile | 2 ++ restore/content.c | 4 ++-- 20 files changed, 64 insertions(+), 95 deletions(-)
common/Makefile +1 -1
@@ -14,7 +14,7 @@ LSRCFILES = arch_xlate.c arch_xlate.h \ main.c media.c media.h media_rmvtape.h mlog.c mlog.h \ namreg.c namreg.h openutil.c openutil.h path.c path.h qlock.c qlock.h \ rec_hdr.h ring.c ring.h sproc.c sproc.h stream.c \ - stream.h ts_mtio.h types.h util.c util.h + stream.h timeutil.h timeutil.c ts_mtio.h types.h util.c util.h default install install-dev :
common/util.c +0 -20
@@ -22,7 +22,6 @@#include <sys/stat.h> #include <sys/ioctl.h> -#include <time.h> #include <fcntl.h> #include <errno.h> #include <dirent.h>
@@ -508,25 +507,6 @@ diriter( jdm_fshandle_t *fshandlep, } } -char * -ctime32 (const time32_t *timep) -{ -time_t t = (time_t) *timep; -return ctime (&t); -} - -char * -ctimennl (const time32_t *clockp ) -{ -char *p =ctime32 ( clockp ); - -if ( p &&strlen ( p ) >0 ) { - p[strlen ( p ) -1 ] =0 ; - } - -return p; -} -int cvtnum (int blocksize,char *s ) {
common/util.h +0 -11
@@ -146,17 +146,6 @@ extern intgen_t diriter( jdm_fshandle_t size_t usrgdsz ); - -/* ctimennl - ctime(3C) with newline removed -*/ -extern char *ctimennl (const time32_t *clockp ); - -/* ctime32 - takes a time32_t instead of a time_t -*/ -extern char *ctime32 (const time32_t *timep ); - - -/* fold_t - a character string made to look like a "fold here" */ #define FOLD_LEN 79
dump/Makefile +2 -0
@@ -26,6 +26,7 @@ COMMINCL = \ qlock.h \ ring.h \ stream.h \ + timeutil.h \ ts_mtio.h \ types.h \ util.h \
@@ -66,6 +67,7 @@ COMMON = \ path.c \ ring.c \ stream.c \ + timeutil.c \ util.c \ sproc.c
dump/content.c +1 -0
@@ -42,6 +42,7 @@#include "exit.h" #include "types.h" #include "path.h" +#include "timeutil.h" #include "util.h" #include "lock.h" #include "qlock.h"
inventory/inv_stobj.c +1 -1
@@ -28,7 +28,7 @@#include <sys/mman.h> #include "types.h" -#include "util.h" +#include "timeutil.h" #include "mlog.h" #include "inv_priv.h" #include "arch_xlate.h"
invutil/Makefile +4 -1
@@ -8,7 +8,7 @@ include $(TOPDIR)/include/builddefs COMMINCL = \ global.h \ mlog.h \ - util.h \ + timeutil.h \ types.h INVINCL = \
@@ -18,6 +18,9 @@ INVINCL = \ INVCOMMON = \ inv_files.c +COMMON = \ + timeutil.c + CURSESCOMMON = \ cmenu.c \ fstab.c \
invutil/invidx.c +6 -26
@@ -32,6 +32,7 @@#include "list.h" #include "invidx.h" #include "stobj.h" +#include "timeutil.h" invidx_fileinfo_t *invidx_file;int invidx_numfiles;
@@ -418,27 +419,6 @@ delete_stobj_entries(int fd, int deletep }int -find_invidx_insert_point (int fd,time_t sh_time) -{ -int i; -invt_counter_t cnt; -invt_entry_t tmpentry; - -lseek (fd,0 ,SEEK_SET ); -read_n_bytes (fd, (char *)&cnt,sizeof (cnt),"invidx file" ); - -for (i =0 ; i < cnt.ic_curnum; i++) { -read_n_bytes (fd, (char *)&tmpentry,sizeof (tmpentry),"invidx file" ); -if (tmpentry.ie_timeperiod.tp_start <= sh_time - && tmpentry.ie_timeperiod.tp_end >= sh_time) { -break ; - } - } - -return i; -} - -int find_stobj_insert_point (int fd,invt_seshdr_t *hdr) {int i;
@@ -462,8 +442,8 @@ int update_invidx_entry(int fd, char *filename, int stobj_fd) { int i; -time_t start_time; -time_t end_time; +time32_t start_time; +time32_t end_time;invt_counter_t cnt;invt_seshdr_t hdr;invt_sescounter_t sescnt;
@@ -718,11 +698,11 @@ invidx_highlight(WINDOW *win, node_t *cusnprintf (txt,sizeof (txt),"path: %s" , invtentry->ie_filename);put_info_line (1 , txt); -snprintf (txt,sizeof (txt),"start: %s" ,ctime ((time_t *)&invtentry->ie_timeperiod.tp_start)); +snprintf (txt,sizeof (txt),"start: %s" ,ctime32 (&invtentry->ie_timeperiod.tp_start)); txt[strlen (txt) -1 ] ='\0' ;put_info_line (2 , txt); -snprintf (txt,sizeof (txt),"end: %s" ,ctime ((time_t *)&invtentry->ie_timeperiod.tp_end)); +snprintf (txt,sizeof (txt),"end: %s" ,ctime32 (&invtentry->ie_timeperiod.tp_end)); txt[strlen (txt) -1 ] ='\0' ;put_info_line (3 , txt);
@@ -757,7 +737,7 @@ invidx_undelete(WINDOW *win, node_t *cur/*ARGSUSED*/ int -invidx_prune (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list) +invidx_prune (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list) {data_t *d;invt_entry_t *invidx_entry;
invutil/invutil.c +27 -18
152 lines not on this page · raw message
invutil/stobj.c +3 -2
@@ -27,6 +27,7 @@#include "getopt.h" #include "invutil.h" +#include "timeutil.h" #include "cmenu.h" #include "list.h" #include "stobj.h"
@@ -184,7 +185,7 @@ stobjsess_highlight(WINDOW *win, node_tsnprintf (txt,sizeof (txt),"pruned: %s, flags: %#x, time: %s" , (stobjhdr->sh_pruned ==BOOL_TRUE ) ?"yes" :"no" , stobjhdr->sh_flag, -ctime ((time_t *)&(stobjhdr->sh_time))); +ctime32 (&(stobjhdr->sh_time))); txt[strlen (txt)-1 ] ='\0' ;put_info_line (1 , txt);
@@ -291,7 +292,7 @@ stobj_select(WINDOW *win, node_t *curren/*ARGSUSED*/ int -stobj_prune (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list) +stobj_prune (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list) {data_t *d;stobjsess_t *stobj;
restore/Makefile +2 -0
@@ -27,6 +27,7 @@ COMMINCL = \ ring.h \ sproc.h \ stream.h \ + timeutil.h \ ts_mtio.h \ types.h \ util.h
@@ -65,6 +66,7 @@ COMMON = \ ring.c \ sproc.c \ stream.c \ + timeutil.c \ util.c LOCALS = \
restore/content.c +2 -2
@@ -37,6 +37,7 @@#include <malloc.h> #include "types.h" +#include "timeutil.h" #include "util.h" #include "cldmgr.h" #include "qlock.h"
@@ -9347,7 +9348,6 @@ display_dump_label( bool_t lockpr,char dump_string_uuid[UUID_STR_LEN +1 ];char media_string_uuid[UUID_STR_LEN +1 ];char fs_string_uuid[UUID_STR_LEN +1 ]; -time_t gh_timestamp = (time_t )grhdrp->gh_timestamp;ASSERT ( scrhdrp->cih_level >=0 );ASSERT ( scrhdrp->cih_level <10 );
@@ -9376,7 +9376,7 @@ display_dump_label( bool_t lockpr, crhdrp->ch_fsdevice );mlog ( mllevel |MLOG_NOLOCK ,_ ("session time: %s" ), -ctime_r ( &gh_timestamp, dateline )); +ctime32_r ( &grhdrp->gh_timestamp, dateline )); mlog( mllevel | MLOG_NOLOCK, _("level: %s%s\n"), level_string,
.gitignore +3 -0
@@ -85,6 +85,7 @@ dump/rec_hdr.h dump/ring.[ch] dump/sproc.[ch] dump/stream.[ch] +dump/timeutil.[ch] dump/ts_mtio.h dump/types.h dump/util.[ch]
@@ -94,6 +95,7 @@ invutil/inv_files.c invutil/inv_priv.h invutil/inventory.h invutil/mlog.h +invutil/timeutil.[ch] invutil/types.h invutil/util.h
@@ -131,6 +133,7 @@ restore/rec_hdr.h restore/ring.[ch] restore/sproc.[ch] restore/stream.[ch] +restore/timeutil.[ch] restore/ts_mtio.h restore/types.h restore/util.[ch]
invutil/cmenu.c +2 -2
@@ -470,7 +470,7 @@ list_undelete(node_t *current, node_t *l }int -list_prune (node_t *menulist,char *mountpt,uuid_t *uuidp,time_t prunetime) +list_prune (node_t *menulist,char *mountpt,uuid_t *uuidp,time32_t prunetime) {node_t *n;data_t *d;
@@ -565,7 +565,7 @@ create_windows() }int -invutil_interactive (char *inv_path,char *mountpt,uuid_t *uuidp,time_t timeSecs) +invutil_interactive (char *inv_path,char *mountpt,uuid_t *uuidp,time32_t timeSecs) {int keyc;node_t *menulist;
invutil/cmenu.h +1 -1
@@ -55,7 +55,7 @@ typedef struct menu_ops_s {int (* op_highlight ) (WINDOW *win,node_t *current,node_t *list);int (* op_unhighlight ) (WINDOW *win,node_t *current,node_t *list);int (* op_commit ) (WINDOW *win,node_t *current,node_t *list); -int (* op_prune ) (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list); +int (* op_prune ) (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list); } menu_ops_t; typedef struct {
invutil/fstab.c +1 -1
@@ -172,7 +172,7 @@ fstab_highlight(WINDOW *win, node_t *cur/*ARGSUSED*/ int -fstab_prune (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list) +fstab_prune (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list) {data_t *d;invt_fstab_t *fstabentry;
invutil/fstab.h +1 -1
@@ -33,6 +33,6 @@ int find_matching_fstab(int fidx, invt_fint fstab_select (WINDOW *win,node_t *current,node_t *list);int fstab_highlight (WINDOW *win,node_t *current,node_t *list);int fstab_commit (WINDOW *win,node_t *current,node_t *list); -int fstab_prune (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list); +int fstab_prune (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list);#endif /* FSTAB_H */
invutil/invidx.h +1 -2
@@ -33,7 +33,6 @@ void *remmap_invidx(int fidx, int num);int find_matching_stobjfile (char *filename);int find_matching_invidxfile (char *filename);int find_overlapping_invidx (int fidx,invt_entry_t *inv_entry); -int find_invidx_insert_point (int fd,time_t sh_time);int find_invidx_insert_pos (int fidx,invt_entry_t *inv_entry);char *get_inventry_stobjfile (data_t *d);node_t *find_invidx_node (node_t *list,int inv_fileidx);
@@ -47,6 +46,6 @@ int invidx_undelete(WINDOW *win, node_tint invidx_select (WINDOW *win,node_t *current,node_t *list);int invidx_highlight (WINDOW *win,node_t *current,node_t *list);int invidx_commit (WINDOW *win,node_t *current,node_t *list); -int invidx_prune (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list); +int invidx_prune (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list);#endif /* INVIDX_H */
invutil/invutil.h +5 -5
@@ -44,12 +44,12 @@ extern bool_t wait_for_locks;char *GetFstabFullPath (char *);char *GetNameOfInvIndex (char *,uuid_t );char *GetNameOfStobj (char *inv_path,char *filename); -void CheckAndPruneFstab (char *,bool_t ,char *,uuid_t *,time_t ,char *); -int CheckAndPruneInvIndexFile (bool_t ,char *,time_t ,char *); -int CheckAndPruneStObjFile (bool_t ,char *,time_t ,char *); +void CheckAndPruneFstab (char *,bool_t ,char *,uuid_t *,time32_t ,char *); +int CheckAndPruneInvIndexFile (bool_t ,char *,time32_t ,char *); +int CheckAndPruneStObjFile (bool_t ,char *,time32_t ,char *);int uses_specified_mf_label (invt_seshdr_t *,invt_session_t *,char *,char *); -time_t ParseDate (char *); +time32_t ParseDate (char *);void usage (void );int open_and_lock (char *,Open_t ,uint );void read_n_bytes (int ,void *,size_t ,char *);
@@ -58,7 +58,7 @@ void * mmap_n_bytes(int, size_t, bool_t,void ListFstab (void );int ListInvIndexFile (char *);int ListStObjFile (char *); -int invutil_interactive (char *,char *,uuid_t *,time_t timeSecs); +int invutil_interactive (char *,char *,uuid_t *,time32_t timeSecs);int mntpnt_equal (char *s1,char *s2);#endif /* INVUTIL_H */
invutil/stobj.h +1 -1
@@ -33,7 +33,7 @@ int stobjstrm_highlight(WINDOW *win, nodint stobjmed_highlight (WINDOW *win,node_t *current,node_t *list);int stobj_select (WINDOW *win,node_t *current,node_t *list);int stobjsess_commit (WINDOW *win,node_t *current,node_t *list); -int stobj_prune (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list); +int stobj_prune (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list);int stobj_undelete (WINDOW *win,node_t *current,node_t *list);int stobjmed_commit (WINDOW *win,node_t *current,node_t *list);int stobjstrm_commit (WINDOW *win,node_t *current,node_t *list);
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 10 lines · Bill Kendall
xfsdump stores
time_tas 32-bits in its dump and inventory structures for portability/historical reasons. xfsinvutil usestime_tdirectly, leading to some strange results on systems which have a 64-bittime_t.The 32-bit time-related functions were factored out into their own file since they are now used by xfsinvutil, and their original file (
util.c) could not easily be linked with xfsinvutil due to dependencies on many other dump/restore modules.
The newly created timeutil.[ch] did not get included into the patch, so I can't easily review them, and the rest of the patch also seems whitespace mangled to me.
The changes in it looks good, just the time_t to time32_t conversions plus overflow checks.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 12 lines · Christoph Hellwig
Quoted 10 lines · Bill Kendall
xfsdump stores
time_tas 32-bits in its dump and inventory structures for portability/historical reasons. xfsinvutil usestime_tdirectly, leading to some strange results on systems which have a 64-bittime_t.The 32-bit time-related functions were factored out into their own file since they are now used by xfsinvutil, and their original file (
util.c) could not easily be linked with xfsinvutil due to dependencies on many other dump/restore modules.
Quoted 6 lines
The newly created timeutil.[ch] did not get included into the patch, so I can't easily review them, and the rest of the patch also seems whitespace mangled to me.
The changes in it looks good, just the
time_ttotime32_tconversions plus overflow checks.
Reposting with timeutil.[ch] and whitespace fixups.
---
common/Makefile +1 -1
@@ -14,7 +14,7 @@ LSRCFILES = arch_xlate.c arch_xlate.h \ main.c media.c media.h media_rmvtape.h mlog.c mlog.h \ namreg.c namreg.h openutil.c openutil.h path.c path.h qlock.c qlock.h \ rec_hdr.h ring.c ring.h sproc.c sproc.h stream.c \ - stream.h ts_mtio.h types.h util.c util.h + stream.h timeutil.c timeutil.h ts_mtio.h types.h util.c util.h default install install-dev :
common/util.c +0 -20
@@ -22,7 +22,6 @@#include <sys/stat.h> #include <sys/ioctl.h> -#include <time.h> #include <fcntl.h> #include <errno.h> #include <dirent.h>
@@ -508,25 +507,6 @@ diriter( jdm_fshandle_t *fshandlep, } } -char * -ctime32 (const time32_t *timep) -{ -time_t t = (time_t) *timep; -return ctime (&t); -} - -char * -ctimennl (const time32_t *clockp ) -{ -char *p =ctime32 ( clockp ); - -if ( p &&strlen ( p ) >0 ) { - p[strlen ( p ) -1 ] =0 ; - } - -return p; -} -int cvtnum (int blocksize,char *s ) {
common/util.h +0 -11
@@ -146,17 +146,6 @@ extern intgen_t diriter( jdm_fshandle_t size_t usrgdsz ); - -/* ctimennl - ctime(3C) with newline removed -*/ -extern char *ctimennl (const time32_t *clockp ); - -/* ctime32 - takes a time32_t instead of a time_t -*/ -extern char *ctime32 (const time32_t *timep ); - - -/* fold_t - a character string made to look like a "fold here" */ #define FOLD_LEN 79
dump/Makefile +2 -0
@@ -26,6 +26,7 @@ COMMINCL = \ qlock.h \ ring.h \ stream.h \ + timeutil.h \ ts_mtio.h \ types.h \ util.h \
@@ -66,6 +67,7 @@ COMMON = \ path.c \ ring.c \ stream.c \ + timeutil.c \ util.c \ sproc.c
dump/content.c +1 -0
@@ -42,6 +42,7 @@#include "exit.h" #include "types.h" #include "path.h" +#include "timeutil.h" #include "util.h" #include "lock.h" #include "qlock.h"
inventory/inv_stobj.c +1 -1
@@ -28,7 +28,7 @@#include <sys/mman.h> #include "types.h" -#include "util.h" +#include "timeutil.h" #include "mlog.h" #include "inv_priv.h" #include "arch_xlate.h"
invutil/Makefile +4 -1
@@ -8,7 +8,7 @@ include $(TOPDIR)/include/builddefs COMMINCL = \ global.h \ mlog.h \ - util.h \ + timeutil.h \ types.h INVINCL = \
@@ -18,6 +18,9 @@ INVINCL = \ INVCOMMON = \ inv_files.c +COMMON = \ + timeutil.c + CURSESCOMMON = \ cmenu.c \ fstab.c \
invutil/invidx.c +6 -26
@@ -32,6 +32,7 @@#include "list.h" #include "invidx.h" #include "stobj.h" +#include "timeutil.h" invidx_fileinfo_t *invidx_file;int invidx_numfiles;
@@ -418,27 +419,6 @@ delete_stobj_entries(int fd, int deletep }int -find_invidx_insert_point (int fd,time_t sh_time) -{ -int i; -invt_counter_t cnt; -invt_entry_t tmpentry; - -lseek (fd,0 ,SEEK_SET ); -read_n_bytes (fd, (char *)&cnt,sizeof (cnt),"invidx file" ); - -for (i =0 ; i < cnt.ic_curnum; i++) { -read_n_bytes (fd, (char *)&tmpentry,sizeof (tmpentry),"invidx file" ); -if (tmpentry.ie_timeperiod.tp_start <= sh_time - && tmpentry.ie_timeperiod.tp_end >= sh_time) { -break ; - } - } - -return i; -} - -int find_stobj_insert_point (int fd,invt_seshdr_t *hdr) {int i;
@@ -462,8 +442,8 @@ int update_invidx_entry(int fd, char *filename, int stobj_fd) { int i; -time_t start_time; -time_t end_time; +time32_t start_time; +time32_t end_time;invt_counter_t cnt;invt_seshdr_t hdr;invt_sescounter_t sescnt;
@@ -718,11 +698,11 @@ invidx_highlight(WINDOW *win, node_t *cusnprintf (txt,sizeof (txt),"path: %s" , invtentry->ie_filename);put_info_line (1 , txt); -snprintf (txt,sizeof (txt),"start: %s" ,ctime ((time_t *)&invtentry->ie_timeperiod.tp_start)); +snprintf (txt,sizeof (txt),"start: %s" ,ctime32 (&invtentry->ie_timeperiod.tp_start)); txt[strlen (txt) -1 ] ='\0' ;put_info_line (2 , txt); -snprintf (txt,sizeof (txt),"end: %s" ,ctime ((time_t *)&invtentry->ie_timeperiod.tp_end)); +snprintf (txt,sizeof (txt),"end: %s" ,ctime32 (&invtentry->ie_timeperiod.tp_end)); txt[strlen (txt) -1 ] ='\0' ;put_info_line (3 , txt);
@@ -757,7 +737,7 @@ invidx_undelete(WINDOW *win, node_t *cur/*ARGSUSED*/ int -invidx_prune (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list) +invidx_prune (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list) {data_t *d;invt_entry_t *invidx_entry;
invutil/invutil.c +27 -17
148 lines not on this page · raw message
invutil/stobj.c +3 -2
@@ -27,6 +27,7 @@#include "getopt.h" #include "invutil.h" +#include "timeutil.h" #include "cmenu.h" #include "list.h" #include "stobj.h"
@@ -184,7 +185,7 @@ stobjsess_highlight(WINDOW *win, node_tsnprintf (txt,sizeof (txt),"pruned: %s, flags: %#x, time: %s" , (stobjhdr->sh_pruned ==BOOL_TRUE ) ?"yes" :"no" , stobjhdr->sh_flag, -ctime ((time_t *)&(stobjhdr->sh_time))); +ctime32 (&(stobjhdr->sh_time))); txt[strlen (txt)-1 ] ='\0' ;put_info_line (1 , txt);
@@ -291,7 +292,7 @@ stobj_select(WINDOW *win, node_t *curren/*ARGSUSED*/ int -stobj_prune (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list) +stobj_prune (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list) {data_t *d;stobjsess_t *stobj;
restore/Makefile +2 -0
@@ -27,6 +27,7 @@ COMMINCL = \ ring.h \ sproc.h \ stream.h \ + timeutil.h \ ts_mtio.h \ types.h \ util.h
@@ -65,6 +66,7 @@ COMMON = \ ring.c \ sproc.c \ stream.c \ + timeutil.c \ util.c LOCALS = \
restore/content.c +2 -2
@@ -37,6 +37,7 @@#include <malloc.h> #include "types.h" +#include "timeutil.h" #include "util.h" #include "cldmgr.h" #include "qlock.h"
@@ -9347,7 +9348,6 @@ display_dump_label( bool_t lockpr,char dump_string_uuid[UUID_STR_LEN +1 ];char media_string_uuid[UUID_STR_LEN +1 ];char fs_string_uuid[UUID_STR_LEN +1 ]; -time_t gh_timestamp = (time_t )grhdrp->gh_timestamp;ASSERT ( scrhdrp->cih_level >=0 );ASSERT ( scrhdrp->cih_level <10 );
@@ -9376,7 +9376,7 @@ display_dump_label( bool_t lockpr, crhdrp->ch_fsdevice );mlog ( mllevel |MLOG_NOLOCK ,_ ("session time: %s" ), -ctime_r ( &gh_timestamp, dateline )); +ctime32_r ( &grhdrp->gh_timestamp, dateline )); mlog( mllevel | MLOG_NOLOCK, _("level: %s%s\n"), level_string,
.gitignore +3 -0
@@ -85,6 +85,7 @@ dump/rec_hdr.h dump/ring.[ch] dump/sproc.[ch] dump/stream.[ch] +dump/timeutil.[ch] dump/ts_mtio.h dump/types.h dump/util.[ch]
@@ -94,6 +95,7 @@ invutil/inv_files.c invutil/inv_priv.h invutil/inventory.h invutil/mlog.h +invutil/timeutil.[ch] invutil/types.h invutil/util.h
@@ -131,6 +133,7 @@ restore/rec_hdr.h restore/ring.[ch] restore/sproc.[ch] restore/stream.[ch] +restore/timeutil.[ch] restore/ts_mtio.h restore/types.h restore/util.[ch]
invutil/cmenu.c +2 -2
@@ -470,7 +470,7 @@ list_undelete(node_t *current, node_t *l }int -list_prune (node_t *menulist,char *mountpt,uuid_t *uuidp,time_t prunetime) +list_prune (node_t *menulist,char *mountpt,uuid_t *uuidp,time32_t prunetime) {node_t *n;data_t *d;
@@ -565,7 +565,7 @@ create_windows() }int -invutil_interactive (char *inv_path,char *mountpt,uuid_t *uuidp,time_t timeSecs) +invutil_interactive (char *inv_path,char *mountpt,uuid_t *uuidp,time32_t timeSecs) {int keyc;node_t *menulist;
invutil/cmenu.h +1 -1
@@ -55,7 +55,7 @@ typedef struct menu_ops_s {int (* op_highlight ) (WINDOW *win,node_t *current,node_t *list);int (* op_unhighlight ) (WINDOW *win,node_t *current,node_t *list);int (* op_commit ) (WINDOW *win,node_t *current,node_t *list); -int (* op_prune ) (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list); +int (* op_prune ) (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list); } menu_ops_t; typedef struct {
invutil/fstab.c +1 -1
@@ -172,7 +172,7 @@ fstab_highlight(WINDOW *win, node_t *cur/*ARGSUSED*/ int -fstab_prune (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list) +fstab_prune (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list) {data_t *d;invt_fstab_t *fstabentry;
invutil/fstab.h +1 -1
@@ -33,6 +33,6 @@ int find_matching_fstab(int fidx, invt_fint fstab_select (WINDOW *win,node_t *current,node_t *list);int fstab_highlight (WINDOW *win,node_t *current,node_t *list);int fstab_commit (WINDOW *win,node_t *current,node_t *list); -int fstab_prune (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list); +int fstab_prune (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list);#endif /* FSTAB_H */
invutil/invidx.h +1 -2
@@ -33,7 +33,6 @@ void *remmap_invidx(int fidx, int num);int find_matching_stobjfile (char *filename);int find_matching_invidxfile (char *filename);int find_overlapping_invidx (int fidx,invt_entry_t *inv_entry); -int find_invidx_insert_point (int fd,time_t sh_time);int find_invidx_insert_pos (int fidx,invt_entry_t *inv_entry);char *get_inventry_stobjfile (data_t *d);node_t *find_invidx_node (node_t *list,int inv_fileidx);
@@ -47,6 +46,6 @@ int invidx_undelete(WINDOW *win, node_tint invidx_select (WINDOW *win,node_t *current,node_t *list);int invidx_highlight (WINDOW *win,node_t *current,node_t *list);int invidx_commit (WINDOW *win,node_t *current,node_t *list); -int invidx_prune (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list); +int invidx_prune (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list);#endif /* INVIDX_H */
invutil/invutil.h +5 -5
@@ -44,12 +44,12 @@ extern bool_t wait_for_locks;char *GetFstabFullPath (char *);char *GetNameOfInvIndex (char *,uuid_t );char *GetNameOfStobj (char *inv_path,char *filename); -void CheckAndPruneFstab (char *,bool_t ,char *,uuid_t *,time_t ,char *); -int CheckAndPruneInvIndexFile (bool_t ,char *,time_t ,char *); -int CheckAndPruneStObjFile (bool_t ,char *,time_t ,char *); +void CheckAndPruneFstab (char *,bool_t ,char *,uuid_t *,time32_t ,char *); +int CheckAndPruneInvIndexFile (bool_t ,char *,time32_t ,char *); +int CheckAndPruneStObjFile (bool_t ,char *,time32_t ,char *);int uses_specified_mf_label (invt_seshdr_t *,invt_session_t *,char *,char *); -time_t ParseDate (char *); +time32_t ParseDate (char *);void usage (void );int open_and_lock (char *,Open_t ,uint );void read_n_bytes (int ,void *,size_t ,char *);
@@ -58,7 +58,7 @@ void * mmap_n_bytes(int, size_t, bool_t,void ListFstab (void );int ListInvIndexFile (char *);int ListStObjFile (char *); -int invutil_interactive (char *,char *,uuid_t *,time_t timeSecs); +int invutil_interactive (char *,char *,uuid_t *,time32_t timeSecs);int mntpnt_equal (char *s1,char *s2);#endif /* INVUTIL_H */
invutil/stobj.h +1 -1
@@ -33,7 +33,7 @@ int stobjstrm_highlight(WINDOW *win, nodint stobjmed_highlight (WINDOW *win,node_t *current,node_t *list);int stobj_select (WINDOW *win,node_t *current,node_t *list);int stobjsess_commit (WINDOW *win,node_t *current,node_t *list); -int stobj_prune (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list); +int stobj_prune (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list);int stobj_undelete (WINDOW *win,node_t *current,node_t *list);int stobjmed_commit (WINDOW *win,node_t *current,node_t *list);int stobjstrm_commit (WINDOW *win,node_t *current,node_t *list);
common/timeutil.c new file +50 -0
50 lines not on this page · raw message
common/timeutil.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Copyright (c) 2009 Silicon Graphics, Inc. +* All Rights Reserved. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it would be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef TIMEUTIL_H +#define TIMEUTIL_H + +/* timeutil.[hc] - time32_t related functions +*/ + + +/* ctime32 - takes a time32_t instead of a time_t +*/ +extern char *ctime32 (const time32_t *timep ); + +/* ctime32_r - takes a time32_t instead of a time_t +*/ +extern char *ctime32_r (const time32_t *timep,char *buf ); + +/* ctimennl - ctime(3C) with newline removed +*/ +extern char *ctimennl (const time32_t *clockp ); + +#endif /* TIMEUTIL_H */
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 5 lines · Christoph Hellwig
Quoted 5 lines · Bill Kendall
Quoted 1 line
Reposting to fix whitespace issues introduced by mailer.
The patch looks good and applies cleanly now,
Quoted 8 lines
Quoted 8 lines
Reviewed-by Christoph Hellwig <[email protected]>Some notes to look into after this patch:
- can you provide a testcase for the problems caused by the wrong
time_tusage? A patch to xfstests would be perfect, but if you have a raw testcase I'll vounteer to wire it up.
The way I reproduced this was to do a subtree dump followed by a dump of the inventory. On systems with a 64-bit time_t, this will show a dump date far into the future.
# xfsdump -F -s tmp -f /dev/null /
# xfsinvutil -C | grep Session
Session 0: valor:/ Sat Jan 29 17:45:22 2146The dump needs to be a subtree dump since that sets a flag in a field which is adjacent to a timestamp field in an inventory structure. When the time32_t field was cast to a time_t *, the flag's value was being read.
I don't know if this is worth writing a test for, however. It catches one specific call to ctime where ctime32 should have been used. The compiler will issue warnings for these cases, it's just that the code was explicitly casting to time_t * to silence the warnings.
Quoted 5 lines
Quoted 5 lines
- why do we wrap both ctime and
ctime_r? Currently xfsdump isn't multithreaded so we shouldn't need it. But if the parallel dump/restore ever gets merged from IRIX we need to get rid of the plain ctime calls. (Btw, are there any plans for the parallel dump/restore port?)
There was an existing ctime_r call so I just blindly converted it to ctime32_r. The existing ctime32 calls all come from xfsinvutil, which will remain single-threaded even if xfsdump/restore is parallel.
However, while looking at this I noticed there's at least one case where we do printf("...", ctime(), ctime()). That's not going to work right -- the same value will be printed for both times. I'll have to repost again...
No plans for the parallel port.
Bill
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 4 lines · Bill Kendall
However, while looking at this I noticed there's at least one case where we do
printf("...", ctime(), ctime()). That's not going to work right -- the same value will be printed for both times. I'll have to repost again...
Fix the one case where printf is called with 2 arguments that are calls to ctime32(). This occurs in CheckAndPruneInvIndexFile() -- otherwise the patch is the same.
---
common/Makefile +1 -1
@@ -14,7 +14,7 @@ LSRCFILES = arch_xlate.c arch_xlate.h \ main.c media.c media.h media_rmvtape.h mlog.c mlog.h \ namreg.c namreg.h openutil.c openutil.h path.c path.h qlock.c qlock.h \ rec_hdr.h ring.c ring.h sproc.c sproc.h stream.c \ - stream.h ts_mtio.h types.h util.c util.h + stream.h timeutil.c timeutil.h ts_mtio.h types.h util.c util.h default install install-dev :
common/util.c +0 -20
@@ -22,7 +22,6 @@#include <sys/stat.h> #include <sys/ioctl.h> -#include <time.h> #include <fcntl.h> #include <errno.h> #include <dirent.h>
@@ -508,25 +507,6 @@ diriter( jdm_fshandle_t *fshandlep, } } -char * -ctime32 (const time32_t *timep) -{ -time_t t = (time_t) *timep; -return ctime (&t); -} - -char * -ctimennl (const time32_t *clockp ) -{ -char *p =ctime32 ( clockp ); - -if ( p &&strlen ( p ) >0 ) { - p[strlen ( p ) -1 ] =0 ; - } - -return p; -} -int cvtnum (int blocksize,char *s ) {
common/util.h +0 -11
@@ -146,17 +146,6 @@ extern intgen_t diriter( jdm_fshandle_t size_t usrgdsz ); - -/* ctimennl - ctime(3C) with newline removed -*/ -extern char *ctimennl (const time32_t *clockp ); - -/* ctime32 - takes a time32_t instead of a time_t -*/ -extern char *ctime32 (const time32_t *timep ); - - -/* fold_t - a character string made to look like a "fold here" */ #define FOLD_LEN 79
dump/Makefile +2 -0
@@ -26,6 +26,7 @@ COMMINCL = \ qlock.h \ ring.h \ stream.h \ + timeutil.h \ ts_mtio.h \ types.h \ util.h \
@@ -66,6 +67,7 @@ COMMON = \ path.c \ ring.c \ stream.c \ + timeutil.c \ util.c \ sproc.c
dump/content.c +1 -0
@@ -42,6 +42,7 @@#include "exit.h" #include "types.h" #include "path.h" +#include "timeutil.h" #include "util.h" #include "lock.h" #include "qlock.h"
inventory/inv_stobj.c +1 -1
@@ -28,7 +28,7 @@#include <sys/mman.h> #include "types.h" -#include "util.h" +#include "timeutil.h" #include "mlog.h" #include "inv_priv.h" #include "arch_xlate.h"
invutil/Makefile +4 -1
@@ -8,7 +8,7 @@ include $(TOPDIR)/include/builddefs COMMINCL = \ global.h \ mlog.h \ - util.h \ + timeutil.h \ types.h INVINCL = \
@@ -18,6 +18,9 @@ INVINCL = \ INVCOMMON = \ inv_files.c +COMMON = \ + timeutil.c + CURSESCOMMON = \ cmenu.c \ fstab.c \
invutil/invidx.c +6 -26
@@ -32,6 +32,7 @@#include "list.h" #include "invidx.h" #include "stobj.h" +#include "timeutil.h" invidx_fileinfo_t *invidx_file;int invidx_numfiles;
@@ -418,27 +419,6 @@ delete_stobj_entries(int fd, int deletep }int -find_invidx_insert_point (int fd,time_t sh_time) -{ -int i; -invt_counter_t cnt; -invt_entry_t tmpentry; - -lseek (fd,0 ,SEEK_SET ); -read_n_bytes (fd, (char *)&cnt,sizeof (cnt),"invidx file" ); - -for (i =0 ; i < cnt.ic_curnum; i++) { -read_n_bytes (fd, (char *)&tmpentry,sizeof (tmpentry),"invidx file" ); -if (tmpentry.ie_timeperiod.tp_start <= sh_time - && tmpentry.ie_timeperiod.tp_end >= sh_time) { -break ; - } - } - -return i; -} - -int find_stobj_insert_point (int fd,invt_seshdr_t *hdr) {int i;
@@ -462,8 +442,8 @@ int update_invidx_entry(int fd, char *filename, int stobj_fd) { int i; -time_t start_time; -time_t end_time; +time32_t start_time; +time32_t end_time;invt_counter_t cnt;invt_seshdr_t hdr;invt_sescounter_t sescnt;
@@ -718,11 +698,11 @@ invidx_highlight(WINDOW *win, node_t *cusnprintf (txt,sizeof (txt),"path: %s" , invtentry->ie_filename);put_info_line (1 , txt); -snprintf (txt,sizeof (txt),"start: %s" ,ctime ((time_t *)&invtentry->ie_timeperiod.tp_start)); +snprintf (txt,sizeof (txt),"start: %s" ,ctime32 (&invtentry->ie_timeperiod.tp_start)); txt[strlen (txt) -1 ] ='\0' ;put_info_line (2 , txt); -snprintf (txt,sizeof (txt),"end: %s" ,ctime ((time_t *)&invtentry->ie_timeperiod.tp_end)); +snprintf (txt,sizeof (txt),"end: %s" ,ctime32 (&invtentry->ie_timeperiod.tp_end)); txt[strlen (txt) -1 ] ='\0' ;put_info_line (3 , txt);
@@ -757,7 +737,7 @@ invidx_undelete(WINDOW *win, node_t *cur/*ARGSUSED*/ int -invidx_prune (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list) +invidx_prune (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list) {data_t *d;invt_entry_t *invidx_entry;
invutil/invutil.c +29 -18
151 lines not on this page · raw message
invutil/stobj.c +3 -2
@@ -27,6 +27,7 @@#include "getopt.h" #include "invutil.h" +#include "timeutil.h" #include "cmenu.h" #include "list.h" #include "stobj.h"
@@ -184,7 +185,7 @@ stobjsess_highlight(WINDOW *win, node_tsnprintf (txt,sizeof (txt),"pruned: %s, flags: %#x, time: %s" , (stobjhdr->sh_pruned ==BOOL_TRUE ) ?"yes" :"no" , stobjhdr->sh_flag, -ctime ((time_t *)&(stobjhdr->sh_time))); +ctime32 (&(stobjhdr->sh_time))); txt[strlen (txt)-1 ] ='\0' ;put_info_line (1 , txt);
@@ -291,7 +292,7 @@ stobj_select(WINDOW *win, node_t *curren/*ARGSUSED*/ int -stobj_prune (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list) +stobj_prune (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list) {data_t *d;stobjsess_t *stobj;
restore/Makefile +2 -0
@@ -27,6 +27,7 @@ COMMINCL = \ ring.h \ sproc.h \ stream.h \ + timeutil.h \ ts_mtio.h \ types.h \ util.h
@@ -65,6 +66,7 @@ COMMON = \ ring.c \ sproc.c \ stream.c \ + timeutil.c \ util.c LOCALS = \
restore/content.c +2 -2
@@ -37,6 +37,7 @@#include <malloc.h> #include "types.h" +#include "timeutil.h" #include "util.h" #include "cldmgr.h" #include "qlock.h"
@@ -9347,7 +9348,6 @@ display_dump_label( bool_t lockpr,char dump_string_uuid[UUID_STR_LEN +1 ];char media_string_uuid[UUID_STR_LEN +1 ];char fs_string_uuid[UUID_STR_LEN +1 ]; -time_t gh_timestamp = (time_t )grhdrp->gh_timestamp;ASSERT ( scrhdrp->cih_level >=0 );ASSERT ( scrhdrp->cih_level <10 );
@@ -9376,7 +9376,7 @@ display_dump_label( bool_t lockpr, crhdrp->ch_fsdevice );mlog ( mllevel |MLOG_NOLOCK ,_ ("session time: %s" ), -ctime_r ( &gh_timestamp, dateline )); +ctime32_r ( &grhdrp->gh_timestamp, dateline )); mlog( mllevel | MLOG_NOLOCK, _("level: %s%s\n"), level_string,
.gitignore +3 -0
@@ -85,6 +85,7 @@ dump/rec_hdr.h dump/ring.[ch] dump/sproc.[ch] dump/stream.[ch] +dump/timeutil.[ch] dump/ts_mtio.h dump/types.h dump/util.[ch]
@@ -94,6 +95,7 @@ invutil/inv_files.c invutil/inv_priv.h invutil/inventory.h invutil/mlog.h +invutil/timeutil.[ch] invutil/types.h invutil/util.h
@@ -131,6 +133,7 @@ restore/rec_hdr.h restore/ring.[ch] restore/sproc.[ch] restore/stream.[ch] +restore/timeutil.[ch] restore/ts_mtio.h restore/types.h restore/util.[ch]
invutil/cmenu.c +2 -2
@@ -470,7 +470,7 @@ list_undelete(node_t *current, node_t *l }int -list_prune (node_t *menulist,char *mountpt,uuid_t *uuidp,time_t prunetime) +list_prune (node_t *menulist,char *mountpt,uuid_t *uuidp,time32_t prunetime) {node_t *n;data_t *d;
@@ -565,7 +565,7 @@ create_windows() }int -invutil_interactive (char *inv_path,char *mountpt,uuid_t *uuidp,time_t timeSecs) +invutil_interactive (char *inv_path,char *mountpt,uuid_t *uuidp,time32_t timeSecs) {int keyc;node_t *menulist;
invutil/cmenu.h +1 -1
@@ -55,7 +55,7 @@ typedef struct menu_ops_s {int (* op_highlight ) (WINDOW *win,node_t *current,node_t *list);int (* op_unhighlight ) (WINDOW *win,node_t *current,node_t *list);int (* op_commit ) (WINDOW *win,node_t *current,node_t *list); -int (* op_prune ) (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list); +int (* op_prune ) (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list); } menu_ops_t; typedef struct {
invutil/fstab.c +1 -1
@@ -172,7 +172,7 @@ fstab_highlight(WINDOW *win, node_t *cur/*ARGSUSED*/ int -fstab_prune (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list) +fstab_prune (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list) {data_t *d;invt_fstab_t *fstabentry;
invutil/fstab.h +1 -1
@@ -33,6 +33,6 @@ int find_matching_fstab(int fidx, invt_fint fstab_select (WINDOW *win,node_t *current,node_t *list);int fstab_highlight (WINDOW *win,node_t *current,node_t *list);int fstab_commit (WINDOW *win,node_t *current,node_t *list); -int fstab_prune (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list); +int fstab_prune (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list);#endif /* FSTAB_H */
invutil/invidx.h +1 -2
@@ -33,7 +33,6 @@ void *remmap_invidx(int fidx, int num);int find_matching_stobjfile (char *filename);int find_matching_invidxfile (char *filename);int find_overlapping_invidx (int fidx,invt_entry_t *inv_entry); -int find_invidx_insert_point (int fd,time_t sh_time);int find_invidx_insert_pos (int fidx,invt_entry_t *inv_entry);char *get_inventry_stobjfile (data_t *d);node_t *find_invidx_node (node_t *list,int inv_fileidx);
@@ -47,6 +46,6 @@ int invidx_undelete(WINDOW *win, node_tint invidx_select (WINDOW *win,node_t *current,node_t *list);int invidx_highlight (WINDOW *win,node_t *current,node_t *list);int invidx_commit (WINDOW *win,node_t *current,node_t *list); -int invidx_prune (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list); +int invidx_prune (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list);#endif /* INVIDX_H */
invutil/invutil.h +5 -5
@@ -44,12 +44,12 @@ extern bool_t wait_for_locks;char *GetFstabFullPath (char *);char *GetNameOfInvIndex (char *,uuid_t );char *GetNameOfStobj (char *inv_path,char *filename); -void CheckAndPruneFstab (char *,bool_t ,char *,uuid_t *,time_t ,char *); -int CheckAndPruneInvIndexFile (bool_t ,char *,time_t ,char *); -int CheckAndPruneStObjFile (bool_t ,char *,time_t ,char *); +void CheckAndPruneFstab (char *,bool_t ,char *,uuid_t *,time32_t ,char *); +int CheckAndPruneInvIndexFile (bool_t ,char *,time32_t ,char *); +int CheckAndPruneStObjFile (bool_t ,char *,time32_t ,char *);int uses_specified_mf_label (invt_seshdr_t *,invt_session_t *,char *,char *); -time_t ParseDate (char *); +time32_t ParseDate (char *);void usage (void );int open_and_lock (char *,Open_t ,uint );void read_n_bytes (int ,void *,size_t ,char *);
@@ -58,7 +58,7 @@ void * mmap_n_bytes(int, size_t, bool_t,void ListFstab (void );int ListInvIndexFile (char *);int ListStObjFile (char *); -int invutil_interactive (char *,char *,uuid_t *,time_t timeSecs); +int invutil_interactive (char *,char *,uuid_t *,time32_t timeSecs);int mntpnt_equal (char *s1,char *s2);#endif /* INVUTIL_H */
invutil/stobj.h +1 -1
@@ -33,7 +33,7 @@ int stobjstrm_highlight(WINDOW *win, nodint stobjmed_highlight (WINDOW *win,node_t *current,node_t *list);int stobj_select (WINDOW *win,node_t *current,node_t *list);int stobjsess_commit (WINDOW *win,node_t *current,node_t *list); -int stobj_prune (char *mountpt,uuid_t *uuidp,time_t prunetime,node_t *node,node_t *list); +int stobj_prune (char *mountpt,uuid_t *uuidp,time32_t prunetime,node_t *node,node_t *list);int stobj_undelete (WINDOW *win,node_t *current,node_t *list);int stobjmed_commit (WINDOW *win,node_t *current,node_t *list);int stobjstrm_commit (WINDOW *win,node_t *current,node_t *list);
common/timeutil.c new file +50 -0
50 lines not on this page · raw message
common/timeutil.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Copyright (c) 2009 Silicon Graphics, Inc. +* All Rights Reserved. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it would be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef TIMEUTIL_H +#define TIMEUTIL_H + +/* timeutil.[hc] - time32_t related functions +*/ + + +/* ctime32 - takes a time32_t instead of a time_t +*/ +extern char *ctime32 (const time32_t *timep ); + +/* ctime32_r - takes a time32_t instead of a time_t +*/ +extern char *ctime32_r (const time32_t *timep,char *buf ); + +/* ctimennl - ctime(3C) with newline removed +*/ +extern char *ctimennl (const time32_t *clockp ); + +#endif /* TIMEUTIL_H */
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
After discussion with Alex I've put both patches into the xfsdump-dev repository. I've taken the final version each, with the description of the initial posting.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs