Switch to unified view

a/src/utils/pxattr.cpp b/src/utils/pxattr.cpp
...
...
403
    }
403
    }
404
    }
404
    }
405
    return true;
405
    return true;
406
}
406
}
407
407
408
static const string nullstring("");
408
static const string cstr_nullstring("");
409
409
410
bool get(const string& path, const string& _name, string *value,
410
bool get(const string& path, const string& _name, string *value,
411
     flags flags, nspace dom)
411
     flags flags, nspace dom)
412
{
412
{
413
    return get(-1, path, _name, value, flags, dom);
413
    return get(-1, path, _name, value, flags, dom);
414
}
414
}
415
bool get(int fd, const string& _name, string *value, flags flags, nspace dom)
415
bool get(int fd, const string& _name, string *value, flags flags, nspace dom)
416
{
416
{
417
    return get(fd, nullstring, _name, value, flags, dom);
417
    return get(fd, cstr_nullstring, _name, value, flags, dom);
418
}
418
}
419
bool set(const string& path, const string& _name, const string& value,
419
bool set(const string& path, const string& _name, const string& value,
420
     flags flags, nspace dom)
420
     flags flags, nspace dom)
421
{
421
{
422
    return set(-1, path, _name, value, flags, dom);
422
    return set(-1, path, _name, value, flags, dom);
423
}
423
}
424
bool set(int fd, const string& _name, const string& value, 
424
bool set(int fd, const string& _name, const string& value, 
425
     flags flags, nspace dom)
425
     flags flags, nspace dom)
426
{
426
{
427
    return set(fd, nullstring, _name, value, flags, dom);
427
    return set(fd, cstr_nullstring, _name, value, flags, dom);
428
}
428
}
429
bool del(const string& path, const string& _name, flags flags, nspace dom) 
429
bool del(const string& path, const string& _name, flags flags, nspace dom) 
430
{
430
{
431
    return del(-1, path, _name, flags, dom);
431
    return del(-1, path, _name, flags, dom);
432
}
432
}
433
bool del(int fd, const string& _name, flags flags, nspace dom) 
433
bool del(int fd, const string& _name, flags flags, nspace dom) 
434
{
434
{
435
    return del(fd, nullstring, _name, flags, dom);
435
    return del(fd, cstr_nullstring, _name, flags, dom);
436
}
436
}
437
bool list(const string& path, vector<string>* names, flags flags, nspace dom)
437
bool list(const string& path, vector<string>* names, flags flags, nspace dom)
438
{
438
{
439
    return list(-1, path, names, flags, dom);
439
    return list(-1, path, names, flags, dom);
440
}
440
}
441
bool list(int fd, vector<string>* names, flags flags, nspace dom)
441
bool list(int fd, vector<string>* names, flags flags, nspace dom)
442
{
442
{
443
    return list(fd, nullstring, names, flags, dom);
443
    return list(fd, cstr_nullstring, names, flags, dom);
444
}
444
}
445
445
446
static const string userstring("user.");
446
static const string cstr_userstring("user.");
447
bool sysname(nspace dom, const string& pname, string* sname)
447
bool sysname(nspace dom, const string& pname, string* sname)
448
{
448
{
449
    if (dom != PXATTR_USER) {
449
    if (dom != PXATTR_USER) {
450
    errno = EINVAL;
450
    errno = EINVAL;
451
    return false;
451
    return false;
452
     }
452
     }
453
    *sname = userstring + pname;
453
    *sname = cstr_userstring + pname;
454
    return true;
454
    return true;
455
}
455
}
456
456
457
bool pxname(nspace dom, const string& sname, string* pname) 
457
bool pxname(nspace dom, const string& sname, string* pname) 
458
{
458
{
459
    if (sname.find("user.") != 0) {
459
    if (sname.find("user.") != 0) {
460
    errno = EINVAL;
460
    errno = EINVAL;
461
    return false;
461
    return false;
462
    }
462
    }
463
    *pname = sname.substr(userstring.length());
463
    *pname = sname.substr(cstr_userstring.length());
464
    return true;
464
    return true;
465
}
465
}
466
466
467
} // namespace pxattr
467
} // namespace pxattr
468
468