* Note: 5th actually means that the value is within the interval
* (limit - margin, limit]. */
static int find_value_cmp(unsigned int file, unsigned int limit, int sign,
- unsigned long long margin, int mds)
+ int negopt, unsigned long long margin, int mds)
{
+ int ret = -1;
+
if (sign > 0) {
- if (file < limit)
- return mds ? 0 : 1;
- }
-
- if (sign == 0) {
- if (file <= limit && file + margin > limit)
- return mds ? 0 : 1;
- if (file + margin <= limit)
- return mds ? 0 : -1;
- }
-
- if (sign < 0) {
- if (file > limit)
- return 1;
- if (mds)
- return 0;
+ if (file <= limit)
+ ret = mds ? 0 : 1;
+ } else if (sign == 0) {
+ if (file <= limit && file + margin >= limit)
+ ret = mds ? 0 : 1;
+ else if (file + margin <= limit)
+ ret = mds ? 0 : -1;
+ } else if (sign < 0) {
+ if (file >= limit)
+ ret = 1;
+ else if (mds)
+ ret = 0;
}
- return -1;
+ return negopt ? ~ret + 1 : ret;
}
/* Check if the file time matches all the given criteria (e.g. --atime +/-N).
/* Check if file is accepted. */
if (param->atime) {
ret = find_value_cmp(st->st_atime, param->atime,
- param->asign, 24 * 60 * 60, mds);
+ param->asign, param->exclude_atime,
+ 24 * 60 * 60, mds);
if (ret < 0)
return ret;
rc = ret;
if (param->mtime) {
ret = find_value_cmp(st->st_mtime, param->mtime,
- param->msign, 24 * 60 * 60, mds);
+ param->msign, param->exclude_mtime,
+ 24 * 60 * 60, mds);
if (ret < 0)
return ret;
if (param->ctime) {
ret = find_value_cmp(st->st_ctime, param->ctime,
- param->csign, 24 * 60 * 60, mds);
+ param->csign, param->exclude_ctime,
+ 24 * 60 * 60, mds);
if (ret < 0)
return ret;
/* If a time or OST should be checked, the decision is not taken yet. */
if (param->atime || param->ctime || param->mtime || param->obduuid ||
- param->size)
+ param->check_size)
decision = 0;
ret = 0;
'glimpse-size-ioctl'. */
if (!decision && S_ISREG(st->st_mode) &&
param->lmd->lmd_lmm.lmm_stripe_count &&
- (param->size ||param->atime || param->mtime || param->ctime)) {
+ (param->check_size ||param->atime || param->mtime || param->ctime)) {
if (param->obdindex != OBD_NOT_FOUND) {
/* Check whether the obd is active or not, if it is
* not active, just print the object affected by this
goto decided;
}
- if (param->size)
+ if (param->check_size)
decision = find_value_cmp(st->st_size, param->size,
- param->size_sign, param->size_units,
- 0);
+ param->size_sign, param->exclude_size,
+ param->size_units, 0);
print_path:
if (decision != -1) {