[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
22/28: file-systems: Add support for JFS.
From: |
guix-commits |
Subject: |
22/28: file-systems: Add support for JFS. |
Date: |
Fri, 3 Jan 2020 07:54:47 -0500 (EST) |
nckx pushed a commit to branch master
in repository guix.
commit 1abbe7c64bfcd2b0f600398950e07bfdd9d4e1b4
Author: Tobias Geerinckx-Rice <address@hidden>
Date: Tue Dec 31 01:25:10 2019 +0100
file-systems: Add support for JFS.
* gnu/build/file-systems.scm (%jfs-endianness): New syntax.
(jfs-superblock?, read-jfs-superblock, jfs-superblock-uuid)
(jfs-superblock-volume-name, check-jfs-file-system): New procedures.
(%partition-label-readers, %partition-uuid-readers, check-file-system):
Register them.
---
gnu/build/file-systems.scm | 49 ++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 47 insertions(+), 2 deletions(-)
diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index 13c44aa..9299cc2 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2016, 2017 David Craven <address@hidden>
;;; Copyright © 2017 Mathieu Othacehe <address@hidden>
;;; Copyright © 2019 Guillaume Le Vaillant <address@hidden>
+;;; Copyright © 2019 Tobias Geerinckx-Rice <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -296,6 +297,45 @@ string. Trailing spaces are trimmed."
;;;
+;;; JFS file systems.
+;;;
+
+;; Taken from <linux-libre>/fs/jfs/jfs_superblock.h.
+
+(define-syntax %jfs-endianness
+ ;; Endianness of JFS file systems.
+ (identifier-syntax (endianness little)))
+
+(define (jfs-superblock? sblock)
+ "Return #t when SBLOCK is a JFS superblock."
+ (bytevector=? (sub-bytevector sblock 0 4)
+ (string->utf8 "JFS1")))
+
+(define (read-jfs-superblock device)
+ "Return the raw contents of DEVICE's JFS superblock as a bytevector, or #f
+if DEVICE does not contain a JFS file system."
+ (read-superblock device 32768 184 jfs-superblock?))
+
+(define (jfs-superblock-uuid sblock)
+ "Return the UUID of JFS superblock SBLOCK as a 16-byte bytevector."
+ (sub-bytevector sblock 136 16))
+
+(define (jfs-superblock-volume-name sblock)
+ "Return the volume name of SBLOCK as a string of at most 16 characters, or
+#f if SBLOCK has no volume name."
+ (null-terminated-latin1->string (sub-bytevector sblock 152 16)))
+
+(define (check-jfs-file-system device)
+ "Return the health of a JFS file system on DEVICE."
+ (match (status:exit-val
+ (system* "jfs_fsck" "-p" "-v" device))
+ (0 'pass)
+ (1 'errors-corrected)
+ (2 'reboot-required)
+ (_ 'fatal-error)))
+
+
+;;;
;;; LUKS encrypted devices.
;;;
@@ -420,7 +460,9 @@ partition field reader that returned a value."
(partition-field-reader read-fat32-superblock
fat32-superblock-volume-name)
(partition-field-reader read-fat16-superblock
- fat16-superblock-volume-name)))
+ fat16-superblock-volume-name)
+ (partition-field-reader read-jfs-superblock
+ jfs-superblock-volume-name)))
(define %partition-uuid-readers
(list (partition-field-reader read-iso9660-superblock
@@ -432,7 +474,9 @@ partition field reader that returned a value."
(partition-field-reader read-fat32-superblock
fat32-superblock-uuid)
(partition-field-reader read-fat16-superblock
- fat16-superblock-uuid)))
+ fat16-superblock-uuid)
+ (partition-field-reader read-jfs-superblock
+ jfs-superblock-uuid)))
(define read-partition-label
(cut read-partition-field <> %partition-label-readers))
@@ -527,6 +571,7 @@ were found."
((string-prefix? "ext" type) check-ext2-file-system)
((string-prefix? "btrfs" type) check-btrfs-file-system)
((string-suffix? "fat" type) check-fat-file-system)
+ ((string-prefix? "jfs" type) check-jfs-file-system)
(else #f)))
(if check-procedure
- 07/28: gnu: protozero: Update to 1.6.8., (continued)
- 07/28: gnu: protozero: Update to 1.6.8., guix-commits, 2020/01/03
- 02/28: gnu: fasm: Expand acronym in description., guix-commits, 2020/01/03
- 04/28: gnu: beep: Update to 1.4.7., guix-commits, 2020/01/03
- 08/28: gnu: opari2: Update to 2.0.5., guix-commits, 2020/01/03
- 13/28: gnu: eyed3: Update to 0.8.12., guix-commits, 2020/01/03
- 16/28: gnu: samplv1: Update to 0.9.12., guix-commits, 2020/01/03
- 10/28: gnu: musl: Update to 1.1.24., guix-commits, 2020/01/03
- 12/28: gnu: zam-plugins: Update to 3.12., guix-commits, 2020/01/03
- 15/28: gnu: drumkv1: Update to 0.9.12., guix-commits, 2020/01/03
- 14/28: gnu: synthv1: Update to 0.9.12., guix-commits, 2020/01/03
- 22/28: file-systems: Add support for JFS.,
guix-commits <=
- 21/28: gnu: gloox: Update to 1.0.23., guix-commits, 2020/01/03
- 17/28: gnu: padthv1: Update to 0.9.12., guix-commits, 2020/01/03
- 18/28: gnu: qtractor: Update to 0.9.12., guix-commits, 2020/01/03
- 20/28: gnu: hexchat: Update to 2.14.3., guix-commits, 2020/01/03
- 24/28: gnu: Add jfsutils-static., guix-commits, 2020/01/03
- 27/28: tests: install: Test a JFS root file system., guix-commits, 2020/01/03
- 09/28: gnu: whois: Update to 5.5.4., guix-commits, 2020/01/03
- 25/28: gnu: Add jfs_fsck-static., guix-commits, 2020/01/03
- 19/28: gnu: tuxguitar: Update to 1.5.3., guix-commits, 2020/01/03
- 11/28: gnu: x42-plugins: Update to 20191215., guix-commits, 2020/01/03