Thu Oct 15 06:25:04 2015 UTC ()
Enable lfs64 in the cleaner.


(dholland)
diff -r1.54 -r1.55 src/libexec/lfs_cleanerd/lfs_cleanerd.c

cvs diff -r1.54 -r1.55 src/libexec/lfs_cleanerd/lfs_cleanerd.c (expand / switch to unified diff)

--- src/libexec/lfs_cleanerd/lfs_cleanerd.c 2015/10/03 08:28:30 1.54
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c 2015/10/15 06:25:04 1.55
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lfs_cleanerd.c,v 1.54 2015/10/03 08:28:30 dholland Exp $ */ 1/* $NetBSD: lfs_cleanerd.c,v 1.55 2015/10/15 06:25:04 dholland Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2005 The NetBSD Foundation, Inc. 4 * Copyright (c) 2005 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Konrad E. Schroder <perseant@hhhh.org>. 8 * by Konrad E. Schroder <perseant@hhhh.org>.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -254,32 +254,47 @@ init_fs(struct clfs *fs, char *fsname) @@ -254,32 +254,47 @@ init_fs(struct clfs *fs, char *fsname)
254 } 254 }
255 255
256 /* Load in the superblock */ 256 /* Load in the superblock */
257 if (kops.ko_pread(fs->clfs_devfd, sbuf, LFS_SBPAD, LFS_LABELPAD) < 0) { 257 if (kops.ko_pread(fs->clfs_devfd, sbuf, LFS_SBPAD, LFS_LABELPAD) < 0) {
258 free(sbuf); 258 free(sbuf);
259 return -1; 259 return -1;
260 } 260 }
261 261
262 __CTASSERT(sizeof(struct dlfs) == sizeof(struct dlfs64)); 262 __CTASSERT(sizeof(struct dlfs) == sizeof(struct dlfs64));
263 memcpy(&fs->lfs_dlfs_u, sbuf, sizeof(struct dlfs)); 263 memcpy(&fs->lfs_dlfs_u, sbuf, sizeof(struct dlfs));
264 free(sbuf); 264 free(sbuf);
265 265
266 /* If it is not LFS, complain and exit! */ 266 /* If it is not LFS, complain and exit! */
267 if (fs->lfs_dlfs_u.u_32.dlfs_magic != LFS_MAGIC) { 267 switch (fs->lfs_dlfs_u.u_32.dlfs_magic) {
 268 case LFS_MAGIC:
 269 fs->lfs_is64 = false;
 270 fs->lfs_dobyteswap = false;
 271 break;
 272 case LFS_MAGIC_SWAPPED:
 273 fs->lfs_is64 = false;
 274 fs->lfs_dobyteswap = true;
 275 break;
 276 case LFS64_MAGIC:
 277 fs->lfs_is64 = true;
 278 fs->lfs_dobyteswap = false;
 279 break;
 280 case LFS64_MAGIC_SWAPPED:
 281 fs->lfs_is64 = true;
 282 fs->lfs_dobyteswap = true;
 283 break;
 284 default:
268 syslog(LOG_ERR, "%s: not LFS", fsname); 285 syslog(LOG_ERR, "%s: not LFS", fsname);
269 return -1; 286 return -1;
270 } 287 }
271 fs->lfs_is64 = 0; /* XXX notyet */ 
272 fs->lfs_dobyteswap = 0; /* XXX notyet */ 
273 /* XXX: can this ever need to be set? does the cleaner even care? */ 288 /* XXX: can this ever need to be set? does the cleaner even care? */
274 fs->lfs_hasolddirfmt = 0; 289 fs->lfs_hasolddirfmt = 0;
275 290
276 /* If this is not a version 2 filesystem, complain and exit */ 291 /* If this is not a version 2 filesystem, complain and exit */
277 if (lfs_sb_getversion(fs) != 2) { 292 if (lfs_sb_getversion(fs) != 2) {
278 syslog(LOG_ERR, "%s: not a version 2 LFS", fsname); 293 syslog(LOG_ERR, "%s: not a version 2 LFS", fsname);
279 return -1; 294 return -1;
280 } 295 }
281 296
282 /* Assume fsname is the mounted name */ 297 /* Assume fsname is the mounted name */
283 strncpy(mnttmp, fsname, sizeof(mnttmp)); 298 strncpy(mnttmp, fsname, sizeof(mnttmp));
284 mnttmp[sizeof(mnttmp) - 1] = '\0'; 299 mnttmp[sizeof(mnttmp) - 1] = '\0';
285 lfs_sb_setfsmnt(fs, mnttmp); 300 lfs_sb_setfsmnt(fs, mnttmp);