summaryrefslogtreecommitdiffstats
path: root/include/blkdev.h
Commit message (Collapse)AuthorAgeFilesLines
* lib: include sys/stat.h for struct statRuediger Meier2016-03-071-0/+1
| | | | | | | Compiler warning: 'struct stat' will not be visible outside of this function [-Wvisibility] Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* lib/blkdev: add open_blkdev_or_file() functionSami Kerola2015-11-221-0/+3
| | | | | | | | | Purpose of this function is to open a path that is potentially pointing to a block device or file without races. The function also proper open(3) flags are used to check the device is not busy, and finally warning is been printed if a block device happens to be misaligned. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* Fix typo "ioclt" in various files.Lauri Nurmi2014-07-111-1/+1
|
* docs: update links to http://git.kernel.org/ web repository viewsSami Kerola2013-11-121-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include: cleanup copyright headersKarel Zak2013-01-081-0/+6
| | | | | | | We use the code from include/ and lib/ on many places, so use public domain if possible or LGPL for code copied from libs. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/blkdev: return static strings by blkdev_scsi_type_to_name()Karel Zak2012-06-151-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/blkdev: cleanup upKarel Zak2012-06-151-24/+27
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blkdev: add blkdev_scsi_type_to_name()Sami Kerola2012-06-111-0/+21
| | | | | | | | Add a function, and necessary symbols, to convert scsi type id's to name strings. Reference: http://permalink.gmane.org/gmane.linux.utilities.util-linux-ng/5994 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fdisk: move kernel geometry into blkdevDavidlohr Bueso2012-04-101-0/+3
| | | | | | This is a more generic place for this ioctl. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* blkdev: add is_blkdev functionDavidlohr Bueso2012-01-051-0/+3
| | | | | | We should have the most basic of checks in this library to see whether or not a block device is being used. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* fdisk: use CDROM_GET_CAPABILITY ioctlDavidlohr Bueso2012-01-021-0/+9
| | | | | | And replace the current archaic logic of is_ide_cdrom_or_tape(). Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* build-sys: check HAVE_ definitions with #ifdef [smatch scan]Sami Kerola2011-12-021-1/+1
| | | | | | Fix to `warning: undefined preprocessor identifier' messages. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib: [blkdev.c] add blkdev_get_physector_size()Davidlohr Bueso2011-06-271-0/+3
| | | | | | | | This function uses the BLKPBSZGET ioctl to get the physical block size of the device. Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* blkdev: add blkdev_is_misaligned()Davidlohr Bueso2011-04-121-0/+3
| | | | | | | | | | This functions returns the status of the device's alignment. It will be 0 when aligned, otherwise return the offset. [kzak@redhat.com: - returns 0 if the ioctl failed] Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* make _IO macros available on SolarisFabian Groffen2011-01-201-0/+3
| | | | | | | | The _IO macro is defined in sys/ioccom.h on various platforms. However, on Solaris it isn't included by ioctl.h, so include it explicitly if available. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* make major and minor available on SolarisKarel Zak2011-01-201-0/+4
| | | | | Reported-by: Fabian Groffen <grobian@gentoo.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* include: cleanup blkdev.hKarel Zak2010-08-241-37/+42
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: add BLKDISCARDZEROESKarel Zak2010-08-241-0/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fsfreeze: new commandHajime Taira2010-05-141-0/+5
| | | | | | | | | | [kzak@redhat.com: - cleanup - add long options - add note about DM to the man page - use err.h and nls.h] Signed-off-by: Hajime Taira <htaira@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: revert ugly ENOMEDIUM supportKarel Zak2010-04-271-3/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* liblkid: move getsize.c code to lib/Karel Zak2010-03-101-1/+5
| | | | | | .. and cleanup blkdev_get_size() usage in libblkid. Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: fix topology ioctlsKarel Zak2009-10-151-3/+5
| | | | | | | | | | | | | | kernel 2.6.32-rc4 (kvm): # blockdev -v --getss --getpbsz --getiomin --getioopt --getmaxsect --getalignoff /dev/sda get logical block (sector) size: 512 get physical block (sector) size: 512 get minimum I/O size: 512 get optimal I/O size: 0 get max sectors per request: 1024 get alignment offset: 0 Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: add topology ioctls supportKarel Zak2009-10-151-0/+6
| | | | | | | | | | | | new options: --getpbsz get physical block (sector) size --getiomin get minimum I/O size --getioopt get optimal I/O size --getalignoff get alignment offset --getmaxsect get max sectors per request Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: add is_whole_disk() from fdisk codeKarel Zak2009-03-111-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: (and partx) remove BLKGETLASTSECTKarel Zak2009-02-261-2/+0Star
| | | | | | This odd ioctl is unsupported in the current 2.4 and 2.6 mainline. Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: retry on ENOMEDIUMMatthias Koenig2008-07-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to a change in kernel behaviour when opening CDROM devices, we need to retry the open/mount call when ENOMEDIUM is returned. Explanation from Tejun Heo: Okay, the difference is from the addition of cdrom_get_media_event() call to both sr_drive_status() and ide_cdrom_drive_status(). Previously, the cdrom driver can't differentiate between tray closed w/ no media and tray open and always returned tray open, which triggers close and retry in the open logic which probably have delayed things enough to get the media recognized. Now the cdrom driver can discern between tray closed w/o media and device not ready for other reasons and returns -ENOMEDIUM on the former. This is all good and dandy but the problem seems that some drives report no media right after the tray is closed but it hasn't properly detected the media yet. It seems the only way to work around the problem is via sensible retries (e.g. try three times 5 secs apart) and I don't think we can add that type of retry logic into cdrom open path. Please note that the previous logic wasn't water proof. Some drives can take longer to recognize the media is there and could have failed the in-kernel retry too. Also, reading the media can take quite some time and during that period the drive reports media present but device not ready. The driver will retry the command (e.g. READ TOC for open) five times but all of them can fail w/ EMEDIUMTYPE. [kzak@redhat.com: - add CRDOM_NOMEDIUM_RETRIES to blkdev.h - add verbose message to mount.c] Signed-off-by: Matthias Koenig <mkoenig@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: blkdev.c clean up, non-linux supportSamuel Thibault2008-07-241-3/+7
| | | | | | | [kzak@redhat.com: split the original patch to small patches] Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* elvtune: use get_linux_version()Karel Zak2007-11-071-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: add blkdev.{c,h}Stefan Krah2007-11-071-0/+55
Now we duplicate BLK* ioctls on many places... This patch also fix BLKGETSIZE64 usage in dependence on kernel version. Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Stefan Krah <stefan@bytereef.org> Signed-off-by: Karel Zak <kzak@redhat.com>