Skip to content

Commit

Permalink
utils.c: improve Tsetattr and Rsetattr decode
Browse files Browse the repository at this point in the history
Decode the mode field with the Linux mode-and-permissions
decoder, and in Tsetattr, note when we're requested to set
ctime=now.
  • Loading branch information
Chris Torek committed Jul 15, 2016
1 parent 327284b commit 2dc8ab6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ l9p_describe_fcall(union l9p_fcall *fcall, enum l9p_version version,
sbuf_printf(sb, " valid=0x%016" PRIx64, mask);
l9p_describe_qid(" qid=", &fcall->rgetattr.qid, sb);
if (mask & L9PL_GETATTR_MODE)
sbuf_printf(sb, " mode=0x%08x", fcall->rgetattr.mode);
l9p_describe_lperm(" mode=", fcall->rgetattr.mode, sb);
if (mask & L9PL_GETATTR_UID)
l9p_describe_ugid(" uid=", fcall->rgetattr.uid, sb);
if (mask & L9PL_GETATTR_GID)
Expand Down Expand Up @@ -1123,7 +1123,7 @@ l9p_describe_fcall(union l9p_fcall *fcall, enum l9p_version version,
/* NB: tsetattr valid mask is only 32 bits, hence %08x */
sbuf_printf(sb, " valid=0x%08" PRIx64, mask);
if (mask & L9PL_SETATTR_MODE)
sbuf_printf(sb, " mode=0x%08x", fcall->tsetattr.mode);
l9p_describe_lperm(" mode=", fcall->tsetattr.mode, sb);
if (mask & L9PL_SETATTR_UID)
l9p_describe_ugid(" uid=", fcall->tsetattr.uid, sb);
if (mask & L9PL_SETATTR_GID)
Expand All @@ -1136,16 +1136,18 @@ l9p_describe_fcall(union l9p_fcall *fcall, enum l9p_version version,
fcall->tsetattr.atime_sec,
fcall->tsetattr.atime_nsec);
else
sbuf_printf(sb, " atime=now");
sbuf_cat(sb, " atime=now");
}
if (mask & L9PL_SETATTR_MTIME) {
if (mask & L9PL_SETATTR_MTIME_SET)
l9p_describe_time(sb, " mtime=",
fcall->tsetattr.mtime_sec,
fcall->tsetattr.mtime_nsec);
else
sbuf_printf(sb, " mtime=now");
sbuf_cat(sb, " mtime=now");
}
if (mask & L9PL_SETATTR_CTIME)
sbuf_cat(sb, " ctime=now");
return;

case L9P_RSETATTR:
Expand Down

0 comments on commit 2dc8ab6

Please sign in to comment.