Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/lfs_cleanerd Read the padded superblocks to avoid pr...
details: https://anonhg.NetBSD.org/src/rev/7e20ba8e239e
branches: trunk
changeset: 752141:7e20ba8e239e
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Tue Feb 16 23:13:13 2010 +0000
description:
Read the padded superblocks to avoid problems with disks that have
larger sectors than 512 Bytes.
diffstat:
libexec/lfs_cleanerd/lfs_cleanerd.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diffs (40 lines):
diff -r 545b182a16ca -r 7e20ba8e239e libexec/lfs_cleanerd/lfs_cleanerd.c
--- a/libexec/lfs_cleanerd/lfs_cleanerd.c Tue Feb 16 20:42:44 2010 +0000
+++ b/libexec/lfs_cleanerd/lfs_cleanerd.c Tue Feb 16 23:13:13 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.22 2009/10/09 16:35:17 pooka Exp $ */
+/* $NetBSD: lfs_cleanerd.c,v 1.23 2010/02/16 23:13:13 mlelstv Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -203,6 +203,7 @@
struct statvfs sf;
int rootfd;
int i;
+ void *sbuf;
/*
* Get the raw device from the block device.
@@ -233,10 +234,20 @@
return -4;
kops.ko_close(rootfd);
+ sbuf = malloc(LFS_SBPAD);
+ if (sbuf == NULL) {
+ syslog(LOG_ERR, "couldn't malloc superblock buffer");
+ return -1;
+ }
+
/* Load in the superblock */
- if (kops.ko_pread(fs->clfs_devfd, &(fs->lfs_dlfs), sizeof(struct dlfs),
- LFS_LABELPAD) < 0)
+ if (kops.ko_pread(fs->clfs_devfd, sbuf, LFS_SBPAD, LFS_LABELPAD) < 0) {
+ free(sbuf);
return -1;
+ }
+
+ memcpy(&(fs->lfs_dlfs), sbuf, sizeof(struct dlfs));
+ free(sbuf);
/* If this is not a version 2 filesystem, complain and exit */
if (fs->lfs_version != 2) {
Home |
Main Index |
Thread Index |
Old Index