Changes in / [fb8dcb4:063ae706] in mainline
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/check.sh
rfb8dcb4 r063ae706 66 66 do 67 67 echo -n ">>>> Building $P... " 68 ( make distclean && make PROFILE=$P HANDS_OFF=y "$@") >>/dev/null 2>>/dev/null68 ( make distclean && make PROFILE=$P HANDS_OFF=y $1 ) >>/dev/null 2>>/dev/null 69 69 if [ $? -ne 0 ]; 70 70 then -
tools/mkfat.py
rfb8dcb4 r063ae706 168 168 """ 169 169 170 LFN_ENTRY = """little: 171 uint8_t pos 172 uint16_t name1[5] 173 uint8_t attr 174 uint8_t type 175 uint8_t csum 176 uint16_t name2[6] 177 uint16_t fc 178 uint16_t name3[2] 179 """ 180 181 # Global variable to hold the file names in 8.3 format. Needed to 182 # keep track of "number" when creating a short fname from a LFN. 183 name83_list = [] 184 185 def name83(fname): 186 "Create a 8.3 name for the given fname" 187 170 def mangle_fname(name): 188 171 # FIXME: filter illegal characters 189 parts = fname.split('.') 190 191 name = '' 192 ext = '' 193 lfn = False 194 195 if len(fname) > 11 : 196 lfn = True 197 172 parts = name.split('.') 173 198 174 if len(parts) > 0: 199 name = parts[0] 200 if len(name) > 8 : 201 lfn = True 202 203 if len(parts) > 1 : 204 ext = parts[-1] 205 if len(ext) > 3 : 206 lfn = True 207 208 if len(parts) > 2 : 209 lfn = True 210 211 if (lfn == False) : 212 return (name.ljust(8)[0:8], ext.ljust(3)[0:3], False) 213 214 # For filenames with multiple extensions, we treat the last one 215 # as the actual extension. The rest of the filename is stripped 216 # of dots and concatenated to form the short name 217 for _name in parts[1:-1]: 218 name = name + _name 219 220 global name83_list 221 for number in range(1, 10000) : 222 number_str = '~' + str(number) 223 224 if len(name) + len(number_str) > 8 : 225 name = name[0:8 - len(number_str)] 226 227 name = name + number_str; 228 229 if (name + ext) not in name83_list : 230 break 231 232 name83_list.append(name + ext) 233 234 return (name.ljust(8)[0:8], ext.ljust(3)[0:3], True) 235 236 def get_utf16(name, l) : 237 "Create a int array out of a string which we can store in uint16_t arrays" 238 239 bs = [0xFFFF for i in range(l)] 240 241 for i in range(len(name)) : 242 bs[i] = ord(name[i]) 243 244 if (len(name) < l) : 245 bs[len(name)] = 0; 246 247 return bs 248 249 def create_lfn_entry((name, index)) : 250 entry = xstruct.create(LFN_ENTRY) 251 252 entry.name1 = get_utf16(name[0:5], 5) 253 entry.name2 = get_utf16(name[5:11], 6) 254 entry.name3 = get_utf16(name[11:13], 2) 255 entry.pos = index 256 257 entry.attr = 0xF 258 entry.fc = 0 259 entry.type = 0 260 261 return entry 175 fname = parts[0] 176 else: 177 fname = '' 178 179 if len(fname) > 8: 180 sys.stdout.write("mkfat.py: error: Directory entry " + name + 181 " base name is longer than 8 characters\n") 182 sys.exit(1); 183 184 return (fname + ' ').upper()[0:8] 185 186 def mangle_ext(name): 187 # FIXME: filter illegal characters 188 parts = name.split('.') 189 190 if len(parts) > 1: 191 ext = parts[1] 192 else: 193 ext = '' 194 195 if len(parts) > 2: 196 sys.stdout.write("mkfat.py: error: Directory entry " + name + 197 " has more than one extension\n") 198 sys.exit(1); 199 200 if len(ext) > 3: 201 sys.stdout.write("mkfat.py: error: Directory entry " + name + 202 " extension is longer than 3 characters\n") 203 sys.exit(1); 204 205 return (ext + ' ').upper()[0:3] 262 206 263 207 def create_dirent(name, directory, cluster, size): 264 265 208 dir_entry = xstruct.create(DIR_ENTRY) 266 209 267 dir_entry.name, dir_entry.ext, lfn = name83(name) 268 269 dir_entry.name = dir_entry.name.upper().encode('ascii') 270 dir_entry.ext = dir_entry.ext.upper().encode('ascii') 271 210 dir_entry.name = mangle_fname(name).encode('ascii') 211 dir_entry.ext = mangle_ext(name).encode('ascii') 212 272 213 if (directory): 273 214 dir_entry.attr = 0x30 … … 289 230 dir_entry.size = size 290 231 291 292 if not lfn: 293 return [dir_entry] 294 295 n = len(name) / 13 + 1 296 names = [(name[i * 13: (i + 1) * 13 + 1], i + 1) for i in range(n)] 297 298 entries = sorted(map (create_lfn_entry, names), reverse = True, key = lambda e : e.pos) 299 entries[0].pos |= 0x40 300 301 fname11 = dir_entry.name + dir_entry.ext 302 303 csum = 0 304 for i in range(0, 11) : 305 csum = ((csum & 1) << 7) + (csum >> 1) + ord(fname11[i]) 306 csum = csum & 0xFF 307 308 for e in entries : 309 e.csum = csum; 310 311 entries.append(dir_entry) 312 313 return entries 232 return dir_entry 314 233 315 234 def create_dot_dirent(empty_cluster): … … 369 288 if item.is_file: 370 289 rv = write_file(item, outf, cluster_size, data_start, fat, reserved_clusters) 371 directory. extend(create_dirent(item.name, False, rv[0], rv[1]))290 directory.append(create_dirent(item.name, False, rv[0], rv[1])) 372 291 elif item.is_dir: 373 292 rv = recursion(False, item.path, outf, cluster_size, root_start, data_start, fat, reserved_clusters, dirent_size, empty_cluster) 374 directory. extend(create_dirent(item.name, True, rv[0], rv[1]))293 directory.append(create_dirent(item.name, True, rv[0], rv[1])) 375 294 376 295 if (head): -
uspace/app/bdsh/cmds/modules/cat/cat.c
rfb8dcb4 r063ae706 52 52 #define CAT_VERSION "0.0.1" 53 53 #define CAT_DEFAULT_BUFLEN 1024 54 #define CAT_FULL_FILE 0 55 54 55 static const char *cat_oops = "That option is not yet supported\n"; 56 56 static const char *hexchars = "0123456789abcdef"; 57 57 … … 163 163 } 164 164 165 static unsigned int cat_file(const char *fname, size_t blen, bool hex, 166 off64_t head, off64_t tail, bool tail_first) 165 static unsigned int cat_file(const char *fname, size_t blen, bool hex) 167 166 { 168 167 int fd, bytes = 0, count = 0, reads = 0; 169 168 char *buff = NULL; 170 169 int i; 171 size_t offset = 0, copied_bytes = 0; 172 off64_t file_size = 0, length = 0; 170 size_t offset = 0; 173 171 174 172 fd = open(fname, O_RDONLY); … … 185 183 } 186 184 187 if (tail != CAT_FULL_FILE) {188 file_size = lseek(fd, 0, SEEK_END);189 if (head == CAT_FULL_FILE) {190 head = file_size;191 length = tail;192 } else if (tail_first) {193 length = head;194 } else {195 if (tail > head)196 tail = head;197 length = tail;198 }199 200 if (tail_first) {201 lseek(fd, (tail >= file_size) ? 0 : (file_size - tail), SEEK_SET);202 } else {203 lseek(fd, ((head - tail) >= file_size) ? 0 : (head - tail), SEEK_SET);204 }205 } else206 length = head;207 208 185 do { 209 bytes = read(fd, buff + copied_bytes, ( 210 (length != CAT_FULL_FILE && length - (off64_t)count <= (off64_t)(blen - copied_bytes)) ? 211 (size_t)(length - count) : 212 (blen - copied_bytes) ) ); 213 bytes += copied_bytes; 214 copied_bytes = 0; 215 186 bytes = read(fd, buff, blen); 216 187 if (bytes > 0) { 188 count += bytes; 217 189 buff[bytes] = '\0'; 218 190 offset = 0; … … 221 193 paged_char(hexchars[((uint8_t)buff[i])/16]); 222 194 paged_char(hexchars[((uint8_t)buff[i])%16]); 223 paged_char(((count+i+1) & 0xf) == 0 ? '\n' : ' ');224 195 } 225 196 else { … … 228 199 /* Reached end of string */ 229 200 break; 230 } else if (c == U_SPECIAL && offset + 2 >= (size_t)bytes) {231 /* If an extended character is cut off due to the size of the buffer,232 we will copy it over to the next buffer so it can be read correctly. */233 copied_bytes = bytes - offset + 1;234 memcpy(buff, buff + offset - 1, copied_bytes);235 break;236 201 } 237 202 paged_char(c); … … 239 204 240 205 } 241 count += bytes;242 206 reads++; 243 207 } 244 } while (bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE));208 } while (bytes > 0 && !should_quit); 245 209 246 210 close(fd); … … 259 223 int cmd_cat(char **argv) 260 224 { 261 unsigned int argc, i, ret = 0; 262 size_t buffer = 0; 225 unsigned int argc, i, ret = 0, buffer = 0; 263 226 int c, opt_ind; 264 aoff64_t head = CAT_FULL_FILE, tail = CAT_FULL_FILE;265 227 bool hex = false; 266 228 bool more = false; 267 bool tailFirst = false;268 229 sysarg_t rows, cols; 269 230 int rc; … … 293 254 return CMD_SUCCESS; 294 255 case 'H': 295 if (!optarg || str_uint64_t(optarg, NULL, 10, false, &head) != EOK ) { 296 puts("Invalid head size\n"); 297 return CMD_FAILURE; 298 } 299 break; 256 printf("%s", cat_oops); 257 return CMD_FAILURE; 300 258 case 't': 301 if (!optarg || str_uint64_t(optarg, NULL, 10, false, &tail) != EOK ) { 302 puts("Invalid tail size\n"); 303 return CMD_FAILURE; 304 } 305 if (head == CAT_FULL_FILE) 306 tailFirst = true; 307 break; 259 printf("%s", cat_oops); 260 return CMD_FAILURE; 308 261 case 'b': 309 if (!optarg || str_size_t(optarg, NULL, 10, false, &buffer) != EOK ) { 310 puts("Invalid buffer size\n"); 311 return CMD_FAILURE; 312 } 262 printf("%s", cat_oops); 313 263 break; 314 264 case 'm': … … 329 279 } 330 280 331 if (buffer < 4)281 if (buffer <= 0) 332 282 buffer = CAT_DEFAULT_BUFLEN; 333 283 … … 345 295 346 296 for (i = optind; argv[i] != NULL && !should_quit; i++) 347 ret += cat_file(argv[i], buffer, hex , head, tail, tailFirst);297 ret += cat_file(argv[i], buffer, hex); 348 298 349 299 if (ret) -
uspace/app/bdsh/cmds/modules/cat/cat.h
rfb8dcb4 r063ae706 4 4 /* Prototypes for the cat command, excluding entry points */ 5 5 6 static unsigned int cat_file(const char *, size_t, bool , off64_t, off64_t, bool);6 static unsigned int cat_file(const char *, size_t, bool); 7 7 8 8 #endif /* CAT_H */ -
uspace/app/sportdmp/sportdmp.c
rfb8dcb4 r063ae706 27 27 */ 28 28 29 #include <errno.h> 30 #include <stdio.h> 31 #include <devman.h> 32 #include <ipc/devman.h> 29 33 #include <device/char_dev.h> 30 #include <errno.h>31 34 #include <ipc/serial_ctl.h> 32 #include <loc.h>33 #include <stdio.h>34 35 35 36 #define BUF_SIZE 1 36 37 37 static void syntax_print(void) 38 { 39 fprintf(stderr, "Usage: sportdmp <baud> <device_service>\n"); 38 static void syntax_print() { 39 fprintf(stderr, "Usage: sportdmp <baud> <device_path>\n"); 40 40 } 41 41 42 42 int main(int argc, char **argv) 43 43 { 44 const char* svc_path = "devices/\\hw\\pci0\\00:01.0\\com1\\a";44 const char* devpath = "/hw/pci0/00:01.0/com1/a"; 45 45 sysarg_t baud = 9600; 46 46 … … 56 56 57 57 if (argc > 2) { 58 svc_path = argv[2];58 devpath = argv[2]; 59 59 } 60 60 … … 64 64 } 65 65 66 service_id_t svc_id;67 int rc = loc_service_get_id(svc_path, &svc_id, IPC_FLAG_BLOCKING);66 devman_handle_t device; 67 int rc = devman_fun_get_handle(devpath, &device, IPC_FLAG_BLOCKING); 68 68 if (rc != EOK) { 69 fprintf(stderr, "Cannot find device service %s\n", svc_path);69 fprintf(stderr, "Cannot open device %s\n", devpath); 70 70 return 1; 71 71 } 72 72 73 async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE, svc_id,73 async_sess_t *sess = devman_device_connect(EXCHANGE_SERIALIZE, device, 74 74 IPC_FLAG_BLOCKING); 75 75 if (!sess) { 76 fprintf(stderr, " Failed connecting to service %s\n", svc_path);76 fprintf(stderr, "Cannot connect device\n"); 77 77 } 78 78 … … 83 83 84 84 if (rc != EOK) { 85 fprintf(stderr, " Failed settingserial properties\n");85 fprintf(stderr, "Cannot set serial properties\n"); 86 86 return 2; 87 87 } … … 89 89 uint8_t *buf = (uint8_t *) malloc(BUF_SIZE); 90 90 if (buf == NULL) { 91 fprintf(stderr, " Failed allocatingbuffer\n");91 fprintf(stderr, "Cannot allocate buffer\n"); 92 92 return 3; 93 93 } -
uspace/app/tester/hw/serial/serial1.c
rfb8dcb4 r063ae706 42 42 #include <async.h> 43 43 #include <ipc/services.h> 44 #include <loc.h> 44 #include <ipc/devman.h> 45 #include <devman.h> 45 46 #include <device/char_dev.h> 46 47 #include <str.h> … … 70 71 } 71 72 72 service_id_t svc_id;73 int res = loc_service_get_id("devices/\\hw\\pci0\\00:01.0\\com1\\a",74 &svc_id,IPC_FLAG_BLOCKING);73 devman_handle_t handle; 74 int res = devman_fun_get_handle("/hw/pci0/00:01.0/com1/a", &handle, 75 IPC_FLAG_BLOCKING); 75 76 if (res != EOK) 76 return " Failed getting serial port service ID";77 78 async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE, svc_id,77 return "Could not get serial device handle"; 78 79 async_sess_t *sess = devman_device_connect(EXCHANGE_SERIALIZE, handle, 79 80 IPC_FLAG_BLOCKING); 80 81 if (!sess) 81 return " Failed connectingto serial device";82 return "Unable to connect to serial device"; 82 83 83 84 char *buf = (char *) malloc(cnt + 1); 84 85 if (buf == NULL) { 85 86 async_hangup(sess); 86 return "Failed allocatinginput buffer";87 return "Failed to allocate input buffer"; 87 88 } 88 89 … … 111 112 free(buf); 112 113 async_hangup(sess); 113 return "Failed settingserial communication parameters";114 } 115 116 TPRINTF("Trying reading%zu characters from serial device "117 "( svc_id=%" PRIun ")\n", cnt, svc_id);114 return "Failed to set serial communication parameters"; 115 } 116 117 TPRINTF("Trying to read %zu characters from serial device " 118 "(handle=%" PRIun ")\n", cnt, handle); 118 119 119 120 size_t total = 0; … … 129 130 free(buf); 130 131 async_hangup(sess); 131 return "Failed read ingfrom serial device";132 return "Failed read from serial device"; 132 133 } 133 134 … … 164 165 free(buf); 165 166 async_hangup(sess); 166 return "Failed writ ingto serial device";167 return "Failed write to serial device"; 167 168 } 168 169 -
uspace/drv/bus/isa/isa.c
rfb8dcb4 r063ae706 66 66 #include <ops/hw_res.h> 67 67 68 #include <devman.h> 69 #include <ipc/devman.h> 68 70 #include <device/hw_res.h> 69 71 -
uspace/drv/bus/usb/uhcirh/port.c
rfb8dcb4 r063ae706 37 37 #include <str_error.h> 38 38 #include <async.h> 39 #include <devman.h> 39 40 40 41 #include <usb/usb.h> /* usb_address_t */ -
uspace/drv/bus/usb/usbhub/port.c
rfb8dcb4 r063ae706 35 35 36 36 #include <bool.h> 37 #include <devman.h> 37 38 #include <errno.h> 38 39 #include <str_error.h> -
uspace/drv/char/ps2mouse/main.c
rfb8dcb4 r063ae706 35 35 #include <libarch/inttypes.h> 36 36 #include <ddf/driver.h> 37 #include <devman.h> 37 38 #include <device/hw_res_parsed.h> 38 39 #include <errno.h> -
uspace/drv/char/xtkbd/main.c
rfb8dcb4 r063ae706 35 35 #include <libarch/inttypes.h> 36 36 #include <ddf/driver.h> 37 #include <devman.h> 37 38 #include <device/hw_res_parsed.h> 38 39 #include <errno.h> -
uspace/drv/infrastructure/root/root.c
rfb8dcb4 r063ae706 53 53 #include <ddf/driver.h> 54 54 #include <ddf/log.h> 55 #include <devman.h> 56 #include <ipc/devman.h> 55 57 56 58 #define NAME "root" -
uspace/drv/infrastructure/rootpc/rootpc.c
rfb8dcb4 r063ae706 48 48 #include <ddf/driver.h> 49 49 #include <ddf/log.h> 50 #include <devman.h> 51 #include <ipc/devman.h> 50 52 #include <ipc/dev_iface.h> 51 53 #include <ops/hw_res.h> -
uspace/drv/nic/e1k/e1k.c
rfb8dcb4 r063ae706 46 46 #include <ddf/log.h> 47 47 #include <ddf/interrupt.h> 48 #include <devman.h> 48 49 #include <device/hw_res_parsed.h> 49 50 #include <device/pci.h> -
uspace/lib/net/generic/net_remote.c
rfb8dcb4 r063ae706 40 40 #include <malloc.h> 41 41 #include <async.h> 42 #include <devman.h> 42 43 #include <generic.h> 43 44 #include <net/modules.h> -
uspace/lib/usb/src/ddfiface.c
rfb8dcb4 r063ae706 33 33 * Implementations of DDF interfaces functions (actual implementation). 34 34 */ 35 #include <ipc/devman.h> 35 36 #include <devman.h> 36 37 #include <async.h> -
uspace/lib/usbvirt/src/ipc_dev.c
rfb8dcb4 r063ae706 38 38 #include <assert.h> 39 39 #include <async.h> 40 #include <devman.h> 40 41 #include <usbvirt/device.h> 41 42 #include <usbvirt/ipc.h> -
uspace/lib/usbvirt/src/ipc_hc.c
rfb8dcb4 r063ae706 38 38 #include <assert.h> 39 39 #include <async.h> 40 #include <devman.h> 40 41 #include <usbvirt/device.h> 41 42 #include <usbvirt/ipc.h>
Note:
See TracChangeset
for help on using the changeset viewer.