drivers/s390/block/dasd_ioctl.c
Source file repositories/reference/linux-study-clean/drivers/s390/block/dasd_ioctl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/block/dasd_ioctl.c- Extension
.c- Size
- 17859 bytes
- Lines
- 727
- Domain
- Driver Families
- Bucket
- drivers/s390
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/interrupt.hlinux/export.hlinux/major.hlinux/fs.hlinux/blkpg.hlinux/slab.hasm/ccwdev.hasm/schid.hasm/cmb.hlinux/uaccess.hlinux/dasd_mod.hdasd_int.h
Detected Declarations
function Authorfunction dasd_ioctl_enablefunction dasd_ioctl_disablefunction dasd_ioctl_quiescefunction dasd_ioctl_resumefunction dasd_ioctl_abortiofunction dasd_ioctl_allowiofunction dasd_formatfunction dasd_check_formatfunction dasd_ioctl_formatfunction test_bitfunction dasd_ioctl_check_formatfunction dasd_release_spacefunction dasd_ioctl_release_spacefunction test_bitfunction dasd_ioctl_copy_pair_swapfunction dasd_ioctl_reset_profilefunction dasd_ioctl_read_profilefunction dasd_ioctl_reset_profilefunction dasd_ioctl_read_profilefunction __dasd_ioctl_informationfunction dasd_ioctl_informationfunction dasd_set_read_onlyfunction dasd_ioctl_readall_cmbfunction dasd_ioctlfunction dasd_biodasdinfoexport dasd_biodasdinfo
Annotated Snippet
test_bit(DASD_FLAG_DEVICE_RO, &base->flags)) {
dasd_put_device(base);
return -EROFS;
}
if (copy_from_user(&fdata, argp, sizeof(struct format_data_t))) {
dasd_put_device(base);
return -EFAULT;
}
if (bdev_is_partition(bdev)) {
pr_warn("%s: The specified DASD is a partition and cannot be formatted\n",
dev_name(&base->cdev->dev));
dasd_put_device(base);
return -EINVAL;
}
rc = dasd_format(base->block, &fdata);
dasd_put_device(base);
return rc;
}
/*
* Check device format
*/
static int dasd_ioctl_check_format(struct block_device *bdev, void __user *argp)
{
struct format_check_t cdata;
struct dasd_device *base;
int rc = 0;
if (!argp)
return -EINVAL;
base = dasd_device_from_gendisk(bdev->bd_disk);
if (!base)
return -ENODEV;
if (bdev_is_partition(bdev)) {
pr_warn("%s: The specified DASD is a partition and cannot be checked\n",
dev_name(&base->cdev->dev));
rc = -EINVAL;
goto out_err;
}
if (copy_from_user(&cdata, argp, sizeof(cdata))) {
rc = -EFAULT;
goto out_err;
}
rc = dasd_check_format(base->block, &cdata);
if (rc)
goto out_err;
if (copy_to_user(argp, &cdata, sizeof(cdata)))
rc = -EFAULT;
out_err:
dasd_put_device(base);
return rc;
}
static int dasd_release_space(struct dasd_device *device,
struct format_data_t *rdata)
{
if (!device->discipline->is_ese && !device->discipline->is_ese(device))
return -ENOTSUPP;
if (!device->discipline->release_space)
return -ENOTSUPP;
return device->discipline->release_space(device, rdata);
}
/*
* Release allocated space
*/
static int dasd_ioctl_release_space(struct block_device *bdev, void __user *argp)
{
struct format_data_t rdata;
struct dasd_device *base;
int rc = 0;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
if (!argp)
return -EINVAL;
base = dasd_device_from_gendisk(bdev->bd_disk);
if (!base)
return -ENODEV;
if (base->features & DASD_FEATURE_READONLY ||
test_bit(DASD_FLAG_DEVICE_RO, &base->flags)) {
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/export.h`, `linux/major.h`, `linux/fs.h`, `linux/blkpg.h`, `linux/slab.h`, `asm/ccwdev.h`, `asm/schid.h`.
- Detected declarations: `function Author`, `function dasd_ioctl_enable`, `function dasd_ioctl_disable`, `function dasd_ioctl_quiesce`, `function dasd_ioctl_resume`, `function dasd_ioctl_abortio`, `function dasd_ioctl_allowio`, `function dasd_format`, `function dasd_check_format`, `function dasd_ioctl_format`.
- Atlas domain: Driver Families / drivers/s390.
- Implementation status: integration implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.