Spinlock save cpu flags
This commit is contained in:
@@ -68,6 +68,7 @@ static size_t tar_parse (struct tarfs* tarfs, uint8_t* addr, size_t max_size) {
|
||||
int tarfs_mount (struct vfs_volume* volume, struct proc* proc, struct reschedule_ctx* rctx,
|
||||
bool format) {
|
||||
(void)format;
|
||||
uint64_t fd;
|
||||
|
||||
struct tarfs* tarfs = malloc (sizeof (*tarfs));
|
||||
|
||||
@@ -82,18 +83,18 @@ int tarfs_mount (struct vfs_volume* volume, struct proc* proc, struct reschedule
|
||||
size_t total_size, sector_size;
|
||||
int ret;
|
||||
|
||||
spin_lock (&back_device->lock);
|
||||
spin_lock (&back_device->lock, &fd);
|
||||
|
||||
ret = device_op (back_device, XDRV_GET_SIZE, NULL, NULL, &total_size);
|
||||
if (ret < 0) {
|
||||
spin_unlock (&back_device->lock);
|
||||
spin_unlock (&back_device->lock, fd);
|
||||
free (volume->udata);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = device_op (back_device, XDRV_GET_SECTOR_SIZE, NULL, NULL, §or_size);
|
||||
if (ret < 0) {
|
||||
spin_unlock (&back_device->lock);
|
||||
spin_unlock (&back_device->lock, fd);
|
||||
free (volume->udata);
|
||||
return ret;
|
||||
}
|
||||
@@ -101,7 +102,7 @@ int tarfs_mount (struct vfs_volume* volume, struct proc* proc, struct reschedule
|
||||
uint8_t* buffer = malloc (total_size);
|
||||
|
||||
if (buffer == NULL) {
|
||||
spin_unlock (&back_device->lock);
|
||||
spin_unlock (&back_device->lock, fd);
|
||||
free (volume->udata);
|
||||
volume->udata = NULL;
|
||||
return ret;
|
||||
@@ -113,7 +114,7 @@ int tarfs_mount (struct vfs_volume* volume, struct proc* proc, struct reschedule
|
||||
ret = device_op (back_device, XDRV_READ, proc, rctx, §or, §or_count, dest);
|
||||
}
|
||||
|
||||
spin_unlock (&back_device->lock);
|
||||
spin_unlock (&back_device->lock, fd);
|
||||
|
||||
if (ret < 0) {
|
||||
free (buffer);
|
||||
|
||||
Reference in New Issue
Block a user