Added comments to yaffs_DoUtimre
authorTimothy Manning <codedraftsman@gmail.com>
Thu, 3 Jun 2021 22:18:59 +0000 (10:18 +1200)
committerTimothy Manning <codedraftsman@gmail.com>
Fri, 4 Jun 2021 00:59:50 +0000 (12:59 +1200)
Signed-off-by: Timothy Manning <codedraughtsman@users.noreply.github.com>
direct/yaffsfs.c

index d1e4e4efa76185ade34bffeef842c6044e53fca6..2c1ac42eba1c8cefad544e6c8f7d79d37d96674e 100644 (file)
@@ -1943,17 +1943,21 @@ static int yaffsfs_DoUtime(struct yaffs_obj *obj,
        }
 
 #if !CONFIG_YAFFS_WINCE
        }
 
 #if !CONFIG_YAFFS_WINCE
+       // if the the buffer is null then create one with the fields set to the current time.
        if (!buf) {
                local.actime = Y_CURRENT_TIME;
                local.modtime = local.actime;
                buf = &local;
        }
 
        if (!buf) {
                local.actime = Y_CURRENT_TIME;
                local.modtime = local.actime;
                buf = &local;
        }
 
+       // copy the buffer's time into the obj.
        if (obj) {
                int result;
 
                obj->yst_atime = buf->actime;
                obj->yst_mtime = buf->modtime;
        if (obj) {
                int result;
 
                obj->yst_atime = buf->actime;
                obj->yst_mtime = buf->modtime;
+
+               // set the obj to dirty to cause it to be written to flash during the next flush operation.
                obj->dirty = 1;
                result = yaffs_flush_file(obj, 0, 0, 0);
                retVal = result == YAFFS_OK ? 0 : -1;
                obj->dirty = 1;
                result = yaffs_flush_file(obj, 0, 0, 0);
                retVal = result == YAFFS_OK ? 0 : -1;