diff options
author | Marvin Borner | 2020-03-18 17:32:50 +0100 |
---|---|---|
committer | Marvin Borner | 2020-03-18 17:32:50 +0100 |
commit | f495cc1e93710c233292a503720ec235a61b685c (patch) | |
tree | 23b0b4b82b6d80001c1ffdb15f00b93cbdc65722 /src/kernel/fs/iso9660 | |
parent | c6657aac0c5d5ecf347bc082cb6df38e1174d297 (diff) |
Applied official linux kernel code style guidelines
Due to my change to vim and the clang-format plugin this was needed!
Diffstat (limited to 'src/kernel/fs/iso9660')
-rw-r--r-- | src/kernel/fs/iso9660/iso9660.c | 95 | ||||
-rw-r--r-- | src/kernel/fs/iso9660/iso9660.h | 4 |
2 files changed, 48 insertions, 51 deletions
diff --git a/src/kernel/fs/iso9660/iso9660.c b/src/kernel/fs/iso9660/iso9660.c index 81ef18a..ab00c31 100644 --- a/src/kernel/fs/iso9660/iso9660.c +++ b/src/kernel/fs/iso9660/iso9660.c @@ -6,57 +6,54 @@ struct iso9660_entity *ISO9660_get(char **dirs, uint8_t dirs_sz) { - ATAPI_read(1, 0x10); - uint32_t last_len = *(uint32_t *) ( - ATAPI_PIO_BUFFER + - ISO9660_ROOT_RECORD_OFFSET + - ISO9660_DIR_EAR_LENGTH - ); - uint32_t last_lba = *(uint32_t *) ( - ATAPI_PIO_BUFFER + - ISO9660_ROOT_RECORD_OFFSET + - ISO9660_DIR_EAR_LBA - ); - - for (uint8_t dirs_i = 0; dirs_i < dirs_sz; dirs_i++) { - ATAPI_read((last_len % 2048 != 0) + (last_len / 2048), last_lba); - - uint8_t found = 0; - for (uint32_t i = 0; i < last_len && !found;) { - if (!*(uint8_t *) (ATAPI_PIO_BUFFER + i + ISO9660_DIR_RECORD_LENGTH)) - break; - - char *filename = (char *) (ATAPI_PIO_BUFFER + i + ISO9660_DIR_FILENAME); - - for (uint32_t j = 0; j < ISO9660_DIR_FILENAME_LENGTH; j++) { - if (filename[j] == ';') { - filename[j] = 0; - break; - } - } - - if (strcmp(dirs[dirs_i], filename) == 0) { - found = 1; - last_lba = *(uint32_t *) (ATAPI_PIO_BUFFER + i + ISO9660_DIR_EAR_LBA); - last_len = *(uint32_t *) (ATAPI_PIO_BUFFER + i + ISO9660_DIR_EAR_LENGTH); - } else { - i += *(uint8_t *) (ATAPI_PIO_BUFFER + i + ISO9660_DIR_RECORD_LENGTH); - } - } - - if (!found) { - return (struct iso9660_entity *) 0; - } - } - - struct iso9660_entity *ret = (struct iso9660_entity *) kmalloc(sizeof(struct iso9660_entity)); - ret->lba = last_lba; - ret->length = last_len; - return ret; + ATAPI_read(1, 0x10); + uint32_t last_len = *(uint32_t *)(ATAPI_PIO_BUFFER + ISO9660_ROOT_RECORD_OFFSET + + ISO9660_DIR_EAR_LENGTH); + uint32_t last_lba = + *(uint32_t *)(ATAPI_PIO_BUFFER + ISO9660_ROOT_RECORD_OFFSET + ISO9660_DIR_EAR_LBA); + + for (uint8_t dirs_i = 0; dirs_i < dirs_sz; dirs_i++) { + ATAPI_read((last_len % 2048 != 0) + (last_len / 2048), last_lba); + + uint8_t found = 0; + for (uint32_t i = 0; i < last_len && !found;) { + if (!*(uint8_t *)(ATAPI_PIO_BUFFER + i + ISO9660_DIR_RECORD_LENGTH)) + break; + + char *filename = (char *)(ATAPI_PIO_BUFFER + i + ISO9660_DIR_FILENAME); + + for (uint32_t j = 0; j < ISO9660_DIR_FILENAME_LENGTH; j++) { + if (filename[j] == ';') { + filename[j] = 0; + break; + } + } + + if (strcmp(dirs[dirs_i], filename) == 0) { + found = 1; + last_lba = + *(uint32_t *)(ATAPI_PIO_BUFFER + i + ISO9660_DIR_EAR_LBA); + last_len = *(uint32_t *)(ATAPI_PIO_BUFFER + i + + ISO9660_DIR_EAR_LENGTH); + } else { + i += *(uint8_t *)(ATAPI_PIO_BUFFER + i + ISO9660_DIR_RECORD_LENGTH); + } + } + + if (!found) { + return (struct iso9660_entity *)0; + } + } + + struct iso9660_entity *ret = + (struct iso9660_entity *)kmalloc(sizeof(struct iso9660_entity)); + ret->lba = last_lba; + ret->length = last_len; + return ret; } uint8_t *ISO9660_read(struct iso9660_entity *entity) { - ATAPI_read((entity->length % 2048 != 0) + (entity->length / 2048), entity->lba); - return (uint8_t *) ATAPI_PIO_BUFFER; + ATAPI_read((entity->length % 2048 != 0) + (entity->length / 2048), entity->lba); + return (uint8_t *)ATAPI_PIO_BUFFER; }
\ No newline at end of file diff --git a/src/kernel/fs/iso9660/iso9660.h b/src/kernel/fs/iso9660/iso9660.h index 86629e4..9ba9cfa 100644 --- a/src/kernel/fs/iso9660/iso9660.h +++ b/src/kernel/fs/iso9660/iso9660.h @@ -11,8 +11,8 @@ #include <stdint.h> struct iso9660_entity { - uint32_t lba; - uint32_t length; + uint32_t lba; + uint32_t length; }; struct iso9660_entity *ISO9660_get(char **dirs, uint8_t dirs_sz); |