Change formatting rules
This commit is contained in:
@@ -12,12 +12,12 @@
|
||||
#include <status.h>
|
||||
#include <sys/debug.h>
|
||||
|
||||
static int device_probe_partitions_dos (struct proc* proc, struct reschedule_ctx* rctx,
|
||||
struct device* device) {
|
||||
static int device_probe_partitions_dos(struct proc* proc, struct reschedule_ctx* rctx,
|
||||
struct device* device) {
|
||||
uint64_t fd, fsd;
|
||||
|
||||
struct dos_mbr mbr;
|
||||
memset (&mbr, 0, sizeof (mbr));
|
||||
memset(&mbr, 0, sizeof(mbr));
|
||||
size_t sector = 0;
|
||||
size_t sector_count = 1;
|
||||
size_t sector_size;
|
||||
@@ -31,23 +31,23 @@ static int device_probe_partitions_dos (struct proc* proc, struct reschedule_ctx
|
||||
[XDRV_PARTITION_RESCAN] = &partdrv_partition_rescan,
|
||||
};
|
||||
|
||||
spin_lock (&device->lock, &fd);
|
||||
spin_lock(&device->lock, &fd);
|
||||
|
||||
device_op (device, XDRV_GET_SECTOR_SIZE, proc, rctx, &fd, §or_size);
|
||||
device_op(device, XDRV_GET_SECTOR_SIZE, proc, rctx, &fd, §or_size);
|
||||
|
||||
int ret = device_op (device, XDRV_READ, proc, rctx, &fd, §or, §or_count, &mbr);
|
||||
int ret = device_op(device, XDRV_READ, proc, rctx, &fd, §or, §or_count, &mbr);
|
||||
|
||||
if (ret < 0) {
|
||||
spin_unlock (&device->lock, fd);
|
||||
spin_unlock(&device->lock, fd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!(mbr.valid_sign[0] == 0x55 && mbr.valid_sign[1] == 0xAA)) {
|
||||
spin_unlock (&device->lock, fd);
|
||||
spin_unlock(&device->lock, fd);
|
||||
return -ST_PARTITION_ERROR;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < lengthof (mbr.ptes); i++) {
|
||||
for (size_t i = 0; i < lengthof(mbr.ptes); i++) {
|
||||
struct dos_pte* pte = &mbr.ptes[i];
|
||||
|
||||
struct partdrv_init init = {
|
||||
@@ -56,24 +56,23 @@ static int device_probe_partitions_dos (struct proc* proc, struct reschedule_ctx
|
||||
.super = device,
|
||||
};
|
||||
|
||||
char key[fieldsizeof (struct device, key)];
|
||||
memset (key, 0, sizeof (key));
|
||||
snprintf (key, sizeof (key), "%sp%zu", device->key, i);
|
||||
char key[fieldsizeof(struct device, key)];
|
||||
memset(key, 0, sizeof(key));
|
||||
snprintf(key, sizeof(key), "%sp%zu", device->key, i);
|
||||
|
||||
struct device* part_dev = device_create (DEVICE_TYPE_DRIVE, key, ops, lengthof (ops),
|
||||
&partdrv_init, &partdrv_fini, &init, proc, rctx);
|
||||
struct device* part_dev = device_create(DEVICE_TYPE_DRIVE, key, ops, lengthof(ops),
|
||||
&partdrv_init, &partdrv_fini, &init, proc, rctx);
|
||||
|
||||
spin_lock (&part_dev->lock, &fsd);
|
||||
list_append (device->subdevices, &part_dev->subdevices_link);
|
||||
spin_unlock (&part_dev->lock, fsd);
|
||||
spin_lock(&part_dev->lock, &fsd);
|
||||
list_append(device->subdevices, &part_dev->subdevices_link);
|
||||
spin_unlock(&part_dev->lock, fsd);
|
||||
}
|
||||
|
||||
spin_unlock (&device->lock, fd);
|
||||
spin_unlock(&device->lock, fd);
|
||||
|
||||
return ST_OK;
|
||||
}
|
||||
|
||||
int device_probe_partitions (struct proc* proc, struct reschedule_ctx* rctx,
|
||||
struct device* device) {
|
||||
return device_probe_partitions_dos (proc, rctx, device);
|
||||
int device_probe_partitions(struct proc* proc, struct reschedule_ctx* rctx, struct device* device) {
|
||||
return device_probe_partitions_dos(proc, rctx, device);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user