Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 594092 | Differences between
and this patch

Collapse All | Expand All

(-)file_not_specified_in_diff (-40 / +40 lines)
Line  Link Here
0
-- a/src/filelist-order.cxx
0
++ b/src/filelist-order.cxx
Lines 53-61 int __STACK_DEBUG__ = 0; Link Here
53
53
54
using namespace std;
54
using namespace std;
55
55
56
static char* program_name = "filelist-order";
56
static const char* program_name = "filelist-order";
57
static char* program_header = "$Header: /var/cvsroot/infrastructure/readahead-list/src/filelist-order.cxx,v 1.6 2005/05/17 02:12:43 robbat2 Exp $";
57
static const char* program_header = "$Header: /var/cvsroot/infrastructure/readahead-list/src/filelist-order.cxx,v 1.6 2005/05/17 02:12:43 robbat2 Exp $";
58
static char* program_id = "$Id: filelist-order.cxx,v 1.6 2005/05/17 02:12:43 robbat2 Exp $";
58
static const char* program_id = "$Id: filelist-order.cxx,v 1.6 2005/05/17 02:12:43 robbat2 Exp $";
59
59
60
static int flag_input_file = 0;
60
static int flag_input_file = 0;
61
static int flag_input_stdin = 0;
61
static int flag_input_stdin = 0;
Lines 75-81 static struct option long_options[] = { Link Here
75
	{"fields", 1, &flag_fields, 1},
75
	{"fields", 1, &flag_fields, 1},
76
	{0, 0, 0, 0}
76
	{0, 0, 0, 0}
77
};
77
};
78
static char* short_options = "f:vdhV";
78
static const char* short_options = "f:vdhV";
79
79
80
// 64-bit integers are needed for some fields
80
// 64-bit integers are needed for some fields
81
#define BASE_DATATYPE long long int
81
#define BASE_DATATYPE long long int
Lines 86-92 struct mapkey { Link Here
86
	char* filename;
86
	char* filename;
87
};
87
};
88
88
89
typedef enum OrderField_Type { ST_DEV,ST_INO,ST_MODE,ST_NLINK,ST_UID,ST_GID,ST_RDEV,ST_SIZE,ST_BLKSIZE,ST_BLOCKS,ST_ATIME,ST_MTIME,ST_CTIME,IOCTL_FIBMAP,FILENAME };
89
enum OrderField_Type { ST_DEV,ST_INO,ST_MODE,ST_NLINK,ST_UID,ST_GID,ST_RDEV,ST_SIZE,ST_BLKSIZE,ST_BLOCKS,ST_ATIME,ST_MTIME,ST_CTIME,IOCTL_FIBMAP,FILENAME };
90
struct OrderField {
90
struct OrderField {
91
		OrderField_Type type;
91
		OrderField_Type type;
92
		bool reverse;
92
		bool reverse;
Lines 95-101 struct OrderField { Link Here
95
		}
95
		}
96
};
96
};
97
97
98
inline const int numcmp(const BASE_DATATYPE a, const BASE_DATATYPE b) {
98
inline int numcmp(const BASE_DATATYPE a, const BASE_DATATYPE b) {
99
	DEBUG_STACK_UP;
99
	DEBUG_STACK_UP;
100
	DEBUG("%s\n","numcmp-init");
100
	DEBUG("%s\n","numcmp-init");
101
	int ret = 0;
101
	int ret = 0;
Lines 109-147 inline const int numcmp(const BASE_DATATYPE a, const BASE_DATATYPE b) { Link Here
109
	return ret;
109
	return ret;
110
}
110
}
111
111
112
inline const BASE_DATATYPE func_ST_DEV(mapkey a) 		{ return ((a).sb->st_dev); }
112
inline BASE_DATATYPE func_ST_DEV(mapkey a)			{ return ((a).sb->st_dev); }
113
inline const BASE_DATATYPE func_ST_INO(mapkey a) 		{ return ((a).sb->st_ino); }
113
inline BASE_DATATYPE func_ST_INO(mapkey a)			{ return ((a).sb->st_ino); }
114
inline const BASE_DATATYPE func_ST_MODE(mapkey a) 		{ return ((a).sb->st_mode); }
114
inline BASE_DATATYPE func_ST_MODE(mapkey a)			{ return ((a).sb->st_mode); }
115
inline const BASE_DATATYPE func_ST_NLINK(mapkey a) 		{ return ((a).sb->st_nlink); }
115
inline BASE_DATATYPE func_ST_NLINK(mapkey a)		{ return ((a).sb->st_nlink); }
116
inline const BASE_DATATYPE func_ST_UID(mapkey a) 		{ return ((a).sb->st_uid); }
116
inline BASE_DATATYPE func_ST_UID(mapkey a)			{ return ((a).sb->st_uid); }
117
inline const BASE_DATATYPE func_ST_GID(mapkey a) 		{ return ((a).sb->st_gid); }
117
inline BASE_DATATYPE func_ST_GID(mapkey a)			{ return ((a).sb->st_gid); }
118
inline const BASE_DATATYPE func_ST_RDEV(mapkey a) 		{ return ((a).sb->st_rdev); }
118
inline BASE_DATATYPE func_ST_RDEV(mapkey a)			{ return ((a).sb->st_rdev); }
119
inline const BASE_DATATYPE func_ST_SIZE(mapkey a) 		{ return ((a).sb->st_size); }
119
inline BASE_DATATYPE func_ST_SIZE(mapkey a)			{ return ((a).sb->st_size); }
120
inline const BASE_DATATYPE func_ST_BLKSIZE(mapkey a) 	{ return ((a).sb->st_blksize); }
120
inline BASE_DATATYPE func_ST_BLKSIZE(mapkey a)		{ return ((a).sb->st_blksize); }
121
inline const BASE_DATATYPE func_ST_BLOCKS(mapkey a) 		{ return ((a).sb->st_blocks); }
121
inline BASE_DATATYPE func_ST_BLOCKS(mapkey a)		{ return ((a).sb->st_blocks); }
122
inline const BASE_DATATYPE func_ST_ATIME(mapkey a) 		{ return ((a).sb->st_atime); }
122
inline BASE_DATATYPE func_ST_ATIME(mapkey a)		{ return ((a).sb->st_atime); }
123
inline const BASE_DATATYPE func_ST_MTIME(mapkey a) 		{ return ((a).sb->st_mtime); }
123
inline BASE_DATATYPE func_ST_MTIME(mapkey a)		{ return ((a).sb->st_mtime); }
124
inline const BASE_DATATYPE func_ST_CTIME(mapkey a) 		{ return ((a).sb->st_ctime); }
124
inline BASE_DATATYPE func_ST_CTIME(mapkey a)		{ return ((a).sb->st_ctime); }
125
inline const BASE_DATATYPE func_IOCTL_FIBMAP(mapkey a)	{ return ((a).first_block); }
125
inline BASE_DATATYPE func_IOCTL_FIBMAP(mapkey a)	{ return ((a).first_block); }
126
inline const char* func_FILENAME(mapkey a) 		{ return ((a).filename); }
126
inline char* func_FILENAME(mapkey a)				{ return ((a).filename); }
127
127
128
128
129
inline const int cmp_ST_DEV(mapkey a, mapkey b) 	{ return  numcmp(func_ST_DEV(a),func_ST_DEV(b)); }
129
inline int cmp_ST_DEV(mapkey a, mapkey b)			{ return  numcmp(func_ST_DEV(a),func_ST_DEV(b)); }
130
inline const int cmp_ST_INO(mapkey a, mapkey b) 	{ return  numcmp(func_ST_INO(a),func_ST_INO(b)); }
130
inline int cmp_ST_INO(mapkey a, mapkey b)			{ return  numcmp(func_ST_INO(a),func_ST_INO(b)); }
131
inline const int cmp_ST_MODE(mapkey a, mapkey b) 	{ return  numcmp(func_ST_MODE(a),func_ST_MODE(b)); }
131
inline int cmp_ST_MODE(mapkey a, mapkey b)			{ return  numcmp(func_ST_MODE(a),func_ST_MODE(b)); }
132
inline const int cmp_ST_NLINK(mapkey a, mapkey b) 	{ return  numcmp(func_ST_NLINK(a),func_ST_NLINK(b)); }
132
inline int cmp_ST_NLINK(mapkey a, mapkey b)			{ return  numcmp(func_ST_NLINK(a),func_ST_NLINK(b)); }
133
inline const int cmp_ST_UID(mapkey a, mapkey b) 	{ return  numcmp(func_ST_UID(a),func_ST_UID(b)); }
133
inline int cmp_ST_UID(mapkey a, mapkey b)			{ return  numcmp(func_ST_UID(a),func_ST_UID(b)); }
134
inline const int cmp_ST_GID(mapkey a, mapkey b) 	{ return  numcmp(func_ST_GID(a),func_ST_GID(b)); }
134
inline int cmp_ST_GID(mapkey a, mapkey b)			{ return  numcmp(func_ST_GID(a),func_ST_GID(b)); }
135
inline const int cmp_ST_RDEV(mapkey a, mapkey b)	{ return  numcmp(func_ST_RDEV(a),func_ST_RDEV(b)); }
135
inline int cmp_ST_RDEV(mapkey a, mapkey b)			{ return  numcmp(func_ST_RDEV(a),func_ST_RDEV(b)); }
136
inline const int cmp_ST_SIZE(mapkey a, mapkey b)	{ return  numcmp(func_ST_SIZE(a),func_ST_SIZE(b)); }
136
inline int cmp_ST_SIZE(mapkey a, mapkey b)			{ return  numcmp(func_ST_SIZE(a),func_ST_SIZE(b)); }
137
inline const int cmp_ST_BLKSIZE(mapkey a, mapkey b) { return  numcmp(func_ST_BLKSIZE(a),func_ST_BLKSIZE(b)); }
137
inline int cmp_ST_BLKSIZE(mapkey a, mapkey b)		{ return  numcmp(func_ST_BLKSIZE(a),func_ST_BLKSIZE(b)); }
138
inline const int cmp_ST_BLOCKS(mapkey a, mapkey b) 	{ return  numcmp(func_ST_BLOCKS(a),func_ST_BLOCKS(b)); }
138
inline int cmp_ST_BLOCKS(mapkey a, mapkey b)		{ return  numcmp(func_ST_BLOCKS(a),func_ST_BLOCKS(b)); }
139
inline const int cmp_ST_ATIME(mapkey a, mapkey b) 	{ return  numcmp(func_ST_ATIME(a),func_ST_ATIME(b)); }
139
inline int cmp_ST_ATIME(mapkey a, mapkey b)			{ return  numcmp(func_ST_ATIME(a),func_ST_ATIME(b)); }
140
inline const int cmp_ST_MTIME(mapkey a, mapkey b) 	{ return  numcmp(func_ST_MTIME(a),func_ST_MTIME(b)); }
140
inline int cmp_ST_MTIME(mapkey a, mapkey b)			{ return  numcmp(func_ST_MTIME(a),func_ST_MTIME(b)); }
141
inline const int cmp_ST_CTIME(mapkey a, mapkey b) 	{ return  numcmp(func_ST_CTIME(a),func_ST_CTIME(b)); }
141
inline int cmp_ST_CTIME(mapkey a, mapkey b)			{ return  numcmp(func_ST_CTIME(a),func_ST_CTIME(b)); }
142
inline const int cmp_IOCTL_FIBMAP(mapkey a, mapkey b) { return  numcmp(func_IOCTL_FIBMAP(a),func_IOCTL_FIBMAP(b)); }
142
inline int cmp_IOCTL_FIBMAP(mapkey a, mapkey b)		{ return  numcmp(func_IOCTL_FIBMAP(a),func_IOCTL_FIBMAP(b)); }
143
// note that this one is backwards
143
// note that this one is backwards
144
inline const int cmp_FILENAME(mapkey a, mapkey b) 	{ return  strcmp(func_FILENAME(b),func_FILENAME(a)); }
144
inline int cmp_FILENAME(mapkey a, mapkey b)			{ return  strcmp(func_FILENAME(b),func_FILENAME(a)); }
145
145
146
#define CMP_NE_RET if(cmp != 0) { DEBUG("%s:(%d)\n","mapcmp-ne-shortcircuit",cmp); DEBUG_STACK_DOWN; return cmp; }
146
#define CMP_NE_RET if(cmp != 0) { DEBUG("%s:(%d)\n","mapcmp-ne-shortcircuit",cmp); DEBUG_STACK_DOWN; return cmp; }
147
int mapcmp(const mapkey *a, const mapkey *b, vector<OrderField*> *ofa) {
147
int mapcmp(const mapkey *a, const mapkey *b, vector<OrderField*> *ofa) {
Lines 555-561 void process_opts(int argc, char** argv) { Link Here
555
	// handle the default
555
	// handle the default
556
	if(param_fields == NULL) {
556
	if(param_fields == NULL) {
557
		flag_fields = 1;
557
		flag_fields = 1;
558
		param_fields = "stat.st_dev,ioctl.fibmap,stat.st_ino,raw.filename";
558
		param_fields = (char*)"stat.st_dev,ioctl.fibmap,stat.st_ino,raw.filename";
559
	}
559
	}
560
	process_fieldorder(param_fields);
560
	process_fieldorder(param_fields);
561
}
561
}

Return to bug 594092