From 482ee36128787cf9d7a39898354da7789136f594 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Fri, 1 May 2015 15:03:50 +0200 Subject: [PATCH] loop.4: Document the loop-control device Signed-off-by: Michael Kerrisk --- man4/loop.4 | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/man4/loop.4 b/man4/loop.4 index c8c6bf97d..e69ab0d71 100644 --- a/man4/loop.4 +++ b/man4/loop.4 @@ -1,4 +1,5 @@ .\" Copyright 2002 Urs Thuermann (urs@isnogud.escape.de) +.\" and Copyright 2015 Michael Kerrisk .\" .\" %%%LICENSE_START(GPLv2+_DOC_FULL) .\" This is free documentation; you can redistribute it and/or @@ -24,7 +25,7 @@ .\" .TH LOOP 4 "2005-12-05" "Linux" "Linux Programmer's Manual" .SH NAME -loop \- driver for loop devices +loop, loop-control \- loop devices .SH SYNOPSIS #include .SH DESCRIPTION @@ -166,8 +167,44 @@ struct loop_info64 { }; .in .fi +.SS /dev/loop-control +Since Linux 3.1, +.\" commit 770fe30a46a12b6fb6b63fbe1737654d28e84844 +the kernel provides the +.I /dev/loop-control +device, which permits an application to dynamically find a free device, +and to add and remove loop devices from the system. +To perform these operations, one first opens +.IR /dev/loop-control +and then employs one of the following +.BR ioctl (2) +operations: +.TP +.B LOOP_CTL_GET_FREE +Allocate or find a free loop device for use. +On success, the device number is returned as the result of the call. +This operation takes no argument. +.TP +.B LOOP_CTL_ADD +Add the new loop device whose device number is specified +as a long integer in the third +.BR ioctl (2) +argument. +On success, the device index is returned as the result of the call. +If the device is already allocated, the call fails with the error +.BR EEXIST . +.TP +.B LOOP_CTL_REMOVE +Remove the loop device whose device number is specified +as a long integer in the third +.BR ioctl (2) +argument. +On success, the device number is returned as the result of the call. +If the device is in use, the call fails with the error +.BR EBUSY . .SH FILES -/dev/loop[0-7]: The loop block special device files +.IR /dev/loop* : +the loop block special device files .SH "SEE ALSO" .BR losetup (8), .BR mount (8)