summaryrefslogtreecommitdiff
path: root/debian/patches/makedev_parted_store.patch
blob: ea10edff625377b72aa03b83cb1a364deb76fd91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Add option -p to MAKEDEV to use user-space parted stores for partition devices.

Index: hurd/sutils/MAKEDEV.sh
===================================================================
--- hurd.orig/sutils/MAKEDEV.sh	2010-07-08 00:48:13.000000000 +0000
+++ hurd/sutils/MAKEDEV.sh	2010-07-08 01:18:26.000000000 +0000
@@ -10,6 +10,7 @@
 DEVDIR=`pwd`	# Reset below by -D/--devdir command line option.
 STFLAGS="-g"	# Set to -k if active translators are to be kept.
 KEEP=		# Set to something if existing files are to be left alone.
+USE_PARTSTORE=	# Whether to use the newer part: stores
 
 while :; do
   case "$1" in
@@ -22,6 +23,8 @@
                              embedded in a translator; default is the cwd
   -k, --keep-active          Leave any existing active translator running
   -K, --keep-all             Don't overwrite existing files
+  -p, --parted               Prefer user-space parted stores to kernel devices
+                             for partition devices
   -n, --dry-run              Don't actually execute any commands
   -v, --verbose              Show what commands are executed to make the devices
   -?, --help                 Give this help list
@@ -34,11 +37,12 @@
     -D*)        DEVDIR="`echo "$1" | sed 's/^-D//'`"; shift 1;;
     --keep-active|-k) STFLAGS="-k"; shift;;
     --keep-all|-K) KEEP=1; shift;;
+    --parted|-p) USE_PARTSTORE=1; shift;;
     --verbose|-v) ECHO=echo; shift;;
     --dry-run|-n) EXEC=:; shift;;
     -nv|-vn)      ECHO=echo; EXEC=:; shift;;
     --usage)
-      echo "Usage: $0 [-V?] [-D DIR] [--help] [--usage] [--version]"
+      echo "Usage: $0 [-V?] [-D DIR] [--help] [--usage] [--version] [--parted]"
       echo "                [--devdir=DIR] [--keep-active] [--keep-all] DEVNAME..."
       exit 0;;
     --version|-V)
@@ -150,6 +154,7 @@
 	;;
 
       [hrsc]d*)
+	local sliceno=
         local n="${I#?d}"
 	local major="${n%%[!0-9]*}"
 	if [ -z "$major" ]; then
@@ -170,7 +175,9 @@
 	    ;;
 	  esac
 	  case "$rest" in
-	  '') ;;	# Whole slice
+	  '')		# Whole slice, can use parted stores
+	    sliceno=$slice
+	    ;;
 	  [a-z]) ;;	# BSD partition after slice
 	  *)
 	    lose "$I: Invalid partition \`$rest'"
@@ -183,7 +190,12 @@
 	esac
 
 	# The device name passed all syntax checks, so finally use it!
-	st $I root 640 /hurd/storeio $I
+	if [ "$USE_PARTSTORE" ] && [ -z "$rest" ] && [ "$sliceno" ]; then
+	  local dev=${I%s[0-9]*}
+	  st $I root 640 /hurd/storeio -T typed part:$sliceno:device:$dev
+	else
+	  st $I root 640 /hurd/storeio $I
+	fi
 	;;
 
       # /dev/shm is used by the POSIX.1 shm_open call in libc.