From 3e3d6337d442225cc951a2084191dc61afb34661 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 17 Sep 2009 11:19:20 +0000 Subject: [PATCH 2/2] swaponoff: add uuid/label support This allows swapon -a enable swap when the swap partition is specified by either UUID=... or LABEL=... in /etc/fstab We could have made a separate config option for this but it makes sense to have it with MOUNT_LABEL as you will need that to parse the rest of fstab anyway. Signed-off-by: Natanael Copa --- util-linux/Config.in | 1 + util-linux/swaponoff.c | 7 +++++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/util-linux/Config.in b/util-linux/Config.in index 5f5adc0..49c57e1 100644 --- a/util-linux/Config.in +++ b/util-linux/Config.in @@ -689,6 +689,7 @@ config FEATURE_MOUNT_LABEL help This allows for specifying a device by label or uuid, rather than by name. This feature utilizes the same functionality as blkid/findfs. + This also enables label or uuid support for swapon. config FEATURE_MOUNT_NFS bool "Support mounting NFS file systems" diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index 863f773..d69301f 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c @@ -11,6 +11,10 @@ #include #include +#if ENABLE_FEATURE_MOUNT_LABEL +#include "volume_id.h" +#endif + #if ENABLE_FEATURE_SWAPON_PRI struct globals { int flags; @@ -26,6 +30,9 @@ static int swap_enable_disable(char *device) int status; struct stat st; +#if ENABLE_FEATURE_MOUNT_LABEL + resolve_mount_spec(&device); +#endif xstat(device, &st); #if ENABLE_DESKTOP -- 1.6.4.2