Changeset 79b77ce in mainline
- Timestamp:
- 2025-12-17T00:00:01Z (3 weeks ago)
- Branches:
- master
- Children:
- 81805e0
- Parents:
- 2309891
- Location:
- uspace
- Files:
-
- 3 edited
-
app/copy/copy.c (modified) (2 diffs)
-
lib/fmgt/include/types/fmgt.h (modified) (1 diff)
-
lib/fmgt/src/copy.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/copy/copy.c
r2309891 r79b77ce 133 133 cons_event_t event; 134 134 kbd_event_t *ev; 135 const char *opstr = NULL; 135 136 errno_t rc; 136 137 … … 143 144 putchar('\n'); 144 145 145 fprintf(stderr, "I/O error %s file '%s' (%s).\n", 146 err->optype == fmgt_io_write ? "writing" : "reading", 147 err->fname, str_error(err->rc)); 146 switch (err->optype) { 147 case fmgt_io_read: 148 opstr = "reading"; 149 break; 150 case fmgt_io_write: 151 opstr = "writing"; 152 break; 153 case fmgt_io_create: 154 opstr = "creating"; 155 break; 156 case fmgt_io_open: 157 opstr = "opening"; 158 break; 159 } 160 161 fprintf(stderr, "I/O error %s file '%s' (%s).\n", opstr, err->fname, 162 str_error(err->rc)); 148 163 fprintf(stderr, "[A]bort or [R]etry?\n"); 149 164 -
uspace/lib/fmgt/include/types/fmgt.h
r2309891 r79b77ce 65 65 fmgt_io_read, 66 66 /** Write */ 67 fmgt_io_write 67 fmgt_io_write, 68 /** Open */ 69 fmgt_io_open, 70 /** Create */ 71 fmgt_io_create 68 72 } fmgt_io_op_type_t; 69 73 -
uspace/lib/fmgt/src/copy.c
r2309891 r79b77ce 97 97 { 98 98 fmgt_t *fmgt = (fmgt_t *)arg; 99 errno_t rc; 100 101 rc = vfs_link_path(dest, KIND_DIRECTORY, NULL); 102 103 /* It is okay if the directory exists. */ 104 if (rc != EOK && rc != EEXIST) 105 return rc; // XXX error recovery? 106 107 (void)fmgt; 108 return EOK; 99 fmgt_io_error_t err; 100 fmgt_error_action_t action; 101 errno_t rc; 102 103 do { 104 rc = vfs_link_path(dest, KIND_DIRECTORY, NULL); 105 106 /* It is okay if the directory exists. */ 107 if (rc == EOK || rc == EEXIST) 108 break; 109 110 /* I/O error */ 111 err.fname = dest; 112 err.optype = fmgt_io_create; 113 err.rc = rc; 114 115 fmgt_timer_stop(fmgt); 116 action = fmgt_io_error_query(fmgt, &err); 117 fmgt_timer_start(fmgt); 118 } while (action == fmgt_er_retry); 119 120 return rc; 109 121 } 110 122 … … 133 145 return ENOMEM; 134 146 135 rc = vfs_lookup_open(src, WALK_REGULAR, MODE_READ, &rfd); 147 do { 148 rc = vfs_lookup_open(src, WALK_REGULAR, MODE_READ, &rfd); 149 if (rc == EOK) 150 break; 151 152 /* I/O error */ 153 err.fname = src; 154 err.optype = fmgt_io_open; 155 err.rc = rc; 156 fmgt_timer_stop(fmgt); 157 action = fmgt_io_error_query(fmgt, &err); 158 fmgt_timer_start(fmgt); 159 } while (action == fmgt_er_retry); 160 161 /* Not recovered? */ 136 162 if (rc != EOK) { 137 163 free(buffer); 138 return rc; // XXX error recovery?164 return rc; 139 165 } 140 166 141 rc = vfs_lookup_open(dest, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE, 142 &wfd); 167 do { 168 rc = vfs_lookup_open(dest, WALK_REGULAR | WALK_MAY_CREATE, 169 MODE_WRITE, &wfd); 170 if (rc == EOK) 171 break; 172 173 /* I/O error */ 174 err.fname = dest; 175 err.optype = fmgt_io_create; 176 err.rc = rc; 177 fmgt_timer_stop(fmgt); 178 action = fmgt_io_error_query(fmgt, &err); 179 fmgt_timer_start(fmgt); 180 } while (action == fmgt_er_retry); 181 143 182 if (rc != EOK) { 144 183 free(buffer);
Note:
See TracChangeset
for help on using the changeset viewer.
