- if (rc != 3) {
- errlog("can't parse line %s\n", line);
- return -1;
- }
-
- if (!match_uid(data->idd_uid, uid_str))
- return 0;
-
- if (!strcmp(nid_str, "*")) {
- nid = LNET_NID_ANY;
- } else {
- nid = libcfs_str2nid(nid_str);
- if (nid == LNET_NID_ANY) {
- errlog("can't parse nid %s\n", nid_str);
- return -1;
- }
- }
-
- if (parse_perm(&perm, &noperm, perm_str)) {
- errlog("invalid perm %s\n", perm_str);
- return -1;
- }
-
- /* merge the perms with the same nid.
- *
- * If there is LNET_NID_ANY in data->idd_perms[i].pdd_nid,
- * it must be data->idd_perms[0].pdd_nid, and act as default perm.
- */
- if (nid != LNET_NID_ANY) {
- int found = 0;
-
- /* search for the same nid */
- for (i = data->idd_nperms - 1; i >= 0; i--) {
- if (data->idd_perms[i].pdd_nid == nid) {
- data->idd_perms[i].pdd_perm =
- (data->idd_perms[i].pdd_perm | perm) &
- ~noperm;
- found = 1;
- break;
- }
- }
-
- /* NOT found, add to tail */
- if (!found) {
- data->idd_perms[data->idd_nperms].pdd_nid = nid;
- data->idd_perms[data->idd_nperms].pdd_perm =
- perm & ~noperm;
- data->idd_nperms++;
- }
- } else {
- if (data->idd_nperms > 0) {
- /* the first one isn't LNET_NID_ANY, need exchange */
- if (data->idd_perms[0].pdd_nid != LNET_NID_ANY) {
- data->idd_perms[data->idd_nperms].pdd_nid =
- data->idd_perms[0].pdd_nid;
- data->idd_perms[data->idd_nperms].pdd_perm =
- data->idd_perms[0].pdd_perm;
- data->idd_perms[0].pdd_nid = LNET_NID_ANY;
- data->idd_perms[0].pdd_perm = perm & ~noperm;
- data->idd_nperms++;
- } else {
- /* only fix LNET_NID_ANY item */
- data->idd_perms[0].pdd_perm =
- (data->idd_perms[0].pdd_perm | perm) &
- ~noperm;
- }
- } else {
- /* it is the first one, only add to head */
- data->idd_perms[0].pdd_nid = LNET_NID_ANY;
- data->idd_perms[0].pdd_perm = perm & ~noperm;
- data->idd_nperms = 1;
- }
- }
-
- return 0;
+ if (rc != 3) {
+ errlog("can't parse line %s\n", line);
+ return -1;
+ }
+
+ if (!match_uid(data->idd_uid, uid_str))
+ return 0;
+
+ if (!strcmp(nid_str, "*")) {
+ nid = LNET_NID_ANY;
+ } else {
+ nid = libcfs_str2nid(nid_str);
+ if (nid == LNET_NID_ANY) {
+ errlog("can't parse nid %s\n", nid_str);
+ return -1;
+ }
+ }
+
+ if (parse_perm(&perm, &noperm, perm_str)) {
+ errlog("invalid perm %s\n", perm_str);
+ return -1;
+ }
+
+ /*
+ * merge the perms with the same nid.
+ *
+ * If there is LNET_NID_ANY in data->idd_perms[i].pdd_nid,
+ * it must be data->idd_perms[0].pdd_nid, and act as default perm.
+ */
+ if (nid != LNET_NID_ANY) {
+ int found = 0;
+
+ /* search for the same nid */
+ for (i = data->idd_nperms - 1; i >= 0; i--) {
+ if (data->idd_perms[i].pdd_nid == nid) {
+ data->idd_perms[i].pdd_perm =
+ (data->idd_perms[i].pdd_perm | perm) &
+ ~noperm;
+ found = 1;
+ break;
+ }
+ }
+
+ /* NOT found, add to tail */
+ if (!found) {
+ data->idd_perms[data->idd_nperms].pdd_nid = nid;
+ data->idd_perms[data->idd_nperms].pdd_perm =
+ perm & ~noperm;
+ data->idd_nperms++;
+ }
+ } else {
+ if (data->idd_nperms > 0) {
+ /* the first one isn't LNET_NID_ANY, need exchange */
+ if (data->idd_perms[0].pdd_nid != LNET_NID_ANY) {
+ data->idd_perms[data->idd_nperms].pdd_nid =
+ data->idd_perms[0].pdd_nid;
+ data->idd_perms[data->idd_nperms].pdd_perm =
+ data->idd_perms[0].pdd_perm;
+ data->idd_perms[0].pdd_nid = LNET_NID_ANY;
+ data->idd_perms[0].pdd_perm = perm & ~noperm;
+ data->idd_nperms++;
+ } else {
+ /* only fix LNET_NID_ANY item */
+ data->idd_perms[0].pdd_perm =
+ (data->idd_perms[0].pdd_perm | perm) &
+ ~noperm;
+ }
+ } else {
+ /* it is the first one, only add to head */
+ data->idd_perms[0].pdd_nid = LNET_NID_ANY;
+ data->idd_perms[0].pdd_perm = perm & ~noperm;
+ data->idd_nperms = 1;
+ }
+ }
+
+ return 0;